@qratilabs/qrati-connect 2.24.3 → 2.26.0

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 (85) hide show
  1. package/element/1dmOpMwn2.js +1 -0
  2. package/element/2CzUGwUv.js +1 -0
  3. package/element/{CVRTTCyF.js → BBWyJmHC.js} +1 -1
  4. package/element/BNaRcekR2.js +1 -0
  5. package/element/BXZi_HIE.js +4 -0
  6. package/element/Bb4v1eCh2.js +14 -0
  7. package/element/{qQ9Xx6H32.js → BfPopwQu2.js} +8 -8
  8. package/element/{BXcQi_eR2.js → BlD6lUxS.js} +4 -4
  9. package/element/BlmPmkho.js +41 -0
  10. package/element/BmU1kgIz2.js +39 -0
  11. package/element/Bo39kG4k2.js +1 -0
  12. package/element/{CJXPO3HP.js → Bt5DH8OK.js} +1 -1
  13. package/element/{BccTn5v-2.js → BvrbBj1F.js} +1 -1
  14. package/element/BwwxqSTC2.js +1 -0
  15. package/element/{CgUphJWo.js → C7zv6hcG.js} +1 -1
  16. package/element/CBLQRRGX2.js +3 -0
  17. package/element/{Bavdi2yc2.js → CCDjXLSf.js} +35 -35
  18. package/element/CD7ZeUsI2.js +9 -0
  19. package/element/CDUjv5F52.js +1 -0
  20. package/element/{CATr-3VW.js → CE4Zhv-W.js} +1 -1
  21. package/element/{CsfDBJh72.js → CM46pkhP2.js} +2 -2
  22. package/element/CMR1TPJ1.js +3 -0
  23. package/element/CVdpS1mF2.js +9 -0
  24. package/element/{DF0LxcV7.js → CitgNM58.js} +1 -1
  25. package/element/{mQzpzQ_t.js → CpYO5bBq.js} +1 -1
  26. package/element/Cqyszkb5.js +1 -0
  27. package/element/{C3dOFk9A.js → CtWIgfGz.js} +1 -1
  28. package/element/CtxIOzTC2.js +1 -0
  29. package/element/Cw3szkAB.js +1 -0
  30. package/element/CwPz_TbG.js +4 -0
  31. package/element/CzHEb5lR2.js +36 -0
  32. package/element/D6nJgjWV.js +5 -0
  33. package/element/{DlqJDAie2.js → D9UPX_0d2.js} +1 -1
  34. package/element/DAjJ8IJf.js +1 -0
  35. package/element/{iuooW4mt.js → DBUAmPz_.js} +8 -8
  36. package/element/DDyjgYNE.js +1 -0
  37. package/element/{Ctl9NdWl2.js → DER_7fjj2.js} +1 -1
  38. package/element/DLSVYuRG.js +8 -0
  39. package/element/DdACKOZr.js +1 -0
  40. package/element/DhbEeiM3.js +8 -0
  41. package/element/DpD2Abx9.js +1 -0
  42. package/element/DvW8TE7T.js +1 -0
  43. package/element/{DGbyGc8b.js → DwanMJWW.js} +1 -1
  44. package/element/KcnPb5CZ.js +1 -0
  45. package/element/L4hWU3Nc.js +1 -0
  46. package/element/{ChJXhA9c.js → OGzsLhnG.js} +1 -1
  47. package/element/{BCTYvPrD.js → OnH8Izqn.js} +1 -1
  48. package/element/Ot24jlyb2.js +1 -0
  49. package/element/{DZtaQWVG2.js → PRmGsKkz2.js} +1 -1
  50. package/element/PVzBLdl-2.js +5 -0
  51. package/element/VF9qDLJE2.js +1 -0
  52. package/element/{2CMH9VMM.js → X0P7ujR0.js} +1 -1
  53. package/element/b3Wjw4T02.js +16 -0
  54. package/element/{DnQ6XaLR.js → nOtAuUm1.js} +1 -1
  55. package/element/uIYtFcCq2.js +93 -0
  56. package/element/web.es.js +42 -44
  57. package/element/xW6UboQF.js +3 -0
  58. package/package.json +1 -1
  59. package/element/BDrHm_qM.js +0 -9
  60. package/element/BZu3c37u.js +0 -1
  61. package/element/BxErY-nv.js +0 -7
  62. package/element/C12iSy3L.js +0 -1
  63. package/element/C9kBlCZx2.js +0 -3
  64. package/element/CIag4I7h2.js +0 -35
  65. package/element/CM46vluW.js +0 -1
  66. package/element/CQBd8iaX2.js +0 -4
  67. package/element/CZbEGemi2.js +0 -4
  68. package/element/CaX2xgrP.js +0 -41
  69. package/element/Cko4QHwX.js +0 -1
  70. package/element/CqBk9L5O.js +0 -1
  71. package/element/Cy-MvajD2.js +0 -39
  72. package/element/CyG7i8682.js +0 -14
  73. package/element/D234gMVd2.js +0 -5
  74. package/element/D340VADc2.js +0 -3
  75. package/element/D5TKEdBd2.js +0 -3
  76. package/element/DNay1z3B2.js +0 -93
  77. package/element/DUIv5AtW2.js +0 -8
  78. package/element/DWBbTgnB.js +0 -8
  79. package/element/EjMoIoSK.js +0 -1
  80. package/element/Z0-Tddye2.js +0 -16
  81. package/element/dT6WSX65.js +0 -1
  82. package/element/h4ZjZXfe2.js +0 -1
  83. /package/element/{CfMNBPpx2.js → CfMNBPpx.js} +0 -0
  84. /package/element/{DPg_DKOi.js → DPg_DKOi2.js} +0 -0
  85. /package/element/{DnIueBGr2.js → DnIueBGr.js} +0 -0
@@ -0,0 +1,41 @@
1
+ import{E as e,_ as t,h as r,p as s,r as o,s as n,t as i,v as a,y as c}from"./DrrpB4Om.js";import{S as u,h as l,i as h}from"./DpD2Abx9.js";var d={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},f=new class{#e=d;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},p="undefined"==typeof window||"Deno"in globalThis;function m(){}function y(e,t){return"function"==typeof e?e(t):e}function g(e){return"number"==typeof e&&e>=0&&e!==1/0}function w(e,t){return Math.max(e+(t||0)-Date.now(),0)}function b(e,t){return"function"==typeof e?e(t):e}function v(e,t){return"function"==typeof e?e(t):e}function R(e,t){const{type:r="all",exact:s,fetchStatus:o,predicate:n,queryKey:i,stale:a}=e;if(i)if(s){if(t.queryHash!==T(i,t.options))return!1}else if(!O(t.queryKey,i))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||o&&o!==t.state.fetchStatus||n&&!n(t))}function S(e,t){const{exact:r,status:s,predicate:o,mutationKey:n}=e;if(n){if(!t.options.mutationKey)return!1;if(r){if(E(t.options.mutationKey)!==E(n))return!1}else if(!O(t.options.mutationKey,n))return!1}return!(s&&t.state.status!==s||o&&!o(t))}function T(e,t){return(t?.queryKeyHashFn||E)(e)}function E(e){return JSON.stringify(e,(e,t)=>x(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function O(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>O(e[r],t[r]))}var C=Object.prototype.hasOwnProperty;function P(e,t,r=0){if(e===t)return e;if(r>500)return t;const s=A(e)&&A(t);if(!(s||x(e)&&x(t)))return t;const o=(s?e:Object.keys(e)).length,n=s?t:Object.keys(t),i=n.length,a=s?new Array(i):{};let c=0;for(let u=0;u<i;u++){const i=s?u:n[u],l=e[i],h=t[i];if(l===h){a[i]=l,(s?u<o:C.call(e,i))&&c++;continue}if(null===l||null===h||"object"!=typeof l||"object"!=typeof h){a[i]=h;continue}const d=P(l,h,r+1);a[i]=d,d===l&&c++}return o===i&&c===o?e:a}function q(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 A(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function x(e){if(!I(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!I(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function I(e){return"[object Object]"===Object.prototype.toString.call(e)}function k(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?P(e,t):t}function F(e,t,r=0){const s=[...e,t];return r&&s.length>r?s.slice(1):s}function D(e,t,r=0){const s=[t,...e];return r&&s.length>r?s.slice(0,-1):s}var j=/* @__PURE__ */Symbol();function L(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 M(e,t){return"function"==typeof e?e(...t):!!e}var U=/* @__PURE__ */(()=>{let e=()=>p;return{isServer:()=>e(),setIsServer(t){e=t}}})(),N=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(){}},H=new class extends N{#r;#s;#o;constructor(){super(),this.#o=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#s||this.setEventListener(this.#o)}onUnsubscribe(){this.hasListeners()||(this.#s?.(),this.#s=void 0)}setEventListener(e){this.#o=e,this.#s?.(),this.#s=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#r!==e&&(this.#r=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#r?this.#r:"hidden"!==globalThis.document?.visibilityState}},Q=function(e){setTimeout(e,0)},_=function(){let e=[],t=0,r=e=>{e()},s=e=>{e()},o=Q;const n=s=>{t?e.push(s):o(()=>{r(s)})};return{batch:n=>{let i;t++;try{i=n()}finally{t--,t||(()=>{const t=e;e=[],t.length&&o(()=>{s(()=>{t.forEach(e=>{r(e)})})})})()}return i},batchCalls:e=>(...t)=>{n(()=>{e(...t)})},schedule:n,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{s=e},setScheduler:e=>{o=e}}}(),$=new class extends N{#n=!0;#s;#o;constructor(){super(),this.#o=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.#s||this.setEventListener(this.#o)}onUnsubscribe(){this.hasListeners()||(this.#s?.(),this.#s=void 0)}setEventListener(e){this.#o=e,this.#s?.(),this.#s=e(this.setOnline.bind(this))}setOnline(e){this.#n!==e&&(this.#n=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#n}};function z(){let e,t;const r=new Promise((r,s)=>{e=r,t=s});function s(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{s({status:"fulfilled",value:t}),e(t)},r.reject=e=>{s({status:"rejected",reason:e}),t(e)},r}function B(e){return Math.min(1e3*2**e,3e4)}function V(e){return"online"!==(e??"online")||$.isOnline()}var W=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function G(e){let t,r=!1,s=0;const o=z(),n=()=>"pending"!==o.status,i=()=>H.isFocused()&&("always"===e.networkMode||$.isOnline())&&e.canRun(),a=()=>V(e.networkMode)&&e.canRun(),c=e=>{n()||(t?.(),o.resolve(e))},u=e=>{n()||(t?.(),o.reject(e))},l=()=>new Promise(r=>{t=e=>{(n()||i())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,n()||e.onContinue?.()}),h=()=>{if(n())return;let t;const o=0===s?e.initialPromise:void 0;try{t=o??e.fn()}catch(a){t=Promise.reject(a)}Promise.resolve(t).then(c).catch(t=>{if(n())return;const o=e.retry??(U.isServer()?0:3),a=e.retryDelay??B,c="function"==typeof a?a(s,t):a,d=!0===o||"number"==typeof o&&s<o||"function"==typeof o&&o(s,t);var p;!r&&d?(s++,e.onFail?.(s,t),(p=c,new Promise(e=>{f.setTimeout(e,p)})).then(()=>i()?void 0:l()).then(()=>{r?u(t):h()})):u(t)})};return{promise:o,status:()=>o.status,cancel:t=>{if(!n()){const r=new W(t);u(r),e.onCancel?.(r)}},continue:()=>(t?.(),o),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:a,start:()=>(a()?h():l().then(h),o)}}var Z=class{#i;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),g(this.gcTime)&&(this.#i=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(U.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#i&&(f.clearTimeout(this.#i),this.#i=void 0)}};function J(e){return{onFetch:(t,r)=>{const s=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,n=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let r=!1;const u=e=>{!function(e,r,s){let o,n=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t.signal,n||(n=!0,o.aborted?s():o.addEventListener("abort",s,{once:!0})),o)})}(e,0,()=>r=!0)},l=L(t.options,t.fetchOptions),h=async(e,s,o)=>{if(r)return Promise.reject(t.signal.reason);if(null==s&&e.pages.length)return Promise.resolve(e);const n=await l((()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:s,direction:o?"backward":"forward",meta:t.options.meta};return u(e),e})()),{maxPages:i}=t.options,a=o?D:F;return{pages:a(e.pages,n,i),pageParams:a(e.pageParams,s,i)}};if(o&&n.length){const e="backward"===o,t=e?X:K,r={pages:n,pageParams:i};a=await h(r,t(s,r),e)}else{const t=e??n.length;do{const e=0===c?i[0]??s.initialPageParam:K(s,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?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function K(e,{pages:t,pageParams:r}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,r[s],r):void 0}function X(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function Y(e,t){return!!t&&null!=K(e,t)}function ee(e,t){return!(!t||!e.getPreviousPageParam)&&null!=X(e,t)}var te=class extends Z{#a;#c;#u;#l;#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.#l=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.#l.remove(this)}setData(e,t){const r=k(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(m).catch(m):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!==v(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"===b(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||!w(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.#l.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.#y()?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#l.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#y(){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,s=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,r.signal)})},o=()=>{const e=L(this.options,t),r=(()=>{const e={client:this.#h,queryKey:this.queryKey,meta:this.meta};return s(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,r,this):e(r)},n=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#h,state:this.state,fetchFn:o};return s(e),e})();("infinite"===this.#a?J(this.options.pages):this.options.behavior)?.onFetch(n,this),this.#u=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===n.fetchOptions?.meta||this.#m({type:"fetch",meta:n.fetchOptions?.meta}),this.#d=G({initialPromise:t?.initialPromise,fn:n.fetchFn,onCancel:e=>{e instanceof W&&e.revert&&this.setState({...this.#u,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:n.options.retry,retryDelay:n.options.retryDelay,networkMode:n.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.#l.config.onSuccess?.(e,this),this.#l.config.onSettled?.(e,this.state.error,this),e}catch(i){if(i instanceof W){if(i.silent)return this.#d.promise;if(i.revert){if(void 0===this.state.data)throw i;return this.state.data}}throw this.#m({type:"error",error:i}),this.#l.config.onError?.(i,this),this.#l.config.onSettled?.(this.state.data,i,this),i}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,...re(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.#u=e.manual?r:void 0,r;case"error":const s=e.error;return{...t,error:s,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),_.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#l.notify({query:this,type:"updated",action:e})})}};function re(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:V(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,s=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var ne=class extends N{constructor(e,t){super(),this.options=t,this.#h=e,this.#g=null,this.#w=z(),this.bindMethods(),this.setOptions(t)}#h;#b=void 0;#v=void 0;#R=void 0;#S;#T;#w;#g;#E;#O;#C;#P;#q;#A;#x=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),ie(this.#b,this.options)?this.#I():this.updateResult(),this.#k())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ae(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ae(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#F(),this.#D(),this.#b.removeObserver(this)}setOptions(e){const t=this.options,r=this.#b;if(this.options=this.#h.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof v(this.options.enabled,this.#b))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#b.setOptions(this.options),t._defaulted&&!q(this.options,t)&&this.#h.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});const s=this.hasListeners();s&&ce(this.#b,r,this.options,t)&&this.#I(),this.updateResult(),!s||this.#b===r&&v(this.options.enabled,this.#b)===v(t.enabled,this.#b)&&b(this.options.staleTime,this.#b)===b(t.staleTime,this.#b)||this.#L();const o=this.#M();!s||this.#b===r&&v(this.options.enabled,this.#b)===v(t.enabled,this.#b)&&o===this.#A||this.#U(o)}getOptimisticResult(e){const t=this.#h.getQueryCache().build(this.#h,e),r=this.createResult(t,e);var s;return s=r,q(this.getCurrentResult(),s)||(this.#R=r,this.#T=this.options,this.#S=this.#b.state),r}getCurrentResult(){return this.#R}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.#w.status||this.#w.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#x.add(e)}getCurrentQuery(){return this.#b}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.#I({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#R))}#I(e){this.#j();let t=this.#b.fetch(this.options,e);return e?.throwOnError||(t=t.catch(m)),t}#L(){this.#F();const e=b(this.options.staleTime,this.#b);if(U.isServer()||this.#R.isStale||!g(e))return;const t=w(this.#R.dataUpdatedAt,e)+1;this.#P=f.setTimeout(()=>{this.#R.isStale||this.updateResult()},t)}#M(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(e){this.#D(),this.#A=e,!U.isServer()&&!1!==v(this.options.enabled,this.#b)&&g(this.#A)&&0!==this.#A&&(this.#q=f.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#I()},this.#A))}#k(){this.#L(),this.#U(this.#M())}#F(){void 0!==this.#P&&(f.clearTimeout(this.#P),this.#P=void 0)}#D(){void 0!==this.#q&&(f.clearInterval(this.#q),this.#q=void 0)}createResult(e,t){const r=this.#b,s=this.options,o=this.#R,n=this.#S,i=this.#T,a=e!==r?e.state:this.#v,{state:c}=e;let u,l={...c},h=!1;if(t._optimisticResults){const o=this.hasListeners(),n=!o&&ie(e,t),i=o&&ce(e,r,t,s);(n||i)&&(l={...l,...re(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(l.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=l;u=l.data;let m=!1;if(void 0!==t.placeholderData&&void 0===u&&"pending"===p){let e;o?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(e=o.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#C?.state.data,this.#C):t.placeholderData,void 0!==e&&(p="success",u=k(o?.data,e,t),h=!0)}if(t.select&&void 0!==u&&!m)if(o&&u===n?.data&&t.select===this.#E)u=this.#O;else try{this.#E=t.select,u=t.select(u),u=k(o?.data,u,t),this.#O=u,this.#g=null}catch(T){this.#g=T}this.#g&&(d=this.#g,u=this.#O,f=Date.now(),p="error");const y="fetching"===l.fetchStatus,g="pending"===p,w="error"===p,b=g&&y,R=void 0!==u,S={status:p,fetchStatus:l.fetchStatus,isPending:g,isSuccess:"success"===p,isError:w,isInitialLoading:b,isLoading:b,data:u,dataUpdatedAt:l.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>a.dataUpdateCount||l.errorUpdateCount>a.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:w&&!R,isPaused:"paused"===l.fetchStatus,isPlaceholderData:h,isRefetchError:w&&R,isStale:ue(e,t),refetch:this.refetch,promise:this.#w,isEnabled:!1!==v(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==S.data,s="error"===S.status&&!t,o=e=>{s?e.reject(S.error):t&&e.resolve(S.data)},n=()=>{o(this.#w=S.promise=z())},i=this.#w;switch(i.status){case"pending":e.queryHash===r.queryHash&&o(i);break;case"fulfilled":(s||S.data!==i.value)&&n();break;case"rejected":s&&S.error===i.reason||n()}}return S}updateResult(){const e=this.#R,t=this.createResult(this.#b,this.options);this.#S=this.#b.state,this.#T=this.options,void 0!==this.#S.data&&(this.#C=this.#b),q(t,e)||(this.#R=t,this.#N({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 s=new Set(r??this.#x);return this.options.throwOnError&&s.add("error"),Object.keys(this.#R).some(t=>{const r=t;return this.#R[r]!==e[r]&&s.has(r)})})()}))}#j(){const e=this.#h.getQueryCache().build(this.#h,this.options);if(e===this.#b)return;const t=this.#b;this.#b=e,this.#v=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#k()}#N(e){_.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#R)}),this.#h.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function ie(e,t){return function(e,t){return!1!==v(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===v(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&ae(e,t,t.refetchOnMount)}function ae(e,t,r){if(!1!==v(t.enabled,e)&&"static"!==b(t.staleTime,e)){const s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&ue(e,t)}return!1}function ce(e,t,r,s){return(e!==t||!1===v(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&ue(e,r)}function ue(e,t){return!1!==v(t.enabled,e)&&e.isStaleByTime(b(t.staleTime,e))}var le=e(void 0),he=e=>{const t=c(le);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},de=({client:e,children:r})=>(t(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */i(le.Provider,{value:e,children:r})),fe=e(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),pe=e(!1),me=(pe.Provider,(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()}));function ye(e,s,n){const i=c(pe),u=c(fe),l=he(n),h=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(h);const d=l.getQueryCache().get(h.queryHash),f=!1!==e.subscribed;h._optimisticResults=i?"isRestoring":f?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),s=e.staleTime;e.staleTime="function"==typeof s?(...e)=>r(s(...e)):r(s),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(h),((e,t,r)=>{const s=r?.state.error&&"function"==typeof e.throwOnError?M(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))})(h,u,d),(e=>{t(()=>{e.clearReset()},[e])})(u);const p=!l.getQueryCache().get(h.queryHash),[y]=r(()=>new s(l,h)),g=y.getOptimisticResult(h),w=!i&&f;if(o(a(e=>{const t=w?y.subscribe(_.batchCalls(e)):m;return y.updateResult(),t},[y,w]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),t(()=>{y.setOptions(h)},[h,y]),((e,t)=>e?.suspense&&t.isPending)(h,g))throw me(h,y,u);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(o&&void 0===e.data||M(r,[e.error,s])))({result:g,errorResetBoundary:u,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw g.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(h,g),h.experimental_prefetchInRender&&!U.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(g,i)&&(p?me(h,y,u):d?.promise)?.catch(m).finally(()=>{y.updateResult()}),h.notifyOnChangeProps?g:y.trackResult(g)}function ge(e,t){return ye(e,ne,t)}var we=class extends Error{name="KyError";get isKyError(){return!0}},be=class extends we{name="HTTPError";response;request;options;data;constructor(e,t,r){const s=`${e.status||0===e.status?e.status:""} ${e.statusText??""}`.trim();super(`Request failed with ${s?`status code ${s}`:"an unknown error"}: ${t.method} ${t.url}`),this.response=e,this.request=t,this.options=r}},ve=class extends we{name="NetworkError";request;constructor(e,t){super(`Request failed due to a network error: ${e.method} ${e.url}`,t),this.request=e}},Re=class extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}},Se=class extends we{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new Re(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}},Te=class extends Error{name="SchemaValidationError";issues;constructor(e){super("Response schema validation failed"),this.issues=e}},Ee=class extends we{name="TimeoutError";request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.request=e}},Oe=(()=>{let e=!1,t=!1;const r="function"==typeof globalThis.ReadableStream,s="function"==typeof globalThis.Request;if(r&&s)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(o){if(o instanceof Error&&"unsupported BodyInit type"===o.message)return!1;throw o}return e&&!t})(),Ce="function"==typeof globalThis.AbortController,Pe="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,qe="function"==typeof globalThis.ReadableStream,Ae="function"==typeof globalThis.FormData,xe=["get","post","put","patch","head","delete"],Ie={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},ke=Symbol("stop"),Fe=class{options;constructor(e){this.options=e}},De=e=>new Fe(e),je={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Le={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Me=new TextEncoder,Ue=(e,t,r)=>{let s,o=0;return e.pipeThrough(new TransformStream({transform(e,n){if(n.enqueue(e),s){o+=s.byteLength;let e=0===t?0:o/t;e>=1&&(e=1-Number.EPSILON),r?.({percent:e,totalBytes:Math.max(t,o),transferredBytes:o},s)}s=e},flush(){s&&(o+=s.byteLength,r?.({percent:1,totalBytes:Math.max(t,o),transferredBytes:o},s))}}))},Ne=e=>null!==e&&"object"==typeof e,He=Symbol("replaceOption"),Qe=e=>Ne(e)&&!0===e[He]?{isReplace:!0,value:e.value}:{isReplace:!1,value:e},_e=(...e)=>{for(const t of e)if((!Ne(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return Ke({},...e)},$e=(e={},t={})=>{const r=new globalThis.Headers(e),s=t instanceof globalThis.Headers,o=new globalThis.Headers(t);for(const[n,i]of o.entries())s&&"undefined"===i||void 0===i?r.delete(n):r.set(n,i);return r},ze=e=>{if(!Ne(e)||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t},Be=e=>{if(e instanceof URLSearchParams){const t=new URLSearchParams(e),r=e[Ze];return r&&(t[Ze]=new Set(r)),t}return e instanceof globalThis.Headers?new globalThis.Headers(e):Array.isArray(e)?[...e]:ze(e)?{...e}:e},Ve=(e,t)=>{return ze(e)&&ze(t)?(r={...e,...t},Object.fromEntries(Object.entries(r).filter(e=>void 0!==e[1]))):$e(e,t);var r};function We(e,t,r){return Object.hasOwn(t,r)&&void 0===t[r]?[]:Ke(e[r]??[],t[r]??[])}var Ge=(e={},t={})=>({init:We(e,t,"init"),beforeRequest:We(e,t,"beforeRequest"),beforeRetry:We(e,t,"beforeRetry"),beforeError:We(e,t,"beforeError"),afterResponse:We(e,t,"afterResponse")}),Ze=Symbol("deletedParameters"),Je=(e,t)=>{const r=new URLSearchParams,s=/* @__PURE__ */new Set;for(const o of[e,t])if(void 0!==o)if(o instanceof URLSearchParams){for(const[t,n]of o.entries())r.append(t,n),s.delete(t);const e=o[Ze];if(e)for(const t of e)r.delete(t),s.add(t)}else if(Array.isArray(o))for(const e of o){if(!Array.isArray(e)||2!==e.length)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(e[0]),String(e[1])),s.delete(String(e[0]))}else if(Ne(o))for(const[e,t]of Object.entries(o))void 0===t?(r.delete(e),s.add(e)):(r.append(e,String(t)),s.delete(e));else{const e=new URLSearchParams(o);for(const[t,o]of e.entries())r.append(t,o),s.delete(t)}return s.size>0&&(r[Ze]=s),r},Ke=(...e)=>{let t,r={},s={},o={};const n=[];for(const i of e)if(Array.isArray(i))Array.isArray(r)||(r=[]),r=[...r,...i];else if(Ne(i)){for(let[e,s]of Object.entries(i)){if("signal"===e&&s instanceof globalThis.AbortSignal){n.push(s);continue}const o=Qe(s),{isReplace:i}=o;if(s=o.value,"context"!==e)"searchParams"!==e?(Ne(s)&&!i&&e in r&&(s=Ke(r[e],s)),r={...r,[e]:s}):t=null==s?void 0:i||void 0===t?s:Je(t,s);else{if(null!=s&&(!Ne(s)||Array.isArray(s)))throw new TypeError("The `context` option must be an object");r={...r,context:null==s?{}:i?{...s}:{...r.context,...s}}}}if(Ne(i.hooks)){const{value:e,isReplace:t}=Qe(i.hooks);o=Ge(t?{}:o,e),r.hooks=o}if(Ne(i.headers)){const{value:e,isReplace:t}=Qe(i.headers);s=t?Be(e):Ve(s,e),r.headers=s}}return void 0!==t&&(r.searchParams=t),n.length>0&&(1===n.length?r.signal=n[0]:r.signal=Pe?AbortSignal.any(n):n.at(-1)),r},Xe=e=>xe.includes(e)?e.toUpperCase():e,Ye={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},et=(e={})=>{if("number"==typeof e)return{...Ye,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");const t=Object.fromEntries(Object.entries({...e,methods:e.methods?.map(e=>e.toLowerCase())}).filter(([,e])=>void 0!==e));return{...Ye,...t}};async function tt(e,{signal:t}){return new Promise((r,s)=>{function o(){clearTimeout(n),s(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",o,{once:!0}));const n=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e)})}var rt=Object.prototype.toString,st=/* @__PURE__ */new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);var ot=(e,t)=>e instanceof t||e?.name===t.name,nt=Symbol("timedOutResponseData"),it="The `schema` argument must follow the Standard Schema specification",at=Object.prototype.toString,ct=e=>e instanceof globalThis.Request||"[object Request]"===at.call(e),ut=e=>e instanceof globalThis.Response||"[object Response]"===at.call(e),lt=async(e,t)=>{if("object"!=typeof t&&"function"!=typeof t||null===t)throw new TypeError(it);const r=t["~standard"];if("object"!=typeof r||null===r||"function"!=typeof r.validate)throw new TypeError(it);const s=await r.validate(e);if(s.issues)throw new Te(s.issues);return s.value},ht=class e{static create(t,r){const s=r.hooks?.init??[],o=s.length>0?function(e){const t={...e,json:Be(e.json),context:Be(e.context),headers:Be(e.headers),searchParams:(r=e.searchParams,Array.isArray(r)?r.map(e=>[...e]):Be(r))};var r;return void 0!==e.retry&&(t.retry=(e=>"object"!=typeof e?e:{...e,...e.methods&&{methods:[...e.methods]},...e.statusCodes&&{statusCodes:[...e.statusCodes]},...e.afterStatusCodes&&{afterStatusCodes:[...e.afterStatusCodes]}})(e.retry)),t}(r):r;for(const e of s)e(o);const n=new e(t,o),i=(async()=>{try{return await(async()=>{if("number"==typeof n.#H.timeout&&n.#H.timeout>2147483647)throw new RangeError("The `timeout` option cannot be greater than 2147483647");if("number"==typeof n.#H.totalTimeout&&n.#H.totalTimeout>2147483647)throw new RangeError("The `totalTimeout` option cannot be greater than 2147483647");await Promise.resolve();const e=await n.#Q();let t=e??await n.#_(async()=>n.#$()),r=void 0!==e||n.#z();for(;;){if(void 0===t)return t;if(ut(t))try{t=await n.#B(t)}catch(s){if(!(s instanceof Se))throw s;const e=await n.#V(s,async()=>n.#$());if(void 0===e)return e;t=e,r=n.#z();continue}const e=t;if(!e.ok&&"opaque"!==e.type&&("function"==typeof n.#H.throwHttpErrors?n.#H.throwHttpErrors(e.status):n.#H.throwHttpErrors)){const s=new be(e,n.#W(e),n.#G()),o=s;if(s.data=await n.#Z(e),r)throw o;const i=await n.#V(s,async()=>n.#$());if(void 0===i)return i;t=i,r=n.#z();continue}break}if(!ut(t))return t;if(n.#J(t),n.#H.onDownloadProgress){if("function"!=typeof n.#H.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!qe)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const e=t.clone();return n.#K(t),((e,t)=>{if(!e.body)return e;const r={status:e.status,statusText:e.statusText,headers:e.headers};if(204===e.status)return new Response(null,r);const s=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(Ue(e.body,s,t),r)})(e,n.#H.onDownloadProgress)}return t})()}catch(e){if(!(e instanceof Error))throw e;if(n.#X.has(e))throw e;let t=e;for(const r of n.#H.hooks.beforeError){const e=await r({request:n.request,options:n.#G(),error:t,retryCount:n.#Y});e instanceof Error&&(t=e)}throw t}finally{const e=n.#ee;n.#te(e?.body??void 0),n.request!==e&&n.#te(n.request.body??void 0)}})();for(const[e,a]of Object.entries(Ie))"bytes"===e&&"function"!=typeof globalThis.Response?.prototype?.bytes||(i[e]=async t=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);const r=await i;if("json"!==e)return r[e]();const s=await r.text();if(""===s)return void 0!==t?lt(void 0,t):JSON.parse(s);const c=o.parseJson?await o.parseJson(s,{request:n.#W(r),response:r}):JSON.parse(s);return void 0===t?c:lt(c,t)});return i}static#re(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#se;#Y=0;#oe;#H;#ee;#ne;#X=/* @__PURE__ */new WeakSet;#ie;#ae;#ce=!1;#ue=/* @__PURE__ */new WeakMap;constructor(t,r={}){if(this.#oe=t,Object.hasOwn(r,"prefixUrl"))throw new Error("The `prefixUrl` option has been renamed `prefix` in v2 and enhanced to allow slashes in input. See also the new `baseUrl` option for improved flexibility with standard URL resolution: https://github.com/sindresorhus/ky#baseurl");if(this.#H={...r,headers:$e(this.#oe.headers,r.headers),hooks:Ge({},r.hooks),method:Xe(r.method??this.#oe.method??"GET"),prefix:String(r.prefix||""),retry:et(r.retry),throwHttpErrors:r.throwHttpErrors??!0,timeout:r.timeout??1e4,totalTimeout:r.totalTimeout??!1,fetch:r.fetch??globalThis.fetch.bind(globalThis),context:r.context??{}},"string"!=typeof this.#oe&&!(this.#oe instanceof URL||this.#oe instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if("string"==typeof this.#oe){if(this.#H.prefix){const e=this.#H.prefix.replace(/\/+$/,""),t=this.#oe.replace(/^\/+/,"");this.#oe=`${e}/${t}`}if(this.#H.baseUrl){let e;try{e=new URL(this.#oe)}catch{}e||(this.#oe=new URL(this.#oe,new Request(this.#H.baseUrl).url))}}Ce&&Pe&&(this.#ne=this.#H.signal??this.#oe.signal,this.#se=new globalThis.AbortController,this.#H.signal=this.#le()),Oe&&(this.#H.duplex="half"),void 0!==this.#H.json&&(this.#H.body=this.#H.stringifyJson?.(this.#H.json)??JSON.stringify(this.#H.json),this.#H.headers.set("content-type",this.#H.headers.get("content-type")??"application/json"));const s=r.headers&&new globalThis.Headers(r.headers).has("content-type");if(this.#oe instanceof globalThis.Request&&(Ae&&this.#H.body instanceof globalThis.FormData||this.#H.body instanceof URLSearchParams)&&!s&&this.#H.headers.delete("content-type"),this.request=new globalThis.Request(this.#oe,this.#H),void 0!==(o=this.#H.searchParams)&&(Array.isArray(o)?o.length>0:o instanceof URLSearchParams?o.size>0||Boolean(o[Ze]?.size):"object"==typeof o?Object.keys(o).length>0:"string"==typeof o?o.trim().length>0:Boolean(o))){const t=new URL(this.request.url),r=this.#H.searchParams?.[Ze];if(r)for(const e of r)t.searchParams.delete(e);if("string"==typeof this.#H.searchParams){const e=this.#H.searchParams.replace(/^\?/,"");""!==e&&(t.search=t.search?`${t.search}&${e}`:`?${e}`)}else{const r=new URLSearchParams(e.#re(this.#H.searchParams));for(const[e,s]of r.entries())t.searchParams.append(e,s)}if(this.#H.searchParams&&"object"==typeof this.#H.searchParams&&!Array.isArray(this.#H.searchParams)&&!(this.#H.searchParams instanceof URLSearchParams))for(const[e,s]of Object.entries(this.#H.searchParams))void 0===s&&t.searchParams.delete(e);this.request=new globalThis.Request(t,this.#H)}var o;if(this.#H.onUploadProgress&&"function"!=typeof this.#H.onUploadProgress)throw new TypeError("The `onUploadProgress` option must be a function");this.#ae="number"==typeof this.#H.totalTimeout?this.#he():void 0}#de(){const e=this.#H.retry.delay(this.#Y+1);let t=e;return!0===this.#H.retry.jitter?t=Math.random()*e:"function"==typeof this.#H.retry.jitter&&(t=this.#H.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e)),Math.min(this.#H.retry.backoffLimit,t)}async#fe(e){if(this.#Y>=this.#H.retry.limit)throw e;const t=e instanceof Error?e:new Re(e);if(t instanceof Se)return t.customDelay??this.#de();if(!this.#H.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#H.retry.shouldRetry){const r=await this.#H.retry.shouldRetry({error:t,retryCount:this.#Y+1});if(!1===r)throw e;if(!0===r)return this.#de()}if(function(e){return ot(e,Ee)}(e)){if(!this.#H.retry.retryOnTimeout)throw e;return this.#de()}if(function(e){return ot(e,be)}(e)){if(!this.#H.retry.statusCodes.includes(e.response.status))throw e;const t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#H.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);return Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now()),Number.isFinite(e)?(e=Math.max(0,e),Math.min(this.#H.retry.maxRetryAfter,e)):Math.min(this.#H.retry.maxRetryAfter,this.#de())}if(413===e.response.status)throw e;return this.#de()}if(!function(e){return ot(e,ve)}(e))throw e;return this.#de()}#J(e){const t=this.#W(e);return this.#H.parseJson&&(e.json=async()=>{const r=await e.text();return""===r?JSON.parse(r):this.#H.parseJson(r,{request:t,response:e})}),e}async#Z(e){const t=await this.#pe(e,this.#me());if(t===nt)return void this.#ye();if(!t)return;if(!this.#ge(e.headers.get("content-type")??""))return t;const r=await this.#we(t,e,this.#me(),this.#W(e));if(r!==nt)return r;this.#ye()}#me(){const e=!1===this.#H.timeout?1e4:this.#H.timeout,t=this.#be();if(void 0===t)return e;if(t<=0)throw new Ee(this.request);return Math.min(e,t)}#ge(e){const t=(e.split(";",1)[0]??"").trim().toLowerCase();return/\/(?:.*[.+-])?json$/.test(t)}async#pe(e,t){const{body:r}=e;if(!r)try{return await e.text()}catch{return}let s;try{s=r.getReader()}catch{return}const o=(e=>{const t=/;\s*charset\s*=\s*(?:"([^"]+)"|([^;,\s]+))/i.exec(e),r=t?.[1]??t?.[2];if(r)try{return new TextDecoder(r)}catch{}return new TextDecoder})(e.headers.get("content-type")??""),n=[];let i=0;const a=(async()=>{try{for(;;){const{done:e,value:t}=await s.read();if(e)break;if(i+=t.byteLength,i>10485760)return void s.cancel().catch(()=>{});n.push(o.decode(t,{stream:!0}))}}catch{return}return n.push(o.decode()),n.join("")})(),c=new Promise(e=>{const r=setTimeout(()=>{e(nt)},t);a.finally(()=>{clearTimeout(r)})}),u=await Promise.race([a,c]);return u===nt&&s.cancel().catch(()=>{}),u}async#we(e,t,r,s){let o;try{return await Promise.race([Promise.resolve().then(()=>this.#H.parseJson?this.#H.parseJson(e,{request:s,response:t}):JSON.parse(e)),new Promise(e=>{o=setTimeout(()=>{e(nt)},r)})])}catch{return}finally{clearTimeout(o)}}#te(e){e&&e.cancel().catch(()=>{})}#K(e){this.#te(e.body??void 0)}#le(){return this.#ne?AbortSignal.any([this.#ne,this.#se.signal]):this.#se.signal}#ye(){const e=this.#be();if(void 0!==e&&e<=0)throw new Ee(this.request)}async#Q(){for(const e of this.#H.hooks.beforeRequest){const t=await e({request:this.request,options:this.#G(),retryCount:0});if(ct(t))this.#ve(t);else if(ut(t))return t}}async#B(e){const t=this.#W(e);for(const s of this.#H.hooks.afterResponse){const o=this.#Re(e.clone(),t);let n;this.#J(o);try{n=await s({request:this.request,options:this.#G(),response:o,retryCount:this.#Y})}catch(r){throw o!==e&&this.#K(o),this.#K(e),r}if(n instanceof Fe)throw o!==e&&this.#K(o),this.#K(e),new Se(n.options);const i=ut(n)?this.#Re(n,t):e;o!==e&&o!==i&&o.body!==i.body&&this.#K(o),e!==i&&e.body!==i.body&&this.#K(e),e=i}return e}async#_(e){try{return await e()}catch(t){return this.#V(t,e)}}async#V(e,t){this.#ce=!1;const r=Math.min(await this.#fe(e),2147483647),s={signal:this.#ne},o=this.#be();if(void 0!==o){if(o<=0)throw new Ee(this.request);if(r>=o)throw await tt(o,s),new Ee(this.request)}if(await tt(r,s),this.#ye(),e instanceof Se&&e.customRequest){const t=new globalThis.Request(e.customRequest,this.#H.signal?{signal:this.#H.signal}:void 0);this.#ve(t)}for(const i of this.#H.hooks.beforeRetry){let t;try{t=await i({request:this.request,options:this.#G(),error:e,retryCount:this.#Y+1})}catch(n){throw n instanceof Error&&n!==e&&this.#X.add(n),n}if(ct(t)){this.#ve(t);break}if(ut(t))return this.#ce=!0,this.#Y++,t;if(t===ke)return}return this.#ye(),this.#Y++,this.#_(t)}#z(){const e=this.#ce;return this.#ce=!1,e}async#$(){this.#se?.signal.aborted&&(this.#se=new globalThis.AbortController,this.#H.signal=this.#le(),this.request=new globalThis.Request(this.request,{signal:this.#H.signal}));const e=(e=>{const t={};for(const r in e)Object.hasOwn(e,r)&&(r in Le||r in je||(t[r]=e[r]));return t})(this.#H),t=this.#H.retry.limit>0?this.request.clone():void 0,r=this.#Se(this.request,this.#H.body??void 0);this.#ee=r,t&&(this.request=t);try{const t=this.#be();if(void 0!==t&&t<=0)throw new Ee(this.request);const s=!1===this.#H.timeout?t:void 0===t?this.#H.timeout:Math.min(this.#H.timeout,t),o=void 0===s?await this.#H.fetch(r,e):await async function(e,t,r,s){return new Promise((o,n)=>{const i=setTimeout(()=>{r&&r.abort(),n(new Ee(e))},s.timeout);s.fetch(e,t).then(o).catch(n).then(()=>{clearTimeout(i)})})}(r,e,this.#se,{timeout:s,fetch:this.#H.fetch});return this.#Re(o,r)}catch(s){if(function(e){if(!e||(t=e,"[object Error]"!==rt.call(t))||"TypeError"!==e.name||"string"!=typeof e.message)return!1;var t;const{message:r,stack:s}=e;return"Load failed"===r?void 0===s||"__sentry_captured__"in e:!!r.startsWith("error sending request for url")||!!("Failed to fetch"===r||r.startsWith("Failed to fetch (")&&r.endsWith(")"))||st.has(r)}(s))throw new ve(this.request,{cause:s});throw s}}#be(){if(void 0===this.#ae)return;const e=this.#he()-this.#ae;return Math.max(0,this.#H.totalTimeout-e)}#he(){return globalThis.performance?.now()??Date.now()}#G(){if(!this.#ie){const{hooks:e,json:t,parseJson:r,stringifyJson:s,searchParams:o,timeout:n,totalTimeout:i,throwHttpErrors:a,fetch:c,...u}=this.#H;this.#ie=Object.freeze(u)}return this.#ie}#ve(e){this.#ie=void 0,this.request=e}#W(e){return this.#ue.get(e)??this.request}#Re(e,t){return this.#ue.set(e,t),e}#Se(e,t){return this.#H.onUploadProgress&&e.body&&Oe?((e,t,r)=>{if(!e.body)return e;const s=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[r,s]of e)t+=40,t+=Me.encode(`Content-Disposition: form-data; name="${r}"`).byteLength,t+="string"==typeof s?Me.encode(s).byteLength:s.size;return t}return e instanceof Blob?e.size:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:"string"==typeof e?Me.encode(e).byteLength:e instanceof URLSearchParams?Me.encode(e.toString()).byteLength:0})(r??e.body);return new Request(e,{duplex:"half",body:Ue(e.body,s,t)})})(e,this.#H.onUploadProgress,t??this.#H.body??void 0):e}},dt=e=>{const t=(t,r)=>ht.create(t,_e(e,r));for(const r of xe)t[r]=(t,s)=>ht.create(t,_e(e,s,{method:r}));return t.create=e=>dt(_e(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),dt(_e(e,t))),t.stop=ke,t.retry=De,t},ft=dt();function pt({title:e,children:t}){/* @__PURE__ */
2
+ return i("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[/* @__PURE__ */i("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__ */i("g",{transform:"translate(-443.142 -257.876)",children:[
3
+ /* @__PURE__ */i("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
+ /* @__PURE__ */i("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"}),
5
+ /* @__PURE__ */i("path",{d:"M754.171,630.2l-509.5-135.058a30.276,30.276,0,0,1-21.483-36.981L295.28,186.212a30.276,30.276,0,0,1,36.981-21.483l509.5,135.058a30.276,30.276,0,0,1,21.483,36.981L791.152,608.712A30.276,30.276,0,0,1,754.171,630.2Z",transform:"translate(220.958 94.156)",fill:"#f2f2f2"}),
6
+ /* @__PURE__ */i("path",{d:"M775.247,705.1H248.155a30.276,30.276,0,0,1-30.241-30.241V393.525a30.276,30.276,0,0,1,30.241-30.241H775.247a30.276,30.276,0,0,1,30.241,30.242V674.862A30.275,30.275,0,0,1,775.247,705.1Z",transform:"translate(319.149 22.09)",fill:"#fff"}),
7
+ /* @__PURE__ */i("path",{d:"M638.653,701.841H298.272c-.426,0-.852-.009-1.272-.033l160.985-90.663c3.065-1.762,9.943-2.382,15.361-1.385a13.912,13.912,0,0,1,4.26,1.385l108.041,60.842,5.176,2.911Z",transform:"translate(312.538 1.526)",fill:"#e6e6e6"}),
8
+ /* @__PURE__ */i("path",{d:"M760.145,704.279h-294.4l57.049-26.943L526.9,675.4l74.341-35.111c4.874-2.3,16.6-2.445,22.328-.434q.577.206,1.071.434Z",transform:"translate(298.432 -0.912)",fill:"#e6e6e6"}),
9
+ /* @__PURE__ */i("path",{d:"M248.322,365.284a28.441,28.441,0,0,0-28.409,28.409V675.03a28.441,28.441,0,0,0,28.409,28.409H775.415a28.441,28.441,0,0,0,28.409-28.409V393.693a28.441,28.441,0,0,0-28.409-28.409Z",transform:"translate(318.982 21.923)",fill:"#3f3d56"}),
10
+ /* @__PURE__ */i("path",{d:"M777.254,685.116H250.161a8.257,8.257,0,0,1-8.248-8.248V395.532a8.257,8.257,0,0,1,8.248-8.248H777.254a8.257,8.257,0,0,1,8.248,8.248V676.869a8.257,8.257,0,0,1-8.248,8.248Zm-527.092-296a6.422,6.422,0,0,0-6.415,6.415V676.869a6.422,6.422,0,0,0,6.415,6.415H777.254a6.422,6.422,0,0,0,6.415-6.415V395.532a6.422,6.422,0,0,0-6.415-6.415Z",transform:"translate(317.143 20.083)",fill:"#ccc"}),
11
+ /* @__PURE__ */i("ellipse",{cx:"71.849",cy:"89.934",rx:"71.849",ry:"89.934",transform:"translate(928.82 428.806)",fill:"#f2f2f2"}),
12
+ /* @__PURE__ */i("path",{d:"M505.77,325.365h.2l3.553,203.7h-7.5Z",transform:"translate(495.097 175.29)",fill:"#ccc"}),
13
+ /* @__PURE__ */i("path",{d:"M736.239,636.154h0a1.776,1.776,0,0,1-.744,2.4l-10.3,5.425-1.655-3.144,10.3-5.425A1.776,1.776,0,0,1,736.239,636.154Z",transform:"translate(276.882 -0.641)",fill:"#ccc"}),
14
+ /* @__PURE__ */i("ellipse",{cx:"71.849",cy:"89.934",rx:"71.849",ry:"89.934",transform:"translate(722.256 428.806)",fill:"#f2f2f2"}),
15
+ /* @__PURE__ */i("path",{d:"M510.532,627.307h0a1.777,1.777,0,0,0-2.4-.744l-7.194,3.788-2.464-141.27h-.2l-3.75,203.7h7.5l-1.02-58.456,8.78-4.622A1.777,1.777,0,0,0,510.532,627.307Z",transform:"translate(296.026 11.574)",fill:"#ccc"}),
16
+ /* @__PURE__ */i("path",{d:"M626.318,603.854a2.25,2.25,0,0,0-3.04-.943l-9.116,4.8-3.122-179h-.25l-4.752,258.115h9.5l-1.292-74.07,11.125-5.857a2.251,2.251,0,0,0,.943-3.04Z",transform:"translate(286.704 16.621)",fill:"#3f3d56"}),
17
+ /* @__PURE__ */i("path",{d:"M777.247,703.1H250.155a30.276,30.276,0,0,1-30.241-30.241V391.525a30.276,30.276,0,0,1,30.241-30.241H777.247a30.276,30.276,0,0,1,30.241,30.241V672.862A30.276,30.276,0,0,1,777.247,703.1Z",transform:"translate(318.982 22.257)",fill:"#fff"}),
18
+ /* @__PURE__ */i("path",{d:"M671.188,708.113h-370.8c-.464,0-.928-.01-1.386-.036l175.372-98.766c3.339-1.919,10.831-2.595,16.734-1.509a15.16,15.16,0,0,1,4.641,1.509l117.7,66.28,5.639,3.172Z",transform:"translate(288.046 16.168)",fill:"#f2f2f2"}),
19
+ /* @__PURE__ */i("path",{d:"M788.457,708.163H467.743l62.148-29.351,4.472-2.114,80.984-38.25c5.309-2.507,18.082-2.663,24.324-.473q.629.224,1.166.473Z",transform:"translate(287.761 16.118)",fill:"#f2f2f2"}),
20
+ /* @__PURE__ */i("path",{d:"M777.247,703.1H250.155a30.276,30.276,0,0,1-30.241-30.241V391.525a30.276,30.276,0,0,1,30.241-30.241H777.247a30.276,30.276,0,0,1,30.241,30.241V672.862A30.276,30.276,0,0,1,777.247,703.1ZM250.155,363.117a28.441,28.441,0,0,0-28.409,28.409V672.862a28.441,28.441,0,0,0,28.409,28.409H777.247a28.441,28.441,0,0,0,28.409-28.409V391.525a28.441,28.441,0,0,0-28.409-28.409Z",transform:"translate(318.982 22.257)",fill:"#3f3d56"}),
21
+ /* @__PURE__ */i("g",{transform:"translate(696.754 297.373)",children:[
22
+ /* @__PURE__ */i("ellipse",{cx:"61.798",cy:"61.798",rx:"61.798",ry:"61.798",transform:"translate(215.662 36.955)",fill:"#ff6584"}),
23
+ /* @__PURE__ */i("ellipse",{cx:"78.271",cy:"97.971",rx:"78.271",ry:"97.971",transform:"translate(225.025 127.808)",fill:"#e6e6e6"}),
24
+ /* @__PURE__ */i("path",{d:"M508.105,323.365h.215l3.87,221.909h-8.171Z",transform:"translate(-204.593 -117.286)",fill:"#ccc"}),
25
+ /* @__PURE__ */i("path",{d:"M739.374,634.239h0a1.935,1.935,0,0,1-.811,2.614l-11.226,5.91-1.8-3.425,11.226-5.91A1.935,1.935,0,0,1,739.374,634.239Z",transform:"translate(-422.513 -281.249)",fill:"#ccc"}),
26
+ /* @__PURE__ */i("ellipse",{cx:"78.271",cy:"97.971",rx:"78.271",ry:"97.971",transform:"translate(0 127.808)",fill:"#e6e6e6"}),
27
+ /* @__PURE__ */i("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
+ /* @__PURE__ */i("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__ */i("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__ */i("div",{className:"space-y-4",children:[/* @__PURE__ */i("h4",{className:"text-foreground text-center text-lg font-semibold",children:e}),/* @__PURE__ */i("p",{className:"text-muted-foreground text-center",children:t})]})]})}var mt=({organizationId:e})=>/* @__PURE__ */i("a",{className:"font-medium text-blue-500",href:l.ORGANIZATION_SETTINGS_INTEGRATION(e),target:"_blank",rel:"noreferrer",children:"Guide"});function yt({organizationId:e,errorType:t,errorMessage:r}){/* @__PURE__ */
30
+ return i(pt,"custom-auth-invalid"===t?{title:"Setup needed",children:["Custom auth is enabled. Pass ",
31
+ /* @__PURE__ */i("code",{children:"uid"}),", ",
32
+ /* @__PURE__ */i("code",{children:"fname"}),", and ",
33
+ /* @__PURE__ */i("code",{children:"lname"})," as props to QratiConnect to complete setup. See our ",
34
+ /* @__PURE__ */i(mt,{organizationId:e})," for details."]}:"service-unavailable"===t?{title:"We'll be right back!",children:["Our service is getting a quick tune-up. Hang tight — great things are coming your way soon! See our"," ",
35
+ /* @__PURE__ */i(mt,{organizationId:e})," if you need help in the meantime."]}:"generic-error"===t&&r?{title:"Setup needed",children:[r," See our ",
36
+ /* @__PURE__ */i(mt,{organizationId:e})," for details."]}:"page-not-registered"===t?{title:"Page not registered",children:["Add the current page URL in Allowed URLs under"," ",
37
+ /* @__PURE__ */i("a",{className:"font-medium text-blue-500",href:l.ORGANIZATION_SETTINGS(e),target:"_blank",rel:"noreferrer",children:"Organization Settings"})," ","⇨ Integration Settings. See our ",
38
+ /* @__PURE__ */i(mt,{organizationId:e})," for details."]}:{title:"Heads up",children:["Something needs attention. See our ",
39
+ /* @__PURE__ */i(mt,{organizationId:e})," for details or contact Qrati support."]})}var gt='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',wt=e=>e.trim().replace(/\s+/g," "),bt=e=>e?.replace(/\/+$/,"")||"",vt=e=>{if(!e)return gt;const t=wt("string"==typeof e?e:e.fontFamily||""),r="string"==typeof e?void 0:e.customFontName;return t&&"system"!==t?"custom"===t?`"${r||"QratiCustomFont"}", ${gt}`:`"${t}", ${gt}`:"inherit"};function Rt(e){var t,r,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Rt(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function St(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Rt(e))&&(s&&(s+=" "),s+=t);return s}var Tt=(...e)=>St(e.filter(Boolean)),Et=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"},Ot="px",Ct=(e,t="light")=>{const r=e?.themeSettings?.colors??{},s=e?.themeSettings?.border,o=e?.themeSettings?.shadow,n=e?.integrationSettings,i="dark"===t,a=(e,t,s,o)=>{const n=i?o:s;return r[i?t:e]||n},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":Et(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":`${s?.width??"1"}${s?.unit??"px"}`,"--radius":`${s?.radius??"10"}${s?.unit??"px"}`,"--shadow-outer-horizontal-offset":`${o?.outerHorizontalOffset??"0"}${o?.unit??Ot}`,"--shadow-outer-vertical-offset":`${o?.outerVerticalOffset??"0"}${o?.unit??Ot}`,"--shadow-outer-blur":`${o?.outerBlur??"0"}${o?.unit??Ot}`,"--shadow-outer-spread":`${o?.outerSpread??"0"}${o?.unit??Ot}`,...n?.fontFamily&&"system"!==n.fontFamily?{"--font-family":vt(n)}:{}}},Pt=async e=>{try{return await e()}catch{return null}},qt=(e,t=1)=>{const r=(new TextEncoder).encode(e),s=3432918353,o=461845907;let n=t>>>0;const i=Math.floor(r.length/4),a=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let h=0;h<i;h++){let e=a.getUint32(4*h,!0);e=Math.imul(e,s),e=e<<15|e>>>17,e=Math.imul(e,o),n^=e,n=n<<13|n>>>19,n=Math.imul(n,5)+3864292196>>>0}let c=0;const u=4*i,l=3&r.length;return 3===l&&(c^=r[u+2]<<16),l>=2&&(c^=r[u+1]<<8),l>=1&&(c^=r[u],c=Math.imul(c,s),c=c<<15|c>>>17,c=Math.imul(c,o),n^=c),n^=r.length,n^=n>>>16,n=Math.imul(n,2246822507)>>>0,n^=n>>>13,n=Math.imul(n,3266489909)>>>0,n^=n>>>16,n.toString(16).padStart(8,"0")},At=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(At).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const s of t){const t=e[s];void 0!==t&&r.push(`${At(s)}:${At(t)}`)}return`{${r.join(",")}}`},xt=async({debug:e=!1}={})=>{const t=performance.now(),r=await Pt(async()=>window.navigator.userAgentData&&"function"==typeof window.navigator.userAgentData.getHighEntropyValues?At(await window.navigator.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","model","fullVersionList"])):null),s=await Pt(()=>(()=>{const e=document.createElement("video"),t=["video/webm","video/mp4","video/ogg","audio/mp4","audio/webm","audio/ogg","audio/mpeg"],r={};for(const s of t){const t=e.canPlayType(s);r[s]=""===t?"no":t}return At(r)})()),o=await Pt(()=>(()=>{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 s={};for(const n of e)r.style.fontFamily=n,s[n]=r.offsetWidth;const o=[];for(const n of t){let t=!1;for(const i of e)if(r.style.fontFamily=`"${n}", ${i}`,r.offsetWidth!==s[i]){o.push(n),t=!0;break}t||(r.style.fontFamily=`"${n}"`,r.offsetWidth!==s.monospace&&r.offsetWidth!==s.serif&&o.push(n))}return document.body.removeChild(r),o.length?o.sort().join(","):null})()),n=await Pt(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),i=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,a=Intl.DateTimeFormat().resolvedOptions(),c=a.timeZone,u=/* @__PURE__ */(new Date).getTimezoneOffset(),l=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",y=window.matchMedia("(forced-colors: active)").matches?"active":null,g="number"==typeof window.devicePixelRatio?Math.round(100*window.devicePixelRatio)/100:null,{pixelDepth:w,colorDepth:b}=window.screen,v="ontouchstart"in window||window.navigator.maxTouchPoints>0,R=await Pt(()=>(async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),s=r.createLinearGradient(0,0,280,100);return s.addColorStop(0,"#f60"),s.addColorStop(.4,"#09f"),s.addColorStop(.7,"#f09"),s.addColorStop(1,"#0f9"),r.fillStyle=s,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)),qt(t.toDataURL("image/png"))})(e)),S=await Pt(()=>(async()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info");return qt(At({vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)}))})()),T=await Pt(()=>(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 qt(At(r))})(e)),E=await Pt(()=>(async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const s=t.createDynamicsCompressor();s.threshold.value=-48,s.knee.value=30,s.ratio.value=14,s.attack.value=0,s.release.value=.3;const o=t.createGain();o.gain.value=.4,r.connect(s),s.connect(o),o.connect(t.destination),r.start(0);const n=(await t.startRendering()).getChannelData(0);let i=0,a=0;for(let u=3e3;u<5800;u+=2){const e=n[u];i=31*i+Math.floor(1e5*(e+1))|0,a=Math.imul(a^Math.floor(98765*e),2246822519)}const c=i>>>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(n.slice(4500,5e3)),s=e.width/r.length;for(let o=0;o<r.length;o++){const n=o*s,i=(r[o]+1)/2*e.height;0===o?t.moveTo(n,i):t.lineTo(n,i)}t.stroke(),document.body.appendChild(e)}return qt(c.toString(16))})(e)),O=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,C=await Pt(()=>window.screen.orientation?.type||null),P=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,q=P&&P.type||null,A=P?.effectiveType||null,x=!0===P?.saveData,I="boolean"==typeof window.navigator.pdfViewerEnabled?window.navigator.pdfViewerEnabled:null,k="boolean"==typeof window.navigator.webdriver?window.navigator.webdriver:null,F=await Pt(()=>"function"!=typeof Intl.supportedValuesOf?null:Intl.supportedValuesOf("calendar").join(",")),D=await Pt(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 At(t)}),j={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,userAgentHighEntropy:r||null,mediaCodecs:s||null,fonts:o,numberingSystem:n,languages:i,timezone:c,timezoneOffset:u,intlCalendar:l,hourCycle:h,reducedMotion:d,colorScheme:f,prefersContrast:p,prefersReducedTransparency:m,pdfViewerEnabled:I,webdriver:k,intlSupportedCalendars:F||null,permissionsState:D||null,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:y,devicePixelRatio:g,pixelDepth:w,colorDepth:b,touchSupport:v,screenOrientation:C||null,connectionType:q,effectiveType:A,saveData:x,canvasID:R,webglID:S,webgpuID:T,audioID:E},L={aspectRatio:O,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(j,L);const M=qt(At(j)),U=Math.round(performance.now()-t);return{fingerprint:M,...j,elapsedMs:U}};"undefined"!=typeof window&&(window.getBrowserFingerprint=xt);var It=async(e,t)=>{if(e instanceof be){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)},kt=e(void 0),Ft=({props:e={},children:o})=>{const{organizationId:c,uid:l,fname:d,lname:f,theme:p="light"}=e,m=he(),[y,g]=r(null),[w,b]=r(()=>{if("undefined"==typeof window)return null;const e=localStorage.getItem("qrati_token");return e?{token:e}:null}),{isLoading:v,data:R,error:S}=ge({queryKey:[u.QRATI_CONNECT_SESSION,c,l??null,d??null,f??null],queryFn:async()=>{const e=await(async()=>{const e=await xt();return"string"==typeof e?e:e?.fingerprint})();try{return(await ft.post(h.INITIALIZE_SESSION,{json:{uid:l,fname:d,lname:f,browserFingerprint:e},headers:{"x-org-id":c,...!w?.token||l||d||f?{}:{Authorization:`Bearer ${w.token}`}}}).json()).data}catch(t){if(t instanceof be)try{const e=t.data;t.apiMessage=e?.message||e?.error}catch{}throw t}},enabled:!!c});t(()=>{const e=R?.authSession?.session?.token??R?.authSession?.token,t=R?.authSession?.user;t&&e?(b(r=>({...r,...t,token:e,tcAccepted:void 0===t.tcAccepted?r?.tcAccepted:t.tcAccepted})),localStorage.setItem("qrati_token",e)):R?.organization?.customAuth&&l&&d&&b(e=>e??{_id:l,uid:l,name:f?`${d} ${f}`:d,fname:d,lname:f})},[R]);const T=s(()=>{const e=R?.organization?.integrationSettings?.fontFamily,t=((e,t)=>{const r=bt("https://qrati.com"),s=t?wt(t):"";return r&&s?`${r}/api/connect/organization/google-font?family=${encodeURIComponent(s)}`:null})(0,e),r=((e,t)=>{const r=bt("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 s=wt(e.fontFamily);if("custom"===s&&t){const r=e.customFontName||"QratiCustomFont",s=/\.woff2(\?|$)/i.test(t)?"woff2":/\.ttf(\?|$)/i.test(t)?"truetype":"woff";return`@font-face{font-family:"${o=r,o.replace(/"/g,'\\"')}";src:url("${t}") format("${s}");font-weight:400 700;font-style:normal;font-display:swap;}`}var o;const n=r||(e=>{if(!e)return null;const t=wt(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})(s);return n?`@import url("${n}");`:""})(R?.organization?.integrationSettings,R?.organization?.customFontUrl?r||R.organization.customFontUrl:void 0,t||void 0)},[R?.organization?.integrationSettings,R?.organization?.customFontUrl,c]);t(()=>{const e=`data-qrati-font-${c}`;if(document.head.querySelector(`[${e}]`)?.remove(),T){if(T.startsWith("@import")){const t=T.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=T,t.setAttribute(e,""),document.head.appendChild(t)}return()=>{document.head.querySelector(`[${e}]`)?.remove()}}},[T,c]);const E=a(async e=>{b(t=>({...t,...e}))},[]),O=a(async(e,t,r,s)=>{try{const o=await ft.post(h.REGISTER,{json:{email:e,password:t,fname:r,lname:s},headers:{"x-org-id":c}}).json();return o.error?{error:o.error}:(b({...o.user,token:o.token}),o.token&&localStorage.setItem("qrati_token",o.token),o)}catch(S){return{error:await It(S,"Registration failed")}}},[c]),C=a(async(e,t)=>{try{const r=await ft.post(h.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:(b({...r.user,token:r.token}),r.token&&localStorage.setItem("qrati_token",r.token),r)}catch(S){return{error:await It(S,"Invalid email or password")}}},[c]),P=a(async e=>{const t=await((e,t,r)=>new Promise((s,o)=>{if(!e)return void o(/* @__PURE__ */new Error("Provider is required"));if(!t)return void o(/* @__PURE__ */new Error("Organization ID is required"));const n=new URL(`${r}/qc-social-auth`);n.searchParams.set("provider",e),n.searchParams.set("organizationId",t),n.searchParams.set("origin",window.location.origin);const i=(window.screen.width-500)/2,a=(window.screen.height-600)/2,c=window.open(n.toString(),"qrati_social_auth",`width=500,height=600,left=${i},top=${a},scrollbars=yes,resizable=yes,status=yes`);if(!c)return void o(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const u=()=>{clearInterval(h),clearTimeout(d),window.removeEventListener("message",l)},l=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(h){console.warn("Could not parse origin for verification")}const{type:n,data:i,error:a,organizationId:l}=e.data||{};if(l===t)switch(n){case"QRATI_SOCIAL_AUTH_SUCCESS":u(),c.close(),s({user:i.user,session:i.session,token:i.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",a),u(),c.close(),o(new Error(a||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":u(),c.close(),o(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",l,"expected:",t)},h=setInterval(()=>{try{c.closed&&(u(),o(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",l);const d=setTimeout(()=>{u(),c.closed||c.close(),o(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,c??"","https://qrati.com");return t?.user&&t?.token&&(b({...t.user,token:t.token}),localStorage.setItem("qrati_token",t.token)),t},[c]),q=a(async()=>P("google"),[P]),A=a(async()=>P("apple"),[P]),x=a(async e=>{try{const t=await ft.post(h.SEND_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase()},headers:{"x-org-id":c}}).json();return t.error?{error:t.error}:t}catch(S){return{error:await It(S,"Failed to send password reset code")}}},[c]),I=a(async(e,t)=>{try{const r=await ft.post(h.VERIFY_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase(),code:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(S){return{error:await It(S,"Invalid code, please check your email")}}},[c]),k=a(async(e,t)=>{try{const r=await ft.post(h.RESET_PASSWORD,{json:{passwordResetCodeId:e,newPassword:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(S){return{error:S?.message}}},[c]),F=a(async()=>{try{const e=await ft.post(h.LOGOUT,{headers:{"x-org-id":c,Authorization:`Bearer ${w?.token}`}}).json();return e.error?{error:e.error}:(b(null),localStorage.removeItem("qrati_token"),await m.invalidateQueries({queryKey:[u.QRATI_CONNECT_SESSION]}),e)}catch(S){return{error:S?.message}}},[c,w?.token]),D=s(()=>({props:e,initializing:v,sessionId:R?.sessionId,organization:R?.organization,folders:R?.folders,orgRole:R?.orgRole??null,loadingUser:v,user:w,updateUser:E,registerUsingEmail:O,loginWithGoogle:q,loginWithApple:A,loginUsingEmail:C,sendPasswordResetCode:x,verifyPasswordResetCode:I,resetPassword:k,signout:F,error:S,portalContainer:y}),[e,v,R,w,E,O,q,A,C,x,I,k,F,S,y]);if(S){const e=S,t=401===e?.response?.status?"page-not-registered":e?.response?"generic-error":"service-unavailable";/* @__PURE__ */
40
+ return i(n,{fallback:null,children:/* @__PURE__ */i(yt,{organizationId:c??"",errorType:t,errorMessage:"generic-error"===t?e.apiMessage:void 0})})}/* @__PURE__ */
41
+ return i(kt.Provider,{value:D,children:/* @__PURE__ */i("div",{ref:g,id:"qrati-connect-container",style:{...Ct(R?.organization,p),fontFamily:R?.organization?.integrationSettings?.fontFamily&&"system"!==R.organization.integrationSettings.fontFamily?"var(--font-family)":"inherit"},className:Tt("bg-background text-foreground relative min-h-[80vh]"),children:o})})},Dt=()=>{const e=c(kt);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{q as A,E as C,m as D,R as E,j as M,O,y as S,S as T,G as _,Ct as a,H as b,ge as c,he as d,ne as f,Z as g,ee as h,Tt as i,M as j,b as k,ye as l,Y as m,Dt as n,St as o,te as p,xt as r,ft as s,Ft as t,de as u,$ as v,T as w,N as x,_ as y};
@@ -0,0 +1,39 @@
1
+ import{_ as e,d as t,f as n,h as r,p as a,s as i,t as s,v as o,w as l}from"./DrrpB4Om.js";import{c,d,i as u,n as m,s as g}from"./BlmPmkho.js";import{n as h,r as f,t as p}from"./DAjJ8IJf.js";import{E as w,S as v,T,_ as y,a as N,c as q,d as x,f as b,g as E,h as C,i as S,l as I,m as z,o as L,p as k,s as M,u as _,x as A}from"./DpD2Abx9.js";import{t as P,u as R}from"./OGzsLhnG.js";import{n as O,t as V}from"./CE4Zhv-W.js";import{a as F,c as j,i as B,l as H,n as U,o as G,r as $,s as W,t as D}from"./DBUAmPz_.js";import{t as K}from"./CitgNM58.js";import{t as Q}from"./DwanMJWW.js";import{t as Z}from"./CAETItHr.js";import{r as Y}from"./DGGc10Cy.js";import{t as J}from"./2CzUGwUv.js";import{n as X,t as ee}from"./CtWIgfGz.js";import{t as te}from"./DPg_DKOi2.js";import{t as ne}from"./CZ9iaxjO2.js";import{a as re,i as ae,n as ie,o as se,r as oe,s as le,t as ce}from"./CM46pkhP2.js";import{c as de,i as ue,n as me,t as ge}from"./CBLQRRGX2.js";import{n as he,t as fe}from"./D9UPX_0d2.js";function pe(e){if(e<1e3)return String(e);const[t,n]=e<1e6?[1e3,"K"]:[1e6,"M"],r=Math.round(e/t*10)/10;return`${r%1==0?r.toFixed(0):r.toFixed(1)}${n}`}function we({className:e}){/* @__PURE__ */
2
+ return s("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__ */s("path",{fill:"currentColor",d:"M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-2h14V5H5zm0 0V5zm2-2h10q.3 0 .45-.275t-.05-.525l-2.75-3.675q-.15-.2-.4-.2t-.4.2L11.25 16L9.4 13.525q-.15-.2-.4-.2t-.4.2l-2 2.675q-.2.25-.05.525T7 17"})})}function ve({className:e}){/* @__PURE__ */
3
+ return s("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__ */s("path",{fill:"currentColor",d:"M15.188 14.688Q16.5 13.375 16.5 11.5t-1.312-3.187T12 7T8.813 8.313T7.5 11.5t1.313 3.188T12 16t3.188-1.312m-5.1-1.276Q9.3 12.625 9.3 11.5t.788-1.912T12 8.8t1.913.788t.787 1.912t-.787 1.913T12 14.2t-1.912-.787m-4.2 3.787q-2.763-1.8-4.363-4.75q-.125-.225-.187-.462t-.063-.488t.063-.488t.187-.462q1.6-2.95 4.363-4.75T12 4t6.113 1.8t4.362 4.75q.125.225.188.463t.062.487t-.062.488t-.188.462q-1.6 2.95-4.362 4.75T12 19t-6.113-1.8m11.3-1.687Q19.55 14.025 20.8 11.5q-1.25-2.525-3.613-4.012T12 6T6.813 7.488T3.2 11.5q1.25 2.525 3.613 4.013T12 17t5.188-1.487"})})}var Te=({description:t,maxLines:a=2,className:i})=>{const[o,l]=r(!1),[c,d]=r(!1),m=n(null),g=n(null);return e(()=>{l(!1)},[t]),e(()=>{if(!m.current||!t)return void d(!1);const e=m.current,n=()=>{const t=window.getComputedStyle(e),r=Math.max(0,Math.floor(e.getBoundingClientRect().width));if(!r)return void(g.current=window.requestAnimationFrame(n));const i=t.lineHeight,s=parseFloat(t.fontSize)||16;let o=1.2*s;i&&"normal"!==i&&(o=i.endsWith("px")?parseFloat(i):parseFloat(i)*s);const l=document.createElement("div");l.style.position="absolute",l.style.visibility="hidden",l.style.pointerEvents="none",l.style.whiteSpace="normal",l.style.width=`${r}px`,l.style.boxSizing=t.boxSizing,l.style.padding=t.padding,l.style.margin=t.margin,l.style.fontSize=t.fontSize,l.style.fontFamily=t.fontFamily,l.style.fontWeight=t.fontWeight,l.style.lineHeight=t.lineHeight,l.style.letterSpacing=t.letterSpacing,l.style.wordBreak="break-word",l.innerText=e.innerText||"",document.body.appendChild(l);const c=l.scrollHeight;document.body.removeChild(l),d(c>o*a+1)},r=()=>{null!==g.current&&window.cancelAnimationFrame(g.current),g.current=window.requestAnimationFrame(n)};let i;r(),window.addEventListener("resize",r);try{i=new MutationObserver(r),i.observe(e,{characterData:!0,childList:!0,subtree:!0})}catch{}return()=>{window.removeEventListener("resize",r),null!==g.current&&window.cancelAnimationFrame(g.current),i?.disconnect()}},[t,a]),t?/* @__PURE__ */s("div",{className:u("relative w-full",i),children:[/* @__PURE__ */s("p",{ref:m,className:u(O({variant:"body2",color:"muted",align:"center"}),"w-full",o?void 0:`line-clamp-${a}`),children:[t,c&&o&&/* @__PURE__ */s("button",{type:"button",onClick:()=>l(!1),className:"text-primary ml-2 text-sm font-medium hover:underline cursor-pointer",children:"see less"})]}),c&&!o&&/* @__PURE__ */s("span",{className:"bg-background absolute right-0 bottom-0 inline-flex items-center pl-2",children:[/* @__PURE__ */s("span",{className:"text-muted-foreground",children:"..."}),/* @__PURE__ */s("button",{type:"button",onClick:()=>l(!0),className:"text-primary ml-1 text-sm font-medium hover:underline cursor-pointer",children:"see more"})]})]}):null},ye=()=>{const{t:e}=Y(),{eventSlug:t}=R(),{event:n}=J({eventSlug:t}),{props:r,organization:a}=m(),{curateLabel:i,leaderboardLabel:o}=r??{},{eventViews:l,contentCount:d,curationCount:u}=(({event:e})=>{const{props:t,organization:n}=m(),r=t?.organizationId,{isLoading:a,data:i}=c({queryKey:["event-stats",r??"",e?._id??""],queryFn:async()=>{try{return(await g.get(S.GET_EVENT_STATISTICS,{searchParams:{eventSlug:e?.slug},headers:{"x-org-id":r}}).json()).data}catch(t){throw new Error(t instanceof Error?t.message:String(t)||"Failed to fetch event stats")}},enabled:!!e&&Boolean(n?.integrationSettings?.showEventStats)});return{isLoading:a,eventViews:"number"==typeof i?.eventViews?i.eventViews:i?.eventViews?.views??0,contentCount:i?.contentCount||0,curationCount:i?.curationCount||0}})({event:n});/* @__PURE__ */
4
+ return s("div",{className:"w-full space-y-3",children:[
5
+ /* @__PURE__ */s("div",{className:"space-y-2 md:-mt-8",children:[/* @__PURE__ */s(V,{variant:"h4",align:"center",immutable:!0,className:"mx-auto max-w-2xl",children:n?.name}),/* @__PURE__ */s(Te,{description:n?.description})]}),a?.integrationSettings?.showEventStats&&/* @__PURE__ */s("div",{className:"flex justify-center",children:/* @__PURE__ */s("div",{className:"flex items-center gap-6",children:[
6
+ /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */s(ve,{className:"text-primary"}),/* @__PURE__ */s("span",{className:"font-medium",children:pe(l??0)})]}),
7
+ /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */s(we,{className:"text-primary"}),/* @__PURE__ */s("span",{className:"font-medium",children:pe(d??0)})]}),n?.engagementStyle===b.CONTEST&&/* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */s(le,{className:"text-primary"}),/* @__PURE__ */s("span",{className:"font-medium",children:u})]})]})}),(n?.status===k.OPEN&&n?.uploadLimit&&n.uploadLimit>0||n?.status===k.OPEN&&n?.engagementStyle===b.CONTEST||n?.engagementStyle===b.REACTION&&n?.showLeaderboard||n?.engagementStyle===b.CONTEST)&&/* @__PURE__ */s("div",{className:"flex w-full flex-wrap justify-center gap-3",children:[n?.status===k.OPEN&&n?.uploadLimit&&n.uploadLimit>0&&/* @__PURE__ */s(P,{to:A.UPLOAD(n?.slug??""),children:/* @__PURE__ */s(ee,{icon:/* @__PURE__ */s(de,{className:"size-5"}),children:e("content.upload","Upload")})}),n?.status===k.OPEN&&n?.engagementStyle===b.CONTEST&&/* @__PURE__ */s(P,{to:A.CURATE(n?.slug??""),children:/* @__PURE__ */s(ee,{icon:/* @__PURE__ */s(le,{className:"size-5"}),children:i||e("content.curate","Curate")})}),n?.showLeaderboard&&/* @__PURE__ */s(P,{to:A.LEADERBOARD(n?.slug??""),children:/* @__PURE__ */s(ee,{icon:/* @__PURE__ */s(ne,{className:"size-5"}),children:o||e("content.leaderboard","Leaderboard")})})]})]})},Ne=(e,t)=>["in-review-count",e??"",t??""];function qe({className:e}){/* @__PURE__ */
8
+ return s("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__ */s("path",{fill:"currentColor",d:"M12.275 9H19.4q-.675-1.725-2.062-2.963T14.15 4.3l-2.3 3.95q-.15.25 0 .5t.425.25m-3.6 1.25q.15.25.425.25t.425-.25L13.1 4.1q-.275-.05-.55-.075T12 4q-1.65 0-3.075.625T6.4 6.3zM4.25 14h4.575q.275 0 .438-.25t.012-.5L5.7 7.1q-.8 1.025-1.25 2.263T4 12q0 .525.063 1.013T4.25 14m5.6 5.7l2.275-3.95q.15-.25-.012-.5t-.438-.25H4.6q.675 1.725 2.063 2.963T9.85 19.7M12 20q1.65 0 3.075-.625T17.6 17.7l-2.275-3.95q-.15-.25-.425-.25t-.425.25L10.9 19.9q.275.05.538.075T12 20m6.3-3.1q.8-1.025 1.25-2.262T20 12q0-.525-.062-1.012T19.75 10h-4.575q-.275 0-.437.25t-.013.5zM12 22q-2.05 0-3.875-.788t-3.187-2.15t-2.15-3.187T2 12q0-2.075.788-3.887t2.15-3.175t3.187-2.15T12 2q2.075 0 3.888.788t3.174 2.15t2.15 3.175T22 12q0 2.05-.788 3.875t-2.15 3.188t-3.175 2.15T12 22"})})}function xe({className:e}){/* @__PURE__ */
9
+ return s("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__ */s("path",{fill:"currentColor",d:"M11.25 16L9.6 13.8q-.225-.3-.6-.3t-.6.3l-1.8 2.4q-.2.25-.05.525T7 17h10q.3 0 .45-.275t-.05-.525l-2.475-3.3q-.275-.05-.563-.125T13.8 12.6zM5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h4q.425 0 .713.288T10 4t-.288.713T9 5H5v14h14v-3.325q0-.425.288-.712t.712-.288t.713.288t.287.712V19q0 .825-.587 1.413T19 21zm11.05-10q-1.85 0-3.15-1.312T11.6 6.5t1.313-3.187T16.1 2t3.188 1.313T20.6 6.5q0 .675-.2 1.3t-.5 1.15l2.35 2.35q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-2.4-2.4q-.525.35-1.125.525T16.05 11m.05-2q1.05 0 1.775-.725T18.6 6.5t-.725-1.775T16.1 4t-1.775.725T13.6 6.5t.725 1.775T16.1 9"})})}function be({className:e}){/* @__PURE__ */
10
+ return s("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__ */s("path",{fill:"currentColor",d:"M7 21q-.425 0-.712-.288T6 20t.288-.712T7 19h4v-3H4q-.825 0-1.412-.587T2 14V5q0-.825.588-1.412T4 3h16q.825 0 1.413.588T22 5v9q0 .825-.587 1.413T20 16h-7v3h4q.425 0 .713.288T18 20t-.288.713T17 21zm-3-7h16V5H4zm0 0V5z"})})}function Ee({className:e}){/* @__PURE__ */
11
+ return s("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__ */s("path",{fill:"currentColor",d:"M12 20q-.825 0-1.412-.587T10 18t.588-1.412T12 16t1.413.588T14 18t-.587 1.413T12 20m0-6q-.825 0-1.412-.587T10 12t.588-1.412T12 10t1.413.588T14 12t-.587 1.413T12 14m0-6q-.825 0-1.412-.587T10 6t.588-1.412T12 4t1.413.588T14 6t-.587 1.413T12 8"})})}function Ce({className:e}){/* @__PURE__ */
12
+ return s("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__ */s("path",{fill:"currentColor",d:"M9 20v-4q-1.275-.1-2.5-.275t-2.45-.45q-.425-.1-.675-.475T3.25 14t.513-.625t.812-.1q1.825.425 3.688.575T12 14t3.738-.15t3.687-.575q.45-.1.825.1t.5.625t-.137.8t-.688.475q-1.225.275-2.45.45T15 16v4q0 .425-.287.713T14 21h-4q-.425 0-.712-.288T9 20m3-7q-.85 0-1.425-.575T10 11q0-.825.575-1.412T12 9q.825 0 1.413.588T14 11q0 .85-.587 1.425T12 13m-7.5-3q-.65 0-1.075-.425T3 8.5q0-.625.425-1.062T4.5 7q.625 0 1.063.438T6 8.5q0 .65-.437 1.075T4.5 10m15 0q-.65 0-1.075-.425T18 8.5q0-.625.425-1.062T19.5 7q.625 0 1.063.438T21 8.5q0 .65-.437 1.075T19.5 10M7.25 6.25q-.65 0-1.075-.425T5.75 4.75q0-.625.425-1.062T7.25 3.25q.625 0 1.063.438T8.75 4.75q0 .65-.437 1.075T7.25 6.25m9.5 0q-.65 0-1.075-.425T15.25 4.75q0-.625.425-1.062t1.075-.438q.625 0 1.063.438t.437 1.062q0 .65-.437 1.075t-1.063.425M12 5q-.65 0-1.075-.425T10.5 3.5q0-.625.425-1.062T12 2q.625 0 1.063.438T13.5 3.5q0 .65-.437 1.075T12 5"})})}function Se({className:e}){/* @__PURE__ */
13
+ return s("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__ */s("path",{fill:"currentColor",d:"M11 12q-1.65 0-2.825-1.175T7 8t1.175-2.825T11 4t2.825 1.175T15 8t-1.175 2.825T11 12m0-2q.825 0 1.413-.587T13 8t-.587-1.412T11 6t-1.412.588T9 8t.588 1.413T11 10m10.4 12.8l-2.5-2.5q-.525.3-1.125.5T16.5 21q-1.875 0-3.187-1.312T12 16.5t1.313-3.187T16.5 12t3.188 1.313T21 16.5q0 .675-.2 1.275t-.5 1.125l2.5 2.5q.275.275.275.7t-.275.7t-.7.275t-.7-.275m-3.125-4.525Q19 17.55 19 16.5t-.725-1.775T16.5 14t-1.775.725T14 16.5t.725 1.775T16.5 19t1.775-.725M3 18v-.775q0-.85.425-1.575t1.175-1.1q1.05-.55 2.338-.962t2.637-.538q.425-.05.725.25t.3.725t-.3.738t-.725.362q-1.425.175-2.4.525t-1.65.7q-.25.125-.387.363T5 17.225V18h4.6q.425 0 .713.288T10.6 19t-.287.713T9.6 20H5q-.825 0-1.412-.587T3 18m7.175 0"})})}function Ie({className:e}){/* @__PURE__ */
14
+ return s("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__ */s("path",{fill:"currentColor",d:"M5 11q-.825 0-1.412-.587T3 9V5q0-.825.588-1.412T5 3h4q.825 0 1.413.588T11 5v4q0 .825-.587 1.413T9 11zm0 10q-.825 0-1.412-.587T3 19v-4q0-.825.588-1.412T5 13h4q.825 0 1.413.588T11 15v4q0 .825-.587 1.413T9 21zm10-10q-.825 0-1.412-.587T13 9V5q0-.825.588-1.412T15 3h4q.825 0 1.413.588T21 5v4q0 .825-.587 1.413T19 11zm0 10q-.825 0-1.412-.587T13 19v-4q0-.825.588-1.412T15 13h4q.825 0 1.413.588T21 15v4q0 .825-.587 1.413T19 21zM5 9h4V5H5zm10 0h4V5h-4zm0 10h4v-4h-4zM5 19h4v-4H5zM9 9"})})}function ze({className:e}){/* @__PURE__ */
15
+ return s("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__ */s("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3c4.97 0 9 4.03 9 9",children:/* @__PURE__ */s("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})})})}var Le=({event:e})=>{const t=d(),{user:n,props:a}=m(),i=a?.organizationId,[o,l]=r(!1);/* @__PURE__ */
16
+ return s(U,{children:[/* @__PURE__ */s(F,{children:/* @__PURE__ */s(o?ze:Ie,{className:"size-6"})}),/* @__PURE__ */s($,{align:"end",side:"bottom",className:"w-44",children:Object.values(E).map(r=>/* @__PURE__ */s(B,{onClick:()=>(async r=>{l(!0);try{const a=new FormData;a.append("eventId",e?._id??""),a.append("galleryLayout",r),await g.post(S.UPDATE_EVENT_LAYOUT,{body:a,headers:{"x-org-id":i,Authorization:n?`Bearer ${n.token}`:void 0}}),t.invalidateQueries({queryKey:[`event-data-${i??""}-${e?.slug??""}`]})}catch(a){console.error(a)}l(!1)})(r),isChecked:e?.galleryLayout===r,title:he(r)},r))})]})},ke=({event:e,onAutoscrollClick:t})=>{const{t:n}=Y(),{isSuper:r,isOwner:i,isAdmin:o,isModerator:l}=j(),{inReviewCount:u}=(e=>{const t=d(),{props:n}=m(),r=n?.organizationId,{role:a,isSuper:i}=j(),{isLoading:s,data:o,isError:l,error:u}=c({queryKey:Ne(r,e?.slug),queryFn:async()=>{try{const t=await g.get(S.GET_CONTENTS_COUNT,{searchParams:{eventSlug:e?.slug,filter:`status:${M.IN_REVIEW}`},headers:{"x-org-id":r}}).json();if(t.error)throw new Error(t.error);return t.data}catch(t){throw new Error(t instanceof Error?t.message:String(t)||"Failed to fetch in review count")}},staleTime:0,enabled:Boolean(a)||Boolean(i)});return{loading:s,inReviewCount:o,error:l?u:null,increment:()=>{t.setQueryData(Ne(r,e?.slug),e=>(e??0)+1)},decrement:()=>{t.setQueryData(Ne(r,e?.slug),e=>Math.max(0,(e??0)-1))}}})(e),h=r||i||o||l,f=r||i||o,p=a(()=>{const t=[];return f&&t.push({title:n("event.shot_inspector","Shot Inspector"),icon:qe,href:C.EVENT_SHOT_INSPECTOR(e?.slug??"")}),e?.visibility===z.PRIVATE&&h&&t.push({title:n("event.access_requests","Access Requests"),icon:Se,href:C.EVENT_ACCESS_REQUESTS(e?.slug??"")}),e?.engagementStyle===b.CONTEST&&f&&t.push({title:n("event.curation_details","Curation Details"),icon:Ce,href:C.EVENT_CURATION_DETAILS(e?.slug??"")}),f&&t.push({title:n("event.edit_event","Edit Event"),icon:G,href:C.EVENT_SETTINGS_BASIC_DETAILS(e?.slug??"")}),t},[e,f,h]);/* @__PURE__ */
17
+ return s("div",{className:"text-muted-foreground sm:text-foreground flex flex-row items-center justify-end gap-6 pr-1 sm:justify-between sm:pr-4",children:["undefined"!=typeof document&&document?.fullscreenEnabled&&t&&/* @__PURE__ */s(W,{content:n("event.kiosk_mode","Kiosk Mode"),children:/* @__PURE__ */s("button",{onClick:t,className:"hidden sm:block",children:/* @__PURE__ */s(be,{className:"size-6"})})}),"undefined"!=typeof document&&document?.fullscreenEnabled&&f&&/* @__PURE__ */s(Le,{event:e}),h&&/* @__PURE__ */s(W,{content:n("event.review_contents","Review Contents"),children:/* @__PURE__ */s("a",{target:"_blank",rel:"noreferrer",href:C.EVENT_REVIEW_CONTENTS(e?.slug??""),className:"relative",children:[/* @__PURE__ */s(xe,{className:"size-6"}),Number(u)>0&&/* @__PURE__ */s("div",{className:"bg-primary text-primary-foreground absolute -top-2 -right-2 rounded-lg px-1 py-0 text-xs",children:u})]})}),p.length>0&&/* @__PURE__ */s(U,{children:[/* @__PURE__ */s(F,{children:/* @__PURE__ */s(Ee,{className:"size-6"})}),/* @__PURE__ */s($,{align:"end",side:"bottom",className:"w-48",children:p.map(e=>/* @__PURE__ */s(B,{href:e.href,icon:/* @__PURE__ */s(e.icon,{className:"text-primary"}),title:e.title,suffix:e?.chip?/* @__PURE__ */s("span",{className:"bg-primary text-primary-foreground rounded-full px-1.5 py-0.5 text-[0.5rem] font-medium sm:text-xs",children:e.chip}):void 0,isBeta:"BETA"===e?.chip},e.href??e.title))})]})]})};function Me({className:e}){/* @__PURE__ */
18
+ return s("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__ */s("path",{fill:"currentColor",d:"M4 18q-.425 0-.712-.288T3 17t.288-.712T4 16h16q.425 0 .713.288T21 17t-.288.713T20 18zm0-5q-.425 0-.712-.288T3 12t.288-.712T4 11h16q.425 0 .713.288T21 12t-.288.713T20 13zm0-5q-.425 0-.712-.288T3 7t.288-.712T4 6h16q.425 0 .713.288T21 7t-.288.713T20 8z"})})}var _e=({engagementStyle:e,sort:t=_,order:n=x,onSortChange:r,onSortOrderChange:i})=>{const{t:o}=Y(),l=a(()=>{const t=Object.keys(L).map(e=>({text:o(`content.sortby_${L[e].label.toLowerCase()}`,L[e].label),value:e,activeClassName:"bg-primary text-primary-foreground"}));return e===b.CONTEST?t:t.filter(e=>e.value!==N.POPULAR)},[e,o]);/* @__PURE__ */
19
+ return s("div",{className:"relative flex w-auto items-center gap-2",children:[/* @__PURE__ */s("button",{type:"button",className:"bg-background rounded p-1",onClick:i,children:/* @__PURE__ */s("svg",{xmlns:"http://www.w3.org/2000/svg",className:u("text-foreground w-7 -scale-x-100 transition-transform",n===T.ASC&&"-scale-y-100"),viewBox:"0 0 24 24",children:/* @__PURE__ */s("path",{fill:"currentColor",d:"M4 18q-.425 0-.712-.288T3 17t.288-.712T4 16h4q.425 0 .713.288T9 17t-.288.713T8 18zm0-5q-.425 0-.712-.288T3 12t.288-.712T4 11h10q.425 0 .713.288T15 12t-.288.713T14 13zm0-5q-.425 0-.712-.288T3 7t.288-.712T4 6h16q.425 0 .713.288T21 7t-.288.713T20 8z"})})}),/* @__PURE__ */s(H,{className:"flex-1 lg:flex-none",selected:t,buttons:l,onChange:e=>r&&r(e)})]})},Ae=["jpg","jpeg","png","webp","heic","tiff","bmp"],Pe=({value:t,onChange:i})=>{const[o,l]=r(!1),c=n(null),d=a(()=>t?URL.createObjectURL(t):null,[t]);return e(()=>()=>{d&&URL.revokeObjectURL(d)},[d]),e(()=>{!t&&c.current&&(c.current.value="")},[t]),/* @__PURE__ */s("div",{className:"flex items-center gap-3",children:[!t&&/* @__PURE__ */s("div",{className:"flex items-center gap-4",children:/* @__PURE__ */s("button",{type:"button",onClick:()=>c.current?.click(),className:"border-border flex items-center gap-2 rounded border px-3 py-2.5 "+(o?"bg-opacity-75 cursor-not-allowed":"hover:cursor-pointer"),children:/* @__PURE__ */s(o?X:se,{})})}),t&&d&&/* @__PURE__ */s("img",{src:d,alt:"Facial Search",className:"size-10 rounded object-cover"}),
20
+ /* @__PURE__ */s("input",{ref:c,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const t=e.target?.files?.[0]??null;if(!t)return;const n=(t.name.split(".").pop()||"").toLowerCase();if(!Ae.includes(n))return i(null);(async e=>{if(!e)return;l(!0);let t=e;try{const n=await ue(e);t=n.size/1024/1024>1?await me(n,{maxSizeMB:1,maxWidthOrHeight:1600,useWebWorker:!0,preserveExif:!1,maxIteration:3}):n}catch(n){console.error(n)}l(!1),i(t)})(t)}})]})},Re={[I.GRID]:{icon:/* @__PURE__ */s(Ie,{className:"size-full text-inherit"})},[I.SINGLE]:{icon:/* @__PURE__ */s(Me,{className:"size-full text-inherit"})}},Oe=Object.keys(Re).map(e=>({icon:Re[e].icon,value:e})),Ve=({engagementStyle:t,disabled:a,mode:i,onModeChange:l,sort:c,onSortChange:d,sortOrder:u,onSortOrderChange:g,handleChange:h,face:f,onFaceImageChange:p})=>{const{t:w}=Y(),{organization:v}=m(),[T,y]=r(""),[N,q]=r(null),x=n(null),b=o(()=>{x.current&&(URL.revokeObjectURL(x.current),x.current=null)},[]),E=o(e=>{if(q(e),b(),e){const t=URL.createObjectURL(e);x.current=t,p?.(t)}else p?.(void 0)},[p,b]),C=o(e=>{y(e.target.value)},[]),S=o(e=>{const t=e.key;"Enter"===t?h&&h(T.length>0?T:""):"Escape"===t&&(y(""),h&&h(""))},[T,h]),I=o(()=>{y(""),h&&h("")},[h]),z=o(()=>{h&&h(T)},[T,h]);return e(()=>{f||q(null)},[f]),e(()=>()=>{b()},[b]),/* @__PURE__ */s("fieldset",{disabled:a,className:"m-0 mb-3 grid min-w-0 grid-cols-3 border-0 p-0 md:space-y-0 md:space-x-4 "+(a?"opacity-50":""),children:[
21
+ /* @__PURE__ */s("div",{className:"col-span-3 flex items-center gap-4 md:col-span-1",children:[v?.integrationSettings?.showGridViewToggle&&/* @__PURE__ */s(H,{buttons:Oe,selected:i,onChange:l}),v?.integrationSettings?.showKeywordSearch&&/* @__PURE__ */s("div",{className:"flex-auto",children:/* @__PURE__ */s("div",{className:"relative min-w-32 sm:min-w-48",children:[
22
+ /* @__PURE__ */s(fe,{placeholder:w("content.search_placeholder","Search using text"),value:T,className:"py-2",onChange:C,onKeyUp:S}),T?.length>0&&/* @__PURE__ */s("button",{className:"absolute inset-y-0 right-10 flex items-center",onClick:I,children:/* @__PURE__ */s(Z,{className:"text-foreground w-5"})}),
23
+ /* @__PURE__ */s("button",{className:"absolute inset-y-0 right-3 flex items-center",onClick:z,children:/* @__PURE__ */s(D,{className:"text-foreground w-5"})})]})}),v?.integrationSettings?.showFacialSearch&&/* @__PURE__ */s(Pe,{value:N,onChange:E})]}),
24
+ /* @__PURE__ */s("div",{className:"col-span-3 md:col-span-1"}),
25
+ /* @__PURE__ */s("div",{className:"col-span-3 mt-3 md:col-span-1 md:mt-0 lg:justify-self-end",children:/* @__PURE__ */s(_e,{engagementStyle:t,sort:c,order:u,onSortChange:d,onSortOrderChange:g})})]})},Fe=()=>/* @__PURE__ */s("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-full",width:"800",height:"469.317",viewBox:"0 0 800 469.317",role:"img","aria-hidden":"true",children:/* @__PURE__ */s("g",{transform:"translate(-443.142 -257.876)",children:[
26
+ /* @__PURE__ */s("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"}),
27
+ /* @__PURE__ */s("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"}),
28
+ /* @__PURE__ */s("path",{d:"M754.171,630.2l-509.5-135.058a30.276,30.276,0,0,1-21.483-36.981L295.28,186.212a30.276,30.276,0,0,1,36.981-21.483l509.5,135.058a30.276,30.276,0,0,1,21.483,36.981L791.152,608.712A30.276,30.276,0,0,1,754.171,630.2Z",transform:"translate(220.958 94.156)",fill:"#f2f2f2"}),
29
+ /* @__PURE__ */s("path",{d:"M775.247,705.1H248.155a30.276,30.276,0,0,1-30.241-30.241V393.525a30.276,30.276,0,0,1,30.241-30.241H775.247a30.276,30.276,0,0,1,30.241,30.242V674.862A30.275,30.275,0,0,1,775.247,705.1Z",transform:"translate(319.149 22.09)",fill:"#fff"}),
30
+ /* @__PURE__ */s("path",{d:"M638.653,701.841H298.272c-.426,0-.852-.009-1.272-.033l160.985-90.663c3.065-1.762,9.943-2.382,15.361-1.385a13.912,13.912,0,0,1,4.26,1.385l108.041,60.842,5.176,2.911Z",transform:"translate(312.538 1.526)",fill:"#e6e6e6"}),
31
+ /* @__PURE__ */s("path",{d:"M760.145,704.279h-294.4l57.049-26.943L526.9,675.4l74.341-35.111c4.874-2.3,16.6-2.445,22.328-.434q.577.206,1.071.434Z",transform:"translate(298.432 -0.912)",fill:"#e6e6e6"}),
32
+ /* @__PURE__ */s("path",{d:"M248.322,365.284a28.441,28.441,0,0,0-28.409,28.409V675.03a28.441,28.441,0,0,0,28.409,28.409H775.415a28.441,28.441,0,0,0,28.409-28.409V393.693a28.441,28.441,0,0,0-28.409-28.409Z",transform:"translate(319.149 22.09)",fill:"none",stroke:"#d6d6e3",strokeWidth:"1.833"})]})}),je=({position:t,gamConfig:r,eventId:a,organizationId:i})=>{const{trackGamAnalytics:o}=ie(),l=n(null),c=`gam-${t}-banner-${a??"ev"}`,d=r.placementCategories?.[t];return e(()=>{let e=!1,t=null,n=null,s=null,u=null,m=null,g=null;const h=d?[d]:[],f=document.createElement("div");f.id=c,document.body.appendChild(f);const p=()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect(),n=t.width>0&&t.height>0;f.style.display=n?"block":"none",n&&(f.style.position="fixed",f.style.top=`${t.top}px`,f.style.left=`${t.left}px`,f.style.width="728px",f.style.height="90px",f.style.zIndex="20")};return p(),window.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",p),(async()=>{await re(),e||window.googletag.cmd.push(()=>{if(e)return;oe(c);const l=window.googletag.defineSlot(r.adUnitPath,[[728,90]],c)?.addService(window.googletag.pubads());l&&(t=l,u=window.googletag.pubads(),a?l.setConfig({targeting:{qrati_event:a,...h.length>0?{qrati_category:h}:{}}}):h.length>0&&l.setConfig({targeting:{qrati_category:h}}),m=e=>{e.slot===l&&o({eventId:a,organizationId:i,type:y.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",m),g=e=>{e.slot===l&&o({eventId:a,organizationId:i,type:y.GAM_VIEWABLE})},u.addEventListener("impressionViewable",g),s=ce({container:f,onClick:()=>{o({eventId:a,organizationId:i,type:y.GAM_CLICK})}}),ae(),window.googletag.display(c),n=window.setTimeout(()=>{e||(p(),l.getResponseInformation?.()||window.googletag.pubads().refresh([l]))},1500))})})(),()=>{e=!0,window.removeEventListener("scroll",p),window.removeEventListener("resize",p),null!==n&&window.clearTimeout(n),s?.(),u&&"function"==typeof u.removeEventListener&&(m&&u.removeEventListener("slotRenderEnded",m),g&&u.removeEventListener("impressionViewable",g));const r=t;t=null,r&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([r])}),f.parentNode&&f.parentNode.removeChild(f)}},[a,r.adUnitPath,i,d,t,c]),/* @__PURE__ */s("div",{className:"flex w-full items-center justify-center overflow-x-auto py-2",children:/* @__PURE__ */s("div",{ref:l,style:{width:728,height:90,minWidth:728}})})},Be=({gamConfig:t,eventId:r,organizationId:a})=>{const{trackGamAnalytics:i}=ie(),o=n(null),l=`gam-right-${r??"ev"}`,c=t.placementCategories?.right??t.placementCategories?.sidebar;return e(()=>{let e=!1,n=null,s=null,d=null,u=null,m=null,g=null;const h=c?[c]:[],f=document.createElement("div");f.id=l,document.body.appendChild(f);const p=()=>{const e=o.current;if(!e)return;const t=e.getBoundingClientRect(),n=e.parentElement?.getBoundingClientRect(),r=t.width>0&&t.height>0;if(f.style.display=r?"block":"none",!r)return;const a=t.top<=0&&n?Math.min(0,n.bottom-600):t.top;f.style.position="fixed",f.style.top=`${a}px`,f.style.left=`${t.left}px`,f.style.width="160px",f.style.height="600px",f.style.zIndex="20"};return p(),window.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",p),(async()=>{await re(),e||window.googletag.cmd.push(()=>{if(e)return;oe(l);const o=window.googletag.defineSlot(t.adUnitPath,[[160,600]],l)?.addService(window.googletag.pubads());o&&(n=o,u=window.googletag.pubads(),r?o.setConfig({targeting:{qrati_event:r,...h.length>0?{qrati_category:h}:{}}}):h.length>0&&o.setConfig({targeting:{qrati_category:h}}),m=e=>{e.slot===o&&i({eventId:r,organizationId:a,type:y.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",m),g=e=>{e.slot===o&&i({eventId:r,organizationId:a,type:y.GAM_VIEWABLE})},u.addEventListener("impressionViewable",g),d=ce({container:f,onClick:()=>{i({eventId:r,organizationId:a,type:y.GAM_CLICK})}}),ae(),window.googletag.display(l),s=window.setTimeout(()=>{e||(p(),o.getResponseInformation?.()||window.googletag.pubads().refresh([o]))},1500))})})(),()=>{e=!0,window.removeEventListener("scroll",p),window.removeEventListener("resize",p),null!==s&&window.clearTimeout(s),d?.(),u&&"function"==typeof u.removeEventListener&&(m&&u.removeEventListener("slotRenderEnded",m),g&&u.removeEventListener("impressionViewable",g));const t=n;n=null,t&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([t])}),f.parentNode&&f.parentNode.removeChild(f)}},[r,t.adUnitPath,a,c,l]),/* @__PURE__ */s("div",{ref:o,style:{width:160,height:600},className:"hidden shrink-0 self-start lg:block"})},He=t(()=>import("./CzHEb5lR2.js")),Ue=()=>{const t=R().eventSlug,{loadingUser:c,organization:T}=m(),y=d(),[E,C]=r(""),[z,M]=r(void 0),[P,O]=r(_),[F,j]=r(x),[B,H]=r("undefined"!=typeof window&&window.innerWidth<768?I.SINGLE:I.GRID),U=n(null),{event:G,ads:$,gamConfig:W}=J({eventSlug:t}),{loading:D,isError:Y,error:X,refetch:ne,contentsWithAds:re,hasNextPage:ae,fetchNextPage:se,isFetchingNextPage:oe}=(({event:e,ads:t=[],gamConfig:n,sort:r=_,order:i=x,keywords:s,face:o,limit:l=20})=>{const{props:c,loadingUser:d,user:u}=m(),T=c?.organizationId,{isLoading:y,isError:N,error:b,data:E,hasNextPage:C,fetchNextPage:I,isFetchingNextPage:z,refetch:k}=f({queryKey:[v.CONTENTS_BY_EVENT(e?._id??""),T??"",r,i,s,o,String(l)],queryFn:async({pageParam:t=1})=>{try{return await g.get(S.GET_CONTENTS,{searchParams:{eventId:e?._id,page:t,keywords:s,faceImageUrl:o,sort:`${w[i].sortOrder}${L[r].sortField}`,limit:l},headers:{"x-org-id":T,...u?{Authorization:`Bearer ${u.token}`}:{}}}).json()}catch(b){throw new Error(b instanceof Error?b.message:String(b)||"Failed to fetch contents")}},enabled:!d&&!!e,staleTime:6e4,gcTime:3e5,refetchOnWindowFocus:"always",initialPageParam:1,getPreviousPageParam:e=>h(e),getNextPageParam:p}),M=a(()=>E?.pages?.flatMap(e=>e?.data??[])??[],[E]);return{contents:M,contentsWithAds:a(()=>{const r=Boolean(n?.inGalleryEnabled);return((e=[],{ads:t,gamConfig:n,position:r,gamShare:a})=>{if(r<=0)return e;const i=Boolean(n?.inGalleryEnabled),s=t.length>0;if(!i&&!s)return e;const o=i?s?Math.min(1,Math.max(0,a)):1:0,l=e=>{const n=t.length>1?t.filter(t=>t._id!==e):t,r=n.reduce((e,t)=>e+Math.max(1,t.frequency??1),0);let a=Math.random()*r;for(const t of n)if(a-=Math.max(1,t.frequency??1),a<=0)return t;return n[n.length-1]};let c=null,d=0;const u=[];for(let m=0;m<e.length;m++)if(u.push(e[m]),(m+1)%r===0){if(i&&(!s||Math.floor((d+1)*o)>Math.floor(d*o))&&n){const e=s?l(c):null;u.push({_id:`gam-ad-slot-${d}`,type:q.GAM_AD,slotIndex:d,gamConfig:n,fallbackAd:e,width:n.sizes[0]?.[0]??300,height:n.sizes[0]?.[1]??250})}else{const e=l(c);c=e._id??null,u.push({...e,type:q.AD,adType:e.type})}d++}return u})(M,{ads:"gam"!==e?.adMode||r?t:[],gamConfig:r?n:null,position:e?.adPosition??0,gamShare:(n?.inGalleryBlend??50)/100})},[M,t,e,n]),loading:y,isError:N,error:b,refetch:k,hasNextPage:C,fetchNextPage:I,isFetchingNextPage:z}})({event:G,ads:$,gamConfig:W,sort:P,order:F,keywords:E,face:z}),{incrementEventView:le}=ie(),{start:ce,initializing:de,running:ue}=(({ref:t,onBottomReached:a,hasNextPage:i,fetchNextPage:s,isFetchingNextPage:o})=>{const[l,c]=r(!1),[d,u]=r(!1),m=n(1),g=n(null),h=n(null),f=n(null),p=n(0),w=n(!1),v=n(null),T=n(null),y=n(!1),N=n(),q=n(),x=n(i),b=n(o),E=n(s),C=n(a);x.current=i,b.current=o,E.current=s,C.current=a,e(()=>{o||(w.current=!1)},[o]);const S=()=>{null!==g.current&&(window.cancelAnimationFrame(g.current),g.current=null)},I=e=>{const n=t.current;if(!n)return;null===f.current&&(f.current=e);const r=Math.min((e-f.current)/1e3,.05);f.current=e,p.current+=60*m.current*r;const a=Math.floor(p.current);a>0&&(n.scrollTop+=a,p.current-=a),x.current&&!b.current&&!w.current&&"function"==typeof E.current&&n.scrollTop+n.clientHeight>=.5*n.scrollHeight&&(w.current=!0,E.current()),Math.ceil(n.scrollTop)+n.clientHeight>=n.scrollHeight?(S(),h.current=window.setTimeout(()=>{u(!0),C.current?.(),w.current=!1,h.current=window.setTimeout(()=>{t.current&&(t.current.scrollTop=0),u(!1),p.current=0,f.current=null,g.current=window.requestAnimationFrame(I)},1e3)},1e3)):g.current=window.requestAnimationFrame(I)},z=()=>{S(),h.current&&(window.clearTimeout(h.current),h.current=null),null!==v.current&&v.current.release().catch(()=>{}).finally(()=>{v.current=null}),T.current&&(document.removeEventListener("visibilitychange",T.current),T.current=null),y.current&&(N.current&&document.removeEventListener("keydown",N.current),q.current&&document.removeEventListener("fullscreenchange",q.current),y.current=!1),c(!1),u(!1),t.current&&(t.current.scrollTop=0)},L=n(e=>{"+"===e.key&&(m.current=Math.min(m.current+1,10)),"-"===e.key&&(m.current=Math.max(m.current-1,1))}),k=n(()=>{document.fullscreenElement||z()});return k.current=()=>{document.fullscreenElement||z()},e(()=>()=>{z()},[]),{start:()=>{if(t?.current?.requestFullscreen)t.current.requestFullscreen();else{const e=t.current;e?.webkitRequestFullscreen?e.webkitRequestFullscreen():e?.mozRequestFullScreen?e.mozRequestFullScreen():e?.msRequestFullscreen&&e.msRequestFullscreen()}(async()=>{try{if(!("wakeLock"in navigator))return;const e=navigator;v.current=await e.wakeLock.request("screen");const t=async()=>{"visible"===document.visibilityState&&(v.current=await e.wakeLock.request("screen"))};T.current=t,document.addEventListener("visibilitychange",t)}catch(e){}})(),y.current||(N.current=e=>L.current(e),q.current=()=>k.current(),document.addEventListener("keydown",N.current),document.addEventListener("fullscreenchange",q.current),y.current=!0),p.current=0,f.current=null,w.current=!1,c(!0),S(),h.current=window.setTimeout(()=>{g.current=window.requestAnimationFrame(I)},300)},initializing:d,running:l}})({ref:U,hasNextPage:ae,fetchNextPage:se,isFetchingNextPage:oe,onBottomReached:()=>G?._id&&y.refetchQueries({queryKey:[v.CONTENTS_BY_EVENT(G._id)]})});e(()=>{G?.slug&&le(G.slug)},[G?.slug,le]);const me=a(()=>B===I.SINGLE,[B]),he=a(()=>/* @__PURE__ */s(ke,{event:G,onAutoscrollClick:ce}),[G,ce]),fe=n(null),pe=n({hasNextPage:ae,isFetchingNextPage:oe,loading:D,running:ue,fetchNextPage:se});pe.current={hasNextPage:ae,isFetchingNextPage:oe,loading:D,running:ue,fetchNextPage:se},e(()=>(fe.current=new IntersectionObserver(e=>{const t=pe.current;t.running||e[0].isIntersecting&&t.hasNextPage&&!t.isFetchingNextPage&&!t.loading&&t.fetchNextPage()},{rootMargin:"200px"}),()=>{fe.current?.disconnect(),fe.current=null}),[]);const we=o(e=>{const t=fe.current;t&&(t.disconnect(),e&&t.observe(e))},[]),ve=W?.bannerPositions??[],Te=T?._id,Ne=W&&ve.includes("right"),qe=Boolean(T?.integrationSettings?.showQuickSearch);/* @__PURE__ */
33
+ return s("div",{className:"bg-background mx-auto min-h-[80vh]",children:[
34
+ /* @__PURE__ */s("div",{className:"flex flex-row justify-end gap-4 pt-2",children:he}),
35
+ /* @__PURE__ */s("div",{className:"pb-3",children:/* @__PURE__ */s(ye,{})}),W&&ve.includes("top")&&/* @__PURE__ */s(je,{position:"top",gamConfig:W,eventId:G?._id,organizationId:Te}),
36
+ /* @__PURE__ */s(Ve,{engagementStyle:G?.engagementStyle,disabled:c||D,mode:B,onModeChange:e=>H(e),sort:P,sortOrder:F,onSortChange:e=>O(e),onSortOrderChange:()=>j("asc"===F?"desc":"asc"),handleChange:C,face:z,onFaceImageChange:e=>M(e)}),z&&/* @__PURE__ */s("div",{className:"flex gap-4 py-2",children:[/* @__PURE__ */s("div",{className:"space-y-2",children:[/* @__PURE__ */s(V,{variant:"h4",children:"Searching using"}),/* @__PURE__ */s("img",{src:z,alt:"face",className:"h-32 rounded"})]}),/* @__PURE__ */s("div",{className:"flex flex-col justify-end gap-2",children:/* @__PURE__ */s(ee,{color:"error",icon:/* @__PURE__ */s(Z,{className:"size-5"}),onClick:()=>M(void 0),children:"Clear search"})})]}),
37
+ /* @__PURE__ */s("div",{className:"flex items-start gap-4",children:[/* @__PURE__ */s("div",{className:"min-w-0 flex-1",children:[c||D?/* @__PURE__ */s("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3",children:Array.from({length:8}).map((e,t)=>/* @__PURE__ */s(Q,{className:"h-72"},t))}):Y?/* @__PURE__ */s("div",{className:"my-16 flex flex-col items-center gap-4",children:/* @__PURE__ */s(K,{title:X?.message?.toLowerCase().includes("timed out")?"Request timed out":"Failed to load",description:/* @__PURE__ */s("div",{className:"flex flex-col items-center gap-4",children:[/* @__PURE__ */s(V,{variant:"body2",color:"muted",align:"center",children:X?.message?.toLowerCase().includes("timed out")?"The search took too long to respond. Please try again.":"Something went wrong while loading content."}),/* @__PURE__ */s(ee,{icon:/* @__PURE__ */s(ge,{className:"size-5"}),onClick:()=>{ne()},children:"Retry"})]})})}):re?.length<=0?/* @__PURE__ */s("div",{className:"my-16 flex flex-col items-center gap-4",children:/* @__PURE__ */s(K,{title:"No Contents",description:"Check back soon for amazing contents.",iconSvg:/* @__PURE__ */s(Fe,{})})}):/* @__PURE__ */s(l,{children:[
38
+ /* @__PURE__ */s("div",{ref:U,className:u(me?"flex w-full justify-center":"",de?"opacity-0":"opacity-100",ue?"scrollbar-hide pointer-events-none transition-opacity duration-300":"pointer-events-auto transition-none","relative size-full overflow-auto"),children:/* @__PURE__ */s(i,{fallback:/* @__PURE__ */s("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Array.from({length:8}).map((e,t)=>/* @__PURE__ */s(Q,{className:"h-72"},t))}),children:/* @__PURE__ */s(He,{event:G,contents:re,gamConfig:W,singleColumnMode:me,kioskMode:ue,timestampField:P===N.CAPTURE_TIME?"capturedAt":void 0,curateLink:G?.engagementStyle===b.CONTEST&&G.status===k.OPEN&&G.slug?A.CURATE(G.slug):void 0,onChangeFaceUrl:e=>M(e),showQuickSearch:qe})})}),
39
+ /* @__PURE__ */s("div",{ref:we,className:"h-4 w-full","aria-hidden":"true"}),oe&&/* @__PURE__ */s("div",{className:"mx-auto my-6 w-fit",children:/* @__PURE__ */s(te,{className:"size-8"})})]}),W&&ve.includes("bottom")&&/* @__PURE__ */s(je,{position:"bottom",gamConfig:W,eventId:G?._id,organizationId:Te})]}),Ne&&/* @__PURE__ */s(Be,{gamConfig:W,eventId:G?._id,organizationId:Te})]})]})};export{Ue as default};
@@ -0,0 +1 @@
1
+ var e={videoAttributes:{controls:"",playsinline:"",muted:"",preload:"auto"},autoplay:!0,preventDragOffset:40};function t(e){return e&&e.data&&"video"===e.data.type}var o=class{constructor(e,t){this.options=t,this.initLightboxEvents(e),e.on("init",()=>{this.initPswpEvents(e.pswp)})}initLightboxEvents(e){e.on("contentLoad",this.onContentLoad.bind(this)),e.on("contentDestroy",this.onContentDestroy.bind(this)),e.on("contentActivate",this.onContentActivate.bind(this)),e.on("contentDeactivate",this.onContentDeactivate.bind(this)),e.on("contentAppend",this.onContentAppend.bind(this)),e.on("contentResize",this.onContentResize.bind(this)),e.addFilter("isKeepingPlaceholder",this.isKeepingPlaceholder.bind(this)),e.addFilter("isContentZoomable",this.isContentZoomable.bind(this)),e.addFilter("useContentPlaceholder",this.useContentPlaceholder.bind(this)),e.addFilter("domItemData",(e,t,o)=>("video"===e.type&&o&&(o.dataset.pswpVideoSources?e.videoSources=JSON.parse(o.dataset.pswpVideoSources):o.dataset.pswpVideoSrc?e.videoSrc=o.dataset.pswpVideoSrc:e.videoSrc=o.href),e))}initPswpEvents(e){e.on("pointerDown",o=>{const n=e.currSlide;if(t(n)&&this.options.preventDragOffset){const t=o.originalEvent;if("pointerdown"===t.type){const i=Math.ceil(n.height*n.currZoomLevel)+n.bounds.center.y,s=t.pageY-e.offset.y;s>i-this.options.preventDragOffset&&s<i&&o.preventDefault()}}}),e.on("appendHeavy",e=>{t(e.slide)&&!e.slide.isActive&&e.preventDefault()}),e.on("close",()=>{t(e.currSlide.content)&&this.pauseVideo(e.currSlide.content)})}onContentDestroy({content:e}){t(e)&&e._videoPosterImg&&(e._videoPosterImg.onload=e._videoPosterImg.onerror=null,e._videoPosterImg=null)}onContentResize(e){if(t(e.content)){e.preventDefault();const t=e.width,o=e.height,n=e.content;if(n.element&&(n.element.style.width=`${t}px`,n.element.style.height=`${o}px`),n.slide&&n.slide.placeholder){const e=n.slide.placeholder.element.style;e.transform="none",e.width=`${t}px`,e.height=`${o}px`}}}isKeepingPlaceholder(e,o){return!t(o)&&e}isContentZoomable(e,o){return!t(o)&&e}onContentActivate({content:e}){t(e)&&this.options.autoplay&&this.playVideo(e)}onContentDeactivate({content:e}){t(e)&&this.pauseVideo(e)}onContentAppend(e){t(e.content)&&(e.preventDefault(),e.content.isAttached=!0,e.content.appendImage())}onContentLoad(e){const o=e.content;if(t(e.content)&&(e.preventDefault(),!o.element)){if(o.state="loading",o.type="video",o.element=document.createElement("video"),this.options.videoAttributes)for(let e in this.options.videoAttributes)o.element.setAttribute(e,this.options.videoAttributes[e]||"");o.element.setAttribute("poster",o.data.msrc),this.preloadVideoPoster(o,o.data.msrc),o.element.style.position="relative",o.element.style.left=0,o.element.style.top=0,o.data.videoSources?o.data.videoSources.forEach(e=>{let t=document.createElement("source");t.src=e.src,t.type=e.type,o.element.appendChild(t)}):o.data.videoSrc&&(o.element.src=o.data.videoSrc)}}preloadVideoPoster(e,t){!e._videoPosterImg&&t&&(e._videoPosterImg=new Image,e._videoPosterImg.src=t,e._videoPosterImg.complete?e.onLoaded():e._videoPosterImg.onload=e._videoPosterImg.onerror=()=>{e.onLoaded()})}playVideo(e){e.element&&e.element.play()}pauseVideo(e){e.element&&e.element.pause()}useContentPlaceholder(e,o){return!!t(o)||e}},n=class{constructor(t,n={}){new o(t,{...e,...n})}};export{n as default};
@@ -1,2 +1,2 @@
1
- import{D as e,_ as t,a as r,f as o,h as n,t as s}from"./DrrpB4Om.js";import{i}from"./CaX2xgrP.js";import{n as a}from"./BkIDQGIs.js";var l=({as:r="div",className:n,threshold:s=.5,rootMargin:i="0px",triggerOnce:a,onChange:l,onClick:h,children:c})=>{const u=o(null),d=o(!1),p=o(l);return p.current=l,t(()=>{const e=u.current;if(!e)return;d.current=!1;const t=new IntersectionObserver(e=>{e.forEach(e=>{a&&d.current||(e.isIntersecting&&(d.current=!0),p.current?.(e.isIntersecting))})},{threshold:s,rootMargin:i});return t.observe(e),()=>t.disconnect()},[s,i,a]),e(r,{ref:u,className:n,onClick:h},c)},h=Object.defineProperty,c=Object.defineProperties,u=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,g=(e,t,r)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,m=(e,t)=>{for(var r in t||(t={}))p.call(t,r)&&g(e,r,t[r]);if(d)for(var r of d(t))f.call(t,r)&&g(e,r,t[r]);return e},b=(e,t)=>c(e,u(t)),w=(e,t)=>{var r={};for(var o in e)p.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&d)for(var o of d(e))t.indexOf(o)<0&&f.call(e,o)&&(r[o]=e[o]);return r},v=class extends r{constructor(){super(...arguments),this.canvas=null,this.handleRef=e=>{this.canvas=e,this.draw()},this.draw=()=>{let{hash:e,height:t,punch:r,width:o}=this.props;if(this.canvas){let n=a(e,o,t,r),s=this.canvas.getContext("2d"),i=s.createImageData(o,t);i.data.set(n),s.putImageData(i,0,0)}}}componentDidUpdate(){this.draw()}render(){let t=this.props,{hash:r,height:o,width:n}=t,s=w(t,["hash","height","width"]);return e("canvas",b(m({},s),{height:o,width:n,ref:this.handleRef}))}};v.defaultProps={height:128,width:128};var y={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends r{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let t=this.props,{hash:r,height:o,width:n,punch:s,resolutionX:i,resolutionY:a,style:l}=t,h=w(t,["hash","height","width","punch","resolutionX","resolutionY","style"]);return e("div",b(m({},h),{style:b(m({display:"inline-block",height:o,width:n},l),{position:"relative"})}),e(v,{hash:r,height:a,width:i,punch:s,style:y}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var j=v,O=({src:e,alt:r,threshold:a=.1,rootMargin:h="600px 0px",blurhash:c,containerClassName:u="size-full",wrapperClassName:d,imgClassName:p="",sizeMode:f="cover",position:g="center",delayMs:m=100,delayTime:b,onClick:w})=>{const v=c&&c.length>=6?c:"LEHV6nWB2yk8pyo0adR*.7kCMdnj",[y,O]=n(!1),[C,x]=n(!1),[N,k]=n(!1),z=o(null);t(()=>{O(!1),x(!1)},[e]);const M="number"==typeof b?b:m,P=d??u;t(()=>{if(!y)return N?z.current=window.setTimeout(()=>{x(!0)},M):z.current&&(clearTimeout(z.current),z.current=null),()=>{z.current&&clearTimeout(z.current)}},[N,y,M]);const D=C&&N||y;/* @__PURE__ */
1
+ import{D as e,_ as t,a as r,f as o,h as n,t as s}from"./DrrpB4Om.js";import{i}from"./BlmPmkho.js";import{n as a}from"./BkIDQGIs.js";var l=({as:r="div",className:n,threshold:s=.5,rootMargin:i="0px",triggerOnce:a,onChange:l,onClick:h,children:c})=>{const u=o(null),d=o(!1),p=o(l);return p.current=l,t(()=>{const e=u.current;if(!e)return;d.current=!1;const t=new IntersectionObserver(e=>{e.forEach(e=>{a&&d.current||(e.isIntersecting&&(d.current=!0),p.current?.(e.isIntersecting))})},{threshold:s,rootMargin:i});return t.observe(e),()=>t.disconnect()},[s,i,a]),e(r,{ref:u,className:n,onClick:h},c)},h=Object.defineProperty,c=Object.defineProperties,u=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,g=(e,t,r)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,m=(e,t)=>{for(var r in t||(t={}))p.call(t,r)&&g(e,r,t[r]);if(d)for(var r of d(t))f.call(t,r)&&g(e,r,t[r]);return e},b=(e,t)=>c(e,u(t)),w=(e,t)=>{var r={};for(var o in e)p.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&d)for(var o of d(e))t.indexOf(o)<0&&f.call(e,o)&&(r[o]=e[o]);return r},v=class extends r{constructor(){super(...arguments),this.canvas=null,this.handleRef=e=>{this.canvas=e,this.draw()},this.draw=()=>{let{hash:e,height:t,punch:r,width:o}=this.props;if(this.canvas){let n=a(e,o,t,r),s=this.canvas.getContext("2d"),i=s.createImageData(o,t);i.data.set(n),s.putImageData(i,0,0)}}}componentDidUpdate(){this.draw()}render(){let t=this.props,{hash:r,height:o,width:n}=t,s=w(t,["hash","height","width"]);return e("canvas",b(m({},s),{height:o,width:n,ref:this.handleRef}))}};v.defaultProps={height:128,width:128};var y={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends r{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let t=this.props,{hash:r,height:o,width:n,punch:s,resolutionX:i,resolutionY:a,style:l}=t,h=w(t,["hash","height","width","punch","resolutionX","resolutionY","style"]);return e("div",b(m({},h),{style:b(m({display:"inline-block",height:o,width:n},l),{position:"relative"})}),e(v,{hash:r,height:a,width:i,punch:s,style:y}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var j=v,O=({src:e,alt:r,threshold:a=.1,rootMargin:h="600px 0px",blurhash:c,containerClassName:u="size-full",wrapperClassName:d,imgClassName:p="",sizeMode:f="cover",position:g="center",delayMs:m=100,delayTime:b,onClick:w})=>{const v=c&&c.length>=6?c:"LEHV6nWB2yk8pyo0adR*.7kCMdnj",[y,O]=n(!1),[C,x]=n(!1),[N,k]=n(!1),z=o(null);t(()=>{O(!1),x(!1)},[e]);const M="number"==typeof b?b:m,P=d??u;t(()=>{if(!y)return N?z.current=window.setTimeout(()=>{x(!0)},M):z.current&&(clearTimeout(z.current),z.current=null),()=>{z.current&&clearTimeout(z.current)}},[N,y,M]);const D=C&&N||y;/* @__PURE__ */
2
2
  return s(l,{as:"div",className:i(P,"relative overflow-hidden"),threshold:a,rootMargin:h,onChange:e=>k(e),children:[N&&/* @__PURE__ */s(j,{className:"size-full blur-2xl",hash:v}),D&&e&&/* @__PURE__ */s("img",{alt:r,src:e,loading:"lazy",decoding:"async",onLoad:()=>O(!0),className:i("absolute top-0 left-0 size-full object-center transition-all duration-300",y?"scale-100 opacity-100":"scale-95 opacity-0","contain"===f?"object-contain":"object-cover","top"===g?"object-top":"bottom"===g?"object-bottom":"object-center",p),onClick:e=>w?.(e)})]})};export{l as n,O as t};
@@ -1,4 +1,4 @@
1
- import{_ as e,h as t,t as l,w as n}from"./DrrpB4Om.js";import{i as r}from"./CaX2xgrP.js";import{t as s}from"./CJXPO3HP.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__ */
1
+ import{_ as e,h as t,t as l,w as n}from"./DrrpB4Om.js";import{i as r}from"./BlmPmkho.js";import{t as s}from"./Bt5DH8OK.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
2
  return l("div",{className:"w-40 rounded pt-2 pl-1",children:[
3
3
  /* @__PURE__ */l("div",{className:"relative h-32 w-full overflow-hidden rounded",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"]})]}),
4
4
  /* @__PURE__ */l("div",{className:"line-clamp-2 pt-2 pb-0.5 text-sm font-medium text-black",children:e.name}),
@@ -0,0 +1 @@
1
+ var t=class{constructor(t,i={}){this.lightbox=t,this.options={filmstripButtonOrder:i.filmstripButtonOrder||7,height:i.height||112,thumbnailHeight:i.thumbnailHeight||64,thumbnailWidth:i.thumbnailWidth||96,itemMargin:i.itemMargin??4,buffer:i.buffer??5,backgroundColor:i.backgroundColor||"rgba(0, 0, 0, 0.6)",activeBorderColor:i.activeBorderColor||"#ff4800",...i},this.itemWidth=this.options.thumbnailWidth+this.options.itemMargin,this.filmstripVisible=!0,this.filmstripContainer=null,this.filmstripContent=null,this.filmstripTrack=null,this.isAnimating=!1,this.thumbnailPool=/* @__PURE__ */new Map,this.contents=[],this.scrollTickPending=!1,this.scrollHandler=this.scrollHandler.bind(this),this.handleThumbnailClick=this.handleThumbnailClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),t.on("init",()=>{this.initPswpEvents(t.pswp)})}getRootNode(){return this.lightbox?.pswp?.element?.getRootNode?.()||document}getElementById(t){const i=this.getRootNode();return"function"==typeof i.getElementById?i.getElementById(t):i.querySelector?.(`#${t}`)||document.getElementById(t)}querySelector(t){return this.getRootNode().querySelector?.(t)||document.querySelector(t)}initPswpEvents(t){this.pswp=t,t.on("uiRegister",()=>{this.registerToggleButton(),this.registerFilmstripContainer()}),t.on("afterInit",()=>{this.filmstripContainer=this.getElementById("pswp-filmstrip-container"),this.filmstripContainer&&this.injectStyles()}),t.on("openingAnimationEnd",()=>{this.filmstripVisible&&!this.isAnimating&&requestAnimationFrame(()=>this.showFilmstrip())}),t.on("change",()=>{this.filmstripVisible&&this.filmstripContent&&this.updateActiveSlide(t.currSlide?.index??0)}),t.on("bindEvents",()=>{document.addEventListener("keydown",this.handleKeyDown)}),t.on("close",()=>{document.removeEventListener("keydown",this.handleKeyDown),this.cleanupFilmstrip()})}injectStyles(){const t="pswp-filmstrip-styles",i=this.getRootNode(),n=i.head??i;if(n.querySelector?.(`#${t}`))return;const e=document.createElement("style");e.id=t,e.textContent=`\n #pswp-filmstrip-container {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1000;\n transform: translateY(100%);\n transition: transform 0.3s ease-in-out;\n pointer-events: none;\n }\n\n #pswp-filmstrip-container.pswp-filmstrip--visible {\n transform: translateY(0);\n pointer-events: auto;\n }\n\n .pswp-filmstrip {\n position: relative;\n height: ${this.options.height}px;\n background-color: ${this.options.backgroundColor};\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n -ms-overflow-style: none;\n scroll-behavior: auto;\n user-select: none;\n -webkit-user-select: none;\n padding: 8px 16px;\n box-sizing: border-box;\n }\n\n .pswp-filmstrip::-webkit-scrollbar {\n display: none;\n }\n\n .pswp-filmstrip__track {\n position: relative;\n height: 100%;\n min-width: 100%;\n }\n\n .pswp-filmstrip__item {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n display: inline-flex;\n flex-shrink: 0;\n padding: 0;\n border: none;\n background: none;\n cursor: pointer;\n outline: none;\n border-radius: 4px;\n overflow: hidden;\n transition: transform 0.15s ease;\n }\n\n .pswp-filmstrip__item:hover {\n transform: translateY(-50%) scale(1.05);\n }\n\n .pswp-filmstrip__item:active {\n transform: translateY(-50%) scale(0.95);\n }\n\n .pswp-filmstrip__thumb {\n width: ${this.options.thumbnailWidth}px;\n height: ${this.options.thumbnailHeight}px;\n border-radius: 4px;\n overflow: hidden;\n position: relative;\n border: 2px solid transparent;\n transition: border-color 0.2s ease;\n background-color: #333;\n }\n\n .pswp-filmstrip__thumb--active {\n border-color: ${this.options.activeBorderColor};\n }\n\n .pswp-filmstrip__img {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center;\n z-index: 2;\n opacity: 0;\n transform: scale(0.95);\n transition: opacity 0.3s ease, transform 0.3s ease;\n }\n\n .pswp-filmstrip__img--loaded {\n opacity: 1;\n transform: scale(1);\n }\n\n .pswp-filmstrip__overlay {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 3;\n pointer-events: none;\n }\n\n .pswp-filmstrip__overlay-icon {\n width: 24px;\n height: 24px;\n opacity: 0.8;\n }\n\n .pswp-filmstrip__ad-label {\n position: absolute;\n top: 4px;\n left: 4px;\n font-size: 10px;\n color: white;\n background-color: rgba(0, 0, 0, 0.6);\n padding: 2px 6px;\n border-radius: 3px;\n z-index: 3;\n }\n\n @media (min-width: 1024px) {\n .pswp-filmstrip__thumb {\n width: 80px;\n height: 80px;\n }\n\n .pswp-filmstrip__overlay-icon {\n width: 28px;\n height: 28px;\n }\n }\n `,n.appendChild(e)}registerToggleButton(){this.pswp.ui.registerElement({name:"filmstrip-toggle-button",title:"Toggle filmstrip",order:this.options.filmstripButtonOrder,isButton:!0,html:this.getToggleButtonHtml(),onClick:()=>this.toggleFilmstrip()})}registerFilmstripContainer(){this.pswp.ui.registerElement({name:"filmstrip",isButton:!1,appendTo:"root",html:'<div id="pswp-filmstrip-container"></div>'})}getToggleButtonHtml(){return'\n <svg aria-hidden="true" class="pswp__icn" viewBox="0 0 24 24" width="24" height="24" id="pswp-filmstrip-icon-show">\n <path d="M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4v2.85L1.35 4.2q-.3-.3-.3-.712t.3-.713t.713-.3t.712.3l18.4 18.4q.3.3.3.7t-.3.7t-.712.3t-.713-.3L17.15 20zm0-2h11.15l-10-10H4zM22 6v11q0 .5-.312.75T21 18t-.687-.262t-.313-.763V8h-8.325q-.4 0-.763-.15t-.637-.425L8.55 5.7q-.225-.25-.275-.525t.075-.55t.35-.45T9.275 4H20q.825 0 1.413.588T22 6" />\n <path d="m 5.100795,16.58464 q -0.165328,0 -0.282961,-0.116899 Q 4.700201,16.350842 4.7,16.186347 V 13.398294 Q 4.7,13.233997 4.817834,13.117098 4.935667,13.000199 5.100795,13 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z" style="stroke-width:0.199771" />\n <path d="m 10.572143,16.65489 q -0.165327,0 -0.282961,-0.116899 -0.117632,-0.116899 -0.117833,-0.281394 v -2.788053 q 0,-0.164297 0.117833,-0.281196 0.117834,-0.116899 0.282961,-0.117098 h 2.805562 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z" style="stroke-width:0.199771" />\n <path d="m 16.049385,16.724729 q -0.165327,0 -0.282961,-0.116899 -0.117632,-0.116899 -0.117833,-0.281394 v -2.788053 q 0,-0.164297 0.117833,-0.281196 0.117834,-0.116899 0.282961,-0.117098 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117634,0.281196 v 2.788053 q 0,0.164296 -0.117634,0.281394 -0.117633,0.117099 -0.283161,0.116899 z" style="stroke-width:0.199771" />\n </svg>\n <svg aria-hidden="true" class="pswp__icn" viewBox="0 0 24 24" width="24" height="24" id="pswp-filmstrip-icon-hide" style="display:none">\n <path d="M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20zm0-2h16V8H4z" />\n <path d="m 5.100795,16.58464 q -0.165328,0 -0.282961,-0.116899 Q 4.700201,16.350842 4.7,16.186347 V 13.398294 Q 4.7,13.233997 4.817834,13.117098 4.935667,13.000199 5.100795,13 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z" style="stroke-width:0.199771" />\n <path d="m 10.572144,16.65489 q -0.165329,0 -0.282961,-0.116899 -0.117633,-0.116899 -0.117834,-0.281394 v -2.788053 q 0,-0.164297 0.117834,-0.281196 0.117832,-0.116899 0.282961,-0.117098 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117633,0.281196 v 2.788053 q 0,0.164296 -0.117633,0.281394 -0.117633,0.117099 -0.283161,0.116899 z" style="stroke-width:0.199771" />\n <path d="m 16.049385,16.724729 q -0.165328,0 -0.282961,-0.116899 -0.117633,-0.116899 -0.117834,-0.281394 v -2.788053 q 0,-0.164297 0.117834,-0.281196 0.117833,-0.116899 0.282961,-0.117098 h 2.805561 q 0.165328,0 0.283161,0.117098 0.117834,0.117099 0.117634,0.281196 v 2.788053 q 0,0.164296 -0.117634,0.281394 -0.117633,0.117099 -0.283161,0.116899 z" style="stroke-width:0.199771" />\n </svg>\n '}setCaptionOffset(t){const i=this.getElementById("pswp-caption-container");i&&(i.style.bottom=t?"7rem":"0")}showFilmstrip(){if(!this.filmstripContainer||!this.pswp)return;const t=this.getContentsFromPswp().filter(t=>t&&t.thumbnailUrl);if(0===t.length)return;this.isAnimating=!0,this.contents=t;const i=this.pswp.currSlide?.index??0;this.createFilmstripContent(t,i),this.filmstripContainer.classList.add("pswp-filmstrip--visible"),this.filmstripVisible=!0;const n=this.querySelector(".pswp");n&&n.classList.add("pswp-filmstrip-active"),this.setCaptionOffset(!0),this.updateToggleIcon(),setTimeout(()=>{this.isAnimating=!1},300)}hideFilmstrip(){if(!this.filmstripContainer)return;this.isAnimating=!0,this.filmstripContainer.classList.remove("pswp-filmstrip--visible"),this.filmstripVisible=!1;const t=this.querySelector(".pswp");t&&t.classList.remove("pswp-filmstrip-active"),this.setCaptionOffset(!1),this.updateToggleIcon(),setTimeout(()=>{this.filmstripContainer&&(this.filmstripContainer.innerHTML=""),this.filmstripContent=null,this.filmstripTrack=null,this.thumbnailPool.clear(),this.contents=[],this.isAnimating=!1},300)}toggleFilmstrip(){this.isAnimating||(this.filmstripVisible?this.hideFilmstrip():this.showFilmstrip())}updateToggleIcon(){const t=this.getElementById("pswp-filmstrip-icon-show"),i=this.getElementById("pswp-filmstrip-icon-hide");t&&(t.style.display=this.filmstripVisible?"none":"block"),i&&(i.style.display=this.filmstripVisible?"block":"none")}createFilmstripContent(t,i){if(!this.filmstripContainer)return;const n=document.createElement("div");n.className="pswp-filmstrip",n.id="pswp-filmstrip-content";const e=document.createElement("div");e.className="pswp-filmstrip__track",e.style.width=t.length*this.itemWidth+"px",n.appendChild(e),this.filmstripContainer.innerHTML="",this.filmstripContainer.appendChild(n),this.filmstripContent=n,this.filmstripTrack=e,n.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.renderVisibleThumbnails(i,!0)}scrollHandler(){!this.scrollTickPending&&this.filmstripContent&&(this.scrollTickPending=!0,requestAnimationFrame(()=>{this.scrollTickPending=!1,this.filmstripContent&&this.renderVisibleThumbnails(this.pswp?.currSlide?.index??0,!1)}))}renderVisibleThumbnails(t,i){if(!this.filmstripContent||!this.filmstripTrack)return;const n=this.filmstripContent,e=this.filmstripTrack,s=this.contents,r=s.length;if(0===r)return;const l=n.clientWidth,o=n.scrollLeft,p=this.options.buffer;let a=Math.floor(o/this.itemWidth)-p,h=Math.ceil((o+l)/this.itemWidth)+p;a=Math.max(0,a),h=Math.min(r-1,h);for(const[m,d]of this.thumbnailPool)(m<a||m>h)&&(d.parentNode&&d.parentNode.removeChild(d),this.thumbnailPool.delete(m));for(let m=a;m<=h;m++){const i=s[m];if(!i||!i.thumbnailUrl)continue;let n=this.thumbnailPool.get(m);const r=m===t;n?this.updateThumbnailState(n,m,r):(n=this.createThumbnailButton(i,m,r),n.style.left=m*this.itemWidth+"px",e.appendChild(n),this.thumbnailPool.set(m,n))}i&&requestAnimationFrame(()=>this.scrollToThumbnail(t))}createThumbnailButton(t,i,n){const e=document.createElement("button");e.className="pswp-filmstrip__item",e.setAttribute("data-index",i),e.setAttribute("type","button"),e.setAttribute("aria-label",`Go to slide ${i+1}`);const s=document.createElement("div");s.className="pswp-filmstrip__thumb "+(i===n?"pswp-filmstrip__thumb--active":""),s.setAttribute("data-thumb-index",i);const r=document.createElement("img");if(r.className="pswp-filmstrip__img",r.alt=t.caption||`Slide ${i+1}`,r.loading="lazy",r.decoding="async",r.onload=()=>r.classList.add("pswp-filmstrip__img--loaded"),r.src=t.thumbnailUrl,s.appendChild(r),"VIDEO"===t.type){const t=document.createElement("div");t.className="pswp-filmstrip__overlay",t.innerHTML='\n <svg class="pswp-filmstrip__overlay-icon" viewBox="0 0 24 24" fill="white">\n <path 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"/>\n </svg>\n ',s.appendChild(t)}return e.appendChild(s),e.addEventListener("click",this.handleThumbnailClick),e}updateThumbnailState(t,i,n){const e=t.querySelector(".pswp-filmstrip__thumb");e&&(n?(e.classList.add("pswp-filmstrip__thumb--active"),t.setAttribute("aria-current","true")):(e.classList.remove("pswp-filmstrip__thumb--active"),t.removeAttribute("aria-current")))}handleThumbnailClick(t){const i=t.currentTarget,n=parseInt(i.getAttribute("data-index"),10);this.pswp&&!isNaN(n)&&this.pswp.goTo(n)}updateActiveSlide(t){if(this.filmstripContent){for(const[i,n]of this.thumbnailPool)this.updateThumbnailState(n,i,i===t);this.scrollToThumbnail(t)}}scrollToThumbnail(t){if(!this.filmstripContent)return;const i=this.contents;if(t<0||t>=i.length)return;const n=this.filmstripContent,e=n.clientWidth/2,s=t*this.itemWidth+this.itemWidth/2;n.scrollTo({left:s-e,behavior:"smooth"})}handleKeyDown(t){this.filmstripVisible&&this.pswp&&("f"!==t.key&&"F"!==t.key||this.toggleFilmstrip())}getContentsFromPswp(){if(!this.pswp)return[];const t=this.pswp.options?.dataSource;if(t?.gallery)return this.getContentsFromDOM(t.gallery);const i="function"==typeof this.pswp.getNumItems?this.pswp.getNumItems():0;if(!i)return[];const n=[];for(let e=0;e<i;e++){let t=null;this.pswp.slides?.[e]?.data?t=this.pswp.slides[e].data:"function"==typeof this.pswp.getItemData&&(t=this.pswp.getItemData(e)),n.push(t||{})}return n.map((t,i)=>this.normalizeItem(t,i))}getContentsFromDOM(t){if(!t)return[];const i=t.querySelectorAll("a[href]");return Array.from(i).map((t,i)=>{const n=t.dataset,e=n.pswpThumbnailUrl||n.pswpMsrc||"",s=(n.pswpType||"").toString().toUpperCase(),r=n.pswpCaption||t.getAttribute("title")||"";return{id:n.pswpId||`item-${i}`,type:s,thumbnailUrl:e||n.pswpSrc||t.getAttribute("href")||"",caption:r}})}normalizeItem(t,i){try{const n=t||{},e=n.data||n,s=(e.type||e.pswpType||n.type||"").toString().toUpperCase(),r=e.thumbnailUrl||e.thumbnail||e.msrc||e.src||"";return{id:e.id||e._id||n.id||n._id||`item-${i}`,type:s,thumbnailUrl:r,caption:e.caption||e.alt||e.title||""}}catch{return{id:`item-${i}`,type:"",thumbnailUrl:"",caption:""}}}cleanupFilmstrip(){const t=this.querySelector(".pswp");t&&t.classList.remove("pswp-filmstrip-active"),this.setCaptionOffset(!1),this.filmstripContent&&(this.filmstripContent.removeEventListener("scroll",this.scrollHandler),this.filmstripContent.innerHTML=""),this.filmstripContainer&&(this.filmstripContainer.innerHTML="",this.filmstripContainer.classList.remove("pswp-filmstrip--visible")),this.filmstripContent=null,this.filmstripTrack=null,this.thumbnailPool.clear(),this.contents=[],this.filmstripVisible=!0,this.isAnimating=!1}};export{t as default};