@qratilabs/qrati-connect 2.27.2 → 2.28.1

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 (59) hide show
  1. package/element/1UqTmSK2.js +3 -0
  2. package/element/{B0sEsGHn.js → 2PuRbItp.js} +7 -7
  3. package/element/{B5RetLW0.js → 3uWxzKri.js} +51 -49
  4. package/element/{DyemeRjE2.js → 5z04gCoQ2.js} +1 -1
  5. package/element/77CTD63x.js +3 -0
  6. package/element/{B9ImRAum.js → 7zeKIiiL.js} +1 -1
  7. package/element/{MU5QuIq0.js → B01ceTPt.js} +1 -1
  8. package/element/{C8meSsHD.js → B7YFs6p5.js} +1 -1
  9. package/element/BB90a5r62.js +93 -0
  10. package/element/{DSx5wvUb2.js → BHmNrbtm2.js} +1 -1
  11. package/element/{DlAI3J0X.js → BMcQNiLL.js} +1 -1
  12. package/element/{DZGp2V2-.js → BMibcq6T.js} +1 -1
  13. package/element/BUDCYszs.js +1 -0
  14. package/element/{DdYePHxG.js → BcAwTWQC.js} +1 -1
  15. package/element/BdQrGBTf.js +4 -0
  16. package/element/Bgw9OUdR.js +4 -0
  17. package/element/{BdkTKcG52.js → BhOaopIk2.js} +5 -5
  18. package/element/C6et9sp52.js +3 -0
  19. package/element/{C4DSwLWc.js → C6ph3KPL.js} +1 -1
  20. package/element/{DOOdI-Oh.js → C8ixb9k4.js} +1 -1
  21. package/element/{Bspyv2wJ2.js → CKwlnGWW2.js} +2 -2
  22. package/element/{p0Q_2x6C.js → CLV9vt29.js} +4 -5
  23. package/element/CZK4LCzr2.js +3 -0
  24. package/element/CfTxXwtG2.js +36 -0
  25. package/element/{Vk429P022.js → Cr4OmKxk2.js} +1 -1
  26. package/element/{DvisvxzJ.js → CrF08YS6.js} +1 -1
  27. package/element/CtApMHPf.js +11 -0
  28. package/element/{BKENYwOQ.js → CxJgMv2R.js} +1 -1
  29. package/element/{DGZEznLT2.js → D34k0bDj2.js} +1 -1
  30. package/element/DBlhTxUx2.js +16 -0
  31. package/element/{CeHBrY_i.js → DUEaNsCB.js} +1 -1
  32. package/element/DUWOb-5c.js +1 -0
  33. package/element/{DmIYOIw1.js → DZwpw1jG.js} +1 -1
  34. package/element/{BspExsK7.js → Da7cHmvl.js} +2 -2
  35. package/element/{QDuBhueG.js → DlNQukHq.js} +1 -1
  36. package/element/DmVgPRH5.js +14 -0
  37. package/element/{CBM5QMn8.js → DtcmI8yd2.js} +1 -1
  38. package/element/{DVFC5Z2L2.js → DtqQWU6q2.js} +31 -31
  39. package/element/{DLF5ysgi.js → JFF45CMp.js} +1 -1
  40. package/element/{CUBxHQ8u.js → KdgQ7jUn.js} +1 -1
  41. package/element/{C6YE4WUG2.js → cePYhOkN2.js} +4 -4
  42. package/element/{D_FNRN5A2.js → hiapcVVA2.js} +1 -1
  43. package/element/{CKQOToSD.js → tJ2MS5HS.js} +3 -3
  44. package/element/{1eQ9Ef0M2.js → vA5CQmOb2.js} +2 -2
  45. package/element/web.es.js +39 -39
  46. package/package.json +1 -1
  47. package/element/BLeZg2Bz.js +0 -1
  48. package/element/BmsDSHUi.js +0 -4
  49. package/element/BqiJLitq2.js +0 -3
  50. package/element/C6MqLLDX.js +0 -3
  51. package/element/CfTdZB8y.js +0 -4
  52. package/element/CgxypkdG.js +0 -3
  53. package/element/Cl0CwL5p.js +0 -9
  54. package/element/DRPgs6nu2.js +0 -16
  55. package/element/DWqIpaZ02.js +0 -2
  56. package/element/SgRzjPnr.js +0 -14
  57. package/element/aXvUP7X72.js +0 -93
  58. package/element/qBKIp1ZW2.js +0 -36
  59. /package/element/{DPg_DKOi2.js → DPg_DKOi.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{E as e,_ as t,h as r,p as n,r as s,s as i,t as a,v as o,y as c}from"./DrrpB4Om.js";import{n as l,t as u}from"./DmpmrPE5.js";import{S as h,h as d,i as f}from"./BLeZg2Bz.js";var p={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},m=new class{#e=p;#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)}},y="undefined"==typeof window||"Deno"in globalThis;function g(){}function v(e,t){return"function"==typeof e?e(t):e}function w(e){return"number"==typeof e&&e>=0&&e!==1/0}function b(e,t){return Math.max(e+(t||0)-Date.now(),0)}function S(e,t){return"function"==typeof e?e(t):e}function R(e,t){return"function"==typeof e?e(t):e}function I(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a)if(n){if(t.queryHash!==C(a,t.options))return!1}else if(!E(t.queryKey,a))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return!("boolean"==typeof o&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function O(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(T(t.options.mutationKey)!==T(i))return!1}else if(!E(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function C(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>P(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function E(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>E(e[r],t[r]))}var F=Object.prototype.hasOwnProperty;function A(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=k(e)&&k(t);if(!(n||P(e)&&P(t)))return t;const s=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?new Array(a):{};let c=0;for(let l=0;l<a;l++){const a=n?l:i[l],u=e[a],h=t[a];if(u===h){o[a]=u,(n?l<s:F.call(e,a))&&c++;continue}if(null===u||null===h||"object"!=typeof u||"object"!=typeof h){o[a]=h;continue}const d=A(u,h,r+1);o[a]=d,d===u&&c++}return s===a&&c===s?e:o}function x(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 k(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function P(e){if(!D(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!D(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function D(e){return"[object Object]"===Object.prototype.toString.call(e)}function M(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?A(e,t):t}function q(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Q(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var L=/* @__PURE__ */Symbol();function U(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==L?e.queryFn:()=>Promise.reject(/* @__PURE__ */new Error(`Missing queryFn: '${e.queryHash}'`))}function _(e,t){return"function"==typeof e?e(...t):!!e}var j=/* @__PURE__ */(()=>{let e=()=>y;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(){}},$=new class extends N{#r;#n;#s;constructor(){super(),this.#s=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#s=e,this.#n?.(),this.#n=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}},z=function(e){setTimeout(e,0)},H=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},s=z;const i=n=>{t?e.push(n):s(()=>{r(n)})};return{batch:i=>{let a;t++;try{a=i()}finally{t--,t||(()=>{const t=e;e=[],t.length&&s(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return a},batchCalls:e=>(...t)=>{i(()=>{e(...t)})},schedule:i,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{s=e}}}(),V=new class extends N{#i=!0;#n;#s;constructor(){super(),this.#s=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.#n||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#s=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#i!==e&&(this.#i=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#i}};function G(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function W(e){return Math.min(1e3*2**e,3e4)}function Z(e){return"online"!==(e??"online")||V.isOnline()}var K=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function B(e){let t,r=!1,n=0;const s=G(),i=()=>"pending"!==s.status,a=()=>$.isFocused()&&("always"===e.networkMode||V.isOnline())&&e.canRun(),o=()=>Z(e.networkMode)&&e.canRun(),c=e=>{i()||(t?.(),s.resolve(e))},l=e=>{i()||(t?.(),s.reject(e))},u=()=>new Promise(r=>{t=e=>{(i()||a())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,i()||e.onContinue?.()}),h=()=>{if(i())return;let t;const s=0===n?e.initialPromise:void 0;try{t=s??e.fn()}catch(o){t=Promise.reject(o)}Promise.resolve(t).then(c).catch(t=>{if(i())return;const s=e.retry??(j.isServer()?0:3),o=e.retryDelay??W,c="function"==typeof o?o(n,t):o,d=!0===s||"number"==typeof s&&n<s||"function"==typeof s&&s(n,t);var f;!r&&d?(n++,e.onFail?.(n,t),(f=c,new Promise(e=>{m.setTimeout(e,f)})).then(()=>a()?void 0:u()).then(()=>{r?l(t):h()})):l(t)})};return{promise:s,status:()=>s.status,cancel:t=>{if(!i()){const r=new K(t);l(r),e.onCancel?.(r)}},continue:()=>(t?.(),s),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?h():u().then(h),s)}}var J=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w(this.gcTime)&&(this.#a=m.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#a&&(m.clearTimeout(this.#a),this.#a=void 0)}};function Y(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},c=0;const l=async()=>{let r=!1;const l=e=>{!function(e,r,n){let s,i=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t.signal,i||(i=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)})}(e,0,()=>r=!0)},u=U(t.options,t.fetchOptions),h=async(e,n,s)=>{if(r)return Promise.reject(t.signal.reason);if(null==n&&e.pages.length)return Promise.resolve(e);const i=await u((()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:s?"backward":"forward",meta:t.options.meta};return l(e),e})()),{maxPages:a}=t.options,o=s?Q:q;return{pages:o(e.pages,i,a),pageParams:o(e.pageParams,n,a)}};if(s&&i.length){const e="backward"===s,t=e?ee:X,r={pages:i,pageParams:a};o=await h(r,t(n,r),e)}else{const t=e??i.length;do{const e=0===c?a[0]??n.initialPageParam:X(n,o);if(c>0&&null==e)break;o=await h(o,e),c++}while(c<t)}return o};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function X(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function ee(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function te(e,t){return!!t&&null!=X(e,t)}function re(e,t){return!(!t||!e.getPreviousPageParam)&&null!=ee(e,t)}var ne=class extends J{#o;#c;#l;#u;#h;#d;#f;#p;constructor(e){super(),this.#p=!1,this.#f=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#h=e.client,this.#u=this.#h.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#c=ae(this.options),this.state=e.state??this.#c,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#o}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#f,...e},e?._type&&(this.#o=e._type),this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=ae(this.options);void 0!==e.data&&(this.setState(ie(e.data,e.dataUpdatedAt)),this.#c=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=M(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(g).catch(g):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!==R(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===L||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===S(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||!b(this.state.dataUpdatedAt,e))}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p||this.#y()?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.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,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,r.signal)})},s=()=>{const e=U(this.options,t),r=(()=>{const e={client:this.#h,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,r,this):e(r)},i=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#h,state:this.state,fetchFn:s};return n(e),e})();("infinite"===this.#o?Y(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===i.fetchOptions?.meta||this.#m({type:"fetch",meta:i.fetchOptions?.meta}),this.#d=B({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:e=>{e instanceof K&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(a){if(a instanceof K){if(a.silent)return this.#d.promise;if(a.revert){if(void 0===this.state.data)throw a;return this.state.data}}throw this.#m({type:"error",error:a}),this.#u.config.onError?.(a,this),this.#u.config.onSettled?.(this.state.data,a,this),a}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,...se(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...ie(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),H.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function se(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function ie(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ae(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var oe=class extends N{constructor(e,t){super(),this.options=t,this.#h=e,this.#g=null,this.#v=G(),this.bindMethods(),this.setOptions(t)}#h;#w=void 0;#b=void 0;#S=void 0;#R;#I;#v;#g;#O;#C;#T;#E;#F;#A;#x=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#w.addObserver(this),ce(this.#w,this.options)?this.#k():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return le(this.#w,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return le(this.#w,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#D(),this.#M(),this.#w.removeObserver(this)}setOptions(e){const t=this.options,r=this.#w;if(this.options=this.#h.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof R(this.options.enabled,this.#w))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#q(),this.#w.setOptions(this.options),t._defaulted&&!x(this.options,t)&&this.#h.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#w,observer:this});const n=this.hasListeners();n&&ue(this.#w,r,this.options,t)&&this.#k(),this.updateResult(),!n||this.#w===r&&R(this.options.enabled,this.#w)===R(t.enabled,this.#w)&&S(this.options.staleTime,this.#w)===S(t.staleTime,this.#w)||this.#Q();const s=this.#L();!n||this.#w===r&&R(this.options.enabled,this.#w)===R(t.enabled,this.#w)&&s===this.#A||this.#U(s)}getOptimisticResult(e){const t=this.#h.getQueryCache().build(this.#h,e),r=this.createResult(t,e);var n;return n=r,x(this.getCurrentResult(),n)||(this.#S=r,this.#I=this.options,this.#R=this.#w.state),r}getCurrentResult(){return this.#S}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#x.add(e)}getCurrentQuery(){return this.#w}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#h.defaultQueryOptions(e),r=this.#h.getQueryCache().build(this.#h,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#k({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#S))}#k(e){this.#q();let t=this.#w.fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}#Q(){this.#D();const e=S(this.options.staleTime,this.#w);if(j.isServer()||this.#S.isStale||!w(e))return;const t=b(this.#S.dataUpdatedAt,e)+1;this.#E=m.setTimeout(()=>{this.#S.isStale||this.updateResult()},t)}#L(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#w):this.options.refetchInterval)??!1}#U(e){this.#M(),this.#A=e,!j.isServer()&&!1!==R(this.options.enabled,this.#w)&&w(this.#A)&&0!==this.#A&&(this.#F=m.setInterval(()=>{(this.options.refetchIntervalInBackground||$.isFocused())&&this.#k()},this.#A))}#P(){this.#Q(),this.#U(this.#L())}#D(){void 0!==this.#E&&(m.clearTimeout(this.#E),this.#E=void 0)}#M(){void 0!==this.#F&&(m.clearInterval(this.#F),this.#F=void 0)}createResult(e,t){const r=this.#w,n=this.options,s=this.#S,i=this.#R,a=this.#I,o=e!==r?e.state:this.#b,{state:c}=e;let l,u={...c},h=!1;if(t._optimisticResults){const s=this.hasListeners(),i=!s&&ce(e,t),a=s&&ue(e,r,t,n);(i||a)&&(u={...u,...se(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=u;l=u.data;let m=!1;if(void 0!==t.placeholderData&&void 0===l&&"pending"===p){let e;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(e=s.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#T?.state.data,this.#T):t.placeholderData,void 0!==e&&(p="success",l=M(s?.data,e,t),h=!0)}if(t.select&&void 0!==l&&!m)if(s&&l===i?.data&&t.select===this.#O)l=this.#C;else try{this.#O=t.select,l=t.select(l),l=M(s?.data,l,t),this.#C=l,this.#g=null}catch(I){this.#g=I}this.#g&&(d=this.#g,l=this.#C,f=Date.now(),p="error");const y="fetching"===u.fetchStatus,g="pending"===p,v="error"===p,w=g&&y,b=void 0!==l,S={status:p,fetchStatus:u.fetchStatus,isPending:g,isSuccess:"success"===p,isError:v,isInitialLoading:w,isLoading:w,data:l,dataUpdatedAt:u.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>o.dataUpdateCount||u.errorUpdateCount>o.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:v&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:h,isRefetchError:v&&b,isStale:he(e,t),refetch:this.refetch,promise:this.#v,isEnabled:!1!==R(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==S.data,n="error"===S.status&&!t,s=e=>{n?e.reject(S.error):t&&e.resolve(S.data)},i=()=>{s(this.#v=S.promise=G())},a=this.#v;switch(a.status){case"pending":e.queryHash===r.queryHash&&s(a);break;case"fulfilled":(n||S.data!==a.value)&&i();break;case"rejected":n&&S.error===a.reason||i()}}return S}updateResult(){const e=this.#S,t=this.createResult(this.#w,this.options);this.#R=this.#w.state,this.#I=this.options,void 0!==this.#R.data&&(this.#T=this.#w),x(t,e)||(this.#S=t,this.#_({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#x.size)return!0;const n=new Set(r??this.#x);return this.options.throwOnError&&n.add("error"),Object.keys(this.#S).some(t=>{const r=t;return this.#S[r]!==e[r]&&n.has(r)})})()}))}#q(){const e=this.#h.getQueryCache().build(this.#h,this.options);if(e===this.#w)return;const t=this.#w;this.#w=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#_(e){H.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#S)}),this.#h.getQueryCache().notify({query:this.#w,type:"observerResultsUpdated"})})}};function ce(e,t){return function(e,t){return!1!==R(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===R(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&le(e,t,t.refetchOnMount)}function le(e,t,r){if(!1!==R(t.enabled,e)&&"static"!==S(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&he(e,t)}return!1}function ue(e,t,r,n){return(e!==t||!1===R(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&he(e,r)}function he(e,t){return!1!==R(t.enabled,e)&&e.isStaleByTime(S(t.staleTime,e))}var de=e(void 0),fe=e=>{const t=c(de);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},pe=({client:e,children:r})=>(t(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */a(de.Provider,{value:e,children:r})),me=e(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ye=e(!1),ge=(ye.Provider,(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()}));function ve(e,n,i){const a=c(ye),l=c(me),u=fe(i),h=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(h);const d=u.getQueryCache().get(h.queryHash),f=!1!==e.subscribed;h._optimisticResults=a?"isRestoring":f?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(h),((e,t,r)=>{const n=r?.state.error&&"function"==typeof e.throwOnError?_(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))})(h,l,d),(e=>{t(()=>{e.clearReset()},[e])})(l);const p=!u.getQueryCache().get(h.queryHash),[m]=r(()=>new n(u,h)),y=m.getOptimisticResult(h),v=!a&&f;if(s(o(e=>{const t=v?m.subscribe(H.batchCalls(e)):g;return m.updateResult(),t},[m,v]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),t(()=>{m.setOptions(h)},[h,m]),((e,t)=>e?.suspense&&t.isPending)(h,y))throw ge(h,m,l);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&void 0===e.data||_(r,[e.error,n])))({result:y,errorResetBoundary:l,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw y.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(h,y),h.experimental_prefetchInRender&&!j.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(y,a)&&(p?ge(h,m,l):d?.promise)?.catch(g).finally(()=>{m.updateResult()}),h.notifyOnChangeProps?y:m.trackResult(y)}function we(e,t){return ve(e,oe,t)}function be({title:e,children:t}){/* @__PURE__ */
1
+ import{E as e,_ as t,h as r,p as n,r as s,s as i,t as a,v as o,y as c}from"./DrrpB4Om.js";import{n as l,t as u}from"./DmpmrPE5.js";import{S as h,h as d,i as f}from"./DUWOb-5c.js";var p={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},m=new class{#e=p;#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)}},y="undefined"==typeof window||"Deno"in globalThis;function g(){}function v(e,t){return"function"==typeof e?e(t):e}function w(e){return"number"==typeof e&&e>=0&&e!==1/0}function b(e,t){return Math.max(e+(t||0)-Date.now(),0)}function S(e,t){return"function"==typeof e?e(t):e}function R(e,t){return"function"==typeof e?e(t):e}function I(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a)if(n){if(t.queryHash!==C(a,t.options))return!1}else if(!E(t.queryKey,a))return!1;if("all"!==r){const e=t.isActive();if("active"===r&&!e)return!1;if("inactive"===r&&e)return!1}return!("boolean"==typeof o&&t.isStale()!==o||s&&s!==t.state.fetchStatus||i&&!i(t))}function O(e,t){const{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(T(t.options.mutationKey)!==T(i))return!1}else if(!E(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function C(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>P(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function E(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(r=>E(e[r],t[r]))}var F=Object.prototype.hasOwnProperty;function A(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=x(e)&&x(t);if(!(n||P(e)&&P(t)))return t;const s=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?new Array(a):{};let c=0;for(let l=0;l<a;l++){const a=n?l:i[l],u=e[a],h=t[a];if(u===h){o[a]=u,(n?l<s:F.call(e,a))&&c++;continue}if(null===u||null===h||"object"!=typeof u||"object"!=typeof h){o[a]=h;continue}const d=A(u,h,r+1);o[a]=d,d===u&&c++}return s===a&&c===s?e:o}function k(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 x(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function P(e){if(!D(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!!D(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function D(e){return"[object Object]"===Object.prototype.toString.call(e)}function M(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?A(e,t):t}function q(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Q(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var L=/* @__PURE__ */Symbol();function U(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==L?e.queryFn:()=>Promise.reject(/* @__PURE__ */new Error(`Missing queryFn: '${e.queryHash}'`))}function _(e,t){return"function"==typeof e?e(...t):!!e}var j=/* @__PURE__ */(()=>{let e=()=>y;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(){}},$=new class extends N{#r;#n;#s;constructor(){super(),this.#s=e=>{if("undefined"!=typeof window&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#n||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#s=e,this.#n?.(),this.#n=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}},z=function(e){setTimeout(e,0)},H=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},s=z;const i=n=>{t?e.push(n):s(()=>{r(n)})};return{batch:i=>{let a;t++;try{a=i()}finally{t--,t||(()=>{const t=e;e=[],t.length&&s(()=>{n(()=>{t.forEach(e=>{r(e)})})})})()}return a},batchCalls:e=>(...t)=>{i(()=>{e(...t)})},schedule:i,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{s=e}}}(),V=new class extends N{#i=!0;#n;#s;constructor(){super(),this.#s=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.#n||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#n?.(),this.#n=void 0)}setEventListener(e){this.#s=e,this.#n?.(),this.#n=e(this.setOnline.bind(this))}setOnline(e){this.#i!==e&&(this.#i=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#i}};function G(){let e,t;const r=new Promise((r,n)=>{e=r,t=n});function n(e){Object.assign(r,e),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=t=>{n({status:"fulfilled",value:t}),e(t)},r.reject=e=>{n({status:"rejected",reason:e}),t(e)},r}function W(e){return Math.min(1e3*2**e,3e4)}function Z(e){return"online"!==(e??"online")||V.isOnline()}var K=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function B(e){let t,r=!1,n=0;const s=G(),i=()=>"pending"!==s.status,a=()=>$.isFocused()&&("always"===e.networkMode||V.isOnline())&&e.canRun(),o=()=>Z(e.networkMode)&&e.canRun(),c=e=>{i()||(t?.(),s.resolve(e))},l=e=>{i()||(t?.(),s.reject(e))},u=()=>new Promise(r=>{t=e=>{(i()||a())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,i()||e.onContinue?.()}),h=()=>{if(i())return;let t;const s=0===n?e.initialPromise:void 0;try{t=s??e.fn()}catch(o){t=Promise.reject(o)}Promise.resolve(t).then(c).catch(t=>{if(i())return;const s=e.retry??(j.isServer()?0:3),o=e.retryDelay??W,c="function"==typeof o?o(n,t):o,d=!0===s||"number"==typeof s&&n<s||"function"==typeof s&&s(n,t);var f;!r&&d?(n++,e.onFail?.(n,t),(f=c,new Promise(e=>{m.setTimeout(e,f)})).then(()=>a()?void 0:u()).then(()=>{r?l(t):h()})):l(t)})};return{promise:s,status:()=>s.status,cancel:t=>{if(!i()){const r=new K(t);l(r),e.onCancel?.(r)}},continue:()=>(t?.(),s),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:o,start:()=>(o()?h():u().then(h),s)}}var J=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w(this.gcTime)&&(this.#a=m.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#a&&(m.clearTimeout(this.#a),this.#a=void 0)}};function Y(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},c=0;const l=async()=>{let r=!1;const l=e=>{!function(e,r,n){let s,i=!1;Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t.signal,i||(i=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)})}(e,0,()=>r=!0)},u=U(t.options,t.fetchOptions),h=async(e,n,s)=>{if(r)return Promise.reject(t.signal.reason);if(null==n&&e.pages.length)return Promise.resolve(e);const i=await u((()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:n,direction:s?"backward":"forward",meta:t.options.meta};return l(e),e})()),{maxPages:a}=t.options,o=s?Q:q;return{pages:o(e.pages,i,a),pageParams:o(e.pageParams,n,a)}};if(s&&i.length){const e="backward"===s,t=e?ee:X,r={pages:i,pageParams:a};o=await h(r,t(n,r),e)}else{const t=e??i.length;do{const e=0===c?a[0]??n.initialPageParam:X(n,o);if(c>0&&null==e)break;o=await h(o,e),c++}while(c<t)}return o};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function X(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function ee(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function te(e,t){return!!t&&null!=X(e,t)}function re(e,t){return!(!t||!e.getPreviousPageParam)&&null!=ee(e,t)}var ne=class extends J{#o;#c;#l;#u;#h;#d;#f;#p;constructor(e){super(),this.#p=!1,this.#f=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#h=e.client,this.#u=this.#h.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#c=ae(this.options),this.state=e.state??this.#c,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#o}get promise(){return this.#d?.promise}setOptions(e){if(this.options={...this.#f,...e},e?._type&&(this.#o=e._type),this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=ae(this.options);void 0!==e.data&&(this.setState(ie(e.data,e.dataUpdatedAt)),this.#c=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(e,t){const r=M(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(g).catch(g):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!==R(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===L||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===S(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||!b(this.state.dataUpdatedAt,e))}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#d?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#d?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#d&&(this.#p||this.#y()?this.#d.cancel({revert:!0}):this.#d.cancelRetry()),this.scheduleGc()),this.#u.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,n=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#p=!0,r.signal)})},s=()=>{const e=U(this.options,t),r=(()=>{const e={client:this.#h,queryKey:this.queryKey,meta:this.meta};return n(e),e})();return this.#p=!1,this.options.persister?this.options.persister(e,r,this):e(r)},i=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#h,state:this.state,fetchFn:s};return n(e),e})();("infinite"===this.#o?Y(this.options.pages):this.options.behavior)?.onFetch(i,this),this.#l=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===i.fetchOptions?.meta||this.#m({type:"fetch",meta:i.fetchOptions?.meta}),this.#d=B({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:e=>{e instanceof K&&e.revert&&this.setState({...this.#l,fetchStatus:"idle"}),r.abort()},onFail:(e,t)=>{this.#m({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#m({type:"pause"})},onContinue:()=>{this.#m({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const e=await this.#d.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#u.config.onSuccess?.(e,this),this.#u.config.onSettled?.(e,this.state.error,this),e}catch(a){if(a instanceof K){if(a.silent)return this.#d.promise;if(a.revert){if(void 0===this.state.data)throw a;return this.state.data}}throw this.#m({type:"error",error:a}),this.#u.config.onError?.(a,this),this.#u.config.onSettled?.(this.state.data,a,this),a}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,...se(t.data,this.options),fetchMeta:e.meta??null};case"success":const r={...t,...ie(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#l=e.manual?r:void 0,r;case"error":const n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),H.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:e})})}};function se(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function ie(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ae(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var oe=class extends N{constructor(e,t){super(),this.options=t,this.#h=e,this.#g=null,this.#v=G(),this.bindMethods(),this.setOptions(t)}#h;#w=void 0;#b=void 0;#S=void 0;#R;#I;#v;#g;#O;#C;#T;#E;#F;#A;#k=/* @__PURE__ */new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#w.addObserver(this),ce(this.#w,this.options)?this.#x():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return le(this.#w,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return le(this.#w,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=/* @__PURE__ */new Set,this.#D(),this.#M(),this.#w.removeObserver(this)}setOptions(e){const t=this.options,r=this.#w;if(this.options=this.#h.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof R(this.options.enabled,this.#w))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#q(),this.#w.setOptions(this.options),t._defaulted&&!k(this.options,t)&&this.#h.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#w,observer:this});const n=this.hasListeners();n&&ue(this.#w,r,this.options,t)&&this.#x(),this.updateResult(),!n||this.#w===r&&R(this.options.enabled,this.#w)===R(t.enabled,this.#w)&&S(this.options.staleTime,this.#w)===S(t.staleTime,this.#w)||this.#Q();const s=this.#L();!n||this.#w===r&&R(this.options.enabled,this.#w)===R(t.enabled,this.#w)&&s===this.#A||this.#U(s)}getOptimisticResult(e){const t=this.#h.getQueryCache().build(this.#h,e),r=this.createResult(t,e);var n;return n=r,k(this.getCurrentResult(),n)||(this.#S=r,this.#I=this.options,this.#R=this.#w.state),r}getCurrentResult(){return this.#S}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(/* @__PURE__ */new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#k.add(e)}getCurrentQuery(){return this.#w}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#h.defaultQueryOptions(e),r=this.#h.getQueryCache().build(this.#h,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#x({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#S))}#x(e){this.#q();let t=this.#w.fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}#Q(){this.#D();const e=S(this.options.staleTime,this.#w);if(j.isServer()||this.#S.isStale||!w(e))return;const t=b(this.#S.dataUpdatedAt,e)+1;this.#E=m.setTimeout(()=>{this.#S.isStale||this.updateResult()},t)}#L(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#w):this.options.refetchInterval)??!1}#U(e){this.#M(),this.#A=e,!j.isServer()&&!1!==R(this.options.enabled,this.#w)&&w(this.#A)&&0!==this.#A&&(this.#F=m.setInterval(()=>{(this.options.refetchIntervalInBackground||$.isFocused())&&this.#x()},this.#A))}#P(){this.#Q(),this.#U(this.#L())}#D(){void 0!==this.#E&&(m.clearTimeout(this.#E),this.#E=void 0)}#M(){void 0!==this.#F&&(m.clearInterval(this.#F),this.#F=void 0)}createResult(e,t){const r=this.#w,n=this.options,s=this.#S,i=this.#R,a=this.#I,o=e!==r?e.state:this.#b,{state:c}=e;let l,u={...c},h=!1;if(t._optimisticResults){const s=this.hasListeners(),i=!s&&ce(e,t),a=s&&ue(e,r,t,n);(i||a)&&(u={...u,...se(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=u;l=u.data;let m=!1;if(void 0!==t.placeholderData&&void 0===l&&"pending"===p){let e;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(e=s.data,m=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#T?.state.data,this.#T):t.placeholderData,void 0!==e&&(p="success",l=M(s?.data,e,t),h=!0)}if(t.select&&void 0!==l&&!m)if(s&&l===i?.data&&t.select===this.#O)l=this.#C;else try{this.#O=t.select,l=t.select(l),l=M(s?.data,l,t),this.#C=l,this.#g=null}catch(I){this.#g=I}this.#g&&(d=this.#g,l=this.#C,f=Date.now(),p="error");const y="fetching"===u.fetchStatus,g="pending"===p,v="error"===p,w=g&&y,b=void 0!==l,S={status:p,fetchStatus:u.fetchStatus,isPending:g,isSuccess:"success"===p,isError:v,isInitialLoading:w,isLoading:w,data:l,dataUpdatedAt:u.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>o.dataUpdateCount||u.errorUpdateCount>o.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:v&&!b,isPaused:"paused"===u.fetchStatus,isPlaceholderData:h,isRefetchError:v&&b,isStale:he(e,t),refetch:this.refetch,promise:this.#v,isEnabled:!1!==R(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=void 0!==S.data,n="error"===S.status&&!t,s=e=>{n?e.reject(S.error):t&&e.resolve(S.data)},i=()=>{s(this.#v=S.promise=G())},a=this.#v;switch(a.status){case"pending":e.queryHash===r.queryHash&&s(a);break;case"fulfilled":(n||S.data!==a.value)&&i();break;case"rejected":n&&S.error===a.reason||i()}}return S}updateResult(){const e=this.#S,t=this.createResult(this.#w,this.options);this.#R=this.#w.state,this.#I=this.options,void 0!==this.#R.data&&(this.#T=this.#w),k(t,e)||(this.#S=t,this.#_({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#k.size)return!0;const n=new Set(r??this.#k);return this.options.throwOnError&&n.add("error"),Object.keys(this.#S).some(t=>{const r=t;return this.#S[r]!==e[r]&&n.has(r)})})()}))}#q(){const e=this.#h.getQueryCache().build(this.#h,this.options);if(e===this.#w)return;const t=this.#w;this.#w=e,this.#b=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#_(e){H.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#S)}),this.#h.getQueryCache().notify({query:this.#w,type:"observerResultsUpdated"})})}};function ce(e,t){return function(e,t){return!1!==R(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===R(t.retryOnMount,e))}(e,t)||void 0!==e.state.data&&le(e,t,t.refetchOnMount)}function le(e,t,r){if(!1!==R(t.enabled,e)&&"static"!==S(t.staleTime,e)){const n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&he(e,t)}return!1}function ue(e,t,r,n){return(e!==t||!1===R(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&he(e,r)}function he(e,t){return!1!==R(t.enabled,e)&&e.isStaleByTime(S(t.staleTime,e))}var de=e(void 0),fe=e=>{const t=c(de);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},pe=({client:e,children:r})=>(t(()=>(e.mount(),()=>{e.unmount()}),[e]),/* @__PURE__ */a(de.Provider,{value:e,children:r})),me=e(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ye=e(!1),ge=(ye.Provider,(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()}));function ve(e,n,i){const a=c(ye),l=c(me),u=fe(i),h=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(h);const d=u.getQueryCache().get(h.queryHash),f=!1!==e.subscribed;h._optimisticResults=a?"isRestoring":f?"optimistic":void 0,(e=>{if(e.suspense){const t=1e3,r=e=>"static"===e?e:Math.max(e??t,t),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>r(n(...e)):r(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(h),((e,t,r)=>{const n=r?.state.error&&"function"==typeof e.throwOnError?_(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))})(h,l,d),(e=>{t(()=>{e.clearReset()},[e])})(l);const p=!u.getQueryCache().get(h.queryHash),[m]=r(()=>new n(u,h)),y=m.getOptimisticResult(h),v=!a&&f;if(s(o(e=>{const t=v?m.subscribe(H.batchCalls(e)):g;return m.updateResult(),t},[m,v]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),t(()=>{m.setOptions(h)},[h,m]),((e,t)=>e?.suspense&&t.isPending)(h,y))throw ge(h,m,l);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&void 0===e.data||_(r,[e.error,n])))({result:y,errorResetBoundary:l,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw y.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(h,y),h.experimental_prefetchInRender&&!j.isServer()&&((e,t)=>e.isLoading&&e.isFetching&&!t)(y,a)&&(p?ge(h,m,l):d?.promise)?.catch(g).finally(()=>{m.updateResult()}),h.notifyOnChangeProps?y:m.trackResult(y)}function we(e,t){return ve(e,oe,t)}function be({title:e,children:t}){/* @__PURE__ */
2
2
  return a("div",{className:"mx-auto mt-24 w-fit max-w-xl space-y-8",children:[/* @__PURE__ */a("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__ */a("g",{transform:"translate(-443.142 -257.876)",children:[
3
3
  /* @__PURE__ */a("path",{d:"M898.247,664.1H371.155a30.276,30.276,0,0,1-30.241-30.241V352.525a30.276,30.276,0,0,1,30.241-30.241H898.247a30.276,30.276,0,0,1,30.241,30.241V633.862A30.276,30.276,0,0,1,898.247,664.1Z",transform:"translate(308.867 25.517)",fill:"#fff"}),
4
4
  /* @__PURE__ */a("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"}),
@@ -36,6 +36,6 @@ return a(be,"custom-auth-invalid"===t?{title:"Setup needed",children:["Custom au
36
36
  /* @__PURE__ */a(Se,{organizationId:e})," for details."]}:"page-not-registered"===t?{title:"Page not registered",children:["Add the current page URL in Allowed URLs under"," ",
37
37
  /* @__PURE__ */a("a",{className:"font-medium text-blue-500",href:d.ORGANIZATION_SETTINGS(e),target:"_blank",rel:"noreferrer",children:"Organization Settings"})," ","⇨ Integration Settings. See our ",
38
38
  /* @__PURE__ */a(Se,{organizationId:e})," for details."]}:{title:"Heads up",children:["Something needs attention. See our ",
39
- /* @__PURE__ */a(Se,{organizationId:e})," for details or contact Qrati support."]})}var Ie='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Oe=e=>e.trim().replace(/\s+/g," "),Ce=e=>e?.replace(/\/+$/,"")||"",Te=e=>{if(!e)return Ie;const t=Oe("string"==typeof e?e:e.fontFamily||""),r="string"==typeof e?void 0:e.customFontName;return t&&"system"!==t?"custom"===t?`"${r||"QratiCustomFont"}", ${Ie}`:`"${t}", ${Ie}`:"inherit"};function Ee(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Ee(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Fe(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ee(e))&&(n&&(n+=" "),n+=t);return n}var Ae=(...e)=>Fe(e.filter(Boolean)),xe=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"},ke="px",Pe=(e,t="light")=>{const r=e?.themeSettings?.colors??{},n=e?.themeSettings?.border,s=e?.themeSettings?.shadow,i=e?.integrationSettings,a="dark"===t,o=(e,t,n,s)=>{const i=a?s:n;return r[a?t:e]||i},c=o("primaryLight","primaryDark","#ff4800","#ff4800");return{"--background":o("backgroundLight","backgroundDark","#fafafa","#0a0a0a"),"--foreground":o("foregroundLight","foregroundDark","#252629","#f5f5f5"),"--muted":o("mutedLight","mutedDark","#e5e5e5","#171717"),"--muted-foreground":o("mutedForegroundLight","mutedForegroundDark","#484848","#b5b8bb"),"--border":o("borderLight","borderDark","#dddddd","#353538"),"--input":o("inputLight","inputDark","#f5f5f5","#171717"),"--primary":c,"--primary-foreground":xe(c),"--popover":o("popoverLight","popoverDark","#f5f5f5","#171717"),"--popover-foreground":o("popoverForegroundLight","popoverForegroundDark","#252629","#fafafa"),"--info":o("infoLight","infoDark","#2563eb","#5b8def"),"--warning":o("warningLight","warningDark","#f59e0b","#fbbf24"),"--success":o("successLight","successDark","#10b981","#34d399"),"--destructive":o("destructiveLight","destructiveDark","#ef4444","#f87171"),"--border-width":`${n?.width??"1"}${n?.unit??"px"}`,"--radius":`${n?.radius??"10"}${n?.unit??"px"}`,"--shadow-outer-horizontal-offset":`${s?.outerHorizontalOffset??"0"}${s?.unit??ke}`,"--shadow-outer-vertical-offset":`${s?.outerVerticalOffset??"0"}${s?.unit??ke}`,"--shadow-outer-blur":`${s?.outerBlur??"0"}${s?.unit??ke}`,"--shadow-outer-spread":`${s?.outerSpread??"0"}${s?.unit??ke}`,...i?.fontFamily&&"system"!==i.fontFamily?{"--font-family":Te(i)}:{}}},De=async e=>{try{return await e()}catch{return null}},Me=(e,t=1)=>{const r=(new TextEncoder).encode(e),n=3432918353,s=461845907;let i=t>>>0;const a=Math.floor(r.length/4),o=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let h=0;h<a;h++){let e=o.getUint32(4*h,!0);e=Math.imul(e,n),e=e<<15|e>>>17,e=Math.imul(e,s),i^=e,i=i<<13|i>>>19,i=Math.imul(i,5)+3864292196>>>0}let c=0;const l=4*a,u=3&r.length;return 3===u&&(c^=r[l+2]<<16),u>=2&&(c^=r[l+1]<<8),u>=1&&(c^=r[l],c=Math.imul(c,n),c=c<<15|c>>>17,c=Math.imul(c,s),i^=c),i^=r.length,i^=i>>>16,i=Math.imul(i,2246822507)>>>0,i^=i>>>13,i=Math.imul(i,3266489909)>>>0,i^=i>>>16,i.toString(16).padStart(8,"0")},qe=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(qe).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const n of t){const t=e[n];void 0!==t&&r.push(`${qe(n)}:${qe(t)}`)}return`{${r.join(",")}}`},Qe=async({debug:e=!1}={})=>{const t=performance.now(),r=await De(async()=>window.navigator.userAgentData&&"function"==typeof window.navigator.userAgentData.getHighEntropyValues?qe(await window.navigator.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","model","fullVersionList"])):null),n=await De(()=>(()=>{const e=document.createElement("video"),t=["video/webm","video/mp4","video/ogg","audio/mp4","audio/webm","audio/ogg","audio/mpeg"],r={};for(const n of t){const t=e.canPlayType(n);r[n]=""===t?"no":t}return qe(r)})()),s=await De(()=>(()=>{const e=["monospace","serif","sans-serif"],t=["Arial","Helvetica","Verdana","Trebuchet MS","Comic Sans MS","Georgia","Times New Roman","Courier New","Segoe UI","Roboto","Open Sans","Noto Sans","system-ui","-apple-system","BlinkMacSystemFont"],r=document.createElement("span");r.style.fontSize="72px",r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="nowrap",r.textContent="mmmmmmmmmwwwwwww",document.body.appendChild(r);const n={};for(const i of e)r.style.fontFamily=i,n[i]=r.offsetWidth;const s=[];for(const i of t){let t=!1;for(const a of e)if(r.style.fontFamily=`"${i}", ${a}`,r.offsetWidth!==n[a]){s.push(i),t=!0;break}t||(r.style.fontFamily=`"${i}"`,r.offsetWidth!==n.monospace&&r.offsetWidth!==n.serif&&s.push(i))}return document.body.removeChild(r),s.length?s.sort().join(","):null})()),i=await De(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),a=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,o=Intl.DateTimeFormat().resolvedOptions(),c=o.timeZone,l=/* @__PURE__ */(new Date).getTimezoneOffset(),u=o.calendar||null,h=void 0!==o.hour12?o.hour12?"h12":"h23":o.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:v,colorDepth:w}=window.screen,b="ontouchstart"in window||window.navigator.maxTouchPoints>0,S=await De(()=>(async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),n=r.createLinearGradient(0,0,280,100);return n.addColorStop(0,"#f60"),n.addColorStop(.4,"#09f"),n.addColorStop(.7,"#f09"),n.addColorStop(1,"#0f9"),r.fillStyle=n,r.fillRect(0,0,280,100),r.font='18px "Arial","Helvetica","DejaVu Sans",sans-serif',r.fillStyle="#000",r.textBaseline="alphabetic",r.fillText("Fingerprint ¼½¾™©®∆π∑€¶§",12,45),r.font='bold 22px "Georgia","Times New Roman",serif',r.fillStyle="#222",r.fillText("🦊🐱🚀 2026",12,78),r.globalAlpha=.7,r.fillStyle="rgba(255, 80, 0, 0.35)",r.fillRect(180,20,80,60),r.beginPath(),r.arc(220,50,32,0,2*Math.PI),r.strokeStyle="#fff",r.lineWidth=4,r.stroke(),r.beginPath(),r.moveTo(30,85),r.quadraticCurveTo(140,20,240,85),r.strokeStyle="#00f",r.lineWidth=3,r.stroke(),e&&(t.style.border="1px solid #444",document.body.appendChild(t)),Me(t.toDataURL("image/png"))})(e)),R=await De(()=>(async()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info");return Me(qe({vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)}))})()),I=await De(()=>(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 Me(qe(r))})(e)),O=await De(()=>(async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const n=t.createDynamicsCompressor();n.threshold.value=-48,n.knee.value=30,n.ratio.value=14,n.attack.value=0,n.release.value=.3;const s=t.createGain();s.gain.value=.4,r.connect(n),n.connect(s),s.connect(t.destination),r.start(0);const i=(await t.startRendering()).getChannelData(0);let a=0,o=0;for(let l=3e3;l<5800;l+=2){const e=i[l];a=31*a+Math.floor(1e5*(e+1))|0,o=Math.imul(o^Math.floor(98765*e),2246822519)}const c=a>>>0^o>>>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(i.slice(4500,5e3)),n=e.width/r.length;for(let s=0;s<r.length;s++){const i=s*n,a=(r[s]+1)/2*e.height;0===s?t.moveTo(i,a):t.lineTo(i,a)}t.stroke(),document.body.appendChild(e)}return Me(c.toString(16))})(e)),C=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,T=await De(()=>window.screen.orientation?.type||null),E=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,F=E&&E.type||null,A=E?.effectiveType||null,x=!0===E?.saveData,k="boolean"==typeof window.navigator.pdfViewerEnabled?window.navigator.pdfViewerEnabled:null,P="boolean"==typeof window.navigator.webdriver?window.navigator.webdriver:null,D=await De(()=>"function"!=typeof Intl.supportedValuesOf?null:Intl.supportedValuesOf("calendar").join(",")),M=await De(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 qe(t)}),q={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,userAgentHighEntropy:r||null,mediaCodecs:n||null,fonts:s,numberingSystem:i,languages:a,timezone:c,timezoneOffset:l,intlCalendar:u,hourCycle:h,reducedMotion:d,colorScheme:f,prefersContrast:p,prefersReducedTransparency:m,pdfViewerEnabled:k,webdriver:P,intlSupportedCalendars:D||null,permissionsState:M||null,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:y,devicePixelRatio:g,pixelDepth:v,colorDepth:w,touchSupport:b,screenOrientation:T||null,connectionType:F,effectiveType:A,saveData:x,canvasID:S,webglID:R,webgpuID:I,audioID:O},Q={aspectRatio:C,width:window.screen.width,height:window.screen.height,maxTouchPoints:window.navigator.maxTouchPoints};(!0===navigator.userAgentData?.mobile||/Mobi|Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent)||navigator.maxTouchPoints>0&&matchMedia("(pointer:coarse)").matches&&innerWidth<=1024)&&Object.assign(q,Q);const L=Me(qe(q)),U=Math.round(performance.now()-t);return{fingerprint:L,...q,elapsedMs:U}};"undefined"!=typeof window&&(window.getBrowserFingerprint=Qe);var Le=async(e,t)=>{if(e instanceof l){try{const t=e.data;if(t?.error)return t.error;if(t?.message)return t.message;if("INVALID_EMAIL_OR_PASSWORD"===t?.code)return"Invalid email or password"}catch{return t||e.message}return t||e.message}return e instanceof Error?t||e.message:t||String(e)},Ue=e(void 0),_e=({props:e={},children:s})=>{const{organizationId:c,uid:d,fname:p,lname:m,theme:y="light"}=e,g=fe(),[v,w]=r(null),[b,S]=r(()=>{if("undefined"==typeof window)return null;const e=localStorage.getItem("qrati_token");return e?{token:e}:null}),{isLoading:R,data:I,error:O}=we({queryKey:[h.QRATI_CONNECT_SESSION,c,d??null,p??null,m??null],queryFn:async()=>{const e=await(async()=>{const e=await Qe();return"string"==typeof e?e:e?.fingerprint})();try{return(await u.post(f.INITIALIZE_SESSION,{json:{uid:d,fname:p,lname:m,browserFingerprint:e},headers:{"x-org-id":c,...!b?.token||d||p||m?{}:{Authorization:`Bearer ${b.token}`}}}).json()).data}catch(t){if(t instanceof l)try{const e=t.data;t.apiMessage=e?.message||e?.error}catch{}throw t}},enabled:!!c});t(()=>{const e=I?.authSession?.session?.token??I?.authSession?.token,t=I?.authSession?.user;t&&e?(S(r=>({...r,...t,token:e,tcAccepted:void 0===t.tcAccepted?r?.tcAccepted:t.tcAccepted})),localStorage.setItem("qrati_token",e)):I?.organization?.customAuth&&d&&p&&S(e=>e??{_id:d,uid:d,name:m?`${p} ${m}`:p,fname:p,lname:m})},[I]);const C=n(()=>{const e=I?.organization?.integrationSettings?.fontFamily,t=((e,t)=>{const r=Ce("https://qrati.com"),n=t?Oe(t):"";return r&&n?`${r}/api/connect/organization/google-font?family=${encodeURIComponent(n)}`:null})(0,e),r=((e,t)=>{const r=Ce("https://qrati.com");return r&&t?`${r}/api/connect/organization/custom-font?organizationId=${encodeURIComponent(t)}`:null})(0,c);return((e,t,r)=>{if(!e?.fontFamily||"system"===e.fontFamily)return"";const n=Oe(e.fontFamily);if("custom"===n&&t){const r=e.customFontName||"QratiCustomFont",n=/\.woff2(\?|$)/i.test(t)?"woff2":/\.ttf(\?|$)/i.test(t)?"truetype":"woff";return`@font-face{font-family:"${s=r,s.replace(/"/g,'\\"')}";src:url("${t}") format("${n}");font-weight:400 700;font-style:normal;font-display:swap;}`}var s;const i=r||(e=>{if(!e)return null;const t=Oe(e);return t&&"system"!==t.toLowerCase()&&"custom"!==t.toLowerCase()?`https://fonts.googleapis.com/css2?family=${t.replace(/\s+/g,"+")}:wght@400;500;600;700&display=swap`:null})(n);return i?`@import url("${i}");`:""})(I?.organization?.integrationSettings,I?.organization?.customFontUrl?r||I.organization.customFontUrl:void 0,t||void 0)},[I?.organization?.integrationSettings,I?.organization?.customFontUrl,c]);t(()=>{const e=`data-qrati-font-${c}`;if(document.head.querySelector(`[${e}]`)?.remove(),C){if(C.startsWith("@import")){const t=C.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=C,t.setAttribute(e,""),document.head.appendChild(t)}return()=>{document.head.querySelector(`[${e}]`)?.remove()}}},[C,c]);const T=o(async e=>{S(t=>({...t,...e}))},[]),E=o(async(e,t,r,n)=>{try{const s=await u.post(f.REGISTER,{json:{email:e,password:t,fname:r,lname:n},headers:{"x-org-id":c}}).json();return s.error?{error:s.error}:(S({...s.user,token:s.token}),s.token&&localStorage.setItem("qrati_token",s.token),s)}catch(O){return{error:await Le(O,"Registration failed")}}},[c]),F=o(async(e,t)=>{try{const r=await u.post(f.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:(S({...r.user,token:r.token}),r.token&&localStorage.setItem("qrati_token",r.token),r)}catch(O){return{error:await Le(O,"Invalid email or password")}}},[c]),A=o(async e=>{const t=await((e,t,r)=>new Promise((n,s)=>{if(!e)return void s(/* @__PURE__ */new Error("Provider is required"));if(!t)return void s(/* @__PURE__ */new Error("Organization ID is required"));const i=new URL(`${r}/qc-social-auth`);i.searchParams.set("provider",e),i.searchParams.set("organizationId",t),i.searchParams.set("origin",window.location.origin);const a=(window.screen.width-500)/2,o=(window.screen.height-600)/2,c=window.open(i.toString(),"qrati_social_auth",`width=500,height=600,left=${a},top=${o},scrollbars=yes,resizable=yes,status=yes`);if(!c)return void s(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const l=()=>{clearInterval(h),clearTimeout(d),window.removeEventListener("message",u)},u=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(h){console.warn("Could not parse origin for verification")}const{type:i,data:a,error:o,organizationId:u}=e.data||{};if(u===t)switch(i){case"QRATI_SOCIAL_AUTH_SUCCESS":l(),c.close(),n({user:a.user,session:a.session,token:a.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",o),l(),c.close(),s(new Error(o||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":l(),c.close(),s(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",u,"expected:",t)},h=setInterval(()=>{try{c.closed&&(l(),s(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",u);const d=setTimeout(()=>{l(),c.closed||c.close(),s(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,c??"","https://qrati.com");return t?.user&&t?.token&&(S({...t.user,token:t.token}),localStorage.setItem("qrati_token",t.token)),t},[c]),x=o(async()=>A("google"),[A]),k=o(async()=>A("apple"),[A]),P=o(async e=>{try{const t=await u.post(f.SEND_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase()},headers:{"x-org-id":c}}).json();return t.error?{error:t.error}:t}catch(O){return{error:await Le(O,"Failed to send password reset code")}}},[c]),D=o(async(e,t)=>{try{const r=await u.post(f.VERIFY_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase(),code:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(O){return{error:await Le(O,"Invalid code, please check your email")}}},[c]),M=o(async(e,t)=>{try{const r=await u.post(f.RESET_PASSWORD,{json:{passwordResetCodeId:e,newPassword:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(O){return{error:O?.message}}},[c]),q=o(async()=>{try{const e=await u.post(f.LOGOUT,{headers:{"x-org-id":c,Authorization:`Bearer ${b?.token}`}}).json();return e.error?{error:e.error}:(S(null),localStorage.removeItem("qrati_token"),await g.invalidateQueries({queryKey:[h.QRATI_CONNECT_SESSION]}),e)}catch(O){return{error:O?.message}}},[c,b?.token]),Q=n(()=>({props:e,initializing:R,sessionId:I?.sessionId,organization:I?.organization,folders:I?.folders,orgRole:I?.orgRole??null,loadingUser:R,user:b,updateUser:T,registerUsingEmail:E,loginWithGoogle:x,loginWithApple:k,loginUsingEmail:F,sendPasswordResetCode:P,verifyPasswordResetCode:D,resetPassword:M,signout:q,error:O,portalContainer:v}),[e,R,I,b,T,E,x,k,F,P,D,M,q,O,v]);if(O){const e=O,t=401===e?.response?.status?"page-not-registered":e?.response?"generic-error":"service-unavailable";/* @__PURE__ */
39
+ /* @__PURE__ */a(Se,{organizationId:e})," for details or contact Qrati support."]})}var Ie='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',Oe=e=>e.trim().replace(/\s+/g," "),Ce=e=>e?.replace(/\/+$/,"")||"",Te=e=>{if(!e)return Ie;const t=Oe("string"==typeof e?e:e.fontFamily||""),r="string"==typeof e?void 0:e.customFontName;return t&&"system"!==t?"custom"===t?`"${r||"QratiCustomFont"}", ${Ie}`:`"${t}", ${Ie}`:"inherit"};function Ee(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Ee(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Fe(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ee(e))&&(n&&(n+=" "),n+=t);return n}var Ae=(...e)=>Fe(e.filter(Boolean)),ke=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"},xe="px",Pe=(e,t="light")=>{const r=e?.themeSettings?.colors??{},n=e?.themeSettings?.border,s=e?.themeSettings?.shadow,i=e?.integrationSettings,a="dark"===t,o=(e,t,n,s)=>{const i=a?s:n;return r[a?t:e]||i},c=o("primaryLight","primaryDark","#ff4800","#ff4800");return{"--background":o("backgroundLight","backgroundDark","#fafafa","#0a0a0a"),"--foreground":o("foregroundLight","foregroundDark","#252629","#f5f5f5"),"--muted":o("mutedLight","mutedDark","#e5e5e5","#171717"),"--muted-foreground":o("mutedForegroundLight","mutedForegroundDark","#484848","#b5b8bb"),"--border":o("borderLight","borderDark","#dddddd","#353538"),"--input":o("inputLight","inputDark","#f5f5f5","#171717"),"--primary":c,"--primary-foreground":ke(c),"--popover":o("popoverLight","popoverDark","#f5f5f5","#171717"),"--popover-foreground":o("popoverForegroundLight","popoverForegroundDark","#252629","#fafafa"),"--info":o("infoLight","infoDark","#2563eb","#5b8def"),"--warning":o("warningLight","warningDark","#f59e0b","#fbbf24"),"--success":o("successLight","successDark","#10b981","#34d399"),"--destructive":o("destructiveLight","destructiveDark","#ef4444","#f87171"),"--border-width":`${n?.width??"1"}${n?.unit??"px"}`,"--radius":`${n?.radius??"10"}${n?.unit??"px"}`,"--shadow-outer-horizontal-offset":`${s?.outerHorizontalOffset??"0"}${s?.unit??xe}`,"--shadow-outer-vertical-offset":`${s?.outerVerticalOffset??"0"}${s?.unit??xe}`,"--shadow-outer-blur":`${s?.outerBlur??"0"}${s?.unit??xe}`,"--shadow-outer-spread":`${s?.outerSpread??"0"}${s?.unit??xe}`,...i?.fontFamily&&"system"!==i.fontFamily?{"--font-family":Te(i)}:{}}},De=async e=>{try{return await e()}catch{return null}},Me=(e,t=1)=>{const r=(new TextEncoder).encode(e),n=3432918353,s=461845907;let i=t>>>0;const a=Math.floor(r.length/4),o=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let h=0;h<a;h++){let e=o.getUint32(4*h,!0);e=Math.imul(e,n),e=e<<15|e>>>17,e=Math.imul(e,s),i^=e,i=i<<13|i>>>19,i=Math.imul(i,5)+3864292196>>>0}let c=0;const l=4*a,u=3&r.length;return 3===u&&(c^=r[l+2]<<16),u>=2&&(c^=r[l+1]<<8),u>=1&&(c^=r[l],c=Math.imul(c,n),c=c<<15|c>>>17,c=Math.imul(c,s),i^=c),i^=r.length,i^=i>>>16,i=Math.imul(i,2246822507)>>>0,i^=i>>>13,i=Math.imul(i,3266489909)>>>0,i^=i>>>16,i.toString(16).padStart(8,"0")},qe=e=>{if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(qe).join(",")}]`;const t=Object.keys(e).sort(),r=[];for(const n of t){const t=e[n];void 0!==t&&r.push(`${qe(n)}:${qe(t)}`)}return`{${r.join(",")}}`},Qe=async({debug:e=!1}={})=>{const t=performance.now(),r=await De(async()=>window.navigator.userAgentData&&"function"==typeof window.navigator.userAgentData.getHighEntropyValues?qe(await window.navigator.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","model","fullVersionList"])):null),n=await De(()=>(()=>{const e=document.createElement("video"),t=["video/webm","video/mp4","video/ogg","audio/mp4","audio/webm","audio/ogg","audio/mpeg"],r={};for(const n of t){const t=e.canPlayType(n);r[n]=""===t?"no":t}return qe(r)})()),s=await De(()=>(()=>{const e=["monospace","serif","sans-serif"],t=["Arial","Helvetica","Verdana","Trebuchet MS","Comic Sans MS","Georgia","Times New Roman","Courier New","Segoe UI","Roboto","Open Sans","Noto Sans","system-ui","-apple-system","BlinkMacSystemFont"],r=document.createElement("span");r.style.fontSize="72px",r.style.position="absolute",r.style.visibility="hidden",r.style.whiteSpace="nowrap",r.textContent="mmmmmmmmmwwwwwww",document.body.appendChild(r);const n={};for(const i of e)r.style.fontFamily=i,n[i]=r.offsetWidth;const s=[];for(const i of t){let t=!1;for(const a of e)if(r.style.fontFamily=`"${i}", ${a}`,r.offsetWidth!==n[a]){s.push(i),t=!0;break}t||(r.style.fontFamily=`"${i}"`,r.offsetWidth!==n.monospace&&r.offsetWidth!==n.serif&&s.push(i))}return document.body.removeChild(r),s.length?s.sort().join(","):null})()),i=await De(()=>new Intl.NumberFormat(window.navigator.languages?.[0]||"en").resolvedOptions().numberingSystem),a=window.navigator.languages?Array.from(window.navigator.languages).join(","):window.navigator.language||null,o=Intl.DateTimeFormat().resolvedOptions(),c=o.timeZone,l=/* @__PURE__ */(new Date).getTimezoneOffset(),u=o.calendar||null,h=void 0!==o.hour12?o.hour12?"h12":"h23":o.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:v,colorDepth:w}=window.screen,b="ontouchstart"in window||window.navigator.maxTouchPoints>0,S=await De(()=>(async e=>{const t=document.createElement("canvas");t.width=280,t.height=100;const r=t.getContext("2d"),n=r.createLinearGradient(0,0,280,100);return n.addColorStop(0,"#f60"),n.addColorStop(.4,"#09f"),n.addColorStop(.7,"#f09"),n.addColorStop(1,"#0f9"),r.fillStyle=n,r.fillRect(0,0,280,100),r.font='18px "Arial","Helvetica","DejaVu Sans",sans-serif',r.fillStyle="#000",r.textBaseline="alphabetic",r.fillText("Fingerprint ¼½¾™©®∆π∑€¶§",12,45),r.font='bold 22px "Georgia","Times New Roman",serif',r.fillStyle="#222",r.fillText("🦊🐱🚀 2026",12,78),r.globalAlpha=.7,r.fillStyle="rgba(255, 80, 0, 0.35)",r.fillRect(180,20,80,60),r.beginPath(),r.arc(220,50,32,0,2*Math.PI),r.strokeStyle="#fff",r.lineWidth=4,r.stroke(),r.beginPath(),r.moveTo(30,85),r.quadraticCurveTo(140,20,240,85),r.strokeStyle="#00f",r.lineWidth=3,r.stroke(),e&&(t.style.border="1px solid #444",document.body.appendChild(t)),Me(t.toDataURL("image/png"))})(e)),R=await De(()=>(async()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl"),r=t.getExtension("WEBGL_debug_renderer_info");return Me(qe({vendor:r?t.getParameter(r.UNMASKED_VENDOR_WEBGL):t.getParameter(t.VENDOR),renderer:r?t.getParameter(r.UNMASKED_RENDERER_WEBGL):t.getParameter(t.RENDERER)}))})()),I=await De(()=>(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 Me(qe(r))})(e)),O=await De(()=>(async e=>{const t=new(window.OfflineAudioContext||window.webkitOfflineAudioContext)(1,6e3,44100),r=t.createOscillator();r.type="sawtooth",r.frequency.value=8800;const n=t.createDynamicsCompressor();n.threshold.value=-48,n.knee.value=30,n.ratio.value=14,n.attack.value=0,n.release.value=.3;const s=t.createGain();s.gain.value=.4,r.connect(n),n.connect(s),s.connect(t.destination),r.start(0);const i=(await t.startRendering()).getChannelData(0);let a=0,o=0;for(let l=3e3;l<5800;l+=2){const e=i[l];a=31*a+Math.floor(1e5*(e+1))|0,o=Math.imul(o^Math.floor(98765*e),2246822519)}const c=a>>>0^o>>>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(i.slice(4500,5e3)),n=e.width/r.length;for(let s=0;s<r.length;s++){const i=s*n,a=(r[s]+1)/2*e.height;0===s?t.moveTo(i,a):t.lineTo(i,a)}t.stroke(),document.body.appendChild(e)}return Me(c.toString(16))})(e)),C=window.screen.width&&window.screen.height?(window.screen.width/window.screen.height).toFixed(4):null,T=await De(()=>window.screen.orientation?.type||null),E=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,F=E&&E.type||null,A=E?.effectiveType||null,k=!0===E?.saveData,x="boolean"==typeof window.navigator.pdfViewerEnabled?window.navigator.pdfViewerEnabled:null,P="boolean"==typeof window.navigator.webdriver?window.navigator.webdriver:null,D=await De(()=>"function"!=typeof Intl.supportedValuesOf?null:Intl.supportedValuesOf("calendar").join(",")),M=await De(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 qe(t)}),q={vendor:window.navigator.vendor||null,platform:window.navigator.platform||null,userAgentHighEntropy:r||null,mediaCodecs:n||null,fonts:s,numberingSystem:i,languages:a,timezone:c,timezoneOffset:l,intlCalendar:u,hourCycle:h,reducedMotion:d,colorScheme:f,prefersContrast:p,prefersReducedTransparency:m,pdfViewerEnabled:x,webdriver:P,intlSupportedCalendars:D||null,permissionsState:M||null,hardwareConcurrency:window.navigator.hardwareConcurrency||null,deviceMemory:window.navigator.deviceMemory||null,forcedColors:y,devicePixelRatio:g,pixelDepth:v,colorDepth:w,touchSupport:b,screenOrientation:T||null,connectionType:F,effectiveType:A,saveData:k,canvasID:S,webglID:R,webgpuID:I,audioID:O},Q={aspectRatio:C,width:window.screen.width,height:window.screen.height,maxTouchPoints:window.navigator.maxTouchPoints};(!0===navigator.userAgentData?.mobile||/Mobi|Android|iPhone|iPad|iPod|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent)||navigator.maxTouchPoints>0&&matchMedia("(pointer:coarse)").matches&&innerWidth<=1024)&&Object.assign(q,Q);const L=Me(qe(q)),U=Math.round(performance.now()-t);return{fingerprint:L,...q,elapsedMs:U}};"undefined"!=typeof window&&(window.getBrowserFingerprint=Qe);var Le=async(e,t)=>{if(e instanceof l){try{const t=e.data;if(t?.error)return t.error;if(t?.message)return t.message;if("INVALID_EMAIL_OR_PASSWORD"===t?.code)return"Invalid email or password"}catch{return t||e.message}return t||e.message}return e instanceof Error?t||e.message:t||String(e)},Ue=e(void 0),_e=({props:e={},children:s})=>{const{organizationId:c,uid:d,fname:p,lname:m,theme:y="light"}=e,g=fe(),[v,w]=r(null),[b,S]=r(()=>{if("undefined"==typeof window)return null;const e=localStorage.getItem("qrati_token");return e?{token:e}:null}),{isLoading:R,data:I,error:O}=we({queryKey:[h.QRATI_CONNECT_SESSION,c,d??null,p??null,m??null],queryFn:async()=>{const e=await(async()=>{const e=await Qe();return"string"==typeof e?e:e?.fingerprint})(),t=!b?.token||d||p||m?null:b.token;try{return{...(await u.post(f.INITIALIZE_SESSION,{json:{uid:d,fname:p,lname:m,browserFingerprint:e},headers:{"x-org-id":c,...t?{Authorization:`Bearer ${t}`}:{}}}).json()).data,requestToken:t}}catch(r){if(r instanceof l)try{const e=r.data;r.apiMessage=e?.message||e?.error}catch{}throw r}},enabled:!!c});t(()=>{const e=I?.authSession?.session?.token??I?.authSession?.token,t=I?.authSession?.user;if(t&&e)S(r=>({...r,...t,token:e,tcAccepted:void 0===t.tcAccepted?r?.tcAccepted:t.tcAccepted})),localStorage.setItem("qrati_token",e);else if(I?.organization?.customAuth&&d&&p)S(e=>e??{_id:d,uid:d,name:m?`${p} ${m}`:p,fname:p,lname:m});else if(I?.requestToken){const e=I.requestToken;S(t=>t?.token!==e?t:(localStorage.removeItem("qrati_token"),null))}},[I]);const C=n(()=>{const e=I?.organization?.integrationSettings?.fontFamily,t=((e,t)=>{const r=Ce("https://qrati.com"),n=t?Oe(t):"";return r&&n?`${r}/api/connect/organization/google-font?family=${encodeURIComponent(n)}`:null})(0,e),r=((e,t)=>{const r=Ce("https://qrati.com");return r&&t?`${r}/api/connect/organization/custom-font?organizationId=${encodeURIComponent(t)}`:null})(0,c);return((e,t,r)=>{if(!e?.fontFamily||"system"===e.fontFamily)return"";const n=Oe(e.fontFamily);if("custom"===n&&t){const r=e.customFontName||"QratiCustomFont",n=/\.woff2(\?|$)/i.test(t)?"woff2":/\.ttf(\?|$)/i.test(t)?"truetype":"woff";return`@font-face{font-family:"${s=r,s.replace(/"/g,'\\"')}";src:url("${t}") format("${n}");font-weight:400 700;font-style:normal;font-display:swap;}`}var s;const i=r||(e=>{if(!e)return null;const t=Oe(e);return t&&"system"!==t.toLowerCase()&&"custom"!==t.toLowerCase()?`https://fonts.googleapis.com/css2?family=${t.replace(/\s+/g,"+")}:wght@400;500;600;700&display=swap`:null})(n);return i?`@import url("${i}");`:""})(I?.organization?.integrationSettings,I?.organization?.customFontUrl?r||I.organization.customFontUrl:void 0,t||void 0)},[I?.organization?.integrationSettings,I?.organization?.customFontUrl,c]);t(()=>{const e=`data-qrati-font-${c}`;if(document.head.querySelector(`[${e}]`)?.remove(),C){if(C.startsWith("@import")){const t=C.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=C,t.setAttribute(e,""),document.head.appendChild(t)}return()=>{document.head.querySelector(`[${e}]`)?.remove()}}},[C,c]);const T=o(async e=>{S(t=>({...t,...e}))},[]),E=o(async(e,t,r,n)=>{try{const s=await u.post(f.REGISTER,{json:{email:e,password:t,fname:r,lname:n},headers:{"x-org-id":c}}).json();return s.error?{error:s.error}:(S({...s.user,token:s.token}),s.token&&localStorage.setItem("qrati_token",s.token),s)}catch(O){return{error:await Le(O,"Registration failed")}}},[c]),F=o(async(e,t)=>{try{const r=await u.post(f.LOGIN,{json:{email:e,password:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:(S({...r.user,token:r.token}),r.token&&localStorage.setItem("qrati_token",r.token),r)}catch(O){return{error:await Le(O,"Invalid email or password")}}},[c]),A=o(async e=>{const t=await((e,t,r)=>new Promise((n,s)=>{if(!e)return void s(/* @__PURE__ */new Error("Provider is required"));if(!t)return void s(/* @__PURE__ */new Error("Organization ID is required"));const i=new URL(`${r}/qc-social-auth`);i.searchParams.set("provider",e),i.searchParams.set("organizationId",t),i.searchParams.set("origin",window.location.origin);const a=(window.screen.width-500)/2,o=(window.screen.height-600)/2,c=window.open(i.toString(),"qrati_social_auth",`width=500,height=600,left=${a},top=${o},scrollbars=yes,resizable=yes,status=yes`);if(!c)return void s(/* @__PURE__ */new Error("Failed to open popup window. Please allow popups and try again."));const l=()=>{clearInterval(h),clearTimeout(d),window.removeEventListener("message",u)},u=e=>{try{const t=new URL(r).origin;if(e.origin!==t)return void console.warn("Origin mismatch:",e.origin,"expected:",t)}catch(h){return void console.warn("Could not parse origin for verification")}const{type:i,data:a,error:o,organizationId:u}=e.data||{};if(u===t)switch(i){case"QRATI_SOCIAL_AUTH_SUCCESS":l(),c.close(),n({user:a.user,session:a.session,token:a.token});break;case"QRATI_SOCIAL_AUTH_ERROR":console.error("Authentication error:",o),l(),c.close(),s(new Error(o||"Social authentication failed"));break;case"QRATI_SOCIAL_AUTH_CANCELLED":l(),c.close(),s(/* @__PURE__ */new Error("Authentication was cancelled"))}else console.warn("Organization ID mismatch:",u,"expected:",t)},h=setInterval(()=>{try{c.closed&&(l(),s(/* @__PURE__ */new Error("Authentication was cancelled")))}catch(e){}},1e3);window.addEventListener("message",u);const d=setTimeout(()=>{l(),c.closed||c.close(),s(/* @__PURE__ */new Error("Authentication timeout. Please try again."))},3e5)}))(e,c??"","https://qrati.com");return t?.user&&t?.token&&(S({...t.user,token:t.token}),localStorage.setItem("qrati_token",t.token)),t},[c]),k=o(async()=>A("google"),[A]),x=o(async()=>A("apple"),[A]),P=o(async e=>{try{const t=await u.post(f.SEND_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase()},headers:{"x-org-id":c}}).json();return t.error?{error:t.error}:t}catch(O){return{error:await Le(O,"Failed to send password reset code")}}},[c]),D=o(async(e,t)=>{try{const r=await u.post(f.VERIFY_PASSWORD_RESET_CODE,{json:{email:e.toLowerCase(),code:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(O){return{error:await Le(O,"Invalid code, please check your email")}}},[c]),M=o(async(e,t)=>{try{const r=await u.post(f.RESET_PASSWORD,{json:{passwordResetCodeId:e,newPassword:t},headers:{"x-org-id":c}}).json();return r.error?{error:r.error}:r}catch(O){return{error:O?.message}}},[c]),q=o(async()=>{try{const e=await u.post(f.LOGOUT,{headers:{"x-org-id":c,Authorization:`Bearer ${b?.token}`}}).json();return e.error?{error:e.error}:(S(null),localStorage.removeItem("qrati_token"),await g.invalidateQueries({queryKey:[h.QRATI_CONNECT_SESSION]}),e)}catch(O){return{error:O?.message}}},[c,b?.token]),Q=n(()=>({props:e,initializing:R,sessionId:I?.sessionId,organization:I?.organization,folders:I?.folders,orgRole:I?.orgRole??null,loadingUser:R,user:b,updateUser:T,registerUsingEmail:E,loginWithGoogle:k,loginWithApple:x,loginUsingEmail:F,sendPasswordResetCode:P,verifyPasswordResetCode:D,resetPassword:M,signout:q,error:O,portalContainer:v}),[e,R,I,b,T,E,k,x,F,P,D,M,q,O,v]);if(O){const e=O,t=401===e?.response?.status?"page-not-registered":e?.response?"generic-error":"service-unavailable";/* @__PURE__ */
40
40
  return a(i,{fallback:null,children:/* @__PURE__ */a(Re,{organizationId:c??"",errorType:t,errorMessage:"generic-error"===t?e.apiMessage:void 0})})}/* @__PURE__ */
41
- return a(Ue.Provider,{value:Q,children:/* @__PURE__ */a("div",{ref:w,id:"qrati-connect-container",style:{...Pe(I?.organization,y),fontFamily:I?.organization?.integrationSettings?.fontFamily&&"system"!==I.organization.integrationSettings.fontFamily?"var(--font-family)":"inherit"},className:Ae("bg-background text-foreground relative min-h-[80vh]"),children:s})})},je=()=>{const e=c(Ue);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{_ as A,C,E as D,g as E,S as O,T as S,I as T,V as _,Pe as a,N as b,ve as c,oe as d,ne as f,B as g,J as h,Ae as i,L as j,x as k,pe as l,re as m,je as n,Fe as o,te as p,Qe as r,we as s,_e as t,fe as u,H as v,O as w,v as x,$ as y};
41
+ return a(Ue.Provider,{value:Q,children:/* @__PURE__ */a("div",{ref:w,id:"qrati-connect-container",style:{...Pe(I?.organization,y),fontFamily:I?.organization?.integrationSettings?.fontFamily&&"system"!==I.organization.integrationSettings.fontFamily?"var(--font-family)":"inherit"},className:Ae("bg-background text-foreground relative min-h-[80vh]"),children:s})})},je=()=>{const e=c(Ue);if(void 0===e)throw new Error("useSession must be used within SessionProvider");return e};export{_ as A,C,E as D,g as E,S as O,T as S,I as T,V as _,Pe as a,N as b,ve as c,oe as d,ne as f,B as g,J as h,Ae as i,L as j,k,pe as l,re as m,je as n,Fe as o,te as p,Qe as r,we as s,_e as t,fe as u,H as v,O as w,v as x,$ as y};
@@ -1,4 +1,4 @@
1
- import{t}from"./DrrpB4Om.js";import{n as s}from"./CKQOToSD.js";import{x as a}from"./BLeZg2Bz.js";import{i as r,n as o,u as e}from"./DdYePHxG.js";import{t as i}from"./MU5QuIq0.js";import{t as n}from"./BKENYwOQ.js";import{t as m}from"./C4DSwLWc.js";import{t as l}from"./QDuBhueG.js";import{t as c}from"./DGGc10Cy.js";import{t as d}from"./CBM5QMn8.js";import{t as g}from"./DyemeRjE2.js";var f=()=>{const f=e(),{props:p}=s(),h=p?.organizationId,{loading:v,event:u}=d({eventSlug:f.eventSlug});if(v)/* @__PURE__ */return t("div",{children:[
1
+ import{t}from"./DrrpB4Om.js";import{n as s}from"./tJ2MS5HS.js";import{x as a}from"./DUWOb-5c.js";import{i as r,n as o,u as e}from"./BcAwTWQC.js";import{t as i}from"./B01ceTPt.js";import{t as n}from"./CxJgMv2R.js";import{t as m}from"./C6ph3KPL.js";import{t as l}from"./DlNQukHq.js";import{t as c}from"./DGGc10Cy.js";import{t as g}from"./DtcmI8yd2.js";import{t as d}from"./5z04gCoQ2.js";var p=()=>{const p=e(),{props:f}=s(),h=f?.organizationId,{loading:v,event:u}=g({eventSlug:p.eventSlug});if(v)/* @__PURE__ */return t("div",{children:[
2
2
  /* @__PURE__ */t(n,{className:"mx-auto mt-4 h-8 w-64"}),
3
3
  /* @__PURE__ */t(n,{className:"mx-auto mt-6 h-6 w-72"}),
4
4
  /* @__PURE__ */t(n,{className:"mx-auto mt-6 h-8 w-72"}),
@@ -6,4 +6,4 @@ import{t}from"./DrrpB4Om.js";import{n as s}from"./CKQOToSD.js";import{x as a}fro
6
6
  return t("div",u&&j===N?{className:"bg-background relative min-h-screen",children:/* @__PURE__ */t(c,{locale:u?.language??"en",translations:u?.translations,children:[
7
7
  /* @__PURE__ */t(l,{}),
8
8
  /* @__PURE__ */t(r,{}),
9
- /* @__PURE__ */t(m,{})]})}:{className:"flex w-full flex-col items-center gap-8",children:[/* @__PURE__ */t(i,{className:"mt-16",title:"Event not found",description:"Please check the provided link",iconSvg:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-full",viewBox:"0 0 997.86122 450.8081",role:"img"})}),/* @__PURE__ */t(o,{to:a.PUBLIC_EVENTS,state:{internalNavigation:!0},children:/* @__PURE__ */t(g,{children:"All events"})})]})};export{f as default};
9
+ /* @__PURE__ */t(m,{})]})}:{className:"flex w-full flex-col items-center gap-8",children:[/* @__PURE__ */t(i,{className:"mt-16",title:"Event not found",description:"Please check the provided link",iconSvg:/* @__PURE__ */t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-full",viewBox:"0 0 997.86122 450.8081",role:"img"})}),/* @__PURE__ */t(o,{to:a.PUBLIC_EVENTS,state:{internalNavigation:!0},children:/* @__PURE__ */t(d,{children:"All events"})})]})};export{p as default};