1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,67423,(e,t,r)=>{"use strict";function s({widthInt:e,heightInt:t,blurWidth:r,blurHeight:s,blurDataURL:i,objectFit:n}){let a=r?40*r:e,o=s?40*s:t,l=a&&o?`viewBox='0 0 ${a} ${o}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${l}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${l?"none":"contain"===n?"xMidYMid":"cover"===n?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${i}'/%3E%3C/svg%3E`}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImageBlurSvg",{enumerable:!0,get:function(){return s}})},87690,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={VALID_LOADERS:function(){return n},imageConfigDefault:function(){return a}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});let n=["default","imgix","cloudinary","akamai","custom"],a={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},8927,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getImgProps",{enumerable:!0,get:function(){return l}}),e.r(33525);let s=e.r(67423),i=e.r(87690),n=["-moz-initial","fill","none","scale-down",void 0];function a(e){return void 0!==e.default}function o(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function l({src:e,sizes:t,unoptimized:r=!1,priority:l=!1,preload:u=!1,loading:h,className:c,quality:d,width:p,height:f,fill:m=!1,style:g,overrideSrc:y,onLoad:v,onLoadingComplete:b,placeholder:w="empty",blurDataURL:_,fetchPriority:k,decoding:x="async",layout:S,objectFit:T,objectPosition:E,lazyBoundary:P,lazyRoot:A,...j},R){var O;let C,I,$,{imgConf:N,showAltText:D,blurComplete:M,defaultLoader:U}=R,L=N||i.imageConfigDefault;if("allSizes"in L)C=L;else{let e=[...L.deviceSizes,...L.imageSizes].sort((e,t)=>e-t),t=L.deviceSizes.sort((e,t)=>e-t),r=L.qualities?.sort((e,t)=>e-t);C={...L,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===U)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let B=j.loader||U;delete j.loader,delete j.srcSet;let V="__next_img_default"in B;if(V){if("custom"===C.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop. 2Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=B;B=t=>{let{config:r,...s}=t;return e(s)}}if(S){"fill"===S&&(m=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[S];e&&(g={...g,...e});let r={responsive:"100vw",fill:"100vw"}[S];r&&!t&&(t=r)}let F="",z=o(p),q=o(f);if((O=e)&&"object"==typeof O&&(a(O)||void 0!==O.src)){let t=a(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}
2`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(I=t.blurWidth,$=t.blurHeight,_=_||t.blurDataURL,F=t.src,!m)if(z||q){if(z&&!q){let e=z/t.width;q=Math.round(t.height*e)}else if(!z&&q){let e=q/t.height;z=Math.round(t.width*e)}}else z=t.width,q=t.height}let W=!l&&!u&&("lazy"===h||void 0===h);(!(e="string"==typeof e?e:F)||e.startsWith("data:")||e.startsWith("blob:"))&&(r=!0,W=!1),C.unoptimized&&(r=!0),V&&!C.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(r=!0);let K=o(d),H=Object.assign(m?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:T,objectPosition:E}:{},D?{}:{color:"transparent"},g),G=M||"empty"===w?null:"blur"===w?`url("data:image/svg+xml;charset=utf-8,${(0,s.getImageBlurSvg)({widthInt:z,heightInt:q,blurWidth:I,blurHeight:$,blurDataURL:_||"",objectFit:H.objectFit})}")`:`url("${w}")`,J=n.includes(H.objectFit)?"fill"===H.objectFit?"100% 100%":"cover":H.objectFit,Y=G?{backgroundSize:J,backgroundPosition:H.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:G}:{},X=function({config:e,src:t,unoptimized:r,width:s,quality:i,sizes:n,loader:a}){if(r)return{src:t,srcSet:void 0,sizes:void 0};let{widths:o,kind:l}=function({deviceSizes:e,allSizes:t},r,s){if(s){let r=/(^|\s)(1?\d?\d)vw/g,i=[];for(let e;e=r.exec(s);)i.push(parseInt(e[2]));if(i.length){let r=.01*Math.min(...i);return{widths:t.filter(t=>t>=e[0]*r),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof r?{widths:e,kind:"w"}:{widths:[...new Set([r,2*r].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,s,n),u=o.length-1;return{sizes:n||"w"!==l?n:"100vw",srcSet:o.map((r,s)=>`${a({config:e,src:t,quality:i,width:r})} ${"w"===l?r:s+1}${l}`).join(", "),src:a({config:e,src:t,quality:i,width:o[u]})}}({config:C,src:e,unoptimized:r,width:z,quality:K,sizes:t,loader:B}),Z=W?"lazy":h;return{props:{...j,loading:Z,fetchPriority:k,width:z,height:q,decoding:x,className:c,style:{...H,...Y},sizes:X.sizes,srcSet:X.srcSet,src:y||X.src},meta:{unoptimized:r,preload:u||l,placeholder:w,fill:m}}}},98879,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return o}});let s=e.r(71645),i="undefined"==typeof window,n=i?()=>{}:s.useLayoutEffect,a=i?()=>{}:s.useEffect;function o(e){let{headManager:t,reduceComponentsToState:r}=e;function o(){if(t&&t.mountedInstances){let e=s.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(r(e))}}return i&&(t?.mountedInstances?.add(e.children),o()),n(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),n(()=>(t&&(t._pendingUpdate=o),()=>{t&&(t._pendingUpdate=o)})),a(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},25633,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={default:function(){return m},defaultHead:function(){return c}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});let n=e.r(55682),a=e.r(90809),o=e.r(43476),l=a._(e.r(71645)),u=n._(e.r(98879)),h=e.r(42732);function c(){return[(0,o.jsx)("meta",{charSet:"utf-8"},"charset"),(0,o.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function d(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===l.default.Fragment?e.concat(l.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}e.r(33525);let p=["name","httpEquiv","charSet","itemProp"];function f(e){let t,r,s,i;return e.reduce(d,[]).reverse().concat(c().reverse()).filter((t=new Set,r=new Set,s=new Set,i={},e=>{let n=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let r=e.key.slice(e.key.indexOf("$")+1);t.has(r)?n=!1:t.add(r)}switch(e.type){case"title":case"base":r.has(e.type)?n=!1:r.add(e.type);break;case"meta":for(let t=0,r=p.length;t<r;t++){let r=p[t];if(e.props.hasOwnProperty(r))if("charSet"===r)s.has(r)?n=!1:s.add(r);else{let t=e.props[r],s=i[r]||new Set;
2("name"!==r||!a)&&s.has(t)?n=!1:(s.add(t),i[r]=s)}}}return n})).reverse().map((e,t)=>{let r=e.key||t;return l.default.cloneElement(e,{key:r})})}let m=function({children:e}){let t=(0,l.useContext)(h.HeadManagerContext);return(0,o.jsx)(u.default,{reduceComponentsToState:f,headManager:t,children:e})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},18556,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"ImageConfigContext",{enumerable:!0,get:function(){return n}});let s=e.r(55682)._(e.r(71645)),i=e.r(87690),n=s.default.createContext(i.imageConfigDefault)},65856,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"RouterContext",{enumerable:!0,get:function(){return s}});let s=e.r(55682)._(e.r(71645)).default.createContext(null)},70965,(e,t,r)=>{"use strict";function s(e,t){let r=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e,0):r}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"findClosestQuality",{enumerable:!0,get:function(){return s}})},1948,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return n}});let s=e.r(70965);function i({config:e,src:t,width:r,quality:i}){if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns. 3Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let n=(0,s.findClosestQuality)(i,e);return`${e.path}?url=${encodeURIComponent(t)}&w=${r}&q=${n}${t.startsWith("/_next/static/media/"),""}`}i.__next_img_default=!0;let n=i},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return i}});let s=e.r(71645);function i(e,t){let r=(0,s.useRef)(null),i=(0,s.useRef)(null);return(0,s.useCallback)(s=>{if(null===s){let e=r.current;e&&(r.current=null,e());let t=i.current;t&&(i.current=null,t())}else e&&(r.current=n(e,s)),t&&(i.current=n(t,s))},[e,t])}function n(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},85437,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"Image",{enumerable:!0,get:function(){return w}});let s=e.r(55682),i=e.r(90809),n=e.r(43476),a=i._(e.r(71645)),o=s._(e.r(74080)),l=s._(e.r(25633)),u=e.r(8927),h=e.r(87690),c=e.r(18556);e.r(33525);let d=e.r(65856),p=s._(e.r(1948)),f=e.r(18581),m={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0};function g(e,t,r,s,i,n,a){let o=e?.src;e&&e["data-loaded-src"]!==o&&(e["data-loaded-src"]=o,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),r?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let s=!1,i=!1;r.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>s,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{s=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}s?.current&&s.current(e)}}))}function y(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}"undefined"==typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let v=(0,a.forwardRef)(({src:e,srcSet:t,sizes:r,height:s,width:i,decoding:o,className:l,style:u,fetchPriority:h,placeholder:c,loading:d,unoptimized:p,fill:m,onLoadRef:v,onLoadingCompleteRef:b,setBlurComplete:w,setShowAltText:_,sizesInput:k,onLoad:x,onError:S,...T},E)=>{let P=(0,a.useCallback)(e=>{e&&(S&&(e.src=e.src),e.complete&&g(e,c,v,b,w,p,k))},[e,c,v,b,w,S,p,k]),A=(0,f.useMergedRef)(E,P);return(0,n.jsx)("img",{...T,...y(h),loading:d,width:i,height:s,decoding:o,"data-nimg":m?"fill":"1",className:l,style:u,sizes:r,srcSet:t,src:e,ref:A,onLoad:e=>{g(e.currentTarget,c,v,b,w,p,k)},onError:e=>{_(!0),"empty"!==c&&w(!0),S&&S(e)}})});function b({isAppRouter:e,imgAttributes:t}){let r={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...y(t.fetchPriority)};return e&&o.default.preload?(o.default.preload(t.src,r),null):(0,n.jsx)(l.default,{children:(0,n.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...r},"__nimg-"+t.src+t.srcSet+t.sizes)})}let w=(0,a.forwardRef)((e,t)=>{let r=(0,a.useContext)(d.RouterContext),s=(0,a.useContext)(c.ImageConfigContext),i=(0,a.useMemo)(()=>{let e=m||s||h.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>
3e-t),r=e.deviceSizes.sort((e,t)=>e-t),i=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:r,qualities:i,localPatterns:"undefined"==typeof window?s?.localPatterns:e.localPatterns}},[s]),{onLoad:o,onLoadingComplete:l}=e,f=(0,a.useRef)(o);(0,a.useEffect)(()=>{f.current=o},[o]);let g=(0,a.useRef)(l);(0,a.useEffect)(()=>{g.current=l},[l]);let[y,w]=(0,a.useState)(!1),[_,k]=(0,a.useState)(!1),{props:x,meta:S}=(0,u.getImgProps)(e,{defaultLoader:p.default,imgConf:i,blurComplete:y,showAltText:_});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v,{...x,unoptimized:S.unoptimized,placeholder:S.placeholder,fill:S.fill,onLoadRef:f,onLoadingCompleteRef:g,setBlurComplete:w,setShowAltText:k,sizesInput:e.sizes,ref:t}),S.preload?(0,n.jsx)(b,{isAppRouter:!r,imgAttributes:x}):null]})});("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},94909,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={default:function(){return h},getImageProps:function(){return u}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});let n=e.r(55682),a=e.r(8927),o=e.r(85437),l=n._(e.r(1948));function u(e){let{props:t}=(0,a.getImgProps)(e,{defaultLoader:l.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let h=o.Image},57688,(e,t,r)=>{t.exports=e.r(94909)},98183,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={assign:function(){return l},searchParamsToUrlQuery:function(){return n},urlQueryToSearchParams:function(){return o}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});function n(e){let t={};for(let[r,s]of e.entries()){let e=t[r];void 0===e?t[r]=s:Array.isArray(e)?e.push(s):t[r]=[e,s]}return t}function a(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function o(e){let t=new URLSearchParams;for(let[r,s]of Object.entries(e))if(Array.isArray(s))for(let e of s)t.append(r,a(e));else t.set(r,a(s));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,s]of r.entries())e.append(t,s)}return e}},95057,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={formatUrl:function(){return o},formatWithValidation:function(){return u},urlObjectKeys:function(){return l}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});let n=e.r(90809)._(e.r(98183)),a=/https?|ftp|gopher|file/;function o(e){let{auth:t,hostname:r}=e,s=e.protocol||"",i=e.pathname||"",o=e.hash||"",l=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),l&&"object"==typeof l&&(l=String(n.urlQueryToSearchParams(l)));let h=e.search||l&&`?${l}`||"";return s&&!s.endsWith(":")&&(s+=":"),e.slashes||(!s||a.test(s))&&!1!==u?(u="//"+(u||""),i&&"/"!==i[0]&&(i="/"+i)):u||(u=""),o&&"#"!==o[0]&&(o="#"+o),h&&"?"!==h[0]&&(h="?"+h),i=i.replace(/[?#]/g,encodeURIComponent),h=h.replace("#","%23"),`${s}${u}${i}${h}${o}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return o(e)}},18967,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={DecodeError:function(){return y},MiddlewareNotFoundError:function(){return _},MissingStaticPage:function(){return w},NormalizeError:function(){return v},PageNotFoundError:function(){return b},SP:function(){return m},ST:function(){return g},WEB_VITALS:function(){return n},execOnce:function(){return a},getDisplayName:function(){return c},getLocationOrigin:function(){return u},getURL:function(){return h},isAbsoluteUrl:function(){return l},isResSent:function(){return d},loadGetInitialProps:function(){return f}
3,normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return k}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});let n=["CLS","FCP","FID","INP","LCP","TTFB"];function a(e){let t,r=!1;return(...s)=>(r||(r=!0,t=e(...s)),t)}let o=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>o.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function h(){let{href:e}=window.location,t=u();return e.substring(t.length)}function c(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function d(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function f(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await f(t.Component,t.ctx)}:{};let s=await e.getInitialProps(t);if(r&&d(r))return s;if(!s)throw Object.defineProperty(Error(`"${c(e)}.getInitialProps()" should resolve to an object. But found "${s}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return s}let m="undefined"!=typeof performance,g=m&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class y extends Error{}class v extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class w extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class _ extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function k(e){return JSON.stringify({message:e.message,stack:e.stack})}},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return n}});let s=e.r(18967),i=e.r(52817);function n(e){if(!(0,s.isAbsoluteUrl)(e))return!0;try{let t=(0,s.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,i.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return s}});let s=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={default:function(){return y},useLinkStatus:function(){return b}};for(var i in s)Object.defineProperty(r,i,{enumerable:!0,get:s[i]});let n=e.r(90809),a=e.r(43476),o=n._(e.r(71645)),l=e.r(95057),u=e.r(8372),h=e.r(18581),c=e.r(18967),d=e.r(5550);e.r(33525);let p=e.r(91949),f=e.r(73668),m=e.r(9396);function g(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}function y(t){var r;let s,i,n,[l,y]=(0,o.useOptimistic)(p.IDLE_LINK_STATUS),b=(0,o.useRef)(null),{href:w,as:_,children:k,prefetch:x=null,passHref:S,replace:T,shallow:E,scroll:P,onClick:A,onMouseEnter:j,onTouchStart:R,legacyBehavior:O=!1,onNavigate:C,ref:I,unstable_dynamicOnHover:$,...N}=t;s=k,O&&("string"==typeof s||"number"==typeof s)&&(s=(0,a.jsx)("a",{children:s}));let D=o.default.useContext(u.AppRouterContext),M=!1!==x,U=!1!==x?null===(r=x)||"auto"===r?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,{href:L,as:B}=o.default.useMemo(()=>{let e=g(w);return{href:e,as:_?g(_):e}},[w,_]);if(O){if(s?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});i=o.default.Children.only(s)}let V=O?i&&"object"==typeof i&&i.ref:I,F=o.default.useCallback(e=>(null!==D&&(b.current=(0,p.mountLinkInstance)(e,L,D,U,M,y)),()=>{b.current&&((0,p.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,p.unmountPrefetchableInstance)(e)}),[M,L,D,U,y]),z={ref:(0,h.useMergedRef)(F,V),onClick(t){O||"function"!=typeof A||A(t),O&&i.props&&"function"==typeof i.props.onClick&&i.props.onClick(t),!D||t.defaultPrevented||function(t,r,s,i,n,a,l){if("undefined"!=typeof window){let u,{nodeName:h}=t.currentTarget;if("A"===h.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,f.isLocalURL)(r)){n&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:c}=e.r(99781);o.default.startTransition(()=>{c(s||r,n?"replace":"push",a??!0,i.current)})}}(t,L,B,b,T,P,C)},onMouseEnter(e){O||"function"!=typeof j||j(e),O&&i.props&&"function"==typeof i.props.onMouseEnter&&i.props.onMouseEnter(e),D&&M&&(0,p.onNavigationIntent)(e.currentTarget,!0===$)},onTouchStart:function(e){O||"function"!=typeof R||R(e),O&&i.props&&"function"==typeof i.props.onTouchStart&&i.props.onTouchStart(e),D&&M&&(0,p.onNavigationIntent)(e.currentTarget,!0===$)}};return(0,c.isAbsoluteUrl)(B)?z.href=B:O&&!S&&("a"!==i.type||"href"in i.props)||(z.href=(0,d.addBasePath)(B)),n=O?o.default.cloneElement(i,z):(0,a.jsx)("a",{...N,...z,children:s}),(0,a.jsx)(v.Provider,{value:l,children:n})}e.r(84508);let v=(0,o.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,o.useContext)(v);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esMo
3dule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},75254,e=>{"use strict";var t=e.i(71645);let r=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,t.forwardRef)(({color:e="currentColor",size:i=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:l,iconNode:u,...h},c)=>(0,t.createElement)("svg",{ref:c,...s,width:i,height:i,stroke:e,strokeWidth:a?24*Number(n)/Number(i):n,className:r("lucide",o),...h},[...u.map(([e,r])=>(0,t.createElement)(e,r)),...Array.isArray(l)?l:[l]])),n=(e,s)=>{let n=(0,t.forwardRef)(({className:n,...a},o)=>(0,t.createElement)(i,{ref:o,iconNode:s,className:r(`lucide-${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...a}));return n.displayName=`${e}`,n};e.s(["default",()=>n],75254)},60508,37727,e=>{"use strict";var t=e.i(75254);let r=(0,t.default)("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);e.s(["NotebookPen",()=>r],60508);let s=(0,t.default)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>s],37727)},13474,64659,e=>{"use strict";var t=e.i(43476),r=e.i(22016),s=e.i(57688),i=e.i(18566),n=e.i(71645),a=e.i(75254);let o=(0,a.default)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>o],64659);let l=(0,a.default)("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);var u=e.i(60508),h=e.i(37727);let c=[{href:"/benefits",label:"Benefits"},{href:"/pricing",label:"Pricing"},{href:"/sidepdf",label:"SidePDF"},{href:"/jotlog",label:"JotLog"},{href:"/youtube-picture-in-picture",label:"PiP"}],d=[{href:"/blog",label:"Blog"},{href:"/contact",label:"Contact"}],p=[{href:"/cornell-notes-template",label:"Cornell notes template",description:"Printable PDF, typed notes, or add to a PDF",icon:u.NotebookPen}];function f({ctaHref:e="https://chromewebstore.google.com/detail/jotlayer-draw-on-notion/jagldjpfejaiccobhdgofbjaemjkmpjo",ctaLabel:a="Add to Chrome"}={}){let u=(0,i.usePathname)(),[m,g]=(0,n.useState)(!1),[y,v]=(0,n.use
3State)(!1),b=(0,n.useRef)(null),w=(0,n.useRef)(null),_=(0,n.useRef)(0),k=e=>"/blog"===e?u.startsWith("/blog"):u===e,x=p.some(e=>k(e.href));(0,n.useEffect)(()=>v(!1),[u]),(0,n.useEffect)(()=>{if(!y)return;let e=e=>"Escape"===e.key&&v(!1),t=e=>{b.current?.contains(e.target)||v(!1)};return document.addEventListener("keydown",e),document.addEventListener("pointerdown",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("pointerdown",t)}},[y]);let S=e=>`whitespace-nowrap rounded-full px-3 py-2 text-sm font-medium transition-colors xl:px-[15px] ${e?"bg-[var(--jl-ink)] text-white":"text-[oklch(0.2_0.01_265_/_0.75)] hover:text-[var(--jl-ink)]"}`,T=e=>(0,t.jsx)(r.default,{href:e.href,"aria-current":k(e.href)?"page":void 0,className:S(k(e.href)),children:e.label},e.href),E=e=>(0,t.jsx)(r.default,{href:e.href,onClick:()=>g(!1),"aria-current":k(e.href)?"page":void 0,className:`rounded-xl px-4 py-3 text-base font-semibold ${k(e.href)?"bg-[var(--jl-ink)] text-white":"text-[var(--jl-ink)]"}`,children:e.label},e.href);return(0,t.jsxs)("header",{className:"sticky top-0 z-40 border-b border-[oklch(0.2_0.01_265_/_0.07)] bg-[oklch(0.985_0.003_250_/_0.86)] backdrop-blur-[10px]",children:[(0,t.jsxs)("div",{className:"jl-shell flex items-center justify-between gap-6 py-3.5",children:[(0,t.jsxs)(r.default,{href:"/",className:"flex items-center gap-2.5",children:[(0,t.jsx)(s.default,{src:"/images/jotlayer-mark.webp",alt:"",width:32,height:32,className:"h-8 w-8 object-contain",priority:!0}),(0,t.jsx)("span",{className:"text-[19px] font-bold tracking-[-0.02em]",children:"JotLayer"})]}),(0,t.jsxs)("nav",{className:"hidden items-center gap-1 rounded-full border-[1.5px] border-[oklch(0.2_0.01_265_/_0.1)] bg-white p-[5px] lg:flex",children:[c.map(T),(0,t.jsxs)("div",{ref:b,className:"relative",onPointerEnter:e=>{"mouse"===e.pointerType&&(w.current&&clearTimeout(w.current),y||(_.current=Date.now()),v(!0))},onPointerLeave:e=>{"mouse"===e.pointerType&&(w.current=setTimeout(()=>v(!1),150))},children:[(0,t.jsxs)("button",{type:"button","aria-expanded":y,"aria-controls":"nav-free-tools",onClick:()=>{Date.now()-_.current<600||v(e=>!e)},className:`${S(x)} inline-flex items-center gap-1`,children:["Free tools",(0,t.jsx)(o,{className:`h-3.5 w-3.5 transition-transform ${y?"rotate-180":""}`})]}),(0,t.jsx)("div",{id:"nav-free-tools",hidden:!y,className:"absolute left-1/2 top-full z-50 w-[320px] -translate-x-1/2 pt-3",children:(0,t.jsxs)("div",{className:"jl-card p-2 shadow-[0_18px_40px_-18px_oklch(0.2_0.01_265_/_0.3)]",children:[(0,t.jsx)("div",{className:"jl-eyebrow px-3 pb-1.5 pt-2 !text-[11.5px]",children:"Free tools"}),p.map(e=>{let s=e.icon;return(0,t.jsxs)(r.default,{href:e.href,"aria-current":k(e.href)?"page":void 0,onClick:()=>v(!1),className:"flex items-start gap-3 rounded-2xl p-3 transition-colors hover:bg-[var(--jl-bg)]",children:[(0,t.jsx)("span",{className:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[oklch(0.9_0.16_98_/_0.45)]",children:(0,t.jsx)(s,{className:"h-5 w-5"})}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"block text-[15px] font-bold leading-tight",children:e.label}),(0,t.jsx)("span",{className:"mt-0.5 block text-[13.5px] leading-snug text-[var(--jl-muted)]",children:e.description})]})]},e.href)})]})})]}),d.map(T)]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"jl-btn jl-btn-sm hidden sm:inline-flex",children:a}),(0,t.jsx)("button",{type:"button",onClick:()=>g(e=>!e),"aria-expanded":m,"aria-label":m?"Close menu":"Open menu",className:"inline-flex h-11 w-11 items-center justify-center rounded-full border-2 border-[var(--jl-line-strong)] bg-white lg:hidden",children:m?(0,t.jsx)(h.X,{className:"h-5 w-5"}):(0,t.jsx)(l,{className:"h-5 w-5"})})]})]}),m&&(0,t.jsx)("div",{className:"border-t border-[var(--jl-line)] bg-[var(--jl-bg)] lg:hidden",children:(0,t.jsxs)("nav",{className:"jl-shell flex flex-col gap-1 py-4",children:[c.map(E),(0,t.jsx)("div",{className:"jl-eyebrow mt-3 px-4 pb-1 !text-[11.5px]",children:"Free tools"}),p.map(E),(0,t.jsx)("div",{className:"mx-4 my-2 h-px bg-[var(--jl-line)]"}),d.map(E),(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"jl-btn jl-btn-sm mt-2 sm:hidden",children:a})]})})]})}e.s(["Navigation",()=>f],13474)},34537,e=>{"use strict";var t,r,s=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInl
3ine|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,i=(t=function(e){return s.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&91>e.charCodeAt(2)},r=Object.create(null),function(e){return void 0===r[e]&&(r[e]=t(e)),r[e]});e.s(["default",()=>i],34537)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>t],43531)},21978,67881,17927,31178,37806,21476,47414,74008,64978,72846,46932,e=>{"use strict";let t,r,s,i,n,a;var o,l,u,h,c,d,p,f,m,g,y,v,b,w,_,k,x,S,T,E,P,A,j=e.i(43476),R=e.i(71645);function O(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var C=R.forwardRef((e,t)=>{let{children:r,...s}=e,i=R.Children.toArray(r),n=i.find(N);if(n){let e=n.props.children,r=i.map(t=>t!==n?t:R.Children.count(e)>1?R.Children.only(null):R.isValidElement(e)?e.props.children:null);return(0,j.jsx)(I,{...s,ref:t,children:R.isValidElement(e)?R.cloneElement(e,void 0,r):null})}return(0,j.jsx)(I,{...s,ref:t,children:r})});C.displayName="Slot";var I=R.forwardRef((e,t)=>
3{let{children:r,...s}=e;if(R.isValidElement(r)){var i;let e,n,a=(i=r,(n=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(n=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref);return R.cloneElement(r,{...function(e,t){let r={...t};for(let s in t){let i=e[s],n=t[s];/^on[A-Z]/.test(s)?i&&n?r[s]=(...e)=>{n(...e),i(...e)}:i&&(r[s]=i):"style"===s?r[s]={...i,...n}:"className"===s&&(r[s]=[i,n].filter(Boolean).join(" "))}return{...e,...r}}(s,r.props),ref:t?function(...e){return t=>{let r=!1,s=e.map(e=>{let s=O(e,t);return r||"function"!=typeof s||(r=!0),s});if(r)return()=>{for(let t=0;t<s.length;t++){let r=s[t];"function"==typeof r?r():O(e[t],null)}}}}(t,a):a})}return R.Children.count(r)>1?R.Children.only(null):null});I.displayName="SlotClone";var $=({children:e})=>(0,j.jsx)(j.Fragment,{children:e});function N(e){return R.isValidElement(e)&&e.type===$}function D(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=function e(t){var r,s,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var n=t.length;for(r=0;r<n;r++)t[r]&&(s=e(t[r]))&&(i&&(i+=" "),i+=s)}else for(s in t)t[s]&&(i&&(i+=" "),i+=s);return i}(e))&&(s&&(s+=" "),s+=t);return s}let M=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,U=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),L=[],B=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let s=e[t],i=r.nextPart.get(s);if(i){let r=B(e,t+1,i);if(r)return r}let n=r.validators;if(null===n)return;let a=0===t?e.join("-"):e.slice(t).join("-"),o=n.length;for(let e=0;e<o;e++){let t=n[e];if(t.validator(a))return t.classGroupId}},V=(e,t)=>{let r=U();for(let s in e)F(e[s],r,s,t);return r},F=(e,t,r,s)=>{let i=e.length;for(let n=0;n<i;n++)z(e[n],t,r,s)},z=(e,t,r,s)=>{"string"==typeof e?q(e,t,r):"function"==typeof e?W(e,t,r,s):K(e,t,r,s)},q=(e,t,r)=>{(""===e?t:H(t,e)).classGroupId=r},W=(e,t,r,s)=>{G(e)?F(e(s),t,r,s):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},K=(e,t,r,s)=>{let i=Object.entries(e),n=i.length;for(let e=0;e<n;e++){let[n,a]=i[e];F(a,H(t,n),r,s)}},H=(e,t)=>{let r=e,s=t.split("-"),i=s.length;for(let e=0;e<i;e++){let t=s[e],i=r.nextPart.get(t);i||(i=U(),r.nextPart.set(t,i)),r=i}return r},G=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,J=[],Y=(e,t,r,s,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:i}),X=/\s+/,Z=e=>{let t;if("string"==typeof e)return e;let r="";for(let s=0;s<e.length;s++)e[s]&&(t=Z(e[s]))&&(r&&(r+=" "),r+=t);return r},Q=[],ee=e=>{let t=t=>t[e]||Q;return t.isThemeGetter=!0,t},et=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,er=/^\((?:(\w[\w-]*):)?(.+)\)$/i,es=/^\d+\/\d+$/,ei=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,en=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ea=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,eo=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,el=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,eu=e=>es.test(e),eh=e=>!!e&&!Number.isNaN(Number(e)),ec=e=>!!e&&Number.isInteger(Number(e)),ed=e=>e.endsWith("%")&&eh(e.slice(0,-1)),ep=e=>ei.test(e),ef=()=>!0,em=e=>en.test(e)&&!ea.test(e),eg=()=>!1,ey=e=>eo.test(e),ev=e=>el.test(e),eb=e=>!e_(e)&&!eP(e),ew=e=>e$(e,eU,eg),e_=e=>et.test(e),ek=e=>e$(e,eL,em),ex=e=>e$(e,eB,eh),eS=e=>e$(e,eD,eg),eT=e=>e$(e,eM,ev),eE=e=>e$(e,eF,ey),eP=e=>er.test(e),eA=e=>eN(e,eL),ej=e=>eN(e,eV),eR=e=>eN(e,eD),eO=e=>eN(e,eU),eC=e=>eN(e,eM),eI=e=>eN(e,eF,!0),e$=(e,t,r)=>{let s=et.exec(e);return!!s&&(s[1]?t(s[1]):r(s[2]))},eN=(e,t,r=!1)=>{let s=er.exec(e);return!!s&&(s[1]?t(s[1]):r)},eD=e=>"position"===e||"percentage"===e,eM=e=>"image"===e||"url"===e,eU=e=>"length"===e||"size"===e||"bg-size"===e,eL=e=>"length"===e,eB=e=>"number"===e,eV=e=>"family-name"===e,eF=e=>"shadow"===e,ez=((e,...t)=>{let r,s,i,n,a=e=>{let t=s(e);if(t)return t;let n=((e,t)=>{let{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:i,sortModifiers:n}=t,a=[],o=e.trim().split(X),l="";for(let e=o.length-1;e>=0;
3e-=1){let t=o[e],{isExternal:u,modifiers:h,hasImportantModifier:c,baseClassName:d,maybePostfixModifierPosition:p}=r(t);if(u){l=t+(l.length>0?" "+l:l);continue}let f=!!p,m=s(f?d.substring(0,p):d);if(!m){if(!f||!(m=s(d))){l=t+(l.length>0?" "+l:l);continue}f=!1}let g=0===h.length?"":1===h.length?h[0]:n(h).join(":"),y=c?g+"!":g,v=y+m;if(a.indexOf(v)>-1)continue;a.push(v);let b=i(m,f);for(let e=0;e<b.length;++e){let t=b[e];a.push(y+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return i(e,n),n};return n=o=>{var l;let u;return s=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null),i=(i,n)=>{r[i]=n,++t>e&&(t=0,s=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=s[e])?(i(e,t),t):void 0},set(e,t){e in r?r[e]=t:i(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,s=e=>{let t,r=[],s=0,i=0,n=0,a=e.length;for(let o=0;o<a;o++){let a=e[o];if(0===s&&0===i){if(":"===a){r.push(e.slice(n,o)),n=o+1;continue}if("/"===a){t=o;continue}}"["===a?s++:"]"===a?s--:"("===a?i++:")"===a&&i--}let o=0===r.length?e:e.slice(n),l=o,u=!1;return o.endsWith("!")?(l=o.slice(0,-1),u=!0):o.startsWith("!")&&(l=o.slice(1),u=!0),Y(r,u,l,t&&t>n?t-n:void 0)};if(t){let e=t+":",r=s;s=t=>t.startsWith(e)?r(t.slice(e.length)):Y(J,!1,t,void 0,!0)}if(r){let e=s;s=t=>r({className:t,parseClassName:e})}return s})(l),sortModifiers:(u=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{u.set(e,1e6+t)}),e=>{let t=[],r=[];for(let s=0;s<e.length;s++){let i=e[s],n="["===i[0],a=u.has(i);n||a?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(i)):r.push(i)}return r.length>0&&(r.sort(),t.push(...r)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return V(r,t)})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,s,i;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(s=(t=r.slice(1,-1)).indexOf(":"),(i=t.slice(0,s))?"arbitrary.."+i:void 0)}let s=e.split("-"),i=+(""===s[0]&&s.length>1);return B(s,i,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=s[e],i=r[e];if(t){if(i){let e=Array(i.length+t.length);for(let t=0;t<i.length;t++)e[t]=i[t];for(let r=0;r<t.length;r++)e[i.length+r]=t[r];return e}return t}return i||L}return r[e]||L}}})(l)}).cache.get,i=r.cache.set,n=a,a(o)},(...e)=>n(((...e)=>{let t,r,s=0,i="";for(;s<e.length;)(t=e[s++])&&(r=Z(t))&&(i&&(i+=" "),i+=r);return i})(...e))})(()=>{let e=ee("color"),t=ee("font"),r=ee("text"),s=ee("font-weight"),i=ee("tracking"),n=ee("leading"),a=ee("breakpoint"),o=ee("container"),l=ee("spacing"),u=ee("radius"),h=ee("shadow"),c=ee("inset-shadow"),d=ee("text-shadow"),p=ee("drop-shadow"),f=ee("blur"),m=ee("perspective"),g=ee("aspect"),y=ee("ease"),v=ee("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...w(),eP,e_],k=()=>["auto","hidden","clip","visible","scroll"],x=()=>["auto","contain","none"],S=()=>[eP,e_,l],T=()=>[eu,"full","auto",...S()],E=()=>[ec,"none","subgrid",eP,e_],P=()=>["auto",{span:["full",ec,eP,e_]},ec,eP,e_],A=()=>[ec,"auto",eP,e_],j=()=>["auto","min","max","fr",eP,e_],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...S()],I=()=>[eu,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],$=()=>[e,eP,e_],N=()=>[...w(),eR,eS,{position:[eP,e_]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",eO,ew,{size:[eP,e_]}],U=()=>[ed,eA,ek],L=()=>["","none","full",u,eP,e_],B=()=>["",eh,eA,ek],V=()=>["solid","dashed","dotted","double"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[eh,ed,eR,eS],q=()=>["","none",f,eP,e_],W=()=>["none",eh,eP,e_],K=()=>["none",eh,eP,e_],H=()=>[eh,eP,e_],G=()=>[eu,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ep],breakpoint:[ep],color:[ef],container:[ep],"drop-shadow":[ep],ease:["in","out","in-out"],font:[eb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ep],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ep],shadow:[ep],spacing:["px",eh],text:[ep],"text-shadow":[ep],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",eu,e_,eP,g]}
vendor: 12,803 bytes, line 3
3],container:["container"],columns:[{columns:[eh,e_,eP,o]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:x()}],"overscroll-x":[{"overscroll-x":x()}],"overscroll-y":[{"overscroll-y":x()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[ec,"auto",eP,e_]}],basis:[{basis:[eu,"full","auto",o,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[eh,eu,"auto","initial","none",e_]}],grow:[{grow:["",eh,eP,e_]}],shrink:[{shrink:["",eh,eP,e_]}],order:[{order:[ec,"first","last","none",eP,e_]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],w:[{w:[o,"screen",...I()]}],"min-w":[{"min-w":[o,"screen","none",...I()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",r,eA,ek]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,eP,ex]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ed,e_]}],"font-family":[{font:[ej,e_,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,eP,e_]}],"line-clamp":[{"line-clamp":[eh,"none",eP,ex]}],leading:[{leading:[n,...S()]}],"list-image":[{"list-image":["none",eP,e_]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",eP,e_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[eh,"from-font","auto",eP,ek]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[eh,"auto",eP,e_]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",eP,e_]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",eP,e_]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ec,eP,e_],radial:["",eP,e_],conic:[ec,eP,e_]},eC,eT]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[eh,eP,e_]}],"outline-w":[{outline:["",eh,eA,ek]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",h,eI,eE]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",c,eI,eE]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[eh,ek]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",d,eI,eE]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[eh,eP,e_]}],"mix-blend":[{"mix-blend":[...F(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":F()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[eh]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[eP,e_]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[eh]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",eP,e_]}],filter:[{filter:["","none",eP,e_]}],blur:[{blur:q()}],brightness:[{brightness:[eh,eP,e_]}],contrast:[{contrast:[eh,eP,e_]}],"drop-shadow":[{"drop-shadow":["","none",p,eI,eE]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",eh,eP,e_]}],"hue-rotate":[{"hue-rotate":[eh,eP,e_]}],invert:[{invert:["",eh,eP,e_]}],saturate:[{saturate:[eh,eP,e_]}],sepia:[{sepia:["",eh,eP,e_]}],"backdrop-filter":[{"backdrop-filter":["","none",eP,e_]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[eh,eP,e_]}],"backdrop-contrast":[{"backdrop-contrast":[eh,eP,e_]}],"backdrop-grayscale":[{"backdrop-grayscale":["",eh,eP,e_]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[eh,eP,e_]}],"backdrop-invert":[{"backdrop-invert":["",eh,eP,e_]}],"backdrop-opacity":[{"backdrop-opacity":[eh,eP,e_]}],"backdrop-saturate":[{"backdrop-saturate":[eh,eP,e_]}],"backdrop-sepia":[{"backdrop-sepia":["",eh,eP,e_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",eP,e_]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[eh,"initial",eP,e_]}],ease:[{ease:["linear","initial",y,eP,e_]}],delay:[{delay:[eh,eP,e_]}],animate:[{animate:["none",v,eP,e_]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,eP,e_]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:H()}],"skew-x":[{"skew-x":H()}],"skew-y":[{"skew-y":H()}],transform:[{transform:[eP,e_,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:G()}],"translate-x":[{"translate-x":G()}],"translate-y":[{"translate-y":G()}],"translate-z":[{"translate-z":G()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}
3],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",eP,e_]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",eP,e_]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[eh,eA,ek,ex]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),eq=(s="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},e=>{var t;if((null==i?void 0:i.variants)==null)return D(s,null==e?void 0:e.class,null==e?void 0:e.className);let{variants:r,defaultVariants:n}=i,a=Object.keys(r).map(t=>{let s=null==e?void 0:e[t],i=null==n?void 0:n[t];if(null===s)return null;let a=M(s)||M(i);return r[t][a]}),o=e&&Object.entries(e).reduce((e,t)=>
3{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return D(s,a,null==i||null==(t=i.compoundVariants)?void 0:t.reduce((e,t)=>{let{class:r,className:s,...i}=t;return Object.entries(i).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...n,...o}[t]):({...n,...o})[t]===r})?[...e,r,s]:e},[]),null==e?void 0:e.class,null==e?void 0:e.className)});function eW({className:e,variant:t,size:r,asChild:s=!1,...i}){let n=s?C:"button";return(0,j.jsx)(n,{"data-slot":"button",className:function(...e){return ez(D(e))}(eq({variant:t,size:r,className:e})),...i})}e.s(["Button",()=>eW],67881);var eK=e.i(47167);class eH extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class eG extends eH{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class eJ extends eH{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class eY extends eH{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(o=v||(v={})).Any="any",o.ApNortheast1="ap-northeast-1",o.ApNortheast2="ap-northeast-2",o.ApSouth1="ap-south-1",o.ApSoutheast1="ap-southeast-1",o.ApSoutheast2="ap-southeast-2",o.CaCentral1="ca-central-1",o.EuCentral1="eu-central-1",o.EuWest1="eu-west-1",o.EuWest2="eu-west-2",o.EuWest3="eu-west-3",o.SaEast1="sa-east-1",o.UsEast1="us-east-1",o.UsWest1="us-west-1",o.UsWest2="us-west-2";function eX(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)0>t.indexOf(s[i])&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r}"function"==typeof SuppressedError&&SuppressedError;class eZ{constructor(e,{headers:t={},customFetch:r,region:s=v.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){var t,r,s,i;return t=this,r=arguments,s=void 0,i=function*(e,t={}){var r;let s,i;try{let n,{headers:a,method:o,body:l,signal:u,timeout:h}=t,c={},{region:d}=t;d||(d=this.region);let p=new URL(`${this.url}/${e}`);d&&"any"!==d&&(c["x-region"]=d,p.searchParams.set("forceFunctionRegion",d)),l&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?"undefined"!=typeof Blob&&l instanceof Blob||l instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",n=l):"string"==typeof l?(c["Content-Type"]="text/plain",n=l):"undefined"!=typeof FormData&&l instanceof FormData?n=l:(c["Content-Type"]="application/json",n=JSON.stringify(l)):n=!l||"string"==typeof l||"undefined"!=typeof Blob&&l instanceof Blob||l instanceof ArrayBuffer||"undefined"!=typeof FormData&&l instanceof FormData?l:JSON.stringify(l);let f=u;h&&(i=new AbortController,s=setTimeout(()=>i.abort(),h),u?(f=i.signal,u.addEventListener("abort",()=>i.abort())):f=i.signal);let m=yield this.fetch(p.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),a),body:n,signal:f}).catch(e=>{throw new eG(e)}),g=m.headers.get("x-relay-error");if(g&&"true"===g)throw new eJ(m);if(!m.ok)throw new eY(m);let y=(null!=(r=m.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim();return{data:"application/json"===y?yield m.json():"application/octet-stream"===y||"application/pdf"===y?yield m.blob():"text/event-stream"===y?m:"multipart/form-data"===y?yield m.formData():yield m.text(),error:null,response:m}}catch(e){return{data:null,error:e,response:e instanceof eY||e instanceof eJ?e.context:void 0}}finally{s&&clearTimeout(s)}},new(s||(s=Promise))(function(e,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof s?r:new s(function(e){e(r)})).then(a,o)}l((i=i.apply(t,r||[])).next())})}}var eQ=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
3de=e.code}},e0=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!=(t=e.shouldThrowOnError)&&t,this.signal=e.signal,this.isMaybeSingle=null!=(r=e.isMaybeSingle)&&r,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var r=this;void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");let s=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,s,i,n;let a=null,o=null,l=null,u=e.status,h=e.statusText;if(e.ok){if("HEAD"!==r.method){let t=await e.text();""===t||(o="text/csv"===r.headers.get("Accept")||r.headers.get("Accept")&&(null==(i=r.headers.get("Accept"))?void 0:i.includes("application/vnd.pgrst.plan+text"))?t:JSON.parse(t))}let n=null==(t=r.headers.get("Prefer"))?void 0:t.match(/count=(exact|planned|estimated)/),c=null==(s=e.headers.get("content-range"))?void 0:s.split("/");n&&c&&c.length>1&&(l=parseInt(c[1])),r.isMaybeSingle&&"GET"===r.method&&Array.isArray(o)&&(o.length>1?(a={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,u=406,h="Not Acceptable"):o=1===o.length?o[0]:null)}else{let t=await e.text();try{a=JSON.parse(t),Array.isArray(a)&&404===e.status&&(o=[],a=null,u=200,h="OK")}catch(r){404===e.status&&""===t?(u=204,h="No Content"):a={message:t}}if(a&&r.isMaybeSingle&&(null==a||null==(n=a.details)?void 0:n.includes("0 rows"))&&(a=null,u=200,h="OK"),a&&r.shouldThrowOnError)throw new eQ(a)}return{error:a,data:o,count:l,status:u,statusText:h}});return this.shouldThrowOnError||(s=s.catch(e=>{var t,r,s,i,n,a;let o="",l=null==e?void 0:e.cause;if(l){let t=null!=(r=null==l?void 0:l.message)?r:"",a=null!=(s=null==l?void 0:l.code)?s:"";o=`${null!=(i=null==e?void 0:e.name)?i:"FetchError"}: ${null==e?void 0:e.message} 4 5Caused by: ${null!=(n=null==l?void 0:l.name)?n:"Error"}: ${t}`,a&&(o+=` (${a})`),(null==l?void 0:l.stack)&&(o+=` 6${l.stack}`)}else o=null!=(a=null==e?void 0:e.stack)?a:"";return{error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:o,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}returns(){return this}overrideTypes(){return this}},e1=class extends e0{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:i=s}={}){let n=i?`${i}.order`:"order",a=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){let i=void 0===s?"offset":`${s}.offset`,n=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(n,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:n="text"}={}){var a;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,i?"wal":null].filter(
6Boolean).join("|"),l=null!=(a=this.headers.get("Accept"))?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${n}; for="${l}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};let e2=RegExp("[,()]");var e5=class extends e1{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&e2.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&e2.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let i="";"plain"===s?i="pl":"phrase"===s?i="ph":"websearch"===s&&(i="w");let n=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},e3=class{constructor(e,{headers:t={},schema:r,fetch:s}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:r=!1,count:s}=null!=t?t:{},i=!1,n=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e)).join(""),{url:a,headers:o}=this.cloneRequestState();return a.searchParams.set("select",n),s&&o.append("Prefer",`count=${s}`),new e5({method:r?"HEAD":"GET",url:a,headers:o,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;let{url:i,headers:n}=this.cloneRequestState();if(t&&n.append("Prefer",`count=${t}`),r||n.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>
6e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);i.searchParams.set("columns",e.join(","))}}return new e5({method:"POST",url:i,headers:n,schema:this.schema,body:e,fetch:null!=(s=this.fetch)?s:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){var n;let{url:a,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&a.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),i||o.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);a.searchParams.set("columns",e.join(","))}}return new e5({method:"POST",url:a,headers:o,schema:this.schema,body:e,fetch:null!=(n=this.fetch)?n:fetch})}update(e,{count:t}={}){var r;let{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new e5({method:"PATCH",url:s,headers:i,schema:this.schema,body:e,fetch:null!=(r=this.fetch)?r:fetch})}delete({count:e}={}){var t;let{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new e5({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!=(t=this.fetch)?t:fetch})}},e4=class e{constructor(e,{headers:t={},schema:r,fetch:s}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=s}from(e){if(!e||"string"!=typeof e||""===e.trim())throw Error("Invalid relation name: relation must be a non-empty string.");return new e3(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:s=!1,count:i}={}){var n;let a,o,l=new URL(`${this.url}/rpc/${e}`),u=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(u)),h=r&&Object.values(t).some(u);h?(a="POST",o=t):r||s?(a=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{l.searchParams.append(e,t)})):(a="POST",o=t);let c=new Headers(this.headers);return h?c.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&c.set("Prefer",`count=${i}`),new e5({method:a,url:l,headers:c,schema:this.schemaName,body:o,fetch:null!=(n=this.fetch)?n:fetch})}};let e8=class{constructor(){}static detectEnvironment(){var t;if("undefined"!=typeof WebSocket)return{type:"native",constructor:WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if(void 0!==e.g.WebSocket)return{type:"native",constructor:e.g.WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("undefined"!=typeof globalThis&&globalThis.EdgeRuntime||"undefined"!=typeof navigator&&(null==(t=navigator.userAgent)?void 0:t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let e=r.versions;if(e&&e.node){let t=parseInt(e.node.replace(/^v/,"").split(".")[0]);return t>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${t} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${t} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=` 7 8Suggested solution: ${e.workaround}`),Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}},e6="1.0.0";(l=b||(b={}))[l.connecting=0]="connecting",l[l.open=1]="open",l[l.closing=2]="closing",l[l.closed=3]="closed",(u=w||(w={})).closed="closed",u.errored="errored",u.joined="joined",u.joining="joining",u.leaving="leaving",(h=_||(_={})).close="phx_close",h.error="phx_error",h.join="phx_join",h.reply="phx_reply",h.leave="phx_leave",h.access_token="access_token",(k||(k={})).websocket="websocket",(c=x||(x={})).Connecting="connecting",c.Open="open",c.Closing="closing",c.Closed="closed";class e9{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=e?e:[]}encode(e,t){return e.event!==this.BROADCAST_EVENT||e.payload instanceof ArrayBuffer||"string"!=typeof e.payload.event?t(JSON.stringify([e.join_ref,e.ref,e.topic,e.event,e.payload])):t(this._binaryEncodeUserBroadcastPush(e))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer(null==(t=e.payload)?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,r;let s=null!=(r=null==(t=e.payload)?void 0:t.payload)?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var t,r;let s=null!=(r=null==(t=e.payload)?void 0:t.payload)?r:{},i=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,i)}_encodeUserBroadcastPush(e,t,r){let s=e.topic,i=null!=(p=e.ref)?p:"",n=null!=(f=e.join_ref)?f:"",a=e.payload.event,o=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},l=0===Object.keys(o).length?"":JSON.stringify(o);if(n.length>255)throw Error(`joinRef length ${n.length} exceeds maximum of 255`);if(i.length>255)throw Error(`ref length ${i.length} exceeds maximum of 255`);if(s.length>255)throw Error(`topic length ${s.length} exceeds maximum of 255`);if(a.length>255)throw Error(`userEvent length ${a.length} exceeds maximum of 255`);if(l.length>255)throw Error(`metadata length ${l.length} exceeds maximum of 255`);let u=this.USER_BROADCAST_PUSH_META_LENGTH+n.length+i.length+s.length+a.length+l.length,h=new ArrayBuffer(this.HEADER_LENGTH+u),c=new DataView(
8h),d=0;c.setUint8(d++,this.KINDS.userBroadcastPush),c.setUint8(d++,n.length),c.setUint8(d++,i.length),c.setUint8(d++,s.length),c.setUint8(d++,a.length),c.setUint8(d++,l.length),c.setUint8(d++,t),Array.from(n,e=>c.setUint8(d++,e.charCodeAt(0))),Array.from(i,e=>c.setUint8(d++,e.charCodeAt(0))),Array.from(s,e=>c.setUint8(d++,e.charCodeAt(0))),Array.from(a,e=>c.setUint8(d++,e.charCodeAt(0))),Array.from(l,e=>c.setUint8(d++,e.charCodeAt(0)));var p,f,m=new Uint8Array(h.byteLength+r.byteLength);return m.set(new Uint8Array(h),0),m.set(new Uint8Array(r),h.byteLength),m.buffer}decode(e,t){if(this._isArrayBuffer(e))return t(this._binaryDecode(e));if("string"==typeof e){let[r,s,i,n,a]=JSON.parse(e);return t({join_ref:r,ref:s,topic:i,event:n,payload:a})}return t({})}_binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),s=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,s)}_decodeUserBroadcast(e,t,r){let s=t.getUint8(1),i=t.getUint8(2),n=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+4,l=r.decode(e.slice(o,o+s));o+=s;let u=r.decode(e.slice(o,o+i));o+=i;let h=r.decode(e.slice(o,o+n));o+=n;let c=e.slice(o,e.byteLength),d=a===this.JSON_ENCODING?JSON.parse(r.decode(c)):c,p={type:this.BROADCAST_EVENT,event:u,payload:d};return n>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||(null==(t=null==e?void 0:e.constructor)?void 0:t.name)==="ArrayBuffer"}_pick(e,t){return e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e))):{}}}class e7{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}(d=S||(S={})).abstime="abstime",d.bool="bool",d.date="date",d.daterange="daterange",d.float4="float4",d.float8="float8",d.int2="int2",d.int4="int4",d.int4range="int4range",d.int8="int8",d.int8range="int8range",d.json="json",d.jsonb="jsonb",d.money="money",d.numeric="numeric",d.oid="oid",d.reltime="reltime",d.text="text",d.time="time",d.timestamp="timestamp",d.timestamptz="timestamptz",d.timetz="timetz",d.tsrange="tsrange",d.tstzrange="tstzrange";let te=(e,t,r={})=>{var s;let i=null!=(s=r.skipTypes)?s:[];return t?Object.keys(t).reduce((r,s)=>(r[s]=tt(s,e,t,i),r),{}):{}},tt=(e,t,r,s)=>{let i=t.find(t=>t.name===e),n=null==i?void 0:i.type,a=r[e];return n&&!s.includes(n)?tr(n,a):ts(a)},tr=(e,t)=>{if("_"===e.charAt(0))return to(t,e.slice(1,e.length));switch(e){case S.bool:return ti(t);case S.float4:case S.float8:case S.int2:case S.int4:case S.int8:case S.numeric:case S.oid:return tn(t);case S.json:case S.jsonb:return ta(t);case S.timestamp:return tl(t);case S.abstime:case S.date:case S.daterange:case S.int4range:case S.int8range:case S.money:case S.reltime:case S.text:case S.time:case S.timestamptz:case S.timetz:case S.tsrange:case S.tstzrange:default:return ts(t)}},ts=e=>e,ti=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},tn=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},ta=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},to=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,s=e[r];if("{"===e[0]&&"}"===s){let s,i=e.slice(1,r);try{s=JSON.parse("["+i+"]")}catch(e){s=i?i.split(","):[]}return s.map(e=>tr(t,e))}return e},tl=e=>"string"==typeof e?e.replace(" ","T"):e,tu=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),""===t.pathname||"/"===t.pathname?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class th{constructor(e,t,r={},s=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,j
8oin_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null==(r=this.receivedResp)?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}(p=T||(T={})).SYNC="sync",p.JOIN="join",p.LEAVE="leave";class tc{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:s}=this.caller;this.joinRef=this.channel._joinRef(),this.state=tc.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=tc.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],s()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:s}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=tc.syncDiff(this.state,e,t,r),s())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,s){let i=this.cloneDeep(e),n=this.transformState(t),a={},o={};return this.map(i,(e,t)=>{n[e]||(o[e]=t)}),this.map(n,(e,t)=>{let r=i[e];if(r){let s=t.map(e=>e.presence_ref),i=r.map(e=>e.presence_ref),n=t.filter(e=>0>i.indexOf(e.presence_ref)),l=r.filter(e=>0>s.indexOf(e.presence_ref));n.length>0&&(a[e]=n),l.length>0&&(o[e]=l)}else a[e]=t}),this.syncDiff(i,{joins:a,leaves:o},r,s)}static syncDiff(e,t,r,s){let{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(t,s)=>{var i;let n=null!=(i=e[t])?i:[];if(e[t]=this.cloneDeep(s),n.length>0){let r=e[t].map(e=>e.presence_ref),s=n.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...s)}r(t,n,s)}),this.map(n,(t,r)=>{let i=e[t];if(!i)return;let n=r.map(e=>e.presence_ref);i=i.filter(e=>0>n.indexOf(e.presence_ref)),e[t]=i,s(t,i,r),0===i.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let s=e[r];return"metas"in s?t[r]=s.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(f=E||(E={})).ALL="*",f.INSERT="INSERT",f.UPDATE="UPDATE",f.DELETE="DELETE",(m=P||(P={})).BROADCAST="broadcast",m.PRESENCE="presence",m.POSTGRES_CHANGES="postgres_changes",m.SYSTEM="system",(g=A||(A={})).SUBSCRIBED="SUBSCRIBED",g.TIMED_OUT="TIMED_OUT",g.CLOSED="CLOSED",g.CHANNEL_ERROR="CHANNEL_ERROR";class td{constructor(e,t={config:{}},r){var s,i;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=w.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new th(this,_.join,this.params,this.timeout),this.rejoinTimer=new e7(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=w.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e
8=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=w.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=w.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=w.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=w.errored,this.rejoinTimer.scheduleTimeout())}),this._on(_.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new tc(this),this.broadcastEndpointURL=tu(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null==(i=null==(s=this.params.config)?void 0:s.broadcast)?void 0:i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.state==w.closed){let{config:{broadcast:n,presence:a,private:o}}=this.params,l=null!=(s=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?s:[],u=!!this.bindings[P.PRESENCE]&&this.bindings[P.PRESENCE].length>0||(null==(i=this.params.config.presence)?void 0:i.enabled)===!0,h={},c={broadcast:n,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:l,private:o};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(A.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(A.CLOSED)),this.updateJoinPayload(Object.assign({config:c},h)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var r;if(this.socket._isManualToken()||this.socket.setAuth(),void 0===t){null==e||e(A.SUBSCRIBED);return}{let s=this.bindings.postgres_changes,i=null!=(r=null==s?void 0:s.length)?r:0,n=[];for(let r=0;r<i;r++){let i=s[r],{filter:{event:a,schema:o,table:l,filter:u}}=i,h=t&&t[r];if(h&&h.event===a&&td.isFilterValueEqual(h.schema,o)&&td.isFilterValueEqual(h.table,l)&&td.isFilterValueEqual(h.filter,u))n.push(Object.assign(Object.assign({},i),{id:h.id}));else{this.unsubscribe(),this.state=w.errored,null==e||e(A.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=n,e&&e(A.SUBSCRIBED);return}}).receive("error",t=>{this.state=w.errored,null==e||e(A.CHANNEL_ERROR,Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||e(A.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===w.joined&&e===P.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,t,r)}async httpSend(e,t,r={}){var s;if(null==t)return Promise.reject("Payload is required for httpSend()");let i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);let n={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,n,null!=(s=r.timeout)?s:this.timeout);if(202===a.status)return{success:!0};let o=a.statusText;try{let e=await a.json();o=e.error||e.message||o}catch(e){}return Promise.reject(Error(o))}async send(e,t={}){var r,s;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var s,i,n;let a=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(n=null==(i=null==(s=this.params)?void 0:s.config)?void 0:i.broadcast)?void 0:n.ack)||r("ok"),a.receive("ok",()=>r("ok")),a.receive("error",()=>r("error")),a.receive("timeout",()=>r("timed out"))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated
8in the future. Please use httpSend() explicitly for REST delivery.");let{event:i,payload:n}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);let o={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:n,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!=(r=t.timeout)?r:this.timeout);return await (null==(s=e.body)?void 0:s.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=w.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(_.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(s=>{(r=new th(this,_.leave,{},e)).receive("ok",()=>{t(),s("ok")}).receive("timeout",()=>{t(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{null==r||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=w.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){let s=new AbortController,i=setTimeout(()=>s.abort(),r),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:s.signal}));return clearTimeout(i),n}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new th(this,e,t,r);return this._canPush()?s.send():this._addToPushBuffer(s),s}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){let e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var s,i;let n=e.toLocaleLowerCase(),{close:a,error:o,leave:l,join:u}=_;if(r&&[a,o,l,u].indexOf(n)>=0&&r!==this._joinRef())return;let h=this._onMessage(n,t,r);if(t&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null==(s=this.bindings.postgres_changes)||s.filter(e=>{var t,r,s;return(null==(t=e.filter)?void 0:t.event)==="*"||(null==(s=null==(r=e.filter)?void 0:r.event)?void 0:s.toLocaleLowerCase())===n}).map(e=>e.callback(h,r)):null==(i=this.bindings[n])||i.filter(e=>{var r,s,i,a,o,l,u,h;if(!["broadcast","presence","postgres_changes"].includes(n))return e.type.toLocaleLowerCase()===n;if("id"in e){let n=e.id,l=null==(r=e.filter)?void 0:r.event;return n&&(null==(s=t.ids)?void 0:s.includes(n))&&("*"===l||(null==l?void 0:l.toLocaleLowerCase())===(null==(i=t.data)?void 0:i.type.toLocaleLowerCase()))&&(!(null==(a=e.filter)?void 0:a.table)||e.filter.table===(null==(o=t.data)?void 0:o.table))}{let r=null==(u=null==(l=null==e?void 0:e.filter)?void 0:l.event)?void 0:u.toLocaleLowerCase();return"*"===r||r===(null==(h=null==t?void 0:t.event)?void 0:h.toLocaleLowerCase())}}).map(e=>{if("object"==typeof h&&"ids"in h){let e=h.data,{schema:t,table:r,commit_timestamp:s,type:i,errors:n}=e;h=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:s,eventType:i,new:{},old:{},errors:n}),this._getPayloadRecords(e))}e.callback(h,r)})}_isClosed(){return this.state===w.closed}_isJoined(){return this.state===w.joined}_isJoining(){return this.state===w.joining}_isLeaving(){return this.state===w.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let s=e.toLocaleLowerCase(),i={type:s,filter:t,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(e=>{var s;return!((null==(s=e.type)?void 0:s.toLocaleLowerCase())===r&&td.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(_.close,{},e)}_onError(e){this._on(_.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=w.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=te(e.columns,e.record)),("UPDATE"===e.type||"DELET
8E"===e.type)&&(t.old=te(e.columns,e.old_record)),t}}let tp=()=>{},tf=[1e3,2e3,5e3,1e4],tm=` 9 addEventListener("message", (e) => { 10 if (e.data.event === "start") { 11 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 12 } 13 });`;class tg{constructor(e,t){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=1e4,this.transport=null,this.heartbeatIntervalMs=25e3,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=tp,this.ref=0,this.reconnectTimer=null,this.vsn=e6,this.logger=tp,this.conn=null,this.sendBuffer=[],this.serializer=new e9,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null==(r=null==t?void 0:t.params)?void 0:r.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${k.websocket}`,this.httpEndpoint=tu(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=e8.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");let e=t.message;if(e.includes("Node.js"))throw Error(`${e} 14 15To use Realtime in Node.js, you need to provide a WebSocket implementation: 16 17Option 1: Use Node.js 22+ which has native WebSocket support 18Option 2: Install and provide the "ws" package: 19 20 npm install ws 21 22 import ws from "ws" 23 const client = new RealtimeClient(url, { 24 ...options, 25 transport: ws 26 })`);throw Error(`WebSocket not available: ${e}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},"function"==typeof this.conn.close&&(e?this.conn.close(e,null!=t?t:""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case b.connecting:return x.Connecting;case b.open:return x.Open;case b.closing:return x.Closing;default:return x.Closed}}isConnected(){return this.connectionState()===x.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){let r=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===r);if(s)return s;{let r=new td(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){let{topic:t,event:r,payload:s,ref:i}=e,n=()=>{this.encode(e,e=>{var t;null==(t=this.conn)||t.send(e)})};this.log("push",`${t} ${r} (${i})`,s),this.isConnected()?n():this.sendBuffer.push(n)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this._wasManualDisconnect=!1,null==(e=this.conn)||e.close(1e3,"heartbeat timeout"),setTimeout(()=>{var e;this.isConnected()||null==(e=this.reconnectTimer)||e.scheduleTimeout()},100);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
260&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{if("phoenix"===e.topic&&"phx_reply"===e.event&&e.ref&&e.ref===this.pendingHeartbeatRef){let t=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback("ok"===e.payload.status?"ok":"error",t)}catch(e){this.log("error","error in heartbeat callback",e)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}let{topic:t,event:r,payload:s,ref:i}=e,n=i?`(${i})`:"",a=s.status||"";this.log("receive",`${a} ${t} ${r} ${n}`.trim(),s),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,s,i)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null==(t=this.reconnectTimer)||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===b.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===b.open||this.conn.readyState===b.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(e=>{this.log("error","error waiting for auth on connect",e),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this._terminateWorker()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null==(t=this.reconnectTimer)||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(_.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${r}${s}`}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([tm],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t,r=!1;if(e)t=e,r=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log("error","Error fetching access token from callback",e),t=this.accessTokenValue}else t=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEac
26h(e=>{let r={access_token:t,version:"realtime-js/2.90.1"};t&&e.updateJoinPayload(r),e.joinedOnce&&e._isJoined()&&e._push(_.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}_setupReconnectionTimer(){this.reconnectTimer=new e7(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},10)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,s,i,n,a,o,l,u,h,c,d;switch(this.transport=null!=(t=null==e?void 0:e.transport)?t:null,this.timeout=null!=(r=null==e?void 0:e.timeout)?r:1e4,this.heartbeatIntervalMs=null!=(s=null==e?void 0:e.heartbeatIntervalMs)?s:25e3,this.worker=null!=(i=null==e?void 0:e.worker)&&i,this.accessToken=null!=(n=null==e?void 0:e.accessToken)?n:null,this.heartbeatCallback=null!=(a=null==e?void 0:e.heartbeatCallback)?a:tp,this.vsn=null!=(o=null==e?void 0:e.vsn)?o:e6,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!=(l=null==e?void 0:e.reconnectAfterMs)?l:e=>tf[e-1]||1e4,this.vsn){case e6:this.encode=null!=(u=null==e?void 0:e.encode)?u:(e,t)=>t(JSON.stringify(e)),this.decode=null!=(h=null==e?void 0:e.decode)?h:(e,t)=>t(JSON.parse(e));break;case"2.0.0":this.encode=null!=(c=null==e?void 0:e.encode)?c:this.serializer.encode.bind(this.serializer),this.decode=null!=(d=null==e?void 0:e.decode)?d:this.serializer.decode.bind(this.serializer);break;default:throw Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if("undefined"!=typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}var ty=e.i(67034),tv=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown="CommitStateUnknownException"===t.icebergType||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};async function tb(e){return e&&"none"!==e.type?"bearer"===e.type?{Authorization:`Bearer ${e.token}`}:"header"===e.type?{[e.name]:e.value}:"custom"===e.type?await e.getHeaders():{}:{}}function tw(e){return e.join("\x1f")}var t_=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:tw(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){let r={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${tw(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tw(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${tw(e.namespace)}`}),!0}catch(e){if(e instanceof tv&&404===e.status)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof tv&&409===e.status)return;throw e}}};function tk(e){return e.join("\x1f")}var tx=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tk(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){let r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${tk(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){let r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${tk(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${tk(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){let t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${tk(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){let t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${tk(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof tv&&404===e.status)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof tv&&409===r.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},tS=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=function(e){let t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:i,body:n,headers:a}){let o=function(e,t,r){let s=new URL(t,e);if(r)for(let[e,t]of Object.entries(r))void 0!==t&&s.searchParams.set(e,t);return s.toString()}(e.baseUrl,s,i),l=await tb(e.auth),u=await t(o,{method:r,headers:{...n?{"Content-Type":"application/json"}:{},...l,...a},body:n?JSON.stringify(n):void 0}),h=await u.text(),c=(u.headers.get("content-type")||"").includes("application/json"),d=c&&h?JSON.parse(h):h;if(!u.ok){let e=c?d:void 0,t=e?.error;throw new tv(t?.message??`Request failed with status ${u.status}`,{status:u.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:u.status,headers:u.headers,data:d}}}}({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new t_(this.client,t),this.tableOps=new tx(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
26async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},tT=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};function tE(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}var tP=class extends tT{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tA=class extends tT{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}};let tj=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),tR=e=>{if(Array.isArray(e))return e.map(e=>tR(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=tR(r)}),t};function tO(e){return(tO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function tI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tC(Object(r),!0).forEach(function(t){!function(e,t,r){var s;(s=function(e,t){if("object"!=tO(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=tO(s))return s;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==tO(s)?s:s+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tC(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}let t$=e=>{var t;return e.msg||e.message||e.error_description||("string"==typeof e.error?e.error:null==(t=e.error)?void 0:t.message)||JSON.stringify(e)},tN=async(e,t,r)=>{e instanceof await Response&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{let s=e.status||500,i=(null==r?void 0:r.statusCode)||s+"";t(new tP(t$(r),s,i))}).catch(e=>{t(new tA(t$(e),e))}):t(new tA(t$(e),e))};async function tD(e,t,r,s,i,n){return new Promise((a,o)=>{let l;e(r,(l={method:t,headers:(null==s?void 0:s.headers)||{}},"GET"===t||!n?l:((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(n)?(l.headers=tI({"Content-Type":"application/json"},null==s?void 0:s.headers),l.body=JSON.stringify(n)):l.body=n,(null==s?void 0:s.duplex)&&(l.duplex=s.duplex),tI(tI({},l),i)))).then(e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?e:e.json()}).then(e=>a(e)).catch(e=>tN(e,o,s))})}async function tM(e,t,r,s){return tD(e,"GET",t,r,s)}async function tU(e,t,r,s,i){return tD(e,"POST",t,s,i,r)}async function tL(e,t,r,s,i){return tD(e,"PUT",t,s,i,r)}async function tB(e,t,r,s){return tD(e,"HEAD",t,tI(tI({},r),{},{noResolveJson:!0}),s)}async function tV(e,t,r,s,i){return tD(e,"DELETE",t,s,i,r)}var tF=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}};
26t=Symbol.toStringTag;var tz=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[t]="BlobDownloadBuilder",this.promise=null}asStream(){return new tF(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await (await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}};let tq={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},tW={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var tK=class{constructor(e,t={},r,s){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=tj(s)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(e,t,r,s){try{let i,n=tI(tI({},tW),s),a=tI(tI({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)}),o=n.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",n.cacheControl),o&&i.append("metadata",this.encodeMetadata(o)),i.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?((i=r).has("cacheControl")||i.append("cacheControl",n.cacheControl),o&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(o))):(i=r,a["cache-control"]=`max-age=${n.cacheControl}`,a["content-type"]=n.contentType,o&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(o))),("undefined"!=typeof ReadableStream&&i instanceof ReadableStream||i&&"object"==typeof i&&"pipe"in i&&"function"==typeof i.pipe)&&!n.duplex&&(n.duplex="half")),(null==s?void 0:s.headers)&&(a=tI(tI({},a),s.headers));let l=this._removeEmptyFolders(t),u=this._getFinalPath(l),h=await ("PUT"==e?tL:tU)(this.fetch,`${this.url}/object/${u}`,i,tI({headers:a},(null==n?void 0:n.duplex)?{duplex:n.duplex}:{}));return{data:{path:l,id:h.Id,fullPath:h.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,s){let i=this._removeEmptyFolders(e),n=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${n}`);a.searchParams.set("token",t);try{let e,t=tI({upsert:tW.upsert},s),n=tI(tI({},this.headers),{"x-upsert":String(t.upsert)});return"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType),{data:{path:i,fullPath:(await tL(this.fetch,a.toString(),e,{headers:n})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async createSignedUploadUrl(e,t){try{let r=this._getFinalPath(e),s=tI({},this.headers);(null==t?void 0:t.upsert)&&(s["x-upsert"]="true");let i=await tU(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:s}),n=new URL(this.url+i.url),a=n.searchParams.get("token");if(!a)throw new tT("No token returned by API");return{data:{signedUrl:n.toString(),path:e,token:a},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){try{return{data:await tU(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
26stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async copy(e,t,r){try{return{data:{path:(await tU(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async createSignedUrl(e,t,r){try{let s=this._getFinalPath(e),i=await tU(this.fetch,`${this.url}/object/sign/${s}`,tI({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i={signedUrl:encodeURI(`${this.url}${i.signedURL}${n}`)},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async createSignedUrls(e,t,r){var s=this;try{let i=await tU(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:t,paths:e},{headers:s.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i.map(e=>tI(tI({},e),{},{signedUrl:e.signedURL?encodeURI(`${s.url}${e.signedURL}${n}`):null})),error:null}}catch(e){if(s.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}download(e,t){let r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",s=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=s?`?${s}`:"",n=this._getFinalPath(e);return new tz(()=>tM(this.fetch,`${this.url}/${r}/${n}${i}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}async info(e){let t=this._getFinalPath(e);try{return{data:tR(await tM(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers})),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async exists(e){let t=this._getFinalPath(e);try{return await tB(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e)&&e instanceof tA){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){let r=this._getFinalPath(e),s=[],i=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&s.push(i);let n=void 0!==(null==t?void 0:t.transform)?"render/image":"object",a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==a&&s.push(a);let o=s.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${n}/public/${r}${o}`)}}}async remove(e){try{return{data:await tV(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async list(e,t,r){try{let s=tI(tI(tI({},tq),t),{},{prefix:e||""});return{data:await tU(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async listV2(e,t){try{let r=tI({},e);return{data:await tU(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ty.Buffer?ty.Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};let tH="2.90.1",tG={"X-Client-Info":`storage-js/${tH}`};var tJ=class{constructor(e,t={},r,s){this.shouldThrowOnError=!1;const i=new URL(e);(null==s?void 0:s.useNewHostname)&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=tI(tI({},tG),t),this.fetch=tj(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(e){try{let t=this.listBucketOptionsToQueryString(e);return{data:await tM(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async getBucket(e){try{return{data:await tM(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async createBucket(e,t={public:!1}){try{return{data:await tU(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async updateBucket(e,t){try{return{data:await tL(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async emptyBucket(e){try{return{data:await tU(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async deleteBucket(e){try{return{data:await tV(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}listBucketOptionsToQueryString(e){let t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},tY=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=tI(tI({},tG),t),this.fetch=tj(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){try{return{data:await tU(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async listBuckets(e){try{let t=new URLSearchParams;(null==e?void 0:e.limit)!==void 0&&t.set("limit",e.limit.toString()),(null==e?void 0:e.offset)!==void 0&&t.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&t.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&t.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&t.set("search",e.search);let r=t.toString(),s=r?`${this.url}/bucket?${r}`:`${this.url}/bucket`;return{data:await tM(this.fetch,s,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}async deleteBucket(e){try{return{data:await tV(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tE(e))return{data:null,error:e};throw e}}from(e){var t=this;if(!(!(!e||"string"!=typeof e||0===e.length||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\"))&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))throw new tT("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let r=new tS({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(e,t){let r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(s)throw e;return{data:null,error:e}}}}})}};let tX={"X-Client-Info":`storage-js/${tH}`,"Content-Type":"application/json"};
26var tZ=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function tQ(e){return"object"==typeof e&&null!==e&&"__isStorageVectorsError"in e}var t0=class extends tZ{constructor(e,t,r){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},t1=class extends tZ{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}};let t2=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),t5=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),t3=async(e,t,r)=>{if(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status&&!(null==r?void 0:r.noResolveJson)){let r=e.status||500;"function"==typeof e.json?e.json().then(e=>{let s=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||r+"";t(new t0(t5(e),r,s))}).catch(()=>{t(new t0(e.statusText||`HTTP ${r} error`,r,r+""))}):t(new t0(e.statusText||`HTTP ${r} error`,r,r+""))}else t(new t1(t5(e),e))};async function t4(e,t,r,s,i,n){return new Promise((a,o)=>{let l;e(r,(l={method:t,headers:(null==s?void 0:s.headers)||{}},"GET"===t||!n?l:((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(n)?(l.headers=tI({"Content-Type":"application/json"},null==s?void 0:s.headers),l.body=JSON.stringify(n)):l.body=n,tI(tI({},l),i)))).then(e=>{if(!e.ok)throw e;if(null==s?void 0:s.noResolveJson)return e;let t=e.headers.get("content-type");return t&&t.includes("application/json")?e.json():{}}).then(e=>a(e)).catch(e=>t3(e,o,s))})}async function t8(e,t,r,s,i){return t4(e,"POST",t,s,i,r)}var t6=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=tI(tI({},tX),t),this.fetch=t2(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(e){try{return{data:await t8(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers})||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async getIndex(e,t){try{return{data:await t8(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async listIndexes(e){try{return{data:await t8(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async deleteIndex(e,t){try{return{data:await t8(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers})||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}},t9=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=tI(tI({},tX),t),this.fetch=t2(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(e){try{if(e.vectors.length<1||e.vectors.length>500)throw Error("Vector batch size must be between 1 and 500 items");return{data:await t8(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers})||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async getVectors(e){try{return{data:await t8(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async listVectors(e){try{if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:await t8(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async queryVectors(e){try{return{data:await t8(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async deleteVectors(e){try{if(e.keys.length<1||e.keys.length>
26500)throw Error("Keys batch size must be between 1 and 500 items");return{data:await t8(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers})||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}},t7=class{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=tI(tI({},tX),t),this.fetch=t2(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(e){try{return{data:await t8(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async getBucket(e){try{return{data:await t8(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async listBuckets(e={}){try{return{data:await t8(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}async deleteBucket(e){try{return{data:await t8(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers})||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tQ(e))return{data:null,error:e};throw e}}},re=class extends t7{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new rt(this.url,this.headers,e,this.fetch)}async createBucket(e){return super.createBucket.call(this,e)}async getBucket(e){return super.getBucket.call(this,e)}async listBuckets(e={}){return super.listBuckets.call(this,e)}async deleteBucket(e){return super.deleteBucket.call(this,e)}},rt=class extends t6{constructor(e,t,r,s){super(e,t,s),this.vectorBucketName=r}async createIndex(e){return super.createIndex.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return super.listIndexes.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return super.getIndex.call(this,this.vectorBucketName,e)}async deleteIndex(e){return super.deleteIndex.call(this,this.vectorBucketName,e)}index(e){return new rr(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},rr=class extends t9{constructor(e,t,r,s,i){super(e,t,i),this.vectorBucketName=r,this.indexName=s}async putVectors(e){return super.putVectors.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async getVectors(e){return super.getVectors.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async listVectors(e={}){return super.listVectors.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async queryVectors(e){return super.queryVectors.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async deleteVectors(e){return super.deleteVectors.call(this,tI(tI({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}},rs=class extends tJ{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new tK(this.url,this.headers,e,this.fetch)}get vectors(){return new re(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new tY(this.url+"/iceberg",this.headers,this.fetch)}};let ri="2.90.1",rn={"X-Client-Info":`gotrue-js/${ri}`},ra="X-Supabase-Api-Version",ro={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},rl=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;class ru extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function rh(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class rc extends ru{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class rd extends ru{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class rp extends ru{constructor(e,t,r,s){super(e,r,s),this.name=t,this.status=r}}class rf extends rp{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class rm extends rp{constructor(){super("Auth session or user missing","AuthInvalidToken
26ResponseError",500,void 0)}}class rg extends rp{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ry extends rp{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class rv extends rp{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class rb extends rp{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class rw extends rp{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function r_(e){return rh(e)&&"AuthRetryableFetchError"===e.name}class rk extends rp{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class rx extends rp{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let rS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),rT=" \n\r=".split(""),rE=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<rT.length;t+=1)e[rT[t].charCodeAt(0)]=-2;for(let t=0;t<rS.length;t+=1)e[rS[t].charCodeAt(0)]=t;return e})();function rP(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(rS[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(rS[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function rA(e,t,r){let s=rE[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===s)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function rj(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},n=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,s,r)};for(let t=0;t<e.length;t+=1)rA(e.charCodeAt(t),i,n);return t.join("")}function rR(e){let t=[],r={queue:0,queuedBits:0},s=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)rA(e.charCodeAt(t),r,s);return new Uint8Array(t)}function rO(e){let t=[],r={queue:0,queuedBits:0},s=e=>{t.push(e)};return e.forEach(e=>rP(e,r,s)),rP(null,r,s),t.join("")}let rC=()=>"undefined"!=typeof window&&"undefined"!=typeof document,rI={tested:!1,writable:!1},r$=()=>{if(!rC())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(rI.tested)return rI.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),rI.tested=!0,rI.writable=!0}catch(e){rI.tested=!0,rI.writable=!1}return rI.writable},rN=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),rD=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},rM=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},rU=async(e,t)=>{await e.removeItem(t)};class rL{constructor(){this.promise=new rL.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function rB(e){let t=e.split(".");if(3!==t.length)throw new rx("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!rl.test(t[e]))throw new rx("JWT not in base64url format");return{header:JSON.parse(rj(t[0])),payload:JSON.parse(rj(t[1])),signature:rR(t[2]),raw:{header:t[0],payload:t[1]}}}async function rV(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function rF(e){return("0"+e.toString(16)).substr(-2)}async function rz(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>String.fromCharCode(e)).join("")}async function rq(e){return"undefined"==typeof crypto||void 0===crypto.subtle||"undefined"==typeof TextEncoder?(console.warn("WebCrypto API is not supported. Code
26challenge method will default to use plain instead of sha256."),e):btoa(await rz(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function rW(e,t,r=!1){let s=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let s=0;s<56;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,rF).join("")}(),i=s;r&&(i+="/PASSWORD_RECOVERY"),await rD(e,`${t}-code-verifier`,i);let n=await rq(s),a=s===n?"plain":"s256";return[n,a]}rL.promiseConstructor=Promise;let rK=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,rH=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function rG(e){if(!rH.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function rJ(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){let e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function rY(e){return JSON.parse(JSON.stringify(e))}let rX=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rZ=[502,503,504];async function rQ(e){var t;let r,s;if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new rw(rX(e),0);if(rZ.includes(e.status))throw new rw(rX(e),e.status);try{r=await e.json()}catch(e){throw new rd(rX(e),e)}let i=function(e){let t=e.headers.get(ra);if(!t||!t.match(rK))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(i&&i.getTime()>=ro["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?s=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(s=r.error_code),s){if("weak_password"===s)throw new rk(rX(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===s)throw new rf}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new rk(rX(r),e.status,r.weak_password.reasons);throw new rc(rX(r),e.status||500,s)}async function r0(e,t,r,s){var i;let n=Object.assign({},null==s?void 0:s.headers);n[ra]||(n[ra]=ro["2024-01-01"].name),(null==s?void 0:s.jwt)&&(n.Authorization=`Bearer ${s.jwt}`);let a=null!=(i=null==s?void 0:s.query)?i:{};(null==s?void 0:s.redirectTo)&&(a.redirect_to=s.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await r1(e,t,r+o,{headers:n,noResolveJson:null==s?void 0:s.noResolveJson},{},null==s?void 0:s.body);return(null==s?void 0:s.xform)?null==s?void 0:s.xform(l):{data:Object.assign({},l),error:null}}async function r1(e,t,r,s,i,n){let a,o,l=(o={method:t,headers:(null==s?void 0:s.headers)||{}},"GET"===t?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==s?void 0:s.headers),o.body=JSON.stringify(n),Object.assign(Object.assign({},o),i)));try{a=await e(r,Object.assign({},l))}catch(e){throw console.error(e),new rw(rX(e),0)}if(a.ok||await rQ(a),null==s?void 0:s.noResolveJson)return a;try{return await a.json()}catch(e){await rQ(e)}}function r2(e){var t,r,s;let i=null;(s=e).access_token&&s.refresh_token&&s.expires_in&&(i=Object.assign({},e),e.expires_at||(i.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:i,user:null!=(t=e.user)?t:e},error:null}}function r5(e){let t=r2(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>
26e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function r3(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function r4(e){return{data:e,error:null}}function r8(e){let{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:n}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:n},user:Object.assign({},eX(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function r6(e){return e}let r9=["global","local","others"];class r7{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=rN(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=r9[0]){if(0>r9.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${r9.join(", ")}`);try{return await r0(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(rh(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await r0(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:r3})}catch(e){if(rh(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=eX(e,["options"]),s=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(s.new_email=null==r?void 0:r.newEmail,delete s.newEmail),await r0(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:r8,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(rh(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await r0(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:r3})}catch(e){if(rh(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,s,i,n,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await r0(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(i=null==(s=null==e?void 0:e.perPage)?void 0:s.toString())?i:""},xform:r6});if(u.error)throw u.error;let h=await u.json(),c=null!=(n=u.headers.get("x-total-count"))?n:0,d=null!=(o=null==(a=u.headers.get("link"))?void 0:a.split(","))?o:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(c)),{data:Object.assign(Object.assign({},h),l),error:null}}catch(e){if(rh(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){rG(e);try{return await r0(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:r3})}catch(e){if(rh(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){rG(e);try{return await r0(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:r3})}catch(e){if(rh(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){rG(e);try{return await r0(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:r3})}catch(e){if(rh(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){rG(e.userId);try{let{data:t,error:r}=await r0(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(rh(e))return{data:null,error:e};throw e}}async _deleteFactor(e){rG(e.userId),rG(e.id);try{return{data:await r0(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(rh(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,r,s,i,n,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await r0(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(i=null==(s=null==e?void 0:e.perPage)?void 0:s.toString())?i:""},xform:r6});if(u.error)throw u.error;let h=await u.json(),c=null!=(n=u.headers.get("x-total-count"))?n:0,d=null!=(o=null==(a=u.headers.get("link"))?void 0:a.split(","))?o:[];return d.length>
260&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(c)),{data:Object.assign(Object.assign({},h),l),error:null}}catch(e){if(rh(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await r0(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(rh(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{return await r0(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(rh(e))return{data:null,error:e};throw e}}async _updateOAuthClient(e,t){try{return await r0(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(rh(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{return await r0(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(rh(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{return await r0(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(rh(e))return{data:null,error:e};throw e}}}function se(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let st={debug:!!(globalThis&&r$()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class sr extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class ss extends sr{}async function si(e,t,r){st.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),st.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async s=>{if(s){st.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await r()}finally{st.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}if(0===t)throw st.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new ss(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(st.debug)try{let e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null," "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}))}function sn(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}class sa extends Error{constructor({message:e,code:t,cause:r,name:s}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!=(i=null!=s?s:r instanceof Error?r.name:void 0)?i:"Unknown Error",this.code=t}}class so extends sa{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}let sl=new class{createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};function su(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function sh(){var e,t;return!!(rC()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null==(e=null==navigator?void 0:navigator.credentials)?void 0:e.create)&&"function"==typeof(null==(t=null==navigator?void 0:navigator.credentials)?void 0:t.get))}async function sc(e){try{let t=await navigator.credentials.create(e);if(!t)return{data:null,error:new so("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new so("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){var r,s,i;let{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new sa({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if((null==(r=n.authenticatorSelection)?void 0:r.requireResidentKey)===!0)return new sa({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&(null==(s=n.authenticatorSelection)?void 0:s.userVerification)==="required")return new sa({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if((null==(i=n.authenticatorSelection)?void 0:i.userVerification)==="required")return new sa({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new sa({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new sa({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new sa(0===n.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!su(t))return new sa({message:`${window.location.hostname}
26 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rp.id!==t)return new sa({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new sa({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new sa({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new sa({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}async function sd(e){try{let t=await navigator.credentials.get(e);if(!t)return{data:null,error:new so("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new so("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new sa({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new sa({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!su(t))return new sa({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new sa({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new sa({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new sa({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}let sp={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},sf={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function sm(...e){let t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),s={};for(let i of e)if(i)for(let e in i){let n=i[e];if(void 0!==n)if(Array.isArray(n))s[e]=n;else if(r(n))s[e]=n;else if(t(n)){let r=s[e];t(r)?s[e]=sm(r,n):s[e]=sm(n)}else s[e]=n}return s}class sg{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:s},i){try{var n,a,o,l;let{data:u,error:h}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!u)return{data:null,error:h};let c=null!=s?s:sl.createNewAbortSignal();if("create"===u.webauthn.type){let{user:e}=u.webauthn.credential_options.publicKey;e.name||(e.name=`${e.id}:${r}`),e.displayName||(e.displayName=e.name)}switch(u.webauthn.type){case"create":{let t=(n=u.webauthn.credential_options.publicKey,a=null==i?void 0:i.create,sm(sp,n,a||{})),{data:r,error:s}=await sc({publicKey:t,signal:c});if(r)return{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:r}},error:null};return{data:null,error:s}}case"request":{let t=(o=u.webauthn.credential_options.publicKey,l=null==i?void 0:i.request,sm(sf,o,l||{})),{data:r,error:s}=await sd(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:t,signal:c}));if(r)return{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:r}},error:null};return{data:null,error:s}}}}catch(e){if(rh(e))return{data:null,error:e};return{data:null,error:new rd("Unexpected error in challenge",e)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t="undefined"!=typeof window?window.location.hostname:void 0,rpOrigins:r="undefined"!=typeof window?[window.location.origin]:void 0,signal:s}={}},i){if(!t)return{data:null,error:new ru("rpId is required for WebAuthn authentication")};try{if(!sh())return{data:null,error:new rd("Browser does not support WebAuthn",null)};let{data:n,error:a}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:s},{request:i});if(!n)return{data:null,error:a};let{webauthn:o}=n;return this._verify({factorId:e,challengeId:n.challengeId,webauthn:{type:o.type,rpId:t,rpOrigins:r,credential_response:o.credential_response}})}catch(e){if(rh(e))return{data:null,error:e};return{data:null,error:new rd("Unexpected error in authenticate",e)}}}async _register({friendlyName:e,webauthn:{rpId:t="undefined"!=typeof window?window.location.hostname:void 0,rpOrigins:r="undefined"!=typeof window?[window.location.origin]:void 0,signal:s}={}},i){if(!t)return{data:null,error:new ru("rpId is required for WebAuthn registration")};try{if(!sh())return{data:null,error:new rd("Browser does not support WebAuthn",null)};let{data:n,error:a}=await this._enroll({friendlyName:e});if(!n)return await this.client.mfa.listFactors().then(t=>{var r;return null==(r=t.data)?void 0:r.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:a};let{data:o,error:l}=await this._challenge({factorId:n.id,friendlyName:n.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:s},{create:i});if(!o)return{data:null,error:l};return this._verify({factorId:n.id,challengeId:o.challengeId,webauthn:{rpId:t,rpOrigins:r,type:o.webauthn.type,credential_response:o.webauthn.credential_response}})}catch(e){if(rh(e))return{data:null,error:e};return{data:null,error:new rd("Unexpected error in register",e)}}}}if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}let sy={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:rn,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function sv(e,t,r){return await r()}let sb={};class sw{get jwks(){var e,t;return null!=(t=null==(e=sb[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){sb[this.storageKey]=Object.assign(Object.assign({},sb[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=sb[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){sb[this.storageKey]=Object.assign(Object.assign({},sb[this.storageKey]),{cachedAt:e})}constructor(e){var t,r,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},sy),e);if(this.storageKey=i.storageKey,this.instanceID=null!=(t=sw.nextInstanceID[this.storageKey])?t:0,sw.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&rC()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new r7({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=rN(i.fetch),this.lock=i.lock||sv,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock?this.lock=i.lock:this.persistSession&&rC()&&(null==(r=null==globalThis?void 0:globalThis.navigator)?void 0:r.locks)?this.lock=si:this.lock=sv,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new sg(this)}
26,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:r$()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=se(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=se(this.memoryStorage)),rC()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null==(s=this.broadcastChannel)||s.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ri}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t={},r="none";if(rC()&&(t=function(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEach((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}(window.location.href),this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce")),rC()&&this.detectSessionInUrl&&"none"!==r){let{data:s,error:i}=await this._getSessionFromURL(t,r);if(i){(this._debug("#_initialize()","error detecting session from URL",i),rh(i)&&"AuthImplicitGrantRedirectError"===i.name)&&(null==(e=i.details)||e.code);return{error:i}}let{session:n,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",n,"redirect type",a),await this._saveSession(n),setTimeout(async()=>{"recovery"===a?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(rh(e))return this._returnResult({error:e});return this._returnResult({error:new rd("Unexpected error during initialization",e)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,s;try{let{data:i,error:n}=await r0(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(s=null==e?void 0:e.options)?void 0:s.captchaToken}},xform:r2});if(n||!i)return this._returnResult({data:{user:null,session:null},error:n});let a=i.session,o=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),this._returnResult({data:{user:o,session:a},error:null})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,r,s;try{let i;if("email"in e){let{email:r,password:s,options:n}=e,a=null,o=null;"pkce"===this.flowType&&([a,o]=await rW(this.storage,this.storageKey)),i=await r0(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:r,password:s,data:null!=(t=null==n?void 0:n.data)?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:r2})}else if("phone"in e){let{phone:t,password:n,options:a}=e;i=await r0(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!=(r=null==a?void 0:a.data)?r:{},channel:null!=(s=null==a?void 0:a.channel)?s:"sms",gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:r2})}else throw new rg("You must provide either an email or phone number and a password");let{data:n,error:a}=i;if(a||!n)return await rU(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});let o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:s,options:i}=e;t=await r0(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:r5})}else if("phone"in e){let{phone:r,password:s,options:i}=e;t=await r0(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:r5})}else throw new rg("You must provide either an email or phone number and a password");let{data:r,error:s}=t;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){let e=new rm;return this._returnResult({data:{user:null,session:null},error:e})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:null==(i=e.options)?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,s,i,n,a,o,l,u,h,c,d;let p,f;if("message"in e)p=e.message,f=e.signature;else{let h,{chain:c,wallet:m,statement:g,options:y}=e;if(rC())if("object"==typeof m)h=m;else{let e=window;if("ethereum"in e&&"object"==typeof e.ethereum&&"request"in e.ethereum&&"function"==typeof e.ethereum.request)h=e.ethereum;else throw Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof m||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");h=m}let v=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href),b=await h.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let w=sn(b[0]),_=null==(r=null==y?void 0:y.signInWithEthereum)?void 0:r.chainId;_||(_=parseInt(await h.request({method:"eth_chainId"}),16)),p=function(e){var t;let{chainId:r,domain:s,expirationTime:i,issuedAt:n=new Date,nonce:a,notBefore:o,requestId:l,resources:u,scheme:h,uri:c,version:d}=e;if(!Number.isInteger(r))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!s)throw Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!c)throw Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==d)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(null==(t=e.statement)?void 0:t.includes("\n"))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let p=sn(e.address),f=h?`${h}://${s}`:s,m=e.statement?`${e.statement} 27`:"",g=`${f} wants you to sign in with your Ethereum account: 28${p} 29 30${m}`,y=`URI: ${c} 31Version: ${d}
32Chain ID: ${r}${a?` 33Nonce: ${a}`:""} 34Issued At: ${n.toISOString()}`;if(i&&(y+=` 35Expiration Time: ${i.toISOString()}`),o&&(y+=` 36Not Before: ${o.toISOString()}`),l&&(y+=` 37Request ID: ${l}`),u){let e="\nResources:";for(let t of u){if(!t||"string"!=typeof t)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=` 38- ${t}`}y+=e}return`${g} 39${y}`}({domain:v.host,address:w,statement:g,uri:v.href,version:"1",chainId:_,nonce:null==(s=null==y?void 0:y.signInWithEthereum)?void 0:s.nonce,issuedAt:null!=(n=null==(i=null==y?void 0:y.signInWithEthereum)?void 0:i.issuedAt)?n:new Date,expirationTime:null==(a=null==y?void 0:y.signInWithEthereum)?void 0:a.expirationTime,notBefore:null==(o=null==y?void 0:y.signInWithEthereum)?void 0:o.notBefore,requestId:null==(l=null==y?void 0:y.signInWithEthereum)?void 0:l.requestId,resources:null==(u=null==y?void 0:y.signInWithEthereum)?void 0:u.resources}),f=await h.request({method:"personal_sign",params:[(d=p,"0x"+Array.from(new TextEncoder().encode(d),e=>e.toString(16).padStart(2,"0")).join("")),w]})}try{let{data:t,error:r}=await r0(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:f},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(c=e.options)?void 0:c.captchaToken}}:null),xform:r2});if(r)throw r;if(!t||!t.session||!t.user){let e=new rm;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,r,s,i,n,a,o,l,u,h,c,d;let p,f;if("message"in e)p=e.message,f=e.signature;else{let c,{chain:d,wallet:m,statement:g,options:y}=e;if(rC())if("object"==typeof m)c=m;else{let e=window;if("solana"in e&&"object"==typeof e.solana&&("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))c=e.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof m||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");c=m}let v=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href);if("signIn"in c&&c.signIn){let e,t=await c.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==y?void 0:y.signInWithSolana),{version:"1",domain:v.host,uri:v.href}),g?{statement:g}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)p="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),f=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in c)||"function"!=typeof c.signMessage||!("publicKey"in c)||"object"!=typeof c||!c.publicKey||!("toBase58"in c.publicKey)||"function"!=typeof c.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${v.host} wants you to sign in with your Solana account:`,c.publicKey.toBase58(),...g?["",g,""]:[""],"Version: 1",`URI: ${v.href}`,`Issued At: ${null!=(s=null==(r=null==y?void 0:y.signInWithSolana)?void 0:r.issuedAt)?s:new Date().toISOString()}`,...(null==(i=null==y?void 0:y.signInWithSolana)?void 0:i.notBefore)?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...(null==(n=null==y?void 0:y.signInWithSolana)?void 0:n.expirationTime)?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...(null==(a=null==y?void 0:y.signInWithSolana)?void 0:a.chainId)?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...(null==(o=null==y?void 0:y.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...(null==(l=null==y?void 0:y.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...(null==(h=null==(u=null==y?void 0:y.signInWithSolana)?void 0:u.resources)?void 0:h.length)?["Resources",...y.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await c.signMessage(new TextEncoder().encode(p),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");f=e}}try{let{data:t,error:r}=await r0(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:rO(f)},(null==(c=e.options)?void 0:c.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:r2});if(r)throw r;if(!t||!t.session||!t.user){let e=new rm;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:r})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){let t=await rM(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(null!=t?t:"").split("/");try{if(!r&&"pkce"===this.flowType)throw new rb;let{data:t,error:i}=await r0(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:r2});if(await rU(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){let e=new rm;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=s?s:null}),error:i})}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:s,access_token:i,nonce:n}=e,{data:a,error:o}=await r0(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:r2});if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!a||!a.session||!a.user){let e=new rm;return this._returnResult({data:{user:null,session:null},error:e})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:a,error:o})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,r,s,i,n;try{if("email"in e){let{email:s,options:i}=e,n=null,a=null;"pkce"===this.flowType&&([n,a]=await rW(this.storage,this.storageKey));let{error:o}=await r0(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:s,data:null!=(t=null==i?void 0:i.data)?t:{},create_user:null==(r=null==i?void 0:i.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if("phone"in e){let{phone:t,options:r}=e,{data:a,error:o}=await r0(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(s=null==r?void 0:r.data)?s:{},create_user:null==(i=null==r?void 0:r.shouldCreateUser)||i,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(n=null==r?void 0:r.channel)?n:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new rg("You must provide either an email or phone number.")}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,r;try{let s,i;"options"in e&&(s=null==(t=e.options)?void 0:t.redirectTo,i=null==(r=e.options)?void 0:r.captchaToken);let{data:n,error:a}=await r0(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:r2});if(a)throw a;if(!n)throw Error("An error occurred on token verification.");let o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,r,s,i,n;try{let a=null,o=null;"pkce"===this.flowType&&([a,o]=await rW(this.storage,this.storageKey));let l=await r0(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!=(r=null==(t=e.options)?void 0:t.redirectTo)?r:void 0}),(null==(s=null==e?void 0:e.options)?void 0:s.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:r4});return(null==(i=l.data)?void 0:i.url)&&rC()&&!(null==(n=e.options)?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new rf;let{error:s}=await r0(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:s,options:i}=e,{error:n}=await r0(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:n})}if("phone"in e){let{phone:r,type:s,options:i}=e,{data:n,error:a}=await r0(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new rg("You must provide either an email or phone number and a type")}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let t=null,r=await rM(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),null!==r&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not val
39id"),await this._removeSession())),!t)return{data:{session:null},error:null};let s=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){let e=await rM(this.userStorage,this.storageKey+"-user");(null==e?void 0:e.user)?t.user=e.user:t.user=rJ()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){var e;let r={value:this.suppressGetSessionWarning};t.user=(e=t.user,new Proxy(e,{get:(e,t,s)=>{if("__isInsecureUserWarningProxy"===t)return!0;if("symbol"==typeof t){let r=t.toString();if("Symbol(Symbol.toPrimitive)"===r||"Symbol(Symbol.toStringTag)"===r||"Symbol(util.inspect.custom)"===r||"Symbol(nodejs.util.inspect.custom)"===r)return Reflect.get(e,t,s)}return r.value||"string"!=typeof t||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),r.value=!0),Reflect.get(e,t,s)}})),r.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}let{data:i,error:n}=await this._callRefreshToken(t.refresh_token);if(n)return this._returnResult({data:{session:null},error:n});return this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{if(e)return await r0(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:r3});return await this._useSession(async e=>{var t,r,s;let{data:i,error:n}=e;if(n)throw n;return(null==(t=i.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await r0(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(s=null==(r=i.session)?void 0:r.access_token)?s:void 0,xform:r3}):{data:{user:null},error:new rf}})}catch(e){if(rh(e))return rh(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await rU(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new rf;let n=s.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await rW(this.storage,this.storageKey));let{data:l,error:u}=await r0(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:r3});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new rf;let t=Date.now()/1e3,r=t,s=!0,i=null,{payload:n}=rB(e.access_token);if(n.exp&&(s=(r=n.exp)<=t),s){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!t)return{data:{user:null,session:null},error:null};i=t}else{let{data:s,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:s.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if(rh(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:s,error:i}=t;if(i)throw i;e=null!=(r=s.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new rf;let{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){try{if(!rC())throw new ry("No browser detected.");
39if(e.error||e.error_description||e.error_code)throw new ry(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new rv("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new ry("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new rv("No code detected.");let{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;let s=new URL(window.location.href);return s.searchParams.delete("code"),window.history.replaceState(window.history.state,"",s.toString()),{data:{session:t.session,redirectType:null},error:null}}let{provider_token:r,provider_refresh_token:s,access_token:i,refresh_token:n,expires_in:a,expires_at:o,token_type:l}=e;if(!i||!a||!n||!l)throw new ry("No session defined in URL");let u=Math.round(Date.now()/1e3),h=parseInt(a),c=u+h;o&&(c=parseInt(o));let d=c-u;1e3*d<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${h}s`);let p=c-h;u-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,c,u):u-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,c,u);let{data:f,error:m}=await this._getUser(i);if(m)throw m;let g={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:c,refresh_token:n,token_type:l,user:f.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:g,redirectType:e.type},error:null})}catch(e){if(rh(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await rM(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:s,error:i}=t;if(i)return this._returnResult({error:i});let n=null==(r=s.session)?void 0:r.access_token;if(n){let{error:t}=await this.admin.signOut(n,e);if(t&&!(rh(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await rU(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let t=Symbol("auth-callback"),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,s;try{let{data:{session:s},error:i}=t;if(i)throw i;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(t){await (null==(s=this.stateChangeEmitters.get(e))?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,s=null;"pkce"===this.flowType&&([r,s]=await rW(this.storage,this.storageKey,!0));try{return await r0(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:null!=(e=t.user.identities)?e:[]},error:null})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:r,error:s}=await this._useSession(async t=>{var r,s,i,n,a;let{data:o,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(s=e.options)?void 0:s.scopes,queryParams:null==(i=e.options)?void 0:i.queryParams,skipBrowserRedirect:!0});return await r0(this.fetch,"GET",u,{headers:this.headers,jwt:null!=(a=null==(n=o.session)?void 0:n.access_token)?a:void 0})});if(s)throw s;return!rC()||(null==(t=e.options)?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),this._returnResult({data:{provider:e.provider,url:null==r?void 0:r.url},error:null})}catch(t){if(rh(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:s,data:{session:i}}=t;if(s)throw s;let{options:n,provider:a,token:o,access_token:l,nonce:u}=e,{data:h,error:c}=await r0(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==i?void 0:i.access_token)?r:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:r2});if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!h||!h.session||!h.user)return this._returnResult({data:{user:null,session:null},error:new rm});return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:c})}catch(e){if(await rU(this.storage,`${this.storageKey}-code-verifier`),rh(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,s;let{data:i,error:n}=t;if(n)throw n;
39return await r0(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(s=null==(r=i.session)?void 0:r.access_token)?s:void 0})})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,s;let i=Date.now();return await (r=async r=>(r>0&&await rV(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await r0(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:r2})),s=(e,t)=>{let r=200*Math.pow(2,e);return t&&r_(t)&&Date.now()+r-i<3e4},new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{let t=await r(i);if(!s(i,null,t))return void e(t)}catch(e){if(!s(i,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),rh(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),rC()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let s=await rM(this.storage,this.storageKey);if(s&&this.userStorage){let t=await rM(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:s.user},await rD(this.userStorage,this.storageKey+"-user",t)),s.user=null!=(e=null==t?void 0:t.user)?e:rJ()}else if(s&&!s.user&&!s.user){let e=await rM(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(s.user=e.user,await rU(this.storage,this.storageKey+"-user"),await rD(this.storage,this.storageKey,s)):s.user=rJ()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),null!==s&&await this._removeSession();return}let i=(null!=(t=s.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${i?"":" not"} expired with margin of 90000s`),i){if(this.autoRefreshToken&&s.refresh_token){let{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),r_(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(s.user&&!0===s.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(s.access_token);!t&&(null==e?void 0:e.user)?(s.user=e.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new rf;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new rL;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new rf;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let s={data:t.session,error:null};return this.refreshingDeferred.resolve(s),s}catch(e){if(this._debug(s,"error",e),rh(e)){let r={data:null,error:e};return r_(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,t,r=!0){let s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let s=[],i=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){s.push(e)}});if(await Promise.all(i),s.length>0){for(let e=0;e<s.length;e+=1)console.error(s[e]);throw s[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await rU(this.storage,`${this.storageKey}-code-verifier`);let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await rD(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let s=rY(e);await rD(this.storage,this.storageKey,s)}else{let e=rY(t);await rD(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await rU(this.storage,this.storageKey),await rU(this.storage,this.storageKey+"-code-verifier"),await rU(this.storage,this.storageKey+"-user"),this.userStorage&&await rU(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&rC()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
39catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e);let t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&"object"==typeof t&&"function"==typeof t.unref?t.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);let t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let s=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),s<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof sr)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!rC()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{"visible"!==document.visibilityState?this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting"):await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let s=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await rW(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});s.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);s.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:s,error:i}=t;return i?this._returnResult({data:null,error:i}):await r0(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token})})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,s;let{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await r0(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):("totp"===e.factorType&&"totp"===o.type&&(null==(s=null==o?void 0:o.totp)?void 0:s.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var r,s,i;let{data:n,error:a}=t;if(a)return this._returnResult({data:null,error:a});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?(s=e.webauthn.credential_response,"toJSON"in s&&"function"==typeof s.toJSON?s.toJSON():{id:s.id,rawId:s.id,response:{attestationObject:rO(new Uint8Array(s.response.attestationObject)),clientDataJSON:rO(new Uint8Array(s.response.clientDataJSON))},type:"public-key",clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:null!=(i=s.authenticatorAttachment)?i:void 0}):function(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();let r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:rO(new Uint8Array(s.authenticatorData)),clientDataJSON:rO(new Uint8Array(s.clientDataJSON)),signature:rO(new Uint8Array(s.signature)),userHandle:s.userHandle?rO(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:u}=await r0(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:u}))})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var r;let{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});let n=await r0(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});if(n.error)return n;let{data:a}=n;if("webauthn"!==a.type)return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential creation options are required");if("undefined"!=typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:r,excludeCredentials:s}=e,i=eX(e,["challenge","user","excludeCredentials"]),n=rR(t).buffer,a=Object.assign(Object.assign({},r),{id:rR(r.id).buffer}),o=Object.assign(Object.assign({},i),{challenge:n,user:a});if(s&&s.length>0){o.excludeCredentials=Array(s.length);for(let e=0;e<s.length;e++){let t=s[e];o.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:rR(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return o}(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential request options are required");if("undefined"!=typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:r}=e,s=eX(e,["challenge","allowCredentials"]),i=rR(t).buffer,n=Object.assign(Object.assign({}
39,s),{challenge:i});if(r&&r.length>0){n.allowCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];n.allowCredentials[e]=Object.assign(Object.assign({},t),{id:rR(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return n}(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let s={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])s.all.push(r),"verified"===r.status&&s[r.factor_type].push(r);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(){var e,t;let{data:{session:r},error:s}=await this.getSession();if(s)return this._returnResult({data:null,error:s});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:i}=rB(r.access_token),n=null;i.aal&&(n=i.aal);let a=n;return(null!=(t=null==(e=r.user.factors)?void 0:e.filter(e=>"verified"===e.status))?t:[]).length>0&&(a="aal2"),{data:{currentLevel:n,nextLevel:a,currentAuthenticationMethods:i.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?await r0(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new rf})})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new rf});let n=await r0(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&rC()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new rf});let n=await r0(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&rC()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;return r?this._returnResult({data:null,error:r}):t?await r0(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new rf})})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{let{data:{session:r},error:s}=t;return s?this._returnResult({data:null,error:s}):r?(await r0(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new rf})})}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let s=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>s)return r;let{data:i,error:n}=await r0(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length&&(this.jwks=i,this.jwks_cached_at=s,r=i.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{var r;let s,i=e;if(!i){let{data:e,error:t}
39=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});i=e.session.access_token}let{header:n,payload:a,signature:o,raw:{header:l,payload:u}}=rB(i);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(a.exp);let h=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!h){let{error:e}=await this.getUser(i);if(e)throw e;return{data:{claims:a,header:n,signature:o},error:null}}let c=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(n.alg),d=await crypto.subtle.importKey("jwk",h,c,!0,["verify"]);if(!await crypto.subtle.verify(c,d,o,(r=`${l}.${u}`,s=[],!function(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){let t=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(s,t)}}(r,e=>s.push(e)),new Uint8Array(s))))throw new rx("Invalid JWT signature");return{data:{claims:a,header:n,signature:o},error:null}}catch(e){if(rh(e))return this._returnResult({data:null,error:e});throw e}}}sw.nextInstanceID={};let s_=sw,sk="";sk="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let sx={headers:{"X-Client-Info":`supabase-js-${sk}/2.90.1`}},sS={schema:"public"},sT={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},sE={};function sP(e){return(sP="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function sA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function sj(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sA(Object(r),!0).forEach(function(t){!function(e,t,r){var s;(s=function(e,t){if("object"!=sP(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=sP(s))return s;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==sP(s)?s:s+"")in e)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sA(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var sR=class extends s_{constructor(e){super(e)}},sO=class{constructor(e,t,r){var s,i,n;this.supabaseUrl=e,this.supabaseKey=t;const a=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,s;let{db:i,auth:n,realtime:a,global:o}=e,{db:l,auth:u,realtime:h,global:c}=t,d={db:sj(sj({},l),i),auth:sj(sj({},u),n),realtime:sj(sj({},h),a),storage:{},global:sj(sj(sj({},c),o),{},{headers:sj(sj({},null!=(r=null==c?void 0:c.headers)?r:{}),null!=(s=null==o?void 0:o.headers)?s:{})}),accessToken:async()=>""};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}(null!=r?r:{},{db:sS,realtime:sE,auth:sj(sj({},sT),{},{storageKey:o}),global:sx});this.storageKey=null!=(s=l.auth.storageKey)?s:"",this.headers=null!=(i=l.global.headers)?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(n=l.auth)?n:{},this.headers,l.global.fetch),this.fetch=((e,t,r)=>{let s=r?(...e)=>r(...e):(...e)=>fetch(...e),i=Headers;return async(r,n)=>{var a;let o=null!=(a=await t())?a:e,l=new i(null==n?void 0:n.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),s(r,sj(sj({},n),{},{headers:l}))}})(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(sj({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new e4(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new rs(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new eZ(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}
39channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return null!=(e=null==(t=r.session)?void 0:t.access_token)?e:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:i,storageKey:n,flowType:a,lock:o,debug:l,throwOnError:u},h,c){let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new sR({url:this.authUrl.href,headers:sj(sj({},d),h),storageKey:n,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:i,flowType:a,lock:o,debug:l,throwOnError:u,fetch:c,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new tg(this.realtimeUrl.href,sj(sj({},e),{},{params:sj(sj({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}};(function(){if("undefined"!=typeof window)return!1;let e=globalThis.process;if(!e)return!1;let t=e.version;if(null==t)return!1;let r=t.match(/^v(\d+)\./);return!!r&&18>=parseInt(r[1],10)})()&&console.warn("â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");let sC=new sO(eK.default.env.NEXT_PUBLIC_SUPABASE_URL||"https://yolcsrlipcjqhxvjbakn.supabase.co","sb_publishable_HPVz5gepZAeXSZtL1DcW6g_cdQasBkQ",void 0);e.s(["supabase",0,sC],17927);let sI=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],s$=new Set(sI),sN=e=>180*e/Math.PI,sD=e=>sU(sN(Math.atan2(e[1],e[0]))),sM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:sD,rotateZ:sD,skewX:e=>sN(Math.atan(e[1])),skewY:e=>sN(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},sU=e=>((e%=360)<0&&(e+=360),e),sL=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),sB=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),sV={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:sL,scaleY:sB,scale:e=>(sL(e)+sB(e))/2,rotateX:e=>sU(sN(Math.atan2(e[6],e[5]))),rotateY:e=>sU(sN(Math.atan2(-e[2],e[0]))),rotateZ:sD,rotate:sD,skewX:e=>sN(Math.atan(e[4])),skewY:e=>sN(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function sF(e){return+!!e.includes("scale")}function sz(e,t){let r,s;if(!e||"none"===e)return sF(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)r=sV,s=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=sM,s=t}if(!s)return sF(t);let n=r[t],a=s[1].split(",").map(sq);return"function"==typeof n?n(a):a[n]}function sq(e){return parseFloat(e.trim())}let sW=e=>t=>"string"==typeof t&&t.startsWith(e),sK=sW("--"),sH=sW("var(--"),sG=e=>!!sH(e)&&sJ.test(e.split("/*")[0].trim()),sJ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function sY(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}function sX({top:e,left:t,right:r,bottom:s}){return{x:{min:t,max:r},y:{min:e,max:s}}}let sZ=(e,t,r)=>e+(t-e)*r;function sQ(e){return void 0===e||1===e}function s0({scale:e,scaleX:t,scaleY:r}){return!sQ(e)||!sQ(t)||!sQ(r)}function s1(e){return s0(e)||s2(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function s2(e){var t,r;return(t=e.x)&&"0%"!==t||(r=e.y)&&"0%"!==r}function s5(e,t,r,s,i){return void 0!==i&&(e=s+i*(e-s)),s+r*(e-s)+t}function s3(e,t=0,r=1,s,i){e.min=s5(e.min,t,r,s,i),e.max=s5(e.max,t,r,s,i)}function s4(e,{x:t,y:r}){s3(e.x,t.translate,t.scale,t.originPoint),s3(e.y,r.translate,r.scale,r.originPoint)}function s8(e,t){e.min=e.min+t,e.max=e.max+t}function s6(e,t,r,s,i=.5){let n=sZ(e.min,e.max,i);s3(e,t,r,n,s)}function s9(e,t){s6(e.x,t.x,t.scaleX,t.scale,t.originX),s6(e.y,t.y,t.scaleY,t.scale,t.originY)}function s7(e,t){return sX(function(e,t){if(!t)return e;let r=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:s.y,right:s.x}}(e.getBoundingClientRect(),t))}let ie=new Set(["width","height","top","left","right","bottom",...sI]),it=(e,t,r)=>r>t?t:r<e?e:r,ir={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},is={...ir,transform:e=>it(0,1,e)},ii={...ir,default:1},ia=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),io=ia("deg"),il=ia("%"),iu=ia("px"),ih=ia("vh"),ic=ia("vw"),id={...il,parse:e=>il.parse(e)/100,transform:e=>il.transform(100*e)},ip=e=>t=>t.test(e),im=[ir,iu,il,io,ic,ih,{test:e=>"auto"===e,parse:e=>e}],ig=e=>im.find(ip(e)),iy=()=>{},iv=()=>{};eK.default;let ib=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,iw=e=>e===ir||e===iu,i_=new Set(["x","y","z"]),ik=sI.filter(e=>!i_.has(e)),ix={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>sz(t,"x"),y:(e,{transform:t})=>sz(t,"y")};ix.translateX=ix.x,ix.translateY=ix.y;let iS=e=>e,iT={},iE=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function iP(e,t){let r=!1,s=!0,i={delta:0,timestamp:0,isProcessing:!1},n=()=>r=!0,a=iE.reduce((e,r)=>(e[r]=function(e,t){let r=new Set,s=new Set,i=!1,n=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function u(t){a.has(t)&&(h.schedule(t),e()),l++,t(o)}let h={schedule:(e,t=!1,n=!1)=>{let o=n&&i?r:s;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{s.delete(e),a.delete(e)},process:e=>{if(o=e,i){n=!0;return}i=!0,[r,s]=[s,r],r.forEach(u),t,l=0,r.clear(),i=!1,n&&(n=!1,h.process(e))}};return h}(n,t?r:void 0),e),{}),{setup:o,read:l,resolveKeyframes:u,preUpdate:h,update:c,preRender:d,render:p,postRender:f}=a,m=()=>{let n=iT.useManualTiming?i.timestamp:performance.now();r=!1,iT.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(n-i.timestamp,40),1)),i.timestamp=n,i.isProcessing=!0,o.process(i),l.process(i),u.process(i),h.process(i),c.process(i),d.process(i),p.process(i),f.process(i),i.isProcessing=!1,r&&t&&(s=!1,e(m))};return{schedule:iE.reduce((t,n)=>{let o=a[n];return t[n]=(t,n=!1,a=!1)=>(!r&&(r=!0,s=!0,i.isProcessing||e(m)),o.schedule(t,n,a)),t},{}),cancel:e=>{for(let t=0;t<iE.length;t++)a[iE[t]].cancel(e)},state:i,steps:a}}let{schedule:iA,cancel:ij,state:iR,steps:iO}=iP("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:iS,!0),iC=new Set,iI=!1,i$=!1,iN=!1;function iD(){if(i$){let e=Array.from(iC).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;
39t.forEach(e=>{let t,s=(t=[],ik.forEach(r=>{let s=e.getValue(r);void 0!==s&&(t.push([r,s.get()]),s.set(+!!r.startsWith("scale")))}),t);s.length&&(r.set(e,s),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}i$=!1,iI=!1,iC.forEach(e=>e.complete(iN)),iC.clear()}function iM(){iC.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(i$=!0)})}class iU{constructor(e,t,r,s,i,n=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=i,this.isAsync=n}scheduleResolve(){this.state="scheduled",this.isAsync?(iC.add(this),iI||(iI=!0,iA.read(iM),iA.resolveKeyframes(iD))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:r,motionValue:s}=this;if(null===e[0]){let i=s?.get(),n=e[e.length-1];if(void 0!==i)e[0]=i;else if(r&&t){let s=r.readValue(t,n);null!=s&&(e[0]=s)}void 0===e[0]&&(e[0]=n),s&&void 0===i&&s.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),iC.delete(this)}cancel(){"scheduled"===this.state&&(iC.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}let iL=e=>Math.round(1e5*e)/1e5,iB=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,iV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,iF=(e,t)=>r=>!!("string"==typeof r&&iV.test(r)&&r.startsWith(e)||t&&null!=r&&Object.prototype.hasOwnProperty.call(r,t)),iz=(e,t,r)=>s=>{if("string"!=typeof s)return s;let[i,n,a,o]=s.match(iB);return{[e]:parseFloat(i),[t]:parseFloat(n),[r]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},iq={...ir,transform:e=>Math.round(it(0,255,e))},iW={test:iF("rgb","red"),parse:iz("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:s=1})=>"rgba("+iq.transform(e)+", "+iq.transform(t)+", "+iq.transform(r)+", "+iL(is.transform(s))+")"},iK={test:iF("#"),parse:function(e){let t="",r="",s="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),s=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),s=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,s+=s,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:iW.transform},iH={test:iF("hsl","hue"),parse:iz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:s=1})=>"hsla("+Math.round(e)+", "+il.transform(iL(t))+", "+il.transform(iL(r))+", "+iL(is.transform(s))+")"},iG={test:e=>iW.test(e)||iK.test(e)||iH.test(e),parse:e=>iW.test(e)?iW.parse(e):iH.test(e)?iH.parse(e):iK.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?iW.transform(e):iH.transform(e),getAnimatableNone:e=>{let t=iG.parse(e);return t.alpha=0,iG.transform(t)}},iJ=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,iY="number",iX="color",iZ=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function iQ(e){let t=e.toString(),r=[],s={color:[],number:[],var:[]},i=[],n=0,a=t.replace(iZ,e=>(iG.test(e)?(s.color.push(n),i.push(iX),r.push(iG.parse(e))):e.startsWith("var(")?(s.var.push(n),i.push("var"),r.push(e)):(s.number.push(n),i.push(iY),r.push(parseFloat(e))),++n,"${}")).split("${}");return{values:r,split:a,indexes:s,types:i}}function i0(e){return iQ(e).values}function i1(e){let{split:t,types:r}=iQ(e),s=t.length;return e=>{let i="";for(let n=0;n<s;n++)if(i+=t[n],void 0!==e[n]){let t=r[n];t===iY?i+=iL(e[n]):t===iX?i+=iG.transform(e[n]):i+=e[n]}return i}}let i2=e=>"number"==typeof e?0:iG.test(e)?iG.getAnimatableNone(e):e,i5={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(iB)?.length||0)+(e.match(iJ)?.length||0)>0},parse:i0,createTransformer:i1,getAnimatableNone:function(e){let t=i0(e);return i1(e)(t.map(i2))}},i3=new Set(["brightness","contrast","saturate","opacity"]);function i4(e){let[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[s]=r.match(iB)||[];if(!s)return e;let i=r.replace(s,""),n=+!!i3.has(t);return s!==r&&(n*=100),t+"("+n+i+")"}let i8=/\b([a-z-]*)\(.*?\)/gu,i6={...i5,getAnimatableNone:e=>{let t=e.match(i8);return t?t.map(i4).join(" "):e}},i9={...ir,transform:Math.round},i7={borderWidth:iu,borderTopWidth:iu,borderRightWidth:iu,borderBottomWidth:iu,borderLeftWidth:iu,borderRadius:iu,radiu
39s:iu,borderTopLeftRadius:iu,borderTopRightRadius:iu,borderBottomRightRadius:iu,borderBottomLeftRadius:iu,width:iu,maxWidth:iu,height:iu,maxHeight:iu,top:iu,right:iu,bottom:iu,left:iu,inset:iu,insetBlock:iu,insetBlockStart:iu,insetBlockEnd:iu,insetInline:iu,insetInlineStart:iu,insetInlineEnd:iu,padding:iu,paddingTop:iu,paddingRight:iu,paddingBottom:iu,paddingLeft:iu,paddingBlock:iu,paddingBlockStart:iu,paddingBlockEnd:iu,paddingInline:iu,paddingInlineStart:iu,paddingInlineEnd:iu,margin:iu,marginTop:iu,marginRight:iu,marginBottom:iu,marginLeft:iu,marginBlock:iu,marginBlockStart:iu,marginBlockEnd:iu,marginInline:iu,marginInlineStart:iu,marginInlineEnd:iu,backgroundPositionX:iu,backgroundPositionY:iu,rotate:io,rotateX:io,rotateY:io,rotateZ:io,scale:ii,scaleX:ii,scaleY:ii,scaleZ:ii,skew:io,skewX:io,skewY:io,distance:iu,translateX:iu,translateY:iu,translateZ:iu,x:iu,y:iu,z:iu,perspective:iu,transformPerspective:iu,opacity:is,originX:id,originY:id,originZ:iu,zIndex:i9,fillOpacity:is,strokeOpacity:is,numOctaves:i9},ne={...i7,color:iG,backgroundColor:iG,outlineColor:iG,fill:iG,stroke:iG,borderColor:iG,borderTopColor:iG,borderRightColor:iG,borderBottomColor:iG,borderLeftColor:iG,filter:i6,WebkitFilter:i6},nt=e=>ne[e];function nr(e,t){let r=nt(e);return r!==i6&&(r=i5),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let ns=new Set(["auto","none","0"]);class ni extends iU{constructor(e,t,r,s,i){super(e,t,r,s,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let r=0;r<e.length;r++){let s=e[r];if("string"==typeof s&&sG(s=s.trim())){let i=function e(t,r,s=1){iv(s<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,n]=function(e){let t=ib.exec(e);if(!t)return[,];let[,r,s,i]=t;return[`--${r??s}`,i]}(t);if(!i)return;let a=window.getComputedStyle(r).getPropertyValue(i);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return sG(n)?e(n,r,s+1):n}(s,t.current);void 0!==i&&(e[r]=i),r===e.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!ie.has(r)||2!==e.length)return;let[s,i]=e,n=ig(s),a=ig(i);if(sY(s)!==sY(i)&&ix[r]){this.needsMeasurement=!0;return}if(n!==a)if(iw(n)&&iw(a))for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r&&(e[t]=parseFloat(r))}else ix[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,r=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&r.push(t);r.length&&function(e,t,r){let s,i=0;for(;i<e.length&&!s;){let t=e[i];"string"==typeof t&&!ns.has(t)&&iQ(t).values.length&&(s=e[i]),i++}if(s&&r)for(let i of t)e[i]=nr(r,s)}(e,r,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ix[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let s=t[t.length-1];void 0!==s&&e.getValue(r,s).jump(s,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;let s=e.getValue(t);s&&s.jump(this.measuredOrigin,!1);let i=r.length-1,n=r[i];r[i]=ix[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==n&&void 0===this.finalKeyframe&&(this.finalKeyframe=n),this.removedTransforms?.length&&this.removedTransforms.forEac
39h(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}}let nn=e=>!!(e&&e.getVelocity);function na(){r=void 0}let no={now:()=>(void 0===r&&no.set(iR.isProcessing||iT.useManualTiming?iR.timestamp:performance.now()),r),set:e=>{r=e,queueMicrotask(na)}};function nl(e,t){-1===e.indexOf(t)&&e.push(t)}function nu(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1)}class nh{constructor(){this.subscriptions=[]}add(e){return nl(this.subscriptions,e),()=>nu(this.subscriptions,e)}notify(e,t,r){let s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](e,t,r);else for(let i=0;i<s;i++){let s=this.subscriptions[i];s&&s(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class nc{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=no.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=no.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new nh);let r=this.events[e].add(t);return"change"===e?()=>{r(),iA.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return a&&a.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=no.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),r?1e3/r*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function nd(e,t){return new nc(e,t)}let np=[...im,iG,i5],{schedule:nf}=iP(queueMicrotask,!1),nm={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ng={};for(let e in nm)ng[e]={isEnabled:t=>nm[e].some(e=>!!t[e])};let ny=()=>({translate:0,scale:1,origin:0,originPoint:0}),nv=()=>({x:ny(),y:ny()}),nb=()=>({min:0,max:0}),nw=()=>({x:nb(),y:nb()}),n_="undefined"!=typeof window,nk={current:null},nx={current:!1},nS=new WeakMap;function nT(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function nE(e){return"string"==typeof e||Array.isArray(e)}let nP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],nA=["initial",...nP];function nj(e){return nT(e.animate)||nA.some(t=>nE(e[t]))}function nR(e){return!!(nj(e)||e.variants)}function nO(e){let t=[{},{}];
39return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function nC(e,t,r,s){if("function"==typeof t){let[i,n]=nO(s);t=t(void 0!==r?r:e.custom,i,n)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,n]=nO(s);t=t(void 0!==r?r:e.custom,i,n)}return t}let nI=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class n${scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:n},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=iU,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=no.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,iA.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=n;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=nj(t),this.isVariantNode=nR(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in h){const t=h[e];void 0!==o[e]&&nn(t)&&t.set(o[e])}}mount(e){this.current=e,nS.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(nx.current||function(){if(nx.current=!0,n_)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>nk.current=e.matches;e.addEventListener("change",t),t()}else nk.current=!1}(),this.shouldReduceMotion=nk.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),ij(this.notifyUpdate),ij(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let r;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let s=s$.has(e);s&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&iA.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in ng){let t=ng[e];if(!t)continue;let{isEnabled:r,Feature:s}=t;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):nw()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<nI.length;t++){let r=nI[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);let s=e["on"+r];s&&(this.propEventSubscriptions[r]=this.on(r,s))}this.prevMotionValues=function(e,t,r){for(let s in t){let i=t[s],n=r[s];if(nn(i))e.addValue(s,i);else if(nn(n))e.addValue(s,nd(i,{owner:e}));else if(n!==i)if(e.hasValue(s)){let t=e.getValue(s);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(s);e.addValue(s,nd(void 0!==t?t:i,{owner:e}))}}for(let s in r)void 0===t[s]&&e.removeValue(s);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}
39addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=nd(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let s,i;if("string"==typeof r&&(s=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(s)||(i=r,/^0[^.\s]+$/u.test(i))))r=parseFloat(r);else{let s;s=r,!np.find(ip(s))&&i5.test(t)&&(r=nr(e,t))}this.setBaseTarget(e,nn(r)?r.get():r)}return nn(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let s=nC(this.props,r,this.presenceContext?.custom);s&&(t=s[e])}if(r&&void 0!==t)return t;let s=this.getBaseTargetFromProps(this.props,e);return void 0===s||nn(s)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:s}on(e,t){return this.events[e]||(this.events[e]=new nh),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){nf.render(this.render)}}class nN extends n${constructor(){super(...arguments),this.KeyframeResolver=ni}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;nn(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}let nD=(e,t)=>t&&"number"==typeof e?t.transform(e):e,nM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nU=sI.length;function nL(e,t,r){let{style:s,vars:i,transformOrigin:n}=e,a=!1,o=!1;for(let e in t){let r=t[e];if(s$.has(e)){a=!0;continue}if(sK(e)){i[e]=r;continue}{let t=nD(r,i7[e]);e.startsWith("origin")?(o=!0,n[e]=t):s[e]=t}}if(!t.transform&&(a||r?s.transform=function(e,t,r){let s="",i=!0;for(let n=0;n<nU;n++){let a=sI[n],o=e[a];if(void 0===o)continue;let l=!0;if(!(l="number"==typeof o?o===+!!a.startsWith("scale"):0===parseFloat(o))||r){let e=nD(o,i7[a]);if(!l){i=!1;let t=nM[a]||a;s+=`${t}(${e}) `}r&&(t[a]=e)}}return s=s.trim(),r?s=r(t,i?"":s):i&&(s="none"),s}(t,e.transform,r):s.transform&&(s.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:r=0}=n;s.transformOrigin=`${e} ${t} ${r}`}}function nB(e,{style:t,vars:r},s,i){let n,a=e.style;for(n in t)a[n]=t[n];for(n in i?.applyProjectionStyles(a,s),r)a.setProperty(n,r[n])}function nV(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let nF={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!iu.test(e))return e;else e=parseFloat(e);let r=nV(e,t.target.x),s=nV(e,t.target.y);return`${r}% ${s}%`}},nz={borderRadius:{...nF,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:nF,borderTopRightRadius:nF,borderBottomLeftRadius:nF,borderBottomRightRadius:nF,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let s=i5.parse(e);if(s.length>5)return e;let i=i5.createTransformer(e),n=+("number"!=typeof s[0]),a=r.x.scale*t.x,o=r.y.scale*t.y;s[0+n]/=a,s[1+n]/=o;let l=sZ(a,o,.5);return"number"==typeof s[2+n]&&(s[2+n]/=l),"number"==typeof s[3+n]&&(s[3+n]/=l),i(s)}}};function nq(e,{layout:t,layoutId:r}){return s$.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!nz[e]||"opacity"===e)}function nW(e,t,r){let{style:s}=e,i={};for(let n in s)(nn(s[n])||t.style&&nn(t.style[n])||nq(n,e)||r?.getValue(n)?.liveStyle!==void 0)&&(i[n]=s[n]);return i}class nK extends nN{constructor(){super(...arguments),this.type="html",this.renderInstance=nB}readValueFromInstance(e,t){if(s$.has(t))return this.projection?.isProjecting?sF(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return sz(r,t)})(e,t);{let r=window.getComputedStyle(e),s=(sK(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof s?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return s7(e,t)}build(e,t,r){nL(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return nW(e,t,r)}}let nH=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),nG={offset:"stroke-dashoffset",array:"stroke-dasharray"},nJ={offset:"strokeDashoffset",array:"strokeDasharray"},nY=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function nX(e,{attrX:t,attrY:r,attrScale:s,pathLength:i,pathSpacing:n=1,pathOffset:a=0,...o}
39,l,u,h){if(nL(e,o,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:c,style:d}=e;for(let e of(c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=h?.transformBox??"fill-box",delete c.transformBox),nY))void 0!==c[e]&&(d[e]=c[e],delete c[e]);void 0!==t&&(c.x=t),void 0!==r&&(c.y=r),void 0!==s&&(c.scale=s),void 0!==i&&function(e,t,r=1,s=0,i=!0){e.pathLength=1;let n=i?nG:nJ;e[n.offset]=iu.transform(-s);let a=iu.transform(t),o=iu.transform(r);e[n.array]=`${a} ${o}`}(c,i,n,a,!1)}let nZ=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),nQ=e=>"string"==typeof e&&"svg"===e.toLowerCase();function n0(e,t,r){let s=nW(e,t,r);for(let r in e)(nn(e[r])||nn(t[r]))&&(s[-1!==sI.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]);return s}class n1 extends nN{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=nw}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(s$.has(t)){let e=nt(t);return e&&e.default||0}return t=nZ.has(t)?t:nH(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return n0(e,t,r)}build(e,t,r){nX(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,s){for(let r in nB(e,t,void 0,s),t.attrs)e.setAttribute(nZ.has(r)?r:nH(r),t.attrs[r])}mount(e){this.isSVGTag=nQ(e.tagName),super.mount(e)}}let n2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function n5(e){if("string"!=typeof e||e.includes("-"));else if(n2.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let n3=(0,R.createContext)({});e.s(["LayoutGroupContext",()=>n3],31178);let n4=(0,R.createContext)({strict:!1}),n8=(0,R.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});e.s(["MotionConfigContext",()=>n8],37806);let n6=(0,R.createContext)({});function n9(e){return Array.isArray(e)?e.join(" "):e}let n7=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ae(e,t,r){for(let s in t)nn(t[s])||nq(s,r)||(e[s]=t[s])}let at=()=>({...n7(),attrs:{}}),ar=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function as(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||ar.has(e)}let ai=e=>!as(e);try{y=e.r(34537).default,"function"==typeof y&&(ai=e=>e.startsWith("on")?!as(e):y(e))}catch{}let an=(0,R.createContext)(null);function aa(e){let t=(0,R.useRef)(null);return null===t.current&&(t.current=e()),t.current}function ao(e){return nn(e)?e.get():e}e.s(["PresenceContext",()=>an],21476),e.s(["useConstant",()=>aa],47414);let al=e=>(t,r)=>{let s=(0,R.useContext)(n6),i=(0,R.useContext)(an),n=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},r,s,i){return{latestValues:function(e,t,r,s){let i={},n=s(e,{});for(let e in n)i[e]=ao(n[e]);let{initial:a,animate:o}=e,l=nj(e),u=nR(e);t&&u&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let h=!!r&&!1===r.initial,c=(h=h||!1===a)?o:a;if(c&&"boolean"!=typeof c&&!nT(c)){let t=Array.isArray(c)?c:[c];for(let r=0;r<t.length;r++){let s=nC(e,t[r]);if(s){let{transitionEnd:e,transition:t,...r}=s;for(let e in r){let t=r[e];if(Array.isArray(t)){let e=h?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(r,s,i,e),renderState:t()}})(e,t,s,i);return r?n():aa(n)},au=al({scrapeMotionValuesFromProps:nW,createRenderState:n7}),ah=al({scrapeMotionValuesFromProps:n0,createRenderState:at}),ac=Symbol.for("motionComponentSymbol");function ad(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function ap(e,t){if("function"==typeof e)return e(t);ad(e)&&(e.current=t)}let af="data-"+nH("framerAppearId"),am=(0,R.createContext)({}),ag=n_?R.useLayoutEffect:R.useEffect;function ay(e,{forwardMotionProps:t=!1,type:r}={},s,i){s&&function(e){for(let t in e)ng[t]={...ng[t],...e[t]}}(s);let n=r?"svg"===r:n5(e),a=n?ah:au;function o(r,s){var o;let l,u,h={...(0,R.useContext)(n8),...r,layoutId:function({layoutId:e}){let t=(0,R.useContext)(n3).id;return t&&void 0!==e?t+"-"+e:e}(r)}
39,{isStatic:c}=h,d=function(e){let{initial:t,animate:r}=function(e,t){if(nj(e)){let{initial:t,animate:r}=e;return{initial:!1===t||nE(t)?t:void 0,animate:nE(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,R.useContext)(n6));return(0,R.useMemo)(()=>({initial:t,animate:r}),[n9(t),n9(r)])}(r),p=a(r,c);if(!c&&n_){(0,R.useContext)(n4).strict;let t=function(e){let{drag:t,layout:r}=ng;if(!t&&!r)return{};let s={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}(h);l=t.MeasureLayout,d.visualElement=function(e,t,r,s,i,n){let{visualElement:a}=(0,R.useContext)(n6),o=(0,R.useContext)(n4),l=(0,R.useContext)(an),u=(0,R.useContext)(n8).reducedMotion,h=(0,R.useRef)(null);s=s||o.renderer,!h.current&&s&&(h.current=s(e,{visualState:t,parent:a,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:u,isSVG:n}));let c=h.current,d=(0,R.useContext)(am);c&&!c.projection&&i&&("html"===c.type||"svg"===c.type)&&function(e,t,r,s){let{layoutId:i,layout:n,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u,layoutCrossfade:h}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:n,alwaysMeasureLayout:!!a||o&&ad(o),visualElement:e,animationType:"string"==typeof n?n:"both",initialPromotionConfig:s,crossfade:h,layoutScroll:l,layoutRoot:u})}(h.current,r,i,d);let p=(0,R.useRef)(!1);(0,R.useInsertionEffect)(()=>{c&&p.current&&c.update(r,l)});let f=r[af],m=(0,R.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return ag(()=>{c&&(p.current=!0,window.MotionIsMounted=!0,c.updateFeatures(),c.scheduleRenderMicrotask(),m.current&&c.animationState&&c.animationState.animateChanges())}),(0,R.useEffect)(()=>{c&&(!m.current&&c.animationState&&c.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),m.current=!1),c.enteringChildren=void 0)}),c}(e,p,h,i,t.ProjectionNode,n)}return(0,j.jsxs)(n6.Provider,{value:d,children:[l&&d.visualElement?(0,j.jsx)(l,{visualElement:d.visualElement,...h}):null,function(e,t,r,{latestValues:s},i,n=!1,a){let o=(a??n5(e)?function(e,t,r,s){let i=(0,R.useMemo)(()=>{let r=at();return nX(r,t,nQ(s),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){let t={};ae(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let r,s,i={},n=(r=e.style||{},ae(s={},r,e),Object.assign(s,function({transformTemplate:e},t){return(0,R.useMemo)(()=>{let r=n7();return nL(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),s);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=n,i})(t,s,i,e),l=function(e,t,r){let s={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(ai(i)||!0===r&&as(i)||!t&&!as(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}(t,"string"==typeof e,n),u=e!==R.Fragment?{...l,...o,ref:r}:{},{children:h}=t,c=(0,R.useMemo)(()=>nn(h)?h.get():h,[h]);return(0,R.createElement)(e,{...u,children:c})}(e,r,(o=d.visualElement,u=(0,R.useRef)(null),(0,R.useCallback)(e=>{if(e&&p.onMount&&p.onMount(e),o&&(e?o.mount(e):o.unmount()),s)if(e){let t=ap(s,e);"function"==typeof t&&(u.current=t)}else u.current?(u.current(),u.current=null):ap(s,e)},[o,p,s])),p,c,t,n)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,R.forwardRef)(o);return l[ac]=e,l}function av(e,t,r){let s=e.getProps();return nC(s,t,void 0!==r?r:s.custom,e)}function ab(e,t){return e?.[t]??e?.default??e}e.s(["useIsomorphicLayoutEffect",()=>ag],74008);let aw=e=>Array.isArray(e);function a_(e,t){let r=e.getValue("willChange");if(nn(r)&&r.add)return r.add(t);if(!r&&iT.WillChange){let r=new iT.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function ak(e){e.duration=0,e.type="keyframes"}let ax=(e,t)=>r=>
39t(e(r)),aS=(...e)=>e.reduce(ax),aT=e=>1e3*e,aE={layout:0,mainThread:0,waapi:0};function aP(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function aA(e,t){return r=>r>0?t:e}let aj=(e,t,r)=>{let s=e*e,i=r*(t*t-s)+s;return i<0?0:Math.sqrt(i)},aR=[iK,iW,iH];function aO(e){let t=aR.find(t=>t.test(e));if(iy(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===iH&&(r=function({hue:e,saturation:t,lightness:r,alpha:s}){e/=360,r/=100;let i=0,n=0,a=0;if(t/=100){let s=r<.5?r*(1+t):r+t-r*t,o=2*r-s;i=aP(o,s,e+1/3),n=aP(o,s,e),a=aP(o,s,e-1/3)}else i=n=a=r;return{red:Math.round(255*i),green:Math.round(255*n),blue:Math.round(255*a),alpha:s}}(r)),r}let aC=(e,t)=>{let r=aO(e),s=aO(t);if(!r||!s)return aA(e,t);let i={...r};return e=>(i.red=aj(r.red,s.red,e),i.green=aj(r.green,s.green,e),i.blue=aj(r.blue,s.blue,e),i.alpha=sZ(r.alpha,s.alpha,e),iW.transform(i))},aI=new Set(["none","hidden"]);function a$(e,t){return r=>sZ(e,t,r)}function aN(e){return"number"==typeof e?a$:"string"==typeof e?sG(e)?aA:iG.test(e)?aC:aU:Array.isArray(e)?aD:"object"==typeof e?iG.test(e)?aC:aM:aA}function aD(e,t){let r=[...e],s=r.length,i=e.map((e,r)=>aN(e)(e,t[r]));return e=>{for(let t=0;t<s;t++)r[t]=i[t](e);return r}}function aM(e,t){let r={...e,...t},s={};for(let i in r)void 0!==e[i]&&void 0!==t[i]&&(s[i]=aN(e[i])(e[i],t[i]));return e=>{for(let t in s)r[t]=s[t](e);return r}}let aU=(e,t)=>{let r=i5.createTransformer(t),s=iQ(e),i=iQ(t);if(!(s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length))return iy(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),aA(e,t);if(aI.has(e)&&!i.values.length||aI.has(t)&&!s.values.length)return aI.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return aS(aD(function(e,t){let r=[],s={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let n=t.types[i],a=e.indexes[n][s[n]],o=e.values[a]??0;r[i]=o,s[n]++}return r}(s,i),i.values),r)};function aL(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?sZ(e,t,r):aN(e)(e,t)}let aB=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>iA.update(t,e),stop:()=>ij(t),now:()=>iR.isProcessing?iR.timestamp:no.now()}},aV=(e,t,r=10)=>{let s="",i=Math.max(Math.round(t/r),2);for(let t=0;t<i;t++)s+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${s.substring(0,s.length-2)})`};function aF(e){let t=0,r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}function az(e,t,r){var s,i;let n=Math.max(t-5,0);return s=r-e(n),(i=t-n)?1e3/i*s:0}let aq=.01,aW=2,aK=.005,aH=.5;function aG(e,t){return e*Math.sqrt(1-t*t)}let aJ=["duration","bounce"],aY=["stiffness","damping","mass"];function aX(e,t){return t.some(t=>void 0!==e[t])}function aZ(e=.3,t=.3){let r,s="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:i,restDelta:n}=s,a=s.keyframes[0],o=s.keyframes[s.keyframes.length-1],l={done:!1,value:a},{stiffness:u,damping:h,mass:c,duration:d,velocity:p,isResolvedFromDuration:f}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!aX(e,aY)&&aX(e,aJ))if(e.visualDuration){let r=2*Math.PI/(1.2*e.visualDuration),s=r*r,i=2*it(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:1,stiffness:s,damping:i}}else{let r=function({duration:e=800,bounce:t=.3,velocity:r=0,mass:s=1}){let i,n;iy(e<=aT(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=it(.05,1,a),e=it(.01,10,e/1e3),a<1?(i=t=>{let s=t*a,i=s*e;return .001-(s-r)/aG(t,a)*Math.exp(-i)},n=t=>{let s=t*a*e,n=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-s),l=aG(Math.pow(t,2),a);return(s*r+r-n)*o*(-i(t)+.001>0?-1:1)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),n=t=>e*e*(r-t)*Math.exp(-t*e));let o=function(e,t,r){let s=r;for(let r=1;r<12;r++)s-=e(s)/t(s);return s}(i,n,5/e);if(e=aT(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*s;
39return{stiffness:t,damping:2*a*Math.sqrt(s*t),duration:e}}}(e);(t={...t,...r,mass:1}).isResolvedFromDuration=!0}return t}({...s,velocity:-((s.velocity||0)/1e3)}),m=p||0,g=h/(2*Math.sqrt(u*c)),y=o-a,v=Math.sqrt(u/c)/1e3,b=5>Math.abs(y);if(i||(i=b?aq:aW),n||(n=b?aK:aH),g<1){let e=aG(v,g);r=t=>o-Math.exp(-g*v*t)*((m+g*v*y)/e*Math.sin(e*t)+y*Math.cos(e*t))}else if(1===g)r=e=>o-Math.exp(-v*e)*(y+(m+v*y)*e);else{let e=v*Math.sqrt(g*g-1);r=t=>{let r=Math.exp(-g*v*t),s=Math.min(e*t,300);return o-r*((m+g*v*y)*Math.sinh(s)+e*y*Math.cosh(s))/e}}let w={calculatedDuration:f&&d||null,next:e=>{let t=r(e);if(f)l.done=e>=d;else{let s=0===e?m:0;g<1&&(s=0===e?aT(m):az(r,e,t));let a=Math.abs(o-t)<=n;l.done=Math.abs(s)<=i&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(aF(w),2e4),t=aV(t=>w.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return w}function aQ({keyframes:e,velocity:t=0,power:r=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:n=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:h}){let c,d,p=e[0],f={done:!1,value:p},m=r*t,g=p+m,y=void 0===a?g:a(g);y!==g&&(m=y-p);let v=e=>-m*Math.exp(-e/s),b=e=>y+v(e),w=e=>{let t=v(e),r=b(e);f.done=Math.abs(t)<=u,f.value=f.done?y:r},_=e=>{let t;if(t=f.value,void 0!==o&&t<o||void 0!==l&&t>l){var r;c=e,d=aZ({keyframes:[f.value,(r=f.value,void 0===o?l:void 0===l||Math.abs(o-r)<Math.abs(l-r)?o:l)],velocity:az(b,e,f.value),damping:i,stiffness:n,restDelta:u,restSpeed:h})}};return _(0),{calculatedDuration:null,next:e=>{let t=!1;return(d||void 0!==c||(t=!0,w(e),_(e)),void 0!==c&&e>=c)?d.next(e-c):(t||w(e),f)}}}aZ.applyToOptions=e=>{let t=function(e,t=100,r){let s=r({...e,keyframes:[0,t]}),i=Math.min(aF(s),2e4);return{type:"keyframes",ease:e=>s.next(i*e).value/t,duration:i/1e3}}(e,100,aZ);return e.ease=t.ease,e.duration=aT(t.duration),e.type="keyframes",e};let a0=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function a1(e,t,r,s){return e===t&&r===s?iS:i=>0===i||1===i?i:a0(function(e,t,r,s,i){let n,a,o=0;do(n=a0(a=t+(r-t)/2,s,i)-e)>0?r=a:t=a;while(Math.abs(n)>1e-7&&++o<12)return a}(i,0,1,e,r),t,s)}let a2=a1(.42,0,1,1),a5=a1(0,0,.58,1),a3=a1(.42,0,.58,1),a4=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,a8=e=>t=>1-e(1-t),a6=a1(.33,1.53,.69,.99),a9=a8(a6),a7=a4(a9),oe=e=>(e*=2)<1?.5*a9(e):.5*(2-Math.pow(2,-10*(e-1))),ot=e=>1-Math.sin(Math.acos(e)),or=a8(ot),os=a4(ot),oi=e=>Array.isArray(e)&&"number"==typeof e[0],on={linear:iS,easeIn:a2,easeInOut:a3,easeOut:a5,circIn:ot,circInOut:os,circOut:or,backIn:a9,backInOut:a7,backOut:a6,anticipate:oe},oa=e=>{if(oi(e)){iv(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,r,s,i]=e;return a1(t,r,s,i)}return"string"==typeof e?(iv(void 0!==on[e],`Invalid easing type '${e}'`,"invalid-easing-type"),on[e]):e},oo=(e,t,r)=>{let s=t-e;return 0===s?1:(r-e)/s};function ol({duration:e=300,keyframes:t,times:r,ease:s="easeInOut"}){var i;let n,a=Array.isArray(s)&&"number"!=typeof s[0]?s.map(oa):oa(s),o={done:!1,value:t[0]},l=function(e,t,{clamp:r=!0,ease:s,mixer:i}={}){let n=e.length;if(iv(n===t.length,"Both input and output ranges must be the same length","range-length"),1===n)return()=>t[0];if(2===n&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[n-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,r){let s=[],i=r||iT.mix||aL,n=e.length-1;for(let r=0;r<n;r++){let n=i(e[r],e[r+1]);t&&(n=aS(Array.isArray(t)?t[r]||iS:t,n)),s.push(n)}return s}(t,s,i),l=o.length,u=r=>{if(a&&r<e[0])return t[0];let s=0;if(l>1)for(;s<e.length-2&&!(r<e[s+1]);s++);let i=oo(e[s],e[s+1],r);return o[s](i)};return r?t=>u(it(e[0],e[n-1],t)):u}((i=r&&r.length===t.length?r:(!function(e,t){let r=e[e.length-1];for(let s=1;s<=t;s++){let i=oo(0,t,s);e.push(sZ(r,1,i))}}(n=[0],t.length-1),n),i.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||a3).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let ou=e=>null!==e;function oh(e,{repeat:t,repeatType:r="loop"},s,i=1){let n=e.filter(ou),a=i<0||t&&"loop"!==r&&t%2==1?0:n.length-1;return a&&void 0!==s?s:n[a]}let oc={decay:aQ,inertia:aQ,tween:ol,keyframes:ol,spring:aZ};function od(e){"string"==typeof e.type&&(e.type=oc[e.type])}class op{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let of=e=>e/100;class om extends op{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==no.now()&&this.tick(no.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},aE.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;od(e);let{type:t=ol,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:n=0}=e,{keyframes:a}=e,o=t||ol;o!==ol&&"number"!=typeof a[0]&&(this.mixKeyframes=aS(of,aL(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===i&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-n})),null===l.calculatedDuration&&(l.calculatedDuration=aF(l));let{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:n,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return r.next(0);let{delay:l=0,keyframes:u,repeat:h,repeatType:c,repeatDelay:d,type:p,onUpdate:f,finalKeyframe:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?g<0:g>s;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=s);let v=this.currentTime,b=r;if(h){let e=Math.min(this.currentTime,s)/a,t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,(t=Math.min(t,h+1))%2&&("reverse"===c?(r=1-r,d&&(r-=d/a)):"mirror"===c&&(b=n)),v=it(0,1,r)*a}let w=y?{done:!1,value:u[0]}:b.next(v);
39i&&(w.value=i(w.value));let{done:_}=w;y||null===o||(_=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);let k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return k&&p!==aQ&&(w.value=oh(u,this.options,m,this.speed)),f&&f(w.value),k&&this.finish(),w}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=aT(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(no.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=aB,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(no.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,aE.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function og(e){let t;return()=>(void 0===t&&(t=e()),t)}let oy=og(()=>void 0!==window.ScrollTimeline),ov={},ob=(n=og(()=>{try{document.createElement("div").animate({opacity:0}
39,{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>ov.linearEasing??n()),ow=([e,t,r,s])=>`cubic-bezier(${e}, ${t}, ${r}, ${s})`,o_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ow([0,.65,.55,1]),circOut:ow([.55,0,1,.45]),backIn:ow([.31,.01,.66,-.59]),backOut:ow([.33,1.53,.69,.99])};function ok(e){return"function"==typeof e&&"applyToOptions"in e}class ox extends op{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:s,pseudoElement:i,allowFlatten:n=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!i,this.allowFlatten=n,this.options=e,iv("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return ok(e)&&ob()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,r,{delay:s=0,duration:i=300,repeat:n=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u){let h={[t]:r};l&&(h.offset=l);let c=function e(t,r){if(t)return"function"==typeof t?ob()?aV(t,r):"ease-out":oi(t)?ow(t):Array.isArray(t)?t.map(t=>e(t,r)||o_.easeOut):o_[t]}(o,i);Array.isArray(c)&&(h.easing=c);let d={delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:n+1,direction:"reverse"===a?"alternate":"normal"};u&&(d.pseudoElement=u);let p=e.animate(h,d);return p}(t,r,s,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=oh(s,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):r.startsWith("--")?t.style.setProperty(r,e):t.style[r]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=aT(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&oy())?(this.animation.timeline=e,iS):t(this)}}let oS={anticipate:oe,backInOut:a7,circInOut:os};class oT extends ox{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in oS&&(e.ease=oS[e.ease])}(e),od(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:r,onComplete:s,element:i,...n}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new om({...n,autoplay:!1}),o=Math.max(10,no.now()-this.startTime),l=it(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let oE=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(i5.test(e)||"0"===e)&&!e.startsWith("url(")),oP=new Set(["opacity","clipPath","filter","transform"]),oA=og(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class oj extends op{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:n="loop",keyframes:a,name:o,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=no.now();const c={autoplay:e,delay:t,type:r,repeat:s,repeatDelay:i,repeatType:n,name:o,motionValue:l,element:u,...h},d=u?.KeyframeResolver||iU;this.keyframeResolver=new d(a,(e,t,r)=>this.onKeyframesResolved(e,t,c,!r),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,s){this.keyframeResolver=void 0;let{name:i,type:n,velocity:a,delay:o,isHandoff:l,onUpdate:u}=r;this.resolvedAt=no.now(),!function(e,t,r,s){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let n=e[e.length-1],a=oE(i,t),o=oE(n,t);return iy(a===o,`You are trying to animate ${t} from "${i}" to "${n}". "${a?n:i}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||ok(r))&&s)}(e,i,n,a)&&((iT.instantAnimations||!o)&&u?.(oh(e,r,t)),e[0]=e[e.length-1],ak(r),r.repeat=0);let h={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},c=!l&&function(e){let{motionValue:t,name:r,repeatDelay:s,repeatType:i,damping:n,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;
39let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return oA()&&r&&oP.has(r)&&("transform"!==r||!l)&&!o&&!s&&"mirror"!==i&&0!==n&&"inertia"!==a}(h)?new oT({...h,element:h.motionValue.owner.current}):new om(h);c.finished.then(()=>this.notifyFinished()).catch(iS),this.pendingTimeline&&(this.stopTimeline=c.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=c}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),iN=!0,iM(),iD(),iN=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let oR=e=>null!==e,oO={type:"spring",stiffness:500,damping:25,restSpeed:10},oC={type:"keyframes",duration:.8},oI={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},o$=(e,t,r,s={},i,n)=>a=>{let o=ab(s,e)||{},l=o.delay||s.delay||0,{elapsed:u=0}=s;u-=aT(l);let h={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:n?void 0:i};!function({when:e,delay:t,delayChildren:r,staggerChildren:s,staggerDirection:i,repeat:n,repeatType:a,repeatDelay:o,from:l,elapsed:u,...h}){return!!Object.keys(h).length}(o)&&Object.assign(h,((e,{keyframes:t})=>t.length>2?oC:s$.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:oO:oI)(e,h)),h.duration&&(h.duration=aT(h.duration)),h.repeatDelay&&(h.repeatDelay=aT(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let c=!1;if(!1!==h.type&&(0!==h.duration||h.repeatDelay)||(ak(h),0===h.delay&&(c=!0)),(iT.instantAnimations||iT.skipAnimations)&&(c=!0,ak(h),h.delay=0),h.allowFlatten=!o.type&&!o.ease,c&&!n&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:r="loop"},s){let i=e.filter(oR),n=t&&"loop"!==r&&t%2==1?0:i.length-1;return i[n]}(h.keyframes,o);if(void 0!==e)return void iA.update(()=>{h.onUpdate(e),h.onComplete()})}return o.isSync?new om(h):new oj(h)};function oN(e,t,{delay:r=0,transitionOverride:s,type:i}={}){let{transition:n=e.getDefaultTransition(),transitionEnd:a,...o}=t;s&&(n=s);let l=[],u=i&&e.animationState&&e.animationState.getState()[i];for(let t in o){let s=e.getValue(t,e.latestValues[t]??null),i=o[t];if(void 0===i||u&&function({protectedKeys:e,needsAnimating:t},r){let s=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,s}(u,t))continue;let a={delay:r,...ab(n||{},t)},h=s.get();if(void 0!==h&&!s.isAnimating&&!Array.isArray(i)&&i===h&&!a.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){let r=e.props[af];if(r){let e=window.MotionHandoffAnimation(r,t,iA);null!==e&&(a.startTime=e,c=!0)}}a_(e,t),s.start(o$(t,s,i,e.shouldReduceMotion&&ie.has(t)?{type:!1}:a,e,c));let d=s.animation;d&&l.push(d)}return a&&Promise.all(l).then(()=>{iA.update(()=>{a&&function(e,t){let{transitionEnd:r={},transition:s={},...i}=av(e,t)||{};for(let t in i={...i,...r}){var n;let r=aw(n=i[t])?n[n.length-1]||0:n;e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,nd(r))}}(e,a)})}),l}function oD(e,t,r,s=0,i=1){let n=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*s;return"function"==typeof r?r(n,a):1===i?n*s:o-n*s}function oM(e,t,r={}){let s=av(e,t,"exit"===r.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=s||{};r.transitionOverride&&(i=r.transitionOverride);let n=s?()=>Promise.all(oN(e,s,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(s=0)=>{let{delayChildren:n=0,staggerChildren:a,staggerDirection:o}=i;return function(e,t,r=0,s=0,i=0,n=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(oM(l,t,{...a,delay:r+("function"==typeof s?0:s)+oD(e.variantChildren,l,s,i,n)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,s,n,a,o,r)}:()=>Promise.resolve(),{when:o}=i;if(!o)return Promise.all([n(),a(r.delay)]);{let[e,t]="beforeChildren"===o?[n,a]:[a,n];return e().then(()=>t())}}function oU(e,t){if(!Array.isArray(t))return!1;let r=t.length;if(r!==e.length)return!1;for(let s=0;s<r;s++)if(t[s]!==e[s])return!1;return!0}let oL=nA.length,oB=[...nP].reverse(),oV=nP.length;function oF(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function oz(){return{animate:oF(!0),whileInView:oF(),whileHover:oF(),whileTap:oF(),whileDrag:oF(),whileFocus:oF(),exit:oF()}}class oq{constructor(e){this.isMounted=!1,this.node=e}update(){}}let oW=0,oK=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function oH(e){return oK.has(e.tagName)||!0===e.isContentEditable}let oG={x:!1,y:!1};function oJ(e,t,r,s={passive:!0}){return e.addEventListener(t,r,s),()=>e.removeEventListener(t,r)}let oY=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function oX(e){return{point:{x:e.pageX,y:e.pageY}}}function oZ(e,t,r,s){return oJ(e,t,e=>oY(e)&&r(e,oX(e)),s)}function oQ(e){return e.max-e.min}function o0(e,t,r,s=.5){e.origin=s,e.originPoint=sZ(t.min,t.max,e.origin),e.scale=oQ(r)/oQ(t),e.translate=sZ(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function o1(e,t,r,s){o0(e.x,t.x,r.x,s?s.originX:void 0),o0(e.y,t.y,r.y,s?s.originY:void 0)}function o2(e,t,r){e.min=r.min+t.min,e.max=e.min+oQ(t)}function o5(e,t,r){e.min=t.min-r.min,e.max=e.min+oQ(t)}function o3(e,t,r){o5(e.x,t.x,r.x),o5(e.y,t.y,r.y)}function o4(e){return[e("x"),e("y")]}let o8=({current:e})=>e?e.ownerDocument.defaultView:null,o6=(e,t)=>Math.abs(e-t);class o9{constructor(e,t,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:n=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=lt(this.lastMoveEventInfo,this.history),s=null!==this.startEvent,i=(e=r.offset,t={x:0,y:0},Math.sqrt(o6(e.x,t.x)**2+o6(e.y,t.y)**2)>=this.distanceThreshold);if(!s&&!i)return;let{point:n}=r,{timestamp:a}=iR;this.history.push({...n,timestamp:a});
39let{onStart:o,onMove:l}=this.handlers;s||(o&&o(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,r)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=o7(t,this.transformPagePoint),iA.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:r,onSessionEnd:s,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let n=lt("pointercancel"===e.type?this.lastMoveEventInfo:o7(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,n),s&&s(e,n)},!oY(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=n,this.contextWindow=s||window;const a=o7(oX(e),this.transformPagePoint),{point:o}=a,{timestamp:l}=iR;this.history=[{...o,timestamp:l}];const{onSessionStart:u}=t;u&&u(e,lt(a,this.history)),this.removeListeners=aS(oZ(this.contextWindow,"pointermove",this.handlePointerMove),oZ(this.contextWindow,"pointerup",this.handlePointerUp),oZ(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),ij(this.updatePoint)}}function o7(e,t){return t?{point:t(e.point)}:e}function le(e,t){return{x:e.x-t.x,y:e.y-t.y}}function lt({point:e},t){return{point:e,delta:le(e,lr(t)),offset:le(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,s=null,i=lr(e);for(;r>=0&&(s=e[r],!(i.timestamp-s.timestamp>aT(.1)));)r--;if(!s)return{x:0,y:0};let n=(i.timestamp-s.timestamp)/1e3;if(0===n)return{x:0,y:0};let a={x:(i.x-s.x)/n,y:(i.y-s.y)/n};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function lr(e){return e[e.length-1]}function ls(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function li(e,t){let r=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,s]=[s,r]),{min:r,max:s}}function ln(e,t,r){return{min:la(e,t),max:la(e,r)}}function la(e,t){return"number"==typeof e?e:e[t]||0}let lo=new WeakMap;class ll{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=nw(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){let{presenceContext:s}=this.visualElement;if(s&&!1===s.isPresent)return;let i=e=>{t?(this.stopAnimation(),this.snapToCursor(oX(e).point)):this.pauseAnimation()},n=(e,t)=>{this.stopAnimation();let{drag:r,dragPropagation:s,onDragStart:i}=this.getProps();if(r&&!s&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(oG[e])return null;else return oG[e]=!0,()=>{oG[e]=!1};return oG.x||oG.y?null:(oG.x=oG.y=!0,()=>{oG.x=oG.y=!1})}(r),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),o4(e=>{let t=this.getAxisMotionValue(e).get()||0;if(il.test(t)){let{projection:r}=this.visualElement;if(r&&r.layout){let s=r.layout.layoutBox[e];s&&(t=oQ(s)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&iA.postRender(()=>i(e,t)),a_(this.visualElement,"transform");let{animationState:n}=this.visualElement;n&&n.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:r,dragDirectionLock:s,onDirectionLock:i,onDrag:n}=this.getProps();if(!r&&!this.openDragLock)return;let{offset:a}=t;if(s&&null===this.currentDirection){this.currentDirection=function(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}(a),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),n&&n(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>
39o4(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:u}=this.getProps();this.panSession=new o9(e,{onSessionStart:i,onStart:n,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:o8(this.visualElement)})}stop(e,t){let r=e||this.latestPointerEvent,s=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;let{velocity:n}=s;this.startAnimation(n);let{onDragEnd:a}=this.getProps();a&&iA.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){let{drag:s}=this.getProps();if(!r||!lu(e,s,this.currentDirection))return;let i=this.getAxisMotionValue(e),n=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(n=function(e,{min:t,max:r},s){return void 0!==t&&e<t?e=s?sZ(t,e,s.min):Math.max(e,t):void 0!==r&&e>r&&(e=s?sZ(r,e,s.max):Math.min(e,r)),e}(n,this.constraints[e],this.elastic[e])),i.set(n)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&ad(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=function(e,{top:t,left:r,bottom:s,right:i}){return{x:ls(e.x,r,i),y:ls(e.y,t,s)}}(r.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:ln(e,"left","right"),y:ln(e,"top","bottom")}}(t),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&o4(e=>{var t,s;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],s=this.constraints[e],i={},void 0!==s.min&&(i.min=s.min-t.min),void 0!==s.max&&(i.max=s.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!ad(t))return!1;let s=t.current;iv(null!==s,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let n=function(e,t,r){let s=s7(e,r),{scroll:i}=t;return i&&(s8(s.x,i.offset.x),s8(s.y,i.offset.y)),s}(s,i.root,this.visualElement.getTransformPagePoint()),a=(e=i.layout.layoutBox,{x:li(e.x,n.x),y:li(e.y,n.y)});if(r){let e=r(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=sX(e))}return a}startAnimation(e){let{drag:t,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:n,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(o4(a=>{if(!lu(a,t,this.currentDirection))return;let l=o&&o[a]||{};n&&(l={min:0,max:0});let u={type:"inertia",velocity:r?e[a]:0,bounceStiffness:s?200:1e6,bounceDamping:s?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(a,u)})).then(a)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return a_(this.visualElement,e),r.start(o$(e,r,0,t,this.visualElement,!1))}stopAnimation(){o4(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){o4(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps();return r[t]||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){o4(t=>{let{drag:r}=this.getProps();if(!lu(t,r,this.currentDirection))return;let{projection:s}=this.visualElement,i=this.getAxisMotionValue(t);if(s&&s.layout){let{min:r,max:n}=s.layout.layoutBox[t],a=i.get()||0;i.set(e[t]-sZ(r,n,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!ad(t)||!r||!this.constraints)return;this.stopAnimation();let s={x:0,y:0};o4(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var r,i;let n,a,o,l=t.get();s[e]=(r={min:l,max:l},i=this.constraints[e],n=.5,a=oQ(r),(o=oQ(i))>a?n=oo(i.min,i.max-a,r.min):a>o&&(n=oo(r.min,r.max-o,i.min)),it(0,1,n))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),o4(t=>{if(!lu(t,e,null))return;let r=this.getAxisMotionValue(t),{min:i,max:n}=this.constraints[t];r.set(sZ(i,n,s[t]))})}addListeners(){if(!this.visualElement.current)return;lo.set(this.visualElement,this);let e=oZ(this.visualElement.current,"pointerdown",e=>{let{drag:t,dragListener:r=!0}=this.getProps();t&&r&&!oH(e.target)&&this.start(e)}),t=()=>{let{dragConstraints:e}=this.getProps();ad(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",t);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),iA.read(t);let i=oJ(window,"resize",()=>this.scalePositionWithinConstraints()),n=r.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(o4(t=>{let r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),e(),s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:n=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:n,dragMomentum:a}}}function lu(e,t,r){return(!0===t||t===e)&&(null===r||r===e)}let lh=e=>(t,r)=>{e&&iA.postRender(()=>e(t,r))};var lc=R;function ld(e=!0){let t=(0,R.useContext)(an);if(null===t)return[!0,null];let{isPresent:r,onExitComplete:s,register:i}=t,n=(0,R.useId)();(0,R.useEffect)(()=>
39{if(e)return i(n)},[e]);let a=(0,R.useCallback)(()=>e&&s&&s(n),[n,s,e]);return!r&&s?[!1,a]:[!0]}e.s(["usePresence",()=>ld],64978);let lp={hasAnimatedSinceResize:!0,hasEverUpdated:!1},lf=!1;class lm extends lc.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),r&&r.register&&s&&r.register(i),lf&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),lp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:r,drag:s,isPresent:i}=this.props,{projection:n}=r;return n&&(n.isPresent=i,lf=!0,s||e.layoutDependency!==t||void 0===t||e.isPresent!==i?n.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?n.promote():n.relegate()||iA.postRender(()=>{let e=n.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),nf.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;lf=!0,s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function lg(e){let[t,r]=ld(),s=(0,lc.useContext)(n3);return(0,j.jsx)(lm,{...e,layoutGroup:s,switchLayoutGroup:(0,lc.useContext)(am),isPresent:t,safeToRemove:r})}function ly(e){return"object"==typeof e&&null!==e}function lv(e){return ly(e)&&"ownerSVGElement"in e}let lb=(e,t)=>e.depth-t.depth;class lw{constructor(){this.children=[],this.isDirty=!1}add(e){nl(this.children,e),this.isDirty=!0}remove(e){nu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(lb),this.isDirty=!1,this.children.forEach(e)}}let l_=["TopLeft","TopRight","BottomLeft","BottomRight"],lk=l_.length,lx=e=>"string"==typeof e?parseFloat(e):e,lS=e=>"number"==typeof e||iu.test(e);function lT(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let lE=lA(0,.5,or),lP=lA(.5,.95,iS);function lA(e,t,r){return s=>s<e?0:s>t?1:r(oo(e,t,s))}function lj(e,t){e.min=t.min,e.max=t.max}function lR(e,t){lj(e.x,t.x),lj(e.y,t.y)}function lO(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function lC(e,t,r,s,i){return e-=t,e=s+1/r*(e-s),void 0!==i&&(e=s+1/i*(e-s)),e}function lI(e,t,[r,s,i],n,a){!function(e,t=0,r=1,s=.5,i,n=e,a=e){if(il.test(t)&&(t=parseFloat(t),t=sZ(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=sZ(n.min,n.max,s);e===n&&(o-=t),e.min=lC(e.min,t,r,o,i),e.max=lC(e.max,t,r,o,i)}(e,t[r],t[s],t[i],t.scale,n,a)}let l$=["x","scaleX","originX"],lN=["y","scaleY","originY"];function lD(e,t,r,s){lI(e.x,t,l$,r?r.x:void 0,s?s.x:void 0),lI(e.y,t,lN,r?r.y:void 0,s?s.y:void 0)}function lM(e){return 0===e.translate&&1===e.scale}function lU(e){return lM(e.x)&&lM(e.y)}function lL(e,t){return e.min===t.min&&e.max===t.max}function lB(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function lV(e,t){return lB(e.x,t.x)&&lB(e.y,t.y)}function lF(e){return oQ(e.x)/oQ(e.y)}function lz(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class lq{constructor(){this.members=[]}add(e){nl(this.members,e),e.scheduleRender()}remove(e){if(nu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,r=this.members.findIndex(t=>e===t);if(0===r)return!1;for(let e=r;e>=0;e--){let r=this.members[e];if(!1!==r.isPresent){t=r;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:s}=e.options;!1===s&&r.hide()}}
39exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let lW=["","X","Y","Z"],lK=0;function lH(e,t,r,s){let{latestValues:i}=t;i[e]&&(r[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function lG({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(e={},r=t?.()){this.id=lK++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(lX),this.nodes.forEach(l3),this.nodes.forEach(l4),this.nodes.forEach(lZ)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new lw)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new nh),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=lv(t)&&!(lv(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:r,layout:s,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||r)&&(this.isLayoutDirty=!0),e){let r,s=0,i=()=>this.root.updateBlockedByResize=!1;iA.read(()=>{s=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==s){let t,n;s=e,this.root.updateBlockedByResize=!0,r&&r(),t=no.now(),n=({timestamp:e})=>{let r=e-t;r>=250&&(ij(n),i(r-250))},iA.setup(n,!0),r=()=>ij(n),lp.hasAnimatedSinceResize&&(lp.hasAnimatedSinceResize=!1,this.nodes.forEach(l5))}})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&i&&(r||s)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:s})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let n=this.options.transition||i.getDefaultTransition()||ut,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=i.getProps(),l=!this.targetLayout||!lV(this.targetLayout,s),u=!t&&r;if(this.options.layoutRoot||this.resumeFrom||u||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...ab(n,"layout"),onPlay:a,onComplete:o};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u)}else t||l5(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=s})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ij(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEac
39h(l8),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:r}=t.options;if(!r)return;let s=r.props[af];if(window.MotionHasOptimisedAnimation(s,"transform")){let{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",iA,!(e||r))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;let s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(l0);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(l1);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(l2),this.nodes.forEach(lJ),this.nodes.forEach(lY)):this.nodes.forEach(l1),this.clearAllSnapshots();let e=no.now();iR.delta=it(0,1e3/60,e-iR.timestamp),iR.timestamp=e,iR.isProcessing=!0,iO.update.process(iR),iO.preRender.process(iR),iO.render.process(iR),iR.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,nf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(lQ),this.sharedNodes.forEach(l6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,iA.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){iA.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||oQ(this.snapshot.measuredBox.x)||oQ(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=nw(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=s(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!lU(this.projectionDelta),r=this.getTransformTemplate(),s=r?r(this.latestValues,""):void 0,n=s!==this.prevTransformTemplateValue;e&&this.instance&&(t||s1(this.latestValues)||n)&&(i(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let r=this.measurePageBox(),s=this.removeElementScroll(r);return e&&(s=this.removeTransform(s)),ui((t=s).x),ui(t.y),{animationId:this.root.animationId,measuredBox:r,layoutBox:s,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return nw();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(ua))){let{scroll:e}=this.root;e&&(s8(t.x,e.offset.x),s8(t.y,e.offset.y))}return t}removeElementScroll(e){let t=nw();if(lR(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){let s=this.path[r],{scroll:i,options:n}=s;s!==this.root&&i&&n.layoutScroll&&(i.wasRoot&&lR(t,e),s8(t.x,i.offset.x),s8(t.y,i.offset.y))}return t}applyTransform(e,t=!1){let r=nw();lR(r,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];!t&&s.options.layoutScroll&&s.scroll&&s!==s.root&&s9(r,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),s1(s.latestValues)&&s9(r,s.latestValues)}return s1(this.latestValues)&&s9(r,this.latestValues),r}removeTransform(e){let t=nw();lR(t,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];if(!r.instance||!s1(r.latestValues))continue;s0(r.latestValues)&&r.updateSnapshot();let s=nw();lR(s,r.measurePageBox()),lD(t,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,s)}return s1(this.latestValues)&&lD(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==iR.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.
39isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let r=!!this.resumingFrom||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:s,layoutId:i}=this.options;if(!this.layout||!(s||i))return;this.resolvedRelativeTargetAt=iR.timestamp;let n=this.getClosestProjectingParent();if(n&&this.linkedParentVersion!==n.layoutVersion&&!n.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(n&&n.layout?this.createRelativeTarget(n,this.layout.layoutBox,n.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=nw(),this.targetWithTransforms=nw()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,o2(a.x,o.x,l.x),o2(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):lR(this.target,this.layout.layoutBox),s4(this.target,this.targetDelta)):lR(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,n&&!!n.resumingFrom==!!this.resumingFrom&&!n.options.layoutScroll&&n.target&&1!==this.animationProgress?this.createRelativeTarget(n,this.target,n.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||s0(this.parent.latestValues)||s2(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=nw(),this.relativeTargetOrigin=nw(),o3(this.relativeTargetOrigin,t,r),lR(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===iR.timestamp&&(r=!1),r)return;let{layout:s,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(s||i))return;lR(this.layoutCorrected,this.layout.layoutBox);let n=this.treeScale.x,a=this.treeScale.y;!function(e,t,r,s=!1){let i,n,a=r.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){n=(i=r[o]).projectionDelta;let{visualElement:a}=i.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&s9(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),n&&(t.x*=n.x.scale,t.y*=n.y.scale,s4(e,n)),s&&s1(i.latestValues)&&s9(e,i.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=nw());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(lO(this.prevProjectionDelta.x,this.projectionDelta.x),lO(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),o1(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===n&&this.treeScale.y===a&&lz(this.projectionDelta.x,this.prevProjectionDelta.x)&&lz(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=nv(),this.projectionDelta=nv(),this.projectionDeltaWithTransform=nv()}setAnimationOrigin(e,t=!1){let r,s=this.snapshot,i=s?s.latestValues:{},n={...this.latestValues},a=nv();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=nw(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),u=this.getStack(),h=!u||u.members.length<=1,c=!!(l&&!h&&
39!0===this.options.crossfade&&!this.path.some(ue));this.animationProgress=0,this.mixTargetDelta=t=>{let s=t/1e3;if(l9(a.x,e.x,s),l9(a.y,e.y,s),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var u,d,p,f,m,g;o3(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,f=this.relativeTargetOrigin,m=o,g=s,l7(p.x,f.x,m.x,g),l7(p.y,f.y,m.y,g),r&&(u=this.relativeTarget,d=r,lL(u.x,d.x)&&lL(u.y,d.y))&&(this.isProjectionDirty=!1),r||(r=nw()),lR(r,this.relativeTarget)}l&&(this.animationValues=n,function(e,t,r,s,i,n){i?(e.opacity=sZ(0,r.opacity??1,lE(s)),e.opacityExit=sZ(t.opacity??1,0,lP(s))):n&&(e.opacity=sZ(t.opacity??1,r.opacity??1,s));for(let i=0;i<lk;i++){let n=`border${l_[i]}Radius`,a=lT(t,n),o=lT(r,n);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||lS(a)===lS(o)?(e[n]=Math.max(sZ(lx(a),lx(o),s),0),(il.test(o)||il.test(a))&&(e[n]+="%")):e[n]=o)}(t.rotate||r.rotate)&&(e.rotate=sZ(t.rotate||0,r.rotate||0,s))}(n,i,this.latestValues,s,c,h)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=s},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ij(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=iA.update(()=>{var t,r,s;let i;lp.hasAnimatedSinceResize=!0,aE.layout++,this.motionValue||(this.motionValue=nd(0)),this.currentAnimation=(t=this.motionValue,r=[0,1e3],s={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{aE.layout--},onComplete:()=>{aE.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=nn(t)?t:nd(t)).start(o$("",i,r,s)),i.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:r,layout:s,latestValues:i}=e;if(t&&r&&s){if(this!==e&&this.layout&&s&&un(this.options.animationType,this.layout.layoutBox,s.layoutBox)){r=this.target||nw();let t=oQ(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;let s=oQ(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+s}lR(t,r),s9(t,i),o1(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new lq),this.sharedNodes.get(e).add(t);let r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){let s=this.getStack();s&&s.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;let s={};r.z&&lH("z",e,s,this.animationValues);for(let t=0;t<lW.length;t++)lH(`rotate${lW[t]}`,e,s,this.animationValues),lH(`skew${lW[t]}`,e,s,this.animationValues);for(let t in e.render(),s)e.setStaticValue(t,s[t]),this.animationValues&&(this.animationValues[t]=s[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=ao(t?.pointerEvents)||"",e.transform=r?r(this.latestValues,""):"none";return}let s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=ao(t?.pointerEvents)||""),this.hasProjected&&!s1(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=s.animationValues||s.latestValues;this.applyTransformsToTarget();let n=function(e,t,r){let s="",i=e.x.translate/t.x,n=e.y.translate/t.y,a=r?.z||0;if((i||n||a)&&(s=`translate3d(${i}px, ${n}px, ${a}px) `),(1!==t.x||1!==t.y)&&(s+=`scale(${1/t.x}, ${1/t.y}) `),r){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:n,skewX:a,skewY:o}=r;e&&(s=`perspective(${e}px) ${s}`),t&&(s+=`rotate(${t}deg) `),i&&(s+=`rotateX(${i}deg) `),n&&(s+=`rotateY(${n}deg) `),a&&(s+=`skewX(${a}deg) `),o&&(s+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(s+=`scale(${o}, ${l})`),s||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);r&&(n=r(i,n)),e.transform=n;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,s.animationValues?e.opacity=s===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=s===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,nz){if(void 0===i[t])continue;let{correct:r,applyTo:a,isCSSVariable:o}=nz[t],l="none"===n?i[t]:r(i[t],s);if(a){let t=a.length;for(let r=0;r<t;r++)e[a[r]]=l}
39else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=s===this?ao(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(l0),this.root.sharedNodes.clear()}}}function lJ(e){e.updateLayout()}function lY(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,n=t.source!==e.layout.source;"size"===i?o4(e=>{let s=n?t.measuredBox[e]:t.layoutBox[e],i=oQ(s);s.min=r[e].min,s.max=s.min+i}):un(i,t.layoutBox,r)&&o4(s=>{let i=n?t.measuredBox[s]:t.layoutBox[s],a=oQ(r[s]);i.max=i.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[s].max=e.relativeTarget[s].min+a)});let a=nv();o1(a,r,t.layoutBox);let o=nv();n?o1(o,e.applyTransform(s,!0),t.measuredBox):o1(o,r,t.layoutBox);let l=!lU(a),u=!1;if(!e.resumeFrom){let s=e.getClosestProjectingParent();if(s&&!s.resumeFrom){let{snapshot:i,layout:n}=s;if(i&&n){let a=nw();o3(a,t.layoutBox,i.layoutBox);let o=nw();o3(o,r,n.layoutBox),lV(a,o)||(u=!0),s.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=s)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:u})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function lX(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function lZ(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function lQ(e){e.clearSnapshot()}function l0(e){e.clearMeasurements()}function l1(e){e.isLayoutDirty=!1}function l2(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function l5(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function l3(e){e.resolveTargetDelta()}function l4(e){e.calcProjection()}function l8(e){e.resetSkewAndRotation()}function l6(e){e.removeLeadSnapshot()}function l9(e,t,r){e.translate=sZ(t.translate,0,r),e.scale=sZ(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function l7(e,t,r,s){e.min=sZ(t.min,r.min,s),e.max=sZ(t.max,r.max,s)}function ue(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let ut={duration:.45,ease:[.4,0,.1,1]},ur=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),us=ur("applewebkit/")&&!ur("chrome/")?Math.round:iS;function ui(e){e.min=us(e.min),e.max=us(e.max)}function un(e,t,r){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(lF(t)-lF(r)))}function ua(e){return e!==e.root&&e.scroll?.wasRoot}let uo=lG({attachResizeListener:(e,t)=>oJ(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ul={current:void 0},uu=lG({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!ul.current){let e=new uo({});e.mount(window),e.setOptions({layoutScroll:!0}),ul.current=e}return ul.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function uh(e,t){let r=function(e,t,r){if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,r=(void 0)??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e)}(e),s=new AbortController;return[r,{passive:!0,...t,signal:s.signal},()=>s.abort()]}function uc(e){return!("touch"===e.pointerType||oG.x||oG.y)}function ud(e,t,r){let{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover","Start"===r);let i=s["onHover"+r];i&&iA.postRender(()=>i(t,oX(t)))}function up(e){return ly(e)&&"offsetHeight"in e}e.s(["isHTMLElement",()=>up],72846);let uf=(e,t)=>!!t&&(e===t||uf(e,t.parentElement)),um=new WeakSet;function ug(e){return t=>{"Enter"===t.key&&e(t)}}function uy(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function uv(e){return oY(e)&&!(oG.x||oG.y)}function ub(e,t,r){let{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap","Start"===r);let i=s["onTap"+("End"===r?"":r)];i&&iA.postRender(()=>i(t,oX(t)))}let uw=new WeakMap,u_=new WeakMap,uk=e=>{let t=uw.get(e.target);t&&t(e)},ux=e=>{e.forEach(uk)},uS={some:0,all:1},uT=function(e,t){if("undefined"==typeof Proxy)return ay;let r=new Map,s=(r,s)=>ay(r,s,e,t);return new Proxy((e,t)=>s(e,t),{get:(i,n)=>"create"===n?s:(r.has(n)||r.set(n,ay(n,void 0,e,t)),r.get(n))})}({animation:{Feature:class extends oq{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:r})=>(function(e,t,r={}){let s;if(e.notify("AnimationStart",t),Array.isArray(t))s=Promise.all(t.map(t=>oM(e,t,r)));
39else if("string"==typeof t)s=oM(e,t,r);else{let i="function"==typeof t?av(e,t,r.custom):t;s=Promise.all(oN(e,i,r))}return s.then(()=>{e.notify("AnimationComplete",t)})})(e,t,r))),r=oz(),s=!0,i=t=>(r,s)=>{let i=av(e,s,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...s}=i;r={...r,...s,...t}}return r};function n(n){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(r.initial=t.props.initial),r}let r={};for(let e=0;e<oL;e++){let s=nA[e],i=t.props[s];(nE(i)||!1===i)&&(r[s]=i)}return r}(e.parent)||{},l=[],u=new Set,h={},c=1/0;for(let t=0;t<oV;t++){var d,p;let f=oB[t],m=r[f],g=void 0!==a[f]?a[f]:o[f],y=nE(g),v=f===n?m.isActive:null;!1===v&&(c=t);let b=g===o[f]&&g!==a[f]&&y;if(b&&s&&e.manuallyAnimateOnMount&&(b=!1),m.protectedKeys={...h},!m.isActive&&null===v||!g&&!m.prevProp||nT(g)||"boolean"==typeof g)continue;let w=(d=m.prevProp,"string"==typeof(p=g)?p!==d:!!Array.isArray(p)&&!oU(p,d)),_=w||f===n&&m.isActive&&!b&&y||t>c&&y,k=!1,x=Array.isArray(g)?g:[g],S=x.reduce(i(f),{});!1===v&&(S={});let{prevResolvedValues:T={}}=m,E={...T,...S},P=t=>{_=!0,u.has(t)&&(k=!0,u.delete(t)),m.needsAnimating[t]=!0;let r=e.getValue(t);r&&(r.liveStyle=!1)};for(let e in E){let t=S[e],r=T[e];if(!h.hasOwnProperty(e))(aw(t)&&aw(r)?oU(t,r):t===r)?void 0!==t&&u.has(e)?P(e):m.protectedKeys[e]=!0:null!=t?P(e):u.add(e)}m.prevProp=g,m.prevResolvedValues=S,m.isActive&&(h={...h,...S}),s&&e.blockInitialAnimation&&(_=!1);let A=b&&w,j=!A||k;_&&j&&l.push(...x.map(t=>{let r={type:f};if("string"==typeof t&&s&&!A&&e.manuallyAnimateOnMount&&e.parent){let{parent:s}=e,i=av(s,t);if(s.enteringChildren&&i){let{delayChildren:t}=i.transition||{};r.delay=oD(s.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(u.size){let t={};if("boolean"!=typeof a.initial){let r=av(e,Array.isArray(a.initial)?a.initial[0]:a.initial);r&&r.transition&&(t.transition=r.transition)}u.forEach(r=>{let s=e.getBaseTarget(r),i=e.getValue(r);i&&(i.liveStyle=!0),t[r]=s??null}),l.push({animation:t})}let f=!!l.length;return s&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(f=!1),s=!1,f?t(l):Promise.resolve()}return{animateChanges:n,setActive:function(t,s){if(r[t].isActive===s)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,s)),r[t].isActive=s;let i=n(t);for(let e in r)r[e].protectedKeys={};return i},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=oz()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();nT(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends oq{constructor(){super(...arguments),this.id=oW++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends oq{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:r={}}=this.node.getProps(),{root:s,margin:i,amount:n="some",once:a}=r,o={root:s?s.current:void 0,rootMargin:i,threshold:"number"==typeof n?n:uS[n]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:r,onViewportLeave:s}=this.node.getProps(),i=t?r:s;i&&i(e)};return e=this.node.current,t=function({root:e,...t}){let r=e||document;u_.has(r)||u_.set(r,{});let s=u_.get(r),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(ux,{root:e,...t})),s[i]}(o),uw.set(e,l),t.observe(e),()=>{uw.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends oq{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[s,i,n]=uh(e,r),a=e=>{let s=e.currentTarget;if(!uv(e))return;um.add(s);let n=t(s,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),um.has(s)&&um.delete(s),uv(e)&&"function"==typeof n&&n(e,{success:t})},o=e=>{a(e,s===window||s===document||r.useGlobalTarget||uf(s,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,i),window.addEventListener("pointercancel",l,i)};
39return s.forEach(e=>{(r.useGlobalTarget?window:e).addEventListener("pointerdown",a,i),up(e)&&(e.addEventListener("focus",e=>((e,t)=>{let r=e.currentTarget;if(!r)return;let s=ug(()=>{if(um.has(r))return;uy(r,"down");let e=ug(()=>{uy(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>uy(r,"cancel"),t)});r.addEventListener("keydown",s,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",s),t)})(e,i)),oH(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),n}(e,(e,t)=>(ub(this.node,t,"Start"),(e,{success:t})=>ub(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends oq{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=aS(oJ(this.node.current,"focus",()=>this.onFocus()),oJ(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends oq{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[s,i,n]=uh(e,r),a=e=>{if(!uc(e))return;let{target:r}=e,s=t(r,e);if("function"!=typeof s||!r)return;let n=e=>{uc(e)&&(s(e),r.removeEventListener("pointerleave",n))};r.addEventListener("pointerleave",n,i)};return s.forEach(e=>{e.addEventListener("pointerenter",a,i)}),n}(e,(e,t)=>(ud(this.node,t,"Start"),e=>ud(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends oq{constructor(){super(...arguments),this.removePointerDownListener=iS}onPointerDown(e){this.session=new o9(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:o8(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:lh(e),onStart:lh(t),onMove:r,onEnd:(e,t)=>{delete this.session,s&&iA.postRender(()=>s(e,t))}}}mount(){this.removePointerDownListener=oZ(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends oq{constructor(e){super(e),this.removeGroupControls=iS,this.removeListeners=iS,this.controls=new ll(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||iS}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:uu,MeasureLayout:lg},layout:{ProjectionNode:uu,MeasureLayout:lg}},(e,t)=>
39t.isSVG??n5(e)?new n1(t):new nK(t,{allowProjection:e!==R.Fragment}));e.s(["motion",()=>uT],46932);var uE=e.i(43531);function uP(){let[e,t]=(0,R.useState)(""),[r,s]=(0,R.useState)("idle"),[i,n]=(0,R.useState)(""),[a,o]=(0,R.useState)(""),l=e=>e?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(o(""),!0):(o("Please enter a valid email address"),!1):(o(""),!1),u=async t=>{if(t.preventDefault(),l(e)){s("loading"),n("");try{let{error:t}=await sC.from("subscribers").insert({email:e});if(t)if("23505"===t.code)n("You are already subscribed!"),s("error");else throw t;else s("success")}catch(e){console.error("Error subscribing:",e),n("Something went wrong. Please try again."),s("error")}}};return"success"===r?(0,j.jsxs)(uT.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex w-full items-center justify-center gap-2 rounded-full border-2 border-[oklch(0.78_0.14_155_/_0.5)] bg-[oklch(0.78_0.14_155_/_0.22)] p-4",children:[(0,j.jsx)(uE.Check,{className:"h-5 w-5"}),(0,j.jsx)("span",{className:"font-semibold",children:"Thanks for subscribing!"})]}):(0,j.jsxs)("div",{className:"flex w-full flex-col items-start",children:[(0,j.jsxs)("form",{onSubmit:u,className:"flex w-full gap-2.5",children:[(0,j.jsx)("div",{className:"flex flex-1 flex-col gap-1",children:(0,j.jsx)("input",{type:"email",value:e,onChange:e=>{let r=e.target.value;t(r),l(r)},placeholder:"[email protected]","aria-label":"Email address",disabled:"loading"===r,className:`jl-input !rounded-full !px-[18px] ${a?"!border-[oklch(0.62_0.19_25)]":""}`})}),(0,j.jsx)(eW,{type:"submit",disabled:"loading"===r||!!a||!e,className:"h-[50px] w-28 rounded-full bg-[var(--jl-ink)] text-[15px] font-semibold text-white hover:bg-[oklch(0.28_0.01_265)]",children:"loading"===r?(0,j.jsx)("div",{className:"flex gap-1 items-center justify-center h-full",children:[0,1,2].map(e=>(0,j.jsx)(uT.div,{className:"w-1.5 h-1.5 bg-background rounded-full",animate:{y:[0,-4,0]},transition:{duration:.6,repeat:1/0,delay:.2*e}},e))}):"Subscribe"})]}),(a||i)&&(0,j.jsx)("p",{className:"mt-2 pl-1 text-sm font-medium text-[oklch(0.62_0.19_25)]",children:a||i})]})}e.s(["NewsletterForm",()=>uP],21978)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.