1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70309,e=>{"use strict";let t=(0,e.i(92511).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],70309)},29343,e=>{"use strict";var t=e.i(80105);e.s(["CheckCircle2",()=>t.default])},15257,e=>{"use strict";var t=e.i(14294),r=e.i(30878),n=e.i(77982),s=e.i(66904),i=e.i(70309),a=e.i(29343),o=e.i(61957),l=e.i(51112);let u=(0,l.createServerReference)("608713253298e8912746e0b14ffca570447481dcff",l.callServer,void 0,l.findSourceMapURL,"requestWaitlistVerification"),c=(0,l.createServerReference)("60f21d55c27fa7482dbb9b10faf9d12d30b7dda129",l.callServer,void 0,l.findSourceMapURL,"verifyAndJoinWaitlist");var h=e.i(84371);function d(){return"u">typeof window}e.i(50382);function f(){return(d()?window.vam:"production")||"production"}function p(){return"production"===f()}function g(e,t={}){try{"function"==typeof window.gtag&&window.gtag("event",e,t)}catch{}try{!function(e,t){var r,n;if(!d()){let e="[Vercel Web Analytics] Please import `track` from `@vercel/analytics/server` when using this function in a server environment";if(p())console.warn(e);else throw Error(e);return}if(!t){null==(r=window.va)||r.call(window,"event",{name:e,options:void 0});return}try{let r=function(e,t){if(!e)return;let r=e,n=[];for(let[s,i]of Object.entries(e))"object"==typeof i&&null!==i&&(t.strip?r=function(e,{[e]:t,...r}){return r}(s,r):n.push(s));if(n.length>0&&!t.strip)throw Error(`The following properties are not valid: ${n.join(", ")}. Only strings, numbers, booleans, and null are allowed.`);return r}(t,{strip:p()});null==(n=window.va)||n.call(window,"event",{name:e,data:r,options:void 0})}catch(e){e instanceof Error&&"development"===f()&&console.error(e)}}(e,t)}catch{}}e.s(["WaitlistForm",0,function({source:e="hero",compact:l=!1,lang:d="en"}){let f=(0,h.getDict)(d).waitlist,[p,m]=(0,r.useState)("email"),[y,b]=(0,r.useState)("idle"),[v,w]=(0,r.useState)(null),[x,E]=(0,r.useState)(""),[k,S]=(0,r.useState)(""),R=(0,r.useRef)(null);async function _(t){if(t.preventDefault(),!x)return;b("loading"),w(null);let r=await u(x,e);if(r.ok){g("signup_started",{source:e}),m("code"),b("idle");return}b("error"),w("invalid-email"===r.error?f.errInvalidEmail:"rate-limited"===r.error?f.errRateLimited:"send-failed"===r.error?f.errSendFailed:f.errUnknown)}async function T(t){if(t.preventDefault(),6!==k.length)return;b("loading"),w(null);let r=await c(x,k);if(r.ok){g("signup_verified",{source:e}),m("success"),b("idle");return}g("signup_code_failed",{source:e,reason:r.error??"unknown"}),b("error"),w("wrong-code"===r.error?f.errWrongCode:"expired"===r.error?f.errExpired:"too-many-attempts"===r.error?f.errTooMany:"no-code"===r.error?f.errNoCode:f.errUnknown)}async function C(){b("loading"),w(null),S("");let t=await u(x,e);if(t.ok){b("idle"),w(f.newCodeSent);return}b("error"),w("rate-limited"===t.error?f.errRateLimited:f.errResendFailed)}return((0,r.useEffect)(()=>{"code"===p&&R.current?.focus()},[p]),"success"===p)?(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-success/30 bg-success/10 px-4 py-3 text-sm text-foreground",children:[(0,t.jsx)(a.CheckCircle2,{className:"size-4 text-success","aria-hidden":!0}),(0,t.jsx)("span",{children:f.success})]}):"code"===p?(0,t.jsxs)("div",{className:`flex w-full flex-col gap-2 ${l?"max-w-sm":"max-w-md"}`,children:[(0,t.jsxs)("form",{onSubmit:T,className:"flex w-full gap-2",children:[(0,t.jsx)(n.Input,{ref:R,type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:k,onChange:e=>S(e.target.value.replace(/\D/g,"").slice(0,6)),placeholder:f.codePlaceholder,className:"h-10 flex-1 text-base tracking-[0.4em] font-mono",maxLength:6,"aria-label":f.codeAria,"aria-invalid":"error"===y}),(0,t.jsxs)(s.Button,{type:"submit",size:"lg",disabled:"loading"===y||6!==k.length,className:"h-10 gap-1.5 px-4",children:["loading"===y?(0,t.jsx)(o.Loader2,{className:"size-4 animate-spin","aria-hidden":!0}):null,"loading"===y?f.verifying:f.verify]})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[f.sentTo.split("{email}
1")[0],(0,t.jsx)("span",{className:"text-foreground/80",children:x}),f.sentTo.split("{email}")[1]," ",(0,t.jsx)("button",{type:"button",onClick:C,disabled:"loading"===y,className:"text-primary underline-offset-2 hover:underline disabled:opacity-50",children:f.sendNewCode})," ","·"," ",(0,t.jsxs)("button",{type:"button",onClick:function(){m("email"),b("idle"),w(null),S("")},className:"text-primary underline-offset-2 hover:underline",children:[(0,t.jsx)(i.ArrowLeft,{className:"-mt-px mr-0.5 inline size-3","aria-hidden":!0}),f.useDifferentEmail]})]}),v&&(0,t.jsx)("p",{className:`text-xs ${"error"===y?"text-destructive":"text-muted-foreground"}`,role:"error"===y?"alert":void 0,children:v})]}):(0,t.jsxs)("div",{className:`flex w-full flex-col gap-2 ${l?"max-w-sm":"max-w-md"}`,children:[(0,t.jsxs)("form",{onSubmit:_,className:"flex w-full gap-2",children:[(0,t.jsx)(n.Input,{type:"email",required:!0,value:x,onChange:e=>E(e.target.value),placeholder:"[email protected]",className:"h-10 flex-1","aria-label":f.emailAria,"aria-invalid":"error"===y,autoComplete:"email"}),(0,t.jsxs)(s.Button,{type:"submit",size:"lg",disabled:"loading"===y,className:"h-10 gap-1.5 px-4",children:["loading"===y?(0,t.jsx)(o.Loader2,{className:"size-4 animate-spin","aria-hidden":!0}):null,"loading"===y?f.sending:f.subscribe]})]}),"error"===y&&v&&(0,t.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:v})]})}],15257)},85877,e=>{"use strict";let t=(0,e.i(92511).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}
1],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",0,t],85877)},47926,48103,e=>{"use strict";var t=e.i(92511);let r=(0,t.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);e.s(["Hash",0,r],47926);let n=(0,t.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);e.s(["Map",0,n],48103)},17632,e=>{"use strict";let t=(0,e.i(92511).default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);e.s(["BookOpen",0,t],17632)},84923,e=>{"use strict";let t=(0,e.i(92511).default)("award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);e.s(["Award",0,t],84923)},96903,e=>{"use strict";let t=(0,e.i(92511).default)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);e.s(["Database",0,t],96903)},56229,e=>{"use strict";var t=e.i(14294);e.s(["BotIcon",0,function({className:e}){return(0,t.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"5",cy:"2",r:"1.2",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"11",cy:"2",r:"1.2",fill:"currentColor",stroke:"none"}),(0,t.jsx)("path",{d:"M5 3.2 L5.5 5.5 M 11 3.2 L 10.5 5.5",strokeWidth:"1",strokeLinecap:"round"}),(0,t.jsx)("rect",{x:"2.5",y:"5",width:"11",height:"9",rx:"3",strokeWidth:"1.3"}),(0,t.jsx)("circle",{cx:"6",cy:"8.5",r:"0.6",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"10",cy:"8.5",r:"0.6",fill:"currentColor",stroke:"none"}),(0,t.jsx)("path",{d:"M6 10.5 Q 8 12.2 10 10.5",strokeWidth:"1.1",strokeLinecap:"round"})]})},"BubblesIcon",0,function({className:e}){return(0,t.jsxs)("svg",{viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,children:[(0,t.jsx)("circle",{cx:"5.2",cy:"6",r:"3.2",fillOpacity:"0.85"}),(0,t.jsx)("circle",{cx:"11",cy:"5",r:"2.2",fillOpacity:"0.55"}),(0,t.jsx)("circle",{cx:"9.8",cy:"11",r:"2.6",fillOpacity:"0.7"})]})}])},20683,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,i=l(e),a=i[0],o=i[1],u=new s((a+o)*3/4-o),c=0,h=o>0?a-4:a;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,s=n%3,i=[],a=0,o=n-s;a<o;a+=16383)i.push(function(e,t,n){for(var s,i=[],a=t;a<n;a+=3)s=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[s>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return i.join("")}(e,a,a+16383>o?o:a+16383));return 1===s?i.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===s&&i.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],n=[],s="u">typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=i.length;a<o;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),s=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>
vendor: 18,551 bytes, line 1
10x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,s=t;if(("string"!=typeof s||""===s)&&(s="utf8"),!o.isEncoding(s))throw TypeError("Unknown encoding: "+s);var i=0|f(n,s),l=a(i),u=l.write(n,s);return u!==i&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return o.from(c,t,r);var p=function(e){if(o.isBuffer(e)){var t=0|d(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|d(e))}function h(e){for(var t=e.length<0?0:0|d(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!o.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)};function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(s)return n?-1:R(e).length;t=(""+t).toLowerCase(),s=!0}}function p(e,t,r){var s,i,a,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var s="",i=t;i<r;++i)s+=A[e[i]];return s}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}(this,t,r);case"base64":return s=this,i=t,a=r,0===i&&a===s.length?n.fromByteArray(s):n.fromByteArray(s.slice(i,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),s="",i=0;i<n.length;i+=2)s+=String.fromCharCode(n[i]+256*n[i+1]);return s}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,s){var i;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(s)return -1;else r=e.length-1;else if(r<0)if(!s)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,s);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(s)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,s)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,s){var i,a=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){var c=-1;for(i=r;i<o;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*a}else -1!==c&&(i-=i-c),c=-1}else for(r+l>o&&(r=o-l),i=r;i>=0;i--){for(var h=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){h=!1;break}if(h)return i}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(O(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),O(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,s=0,i=Math.min(r,n);s<i;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:+(n<r)},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var i=e[r];if(O(i,Uint8Array)&&(i=o.from(i)),!o.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(n,s),s+=i.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(o.prototype[i]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,s){if(O(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var i=s-n,a=r-t,l=Math.min(i,a),u=this.slice(n,s),c=e.slice(t,r),h=0;h<l;++h)if(u[h]!==c[h]){i=u[h],a=c[h];break}return i<a?-1:+(a<i)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)};function b(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s<r;){var i,a,o,l,u=e[s],c=null,h=u>239?4:u>223?3:u>191?2:1;if(s+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:(192&(i=e[s+1]))==128&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[s+1],a=e[s+2],(192&i)==128&&(192&a)==128&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[s+1],a=e[s+2],o=e[s+3],(192&i)==128&&(192&a)==128&&(192&o)==128&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),s+=h}var d=n,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var p="",g=0;g<f;)p+=String.fromCharCode.apply(String,d.slice(g,g+=4096));return p}function v(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,n,s,i){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function x(e,t,r,n,s,i){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,i){return t*=1,r>>>=0,i||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),s.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,i){return t*=1,r>>>=0,i||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),s.write(e,t,r,n,52,8),r+8}o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s,i,a,o,l,u,c,h,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var o,l=parseInt(t.substr(2*a,2),16);if((o=l)!=o)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return s=t,i=r,C(R(e,this.length-s),this,s,i);case"ascii":return a=t,o=r,C(_(e),this,a,o);case"latin1":case"binary":return function(e,t,r,n){return C(_(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,C(T(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,h=r,C(function(e,t){for(var r,n,s=[],i=0;i<e.length&&!((t-=2)<0);++i)n=(r=e.charCodeAt(i))>>8,s.push(r%256),s.push(n);return s}(e,this.length-c),this,c,h);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,s=1,i=this[e+--n];n>0&&(s*=256);)i+=this[e+--n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),s.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),s.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),s.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),s.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var s=Math.pow(2,8*r)-1;w(this,e,t,r,s,0)}var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var s=Math.pow(2,8*r)-1;w(this,e,t,r,s,0)}var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var s=Math.pow(2,8*r-1);w(this,e,t,r,s-1,-s)}var i=0,a=1,o=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var s=Math.pow(2,8*r-1);w(this,e,t,r,s-1,-s)}var i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var s=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=s-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return s},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var s,i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var a=o.isBuffer(e)?e:o.from(e,n),l=a.length;
1if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=a[s%l]}return this};var S=/[^+/0-9A-Za-z-_]/g;function R(e,t){t=t||1/0;for(var r,n=e.length,s=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!s){if(r>56319||a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function _(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function T(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(S,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function C(e,t,r,n){for(var s=0;s<n&&!(s+r>=t.length)&&!(s>=e.length);++s)t[s+r]=e[s];return s}function O(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var A=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,s=0;s<16;++s)t[n+s]=e[r]+e[s];return t}()},783:function(e,t){t.read=function(e,t,r,n,s){var i,a,o=8*s-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?s-1:0,d=r?-1:1,f=e[t+h];for(h+=d,i=f&(1<<-c)-1,f>>=-c,c+=o;c>0;i=256*i+e[t+h],h+=d,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),i-=u}return(f?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,s,i){var a,o,l,u=8*i-s-1,c=(1<<u)-1,h=c>>1,d=5960464477539062e-23*(23===s),f=n?0:i-1,p=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(t*l-1)*Math.pow(2,s),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,s),a=0));s>=8;e[r+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,u+=s;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}}},s={};function i(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}},a=!0;try{n[e](r,r.exports,i),a=!1}finally{a&&delete s[e]}return r.exports}i.ab="/ROOT/web/node_modules/next/dist/compiled/buffer/",t.exports=i(72)},93575,8495,38445,54671,90563,99644,e=>{"use strict";let t,r,n;var s,i,a,o,l,u,c,h,d,f,p,g,m=e.i(30878),y=e.i(50382),b=e.i(64885),v=e.i(75881),w=e.i(85877),x=e.i(92511);let E=(0,x.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),k=(0,x.default)("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);e.s(["Table",0,k],8495);var S=e.i(21052),R=e.i(9724),_=e.i(84552),T=e.i(21158);let C=(0,x.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);var O=e.i(21219),A=e.i(47926),P=e.i(48103);let I=(0,x.default)("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),j=(0,x.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),N=(0,x.default)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);e.s(["Mail",0,N],38445);let L=(0,x.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["FileText",0,L],54671);var M=e.i(17632),D=e.i(84923);let $=(0,x.default)("calendar-days",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);var U=e.i(96903);let B=(0,x.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),F=(0,x.default)("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),H=(0,x.default)("blocks",[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",ke
1y:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]),W=(0,x.default)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]),q=(0,x.default)("briefcase-business",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);var z=e.i(56229);let V=[{label:"Main",items:[{href:"/feed",label:"Feed",icon:w.Sparkles},{href:"/assistant",label:"Assistant",icon:z.BotIcon},{href:"/pulse",label:"Pulse",icon:z.BubblesIcon},{href:"/graph",label:"Graph",icon:E},{href:"/signal",label:"Signal",icon:I},{href:"/compare",label:"Compare",icon:k},{href:"/saved",label:"Saved",icon:v.Bookmark}]},{label:"Browse",items:[{href:"/news",label:"News",icon:S.Newspaper},{href:"/releases",label:"Releases",icon:R.Package},{href:"/videos",label:"Videos",icon:_.Video}]},{label:"Explore",items:[{href:"/projects",label:"Projects",icon:T.FolderGit2},{href:"/startups",label:"Startups",icon:C},{href:"/jobs",label:"Jobs",icon:q},{href:"/community",label:"Community",icon:O.MessagesSquare},{href:"/topics",label:"Topics",icon:A.Hash},{href:"/roadmap",label:"Roadmap",icon:P.Map}]},{label:"Learn",items:[{href:"/exam-prep",label:"Exam prep",icon:F},{href:"/daily-brick",label:"Daily Brick",icon:H},{href:"/practice",label:"Practice",icon:W}]},{label:"Read",items:[{href:"/digest",label:"Digest",icon:j},{href:"/newsletter",label:"Newsletter",icon:N},{href:"/articles",label:"Articles",icon:L}]},{label:"Reference",items:[{href:"/books",label:"Books",icon:M.BookOpen},{href:"/certifications",label:"Certifications",icon:D.Award},{href:"/events",label:"Events",icon:$},{href:"/sources",label:"Sources",icon:U.Database},{href:"/mcp",label:"MCP",icon:B}]}],K="0"!==y.default.env.NEXT_PUBLIC_NAV_V2,G=[{href:"/digest",label:"Briefing",sublabel:"one story a day, themes weekly",icon:j},{href:"/feed",label:"Feed",sublabel:"everything, ranked for your role",icon:w.Sparkles},{href:"/topics",label:"Topics",sublabel:`${b.TOPICS.length} hubs, updated hourly`,icon:A.Hash},{href:"/pulse",label:"Trends",sublabel:"live topic momentum",icon:z.BubblesIcon},{href:"/roadmap",label:"Roadmap",sublabel:"feature status, sourced",icon:P.Map},{href:"/compare",label:"Compare",sublabel:"vs Snowflake · Fabric · BigQuery",icon:k},{href:"/jobs",label:"Jobs",sublabel:"at Databricks and around it",icon:q}],J={label:"Learn",icon:F,sublabel:"daily brick · practice · exam prep · articles",items:[{href:"/articles",label:"Articles",icon:L},{href:"/exam-prep",label:"Exam prep",icon:F},{href:"/daily-brick",label:"Daily Brick",icon:H},{href:"/practice",label:"Practice",icon:W},{href:"/certifications",label:"Certifications",icon:D.Award},{href:"/books",label:"Books",icon:M.BookOpen},{href:"/events",label:"Events",icon:$}]},Y=[{href:"/sources",label:"Sources",icon:U.Database},{href:"/mcp",label:"MCP",icon:B}],X=[{label:"Main",items:G},{label:"Learn",items:J.items},{label:"More",items:[{href:"/assistant",label:"Assistant",icon:z.BotIcon},{href:"/signal",label:"Signal",icon:I},{href:"/graph",label:"Graph",icon:E},{href:"/saved",label:"Saved",icon:v.Bookmark},{href:"/news",label:"News",icon:S.Newspaper},{href:"/releases",label:"Releases",icon:R.Package},{href:"/videos",label:"Videos",icon:_.Video},{href:"/projects",label:"Projects",icon:T.FolderGit2},{href:"/startups",label:"Startups",icon:C},{href:"/community",label:"Community",icon:O.MessagesSquare},{href:"/newsletter",label:"Newsletter",icon:N},...Y]}],Q=K?X:V;e.s(["ACTIVE_NAV_GROUPS",0,Q,"LEARN_V2",0,J,"LEGAL_LINKS",0,[{href:"/about",label:"About"},{href:"/privacy",label:"Privacy"},{href:"/terms",label:"Terms"},{href:"/disclaimer",label:"Disclaimer"},{href:"/contact",label:"Contact"},{href:"/contributors",label:"Contributors"}],"NAV_GROUPS",0,V,"NAV_V2",0,K,"PRIMARY_V2",0,G,"SOCIAL",0,{linkedin:"https://www.linkedin.com/company/brickster-ai",x:"https://x.com/brickster_ai",rss:"/feed.xml"},"UTILITY_V2",0,Y],90563);let Z="bx.nav.preview",ee=new Set;function et(e){if(ee.add(e),void 0===t)for(let e of(t=function(){try{let e=new URLSearchParams(window.location.search).get("nav");return"v1"===e||"v2"===e?sessionStorage.setItem(Z,e):"reset"===e&&sessionStorage.removeItem(Z),sessionStorage.getItem(Z)}catch{return null}}(),ee))e();return()=>{ee.delete(e)}}function er(){return"v2"===t||"v1"!==t&&K}function en(){return K}e.s(["useNavVariant",0,function(){return(0,m.useSyncExternalStore)(et,er,en)}],93575);
1class es extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class ei extends es{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class ea extends es{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class eo extends es{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(s=c||(c={})).Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2";function el(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)0>t.indexOf(n[s])&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}"function"==typeof SuppressedError&&SuppressedError;class eu{constructor(e,{headers:t={},customFetch:r,region:n=c.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){var t,r,n,s;return t=this,r=arguments,n=void 0,s=function*(e,t={}){var r;let n,s;try{let i,{headers:a,method:o,body:l,signal:u,timeout:c}=t,h={},{region:d}=t;d||(d=this.region);let f=new URL(`${this.url}/${e}`);d&&"any"!==d&&(h["x-region"]=d,f.searchParams.set("forceFunctionRegion",d)),l&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?"u">typeof Blob&&l instanceof Blob||l instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",i=l):"string"==typeof l?(h["Content-Type"]="text/plain",i=l):"u">typeof FormData&&l instanceof FormData?i=l:(h["Content-Type"]="application/json",i=JSON.stringify(l)):i=!l||"string"==typeof l||"u">typeof Blob&&l instanceof Blob||l instanceof ArrayBuffer||"u">typeof FormData&&l instanceof FormData?l:JSON.stringify(l);let p=u;c&&(s=new AbortController,n=setTimeout(()=>s.abort(),c),u?(p=s.signal,u.addEventListener("abort",()=>s.abort())):p=s.signal);let g=yield this.fetch(f.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),a),body:i,signal:p}).catch(e=>{throw new ei(e)}),m=g.headers.get("x-relay-error");if(m&&"true"===m)throw new ea(g);if(!g.ok)throw new eo(g);let y=(null!=(r=g.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim();return{data:"application/json"===y?yield g.json():"application/octet-stream"===y||"application/pdf"===y?yield g.blob():"text/event-stream"===y?g:"multipart/form-data"===y?yield g.formData():yield g.text(),error:null,response:g}}catch(e){return{data:null,error:e,response:e instanceof eo||e instanceof ea?e.context:void 0}}finally{n&&clearTimeout(n)}},new(n||(n=Promise))(function(e,i){function a(e){try{l(s.next(e))}catch(e){i(e)}}function o(e){try{l(s.throw(e))}catch(e){i(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(a,o)}l((s=s.apply(t,r||[])).next())})}}let ec=e=>Math.min(1e3*2**e,3e4),eh=[520,503],ed=["GET","HEAD","OPTIONS"];var ef=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
1de=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function ep(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();let n=setTimeout(()=>{null==t||t.removeEventListener("abort",s),r()},e);function s(){clearTimeout(n),r()}null==t||t.addEventListener("abort",s)})}var eg=class{constructor(e){var t,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,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,this.shouldStripNulls=null!=(n=e.shouldStripNulls)&&n,this.urlLengthLimit=null!=(s=e.urlLengthLimit)?s:8e3,this.retryEnabled=null==(i=e.retry)||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(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"),this.shouldStripNulls){let e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}let n=this.fetch,s=(async()=>{let e=0;for(;;){var t,s,i,a,o;let l,u=new Headers(r.headers);e>0&&u.set("X-Retry-Count",String(e));try{l=await n(r.url.toString(),{method:r.method,headers:u,body:JSON.stringify(r.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:r.signal})}catch(t){if((null==t?void 0:t.name)==="AbortError"||(null==t?void 0:t.code)==="ABORT_ERR"||!ed.includes(r.method))throw t;if(r.retryEnabled&&e<3){let t=ec(e);e++,await ep(t,r.signal);continue}throw t}if(t=r.method,s=l.status,i=e,r.retryEnabled&&!(i>=3)&&ed.includes(t)&&eh.includes(s)&&1){let t=null!=(a=null==(o=l.headers)?void 0:o.get("Retry-After"))?a:null,n=null!==t?1e3*Math.max(0,parseInt(t,10)||0):ec(e);await l.text(),e++,await ep(n,r.signal);continue}return await r.processResponse(l)}})();return this.shouldThrowOnError||(s=s.catch(e=>{var t,r,n,s,i,a;let o="",l="",u="",c=null==e?void 0:e.cause;if(c){let t=null!=(r=null==c?void 0:c.message)?r:"",a=null!=(n=null==c?void 0:c.code)?n:"";o=`${null!=(s=null==e?void 0:e.name)?s:"FetchError"}: ${null==e?void 0:e.message} 2 3Caused by: ${null!=(i=null==c?void 0:c.name)?i:"Error"}: ${t}`,a&&(o+=` (${a})`),(null==c?void 0:c.stack)&&(o+=` 4${c.stack}`)}else o=null!=(a=null==e?void 0:e.stack)?a:"";let h=this.url.toString().length;return(null==e?void 0:e.name)==="AbortError"||(null==e?void 0:e.code)==="ABORT_ERR"?(u="",l="Request was aborted (timeout or manual cancellation)",h>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${h} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((null==c?void 0:c.name)==="HeadersOverflowError"||(null==c?void 0:c.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",l="HTTP headers exceeded server limits (typically 16KB)",h>this.urlLengthLimit&&(l+=`. Your request URL is ${h} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:o,hint:l,code:u},data:null,count:null,status:0,statusText:""}})),s.then(e,t)}async processResponse(e){var t,r,n;let s=null,i=null,a=null,o=e.status,l=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(i="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null==(n=this.headers.get("Accept"))?void 0:n.includes("application/vnd.pgrst.plan+text"))?t:JSON.parse(t))}let u=null==(t=this.headers.get("Prefer"))?void 0:t.match(/count=(exact|planned|estimated)/),c=null==(r=e.headers.get("content-range"))?void 0:r.split("/");u&&c&&c.length>1&&(a=parseInt(c[1])),this.isMaybeSingle&&Array.isArray(i)&&(i.length>1?(s={code:"PGRST116",details:`Results contain ${i.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},i=null,a=null,o=406,l="Not Acceptable"):i=1===i.length?i[0]:null)}else{let t=await e.text();try{s=JSON.parse(t),Array.isArray(s)&&404===e.status&&(i=[],s=null,o=200,l="OK")}catch(r){404===e.status&&""===t?(o=204,l="No Content"):s={message:t}}if(s&&this.shouldThrowOnError)throw new ef(s)}return{success:null===s,error:s,data:i,count:a,status:o,statusText:l}}returns(){return this}overrideTypes(){return this}},em=class extends eg{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:n,referencedTable:s=n}={}){let i=s?`${s}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let s=void 0===n?"offset":`${n}.offset`,i=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${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 this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
4explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var a;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=null!=(a=this.headers.get("Accept"))?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; 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 ey=RegExp("[,()]");var eb=class extends em{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&&ey.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&&ey.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:n}={}){let s="";"plain"===n?s="pl":"phrase"===n?s="ph":"websearch"===n&&(s="w");let i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).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 n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},ev=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){let{head:r=!1,count:n}=null!=t?t:{},s=!1,i=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e)).join(""),{url:a,headers:o}=this.cloneRequestState();return a.searchParams.set("select",i),n&&o.append("Prefer",`count=${n}`),new eb({method:r?"HEAD":"GET",url:a,headers:o,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;let{url:s,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>
4e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);s.searchParams.set("columns",e.join(","))}}return new eb({method:"POST",url:s,headers:i,schema:this.schema,body:e,fetch:null!=(n=this.fetch)?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;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),n&&o.append("Prefer",`count=${n}`),s||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 eb({method:"POST",url:a,headers:o,schema:this.schema,body:e,fetch:null!=(i=this.fetch)?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;let{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new eb({method:"PATCH",url:n,headers:s,schema:this.schema,body:e,fetch:null!=(r=this.fetch)?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;let{url:r,headers:n}=this.cloneRequestState();return e&&n.append("Prefer",`count=${e}`),new eb({method:"DELETE",url:r,headers:n,schema:this.schema,fetch:null!=(t=this.fetch)?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function ew(e){return(ew="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 ex(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function eE(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ex(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=ew(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=ew(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==ew(n)?n:n+"")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)):ex(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ek=class e{constructor(e,{headers:t={},schema:r,fetch:n,timeout:s,urlLengthLimit:i=8e3,retry:a}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.urlLengthLimit=i;const o=null!=n?n:globalThis.fetch;void 0!==s&&s>0?this.fetch=(e,t)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),s),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(n),o(e,t);let s=()=>{clearTimeout(n),r.abort()};return i.addEventListener("abort",s,{once:!0}),o(e,eE(eE({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(n),i.removeEventListener("abort",s)})}return o(e,eE(eE({},t),{},{signal:r.signal})).finally(()=>clearTimeout(n))}:this.fetch=o,this.retry=a}from(e){if(!e||"string"!=typeof e||""===e.trim())throw Error("Invalid relation name: relation must be a non-empty string.");return new ev(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:n=!1,count:s}={}){var i;let a,o,l=new URL(`${this.url}/rpc/${e}`),u=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(u)),c=r&&Object.values(t).some(u);c?(a="POST",o=t):r||n?(a=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}
4`]).forEach(([e,t])=>{l.searchParams.append(e,t)})):(a="POST",o=t);let h=new Headers(this.headers);return c?h.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&h.set("Prefer",`count=${s}`),new eb({method:a,url:l,headers:h,schema:this.schemaName,body:o,fetch:null!=(i=this.fetch)?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};let eS=class{static detectEnvironment(){var t;if("u">typeof WebSocket)return{type:"native",wsConstructor:WebSocket};let r=globalThis;if("u">typeof globalThis&&void 0!==r.WebSocket)return{type:"native",wsConstructor:r.WebSocket};let n=e.g;if(n&&void 0!==n.WebSocket)return{type:"native",wsConstructor:n.WebSocket};if("u">typeof globalThis&&void 0!==r.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("u">typeof globalThis&&r.EdgeRuntime||"u">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 s=globalThis.process;if(s){let e=s.versions;if(e&&e.node){let t=parseInt(e.node.replace(/^v/,"").split(".")[0]);return t>=22?void 0!==globalThis.WebSocket?{type:"native",wsConstructor: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.wsConstructor)return e.wsConstructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=` 5 6Suggested solution: ${e.workaround}`),Error(t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}},eR="2.0.0",e_="errored",eT="joined",eC={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave",access_token:"access_token"};class eO{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 n=null!=(r=null==(t=e.payload)?void 0:t.payload)?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var t,r;let n=null!=(r=null==(t=e.payload)?void 0:t.payload)?r:{},s=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,s)}_encodeUserBroadcastPush(e,t,r){let n=e.topic,s=null!=(f=e.ref)?f:"",i=null!=(p=e.join_ref)?p:"",a=e.payload.event,o=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},l=0===Object.keys(o).length?"":JSON.stringify(o);if(i.length>255)throw Error(`joinRef length ${i.length} exceeds maximum of 255`);if(s.length>255)throw Error(`ref length ${s.length} exceeds maximum of 255`);if(n.length>255)throw Error(`topic length ${n.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+i.length+s.length+n.length+a.length+l.length,c=new ArrayBuffer(this.HEADER_LENGTH+u),h=new DataView(c),d=0;h.setUint8(d++,this.KINDS.userBroadcastPush),h.setUint8(d++,i.length),h.setUint8(d++,s.length),h.setUint8(d++,n.length),h.setUint8(d++,a.length),h.setUint8(d++,l.length),h.setUint8(d++,t),Array.from(i,e=>h.setUint8(d++,e.charCodeAt(0))),Array.from(s,e=>h.setUint8(d++,e.charCodeAt(0))),Array.from(n,e=>h.setUint8(d++,e.charCodeAt(0))),Array.from(a,e=>h.setUint8(d++,e.charCodeAt(0))),Array.from(l,e=>h.setUint8(d++,e.charCodeAt(0)));var f,p,g=new Uint8Array(c.byteLength+r.byteLength);return g.set(new Uint8Array(c),0),g.set(new Uint8Array(r),c.byteLength),g.buffer}decode(e,t){if(this._isArrayBuffer(e))return t(this._binaryDecode(e));if("string"==typeof e){let[r,n,s,i,a]=JSON.parse(e);return t({join_ref:r,ref:n,topic:s,event:i,payload:a})}return t({})}_binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;if(r===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,n)}_decodeUserBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+4,l=r.decode(e.slice(o,o+n));o+=n;let u=r.decode(e.slice(o,o+s));o+=s;let c=r.decode(e.slice(o,o+i));o+=i;let h=e.slice(o,e.byteLength),d=a===this.JSON_ENCODING?JSON.parse(r.decode(h)):h,f={type:this.BROADCAST_EVENT,event:u,payload:d};return i>0&&(f.meta=JSON.parse(c)),{join_ref:null,ref:null,topic:l,event:this.BROADCAST_EVENT,payload:f}}_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))):{}}}(i=h||(h={})).abstime="abstime",i.bool="bool",i.date="date",i.daterange="daterange",i.float4="float4",i.float8="float8",i.int2="int2",i.int4="int4",i.int4range="int4range",i.int8="int8",i.int8range="int8range",i.json="json",i.jsonb="jsonb",i.money="money",i.numeric="numeric",i.oid="oid",i.reltime="reltime",i.text="text",i.time="time",i.timestamp="timestamp",i.timestamptz="timestamptz",i.timetz="timetz",i.tsrange="tsrange",i.tstzrange="tstzrange";let eA=(e,t,r={})=>{var n;let s=null!=(n=r.skipTypes)?n:[];return t?Object.keys(t).reduce((r,n)=>(r[n]=eP(n,e,t,s),r),{}):{}},eP=(e,t,r,n)=>{let s=t.find(t=>t.name===e),i=null==s?void 0:s.type,a=r[e];return i&&!n.includes(i)?eI(i,a):ej(a)},eI=(e,t)=>{if("_"===e.charAt(0))return eD(t,e.slice(1,e.length));switch(e){case h.bool:return eN(t);case h.float4:case h.float8:case h.int2:case h.int4:case h.int8:case h.numeric:case h.oid:return eL(t);case h.json:case h.jsonb:return eM(t);case h.timestamp:return e$(t);case h.abstime:case h.date:case h.daterange:case h.int4range:case h.int8range:case h.money:case h.reltime:case h.text:case h.time:case h.timestamptz:case h.timetz:case h.tsrange:case h.tstzrange:default:return ej(t)}},ej=e=>e,eN=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},eL=e=>{if("string"==typeof e){let t=parseFloat(e);
6if(!Number.isNaN(t))return t}return e},eM=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},eD=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){let n,s=e.slice(1,r);try{n=JSON.parse("["+s+"]")}catch(e){n=s?s.split(","):[]}return n.map(e=>eI(t,e))}return e},e$=e=>"string"==typeof e?e.replace(" ","T"):e,eU=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};var eB=e=>"function"==typeof e?e:function(){return e},eF="u">typeof window?window:null,eH=("u">typeof self?self:null)||eF||globalThis,eW="closed",eq="errored",ez="joined",eV="joining",eK="leaving",eG="phx_close",eJ="phx_error",eY="phx_reply",eX="phx_leave",eQ="websocket",eZ="base64url.bearer.phx.",e0=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),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,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},e1=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},e2=class{constructor(e,t,r){this.state=eW,this.topic=e,this.params=eB(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new e0(this,"phx_join",this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new e1(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=ez,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=eq,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=eW,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=eq,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new e0(this,eX,eB({}),this.timeout).send(),this.state=eq,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(eY,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(!this.joinedOnce)return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush;throw Error("tried to join multiple times. 'join' can only be called a single time per channel instance")}
6teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=eW,this.bindings=[]}onClose(e){this.on(eG,e)}onError(e){return this.on(eJ,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>r.event!==e||void 0!==t&&t!==r.ref)}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new e0(this,e,function(){return t},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=eK;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(eG,"leave")},r=new e0(this,eX,eB({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,n){return this.topic===e&&(!n||n===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=eV,this.joinPush.resend(e))}trigger(e,t,r,n){let s=this.onMessage(e,t,r,n);if(t&&!s)throw Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(n=>n.event===e&&this.filterBindings(n,t,r));for(let e=0;e<i.length;e++)i[e].callback(s,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===eW}isErrored(){return this.state===eq}isJoined(){return this.state===ez}isJoining(){return this.state===eV}isLeaving(){return this.state===eK}},e5=class{static request(e,t,r,n,s,i,a){if(eH.XDomainRequest){let r=new eH.XDomainRequest;return this.xdomainRequest(r,e,t,n,s,i,a)}if(eH.XMLHttpRequest){let o=new eH.XMLHttpRequest;return this.xhrRequest(o,e,t,r,n,s,i,a)}if(eH.fetch&&eH.AbortController)return this.fetchRequest(e,t,r,n,s,i,a);throw Error("No suitable XMLHttpRequest implementation found")}static fetchRequest(e,t,r,n,s,i,a){let o={method:e,headers:r,body:n},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),o.signal=l.signal),eH.fetch(t,o).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>a&&a(e)).catch(e=>{"AbortError"===e.name&&i?i():a&&a(null)}),l}static xdomainRequest(e,t,r,n,s,i,a){return e.timeout=s,e.open(t,r),e.onload=()=>{let t=this.parseJSON(e.responseText);a&&a(t)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,s,i,a,o){for(let[s,a]of(e.open(t,r,!0),e.timeout=i,Object.entries(n)))e.setRequestHeader(s,a);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{4===e.readyState&&o&&o(this.parseJSON(e.responseText))},a&&(e.ontimeout=a),e.send(s),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,i=e[n];"object"==typeof i?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},e8=class{constructor(e,t){t&&2===t.length&&t[1].startsWith(eZ)&&(this.authToken=atob(t[1].slice(eZ.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=0,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(RegExp("(.*)/"+eQ),"$1/longpoll")}endpointURL(){return e5.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=0}
6ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return 1===this.readyState||0===this.readyState}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:r,messages:n}=e;if(410===t&&null!==this.token){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else t=0;switch(t){case 200:n.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=1,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=(e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let e=0;e<n;e++)t+=String.fromCharCode(r[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>
6this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,r){for(let e of this.reqs)e.abort();this.readyState=3;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"u">typeof CloseEvent?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n,s){let i,a=()=>{this.reqs.delete(i),n()};i=e5.request(e,this.endpointURL(),t,r,this.timeout,a,e=>{this.reqs.delete(i),this.isActive()&&s(e)}),this.reqs.add(i)}},e4=class e{constructor(t,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,t=>{let{onJoin:r,onLeave:n,onSync:s}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,r,n),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,r,n)}),this.pendingDiffs=[],s()}),this.channel.on(n.diff,t=>{let{onJoin:r,onLeave:n,onSync:s}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,r,n),s())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,r,n){let s=this.clone(e),i={},a={};return this.map(s,(e,r)=>{t[e]||(a[e]=r)}),this.map(t,(e,t)=>{let r=s[e];if(r){let n=t.metas.map(e=>e.phx_ref),s=r.metas.map(e=>e.phx_ref),o=t.metas.filter(e=>0>s.indexOf(e.phx_ref)),l=r.metas.filter(e=>0>n.indexOf(e.phx_ref));o.length>0&&(i[e]=t,i[e].metas=o),l.length>0&&(a[e]=this.clone(r),a[e].metas=l)}else i[e]=t}),this.syncDiff(s,{joins:i,leaves:a},r,n)}static syncDiff(e,t,r,n){let{joins:s,leaves:i}=this.clone(t);return r||(r=function(){}),n||(n=function(){}),this.map(s,(t,n)=>{let s=e[t];if(e[t]=this.clone(n),s){let r=e[t].metas.map(e=>e.phx_ref),n=s.metas.filter(e=>0>r.indexOf(e.phx_ref));e[t].metas.unshift(...n)}r(t,s,n)}),this.map(i,(t,r)=>{let s=e[t];if(!s)return;let i=r.metas.map(e=>e.phx_ref);s.metas=s.metas.filter(e=>0>i.indexOf(e.phx_ref)),n(t,s,r),0===s.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,r)=>t(e,r))}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static clone(e){return JSON.parse(JSON.stringify(e))}},e3={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){return e.payload.constructor===ArrayBuffer?t(this.binaryEncode(e)):t(JSON.stringify([e.join_ref,e.ref,e.topic,e.event,e.payload]))},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,s,i,a]=JSON.parse(e);return t({join_ref:r,ref:n,topic:s,event:i,payload:a})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:s,payload:i}=e,a=this.META_LENGTH+t.length+r.length+s.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,r.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(r,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0)));var c=new Uint8Array(o.byteLength+i.byteLength);return c.set(new Uint8Array(o),0),c.set(new Uint8Array(i),o.byteLength),c.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=r.decode(e.slice(a,a+n));a+=n;let l=r.decode(e.slice(a,a+s));a+=s;let u=r.decode(e.slice(a,a+i));return a+=i,{join_ref:o,ref:null,topic:l,event:u,payload:e.slice(a,e.byteLength)}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(e.slice(o,o+n));o+=n;let u=r.decode(e.slice(o,o+s));o+=s;let c=r.decode(e.slice(o,o+i));o+=i;let h=r.decode(e.slice(o,o+a));return o+=a,{join_ref:l,ref:u,topic:c,event:eY,payload:{status:h,response:e.slice(o,e.byteLength)}}},decodeBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,a=r.decode(e.slice(i,i+n));i+=n;let o=r.decode(e.slice(i,i+s));return i+=s,{join_ref:null,ref:null,topic:a,event:o,payload:e.slice(i,e.byteLength)}}},e6=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||1e4,this.transport=t.transport||eH.WebSocket||e8,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=eH&&eH.sessionStorage}catch{}this.sessionStore=t.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=e3.encode.bind(e3),this.defaultDecoder=e3.decode.bind(e3),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==e8?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;eF&&eF.addEventListener&&(eF.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),n=this.connectClock)}),eF.addEventListener("pageshow",e=>{n===this.connectClock&&(n=null,this.connect())}),eF.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,r)=>{console.log(`${e}: ${t}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=eB(t.params||{}),this.endPoint=`${e}/${eQ}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new e1(()=>
6{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return e8}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=e5.appendParams(e5.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=eB(e)),(!this.conn||this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==e8?this.connectWithF
6allback(e8,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(s=>{s.ref===t&&(this.off([n]),e(Date.now()-r))});return!0}transportName(e){return e===e8?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${eZ}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,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)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){let r,n;clearTimeout(this.fallbackTimer);let s=!1,i=!0,a=this.transportName(e),o=t=>{this.log("transport",`falling back to ${a}...`,t),this.off([r,n]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),n=this.onError(e=>{this.log("transport","error",e),i&&!s&&(clearTimeout(this.fallbackTimer),o(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!i){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&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.triggerChanError(Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();let n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){5!==r&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r):t()}waitForSocketClosed(e,t,r=1){5===r||3===e.readyState?t():setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError(e)}
6triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(eJ,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case 0:return"connecting";case 1:return"open";case 2:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let r=new e2(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:s,join_ref:i}=e;this.log("push",`${t} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef)return void this.heartbeatTimeout();this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),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.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:r,payload:n,ref:s,join_ref:i}=e;if(s&&s===this.pendingHeartbeatRef){let e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===n.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${n.status||""} ${t} ${r} ${s&&"("+s+")"||""}`.trim(),n);for(let e=0;e<this.channels.length;e++){let a=this.channels[e];a.isMember(t,r,n,i)&&a.trigger(r,n,s,i)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class e9{constructor(e,t){const r=function(e){return(null==e?void 0:e.events)&&{events:e.events}}(t);this.presence=new e4(e.getChannel(),r),this.presence.onJoin((t,r,n)=>{let s=e9.onJoinPayload(t,r,n);e.getChannel().trigger("presence",s)}),this.presence.onLeave((t,r,n)=>{let s=e9.onLeavePayload(t,r,n);e.getChannel().trigger("presence",s)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return e9.transformState(this.presence.state)}static transformState(e){return Object.getOwnPropertyNames(e=JSON.parse(JSON.stringify(e))).reduce((t,r)=>{let n=e[r];return t[r]=e7(n),t},{})}static onJoinPayload(e,t,r){return{event:"join",key:e,currentPresences:te(t),newPresences:e7(r)}}static onLeavePayload(e,t,r){return{event:"leave",key:e,currentPresences:te(t),leftPresences:e7(r)}}}function e7(e){return e.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function te(e){return(null==e?void 0:e.metas)?e7(e):[]}(a=d||(d={})).SYNC="sync",a.JOIN="join",a.LEAVE="leave";class tt{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new e9(this.channel.channelAdapter,t)}}class tr{constructor(e,t,r){const n=function(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}(r);this.channel=e.getSocket().channel(t,n),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,t){return this.channel.on(e,t)}off(e,t){this.channel.off(e,t)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,t,r){let n;try{n=this.channel.push(e,t,r)}catch(t){throw Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>100){let e=this.channel.pushBuffer.shift();e.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload())}return n}updateJoinPayload(e){let t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),e)}canPush(){return this.socket.isConnected()&&this.state===eT}isJoined(){return this.state===eT}isJoining(){return"joining"===this.state}isClosed(){return"closed"===this.state}isLeaving(){return"leaving"===this.state}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}(o=f||(f={})).ALL="*",o.INSERT="INSERT",o.UPDATE="UPDATE",o.DELETE="DELETE",(l=p||(p={})).BROADCAST="broadcast",l.PRESENCE="presence",l.POSTGRES_CHANGES="postgres_changes",l.SYSTEM="system",(u=g||(g={})).SUBSCRIBED="SUBSCRIBED",u.TIMED_OUT="TIMED_OUT",u.CLOSED="CLOSED",u.CHANNEL_ERROR="CHANNEL_ERROR";class tn{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},r){var n,s;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},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.channelAdapter=new tr(this.socket.socketAdapter,e,this.params),this.presence=new tt(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=eU(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null==(s=null==(n=this.params.config)?void 0:n.broadcast)?void 0:s.replay))throw Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,n,s;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){let{config:{broadcast:i,presence:a,private:o}}=this.params,l=null!=(n=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?n:[],u=!!this.bindings[p.PRESENCE]&&this.bindings[p.PRESENCE].length>0||(null==(s=this.params.config.presence)?void 0:s.enabled)===!0,c={},h={broadcast:i,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:l,private:o};this.socket.accessTokenValue&&(c.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(g.CHANNEL_ERROR,function(e){if(e instanceof Error)return e;if("string"==typeof e)return Error(e);
6if(e&&"object"==typeof e){if("number"==typeof e.code){let t="string"==typeof e.reason&&e.reason?` (${e.reason})`:"";return Error(`socket closed: ${e.code}${t}`,{cause:e})}return Error("channel error: transport failure",{cause:e})}return Error("channel error: connection lost")}(t))}),this._onClose(()=>null==e?void 0:e(g.CLOSED)),this.updateJoinPayload(Object.assign({config:h},c)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive("ok",async({postgres_changes:t})=>{if(this.socket._isManualToken()||this.socket.setAuth(),void 0===t){null==e||e(g.SUBSCRIBED);return}this._updatePostgresBindings(t,e)}).receive("error",t=>{this.state=e_;let r=Object.values(t).join(", ")||"error";null==e||e(g.CHANNEL_ERROR,Error(r,{cause:t}))}).receive("timeout",()=>{null==e||e(g.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var r;let n=this.bindings.postgres_changes,s=null!=(r=null==n?void 0:n.length)?r:0,i=[];for(let r=0;r<s;r++){let s=n[r],{filter:{event:a,schema:o,table:l,filter:u}}=s,c=e&&e[r];if(c&&c.event===a&&tn.isFilterValueEqual(c.schema,o)&&tn.isFilterValueEqual(c.table,l)&&tn.isFilterValueEqual(c.filter,u))i.push(Object.assign(Object.assign({},s),{id:c.id}));else{this.unsubscribe(),this.state=e_,null==t||t(g.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=i,this.state!=e_&&t&&t(g.SUBSCRIBED)}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){let n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),s=e===p.PRESENCE||e===p.POSTGRES_CHANGES;if(n&&s)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,t,r)}async httpSend(e,t,r={}){var n;if(null==t)return Promise.reject(Error("Payload is required for httpSend()"));let s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);let i={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,i,null!=(n=r.timeout)?n: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,n;if(this.channelAdapter.canPush()||"broadcast"!==e.type)return new Promise(r=>{var n,s,i;let a=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(i=null==(s=null==(n=this.params)?void 0:n.config)?void 0:s.broadcast)?void 0:i.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
6in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:i}=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:s,payload:i,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!=(r=t.timeout)?r:this.timeout);return await (null==(n=e.body)?void 0:n.cancel()),e.ok?"ok":"error"}catch(e){if(e instanceof Error&&"AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>t("ok")).receive("timeout",()=>t("timed out")).receive("error",()=>t("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,r){let n=new AbortController,s=setTimeout(()=>n.abort(),r),i=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(s),i}_on(e,t,r){let n=e.toLocaleLowerCase(),s=this.channelAdapter.on(e,r),i={type:n,filter:t,callback:r,ref:s};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,r)=>{var n,s,i,a,o,l,u;let c=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(c,r))return!1;let h=null==(n=this.bindings[c])?void 0:n.find(t=>t.ref===e.ref);if(!h)return!0;if(!["broadcast","presence","postgres_changes"].includes(c))return h.type.toLocaleLowerCase()===c;if("id"in h){let e=h.id,r=null==(s=h.filter)?void 0:s.event;return e&&(null==(i=t.ids)?void 0:i.includes(e))&&("*"===r||(null==r?void 0:r.toLocaleLowerCase())===(null==(a=t.data)?void 0:a.type.toLocaleLowerCase()))}{let e=null==(l=null==(o=null==h?void 0:h.filter)?void 0:o.event)?void 0:l.toLocaleLowerCase();return"*"===e||e===(null==(u=null==t?void 0:t.event)?void 0:u.toLocaleLowerCase())}})}_notThisChannelEvent(e,t){let{close:r,error:n,leave:s,join:i}=eC;return t&&[r,n,s,i].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,r)=>{if("object"==typeof t&&"ids"in t){let e=t.data,{schema:r,table:n,commit_timestamp:s,type:i,errors:a}=e;return Object.assign(Object.assign({},{schema:r,table:n,commit_timestamp:s,eventType:i,new:{},old:{},errors:a}),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw Error("cannot copy bindings into joined channel");for(let t in e.bindings)for(let r of e.bindings[t])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=eA(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=eA(e.columns,e.old_record)),t}}class ts{constructor(e,t){this.socket=new e6(e,t)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,t,r,n=1e4){return new Promise(s=>{setTimeout(()=>s("timeout"),n),this.socket.disconnect(()=>{e(),s("ok")},t,r)})}push(e){this.socket.push(e)}log(e,t,r){this.socket.log(e,t,r)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return"connecting"==this.socket.connectionState()}isDisconnecting(){return"closing"==this.socket.connectionState()}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}let ti=[1e3,2e3,5e3,1e4],ta=` 7 addEventListener("message", (e) => { 8 if (e.data.event === "start") { 9 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 10 } 11 });`;class to{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var r;if(this.channels=[],this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
11,this.ref=0,this.serializer=new eO,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,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;const n=this._initializeOptions(t);this.socketAdapter=new ts(e,n),this.httpEndpoint=eU(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){let e=t.message;if(e.includes("Node.js"))throw Error(`${e} 12 13To use Realtime in Node.js, you need to provide a WebSocket implementation: 14 15Option 1: Use Node.js 22+ which has native WebSocket support 16Option 2: Install and provide the "ws" package: 17 18 npm install ws 19 20 import ws from "ws" 21 const client = new RealtimeClient(url, { 22 ...options, 23 transport: ws 24 })`);throw Error(`WebSocket not available: ${e}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return(this._cancelPendingDisconnect(),this.isDisconnecting())?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return"ok"===t&&e.teardown(),t}async removeAllChannels(){let e=this.channels.map(async e=>{let t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,r){this.socketAdapter.log(e,t,r)}connectionState(){return this.socketAdapter.connectionState()||"closed"}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){let r=`realtime:${e}`,n=this.getChannels().find(e=>e.topic===r);if(n)return n;{let r=new tn(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(r),r}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
24this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}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.forEach(e=>{let r={access_token:t,version:"realtime-js/2.106.1"};t&&e.updateJoinPayload(r),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(eC.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)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log("error","error waiting for auth on connect",e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,r)=>{"sent"==t&&this._setAuthSafely(),e&&e(t,r)}}_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.disconnect()},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)}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([ta],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var t,r,n,s,i,a,o,l,u,c,h,d;let f,p;this.worker=null!=(t=null==e?void 0:e.worker)&&t,this.accessToken=null!=(r=null==e?void 0:e.accessToken)?r:null;let g={};g.timeout=null!=(n=null==e?void 0:e.timeout)?n:1e4,g.heartbeatIntervalMs=null!=(s=null==e?void 0:e.heartbeatIntervalMs)?s:25e3,this._disconnectOnEmptyChannelsAfterMs=null!=(i=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)?i:2*(null!=(a=null==e?void 0:e.heartbeatIntervalMs)?a:25e3),g.transport=null!=(o=null==e?void 0:e.transport)?o:eS.getWebSocketConstructor(),g.params=null==e?void 0:e.params,g.logger=null==e?void 0:e.logger,g.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),g.sessionStorage=null!=(l=null==e?void 0:e.sessionStorage)?l:function(){let e;try{if("u">typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return e=new Map,{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var r;return null!=(r=Array.from(e.keys())[t])?r:null},removeItem(t){e.delete(t)},setItem(t,r){e.set(t,String(r))}}}(),g.reconnectAfterMs=null!=(u=null==e?void 0:e.reconnectAfterMs)?u:e=>ti[e-1]||1e4;let m=null!=(c=null==e?void 0:e.vsn)?c:eR;switch(m){case"1.0.0":f=(e,t)=>t(JSON.stringify(e)),p=(e,t)=>t(JSON.parse(e));break;case eR:f=this.serializer.encode.bind(this.serializer),p=this.serializer.decode.bind(this.serializer);break;default:throw Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=m,g.encode=null!=(h=null==e?void 0:e.encode)?h:f,g.decode=null!=(d=null==e?void 0:e.decode)?d:p,g.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,g.params=Object.assign(Object.assign({},g.params),{log_level:this.logLevel})),this.worker){if("u">typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl,g.autoSendHeartbeat=!this.worker}return g}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
24var tl=e.i(20683),tu=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 tc(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 th(e){return e.join("\x1f")}var td=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){let t=e?{parent:th(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/${th(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${th(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${th(e.namespace)}`}),!0}catch(e){if(e instanceof tu&&404===e.status)return!1;throw e}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(e){if(e instanceof tu&&409===e.status)return;throw e}}};function tf(e){return e.join("\x1f")}var tp=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/${tf(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/${tf(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/${tf(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/${tf(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/${tf(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/${tf(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(e){if(e instanceof tu&&404===e.status)return!1;throw e}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof tu&&409===r.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},tg=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:n,query:s,body:i,headers:a}){let o=function(e,t,r){let n=new URL(t,e);if(r)for(let[e,t]of Object.entries(r))void 0!==t&&n.searchParams.set(e,t);return n.toString()}(e.baseUrl,n,s),l=await tc(e.auth),u=await t(o,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...a},body:i?JSON.stringify(i):void 0}),c=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),d=h&&c?JSON.parse(c):c;if(!u.ok){let e=h?d:void 0,t=e?.error;throw new tu(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 td(this.client,t),this.tableOps=new tp(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)}
24async 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)}};function tm(e){return(tm="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 ty(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function tb(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ty(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=tm(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=tm(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==tm(n)?n:n+"")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)):ty(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var tv=class extends Error{constructor(e,t="storage",r,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name="vectors"===t?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function tw(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}var tx=class extends tv{constructor(e,t,r,n="storage"){super(e,n,t,r),this.name="vectors"===n?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return tb({},super.toJSON())}},tE=class extends tv{constructor(e,t,r="storage"){super(e,r),this.name="vectors"===r?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function tk(e,t,r){let n=tb({},e),s=t.toLowerCase();for(let e of Object.keys(n))e.toLowerCase()===s&&delete n[e];return n[s]=r,n}let tS=e=>{if(Array.isArray(e))return e.map(e=>tS(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,""))]=tS(r)}),t},tR=e=>{if("object"==typeof e&&null!==e){if("string"==typeof e.msg)return e.msg;if("string"==typeof e.message)return e.message;if("string"==typeof e.error_description)return e.error_description;if("string"==typeof e.error)return e.error;if("object"==typeof e.error&&null!==e.error){let t=e.error;if("string"==typeof t.message)return t.message}}return JSON.stringify(e)},t_=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){let r=parseInt(String(e.status),10);Number.isFinite(r)||(r=500),e.json().then(e=>{let s=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||r+"";t(new tx(tR(e),r,s,n))}).catch(()=>{let s=r+"";t(new tx(e.statusText||`HTTP ${r} error`,r,s,n))})}else t(new tE(tR(e),e,n))};async function tT(e,t,r,n,s,i,a){return new Promise((o,l)=>{e(r,((e,t,r,n)=>{let s={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return tb(tb({},s),r);if((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)){var i;let e,r=(null==t?void 0:t.headers)||{};for(let[t,n]of Object.entries(r))"content-type"===t.toLowerCase()&&(e=n);s.headers=tk(r,"Content-Type",null!=(i=e)?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return(null==t?void 0:t.duplex)&&(s.duplex=t.duplex),tb(tb({},s),r)})(t,n,s,i)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===a){let t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status||!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>o(e)).catch(e=>t_(e,l,n,a))})}function tC(e="storage"){return{get:async(t,r,n,s)=>tT(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,i)=>tT(t,"POST",r,s,i,n,e),put:async(t,r,n,s,i)=>tT(t,"PUT",r,s,i,n,e),head:async(t,r,n,s)=>tT(t,"HEAD",r,tb(tb({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,i)=>tT(t,"DELETE",r,s,i,n,e)}}let{get:tO,post:tA,put:tP,head:tI,remove:tj}=tC("storage"),tN=tC("vectors");var tL=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=function(e){let t={};for(let[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}(t),this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=tk(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tw(e))return{data:null,error:e};throw e}}};r=Symbol.toStringTag;var tM=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[r]="StreamDownloadBuilder",this.promise=null}
24then(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 this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tw(e))return{data:null,error:e};throw e}}};n=Symbol.toStringTag;var tD=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[n]="BlobDownloadBuilder",this.promise=null}asStream(){return new tM(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(tw(e))return{data:null,error:e};throw e}}};let t$={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},tU={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var tB=class extends tL{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var s=this;return s.handleOperation(async()=>{let i,a=tb(tb({},tU),n),o=tb(tb({},s.headers),"POST"===e&&{"x-upsert":String(a.upsert)}),l=a.metadata;if("u">typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",a.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):"u">typeof FormData&&r instanceof FormData?((i=r).has("cacheControl")||i.append("cacheControl",a.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=s.toBase64(s.encodeMetadata(l))),("u">typeof ReadableStream&&i instanceof ReadableStream||i&&"object"==typeof i&&"pipe"in i&&"function"==typeof i.pipe)&&!a.duplex&&(a.duplex="half")),null==n?void 0:n.headers)for(let[e,t]of Object.entries(n.headers))o=tk(o,e,t);let u=s._removeEmptyFolders(t),c=s._getFinalPath(u),h=await ("PUT"==e?tP:tA)(s.fetch,`${s.url}/object/${c}`,i,tb({headers:o},(null==a?void 0:a.duplex)?{duplex:a.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;let i=s._removeEmptyFolders(e),a=s._getFinalPath(i),o=new URL(s.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),s.handleOperation(async()=>{let e,t=tb(tb({},tU),n),a=tb(tb({},s.headers),{"x-upsert":String(t.upsert)}),l=t.metadata;if("u">typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),l&&e.append("metadata",s.encodeMetadata(l)),e.append("",r)):"u">typeof FormData&&r instanceof FormData?((e=r).has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",s.encodeMetadata(l))):(e=r,a["cache-control"]=`max-age=${t.cacheControl}`,a["content-type"]=t.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),("u">typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(let[e,t]of Object.entries(n.headers))a=tk(a,e,t);return{path:i,fullPath:(await tP(s.fetch,o.toString(),e,tb({headers:a},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e),s=tb({},r.headers);(null==t?void 0:t.upsert)&&(s["x-upsert"]="true");let i=await tA(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),a=new URL(r.url+i.url),o=a.searchParams.get("token");if(!o)throw new tv("No token returned by API");return{signedUrl:a.toString(),path:e,token:o}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await tA(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,de
24stinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await tA(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(e),i="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0,a=await tA(n.fetch,`${n.url}/object/sign/${s}`,tb({expiresIn:t},i?{transform:r.transform}:{}),{headers:n.headers}),o=new URLSearchParams;(null==r?void 0:r.download)&&o.set("download",!0===r.download?"":r.download),(null==r?void 0:r.cacheNonce)!=null&&o.set("cacheNonce",String(r.cacheNonce));let l=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{let s=await tA(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),i=new URLSearchParams;(null==r?void 0:r.download)&&i.set("download",!0===r.download?"":r.download),(null==r?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));let a=i.toString();return s.map(e=>tb(tb({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,r){let n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(s,t.transform),(null==t?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));let i=s.toString(),a=this._getFinalPath(e);return new tD(()=>tO(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;let r=t._getFinalPath(e);return t.handleOperation(async()=>tS(await tO(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t;let r=this._getFinalPath(e);try{return await tI(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(tw(e)){let r=e instanceof tx?e.status:e instanceof tE?null==(t=e.originalError)?void 0:t.status:void 0;if(void 0!==r&&[400,404].includes(r))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){let r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),(null==t?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));let s=n.toString(),i="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await tj(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var n=this;return n.handleOperation(async()=>{let s=tb(tb(tb({},t$),t),{},{prefix:e||""});return await tA(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{let n=tb({},e);return await tA(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==tl.Buffer?tl.Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};let tF={"X-Client-Info":"storage-js/2.106.1"};var tH=class extends tL{constructor(e,t={},r,n){const s=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),super(s.href.replace(/\/$/,""),tb(tb({},tF),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{let r=t.listBucketOptionsToQueryString(e);return await tO(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await tO(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await tA(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await tP(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await tA(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await tj(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}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():""}},tW=class extends tL{constructor(e,t={},r){super(e.replace(/\/$/,""),tb(tb({},tF),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await tA(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{let r=new URLSearchParams;(null==e?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(null==e?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);let n=r.toString(),s=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await tO(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await tj(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}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 tv("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 tg({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=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(n)throw e;return{data:null,error:e}}}}})}},tq=class extends tL{constructor(e,t={},r){super(e.replace(/\/$/,""),tb(tb({},tF),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await tN.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await tN.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},tz=class extends tL{constructor(e,t={},r){super(e.replace(/\/$/,""),tb(tb({},tF),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw Error("segmentCount must be between 1 and 16");
24if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},tV=class extends tL{constructor(e,t={},r){super(e.replace(/\/$/,""),tb(tb({},tF),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await tN.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},tK=class extends tV{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new tG(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)}},tG=class extends tq{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return super.createIndex.call(this,tb(tb({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return super.listIndexes.call(this,tb(tb({},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 tJ(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},tJ=class extends tz{constructor(e,t,r,n,s){super(e,t,s),this.vectorBucketName=r,this.indexName=n}async putVectors(e){return super.putVectors.call(this,tb(tb({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async getVectors(e){return super.getVectors.call(this,tb(tb({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async listVectors(e={}){return super.listVectors.call(this,tb(tb({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async queryVectors(e){return super.queryVectors.call(this,tb(tb({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}async deleteVectors(e){return super.deleteVectors.call(this,tb(tb({},e),{},{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))}},tY=class extends tH{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new tB(this.url,this.headers,e,this.fetch)}get vectors(){return new tK(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new tW(this.url+"/iceberg",this.headers,this.fetch)}};let tX="2.106.1",tQ={"X-Client-Info":`gotrue-js/${tX}`},tZ="X-Supabase-Api-Version",t0={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},t1=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;class t2 extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function t5(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class t8 extends t2{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class t4 extends t2{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class t3 extends t2{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class t6 extends t3{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function t9(e){return t5(e)&&"AuthSessionMissingError"===e.name}class t7 extends t3{constructor(){super("Auth session or user missing","AuthInvalidToken
24ResponseError",500,void 0)}}class re extends t3{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class rt extends t3{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class rr extends t3{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class rn extends t3{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 rs extends t3{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function ri(e){return t5(e)&&"AuthRetryableFetchError"===e.name}class ra extends t3{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class ro extends t3{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let rl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ru=" \n\r=".split(""),rc=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<ru.length;t+=1)e[ru[t].charCodeAt(0)]=-2;for(let t=0;t<rl.length;t+=1)e[rl[t].charCodeAt(0)]=t;return e})();function rh(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(rl[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(rl[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function rd(e,t,r){let n=rc[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===n)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function rf(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=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,n,r)};for(let t=0;t<e.length;t+=1)rd(e.charCodeAt(t),s,i);return t.join("")}function rp(e){let t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)rd(e.charCodeAt(t),r,n);return new Uint8Array(t)}function rg(e){let t=[],r={queue:0,queuedBits:0},n=e=>{t.push(e)};return e.forEach(e=>rh(e,r,n)),rh(null,r,n),t.join("")}let rm=()=>"u">typeof window&&"u">typeof document,ry={tested:!1,writable:!1},rb=()=>{if(!rm())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(ry.tested)return ry.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),ry.tested=!0,ry.writable=!0}catch(e){ry.tested=!0,ry.writable=!1}return ry.writable},rv=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),rw=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},rx=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return null}},rE=async(e,t)=>{await e.removeItem(t)};class rk{constructor(){this.promise=new rk.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function rS(e){let t=e.split(".");if(3!==t.length)throw new ro("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!t1.test(t[e]))throw new ro("JWT not in base64url format");return{header:JSON.parse(rf(t[0])),payload:JSON.parse(rf(t[1])),signature:rp(t[2]),raw:{header:t[0],payload:t[1]}}}async function rR(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function r_(e){return("0"+e.toString(16)).substr(-2)}async function rT(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 rC(e){return"u">typeof crypto&&void 0!==crypto.subtle&&"u">typeof TextEncoder?btoa(await rT(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):(console.warn("WebCrypto API is not supported. Code
24challenge method will default to use plain instead of sha256."),e)}async function rO(e,t,r=!1){let n=function(){let e=new Uint32Array(56);if("u"<typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let n=0;n<56;n++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,r_).join("")}(),s=n;r&&(s+="/recovery"),await rw(e,`${t}-code-verifier`,s);let i=await rC(n),a=n===i?"plain":"s256";return[i,a]}rk.promiseConstructor=Promise;let rA=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,rP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function rI(e){if(!rP.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function rj(e){if(!e.passkey)throw Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function rN(){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 rL(e){return JSON.parse(JSON.stringify(e))}let rM=e=>{if("object"==typeof e&&null!==e){if("string"==typeof e.msg)return e.msg;if("string"==typeof e.message)return e.message;if("string"==typeof e.error_description)return e.error_description;if("string"==typeof e.error)return e.error}return JSON.stringify(e)},rD=[502,503,504,520,521,522,523,524,530];async function r$(e){var t;let r,n;if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new rs(rM(e),0);if(rD.includes(e.status))throw new rs(rM(e),e.status);try{r=await e.json()}catch(e){throw new t4(rM(e),e)}let s=function(e){let t=e.headers.get(tZ);if(!t||!t.match(rA))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(s&&s.getTime()>=t0["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?n=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(n=r.error_code),n){if("weak_password"===n)throw new ra(rM(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===n)throw new t6}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 ra(rM(r),e.status,r.weak_password.reasons);throw new t8(rM(r),e.status||500,n)}async function rU(e,t,r,n){var s;let i=Object.assign({},null==n?void 0:n.headers);i[tZ]||(i[tZ]=t0["2024-01-01"].name),(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);let a=null!=(s=null==n?void 0:n.query)?s:{};(null==n?void 0:n.redirectTo)&&(a.redirect_to=n.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await rB(e,t,r+o,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function rB(e,t,r,n,s,i){let a,o,l=(o={method:t,headers:(null==n?void 0:n.headers)||{}},"GET"===t?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"}
24,null==n?void 0:n.headers),o.body=JSON.stringify(i),Object.assign(Object.assign({},o),s)));try{a=await e(r,Object.assign({},l))}catch(e){throw console.error(e),new rs(rM(e),0)}if(a.ok||await r$(a),null==n?void 0:n.noResolveJson)return a;try{return await a.json()}catch(e){await r$(e)}}function rF(e){var t,r,n;let s=null;(n=e).access_token&&n.refresh_token&&n.expires_in&&(s=Object.assign({},e),e.expires_at||(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:s,user:null!=(t=e.user)?t:null},error:null}}function rH(e){let t=rF(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)=>e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function rW(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function rq(e){return{data:e,error:null}}function rz(e){let{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},user:Object.assign({},el(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function rV(e){return e}let rK=["global","local","others"];class rG{_encodePathSegment(e){if("."===e||".."===e)throw new t2("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:t={},fetch:r,experimental:n}){this.url=e,this.headers=t,this.fetch=rv(r),this.experimental=null!=n?n:{},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)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,t=rK[0]){if(0>rK.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${rK.join(", ")}`);try{return await rU(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(t5(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await rU(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:rW})}catch(e){if(t5(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=el(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=null==r?void 0:r.newEmail,delete n.newEmail),await rU(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:rz,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(t5(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await rU(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:rW})}catch(e){if(t5(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,n,s,i,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await rU(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!=(s=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?s:""},xform:rV});if(u.error)throw u.error;let c=await u.json(),h=null!=(i=u.headers.get("x-total-count"))?i: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(h)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(t5(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){rI(e);try{return await rU(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:rW})}catch(e){if(t5(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){rI(e);try{return await rU(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:rW})}catch(e){if(t5(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){rI(e);
24try{return await rU(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:rW})}catch(e){if(t5(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){rI(e.userId);try{let{data:t,error:r}=await rU(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(t5(e))return{data:null,error:e};throw e}}async _deleteFactor(e){rI(e.userId),rI(e.id);try{return{data:await rU(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,r,n,s,i,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await rU(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!=(s=null==(n=null==e?void 0:e.perPage)?void 0:n.toString())?s:""},xform:rV});if(u.error)throw u.error;let c=await u.json(),h=null!=(i=u.headers.get("x-total-count"))?i: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(h)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(t5(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await rU(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{let t=this._encodePathSegment(e);return await rU(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _updateOAuthClient(e,t){try{let r=this._encodePathSegment(e);return await rU(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${r}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{let t=this._encodePathSegment(e);return await rU(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{let t=this._encodePathSegment(e);return await rU(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _listCustomProviders(e){try{let t={};return(null==e?void 0:e.type)&&(t.type=e.type),await rU(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:t,xform:e=>{var t;return{data:{providers:null!=(t=null==e?void 0:e.providers)?t:[]},error:null}}})}catch(e){if(t5(e))return{data:{providers:[]},error:e};throw e}}async _createCustomProvider(e){try{return await rU(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _getCustomProvider(e){try{let t=this._encodePathSegment(e);return await rU(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _updateCustomProvider(e,t){try{let r=this._encodePathSegment(e);return await rU(this.fetch,"PUT",`${this.url}/admin/custom-providers/${r}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _deleteCustomProvider(e){try{let t=this._encodePathSegment(e);return await rU(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _adminListPasskeys(e){rj(this.experimental),rI(e.userId);try{return await rU(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(t5(e))return{data:null,error:e};throw e}}async _adminDeletePasskey(e){rj(this.experimental),rI(e.userId),rI(e.passkeyId);
24try{return await rU(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(t5(e))return{data:null,error:e};throw e}}}function rJ(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let rY={debug:!!(globalThis&&rb()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class rX extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class rQ extends rX{}async function rZ(e,t,r){let n;rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let s=new globalThis.AbortController;t>0&&(n=setTimeout(()=>{s.abort(),rY.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async s=>{if(s){clearTimeout(n),rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await r()}finally{rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}if(0===t)throw rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new rQ(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(rY.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"),clearTimeout(n),await r()})}catch(i){if(t>0&&clearTimeout(n),null!==i&&"object"==typeof i&&"name"in i&&"AbortError"===i.name&&t>0)if(s.signal.aborted)return rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async t=>{if(!t)return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r();rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,t.name);try{return await r()}finally{rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,t.name)}}));else throw rY.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new rQ(`Lock "${e}" was released because another request stole it`);throw i}}function r0(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}class r1 extends Error{constructor({message:e,code:t,cause:r,name:n}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!=(s=null!=n?n:r instanceof Error?r.name:void 0)?s:"Unknown Error",this.code=t}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class r2 extends r1{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}let r5=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 r8(e){if(!e)throw Error("Credential creation options are required");if("u">typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:r,excludeCredentials:n}=e,s=el(e,["challenge","user","excludeCredentials"]),i=rp(t).buffer,a=Object.assign(Object.assign({},r),{id:rp(r.id).buffer}),o=Object.assign(Object.assign({}
24,s),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e];o.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:rp(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return o}function r4(e){if(!e)throw Error("Credential request options are required");if("u">typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:r}=e,n=el(e,["challenge","allowCredentials"]),s=rp(t).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];i.allowCredentials[e]=Object.assign(Object.assign({},t),{id:rp(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return i}function r3(e){var t;return"toJSON"in e&&"function"==typeof e.toJSON?e.toJSON():{id:e.id,rawId:e.id,response:{attestationObject:rg(new Uint8Array(e.response.attestationObject)),clientDataJSON:rg(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}function r6(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();let r=e.getClientExtensionResults(),n=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:rg(new Uint8Array(n.authenticatorData)),clientDataJSON:rg(new Uint8Array(n.clientDataJSON)),signature:rg(new Uint8Array(n.signature)),userHandle:n.userHandle?rg(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}function r9(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function r7(){var e,t;return!!(rm()&&"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 ne(e){try{let t=await navigator.credentials.create(e);if(!t)return{data:null,error:new r2("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new r2("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){var r,n,s;let{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new r1({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if((null==(r=i.authenticatorSelection)?void 0:r.requireResidentKey)===!0)return new r1({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==(n=i.authenticatorSelection)?void 0:n.userVerification)==="required")return new r1({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==(s=i.authenticatorSelection)?void 0:s.userVerification)==="required")return new r1({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 r1({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new r1({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new r1(0===i.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(!r9(t))return new r1({message:`${window.location.hostname}
24 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(i.rp.id!==t)return new r1({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new r1({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 r1({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 r1({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}async function nt(e){try{let t=await navigator.credentials.get(e);if(!t)return{data:null,error:new r2("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new r2("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 r1({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new r1({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!r9(t))return new r1({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new r1({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 r1({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 r1({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}let nr={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},nn={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function ns(...e){let t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),n={};for(let s of e)if(s)for(let e in s){let i=s[e];if(void 0!==i)if(Array.isArray(i))n[e]=i;else if(r(i))n[e]=i;else if(t(i)){let r=n[e];t(r)?n[e]=ns(r,i):n[e]=ns(i)}else n[e]=i}return n}class ni{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:n},s){var i,a,o,l,u;try{let{data:c,error:h}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!c)return{data:null,error:h};let d=null!=n?n:r5.createNewAbortSignal();if("create"===c.webauthn.type){let{user:e}=c.webauthn.credential_options.publicKey;if(!e.name)if(r)e.name=`${e.id}:${r}`;else{let t=(await this.client.getUser()).data.user,r=(null==(i=null==t?void 0:t.user_metadata)?void 0:i.name)||(null==t?void 0:t.email)||(null==t?void 0:t.id)||"User";e.name=`${e.id}:${r}`}e.displayName||(e.displayName=e.name)}switch(c.webauthn.type){case"create":{let t=(a=c.webauthn.credential_options.publicKey,o=null==s?void 0:s.create,ns(nr,a,o||{})),{data:r,error:n}=await ne({publicKey:t,signal:d});if(r)return{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:r}},error:null};return{data:null,error:n}}case"request":{let t=(l=c.webauthn.credential_options.publicKey,u=null==s?void 0:s.request,ns(nn,l,u||{})),{data:r,error:n}=await nt(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:t,signal:d}));if(r)return{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:r}},error:null};return{data:null,error:n}}}}catch(e){if(t5(e))return{data:null,error:e};return{data:null,error:new t4("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="u">typeof window?window.location.hostname:void 0,rpOrigins:r="u">typeof window?[window.location.origin]:void 0,signal:n}={}},s){if(!t)return{data:null,error:new t2("rpId is required for WebAuthn authentication")};try{if(!r7())return{data:null,error:new t4("Browser does not support WebAuthn",null)};let{data:i,error:a}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:n},{request:s});if(!i)return{data:null,error:a};let{webauthn:o}=i;return this._verify({factorId:e,challengeId:i.challengeId,webauthn:{type:o.type,rpId:t,rpOrigins:r,credential_response:o.credential_response}})}catch(e){if(t5(e))return{data:null,error:e};return{data:null,error:new t4("Unexpected error in authenticate",e)}}}async _register({friendlyName:e,webauthn:{rpId:t="u">typeof window?window.location.hostname:void 0,rpOrigins:r="u">typeof window?[window.location.origin]:void 0,signal:n}={}},s){if(!t)return{data:null,error:new t2("rpId is required for WebAuthn registration")};try{if(!r7())return{data:null,error:new t4("Browser does not support WebAuthn",null)};let{data:i,error:a}=await this._enroll({friendlyName:e});if(!i)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:i.id,friendlyName:i.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:n},{create:s});if(!o)return{data:null,error:l};return this._verify({factorId:i.id,challengeId:o.challengeId,webauthn:{rpId:t,rpOrigins:r,type:o.webauthn.type,credential_response:o.webauthn.credential_response}})}catch(e){if(t5(e))return{data:null,error:e};return{data:null,error:new t4("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){"u">typeof self&&(self.globalThis=self)}let na={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:tQ,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function no(e,t,r){return await r()}let nl={};class nu{get jwks(){var e,t;return null!=(t=null==(e=nl[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){nl[this.storageKey]=Object.assign(Object.assign({},nl[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=nl[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){nl[this.storageKey]=Object.assign(Object.assign({},nl[this.storageKey]),{cachedAt:e})}constructor(e){var t,r,n,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({},na),e);if(this.storageKey=i.storageKey,this.instanceID=null!=(t=nu.nextInstanceID[this.storageKey])?t:0,nu.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&rm()){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.experimental=null!=(r=i.experimental)?r:{},this.admin=new rG({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=rv(i.fetch),this.lock=i.lock||no,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&&rm()&&(null==(n=null==globalThis?void 0:globalThis.navigator)?void 0:n.locks)?this.lock=rZ:this.lock=no,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 ni(this)}
24,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.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:rb()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=rJ(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=rJ(this.memoryStorage)),rm()&&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);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug("#broadcastChannel","error",e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug("#initialize()","error",e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${tX}) ${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(rm()&&(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")),rm()&&this.detectSessionInUrl&&"none"!==r){let{data:n,error:s}=await this._getSessionFromURL(t,r);if(s){(this._debug("#_initialize()","error detecting session from URL",s),t5(s)&&"AuthImplicitGrantRedirectError"===s.name)&&(null==(e=s.details)||e.code);return{error:s}}let{session:i,redirectType:a}=n;return this._debug("#_initialize()","detected session in URL",i,"redirect type",a),await this._saveSession(i),setTimeout(async()=>{"recovery"===a?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(t5(e))return this._returnResult({error:e});return this._returnResult({error:new t4("Unexpected error during initialization",e)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{let{data:s,error:i}=await rU(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==(n=null==e?void 0:e.options)?void 0:n.captchaToken}},xform:rF});if(i||!s)return this._returnResult({data:{user:null,session:null},error:i});let a=s.session,o=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",a)),this._returnResult({data:{user:o,session:a},error:null})}catch(e){if(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,r,n;try{let s;if("email"in e){let{email:r,password:n,options:i}=e,a=null,o=null;"pkce"===this.flowType&&([a,o]=await rO(this.storage,this.storageKey)),s=await rU(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==i?void 0:i.emailRedirectTo,body:{email:r,password:n,data:null!=(t=null==i?void 0:i.data)?t:{},gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:a,code_challenge_method:o},xform:rF}
24)}else if("phone"in e){let{phone:t,password:i,options:a}=e;s=await rU(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:i,data:null!=(r=null==a?void 0:a.data)?r:{},channel:null!=(n=null==a?void 0:a.channel)?n:"sms",gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:rF})}else throw new re("You must provide either an email or phone number and a password");let{data:i,error:a}=s;if(a||!i)return await rE(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});let o=i.session,l=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(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:n,options:s}=e;t=await rU(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:rH})}else if("phone"in e){let{phone:r,password:n,options:s}=e;t=await rU(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:rH})}else throw new re("You must provide either an email or phone number and a password");let{data:r,error:n}=t;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!r||!r.session||!r.user){let e=new t7;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:n})}catch(e){if(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,r,n,s;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==(n=e.options)?void 0:n.queryParams,skipBrowserRedirect:null==(s=e.options)?void 0:s.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,n,s,i,a,o,l,u,c,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let c,{chain:h,wallet:g,statement:m,options:y}=e;if(rm())if("object"==typeof g)c=g;else{let e=window;if("ethereum"in e&&"object"==typeof e.ethereum&&"request"in e.ethereum&&"function"==typeof e.ethereum.request)c=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 g||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");c=g}let b=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href),v=await c.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!v||0===v.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let w=r0(v[0]),x=null==(r=null==y?void 0:y.signInWithEthereum)?void 0:r.chainId;x||(x=parseInt(await c.request({method:"eth_chainId"}),16)),f=function(e){var t;let{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:l,resources:u,scheme:c,uri:h,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(!n)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(!h)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 f=r0(e.address),p=c?`${c}://${n}`:n,g=e.statement?`${e.statement} 25`:"",m=`${p} wants you to sign in with your Ethereum account: 26${f} 27 28${g}`,y=`URI: ${h} 29Version: ${d}
30Chain ID: ${r}${a?` 31Nonce: ${a}`:""} 32Issued At: ${i.toISOString()}`;if(s&&(y+=` 33Expiration Time: ${s.toISOString()}`),o&&(y+=` 34Not Before: ${o.toISOString()}`),l&&(y+=` 35Request 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+=` 36- ${t}`}y+=e}return`${m} 37${y}`}({domain:b.host,address:w,statement:m,uri:b.href,version:"1",chainId:x,nonce:null==(n=null==y?void 0:y.signInWithEthereum)?void 0:n.nonce,issuedAt:null!=(i=null==(s=null==y?void 0:y.signInWithEthereum)?void 0:s.issuedAt)?i: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}),p=await c.request({method:"personal_sign",params:[(d=f,"0x"+Array.from(new TextEncoder().encode(d),e=>e.toString(16).padStart(2,"0")).join("")),w]})}try{let{data:t,error:r}=await rU(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},(null==(c=e.options)?void 0:c.captchaToken)?{gotrue_meta_security:{captcha_token:null==(h=e.options)?void 0:h.captchaToken}}:null),xform:rF}
37);if(r)throw r;if(!t||!t.session||!t.user){let e=new t7;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(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,r,n,s,i,a,o,l,u,c,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let h,{chain:d,wallet:g,statement:m,options:y}=e;if(rm())if("object"==typeof g)h=g;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))h=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 g||!(null==y?void 0:y.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");h=g}let b=new URL(null!=(t=null==y?void 0:y.url)?t:window.location.href);if("signIn"in h&&h.signIn){let e,t=await h.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==y?void 0:y.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),m?{statement:m}: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)f="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),p=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in h)||"function"!=typeof h.signMessage||!("publicKey"in h)||"object"!=typeof h||!h.publicKey||!("toBase58"in h.publicKey)||"function"!=typeof h.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");f=[`${b.host} wants you to sign in with your Solana account:`,h.publicKey.toBase58(),...m?["",m,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!=(n=null==(r=null==y?void 0:y.signInWithSolana)?void 0:r.issuedAt)?n:new Date().toISOString()}`,...(null==(s=null==y?void 0:y.signInWithSolana)?void 0:s.notBefore)?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...(null==(i=null==y?void 0:y.signInWithSolana)?void 0:i.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==(c=null==(u=null==y?void 0:y.signInWithSolana)?void 0:u.resources)?void 0:c.length)?["Resources",...y.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await h.signMessage(new TextEncoder().encode(f),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=e}}try{let{data:t,error:r}=await rU(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:f,signature:rg(p)},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:rF}
37);if(r)throw r;if(!t||!t.session||!t.user){let e=new t7;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(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){let t=await rx(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/");try{if(!r&&"pkce"===this.flowType)throw new rn;let{data:t,error:s}=await rU(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:rF});if(await rE(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user){let e=new t7;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("recovery"===n?"PASSWORD_RECOVERY":"SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=n?n:null}),error:s})}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(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:n,access_token:s,nonce:i}=e,{data:a,error:o}=await rU(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:rF});if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!a||!a.session||!a.user){let e=new t7;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(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,r,n,s,i;try{if("email"in e){let{email:n,options:s}=e,i=null,a=null;"pkce"===this.flowType&&([i,a]=await rO(this.storage,this.storageKey));let{error:o}=await rU(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!=(t=null==s?void 0:s.data)?t:{},create_user:null==(r=null==s?void 0:s.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:i,code_challenge_method:a},redirectTo:null==s?void 0:s.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 rU(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(n=null==r?void 0:r.data)?n:{},create_user:null==(s=null==r?void 0:r.shouldCreateUser)||s,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(i=null==r?void 0:r.channel)?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new re("You must provide either an email or phone number.")}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,r;try{let n,s;"options"in e&&(n=null==(t=e.options)?void 0:t.redirectTo,s=null==(r=e.options)?void 0:r.captchaToken);let{data:i,error:a}=await rU(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:n,xform:rF});if(a)throw a;if(!i)throw Error("An error occurred on token verification.");let o=i.session,l=i.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(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,r,n,s,i;try{let a=null,o=null;"pkce"===this.flowType&&([a,o]=await rO(this.storage,this.storageKey));let l=await rU(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==(n=null==e?void 0:e.options)?void 0:n.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:rq});return(null==(s=l.data)?void 0:s.url)&&rm()&&!(null==(i=e.options)?void 0:i.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(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 t6;let{error:n}=await rU(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(t5(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:n,options:s}=e,{error:i}=await rU(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}if("phone"in e){let{phone:r,type:n,options:s}=e,{data:i,error:a}=await rU(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==i?void 0:i.message_id},error:a})}throw new re("You must provide either an email or phone number and a type")}catch(e){if(t5(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 rx(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
37id"),await this._removeSession())),!t)return{data:{session:null},error:null};let n=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){let e=await rx(this.userStorage,this.storageKey+"-user");(null==e?void 0:e.user)?t.user=e.user:t.user=rN()}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,n)=>{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,n)}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,n)}})),r.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}let{data:s,error:i}=await this._callRefreshToken(t.refresh_token);if(i)return this._returnResult({data:{session:null},error:i});return this._returnResult({data:{session:s},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 rU(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:rW});return await this._useSession(async e=>{var t,r,n;let{data:s,error:i}=e;if(i)throw i;return(null==(t=s.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await rU(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0,xform:rW}):{data:{user:null},error:new t6}})}catch(e){if(t5(e))return t9(e)&&(await this._removeSession(),await rE(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:n,error:s}=r;if(s)throw s;if(!n.session)throw new t6;let i=n.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await rO(this.storage,this.storageKey));let{data:l,error:u}=await rU(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:i.access_token,xform:rW});if(u)throw u;return i.user=l.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(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 t6;let t=Date.now()/1e3,r=t,n=!0,s=null,{payload:i}=rS(e.access_token);if(i.exp&&(n=(r=i.exp)<=t),n){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};s=t}else{let{data:n,error:i}=await this._getUser(e.access_token);if(i)return this._returnResult({data:{user:null,session:null},error:i});s={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(e){if(t5(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:n,error:s}=t;if(s)throw s;e=null!=(r=n.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new t6;let{data:n,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if(t5(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var r;try{if(!rm())throw new rt("No browser detected.");
37if(e.error||e.error_description||e.error_code)throw new rt(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 rr("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new rt("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new rr("No code detected.");let{data:t,error:n}=await this._exchangeCodeForSession(e.code);if(n)throw n;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!=(r=t.redirectType)?r:null},error:null}}let{provider_token:n,provider_refresh_token:s,access_token:i,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!i||!o||!a||!u)throw new rt("No session defined in URL");let c=Math.round(Date.now()/1e3),h=parseInt(o),d=c+h;l&&(d=parseInt(l));let f=d-c;1e3*f<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let p=d-h;c-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,d,c):c-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,d,c);let{data:g,error:m}=await this._getUser(i);if(m)throw m;let y={provider_token:n,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:d,refresh_token:a,token_type:u,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:e.type},error:null})}catch(e){if(t5(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 rx(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:n,error:s}=t;if(s&&!t9(s))return this._returnResult({error:s});let i=null==(r=n.session)?void 0:r.access_token;if(i){let{error:t}=await this.admin.signOut(i,e);if(t&&!(t5(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)||t9(t)))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await rE(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,n;try{let{data:{session:n},error:s}=t;if(s)throw s;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(t){await (null==(n=this.stateChangeEmitters.get(e))?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),t9(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await rO(this.storage,this.storageKey,!0));try{return await rU(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(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(t5(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:n}=await this._useSession(async t=>{var r,n,s,i,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==(n=e.options)?void 0:n.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:!0});return await rU(this.fetch,"GET",u,{headers:this.headers,jwt:null!=(a=null==(i=o.session)?void 0:i.access_token)?a:void 0})});if(n)throw n;return!rm()||(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(t5(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:n,data:{session:s}}=t;if(n)throw n;let{options:i,provider:a,token:o,access_token:l,nonce:u}=e,{data:c,error:h}=await rU(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==s?void 0:s.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==i?void 0:i.captchaToken}},xform:rF}
37);if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!c||!c.session||!c.user)return this._returnResult({data:{user:null,session:null},error:new t7});return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("USER_UPDATED",c.session)),this._returnResult({data:c,error:h})}catch(e){if(await rE(this.storage,`${this.storageKey}-code-verifier`),t5(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,n;let{data:s,error:i}=t;if(i)throw i;return await rU(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(n=null==(r=s.session)?void 0:r.access_token)?n:void 0})})}catch(e){if(t5(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,n;let s=Date.now();return await (r=async r=>(r>0&&await rR(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await rU(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:rF})),n=(e,t)=>{let r=200*Math.pow(2,e);return t&&ri(t)&&Date.now()+r-s<3e4},new Promise((e,t)=>{(async()=>{for(let s=0;s<1/0;s++)try{let t=await r(s);if(!n(s,null,t))return void e(t)}catch(e){if(!n(s,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),t5(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),rm()&&!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 n=await rx(this.storage,this.storageKey);if(n&&this.userStorage){let t=await rx(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:n.user},await rw(this.userStorage,this.storageKey+"-user",t)),n.user=null!=(e=null==t?void 0:t.user)?e:rN()}else if(n&&!n.user&&!n.user){let e=await rx(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(n.user=e.user,await rE(this.storage,this.storageKey+"-user"),await rw(this.storage,this.storageKey,n)):n.user=rN()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),null!==n&&await this._removeSession();return}let s=(null!=(t=n.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${s?"":" not"} expired with margin of 90000s`),s){if(this.autoRefreshToken&&n.refresh_token){let{error:e}=await this._callRefreshToken(n.refresh_token);e&&(console.error(e),ri(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(n.user&&!0===n.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(n.access_token);!t&&(null==e?void 0:e.user)?(n.user=e.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):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",n)}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 t6;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new rk;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new t6;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let n={data:t.session,error:null};return this.refreshingDeferred.resolve(n),n}catch(e){if(this._debug(n,"error",e),t5(e)){let r={data:null,error:e};return ri(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(n,"end")}}async _notifyAllSubscribers(e,t,r=!0){let n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let n=[],s=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(s),n.length>0){for(let e=0;e<n.length;e+=1)console.error(n[e]);throw n[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await rE(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 rw(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let n=rL(e);await rw(this.storage,this.storageKey,n)}else{let e=rL(t);await rw(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await rE(this.storage,this.storageKey),await rE(this.storage,this.storageKey+"-code-verifier"),await rE(this.storage,this.storageKey+"-user"),this.userStorage&&await rE(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&rm()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
37catch(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():"u">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():"u">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 n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=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 instanceof rX)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!rm()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},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 n=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await rO(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});n.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);n.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:n,error:s}=t;return s?this._returnResult({data:null,error:s}):await rU(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});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 rU(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):("totp"===e.factorType&&"totp"===o.type&&(null==(n=null==o?void 0:o.totp)?void 0:n.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(t5(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;let{data:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});let i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?r3(e.webauthn.credential_response):r6(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await rU(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:o}))})}catch(e){if(t5(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:n,error:s}=t;if(s)return this._returnResult({data:null,error:s});let i=await rU(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});if(i.error)return i;let{data:a}=i;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:r8(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:r4(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(t5(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 n={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])n.all.push(r),"verified"===r.status&&n[r.factor_type].push(r);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,r,n,s;if(e)try{let{payload:n}=rS(e),s=null;n.aal&&(s=n.aal);let i=s,{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!=(r=null==(t=null==a?void 0:a.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(i="aal2");let l=n.amr||[];return{data:{currentLevel:s,nextLevel:i,currentAuthenticationMethods:l},error:null}}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}let{data:{session:i},error:a}
37=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:o}=rS(i.access_token),l=null;o.aal&&(l=o.aal);let u=l;return(null!=(s=null==(n=i.user.factors)?void 0:n.filter(e=>"verified"===e.status))?s:[]).length>0&&(u="aal2"),{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await rU(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 t6})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new t6});let i=await rU(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return i.data&&i.data.redirect_url&&rm()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new t6});let i=await rU(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return i.data&&i.data.redirect_url&&rm()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(e){if(t5(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 rU(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 t6})})}catch(e){if(t5(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:n}=t;return n?this._returnResult({data:null,error:n}):r?(await rU(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 t6})})}catch(e){if(t5(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 n=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>n)return r;let{data:s,error:i}=await rU(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return s.keys&&0!==s.keys.length&&(this.jwks=s,this.jwks_cached_at=n,r=s.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{var r;let n,s=e;if(!s){let{data:e,error:t}
37=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}let{header:i,payload:a,signature:o,raw:{header:l,payload:u}}=rS(s);(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 c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!c){let{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:a,header:i,signature:o},error:null}}let h=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")}}(i.alg),d=await crypto.subtle.importKey("jwk",c,h,!0,["verify"]);if(!await crypto.subtle.verify(h,d,o,(r=`${l}.${u}`,n=[],!function(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){let t=(n-55296)*1024&65535;n=(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)}`)}(n,t)}}(r,e=>n.push(e)),new Uint8Array(n))))throw new ro("Invalid JWT signature");return{data:{claims:a,header:i,signature:o},error:null}}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,r,n;rj(this.experimental);try{if(!r7())return this._returnResult({data:null,error:new t4("Browser does not support WebAuthn",null)});let{data:s,error:i}=await this._startPasskeyAuthentication({options:{captchaToken:null==(t=null==e?void 0:e.options)?void 0:t.captchaToken}});if(i||!s)return this._returnResult({data:null,error:i});let a=r4(s.options),o=null!=(n=null==(r=null==e?void 0:e.options)?void 0:r.signal)?n:r5.createNewAbortSignal(),{data:l,error:u}=await nt({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new t4("WebAuthn ceremony failed",null)});let c=r6(l);return this._verifyPasskeyAuthentication({challengeId:s.challenge_id,credential:c})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,r;rj(this.experimental);try{if(!r7())return this._returnResult({data:null,error:new t4("Browser does not support WebAuthn",null)});let{data:n,error:s}=await this._startPasskeyRegistration();if(s||!n)return this._returnResult({data:null,error:s});let i=r8(n.options),a=null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.signal)?r:r5.createNewAbortSignal(),{data:o,error:l}=await ne({publicKey:i,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new t4("WebAuthn ceremony failed",null)});let u=r3(o);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){rj(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new t6});let{data:n,error:s}=await rU(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){rj(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new t6});let{data:s,error:i}=await rU(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;rj(this.experimental);try{let{data:r,error:n}=await rU(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null==(t=null==e?void 0:e.options)?void 0:t.captchaToken}}});if(n)return this._returnResult({data:null,error:n});return this._returnResult({data:r,error:null})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){rj(this.experimental);try{let{data:t,error:r}=await rU(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:rF}
37);if(r)return this._returnResult({data:null,error:r});return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:t,error:null})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){rj(this.experimental);try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!t)return this._returnResult({data:null,error:new t6});let{data:n,error:s}=await rU(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){rj(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new t6});let{data:s,error:i}=await rU(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){rj(this.experimental);try{return await this._useSession(async t=>{let{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new t6});let{error:s}=await rU(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return s?this._returnResult({data:null,error:s}):this._returnResult({data:null,error:null})})}catch(e){if(t5(e))return this._returnResult({data:null,error:e});throw e}}}nu.nextInstanceID={};let nc=nu,nh="";nh="u">typeof Deno?"deno":"u">typeof document?"web":"u">typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let nd={headers:{"X-Client-Info":`supabase-js-${nh}/2.106.1`}},nf={schema:"public"},np={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ng={},nm={enabled:!1,respectSamplingDecision:!0},ny=null;function nb(e){return(nb="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 nv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function nw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nv(Object(r),!0).forEach(function(t){!function(e,t,r){var n;(n=function(e,t){if("object"!=nb(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=nb(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==nb(n)?n:n+"")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)):nv(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}async function nx(e,t,r){if(!function(e,t){let r;if(!e||!t||0===t.length)return!1;if(e instanceof URL)r=e;else try{r=new URL(e)}catch(e){return!1}for(let e of t)try{if("string"==typeof e){if(function(e,t){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(2);if(e.endsWith(r)&&(e===r||e.endsWith("."+r)))return!0}return!1}(r.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(r.hostname))return!0}else if("function"==typeof e&&e(r))return!0}catch(e){continue}return!1}("string"==typeof e||e instanceof URL?e:e.url,t))return null;let n=await function(){var e,t,r,n;return e=this,t=void 0,r=void 0,n=function*(){try{let e=yield(null===ny&&(ny=import("@opentelemetry/api").cat
37ch(()=>null)),ny);if(!e||!e.propagation||!e.context)return null;let t={};e.propagation.inject(e.context.active(),t);let r=t.traceparent;if(!r)return null;return{traceparent:r,tracestate:t.tracestate,baggage:t.baggage}}catch(e){return null}},new(r||(r=Promise))(function(s,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})}();if(!n||!n.traceparent)return null;if(r){let e=function(e){if(!e||"string"!=typeof e)return null;let t=e.split("-");if(4!==t.length)return null;let[r,n,s,i]=t;if(2!==r.length||32!==n.length||16!==s.length||2!==i.length)return null;let a=/^[0-9a-f]+$/i;return a.test(r)&&a.test(n)&&a.test(s)&&a.test(i)&&"00000000000000000000000000000000"!==n&&"0000000000000000"!==s?{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(1&parseInt(i,16))==1}:null}(n.traceparent);if(e&&!e.isSampled)return null}return n}function nE(e){return"boolean"==typeof e?{enabled:e}:e}var nk=class extends nc{constructor(e){super(e)}},nS=class{constructor(e,t,r){var n,s,i;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,n,s,i,a,o;let{db:l,auth:u,realtime:c,global:h}=e,{db:d,auth:f,realtime:p,global:g}=t,m=nE(e.tracePropagation),y=nE(t.tracePropagation),b={db:nw(nw({},d),l),auth:nw(nw({},f),u),realtime:nw(nw({},p),c),storage:{},global:nw(nw(nw({},g),h),{},{headers:nw(nw({},null!=(r=null==g?void 0:g.headers)?r:{}),null!=(n=null==h?void 0:h.headers)?n:{})}),tracePropagation:{enabled:null!=(s=null!=(i=null==m?void 0:m.enabled)?i:null==y?void 0:y.enabled)&&s,respectSamplingDecision:null==(a=null!=(o=null==m?void 0:m.respectSamplingDecision)?o:null==y?void 0:y.respectSamplingDecision)||a},accessToken:async()=>""};return e.accessToken?b.accessToken=e.accessToken:delete b.accessToken,b}(null!=r?r:{},{db:nf,realtime:ng,auth:nw(nw({},np),{},{storageKey:o}),global:nd,tracePropagation:nm});this.settings=l,this.storageKey=null!=(n=l.auth.storageKey)?n:"",this.headers=null!=(s=l.global.headers)?s:{},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!=(i=l.auth)?i:{},this.headers,l.global.fetch),this.fetch=((e,t,r,n,s)=>{let i=n?(...e)=>n(...e):(...e)=>fetch(...e),a=Headers,o=(null==s?void 0:s.enabled)===!0,l=(null==s?void 0:s.respectSamplingDecision)!==!1,u=o?function(e){let t=[];try{let r=new URL(e);t.push(r.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}(t):null;return async(t,n)=>{var s;let o=null!=(s=await r())?s:e,c=new a(null==n?void 0:n.headers);if(c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${o}`),u){let e=await nx(t,u,l);e&&(e.traceparent&&!c.has("traceparent")&&c.set("traceparent",e.traceparent),e.tracestate&&!c.has("tracestate")&&c.set("tracestate",e.tracestate),e.baggage&&!c.has("baggage")&&c.set("baggage",e.baggage))}return i(t,nw(nw({},n),{},{headers:c}))}})(t,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(nw({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new ek(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new tY(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new eu(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)}
37channel(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:n,userStorage:s,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:u,experimental:c,lockAcquireTimeout:h,skipAutoInitialize:d},f,p){let g={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new nk({url:this.authUrl.href,headers:nw(nw({},g),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:a,lock:o,debug:l,throwOnError:u,experimental:c,fetch:p,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new to(this.realtimeUrl.href,nw(nw({},e),{},{params:nw(nw({},{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("u">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 nR=null;e.s(["track",0,function(e,t,r,n){try{let s=nR?nR:nR=new nS("https://cldoxtgwdfxnolzfayin.supabase.co","sb_publishable_sk52NV5eANWBzDnGkpUSpg_i7fVlziC",{auth:{persistSession:!1}});if(!s)return;setTimeout(()=>{s.rpc("log_ui_event",{kind_input:e,label_input:t.slice(0,64),route_input:r.slice(0,128),surface_input:n}).then(void 0,()=>{})},0)}catch{}}],99644)},68089,e=>{"use strict";let t=(0,e.i(92511).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",0,t],68089)},1777,e=>{"use strict";var t,r,n=e.i(13046);let s=((t={}).open="data-open",t.closed="data-closed",t[t.startingStyle=n.TransitionStatusDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=n.TransitionStatusDataAttributes.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t),i=((r={}).popupOpen="data-popup-open",r.pressed="data-pressed",r),a={[i.popupOpen]:""},o={[i.popupOpen]:"",[i.pressed]:""},l={[s.open]:""},u={[s.closed]:""},c={[s.anchorHidden]:""};e.s(["CommonPopupDataAttributes",0,s,"popupStateMapping",0,{open:e=>e?l:u,anchorHidden:e=>e?c:null},"pressableTriggerOpenStateMapping",0,{open:e=>e?o:null},"triggerOpenStateMapping",0,{open:e=>e?a:null}])},73459,e=>{"use strict";let t="u">typeof navigator,r=function(){if(!t)return{platform:"",maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}(),n=function(){if(!t)return"";let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}(),s=function(){if(!t)return"";let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}(),i="u">typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter:none"),a="MacIntel"===r.platform&&r.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(r.platform);t&&/firefox/i.test(s);let o=t&&/apple/i.test(navigator.vendor);t&&/Edg/i.test(s);let l=t&&/android/i.test(n)||/android/i.test(s),u=t&&n.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,c=s.includes("jsdom/");e.s(["isAndroid",0,l,"isIOS",0,a,"isJSDOM",0,c,"isMac",0,u,"isSafari",0,o,"isWebKit",0,i])},13687,35810,2220,e=>{"use strict";e.s(["addEventListener",0,function(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}],13687),e.s(["mergeCleanups",0,function(...e){return()=>{for(let t=0;t<e.length;t+=1){let r=e[t];r&&r()}}}],35810);
37var t=e.i(62926),r=e.i(57948);function n(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}e.s(["useValueAsRef",0,function(e){let s=(0,r.useRefWithInit)(n,e).current;return s.next=e,(0,t.useIsoLayoutEffect)(s.effect),s}],2220)},82807,41961,22156,29314,11235,35982,29561,61837,82697,42372,15926,74254,44607,86601,55954,61546,4430,e=>{"use strict";var t=e.i(30878),r=e.i(67481),n=e.i(13687),s=e.i(35810),i=e.i(83069),a=e.i(2220),o=e.i(91434),l=e.i(62926),u=e.i(81528),c=e.i(73459),h=e.i(31164),d=e.i(42785),f=r;e.s(["ownerWindow",()=>f.getWindow],41961);var f=r;e.i(50382);let p={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},g={...p,position:"fixed",top:0,left:0};({...p,position:"absolute"});var m=e.i(14294);let y=t.forwardRef(function(e,r){let[n,s]=t.useState();return(0,l.useIsoLayoutEffect)(()=>{c.isSafari&&s("button")},[]),(0,m.jsx)("span",{...e,ref:r,style:g,"aria-hidden":!n||void 0,tabIndex:0,role:n,"data-base-ui-focus-guard":""})});e.s(["FocusGuard",0,y],22156);var b=e.i(85226);let v="data-base-ui-focusable",w="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",x="ArrowLeft",E="ArrowRight",k="ArrowUp",S="ArrowDown";function R(e){return(0,r.isHTMLElement)(e)&&e.matches(w)}function _(e){return!!e&&"combobox"===e.getAttribute("role")&&R(e)}function T(e){return e?e.hasAttribute(v)?e:e.querySelector(`[${v}]`)||e:null}function C(e){e.preventDefault(),e.stopPropagation()}function O(e){return""===e.pointerType&&!!e.isTrusted||(c.isAndroid&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}function A(e){return!c.isJSDOM&&(!c.isAndroid&&0===e.width&&0===e.height||c.isAndroid&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}e.s(["ACTIVE_KEY",0,"active","ARROW_DOWN",0,S,"ARROW_LEFT",0,x,"ARROW_RIGHT",0,E,"ARROW_UP",0,k,"FOCUSABLE_ATTRIBUTE",0,v,"SELECTED_KEY",0,"selected","TYPEABLE_SELECTOR",0,w],29314),e.s(["getFloatingFocusElement",0,T,"isEventTargetWithin",0,function(e,t){return null!=t&&("composedPath"in e?e.composedPath().includes(t):null!=e.target&&t.contains(e.target))},"isInteractiveElement",0,function(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${w}`)!=null},"isRootElement",0,function(e){return e.matches("html,body")},"isTargetInsideEnabledTrigger",0,function(e,t){if(!(0,r.isElement)(e))return!1;if(t.hasElement(e))return!e.hasAttribute("data-trigger-disabled");for(let[,r]of t.entries())if((0,b.contains)(r,e))return!r.hasAttribute("data-trigger-disabled");return!1},"isTypeableCombobox",0,_,"isTypeableElement",0,R,"matchesFocusVisible",0,function(e){if(!e||c.isJSDOM)return!0;try{return e.matches(":focus-visible")}catch(e){return!0}}],11235),e.s(["isClickLikeEvent",0,function(e){let t=e.type;return"click"===t||"mousedown"===t||"keydown"===t||"keyup"===t},"isMouseLikePointerType",0,function(e,t){let r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)},"isReactEvent",0,function(e){return"nativeEvent"in e},"isVirtualClick",0,O,"isVirtualPointerEvent",0,A,"stopEvent",0,C],35982);let P=["top","right","bottom","left"],I=P.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),j=Math.min,N=Math.max,L=Math.round,M=Math.floor,D={left:"right",right:"left",bottom:"top",top:"bottom"};function $(e){return e.split("-")[0]}function U(e){return e.split("-")[1]}function B(e){return"x"===e?"y":"x"}function F(e){return"y"===e?"height":"width"}function H(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function W(e){return B(H(e))}function q(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let z=["left","right"],V=["right","left"],K=["top","bottom"],G=["bottom","top"];function J(e){let t=$(e);return D[t]+e.slice(t.length)}function Y(e,t,r){return Math.floor(e/t)!==r}function X(e,t){return t<0||t>=e.length}function Q(e,{startingIndex:t=-1,decrement:r=!1,disabledIndices:n,amount:s=1}={}){let i=t;do i+=r?-s:s;while(i>=0&&i<=e.length-1&&Z(e,i,n))return i}function Z(e,t,r){if("function"==typeof r?r(t):r?.includes(t)??!1)return!0;let n=e[t];return!!n&&(!ee(n)||!r&&(n.hasAttribute("disabled")||"true"===n.getAttribute("aria-disabled")))}function ee(e,t=e?(0,r.getComputedStyle)(e):null){var n;
37return!!e&&!!e.isConnected&&!!t&&"hidden"!==(n=t).visibility&&"collapse"!==n.visibility&&("function"==typeof e.checkVisibility?e.checkVisibility():"none"!==t.display&&"contents"!==t.display)}function et(e){for(let t of Array.from(e.children))if("summary"===(0,r.getNodeName)(t))return t;return null}function er(e){let t=e?(0,r.getNodeName)(e):"";return null!=e&&e.matches('a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]')&&("summary"!==t||null!=e.parentElement&&"details"===(0,r.getNodeName)(e.parentElement)&&et(e.parentElement)===e)&&("details"!==t||null==et(e))&&("input"!==t||"hidden"!==e.type)}function en(e){if(!er(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=function(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return(0,r.isShadowRoot)(n)?n.host:null}(t)){let n=t!==e,s="slot"===(0,r.getNodeName)(t);if(t.hasAttribute("inert")||n&&"details"===(0,r.getNodeName)(t)&&!t.open&&!function(e,t){let r=et(t);return!!r&&(e===r||(0,b.contains)(r,e))}(e,t)||t.hasAttribute("hidden")||!s&&!function(e,t){let n=(0,r.getComputedStyle)(e);return t?"none"!==n.display:ee(e,n)}(t,n))return!1}return!0}function es(e){let t=e.tabIndex;if(t<0){let t=(0,r.getNodeName)(e);if("details"===t||"audio"===t||"video"===t||(0,r.isHTMLElement)(e)&&e.isContentEditable)return 0}return t}function ei(e){return"input"!==(0,r.getNodeName)(e)?null:"radio"===e.type&&""!==e.name?e:null}function ea(e){if((0,r.isHTMLElement)(e)&&"slot"===(0,r.getNodeName)(e)){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return(0,r.isHTMLElement)(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function eo(e){return en(e)&&es(e)>=0}function el(e){let t=[];return!function e(t,r){ea(t).forEach(t=>{er(t)&&r.push(t),e(t,r)})}(e,t),t.filter(en)}function eu(e){let t=el(e);return t.filter(e=>es(e)>=0&&function(e,t){let r=ei(e);if(!r)return!0;let n=t.find(e=>{let t=ei(e);return t?.name===r.name&&t.form===r.form&&t.checked});return n?n===r:t.find(e=>{let t=ei(e);return t?.name===r.name&&t.form===r.form})===r}(e,t))}function ec(e,t){let r=eu(e),n=r.length;if(0===n)return;let s=(0,b.activeElement)((0,d.ownerDocument)(e)),i=r.indexOf(s);return r[-1===i?1===t?0:n-1:i+t]}function eh(e){return ec((0,d.ownerDocument)(e).body,1)||e}function ed(e){return ec((0,d.ownerDocument)(e).body,-1)||e}function ef(e,t){if(!e)return null;let r=eu((0,d.ownerDocument)(e).body),n=r.length;if(0===n)return null;let s=r.indexOf(e);return -1===s?null:r[(s+t+n)%n]}function ep(e,t){let r=t||e.currentTarget,n=e.relatedTarget;return!n||!(0,b.contains)(r,n)}function eg(e){eu(e).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function em(e){let t=[];!function e(t,n,s){ea(t).forEach(t=>{(0,r.isHTMLElement)(t)&&t.matches(n)&&s.push(t),e(t,n,s)})}(e,"[data-tabindex]",t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}function ey(e,t,r=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!r||t.context?.open?[t]:[],...ey(e,t.id,r)])}function eb(e,t){let r=[],n=e.find(e=>e.id===t)?.parentId;for(;n;){let t=e.find(e=>e.id===n);n=t?.parentId,t&&(r=r.concat(t))}return r}e.s(["clamp",0,function(e,t,r){return N(e,j(t,r))},"createCoords",0,e=>({x:e,y:e}),"evaluate",0,function(e,t){return"function"==typeof e?e(t):e},"floor",0,M,"getAlignment",0,U,"getAlignmentAxis",0,W,"getAlignmentSides",0,function(e,t,r){void 0===r&&(r=!1);let n=U(e),s=W(e),i=F(s),a="x"===s?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=J(a)),[a,J(a)]},"getAxisLength",0,F,"getExpandedPlacements",0,function(e){let t=J(e);return[q(e),t,q(t)]},"getOppositeAlignmentPlacement",0,q,"getOppositeAxis",0,B,"getOppositeAxisPlacements",0,function(e,t,r,n){let s=U(e),i=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?V:z;return t?z:V;case"left":case"right":return t?K:G;default:return[]}}($(e),"start"===r,n);return s&&(i=i.map(e=>e+"-"+s),t&&(i=i.concat(i.map(q)))),i}
37,"getOppositePlacement",0,J,"getPaddingObject",0,function(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}},"getSide",0,$,"getSideAxis",0,H,"max",0,N,"min",0,j,"placements",0,I,"rectToClientRect",0,function(e){let{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}},"round",0,L,"sides",0,P],29561),e.s(["createGridCellMap",0,function(e,t,r){let n=[],s=0;return e.forEach(({width:e,height:i},a)=>{let o=!1;for(r&&(s=0);!o;){let r=[];for(let n=0;n<e;n+=1)for(let e=0;e<i;e+=1)r.push(s+n+e*t);s%t+e<=t&&r.every(e=>null==n[e])?(r.forEach(e=>{n[e]=a}),o=!0):s+=1}}),[...n]},"findNonDisabledListIndex",0,Q,"getGridCellIndexOfCorner",0,function(e,t,r,n,s){if(-1===e)return -1;let i=r.indexOf(e),a=t[e];switch(s){case"tl":return i;case"tr":if(!a)return i;return i+a.width-1;case"bl":if(!a)return i;return i+(a.height-1)*n;case"br":return r.lastIndexOf(e);default:return -1}},"getGridCellIndices",0,function(e,t){return t.flatMap((t,r)=>e.includes(t)?[r]:[])},"getGridNavigatedIndex",0,function(e,{event:t,orientation:r,loopFocus:n,onLoop:s,rtl:i,cols:a,disabledIndices:o,minIndex:l,maxIndex:u,prevIndex:c,stopEvent:h=!1}){let d,f=c;if(t.key===k?d="up":t.key===S&&(d="down"),d){let r=[],i=[],p=!1,g=0;{let t=null,n=-1;e.forEach((e,s)=>{if(null==e)return;g+=1;let a=e.closest('[role="row"]');a&&(p=!0),(a!==t||-1===n)&&(t=a,r[n+=1]=[]),r[n].push(s),i[s]=n})}let m=!1,y=0;if(p)for(let e of r){let t=e.length;t>y&&(y=t),t!==a&&(m=!0)}let b=m&&g<e.length,v=y||a;h&&C(t);let w=(a=>{if(!m||-1===c)return;let l=i[c];if(null==l)return;let u=r[l].indexOf(c),h="up"===a?-1:1;for(let a=l+h,d=0;d<r.length;d+=1,a+=h){if(a<0||a>=r.length){if(!n||b)return;if(a=a<0?r.length-1:0,s){let e=Math.min(u,r[a].length-1);a=i[s(t,c,r[a][e]??r[a][0])]??a}}let l=r[a];for(let t=Math.min(u,l.length-1);t>=0;t-=1){let r=l[t];if(!Z(e,r,o))return r}}})(d)??(t=>{if(!b||-1===c)return;let r=c%v,s="up"===t?-v:v,i=u-u%v,a=M(u/v)+1;for(let t=c-r+s,l=0;l<a;l+=1,t+=s){if(t<0||t>u){if(!n)return;t=t<0?i:0}let s=Math.min(t+v-1,u);for(let n=Math.min(t+r,s);n>=t;n-=1)if(!Z(e,n,o))return n}})(d);if(void 0!==w)f=w;else if(-1===c)f="up"===d?u:l;else if(f=Q(e,{startingIndex:c,amount:v,decrement:"up"===d,disabledIndices:o}),n){if("up"===d&&(c-v<l||f<0)){let e=c%v,r=u%v,n=u-(r-e);f=r===e?u:r>e?n:n-v,s&&(f=s(t,c,f))}"down"===d&&c+v>u&&(f=Q(e,{startingIndex:c%v-v,amount:v,disabledIndices:o}),s&&(f=s(t,c,f)))}X(e,f)&&(f=c)}if("both"===r){let r=M(c/a);t.key===(i?x:E)&&(h&&C(t),c%a!=a-1?(f=Q(e,{startingIndex:c,disabledIndices:o}),n&&Y(f,a,r)&&(f=Q(e,{startingIndex:c-c%a-1,disabledIndices:o}),s&&(f=s(t,c,f)))):n&&(f=Q(e,{startingIndex:c-c%a-1,disabledIndices:o}),s&&(f=s(t,c,f))),Y(f,a,r)&&(f=c)),t.key===(i?E:x)&&(h&&C(t),c%a!=0?(f=Q(e,{startingIndex:c,decrement:!0,disabledIndices:o}),n&&Y(f,a,r)&&(f=Q(e,{startingIndex:c+(a-c%a),decrement:!0,disabledIndices:o}),s&&(f=s(t,c,f)))):n&&(f=Q(e,{startingIndex:c+(a-c%a),decrement:!0,disabledIndices:o}),s&&(f=s(t,c,f))),Y(f,a,r)&&(f=c));let l=M(u/a)===r;X(e,f)&&(n&&l?(f=t.key===(i?E:x)?u:Q(e,{startingIndex:c-c%a-1,disabledIndices:o}),s&&(f=s(t,c,f))):f=c)}return f},"getMaxListIndex",0,function(e,t){return Q(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})},"getMinListIndex",0,function(e,t){return Q(e.current,{disabledIndices:t})},"isElementVisible",0,ee,"isIndexOutOfListBounds",0,X,"isListIndexDisabled",0,Z],61837),e.s(["disableFocusInside",0,eg,"enableFocusInside",0,em,"focusable",0,el,"getNextTabbable",0,eh,"getPreviousTabbable",0,ed,"getTabbableAfterElement",0,function(e){return ef(e,1)},"getTabbableBeforeElement",0,function(e){return ef(e,-1)},"isOutsideEvent",0,ep,"isTabbable",0,eo,"tabbable",0,eu],82697),e.s(["getNodeAncestors",0,eb,"getNodeChildren",0,ey],42372);var ev=e.i(5760),ew=e.i(10372);function ex(e){return`data-base-ui-${e}`}e.s(["createAttribute",0,ex],15926);var eE=e.i(88258);let ek=0;function eS(e,t={}){let{preventScroll:r=!1,cancelPrevious:n=!0,sync:s=!1}=t;n&&cancelAnimationFrame(ek);let i=()=>e?.focus({preventScroll:r});if(s)return i(),eE.NOOP;let a=requestAnimationFrame(i);return ek=a,()=>{ek===a&&(cancelAnimationFrame(a),ek=0)}}e.s(["enqueueFocus",0,eS],74254);let eR={inert:new WeakMap,"aria-hidden":new WeakMap},e_="data-base-ui-inert",eT={inert:new WeakSet,"aria-hidden":new WeakSet},eC=new WeakMap,eO=0,eA=(e,t)=>
37t.map(t=>{if(e.contains(t))return t;let n=function e(t){return t?(0,r.isShadowRoot)(t)?t.host:e(t.parentNode):null}(t);return e.contains(n)?n:null}).filter(e=>null!=e),eP=e=>{let t=new Set;return e.forEach(e=>{let r=e;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},eI=(e,t,n)=>{let s=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{"script"!==(0,r.getNodeName)(e)&&(t.has(e)?i(e):s.push(e))})};return i(e),s};function ej(e,t={}){let{ariaHidden:r=!1,inert:n=!1,mark:s=!0,markerIgnoreElements:i=[]}=t,a=(0,d.ownerDocument)(e[0]).body;return function(e,t,r,n,{mark:s=!0,markerIgnoreElements:i=[]}){let a=n?"inert":r?"aria-hidden":null,o=null,l=null,u=eA(t,e),c=new Set(s?eA(t,i):[]),h=s?eI(t,eP(u),new Set(u)).filter(e=>!c.has(e)):[],d=[],f=[];if(a){let e=eR[a],r=eT[a];l=r,o=e;let n=eA(t,Array.from(t.querySelectorAll("[aria-live]"))),s=u.concat(n);eI(t,eP(s),new Set(s)).forEach(t=>{let n=t.getAttribute(a),s=null!==n&&"false"!==n,i=(e.get(t)||0)+1;e.set(t,i),d.push(t),1===i&&s&&r.add(t),s||t.setAttribute(a,"inert"===a?"":"true")})}return s&&h.forEach(e=>{let t=(eC.get(e)||0)+1;eC.set(e,t),f.push(e),1===t&&e.setAttribute(e_,"")}),eO+=1,()=>{o&&d.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!l?.has(e)&&a&&e.removeAttribute(a),l?.delete(e))}),s&&f.forEach(e=>{let t=(eC.get(e)||0)-1;eC.set(e,t),t||e.removeAttribute(e_)}),(eO-=1)||(eR.inert=new WeakMap,eR["aria-hidden"]=new WeakMap,eT.inert=new WeakSet,eT["aria-hidden"]=new WeakSet,eC=new WeakMap)}}(e,a,r,n,{mark:s,markerIgnoreElements:i})}var eN=e.i(73340),eL=e.i(47094),eM=e.i(85207);let eD="data-base-ui-click-trigger",e$={clipPath:"inset(50%)",position:"fixed",top:0,left:0};e.s(["CLICK_TRIGGER_IDENTIFIER",0,eD,"DISABLED_TRANSITIONS_STYLE",0,{style:{transition:"none"}},"DROPDOWN_COLLISION_AVOIDANCE",0,{fallbackAxisSide:"none"},"PATIENT_CLICK_THRESHOLD",0,500,"POPUP_COLLISION_AVOIDANCE",0,{fallbackAxisSide:"end"},"TYPEAHEAD_RESET_MS",0,500,"ownerVisuallyHidden",0,e$],44607);let eU=t.createContext(null),eB=()=>t.useContext(eU),eF=ex("portal"),eH=t.forwardRef(function(e,i){let{children:a,container:u,className:c,render:h,renderGuards:d,style:f,...p}=e,{portalNode:g,portalSubtree:b}=function(e={}){let{ref:n,container:s,componentProps:i=eE.EMPTY_OBJECT,elementProps:a}=e,u=(0,eL.useId)(),c=eB(),h=c?.portalNode,[d,f]=t.useState(null),[p,g]=t.useState(null),m=(0,o.useStableCallback)(e=>{null!==e&&g(e)}),y=t.useRef(null);(0,l.useIsoLayoutEffect)(()=>{if(null===s){y.current&&(y.current=null,g(null),f(null));return}if(null==u)return;let e=(s&&((0,r.isNode)(s)?s:s.current))??h??document.body;if(null==e){y.current&&(y.current=null,g(null),f(null));return}y.current!==e&&(y.current=e,g(null),f(e))},[s,h,u]);let b=(0,eM.useRenderElement)("div",i,{ref:[n,m],props:[{id:u,[eF]:""},a]});return{portalNode:p,portalSubtree:d&&b?eN.createPortal(b,d):null}}({container:u,ref:i,componentProps:e,elementProps:p}),v=t.useRef(null),w=t.useRef(null),x=t.useRef(null),E=t.useRef(null),[k,S]=t.useState(null),R=t.useRef(!1),_=k?.modal,T=k?.open,C="boolean"==typeof d?d:!!k&&!k.modal&&k.open&&!!g;t.useEffect(()=>{if(g&&!_)return(0,s.mergeCleanups)((0,n.addEventListener)(g,"focusin",e,!0),(0,n.addEventListener)(g,"focusout",e,!0));function e(e){g&&e.relatedTarget&&ep(e)&&("focusin"===e.type?R.current&&(em(g),R.current=!1):(eg(g),R.current=!0))}},[g,_]),t.useEffect(()=>{g&&!1===T&&(em(g),R.current=!1)},[T,g]);let O=t.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:w,beforeInsideRef:x,afterInsideRef:E,portalNode:g,setFocusManagerState:S}),[g]);return(0,m.jsxs)(t.Fragment,{children:[b,(0,m.jsxs)(eU.Provider,{value:O,children:[C&&g&&(0,m.jsx)(y,{"data-type":"outside",ref:v,onFocus:e=>{if(ep(e,g))x.current?.focus();else{let e=ed(k?k.domReference:null);e?.focus()}}}),C&&g&&(0,m.jsx)("span",{"aria-owns":g.id,style:e$}),g&&eN.createPortal(a,g),C&&g&&(0,m.jsx)(y,{"data-type":"outside",ref:w,onFocus:e=>{if(ep(e,g))E.current?.focus();else{let t=eh(k?k.domReference:null);t?.focus(),k?.closeOnFocusOut&&k?.onOpenChange(!1,(0,ev.createChangeEventDetails)(ew.REASONS.focusOut,e.nativeEvent))}}})]})]})});e.s(["FloatingPortal",0,eH,"usePortalContext",0,eB],86601);var eW=e.i(57948);function eq(){let e=new Map;
37return{emit(t,r){e.get(t)?.forEach(e=>e(r))},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r)},off(t,r){e.get(t)?.delete(r)}}}e.s(["createEventEmitter",0,eq],55954);class ez{nodesRef={current:[]};events=eq();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);-1!==t&&this.nodesRef.current.splice(t,1)}}e.s(["FloatingTreeStore",0,ez],61546);let eV=t.createContext(null),eK=t.createContext(null),eG=()=>t.useContext(eV)?.id||null,eJ=e=>{let r=t.useContext(eK);return e??r};e.s(["FloatingNode",0,function(e){let{children:r,id:n}=e,s=eG();return(0,m.jsx)(eV.Provider,{value:t.useMemo(()=>({id:n,parentId:s}),[n,s]),children:r})},"FloatingTree",0,function(e){let{children:t,externalTree:r}=e,n=(0,eW.useRefWithInit)(()=>r??new ez).current;return(0,m.jsx)(eK.Provider,{value:n,children:t})},"useFloatingNodeId",0,function(e){let t=(0,eL.useId)(),r=eJ(e),n=eG();return(0,l.useIsoLayoutEffect)(()=>{if(!t)return;let e={id:t,parentId:n};return r?.addNode(e),()=>{r?.removeNode(e)}},[r,t,n]),t},"useFloatingParentNodeId",0,eG,"useFloatingTree",0,eJ],4430);var eY=e.i(29057);let eX=[];function eQ(){eX=eX.filter(e=>e.deref()?.isConnected)}function eZ(){return eQ(),eX[eX.length-1]?.deref()}function e0(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;let r=el(e).filter(e=>{let t=e.getAttribute("data-tabindex")||"";return eo(e)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),n=e.getAttribute("tabindex");t.current.includes("floating")||0===r.length?"0"!==n&&e.setAttribute("tabindex","0"):("-1"!==n||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}e.s(["FloatingFocusManager",0,function(e){let{context:p,children:g,disabled:v=!1,initialFocus:w=!0,returnFocus:x=!0,restoreFocus:E=!1,modal:k=!0,closeOnFocusOut:S=!0,openInteractionType:P="",nextFocusableElement:I,previousFocusableElement:j,beforeContentFocusGuardRef:N,externalTree:L,getInsideElements:M}=e,D="rootStore"in p?p.rootStore:p,$=D.useState("open"),U=D.useState("domReferenceElement"),B=D.useState("floatingElement"),{events:F,dataRef:H}=D.context,W=(0,o.useStableCallback)(()=>H.current.floatingContext?.nodeId),q=!1===w,z=_(U)&&q,V=t.useRef(["content"]),K=(0,a.useValueAsRef)(w),G=(0,a.useValueAsRef)(x),J=(0,a.useValueAsRef)(P),Y=eJ(L),X=eB(),Q=t.useRef(!1),Z=t.useRef(!1),et=t.useRef(!1),er=t.useRef(null),en=t.useRef(""),es=t.useRef(""),ei=t.useRef(null),ea=t.useRef(null),el=(0,i.useMergedRefs)(ei,N,X?.beforeInsideRef),ec=(0,i.useMergedRefs)(ea,X?.afterInsideRef),ef=(0,u.useTimeout)(),eg=(0,u.useTimeout)(),em=(0,h.useAnimationFrame)(),eE=null!=X,ek=T(B),eR=(0,o.useStableCallback)((e=ek)=>e?eu(e):[]),e_=(0,o.useStableCallback)(()=>M?.().filter(e=>null!=e)??[]);t.useEffect(()=>{if(v||!k)return;let e=(0,d.ownerDocument)(ek);return(0,n.addEventListener)(e,"keydown",function(e){"Tab"===e.key&&(0,b.contains)(ek,(0,b.activeElement)((0,d.ownerDocument)(ek)))&&0===eR().length&&!z&&C(e)})},[v,U,ek,k,V,z,eR]),t.useEffect(()=>{if(v||!$)return;let e=(0,d.ownerDocument)(ek);function t(){et.current=!1}return(0,s.mergeCleanups)((0,n.addEventListener)(e,"pointerdown",function(e){let t=(0,b.getTarget)(e),r=e_();et.current=!((0,b.contains)(B,t)||(0,b.contains)(U,t)||(0,b.contains)(X?.portalNode,t)||r.some(e=>e===t||(0,b.contains)(e,t))),es.current=e.pointerType||"keyboard",t?.closest(`[${eD}]`)&&(Z.current=!0)},!0),(0,n.addEventListener)(e,"pointerup",t,!0),(0,n.addEventListener)(e,"pointercancel",t,!0),(0,n.addEventListener)(e,"keydown",function(){es.current="keyboard"},!0))},[v,B,U,ek,$,X,e_]),t.useEffect(()=>{if(v||!S)return;let e=(0,d.ownerDocument)(ek);function t(t){let n=t.relatedTarget,s=t.currentTarget,i=(0,b.getTarget)(t);queueMicrotask(()=>{let a=W(),o=D.context.triggerElements,l=e_(),u=n?.hasAttribute(ex("focus-guard"))&&[ei.current,ea.current,X?.beforeInsideRef.current,X?.afterInsideRef.current,X?.beforeOutsideRef.current,X?.afterOutsideRef.current,(0,eY.resolveRef)(j),(0,eY.resolveRef)(I)].includes(n),c=!((0,b.contains)(U,n)||(0,b.contains)(B,n)||(0,b.contains)(n,B)||(0,b.contains)(X?.portalNode,n)||l.some(e=>
37e===n||(0,b.contains)(e,n))||null!=n&&o.hasElement(n)||o.hasMatchingElement(e=>(0,b.contains)(e,n))||u||Y&&(ey(Y.nodesRef.current,a).find(e=>(0,b.contains)(e.context?.elements.floating,n)||(0,b.contains)(e.context?.elements.domReference,n))||eb(Y.nodesRef.current,a).find(e=>[e.context?.elements.floating,T(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(s===U&&ek&&e0(ek,V),E&&s!==U&&!ee(i)&&(0,b.activeElement)(e)===e.body){if((0,r.isHTMLElement)(ek)&&(ek.focus(),"popup"===E))return void em.request(()=>{ek.focus()});let e=eR(),t=er.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ek;(0,r.isHTMLElement)(n)&&n.focus()}if(H.current.insideReactTree){H.current.insideReactTree=!1;return}(z||!k)&&n&&c&&!Z.current&&(z||n!==eZ())&&(Q.current=!0,D.setOpen(!1,(0,ev.createChangeEventDetails)(ew.REASONS.focusOut,t)))})}let i=(0,r.isHTMLElement)(U)?U:null;if(B||i)return(0,s.mergeCleanups)(i&&(0,n.addEventListener)(i,"focusout",t),i&&(0,n.addEventListener)(i,"pointerdown",function(){Z.current=!0,eg.start(0,()=>{Z.current=!1})}),B&&(0,n.addEventListener)(B,"focusin",function(e){let t=(0,b.getTarget)(e);eo(t)&&(er.current=t)}),B&&(0,n.addEventListener)(B,"focusout",t),B&&X&&(0,n.addEventListener)(B,"focusout",function(){et.current||(H.current.insideReactTree=!0,ef.start(0,()=>{H.current.insideReactTree=!1}))},!0))},[v,U,B,ek,k,Y,X,D,S,E,eR,z,W,V,H,ef,eg,em,I,j,e_]),t.useEffect(()=>{if(v||!B||!$)return;let e=Array.from(X?.portalNode?.querySelectorAll(`[${ex("portal")}]`)||[]),t=Y?eb(Y.nodesRef.current,W()):[],r=t.find(e=>_(e.context?.elements.domReference||null))?.context?.elements.domReference,n=ej([B,...e,ei.current,ea.current,X?.beforeOutsideRef.current,X?.afterOutsideRef.current,...e_(),r,(0,eY.resolveRef)(j),(0,eY.resolveRef)(I),z?U:null].filter(e=>null!=e),{ariaHidden:k||z,mark:!1}),s=ej([B,...e].filter(e=>null!=e));return()=>{s(),n()}},[$,v,U,B,k,V,X,z,Y,W,I,j,e_]),(0,l.useIsoLayoutEffect)(()=>{if(!$||v||!(0,r.isHTMLElement)(ek))return;let e=(0,d.ownerDocument)(ek),t=(0,b.activeElement)(e);queueMicrotask(()=>{let e,r=K.current,n="function"==typeof r?r(J.current||""):r;if(void 0===n||!1===n||(0,b.contains)(ek,t))return;let s=null,i=()=>(null==s&&(s=eR(ek)),s[0]||ek);eS(e=(e=!0===n||null===n?i():(0,eY.resolveRef)(n))||i(),{preventScroll:e===ek})})},[v,$,ek,q,eR,K,J]),(0,l.useIsoLayoutEffect)(()=>{var e;if(v||!ek)return;let t=(0,d.ownerDocument)(ek);function n(e){var t,r;let n;if(e.open||(t=e.nativeEvent,r=es.current,n=(0,f.getWindow)((0,b.getTarget)(t)),en.current=t instanceof n.KeyboardEvent?"keyboard":t instanceof n.FocusEvent?r||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof n.MouseEvent?r||(0===t.detail?"keyboard":"mouse"):""),e.reason===ew.REASONS.triggerHover&&"mouseleave"===e.nativeEvent.type&&(Q.current=!0),e.reason===ew.REASONS.outsidePress)if(e.nested)Q.current=!1;else if(O(e.nativeEvent)||A(e.nativeEvent))Q.current=!1;else{let e=!1;(0,d.ownerDocument)(ek).createElement("div").focus({get preventScroll(){return e=!0,!1}}),e?Q.current=!1:Q.current=!0}}return e=(0,b.activeElement)(t),eQ(),e&&"body"!==(0,r.getNodeName)(e)&&(eX.push(new WeakRef(e)),eX.length>20&&(eX=eX.slice(-20))),F.on("openchange",n),()=>{F.off("openchange",n);let e=(0,b.activeElement)(t),s=e_(),i=(0,b.contains)(B,e)||s.some(t=>t===e||(0,b.contains)(t,e))||Y&&ey(Y.nodesRef.current,W(),!1).some(t=>(0,b.contains)(t.context?.elements.floating,e)),a=G.current,o=function(){let e=G.current,t="function"==typeof e?e(en.current):e;if(void 0===t||!1===t)return null;if(null===t&&(t=!0),"boolean"==typeof t){let e=U||eZ();return e&&e.isConnected?e:null}let r=U||eZ();return(0,eY.resolveRef)(t)||r||null}();queueMicrotask(()=>{let n=o?eo(o)?o:eu(o)[0]||o:null;a&&!Q.current&&(0,r.isHTMLElement)(n)&&("boolean"!=typeof a||n===e||e===t.body||i)&&n.focus({preventScroll:!0}),Q.current=!1})}},[v,B,ek,G,H,F,Y,U,W,e_]),(0,l.useIsoLayoutEffect)(()=>{if(!c.isWebKit||$||!B)return;let e=(0,b.activeElement)((0,d.ownerDocument)(B));(0,r.isHTMLElement)(e)&&R(e)&&(0,b.contains)(B,e)&&e.blur()},[$,B]),(0,l.useIsoLayoutEffect)(()=>
37{if(!v&&X)return X.setFocusManagerState({modal:k,closeOnFocusOut:S,open:$,onOpenChange:D.setOpen,domReference:U}),()=>{X.setFocusManagerState(null)}},[v,X,k,$,D,S,U]),(0,l.useIsoLayoutEffect)(()=>{if(!v&&ek)return e0(ek,V),()=>{queueMicrotask(eQ)}},[v,ek,V]);let eT=!v&&(!k||!z)&&(eE||k);return(0,m.jsxs)(t.Fragment,{children:[eT&&(0,m.jsx)(y,{"data-type":"inside",ref:el,onFocus:e=>{if(k){let e=eR();eS(e[e.length-1])}else if(X?.portalNode)if(Q.current=!1,ep(e,X.portalNode)){let e=eh(U);e?.focus()}else(0,eY.resolveRef)(j??X.beforeOutsideRef)?.focus()}}),g,eT&&(0,m.jsx)(y,{"data-type":"inside",ref:ec,onFocus:e=>{if(k)eS(eR()[0]);else if(X?.portalNode)if(S&&(Q.current=!0),ep(e,X.portalNode)){let e=ed(U);e?.focus()}else(0,eY.resolveRef)(I??X.afterOutsideRef)?.focus()}})]})}],82807)},83081,e=>{"use strict";let t="ArrowUp",r="ArrowDown",n="ArrowLeft",s="ArrowRight";[...new Set([...new Set([n,s]),...new Set([t,r])])];let i=new Set([t,r,n,s,"Home","End"]);e.s(["COMPOSITE_KEYS",0,i])},94852,e=>{"use strict";var t=e.i(9367);e.s(["inertValue",0,function(e){return(0,t.isReactVersionAtLeast)(19)?e:e?"true":void 0}])},10711,(e,t,r)=>{"use strict";var n=e.r(30878),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=n.useState,a=n.useEffect,o=n.useLayoutEffect,l=n.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!s(e,r)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=i({inst:{value:r,getSnapshot:t}}),s=n[0].inst,c=n[1];return o(function(){s.value=r,s.getSnapshot=t,u(s)&&c({inst:s})},[e,r,t]),a(function(){return u(s)&&c({inst:s}),e(function(){u(s)&&c({inst:s})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},53257,(e,t,r)=>{"use strict";t.exports=e.r(10711)},73605,(e,t,r)=>{"use strict";var n=e.r(30878),s=e.r(53257),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=s.useSyncExternalStore,o=n.useRef,l=n.useEffect,u=n.useMemo,c=n.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,n,s){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var f=a(e,(h=u(function(){function e(e){if(!l){if(l=!0,a=e,e=n(e),void 0!==s&&d.hasValue){var t=d.value;if(s(t,e))return o=t}return o=e}if(t=o,i(a,e))return t;var r=n(e);return void 0!==s&&s(t,r)?(a=e,t):(a=e,o=r)}var a,o,l=!1,u=void 0===r?null:r;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,r,n,s]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=f},[f]),c(f),f}},54069,(e,t,r)=>{"use strict";t.exports=e.r(73605)},42609,47669,39892,72139,e=>{"use strict";let t;e.i(50382);var r=e.i(31027);let n=(e,t,n,s,i,a,...o)=>{let l;if(o.length>0)throw Error((0,r.default)(1));if(e&&t&&n&&s&&i&&a)l=(r,o,l,u)=>a(e(r,o,l,u),t(r,o,l,u),n(r,o,l,u),s(r,o,l,u),i(r,o,l,u),o,l,u);else if(e&&t&&n&&s&&i)l=(r,a,o,l)=>i(e(r,a,o,l),t(r,a,o,l),n(r,a,o,l),s(r,a,o,l),a,o,l);else if(e&&t&&n&&s)l=(r,i,a,o)=>s(e(r,i,a,o),t(r,i,a,o),n(r,i,a,o),i,a,o);else if(e&&t&&n)l=(r,s,i,a)=>n(e(r,s,i,a),t(r,s,i,a),s,i,a);else if(e&&t)l=(r,n,s,i)=>t(e(r,n,s,i),n,s,i);else if(e)l=e;else throw Error("Missing arguments");return l};e.s(["createSelector",0,n],47669);var s=e.i(30878),i=e.i(53257),a=e.i(54069),o=e.i(9367),l=e.i(57948);let u=[];function c(){return t}function h(e){u.push(e)}function d(e){let r=(r,n)=>{let s,i=(0,l.useRefWithInit)(f).current;try{for(let e of(t=i,u))e.before(i);for(let t of(s=e(r,n),u))t.after(i);i.didInitialize=!0}finally{t=void 0}return s};return r.displayName=e.displayName||e.name,r}function f(){return{didInitialize:!1}}e.s(["fastComponent",0,d,"fastComponentRef",0,function(e){return s.forwardRef(d(e))},"getInstance",0,c,"register",0,h],39892);let p=(0,o.isReactVersionAtLeast)(19)?function(e,t,r,n,a){let o,l=c();if(!l){let o;return o=s.useCallback(()=>t(e.getSnapshot(),r,n,a),[e,t,r,n,a]),(0,i.useSyncExternalStore)(e.subscribe,o,o)}let u=l.syncIndex;return l.syncIndex+=1,l.didInitialize?(o=l.syncHooks[u]).store===e&&o.selector===t&&Object.is(o.a1,r)&&Object.is(o.a2,n)&&Object.is(o.a3,a)||(o.store!==e&&(l.didChangeStore=!0),o.store=e,o.selector=t,o.a1=r,o.a2=n,o.a3=a,o.didChange=!0):(o={store:e,selector:t,a1:r,a2:n,a3:a,value:t(e.getSnapshot(),r,n,a),didChange:!1},l.syncHooks.push(o)),o.value}:function(e,t,r,n,s){return(0,a.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,r,n,s))};h({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let r=0;r<e.syncHooks.length;r+=1){let n=e.syncHooks[r],s=n.selector(n.store.state,n.a1,n.a2,n.a3);(n.didChange||!Object.is(n.value,s))&&(t=!0,n.value=s,n.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let r=new Set;for(let t of e.syncHooks)r.add(t.store);let n=[];for(let e of r)n.push(e.subscribe(t));return()=>{for(let e of n)e()}}
37),(0,i.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});class g{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let r of this.listeners){if(t!==this.updateTick)return;r(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t]))return void this.setState({...this.state,...e})}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,r,n){return p(this,e,t,r,n)}}var m=e.i(91434),y=e.i(62926),b=e.i(88258);class v extends g{constructor(e,t={},r){super(e),this.context=t,this.selectors=r}useSyncedValue(e,t){s.useDebugValue(e),(0,y.useIsoLayoutEffect)(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let r=this;(0,y.useIsoLayoutEffect)(()=>(r.state[e]!==t&&r.set(e,t),()=>{r.set(e,void 0)}),[r,e,t])}useSyncedValues(e){let t=this,r=Object.values(e);(0,y.useIsoLayoutEffect)(()=>{t.update(e)},[t,...r])}useControlledProp(e,t){s.useDebugValue(e);let r=void 0!==t;(0,y.useIsoLayoutEffect)(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,r])}select(e,t,r,n){return(0,this.selectors[e])(this.state,t,r,n)}useState(e,t,r,n){return s.useDebugValue(e),p(this,this.selectors[e],t,r,n)}useContextCallback(e,t){s.useDebugValue(e);let r=(0,m.useStableCallback)(t??b.NOOP);this.context[e]=r}useStateSetter(e){let t=s.useRef(void 0);return void 0===t.current&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let r,n=(r="function"==typeof e?e:this.selectors[e])(this.state);return t(n,n,this),this.subscribe(e=>{let s=r(e);if(!Object.is(n,s)){let e=n;n=s,t(s,e,this)}})}}e.s(["ReactStore",0,v],72139);var w=e.i(55954),x=e.i(35982);let E={open:n(e=>e.open),transitionStatus:n(e=>e.transitionStatus),domReferenceElement:n(e=>e.domReferenceElement),referenceElement:n(e=>e.positionReference??e.referenceElement),floatingElement:n(e=>e.floatingElement),floatingId:n(e=>e.floatingId)};e.s(["FloatingRootStore",0,class extends v{constructor(e){const{syncOnly:t,nested:r,onOpenChange:n,triggerElements:s,...i}=e;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:n,dataRef:{current:{}},events:(0,w.createEventEmitter)(),nested:r,triggerElements:s},E),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||null!=t&&(0,x.isClickLikeEvent)(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>
37{this.syncOpenEvent(e,t.event);let r={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit("openchange",r)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}}],42609)},87541,e=>{"use strict";e.s(["PopupTriggerMap",0,class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let r=this.idMap.get(e);r!==t&&(void 0!==r&&this.elementsSet.delete(r),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}])},33267,e=>{"use strict";var t=e.i(30878),r=e.i(14294);let n=t.forwardRef(function(e,t){let n,{cutout:s,...i}=e;if(s){let e=s.getBoundingClientRect();n=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,r.jsx)("div",{ref:t,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:n}})});e.s(["InternalBackdrop",0,n])},21569,e=>{"use strict";var t=e.i(67481),r=e.i(13687),n=e.i(73459),s=e.i(42785),i=e.i(41961),a=e.i(62926),o=e.i(81528),l=e.i(31164),u=e.i(88258);let c={},h={},d="";class f{lockCount=0;restore=null;timeoutLock=o.Timeout.create();timeoutUnlock=o.Timeout.create();acquire(e){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){let a,o,f,p,g;if(0===this.lockCount||null!==this.restore)return;let m=(0,s.ownerDocument)(e).documentElement,y=(0,i.ownerWindow)(m).getComputedStyle(m).overflowY;if("hidden"===y||"clip"===y){this.restore=u.NOOP;return}let b=n.isIOS||!function(e){if("u"<typeof document)return!1;let t=(0,s.ownerDocument)(e);return(0,i.ownerWindow)(t).innerWidth-t.documentElement.clientWidth>0}(e);this.restore=b?(o=(a=(0,s.ownerDocument)(e)).documentElement,f=a.body,g={overflowY:(p=(0,t.isOverflowElement)(o)?o:f).style.overflowY,overflowX:p.style.overflowX},Object.assign(p.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(p.style,g)}):function(e){let a=(0,s.ownerDocument)(e),o=a.documentElement,u=a.body,f=(0,i.ownerWindow)(o),p=0,g=0,m=!1,y=l.AnimationFrame.create();if(n.isWebKit&&(f.visualViewport?.scale??1)!==1)return()=>{};function b(){let r=f.getComputedStyle(o),n=f.getComputedStyle(u),i=(r.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";p=o.scrollTop,g=o.scrollLeft,c={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY,overflowX:o.style.overflowX},d=o.style.scrollBehavior,h={position:u.style.position,height:u.style.height,width:u.style.width,boxSizing:u.style.boxSizing,overflowY:u.style.overflowY,overflowX:u.style.overflowX,scrollBehavior:u.style.scrollBehavior};let a=o.scrollHeight>o.clientHeight,l=o.scrollWidth>o.clientWidth,y="scroll"===r.overflowY||"scroll"===n.overflowY,b="scroll"===r.overflowX||"scroll"===n.overflowX,v=Math.max(0,f.innerWidth-u.clientWidth),w=Math.max(0,f.innerHeight-u.clientHeight),x=parseFloat(n.marginTop)+parseFloat(n.marginBottom),E=parseFloat(n.marginLeft)+parseFloat(n.marginRight),k=(0,t.isOverflowElement)(o)?o:u;if(m=function(e){if(!("u">typeof CSS&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||"u"<typeof document)return!1;let r=(0,s.ownerDocument)(e),n=r.documentElement,i=r.body,a=(0,t.isOverflowElement)(n)?n:i,o=a.style.overflowY,l=n.style.scrollbarGutter;n.style.scrollbarGutter="stable",a.style.overflowY="scroll";let u=a.offsetWidth;a.style.overflowY="hidden";let c=a.offsetWidth;return a.style.overflowY=o,n.style.scrollbarGutter=l,u===c}(e)){o.style.scrollbarGutter=i,k.style.overflowY="hidden",k.style.overflowX="hidden";return}Object.assign(o.style,{scrollbarGutter:i,overflowY:"hidden",overflowX:"hidden"}),(a||y)&&(o.style.overflowY="scroll"),(l||b)&&(o.style.overflowX="scroll"),Object.assign(u.style,{position:"relative",height:x||w?`calc(100dvh - ${x+w}px)`:"100dvh",width:E||v?`calc(100vw - ${E+v}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),u.scrollTop=p,u.scrollLeft=g,o.setAttribute("data-base-ui-scroll-locked",""),o.style.scrollBehavior="unset"}function v(){Object.assign(o.style,c),Object.assign(u.style,h),m||(o.scrollTop=p,o.scrollLeft=g,o.removeAttribute("data-base-ui-scroll-locked"),o.style.scrollBehavior=d)}b();let w=(0,r.addEventListener)(f,"resize",function(){v(),y.request(b)});return()=>{y.cancel(),v(),"function"==typeof f.removeEventListener&&w()}}(e)}}let p=new f;e.s(["useScrollLock",0,function(e=!0,t=null){(0,a.useIsoLayoutEffect)(()=>
37{if(e)return p.acquire(t)},[e,t])}])},69556,e=>{"use strict";var t=e.i(30878);e.s(["useOnFirstRender",0,function(e){let r=t.useRef(!0);r.current&&(r.current=!1,e())}])},73753,76026,52524,e=>{"use strict";var t=e.i(30878),r=e.i(67481),n=e.i(13687),s=e.i(35810),i=e.i(81528),a=e.i(91434),o=e.i(42785),l=e.i(85226),u=e.i(11235),c=e.i(35982),h=e.i(42372),d=e.i(4430),f=e.i(5760),p=e.i(10372),g=e.i(15926);let m={intentional:"onClick",sloppy:"onPointerDown"};function y(){return!1}e.s(["useDismiss",0,function(e,b={}){let v="rootStore"in e?e.rootStore:e,w=v.useState("open"),x=v.useState("floatingElement"),{dataRef:E}=v.context,{enabled:k=!0,escapeKey:S=!0,outsidePress:R=!0,outsidePressEvent:_="sloppy",referencePress:T=y,referencePressEvent:C="sloppy",bubbles:O,externalTree:A}=b,P=(0,d.useFloatingTree)(A),I=(0,a.useStableCallback)("function"==typeof R?R:()=>!1),j="function"==typeof R?I:R,N=!1!==j,L=(0,a.useStableCallback)(()=>_),M=t.useRef(!1),D=t.useRef(!1),$=t.useRef(!1),{escapeKey:U,outsidePress:B}={escapeKey:"boolean"==typeof O?O:O?.escapeKey??!1,outsidePress:"boolean"==typeof O?O:O?.outsidePress??!0},F=t.useRef(null),H=(0,i.useTimeout)(),W=(0,i.useTimeout)(),q=(0,a.useStableCallback)(()=>{W.clear(),E.current.insideReactTree=!1}),z=t.useRef(!1),V=t.useRef(""),K=(0,a.useStableCallback)(T),G=(0,a.useStableCallback)(e=>{if(!w||!k||!S||"Escape"!==e.key||z.current)return;let t=E.current.floatingContext?.nodeId,r=P?(0,h.getNodeChildren)(P.nodesRef.current,t):[];if(!U&&r.length>0){let e=!0;if(r.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let n=(0,c.isReactEvent)(e)?e.nativeEvent:e,s=(0,f.createChangeEventDetails)(p.REASONS.escapeKey,n);v.setOpen(!1,s),U||s.isPropagationAllowed||e.stopPropagation()}),J=(0,a.useStableCallback)(()=>{E.current.insideReactTree=!0,W.start(0,q)});t.useEffect(()=>{if(!w||!k)return;E.current.__escapeKeyBubbles=U,E.current.__outsidePressBubbles=B;let e=new i.Timeout,t=new i.Timeout;function a(){$.current=!0,t.start(0,()=>{$.current=!1})}function c(){M.current=!1,D.current=!1}function d(){let e=V.current,t=L(),r="function"==typeof t?t():t;return"string"==typeof r?r:r["pen"!==e&&e?e:"mouse"]}function m(e){let t=E.current.floatingContext?.nodeId,r=P&&(0,h.getNodeChildren)(P.nodesRef.current,t).some(t=>(0,u.isEventTargetWithin)(e,t.context?.elements.floating));return(0,u.isEventTargetWithin)(e,v.select("floatingElement"))||(0,u.isEventTargetWithin)(e,v.select("domReferenceElement"))||r}function y(e){let n;if("intentional"===(n=d())&&"click"!==e.type||"sloppy"===n&&"click"===e.type||E.current.insideReactTree)return void q();let s=(0,l.getTarget)(e),i=`[${(0,g.createAttribute)("inert")}]`,a=(0,r.isElement)(s)?s.getRootNode():null,c=Array.from(((0,r.isShadowRoot)(a)?a:(0,o.ownerDocument)(v.select("floatingElement"))).querySelectorAll(i)),y=v.context.triggerElements;if(s&&(y.hasElement(s)||y.hasMatchingElement(e=>(0,l.contains)(e,s))))return;let b=(0,r.isElement)(s)?s:null;for(;b&&!(0,r.isLastTraversableNode)(b);){let e=(0,r.getParentNode)(b);if((0,r.isLastTraversableNode)(e)||!(0,r.isElement)(e))break;b=e}if(c.length&&(0,r.isElement)(s)&&!(0,u.isRootElement)(s)&&!(0,l.contains)(s,v.select("floatingElement"))&&c.every(e=>!(0,l.contains)(b,e)))return;if((0,r.isHTMLElement)(s)&&!("touches"in e)){let t=(0,r.isLastTraversableNode)(s),n=(0,r.getComputedStyle)(s),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),l=a&&s.clientWidth>0&&s.scrollWidth>s.clientWidth,u=o&&s.clientHeight>0&&s.scrollHeight>s.clientHeight,c="rtl"===n.direction,h=u&&(c?e.offsetX<=s.offsetWidth-s.clientWidth:e.offsetX>s.clientWidth),d=l&&e.offsetY>s.clientHeight;if(h||d)return}if(m(e))return;if("intentional"===d()&&$.current){t.clear(),$.current=!1;return}if("function"==typeof j&&!j(e))return;let w=E.current.floatingContext?.nodeId,x=P?(0,h.getNodeChildren)(P.nodesRef.current,w):[];if(x.length>0){let e=!0;if(x.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}v.setOpen(!1,(0,f.createChangeEventDetails)(p.REASONS.outsidePress,e)),q()}
37function b(e){if("sloppy"!==d()||!v.select("open")||!k||(0,u.isEventTargetWithin)(e,v.select("floatingElement"))||(0,u.isEventTargetWithin)(e,v.select("domReferenceElement")))return;let t=e.touches[0];t&&(F.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},H.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function R(e,t){let r=(0,l.getTarget)(e);if(!r)return;let s=(0,n.addEventListener)(r,e.type,()=>{t(e),s()})}function _(e){H.clear(),"pointerdown"===e.type&&(V.current=e.pointerType),("mousedown"!==e.type||!F.current||F.current.dismissOnMouseDown)&&R(e,e=>{if("pointerdown"===e.type)"sloppy"!==d()||"touch"===e.pointerType||!v.select("open")||!k||(0,u.isEventTargetWithin)(e,v.select("floatingElement"))||(0,u.isEventTargetWithin)(e,v.select("domReferenceElement"))||y(e);else y(e)})}function T(e){if(!M.current)return;let r=D.current;if(c(),"intentional"===d()){if("pointercancel"===e.type){r&&a();return}m(e)||(r?a():("function"!=typeof j||j(e))&&(t.clear(),$.current=!0,q()))}}function C(e){if("sloppy"!==d()||!F.current||(0,u.isEventTargetWithin)(e,v.select("floatingElement"))||(0,u.isEventTargetWithin)(e,v.select("domReferenceElement")))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-F.current.startX),n=Math.abs(t.clientY-F.current.startY),s=Math.sqrt(r*r+n*n);s>5&&(F.current.dismissOnTouchEnd=!0),s>10&&(y(e),H.clear(),F.current=null)}function O(e){"sloppy"!==d()||!F.current||(0,u.isEventTargetWithin)(e,v.select("floatingElement"))||(0,u.isEventTargetWithin)(e,v.select("domReferenceElement"))||(F.current.dismissOnTouchEnd&&y(e),H.clear(),F.current=null)}let A=(0,o.ownerDocument)(x),I=(0,s.mergeCleanups)(S&&(0,s.mergeCleanups)((0,n.addEventListener)(A,"keydown",G),(0,n.addEventListener)(A,"compositionstart",function(){e.clear(),z.current=!0}),(0,n.addEventListener)(A,"compositionend",function(){e.start(5*!!(0,r.isWebKit)(),()=>{z.current=!1})})),N&&(0,s.mergeCleanups)((0,n.addEventListener)(A,"click",_,!0),(0,n.addEventListener)(A,"pointerdown",_,!0),(0,n.addEventListener)(A,"pointerup",T,!0),(0,n.addEventListener)(A,"pointercancel",T,!0),(0,n.addEventListener)(A,"mousedown",_,!0),(0,n.addEventListener)(A,"mouseup",T,!0),(0,n.addEventListener)(A,"touchstart",function(e){V.current="touch",R(e,b)},!0),(0,n.addEventListener)(A,"touchmove",function(e){R(e,C)},!0),(0,n.addEventListener)(A,"touchend",function(e){R(e,O)},!0)));return()=>{I(),e.clear(),t.clear(),c(),$.current=!1}},[E,x,S,N,j,w,k,U,B,G,q,L,P,v,H]),t.useEffect(q,[j,q]);let Y=t.useMemo(()=>({onKeyDown:G,[m[C]]:e=>{K()&&v.setOpen(!1,(0,f.createChangeEventDetails)(p.REASONS.triggerPress,e.nativeEvent))},..."intentional"!==C&&{onClick(e){K()&&v.setOpen(!1,(0,f.createChangeEventDetails)(p.REASONS.triggerPress,e.nativeEvent))}}}),[G,v,C,K]),X=(0,a.useStableCallback)(e=>{if(!w||!k||0!==e.button)return;let t=(0,l.getTarget)(e.nativeEvent);(0,l.contains)(v.select("floatingElement"),t)&&(M.current||(M.current=!0,D.current=!1))}),Q=(0,a.useStableCallback)(e=>{!w||!k||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&M.current&&(D.current=!0)}),Z=t.useMemo(()=>({onKeyDown:G,onPointerDown:Q,onMouseDown:Q,onClickCapture:J,onMouseDownCapture(e){J(),X(e)},onPointerDownCapture(e){J(),X(e)},onMouseUpCapture:J,onTouchEndCapture:J,onTouchMoveCapture:J}),[G,J,X,Q]);return t.useMemo(()=>k?{reference:Y,floating:Z,trigger:Y}:{},[k,Y,Z])}],73753);var b=e.i(29314);function v(e,t,r){let n=new Map,s="item"===r,i={};for(let t in"floating"===r&&(i.tabIndex=-1,i[b.FOCUSABLE_ATTRIBUTE]=""),e)s&&e&&(t===b.ACTIVE_KEY||t===b.SELECTED_KEY)||(i[t]=e[t]);for(let a=0;a<t.length;a+=1){let o,l=t[a]?.[r];(o="function"==typeof l?e?l(e):null:l)&&w(i,o,s,n)}return w(i,e,s,n),i}function w(e,t,r,n){for(let s in t){let i=t[s];r&&(s===b.ACTIVE_KEY||s===b.SELECTED_KEY)||(s.startsWith("on")?(n.has(s)||n.set(s,[]),"function"==typeof i&&(n.get(s)?.push(i),e[s]=(...e)=>n.get(s)?.map(t=>t(...e)).find(e=>void 0!==e))):e[s]=i)}}e.s(["useInteractions",0,function(e=[]){let r=e.map(e=>e?.reference),n=e.map(e=>e?.floating),s=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=t.useCallback(t=>v(t,e,"reference"),r),o=t.useCallback(t=>v(t,e,"floating"),n),l=t.useCallback(t=>v(t,e,"item"),s),u=t.useCallback(t=>v(t,e,"trigger"),i);return t.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:l,getTriggerProps:u}),[a,o,l,u])}],76026);var x=e.i(47094),E=e.i(88258);let k=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);e.s(["useRole",0,function(e,r={}){let n="rootStore"in e?e.rootStore:e,s=n.useState("open"),i=n.useState("floatingId"),a=n.useState("domReferenceElement"),o=n.useState("floatingElement"),{role:l="dialog"}=r,c=(0,x.useId)(),h=a?.id||c,f=t.useMemo(()=>(0,u.getFloatingFocusElement)(o)?.id||i,[o,i]),p=k.get(l)??l,g=null!=(0,d.useFloatingParentNodeId)(),m=t.useMemo(()=>"tooltip"===p||"label"===l?E.EMPTY_OBJECT:{"aria-haspopup":"alertdialog"===p?"dialog":p,"aria-expanded":"false",..."listbox"===p&&{role:"combobox"},..."menu"===p&&g&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[p,g,l]),y=t.useMemo(()=>"tooltip"===p||"label"===l?{[`aria-${"label"===l?"labelledby":"describedby"}`]:s?f:void 0}:{...m,"aria-expanded":s?"true":"false","aria-controls":s?f:void 0,..."menu"===p&&{id:h}},[p,f,s,h,l,m]),b=t.useMemo(()=>
37{let e={id:f,...p&&{role:p}};return"tooltip"===p||"label"===l?e:{...e,..."menu"===p&&{"aria-labelledby":h}}},[p,f,h,l]),v=t.useCallback(({active:e,selected:t})=>{let r={role:"option",...e&&{id:`${f}-fui-option`}};switch(l){case"select":case"combobox":return{...r,"aria-selected":t}}return{}},[f,l]);return t.useMemo(()=>({reference:y,floating:b,item:v,trigger:m}),[y,b,m,v])}],52524)},31244,62108,e=>{"use strict";var t=e.i(47094),r=e.i(57948),n=e.i(62926),s=e.i(67481),i=e.i(4430),a=e.i(42609);e.s(["useSyncedFloatingRootContext",0,function(e){let{popupStore:o,treatPopupAsFloatingElement:l=!1,onOpenChange:u}=e,c=(0,t.useId)(),h=null!=(0,i.useFloatingParentNodeId)(),d=o.useState("open"),f=o.useState("activeTriggerElement"),p=o.useState(l?"popupElement":"positionerElement"),g=o.context.triggerElements,m=(0,r.useRefWithInit)(()=>new a.FloatingRootStore({open:d,transitionStatus:void 0,referenceElement:f,floatingElement:p,triggerElements:g,onOpenChange:u,floatingId:c,syncOnly:!0,nested:h})).current;return(0,n.useIsoLayoutEffect)(()=>{let e={open:d,floatingId:c,referenceElement:f,floatingElement:p};(0,s.isElement)(f)&&(e.domReferenceElement=f),m.state.positionReference===m.state.referenceElement&&(e.positionReference=f),m.update(e)},[d,c,f,p,m]),m.context.onOpenChange=u,m.context.nested=h,m}],31244);var o=e.i(30878),l=e.i(91434),u=e.i(73459);e.s(["useOpenInteractionType",0,function(e){let t,r,s,i,[a,c]=o.useState(null),h=(0,l.useStableCallback)((t,r)=>{e||c(r||(u.isIOS?"touch":""))});t=o.useRef(e),r=(0,l.useStableCallback)(t=>{t&&!e&&c(null)}),(0,n.useIsoLayoutEffect)(()=>{t.current!==e&&r(t.current)},[e,r]),(0,n.useIsoLayoutEffect)(()=>{t.current=e},[e]);let{onClick:d,onPointerDown:f}=(s=o.useRef(""),i=o.useCallback(e=>{e.defaultPrevented||(s.current=e.pointerType,h(e,e.pointerType))},[h]),{onClick:o.useCallback(e=>{0===e.detail?h(e,"keyboard"):(h(e,"pointerType"in e?e.pointerType:s.current),s.current="")},[h]),onPointerDown:i});return o.useMemo(()=>({openMethod:a,triggerProps:{onClick:d,onPointerDown:f}}),[a,d,f])}],62108)},42155,e=>{"use strict";var t=e.i(47669),r=e.i(88258),n=e.i(87541),s=e.i(42609);let i=(0,t.createSelector)(e=>e.triggerIdProp??e.activeTriggerId),a={open:(0,t.createSelector)(e=>e.openProp??e.open),mounted:(0,t.createSelector)(e=>e.mounted),transitionStatus:(0,t.createSelector)(e=>e.transitionStatus),floatingRootContext:(0,t.createSelector)(e=>e.floatingRootContext),preventUnmountingOnClose:(0,t.createSelector)(e=>e.preventUnmountingOnClose),payload:(0,t.createSelector)(e=>e.payload),activeTriggerId:i,activeTriggerElement:(0,t.createSelector)(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:(0,t.createSelector)((e,t)=>void 0!==t&&i(e)===t),isOpenedByTrigger:(0,t.createSelector)((e,t)=>void 0!==t&&i(e)===t&&e.open),isMountedByTrigger:(0,t.createSelector)((e,t)=>void 0!==t&&i(e)===t&&e.mounted),triggerProps:(0,t.createSelector)((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:(0,t.createSelector)(e=>e.popupProps),popupElement:(0,t.createSelector)(e=>e.popupElement),positionerElement:(0,t.createSelector)(e=>e.positionerElement)};e.s(["createInitialPopupStoreState",0,function(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new s.FloatingRootStore({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new n.PopupTriggerMap,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0}),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:r.EMPTY_OBJECT,inactiveTriggerProps:r.EMPTY_OBJECT,popupProps:r.EMPTY_OBJECT}},"popupStoreSelectors",0,a],42155)},71949,e=>{"use strict";var t=e.i(30878),r=e.i(91434),n=e.i(62926),s=e.i(86360),i=e.i(64422);function a(e,r){let n=t.useRef(null),s=t.useRef(null);return t.useCallback(t=>{if(void 0!==e){if(null!==n.current){let e=n.current,t=s.current,i=r.context.triggerElements.getById(e);t&&i===t&&r.context.triggerElements.delete(e),n.current=null,s.current=null}null!==t&&(n.current=e,s.current=t,r.context.triggerElements.add(e,t))}},[r,e])}e.s(["useImplicitActiveTrigger",0,function(e){let t=e.useState("open");(0,n.useIsoLayoutEffect)(()=>
37{if(t&&!e.select("activeTriggerId")&&1===e.context.triggerElements.size){let t=e.context.triggerElements.entries().next();if(!t.done){let[r,n]=t.value;e.update({activeTriggerId:r,activeTriggerElement:n})}}},[t,e])},"useOpenStateTransitions",0,function(e,t,n){let{mounted:a,setMounted:o,transitionStatus:l}=(0,s.useTransitionStatus)(e);t.useSyncedValues({mounted:a,transitionStatus:l});let u=(0,r.useStableCallback)(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),c=t.useState("preventUnmountingOnClose");return(0,i.useOpenChangeComplete)({enabled:!c,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:l}},"useTriggerDataForwarding",0,function(e,t,s,i){let o=s.useState("isMountedByTrigger",e),l=a(e,s),u=(0,r.useStableCallback)(t=>{if(l(t),!t||!s.select("open"))return;let r=s.select("activeTriggerId");r===e?s.update({activeTriggerElement:t,...i}):null==r&&s.update({activeTriggerId:e,activeTriggerElement:t,...i})});return(0,n.useIsoLayoutEffect)(()=>{o&&s.update({activeTriggerElement:t.current,...i})},[o,s,t,...Object.values(i)]),{registerTrigger:u,isMountedByThisTrigger:o}},"useTriggerRegistration",0,a])},72444,e=>{"use strict";var t=e.i(30878),r=e.i(31164),n=e.i(81528),s=e.i(88258),i=e.i(85226),a=e.i(11235),o=e.i(35982),l=e.i(5760),u=e.i(10372);e.s(["useClick",0,function(e,c={}){let h="rootStore"in e?e.rootStore:e,d=h.context.dataRef,{enabled:f=!0,event:p="click",toggle:g=!0,ignoreMouse:m=!1,stickIfOpen:y=!0,touchOpenDelay:b=0,reason:v=u.REASONS.triggerPress}=c,w=t.useRef(void 0),x=(0,r.useAnimationFrame)(),E=(0,n.useTimeout)(),k=t.useMemo(()=>({onPointerDown(e){w.current=e.pointerType},onMouseDown(e){let t=w.current,r=e.nativeEvent,n=h.select("open");if(0!==e.button||"click"===p||(0,o.isMouseLikePointerType)(t,!0)&&m)return;let s=d.current.openEvent,u=s?.type,c=h.select("domReferenceElement")!==e.currentTarget,f=n&&c||!(n&&g&&(!s||!y||"click"===u||"mousedown"===u)),k=(0,i.getTarget)(r);if((0,a.isTypeableElement)(k)){let e=(0,l.createChangeEventDetails)(v,r,k);f&&"touch"===t&&b>0?E.start(b,()=>{h.setOpen(!0,e)}):h.setOpen(f,e);return}let S=e.currentTarget;x.request(()=>{let e=(0,l.createChangeEventDetails)(v,r,S);f&&"touch"===t&&b>0?E.start(b,()=>{h.setOpen(!0,e)}):h.setOpen(f,e)})},onClick(e){if("mousedown-only"===p)return;let t=w.current;if("mousedown"===p&&t){w.current=void 0;return}if((0,o.isMouseLikePointerType)(t,!0)&&m)return;let r=h.select("open"),n=d.current.openEvent,s=h.select("domReferenceElement")!==e.currentTarget,i=r&&s||!(r&&g&&(!n||!y||(0,o.isClickLikeEvent)(n))),a=(0,l.createChangeEventDetails)(v,e.nativeEvent,e.currentTarget);i&&"touch"===t&&b>0?E.start(b,()=>{h.setOpen(!0,a)}):h.setOpen(i,a)},onKeyDown(){w.current=void 0}}),[d,p,m,h,y,g,x,E,b,v]);return t.useMemo(()=>f?{reference:k}:s.EMPTY_OBJECT,[f,k])}])},7387,e=>{"use strict";let t=(0,e.i(92511).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",0,t],7387)},2567,68926,e=>{"use strict";e.s([],2567),e.i(50382);var t=e.i(31027),r=e.i(30878);let n=r.createContext(void 0);e.s(["DialogRootContext",0,n,"useDialogRootContext",0,function(e){let s=r.useContext(n);if(!1===e&&void 0===s)throw Error((0,t.default)(27));return s}],68926)},43029,18609,83268,e=>{"use strict";e.i(50382);var t=e.i(30878),r=e.i(68926),n=e.i(85207),s=e.i(1777),i=e.i(13046);let a={...s.popupStateMapping,...i.transitionStatusMapping},o=t.forwardRef(function(e,t){let{render:s,className:i,style:o,forceRender:l=!1,...u}=e,{store:c}=(0,r.useDialogRootContext)(),h=c.useState("open"),d=c.useState("nested"),f=c.useState("mounted"),p=c.useState("transitionStatus");return(0,n.useRenderElement)("div",e,{state:{open:h,transitionStatus:p},ref:[c.context.backdropRef,t],stateAttributesMapping:a,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:l||!d})});e.s(["DialogBackdrop",0,o],43029);var l=e.i(84829),u=e.i(5760),c=e.i(10372);let h=t.forwardRef(function(e,t){let{render:s,className:i,disabled:a=!1,nativeButton:o=!0,style:h,...d}=e,{store:f}=(0,r.useDialogRootContext)(),p=f.useState("open"),{getButtonProps:g,buttonRef:m}=(0,l.useButton)({disabled:a,native:o});return(0,n.useRenderElement)("button",e,{state:{disabled:a},ref:[t,m],props:[{onClick:function(e){p&&f.setOpen(!1,(0,u.createChangeEventDetails)(c.REASONS.closePress,e.nativeEvent))}},d,g]})});e.s(["DialogClose",0,h],18609);var d=e.i(66021);let f=t.forwardRef(function(e,t){let{render:s,className:i,style:a,id:o,...l}=e,{store:u}=(0,r.useDialogRootContext)(),c=(0,d.useBaseUiId)(o);return u.useSyncedValueWithCleanup("descriptionElementId",c),(0,n.useRenderElement)("p",e,{ref:t,props:[{id:c},l]})});e.s(["DialogDescription",0,f],83268)},77001,4622,38264,e=>{"use strict";let t=((r={}).nestedDialogs="--nested-dialogs",r);e.s(["DialogPopupCssVars",0,t],77001);var r,n,s=e.i(1777);let i=((n={})[n.open=s.CommonPopupDataAttributes.open]="open",n[n.closed=s.CommonPopupDataAttributes.closed]="closed",n[n.startingStyle=s.CommonPopupDataAttributes.startingStyle]="startingStyle",n[n.endingStyle=s.CommonPopupDataAttributes.endingStyle]="endingStyle",n.nested="data-nested",n.nestedDialogOpen="data-nested-dialog-open",n);e.s(["DialogPopupDataAttributes",0,i],4622),e.i(50382);var a=e.i(31027),o=e.i(30878);let l=o.createContext(void 0);e.s(["DialogPortalContext",0,l,"useDialogPortalContext",0,function(){let e=o.useContext(l);if(void 0===e)throw Error((0,a.default)(26));return e}],38264)},899,e=>{"use strict";var t=e.i(30878),r=e.i(82807),n=e.i(68926),s=e.i(85207),i=e.i(1777),a=e.i(13046),o=e.i(77001),l=e.i(4622),u=e.i(38264),c=e.i(64422),h=e.i(83081),d=e.i(14294);let f={...i.popupStateMapping,...a.transitionStatusMapping,nestedDialogOpen:e=>e?{[l.DialogPopupDataAttributes.nestedDialogOpen]:""}:null},p=t.forwardRef(function(e,t){let{className:i,finalFocus:a,initialFocus:l,render:p,style:g,...m}=e,{store:y}=(0,n.useDialogRootContext)(),b=y.useState("descriptionElementId"),v=y.useState("disablePointerDismissal"),w=y.useState("floatingRootContext"),x=y.useState("popupProps"),E=y.useState("modal"),k=y.useState("mounted"),S=y.useState("nested"),R=y.useState("nestedOpenDialogCount"),_=y.useState("open"),T=y.useState("openMethod"),C=y.useState("titleElementId"),O=y.useState("transitionStatus"),A=y.useState("role");(0,u.useDialogPortalContext)(),(0,c.useOpenChangeComplete)({open:_,ref:y.context.popupRef,onComplete(){_&&y.context.onOpenChangeComplete?.(!0)}});let P=void 0===l?function(e){return"touch"!==e||y.context.popupRef.current}:l,I=(0,s.useRenderElement)("div",e,{state:{open:_,nested:S,transitionStatus:O,nestedDialogOpen:R>0},props:[x,{"aria-labelledby":C??void 0,"aria-describedby":b??void 0,role:A,tabIndex:-1,hidden:!k,onKeyDown(e){h.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()},style:{[o.DialogPopupCssVars.nestedDialogs]:R}},m],ref:[t,y.context.popupRef,y.useStateSetter("popupElement")],stateAttributesMapping:f});return(0,d.jsx)(r.FloatingFocusManager,{context:w,openInteractionType:T,disabled:!k,closeOnFocusOut:!v,initialFocus:P,returnFocus:a,modal:!1!==E,restoreFocus:"popup",children:I})});e.s(["DialogPopup",0,p])},6400,e=>{"use strict";var t=e.i(30878),r=e.i(94852),n=e.i(86601),s=e.i(68926),i=e.i(38264),a=e.i(33267),o=e.i(14294);let l=t.forwardRef(function(e,t){let{keepMounted:l=!1,...u}=e,{store:c}=(0,s.useDialogRootContext)(),h=c.useState("mounted"),d=c.useState("modal"),f=c.useState("open");return h||l?(0,o.jsx)(i.DialogPortalContext.Provider,{value:l,children:(0,o.jsxs)(n.FloatingPortal,{ref:t,...u,children:[h&&!0===d&&(0,o.jsx)(a.InternalBackdrop,{ref:c.context.
37internalBackdropRef,inert:(0,r.inertValue)(!f)}),e.children]})}):null});e.s(["DialogPortal",0,l])},42829,e=>{"use strict";var t=e.i(30878),r=e.i(21569),n=e.i(73753),s=e.i(76026),i=e.i(52524),a=e.i(31244),o=e.i(85226),l=e.i(62108),u=e.i(5760),c=e.i(10372),h=e.i(71949);e.s(["useDialogRoot",0,function(e){let{store:d,parentContext:f,actionsRef:p,isDrawer:g}=e,m=d.useState("open"),y=d.useState("disablePointerDismissal"),b=d.useState("modal"),v=d.useState("popupElement"),{openMethod:w,triggerProps:x}=(0,l.useOpenInteractionType)(m);(0,h.useImplicitActiveTrigger)(d);let{forceUnmount:E}=(0,h.useOpenStateTransitions)(m,d),k=t.useCallback(()=>{d.setOpen(!1,(0,u.createChangeEventDetails)(c.REASONS.imperativeAction))},[d]);t.useImperativeHandle(p,()=>({unmount:E,close:k}),[E,k]);let S=(0,a.useSyncedFloatingRootContext)({popupStore:d,onOpenChange:d.setOpen,treatPopupAsFloatingElement:!0}),[R,_]=t.useState(0),[T,C]=t.useState(0),O=0===R,A=(0,i.useRole)(S),P=(0,n.useDismiss)(S,{outsidePressEvent:()=>d.context.internalBackdropRef.current||d.context.backdropRef.current?"intentional":{mouse:"trap-focus"===b?"sloppy":"intentional",touch:"sloppy"},outsidePress(e){if(!d.context.outsidePressEnabledRef.current||"button"in e&&0!==e.button||"touches"in e&&1!==e.touches.length)return!1;let t=(0,o.getTarget)(e);return!!O&&!y&&(!b||!d.context.internalBackdropRef.current&&!d.context.backdropRef.current||d.context.internalBackdropRef.current===t||d.context.backdropRef.current===t||(0,o.contains)(t,v)&&!t?.hasAttribute("data-base-ui-portal"))},escapeKey:O});(0,r.useScrollLock)(m&&!0===b,v);let{getReferenceProps:I,getFloatingProps:j,getTriggerProps:N}=(0,s.useInteractions)([A,P]);d.useContextCallback("onNestedDialogOpen",(e,t)=>{_(e),C(t)}),d.useContextCallback("onNestedDialogClose",()=>{_(0),C(0)}),t.useEffect(()=>(f?.onNestedDialogOpen&&m&&f.onNestedDialogOpen(R+1,T+ +!!g),f?.onNestedDialogClose&&!m&&f.onNestedDialogClose(),()=>{f?.onNestedDialogClose&&m&&f.onNestedDialogClose()}),[g,m,R,T,f]);let L=t.useMemo(()=>I(x),[I,x]),M=t.useMemo(()=>N(x),[N,x]),D=t.useMemo(()=>j(),[j]);d.useSyncedValues({openMethod:w,activeTriggerProps:L,inactiveTriggerProps:M,popupProps:D,floatingRootContext:S,nestedOpenDialogCount:R,nestedOpenDrawerCount:T})}])},98386,92951,53361,59704,e=>{"use strict";e.i(50382);var t,r=e.i(30878),n=e.i(69556),s=e.i(42829),i=e.i(68926),a=e.i(47669),o=e.i(72139),l=e.i(57948),u=e.i(42155),c=e.i(87541);let h={...u.popupStoreSelectors,modal:(0,a.createSelector)(e=>e.modal),nested:(0,a.createSelector)(e=>e.nested),nestedOpenDialogCount:(0,a.createSelector)(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:(0,a.createSelector)(e=>e.nestedOpenDrawerCount),disablePointerDismissal:(0,a.createSelector)(e=>e.disablePointerDismissal),openMethod:(0,a.createSelector)(e=>e.openMethod),descriptionElementId:(0,a.createSelector)(e=>e.descriptionElementId),titleElementId:(0,a.createSelector)(e=>e.titleElementId),viewportElement:(0,a.createSelector)(e=>e.viewportElement),role:(0,a.createSelector)(e=>e.role)};class d extends o.ReactStore{constructor(e){super(function(e={}){return{...(0,u.createInitialPopupStoreState)(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}(e),{popupRef:r.createRef(),backdropRef:r.createRef(),internalBackdropRef:r.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new c.PopupTriggerMap,onOpenChange:void 0,onOpenChangeComplete:void 0},h)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||null==this.state.activeTriggerId||(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let r={open:e},n=t.trigger?.id??null;(n||e)&&(r.activeTriggerId=n,r.activeTriggerElement=t.trigger??null),this.update(r)};static useStore(e,t){let r=(0,l.useRefWithInit)(()=>new d(t)).current;return e??r}}e.s(["DialogStore",0,d],92951);var f=e.i(14294);let p=r.createContext(!1);e.s(["DialogRoot",0,function(e){let{children:t,open:a,defaultOpen:o=!1,onOpenChange:l,onOpenChangeComplete:u,disablePointerDismissal:c=!1,modal:h=!0,actionsRef:g,handle:m,triggerId:y,defaultTr
37iggerId:b=null}=e,v=(0,i.useDialogRootContext)(!0),w=r.useContext(p),x=!!v,E=d.useStore(m?.store,{open:o,openProp:a,activeTriggerId:b,triggerIdProp:y,modal:h,disablePointerDismissal:c,nested:x});(0,n.useOnFirstRender)(()=>{void 0===a&&!1===E.state.open&&!0===o&&E.update({open:!0,activeTriggerId:b})}),E.useControlledProp("openProp",a),E.useControlledProp("triggerIdProp",y),E.useSyncedValues({disablePointerDismissal:c,nested:x,modal:h}),E.useContextCallback("onOpenChange",l),E.useContextCallback("onOpenChangeComplete",u);let k=E.useState("payload");(0,s.useDialogRoot)({store:E,actionsRef:g,parentContext:v?.store.context,isDrawer:w,onOpenChange:l,triggerIdProp:y});let S=r.useMemo(()=>({store:E}),[E]);return(0,f.jsx)(p.Provider,{value:!1,children:(0,f.jsx)(i.DialogRootContext.Provider,{value:S,children:"function"==typeof t?t({payload:k}):t})})}],98386);var g=e.i(85207),m=e.i(1777),y=e.i(13046),b=e.i(38264);let v=((t={})[t.open=m.CommonPopupDataAttributes.open]="open",t[t.closed=m.CommonPopupDataAttributes.closed]="closed",t[t.startingStyle=m.CommonPopupDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=m.CommonPopupDataAttributes.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t),w={...m.popupStateMapping,...y.transitionStatusMapping,nested:e=>e?{[v.nested]:""}:null,nestedDialogOpen:e=>e?{[v.nestedDialogOpen]:""}:null},x=r.forwardRef(function(e,t){let{className:r,render:n,children:s,style:a,...o}=e,l=(0,b.useDialogPortalContext)(),{store:u}=(0,i.useDialogRootContext)(),c=u.useState("open"),h=u.useState("nested"),d=u.useState("transitionStatus"),f=u.useState("nestedOpenDialogCount"),p=u.useState("mounted");return(0,g.useRenderElement)("div",e,{enabled:l||p,state:{open:c,nested:h,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,u.useStateSetter("viewportElement")],stateAttributesMapping:w,props:[{role:"presentation",hidden:!p,style:{pointerEvents:c?void 0:"none"},children:s},o]})});e.s(["DialogViewport",0,x],53361);var E=e.i(66021);let k=r.forwardRef(function(e,t){let{render:r,className:n,style:s,id:a,...o}=e,{store:l}=(0,i.useDialogRootContext)(),u=(0,E.useBaseUiId)(a);return l.useSyncedValueWithCleanup("titleElementId",u),(0,g.useRenderElement)("h2",e,{ref:t,props:[{id:u},o]})});e.s(["DialogTitle",0,k],59704)},17313,e=>{"use strict";e.i(2567);var t=e.i(43029),r=e.i(18609),n=e.i(83268),s=e.i(899),i=e.i(6400),a=e.i(98386),o=e.i(53361),l=e.i(59704);e.i(50382);var u=e.i(31027),c=e.i(30878),h=e.i(68926),d=e.i(84829),f=e.i(85207),p=e.i(1777),g=e.i(44607),m=e.i(71949),y=e.i(66021),b=e.i(72444),v=e.i(76026);let w=c.forwardRef(function(e,t){let{render:r,className:n,disabled:s=!1,nativeButton:i=!0,id:a,payload:o,handle:l,style:w,...x}=e,E=(0,h.useDialogRootContext)(!0),k=l?.store??E?.store;if(!k)throw Error((0,u.default)(79));let S=(0,y.useBaseUiId)(a),R=k.useState("floatingRootContext"),_=k.useState("isOpenedByTrigger",S),T=c.useRef(null),{registerTrigger:C,isMountedByThisTrigger:O}=(0,m.useTriggerDataForwarding)(S,T,k,{payload:o}),{getButtonProps:A,buttonRef:P}=(0,d.useButton)({disabled:s,native:i}),I=(0,b.useClick)(R,{enabled:null!=R}),j=(0,v.useInteractions)([I]),N=k.useState("triggerProps",O);return(0,f.useRenderElement)("button",e,{state:{disabled:s,open:_},ref:[P,t,C,T],props:[j.getReferenceProps(),N,{[g.CLICK_TRIGGER_IDENTIFIER]:"",id:S},x,A],stateAttributesMapping:p.triggerOpenStateMapping})});var x=e.i(92951),E=e.i(5760),k=e.i(10372);class S{constructor(e){this.store=e??new x.DialogStore}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;this.store.setOpen(!0,(0,E.createChangeEventDetails)(k.REASONS.imperativeAction,void 0,t))}openWithPayload(e){this.store.set("payload",e),this.store.setOpen(!0,(0,E.createChangeEventDetails)(k.REASONS.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,(0,E.createChangeEventDetails)(k.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Backdrop",()=>t.DialogBackdrop,"Close",()=>r.DialogClose,"Description",()=>n.DialogDescription,"Handle",0,S,"Popup",()=>s.DialogPopup,"Portal",()=>i.DialogPortal,"Root",()=>
37a.DialogRoot,"Title",()=>l.DialogTitle,"Trigger",0,w,"Viewport",()=>o.DialogViewport,"createHandle",0,function(){return new S}],41355);var R=e.i(41355);e.s(["Dialog",0,R],17313)},25363,e=>{"use strict";var t,r,n,s=e.i(14294),i=e.i(30878),a=e.i(55552),o=e.i(4561),l=e.i(93575),u=e.i(92623);function c({className:e}){return(0,s.jsx)(u.default,{src:"/brand/logo-b.jpg",alt:"brickster.ai",width:64,height:64,className:e,priority:!0,unoptimized:!0})}var h=e.i(53913),d=e.i(72379),f=e.i(92511);let p=(0,f.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),g=(0,f.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var m=e.i(90563),y=e.i(99644),b=e.i(84222),v=e.i(98878),w=e.i(1414),x=e.i(84371);function E({className:e}){return(0,s.jsxs)("div",{className:e??"flex items-center gap-4 text-muted-foreground",children:[(0,s.jsx)("a",{href:m.SOCIAL.linkedin,target:"_blank",rel:"noopener noreferrer","aria-label":"brickster.ai on LinkedIn",className:"transition-colors hover:text-primary",children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"size-4","aria-hidden":!0,children:(0,s.jsx)("path",{d:"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14zM8.34 18.34V9.94H5.56v8.4h2.78zM6.95 8.7a1.61 1.61 0 1 0 0-3.22 1.61 1.61 0 0 0 0 3.22zm11.39 9.64v-4.6c0-2.46-1.31-3.6-3.06-3.6a2.64 2.64 0 0 0-2.4 1.32v-1.12H10.1c.04.78 0 8.4 0 8.4h2.78v-4.69c0-.25.02-.5.09-.68.2-.5.66-1.02 1.42-1.02.99 0 1.39.76 1.39 1.87v4.52h2.56z"})})}),(0,s.jsx)("a",{href:m.SOCIAL.x,target:"_blank",rel:"noopener noreferrer","aria-label":"brickster.ai on X",className:"transition-colors hover:text-primary",children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"size-[15px]","aria-hidden":!0,children:(0,s.jsx)("path",{d:"M18.9 1.65h3.68l-8.04 9.19L24 22.35h-7.41l-5.8-7.58-6.64 7.58H.46l8.6-9.83L0 1.65h7.6l5.24 6.93 6.06-6.93zm-1.29 18.5h2.04L6.48 3.75H4.3L17.61 20.15z"})})}),(0,s.jsx)("a",{href:m.SOCIAL.rss,"aria-label":"RSS feed (all sections)",className:"transition-colors hover:text-primary",children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"size-[15px]","aria-hidden":!0,children:(0,s.jsx)("path",{d:"M6.18 15.64a2.18 2.18 0 1 1 0 4.36 2.18 2.18 0 0 1 0-4.36zM4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44zm0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"})})})]})}function k({collapsed:e,onToggle:t,lang:r="en"}){let n=(0,l.useNavVariant)(),u=(0,x.getDict)(r),f=(0,h.usePathname)(),S=m.LEARN_V2.items.some(e=>f===e.href||f.startsWith(`${e.href}/`)),[R,_]=(0,i.useState)(S);(0,i.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{try{let e=window.localStorage.getItem("nav.learn.open");null!==e&&_("1"===e)}catch{}},0);return()=>clearTimeout(e)},[n]);let T=(0,i.useRef)(null),[C,O]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=T.current;if(!e)return;let t=()=>O(e.scrollHeight-e.scrollTop-e.clientHeight>8);t(),e.addEventListener("scroll",t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),()=>{e.removeEventListener("scroll",t),r.disconnect()}},[]);let A=(0,b.useBookmarks)().length,P=!!(0,v.useUser)(),I=e=>"/saved"===e&&P?"/account/saved":e,j=e=>{let t=(0,w.localizeHref)(I(e),r);return f===t||f.startsWith(`${t}/`)},N=(0,a.cn)("transition-[opacity,transform] duration-200",e&&"-translate-x-1.5 opacity-0 group-hover/side:translate-x-0 group-hover/side:opacity-100");return(0,s.jsxs)("aside",{className:(0,a.cn)("group/side peer/side fixed inset-y-0 left-0 z-40 hidden flex-col border-r border-border bg-sidebar transition-[width] duration-300 ease-[var(--ease-shell)] lg:flex",e?"w-[78px] hover:w-[300px]":"w-[300px]"),children:[(0,s.jsx)("button",{type:"button",onClick:t,"aria-label":e?"Expand sidebar":"Collapse sidebar",className:"absolute -right-3 top-[72px] z-50 flex size-6 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-[var(--shadow-sm)] transition-colors hover:border-primary/40 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:(0,s.jsx)(p,{className:(0,a.cn)("size-3.5 transition-transform duration-300",e&&"rotate-180"),"aria-hidden":!0})}),(0,s.jsxs)(o.default,{href:(0,w.localizeHref)("/",r),className:"flex h-[62px] shrink-0 items-center gap-3 px-[23px]",children:[(0,s.jsx)("span",{className:"flex size-[30px] shrink-0 items-center justify-center overflow-hidden rounded-lg",children:(0,s.jsx)(c,{className:"size-full"})}),(0,s.jsxs)("span",{className:(0,a.cn)("flex flex-col justify-center",N),children:[(0,s.jsxs)("span",{className:"whitespace-nowrap font-heading text-[18px] font-extrabold leading-none tracking-tight",children:["brickster",(0,s.jsx)("span",{className:"text-primary",children:".ai"})]}),(0,s.jsx)("span",{className:"mt-0.5 whitespace-nowrap text-[11px] leading-none text-dim",children:"The Databricks Radar"})]})]}),(0,s.jsx)("nav",{ref:T,className:"relative flex-1 overflow-y-auto overflow-x-hidden px-3.5 pb-6",children:n?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"mt-1",children:[m.PRIMARY_V2.map(({href:e,label:t,sublabel:n,icon:i})=>{let l=j(e);return(0,s.jsxs)(o.default,{href:(0,w.localizeHref)(e,r),onClick:()=>(0,y.track)("nav_click",t,e,"sidebar"),"aria-current":l?"page":void 0,className:(0,a.cn)("relative flex items-start gap-2 rounded-[9px] px-[13px] py-[8px] text-[13.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",l?"bg-primary/15 text-primary before:absolute before:inset-y-1.5 before:left-0 before:w-[3px] before:rounded-r before:bg-primary":"text-muted-foreground hover:bg-foreground
37/5 hover:text-foreground"),children:[(0,s.jsx)(i,{className:(0,a.cn)("mt-0.5 size-[18px] shrink-0",l?"text-primary":"text-dim")}),(0,s.jsxs)("span",{className:(0,a.cn)("min-w-0",N),children:[(0,s.jsx)("span",{className:"block truncate",children:t}),n?(0,s.jsx)("span",{className:"block truncate text-[11px] font-normal leading-tight text-dim",children:n}):null]})]},e)}),(0,s.jsxs)("button",{type:"button",onClick:()=>{_(e=>{try{window.localStorage.setItem("nav.learn.open",e?"0":"1")}catch{}return!e})},"aria-expanded":R,"aria-label":m.LEARN_V2.label,className:"mt-1 flex w-full items-start gap-2 rounded-[9px] px-[13px] py-[8px] text-left text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[e?(0,s.jsx)(m.LEARN_V2.icon,{className:"mt-0.5 size-[18px] shrink-0 text-dim","aria-hidden":!0}):(0,s.jsx)(g,{className:(0,a.cn)("mt-0.5 size-[18px] shrink-0 text-dim transition-transform",R&&"rotate-90"),"aria-hidden":!0}),(0,s.jsxs)("span",{className:(0,a.cn)("min-w-0",N),children:[(0,s.jsx)("span",{className:"block truncate",children:m.LEARN_V2.label}),(0,s.jsx)("span",{className:"block truncate text-[11px] font-normal leading-tight text-dim",children:m.LEARN_V2.sublabel})]})]}),R?m.LEARN_V2.items.map(({href:t,label:n,icon:i})=>{let l=j(t);return(0,s.jsxs)(o.default,{href:(0,w.localizeHref)(t,r),onClick:()=>(0,y.track)("nav_click",n,t,"sidebar"),"aria-current":l?"page":void 0,className:(0,a.cn)("relative flex items-center gap-2 rounded-[9px] px-[13px] py-[7px] text-[13px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",e?"ml-0":"ml-5",l?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-foreground
37/5 hover:text-foreground"),children:[(0,s.jsx)(i,{className:(0,a.cn)("size-4 shrink-0",l?"text-primary":"text-dim")}),(0,s.jsx)("span",{className:(0,a.cn)("truncate",N),children:n})]},t)}):null]})}):m.NAV_GROUPS.map(t=>(0,s.jsxs)("div",{className:"mt-3 first:mt-1",children:[(0,s.jsx)("div",{className:(0,a.cn)("px-3 pb-1 font-mono text-[10px] uppercase tracking-wider text-dim transition-opacity duration-200",e&&"opacity-0 group-hover/side:opacity-100"),children:u.nav.groups[t.label]??t.label}),t.items.map(({href:e,label:t,icon:n})=>{let i=j(e);return(0,s.jsxs)(o.default,{href:(0,w.localizeHref)(I(e),r),onClick:()=>(0,y.track)("nav_click",t,e,"sidebar"),"aria-current":i?"page":void 0,className:(0,a.cn)("relative flex items-center gap-2 rounded-[9px] px-[13px] py-[9px] text-[13.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",i?"bg-primary/15 text-primary before:absolute before:inset-y-1.5 before:left-0 before:w-[3px] before:rounded-r before:bg-primary":"text-muted-foreground hover:bg-foreground
37/5 hover:text-foreground"),children:[(0,s.jsx)(n,{className:(0,a.cn)("size-[18px] shrink-0",i?"text-primary":"text-dim")}),(0,s.jsx)("span",{className:(0,a.cn)("truncate",N),children:u.nav.items[e]??t}),"/saved"===e&&A>0?(0,s.jsx)("span",{className:(0,a.cn)("ml-auto rounded-full bg-primary/15 px-1.5 py-px text-[10px] font-semibold text-primary",N),children:A}):null]},e)})]},t.label))}),C?(0,s.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none relative z-10 -mt-9 flex h-9 shrink-0 items-end justify-center bg-gradient-to-t from-sidebar via-sidebar/80 to-transparent",children:(0,s.jsx)(d.ChevronDown,{className:"mb-1 size-4 motion-safe:animate-bounce text-dim"})}):null,(0,s.jsxs)("div",{className:(0,a.cn)("shrink-0 border-t border-border px-[26px] py-4 transition-opacity duration-200",e&&"opacity-0 group-hover/side:opacity-100"),children:[(0,s.jsx)(E,{}),(0,s.jsxs)("div",{className:"mt-3.5 flex flex-wrap gap-x-3 gap-y-1.5 text-[11.5px] text-dim",children:[(n?m.UTILITY_V2:[]).map(({href:e,label:t})=>(0,s.jsx)(o.default,{href:(0,w.localizeHref)(e,r),onClick:()=>(0,y.track)("nav_click",t,e,"sidebar"),className:"transition-colors hover:text-foreground",children:u.nav.items[e]??t},e)),m.LEGAL_LINKS.map(e=>(0,s.jsx)(o.default,{href:(0,w.localizeHref)(e.href,r),className:"transition-colors hover:text-foreground",children:u.legal[e.href]??e.label},e.href))]}),(0,s.jsx)("p",{className:"mt-3 border-t border-border/50 pt-3 text-[11px] leading-relaxed text-dim",children:u.shell.independentShort})]})]})}let S=(0,f.default)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);var R=e.i(68089);let _=(0,f.default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),T=(0,f.default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);var C=e.i(7756),O=e.i(66904);function A(){let{resolvedTheme:e,setTheme:t}=(0,C.useTheme)(),[r,n]=(0,i.useState)(!1);(0,i.useEffect)(()=>{n(!0)},[]);let a=r&&"dark"===e;return(0,s.jsx)(O.Button,{variant:"ghost",size:"icon-sm","aria-label":a?"Switch to light mode":"Switch to dark mode",onClick:()=>t(a?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:r?a?(0,s.jsx)(T,{className:"size-4"}):(0,s.jsx)(_,{className:"size-4"}):(0,s.jsx)("span",{className:"size-4","aria-hidden":!0})})}let P=(0,f.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),I=(0,f.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s([],72645),e.i(72645),e.i(50382);var j=e.i(31027);let N=i.createContext(void 0);function L(e){let t=i.useContext(N);if(void 0===t&&!e)throw Error((0,j.default)(33));return t}let M=i.createContext(void 0);function D(e){let t=i.useContext(M);if(void 0===t&&!e)throw Error((0,j.default)(36));return t}var $=e.i(85207),U=e.i(1777);let B=i.forwardRef(function(e,t){let{className:r,render:n,style:s,...i}=e,{store:a}=D(),{arrowRef:o,side:l,align:u,arrowUncentered:c,arrowStyles:h}=L(),d=a.useState("open");return(0,$.useRenderElement)("div",e,{ref:[o,t],stateAttributesMapping:U.popupStateMapping,state:{open:d,side:l,align:u,uncentered:c},props:{style:h,"aria-hidden":!0,...i}})});var F=e.i(13046);let H=i.createContext(void 0);function W(e=!0){let t=i.useContext(H);if(void 0===t&&!e)throw Error((0,j.default)(25));return t}var q=e.i(10372);let z={...U.popupStateMapping,...F.transitionStatusMapping},V=i.forwardRef(function(e,t){let{className:r,render:n,style:s,...i}=e,{store:a}=D(),o=a.useState("open"),l=a.useState("mounted"),u=a.useState("transitionStatus"),c=a.use
37State("lastOpenChangeReason"),h=W();return(0,$.useRenderElement)("div",e,{ref:h?.backdropRef?[t,h.backdropRef]:t,state:{open:o,transitionStatus:u},stateAttributesMapping:z,props:[{role:"presentation",hidden:!l,style:{pointerEvents:c===q.REASONS.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i]})});var K=e.i(91434),G=e.i(62453);let J=i.createContext(void 0);var Y=e.i(83069),X=e.i(84829),Q=e.i(63647),Z=e.i(73459);function ee(e){let{closeOnClick:t,highlighted:r,id:n,nodeId:s,store:a,typingRef:o,itemRef:l,itemMetadata:u}=e,{events:c}=a.useState("floatingTreeRoot"),h=W(!0),d=void 0!==h;return i.useMemo(()=>({id:n,role:"menuitem",tabIndex:r?0:-1,onKeyDown(e){" "===e.key&&o?.current&&e.preventDefault()},onMouseMove(e){s&&c.emit("itemhover",{nodeId:s,target:e.currentTarget})},onClick(e){t&&c.emit("close",{domEvent:e,reason:q.REASONS.itemPress})},onMouseUp(e){if(h){let t=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,d&&t&&1>=Math.abs(e.clientX-t.x)&&1>=Math.abs(e.clientY-t.y)||d&&!Z.isMac&&2===e.button)return}l.current&&a.context.allowMouseUpTriggerRef.current&&(!d||2===e.button)&&(!u||"regular-item"===u.type)&&l.current.click()}}),[t,r,n,c,s,a,o,l,h,d,u])}let et={type:"regular-item"};function er(e){let{closeOnClick:t,disabled:r=!1,highlighted:n,id:s,store:a,typingRef:o=a.context.typingRef,nativeButton:l,itemMetadata:u,nodeId:c}=e,h=i.useRef(null),{getButtonProps:d,buttonRef:f}=(0,X.useButton)({disabled:r,focusableWhenDisabled:!0,native:l,composite:!0}),p=ee({closeOnClick:t,highlighted:n,id:s,nodeId:c,store:a,typingRef:o,itemRef:h,itemMetadata:u}),g=i.useCallback(e=>(0,Q.mergeProps)(p,{onMouseEnter(){"submenu-trigger"===u.type&&u.setActive()}},e,d),[p,d,u]),m=(0,Y.useMergedRefs)(h,f);return i.useMemo(()=>({getItemProps:g,itemRef:m}),[g,m])}var en=e.i(62926);let es=i.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}}),ei=((t={})[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t);function ea(e={}){let{label:t,metadata:r,textRef:n,indexGuessBehavior:s,index:a}=e,{register:o,unregister:l,subscribeMapChange:u,elementsRef:c,labelsRef:h,nextIndexRef:d}=i.useContext(es),f=i.useRef(-1),[p,g]=i.useState(a??(s===ei.GuessFromOrder?()=>{if(-1===f.current){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),m=i.useRef(null),y=i.useCallback(e=>{if(m.current=e,-1!==p&&null!==e&&(c.current[p]=e,h)){let r=void 0!==t;h.current[p]=r?t:n?.current?.textContent??e.textContent}},[p,c,h,t,n]);return(0,en.useIsoLayoutEffect)(()=>{if(null!=a)return;let e=m.current;if(e)return o(e,r),()=>{l(e)}},[a,o,l,r]),(0,en.useIsoLayoutEffect)(()=>{if(null==a)return u(e=>{let t=m.current?e.get(m.current)?.index:null;null!=t&&g(t)})},[a,u,g]),i.useMemo(()=>({ref:y,index:p}),[p,y])}var eo=e.i(66021);let el=((r={}).checked="data-checked",r.unchecked="data-unchecked",r.disabled="data-disabled",r.highlighted="data-highlighted",r),eu={checked:e=>e?{[el.checked]:""}:{[el.unchecked]:""},...F.transitionStatusMapping};var ec=e.i(5760);let eh=i.forwardRef(function(e,t){let{render:r,className:n,id:a,label:o,nativeButton:l=!1,disabled:u=!1,closeOnClick:c=!1,checked:h,defaultChecked:d,onCheckedChange:f,style:p,...g}=e,m=ea({label:o}),y=L(!0),b=(0,eo.useBaseUiId)(a),{store:v}=D(),w=v.useState("isActive",m.index),x=v.useState("itemProps"),[E,k]=(0,G.useControlled)({controlled:h,default:d??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:S,itemRef:R}=er({closeOnClick:c,disabled:u,highlighted:w,id:b,store:v,nativeButton:l,nodeId:y?.context.nodeId,itemMetadata:et}),_=i.useMemo(()=>({disabled:u,highlighted:w,checked:E}),[u,w,E]),T=(0,K.useStableCallback)(e=>{let t={...(0,ec.createChangeEventDetails)(q.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}};f?.(!E,t),t.isCanceled||k(e=>!e)}),C=(0,$.useRenderElement)("div",e,{state:_,stateAttributesMapping:eu,props:[x,{role:"menuitemcheckbox","aria-checked":E,onClick:T},g,S],ref:[R,t,m.ref]});return(0,s.jsx)(J.Provider,{value:_,children:C})});var ed=e.i(86360),ef=e.i(64422);let ep=i.forwardRef(function(e,t){let{render:r,className:n,style:s,keepMounted:a=!1,...o}=e,l=function(){let e=i.useContext(J);if(void 0===e)throw Error((0,j.default)(30));return e}(),u=i.useRef(null),{transitionStatus:c,setMounted:h}=(0,ed.useTransitionStatus)(l.checked);(0,ef.useOpenChangeComplete)({open:l.checked,ref:u,onComplete(){l.checked||h(!1)}});let d={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:c};return(0,$.useRenderElement)("span",e,{state:d,ref:[t,u],stateAttributesMapping:eu,props:{"aria-hidden":!0,...o},enabled:a||l.checked})}),eg=i.createContext(void 0),em=i.forwardRef(function(e,t){let{render:r,className:n,style:a,...o}=e,[l,u]=i.useState(void 0),c=i.useMemo(()=>({setLabelId:u}),[u]),h=(0,$.useRenderElement)("div",e,{ref:t,props:{role:"group","aria-labelledby":l,...o}});return(0,s.jsx)(eg.Provider,{value:c,children:h})}),ey=i.forwardRef(function(e,t){let{className:r,render:n,id:s,style:a,...o}=e,l=(0,eo.useBaseUiId)(s),{setLabelId:u}=function(){let e=i.useContext(eg);if(void 0===e)throw Error((0,j.default)(31));return e}();return(0,en.useIsoLayoutEffect)(()=>(u(l),()=>{u(void 0)}),[u,l]),(0,$.useRenderElement)("div",e,{ref:t,props:{id:l,role:"presentation",...o}})}),eb=i.forwardRef(function(e,t){let{render:r,className:n,id:s,label:i,nativeButton:a=!1,disabled:o=!1,closeOnClick:l=!0,style:u,...c}=e,h=ea({label:i}),d=L(!0),f=(0,eo.useBaseUiId)(s),{store:p}
37=D(),g=p.useState("isActive",h.index),m=p.useState("itemProps"),{getItemProps:y,itemRef:b}=er({closeOnClick:l,disabled:o,highlighted:g,id:f,store:p,nativeButton:a,nodeId:d?.context.nodeId,itemMetadata:et});return(0,$.useRenderElement)("div",e,{state:{disabled:o,highlighted:g},props:[m,c,y],ref:[b,t,h.ref]})}),ev=i.forwardRef(function(e,t){let{render:r,className:n,id:s,label:a,closeOnClick:o=!1,style:l,...u}=e,c=i.useRef(null),h=ea({label:a}),d=L(!0),f=d?.context.nodeId,p=(0,eo.useBaseUiId)(s),{store:g}=D(),m=g.useState("isActive",h.index),y=g.useState("itemProps"),b=g.context.typingRef,{getButtonProps:v,buttonRef:w}=(0,X.useButton)({native:!1,composite:!0}),x=ee({closeOnClick:o,highlighted:m,id:p,nodeId:f,store:g,typingRef:b,itemRef:c}),E=i.useMemo(()=>({highlighted:m}),[m]);return(0,$.useRenderElement)("a",e,{state:E,props:[y,u,function(e){return(0,Q.mergeProps)(x,e,v)}],ref:[c,w,t,h.ref]})});var ew=e.i(82807),ex=e.i(67481),eE=e.i(13687),ek=e.i(35810),eS=e.i(81528),eR=e.i(42785),e_=e.i(85226),eT=e.i(11235),eC=e.i(42372),eO=e.i(4430),eA=e.i(43827),eP=e.i(57948);class eI{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new eS.Timeout,this.restTimeout=new eS.Timeout,this.handleCloseOptions=void 0}static create(){return new eI}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}let ej=new WeakMap;function eN(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ej.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),ej.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function eL(e,t){let{scopeElement:r,referenceElement:n,floatingElement:s}=t,i=ej.get(r);i&&i!==e&&eN(i),eN(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=r,e.pointerEventsReferenceElement=n,e.pointerEventsFloatingElement=s,ej.set(r,e),r.style.pointerEvents="none",n.style.pointerEvents="auto",s.style.pointerEvents="auto"}function eM(e){let t=(0,eP.useRefWithInit)(eI.create).current,r=e.context.dataRef.current;return r.hoverInteractionState||(r.hoverInteractionState=t),(0,eA.useOnMount)(r.hoverInteractionState.disposeEffect),r.hoverInteractionState}var eD=e.i(35982);function e$(e,t,r){let n=null==r||(0,eD.isMouseLikePointerType)(r)?"function"==typeof e?e():e:0;return"number"==typeof n?n:n?.[t]}function eU(e){return"function"==typeof e?e():e}function eB(e,t){return t||"click"===e||"mousedown"===e}let eF=i.createContext(void 0);var eH=e.i(83081),eW=e.i(88258),eq=e.i(44607);function ez(e){return"starting"===e?eq.DISABLED_TRANSITIONS_STYLE:eW.EMPTY_OBJECT}let eV={...U.popupStateMapping,...F.transitionStatusMapping},eK=i.forwardRef(function(e,t){let{render:r,className:n,style:a,finalFocus:o,...l}=e,{store:u}=D(),{side:c,align:h}=L(),d=null!=function(e){let t=i.useContext(eF);if(void 0===t&&!e)throw Error((0,j.default)(69));return t}(!0),f=u.useState("open"),p=u.useState("transitionStatus"),g=u.useState("popupProps"),m=u.useState("mounted"),y=u.useState("instantType"),b=u.useState("activeTriggerElement"),v=u.useState("parent"),w=u.useState("lastOpenChangeReason"),x=u.useState("rootId"),E=u.useState("floatingRootContext"),k=u.useState("floatingTreeRoot"),S=u.useState("closeDelay"),R=u.useState("activeTriggerElement"),_="context-menu"===v.type;(0,ef.useOpenChangeComplete)({open:f,ref:u.context.popupRef,onComplete(){f&&u.context.onOpenChangeComplete?.(!0)}}),i.useEffect(()=>{function e(e){u.setOpen(!1,(0,ec.createChangeEventDetails)(e.reason,e.domEvent))}return k.events.on("close",e),()=>{k.events.off("close",e)}},[k.events,u]);let T=u.useState("hoverEnabled"),C=u.useState("disabled");!function(e,t={}){let r="rootStore"in e?e.rootStore:e,n=r.useState("open"),s=r.useState("floatingElement"),a=r.useState("domReferenceElement"),{dataRef:o}=r.context,{enabled:l=!0,closeDelay:u=0,nodeId:c}
37=t,h=eM(r),d=(0,eO.useFloatingTree)(),f=(0,eO.useFloatingParentNodeId)(),p=(0,K.useStableCallback)(()=>eB(o.current.openEvent?.type,h.interactedInside)),g=(0,K.useStableCallback)(()=>{let e=o.current.openEvent?.type;return e?.includes("mouse")&&"mousedown"!==e}),m=(0,K.useStableCallback)(e=>(0,eT.isTargetInsideEnabledTrigger)(e,r.context.triggerElements)),y=i.useCallback(e=>{let t=e$(u,"close",h.pointerType),n=()=>{r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,e)),d?.events.emit("floating.closed",e)};t?h.openChangeTimeout.start(t,n):(h.openChangeTimeout.clear(),n())},[u,r,h,d]),b=(0,K.useStableCallback)(()=>{eN(h)}),v=(0,K.useStableCallback)(e=>{let t=(0,e_.getTarget)(e);if(!(0,eT.isInteractiveElement)(t)){h.interactedInside=!1;return}h.interactedInside=t?.closest("[aria-haspopup]")!=null});(0,en.useIsoLayoutEffect)(()=>{n||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,b())},[n,h,b]),i.useEffect(()=>b,[b]),(0,en.useIsoLayoutEffect)(()=>{if(l&&n&&h.handleCloseOptions?.blockPointerEvents&&g()&&(0,ex.isElement)(a)&&s){let e=(0,eR.ownerDocument)(s),t=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;t&&(t.style.pointerEvents="");let r=h.handleCloseOptions?.getScope?.()??h.pointerEventsScopeElement??t??a.closest("[data-rootownerid]")??e.body;return eL(h,{scopeElement:r,referenceElement:a,floatingElement:s}),()=>{b()}}},[l,n,a,s,h,g,d,f,b]);let w=(0,eS.useTimeout)();i.useEffect(()=>{if(l)return(0,ek.mergeCleanups)(s&&(0,eE.addEventListener)(s,"mouseenter",function(){h.openChangeTimeout.clear(),w.clear(),d?.events.off("floating.closed",e),b()}),s&&(0,eE.addEventListener)(s,"mouseleave",function(t){if(d&&f&&(0,eC.getNodeChildren)(d.nodesRef.current,f).length>0)return void d.events.on("floating.closed",e);if(m(t.relatedTarget))return;let r=o.current.floatingContext?.nodeId??c,n=t.relatedTarget;if(!(d&&r&&(0,ex.isElement)(n)&&(0,eC.getNodeChildren)(d.nodesRef.current,r,!1).some(e=>(0,e_.contains)(e.context?.elements.floating,n)))){if(h.handler)return void h.handler(t);b(),p()||y(t)}}),s&&(0,eE.addEventListener)(s,"pointerdown",v,!0),()=>{d?.events.off("floating.closed",e)});function e(t){d&&f&&!((0,eC.getNodeChildren)(d.nodesRef.current,f).length>0)&&w.start(0,()=>{d.events.off("floating.closed",e),r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,t)),d.events.emit("floating.closed",t)})}},[l,s,r,o,c,p,m,y,b,v,h,d,f,w])}(E,{enabled:T&&!C&&!_&&"menubar"!==v.type,closeDelay:S});let O={transitionStatus:p,side:c,align:h,open:f,nested:"menu"===v.type,instant:y},A=i.useCallback(e=>{u.set("popupElement",e)},[u]),P=(0,$.useRenderElement)("div",e,{state:O,ref:[t,u.context.popupRef,A],stateAttributesMapping:eV,props:[g,{onKeyDown(e){d&&eH.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()}},ez(p),l,{"data-rootownerid":x}]}),I=void 0===v.type||_;return(b||"menubar"===v.type&&w!==q.REASONS.outsidePress)&&(I=!0),(0,s.jsx)(ew.FloatingFocusManager,{context:E,modal:_,disabled:!m,returnFocus:void 0===o?I:o,initialFocus:"menu"!==v.type,restoreFocus:!0,externalTree:"menubar"!==v.type?k:void 0,previousFocusableElement:R,nextFocusableElement:void 0===v.type?u.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:void 0===v.type?u.context.beforeContentFocusGuardRef:void 0,children:P})});var eG=e.i(86601);let eJ=i.createContext(void 0),eY=i.forwardRef(function(e,t){let{keepMounted:r=!1,...n}=e,{store:i}=D();return i.useState("mounted")||r?(0,s.jsx)(eJ.Provider,{value:r,children:(0,s.jsx)(eG.FloatingPortal,{ref:t,...n})}):null});var eX=e.i(94852),eQ=e.i(29561),eZ=e.i(41961),e0=e.i(2220);function e1(e,t,r){let n,{reference:s,floating:i}=e,a=(0,eQ.getSideAxis)(t),o=(0,eQ.getAlignmentAxis)(t),l=(0,eQ.getAxisLength)(o),u=(0,eQ.getSide)(t),c="y"===a,h=s.x+s.width/2-i.width/2,d=s.y+s.height/2-i.height/2,f=s[l]/2-i[l]/2;switch(u){case"top":n={x:h,y:s.y-i.height};break;case"bottom":n={x:h,y:s.y+s.height};break;case"right":n={x:s.x+s.width,y:d};break;case"left":n={x:s.x-i.width,y:d};break;default:n={x:s.x,y:s.y}}switch((0,eQ.getAlignment)(t)){case"start":n[o]-=f*(r&&c?-1:1);break;case"end":n[o]+=f*(r&&c?-1:1)}return n}async function e2(e,t){var r;void 0===t&&(t={});let{x:n,y:s,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}
37=(0,eQ.evaluate)(t,e),p=(0,eQ.getPaddingObject)(f),g=o[d?"floating"===h?"reference":"floating":h],m=(0,eQ.rectToClientRect)(await i.getClippingRect({element:null==(r=await (null==i.isElement?void 0:i.isElement(g)))||r?g:g.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:c,strategy:l})),y="floating"===h?{x:n,y:s,width:a.floating.width,height:a.floating.height}:a.reference,b=await (null==i.getOffsetParent?void 0:i.getOffsetParent(o.floating)),v=await (null==i.isElement?void 0:i.isElement(b))&&await (null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=(0,eQ.rectToClientRect)(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:y,offsetParent:b,strategy:l}):y);return{top:(m.top-w.top+p.top)/v.y,bottom:(w.bottom-m.bottom+p.bottom)/v.y,left:(m.left-w.left+p.left)/v.x,right:(w.right-m.right+p.right)/v.x}}let e5=async(e,t,r)=>{let{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:a}=r,o=a.detectOverflow?a:{...a,detectOverflow:e2},l=await (null==a.isRTL?void 0:a.isRTL(t)),u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:c,y:h}=e1(u,n,l),d=n,f=0,p={};for(let r=0;r<i.length;r++){let g=i[r];if(!g)continue;let{name:m,fn:y}=g,{x:b,y:v,data:w,reset:x}=await y({x:c,y:h,initialPlacement:n,placement:d,strategy:s,middlewareData:p,rects:u,platform:o,elements:{reference:e,floating:t}});c=null!=b?b:c,h=null!=v?v:h,p[m]={...p[m],...w},x&&f<50&&(f++,"object"==typeof x&&(x.placement&&(d=x.placement),x.rects&&(u=!0===x.rects?await a.getElementRects({reference:e,floating:t,strategy:s}):x.rects),{x:c,y:h}=e1(u,d,l)),r=-1)}return{x:c,y:h,placement:d,strategy:s,middlewareData:p}};function e8(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function e4(e){return eQ.sides.some(t=>e[t]>=0)}let e3=new Set(["left","top"]);async function e6(e,t){let{placement:r,platform:n,elements:s}=e,i=await (null==n.isRTL?void 0:n.isRTL(s.floating)),a=(0,eQ.getSide)(r),o=(0,eQ.getAlignment)(r),l="y"===(0,eQ.getSideAxis)(r),u=e3.has(a)?-1:1,c=i&&l?-1:1,h=(0,eQ.evaluate)(t,e),{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&"number"==typeof p&&(f="end"===o?-1*p:p),l?{x:f*c,y:d*u}:{x:d*u,y:f*c}}function e9(e){let t=(0,ex.getComputedStyle)(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,s=(0,ex.isHTMLElement)(e),i=s?e.offsetWidth:r,a=s?e.offsetHeight:n,o=(0,eQ.round)(r)!==i||(0,eQ.round)(n)!==a;return o&&(r=i,n=a),{width:r,height:n,$:o}}function e7(e){return(0,ex.isElement)(e)?e:e.contextElement}function te(e){let t=e7(e);if(!(0,ex.isHTMLElement)(t))return(0,eQ.createCoords)(1);let r=t.getBoundingClientRect(),{width:n,height:s,$:i}=e9(t),a=(i?(0,eQ.round)(r.width):r.width)/n,o=(i?(0,eQ.round)(r.height):r.height)/s;return a&&Number.isFinite(a)||(a=1),o&&Number.isFinite(o)||(o=1),{x:a,y:o}}let tt=(0,eQ.createCoords)(0);function tr(e){let t=(0,ex.getWindow)(e);return(0,ex.isWebKit)()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:tt}function tn(e,t,r,n){var s;void 0===t&&(t=!1),void 0===r&&(r=!1);let i=e.getBoundingClientRect(),a=e7(e),o=(0,eQ.createCoords)(1);t&&(n?(0,ex.isElement)(n)&&(o=te(n)):o=te(e));let l=(void 0===(s=r)&&(s=!1),n&&(!s||n===(0,ex.getWindow)(a))&&s)?tr(a):(0,eQ.createCoords)(0),u=(i.left+l.x)/o.x,c=(i.top+l.y)/o.y,h=i.width/o.x,d=i.height/o.y;if(a){let e=(0,ex.getWindow)(a),t=n&&(0,ex.isElement)(n)?(0,ex.getWindow)(n):n,r=e,s=(0,ex.getFrameElement)(r);for(;s&&n&&t!==r;){let e=te(s),t=s.getBoundingClientRect(),n=(0,ex.getComputedStyle)(s),i=t.left+(s.clientLeft+parseFloat(n.paddingLeft))*e.x,a=t.top+(s.clientTop+parseFloat(n.paddingTop))*e.y;u*=e.x,c*=e.y,h*=e.x,d*=e.y,u+=i,c+=a,r=(0,ex.getWindow)(s),s=(0,ex.getFrameElement)(r)}}return(0,eQ.rectToClientRect)({width:h,height:d,x:u,y:c})}function ts(e,t){let r=(0,ex.getNodeScroll)(e).scrollLeft;return t?t.left+r:tn((0,ex.getDocumentElement)(e)).left+r}function ti(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-ts(e,r),y:r.top+t.scrollTop}}function ta(e,t,r){var n;let s;if("viewport"===t)s=function(e,t){let r=(0,ex.getWindow)(e),n=(0,ex.getDocumentElement)(e),s=r.visualVie
37wport,i=n.clientWidth,a=n.clientHeight,o=0,l=0;if(s){i=s.width,a=s.height;let e=(0,ex.isWebKit)();(!e||e&&"fixed"===t)&&(o=s.offsetLeft,l=s.offsetTop)}let u=ts(n);if(u<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),s="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,a=Math.abs(n.clientWidth-t.clientWidth-s);a<=25&&(i-=a)}else u<=25&&(i+=u);return{width:i,height:a,x:o,y:l}}(e,r);else if("document"===t){let t,r,i,a,o,l,u;n=(0,ex.getDocumentElement)(e),t=(0,ex.getDocumentElement)(n),r=(0,ex.getNodeScroll)(n),i=n.ownerDocument.body,a=(0,eQ.max)(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=(0,eQ.max)(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),l=-r.scrollLeft+ts(n),u=-r.scrollTop,"rtl"===(0,ex.getComputedStyle)(i).direction&&(l+=(0,eQ.max)(t.clientWidth,i.clientWidth)-a),s={width:a,height:o,x:l,y:u}}else if((0,ex.isElement)(t)){let e,n,i,a,o,l;n=(e=tn(t,!0,"fixed"===r)).top+t.clientTop,i=e.left+t.clientLeft,a=(0,ex.isHTMLElement)(t)?te(t):(0,eQ.createCoords)(1),o=t.clientWidth*a.x,l=t.clientHeight*a.y,s={width:o,height:l,x:i*a.x,y:n*a.y}}else{let r=tr(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return(0,eQ.rectToClientRect)(s)}function to(e){return"static"===(0,ex.getComputedStyle)(e).position}function tl(e,t){if(!(0,ex.isHTMLElement)(e)||"fixed"===(0,ex.getComputedStyle)(e).position)return null;if(t)return t(e);let r=e.offsetParent;return(0,ex.getDocumentElement)(e)===r&&(r=r.ownerDocument.body),r}function tu(e,t){let r=(0,ex.getWindow)(e);if((0,ex.isTopLayer)(e))return r;if(!(0,ex.isHTMLElement)(e)){let t=(0,ex.getParentNode)(e);for(;t&&!(0,ex.isLastTraversableNode)(t);){if((0,ex.isElement)(t)&&!to(t))return t;t=(0,ex.getParentNode)(t)}return r}let n=tl(e,t);for(;n&&(0,ex.isTableElement)(n)&&to(n);)n=tl(n,t);return n&&(0,ex.isLastTraversableNode)(n)&&to(n)&&!(0,ex.isContainingBlock)(n)?r:n||(0,ex.getContainingBlock)(e)||r}let tc=async function(e){let t=this.getOffsetParent||tu,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=(0,ex.isHTMLElement)(t),s=(0,ex.getDocumentElement)(t),i="fixed"===r,a=tn(e,!0,i,t),o={scrollLeft:0,scrollTop:0},l=(0,eQ.createCoords)(0);if(n||!n&&!i)if(("body"!==(0,ex.getNodeName)(t)||(0,ex.isOverflowElement)(s))&&(o=(0,ex.getNodeScroll)(t)),n){let e=tn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else s&&(l.x=ts(s));i&&!n&&s&&(l.x=ts(s));let u=!s||n||i?(0,eQ.createCoords)(0):ti(s,o);return{x:a.left+o.scrollLeft-l.x-u.x,y:a.top+o.scrollTop-l.y-u.y,width:a.width,height:a.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},th={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e,i="fixed"===s,a=(0,ex.getDocumentElement)(n),o=!!t&&(0,ex.isTopLayer)(t.floating);if(n===a||o&&i)return r;let l={scrollLeft:0,scrollTop:0},u=(0,eQ.createCoords)(1),c=(0,eQ.createCoords)(0),h=(0,ex.isHTMLElement)(n);if((h||!h&&!i)&&(("body"!==(0,ex.getNodeName)(n)||(0,ex.isOverflowElement)(a))&&(l=(0,ex.getNodeScroll)(n)),h)){let e=tn(n);u=te(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let d=!a||h||i?(0,eQ.createCoords)(0):ti(a,l);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+c.x+d.x,y:r.y*u.y-l.scrollTop*u.y+c.y+d.y}},getDocumentElement:ex.getDocumentElement,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e,i=[..."clippingAncestors"===r?(0,ex.isTopLayer)(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=(0,ex.getOverflowAncestors)(e,[],!1).filter(e=>(0,ex.isElement)(e)&&"body"!==(0,ex.getNodeName)(e)),s=null,i="fixed"===(0,ex.getComputedStyle)(e).position,a=i?(0,ex.getParentNode)(e):e;for(;(0,ex.isElement)(a)&&!(0,ex.isLastTraversableNode)(a);){let t=(0,ex.getComputedStyle)(a),r=(0,ex.isContainingBlock)(a);r||"fixed"!==t.position||(s=null),(i?r||s:!(!r&&"static"===t.position&&s&&("absolute"===s.position||"fixed"===s.position)||(0,ex.isOverflowElement)(a)&&!r&&function e(t,r){let n=(0,ex.getParentNode)(t);return!(n===r||!(0,ex.isElement)(n)||(0,ex.isLastTraversableNode)(n))&&("fixed"===(0,ex.getComputedStyle)(n).position||e(n,r))}
37(e,a)))?s=t:n=n.filter(e=>e!==a),a=(0,ex.getParentNode)(a)}return t.set(e,n),n}(t,this._c):[].concat(r),n],a=ta(t,i[0],s),o=a.top,l=a.right,u=a.bottom,c=a.left;for(let e=1;e<i.length;e++){let r=ta(t,i[e],s);o=(0,eQ.max)(r.top,o),l=(0,eQ.min)(r.right,l),u=(0,eQ.min)(r.bottom,u),c=(0,eQ.max)(r.left,c)}return{width:l-c,height:u-o,x:c,y:o}},getOffsetParent:tu,getElementRects:tc,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=e9(e);return{width:t,height:r}},getScale:te,isElement:ex.isElement,isRTL:function(e){return"rtl"===(0,ex.getComputedStyle)(e).direction}};function td(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tf(e,t,r,n){let s;void 0===n&&(n={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:u=!1}=n,c=e7(e),h=i||a?[...c?(0,ex.getOverflowAncestors)(c):[],...t?(0,ex.getOverflowAncestors)(t):[]]:[];h.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),a&&e.addEventListener("resize",r)});let d=c&&l?function(e,t){let r,n=null,s=(0,ex.getDocumentElement)(e);function i(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function a(o,l){void 0===o&&(o=!1),void 0===l&&(l=1),i();let u=e.getBoundingClientRect(),{left:c,top:h,width:d,height:f}=u;if(o||t(),!d||!f)return;let p={rootMargin:-(0,eQ.floor)(h)+"px "+-(0,eQ.floor)(s.clientWidth-(c+d))+"px "+-(0,eQ.floor)(s.clientHeight-(h+f))+"px "+-(0,eQ.floor)(c)+"px",threshold:(0,eQ.max)(0,(0,eQ.min)(1,l))||1},g=!0;function m(t){let n=t[0].intersectionRatio;if(n!==l){if(!g)return a();n?a(!1,n):r=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==n||td(u,e.getBoundingClientRect())||a(),g=!1}try{n=new IntersectionObserver(m,{...p,root:s.ownerDocument})}catch(e){n=new IntersectionObserver(m,p)}n.observe(e)}(!0),i}(c,r):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),c&&!u&&p.observe(c),t&&p.observe(t));let g=u?tn(e):null;return u&&function t(){let n=tn(e);g&&!td(g,n)&&r(),g=n,s=requestAnimationFrame(t)}(),r(),()=>{var e;h.forEach(e=>{i&&e.removeEventListener("scroll",r),a&&e.removeEventListener("resize",r)}),null==d||d(),null==(e=p)||e.disconnect(),p=null,u&&cancelAnimationFrame(s)}}var tp=e.i(73340),tg="u">typeof document?i.useLayoutEffect:function(){};function tm(e,t){let r,n,s;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!tm(e[n],t[n]))return!1;return!0}if((r=(s=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,s[n]))return!1;for(n=r;0!=n--;){let r=s[n];if(("_owner"!==r||!e.$$typeof)&&!tm(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function ty(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tb(e,t){let r=ty(e);return Math.round(t*r)/r}function tv(e){let t=i.useRef(e);return tg(()=>{t.current=e}),t}var tw=e.i(47094),tx=e.i(42609),tE=e.i(87541);let tk=i.createContext(void 0);function tS(){let e=i.useContext(tk);return e?.direction??"ltr"}let tR={name:"hide",async fn(e){var t,r,n;let s,{width:i,height:a,x:o,y:l}=e.rects.reference,u=await (void 0===(n=t)&&(n={}),{name:(s={name:"hide",options:n,async fn(e){let{rects:t,platform:r}=e,{strategy:s="referenceHidden",...i}=(0,eQ.evaluate)(n,e);switch(s){case"referenceHidden":{let n=e8(await r.detectOverflow(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:e4(n)}}}case"escaped":{let n=e8(await r.detectOverflow(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:e4(n)}}}default:return{}}}}).name,fn:s.fn,options:[t,r]}).fn(e);return{data:{referenceHidden:u.data?.referenceHidden||0===i&&0===a&&0===o&&0===l}}}},t_={sideX:"left",sideY:"top"},tT={name:"adaptiveOrigin",async fn(e){let{x:t,y:r,rects:{floating:n},elements:{floating:s},platform:i,strategy:a,placement:o}=e,l=(0,eZ.ownerWindow)(s),u=l.getComputedStyle(s);if("0s"===u.transitionDuration||""===u.transitionDuration)return{x:t,y:r,data:t_};let c=await i.getOffsetParent?.(s),h={width:0,height:0};
37if("fixed"===a&&l?.visualViewport)h={width:l.visualViewport.width,height:l.visualViewport.height};else if(c===l){let e=(0,eR.ownerDocument)(s);h={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await i.isElement?.(c)&&(h=await i.getDimensions(c));let d=(0,eQ.getSide)(o),f=t,p=r;return"left"===d&&(f=h.width-(t+n.width)),"top"===d&&(p=h.height-(r+n.height)),{x:f,y:p,data:{sideX:"left"===d?"right":t_.sideX,sideY:"top"===d?"bottom":t_.sideY}}}};function tC(e,t,r){let n="inline-start"===e||"inline-end"===e;return({top:"top",right:n?r?"inline-start":"inline-end":"right",bottom:"bottom",left:n?r?"inline-end":"inline-start":"left"})[t]}function tO(e,t,r){let{rects:n,placement:s}=e;return{side:tC(t,(0,eQ.getSide)(s),r),align:(0,eQ.getAlignment)(s)||"center",anchor:{width:n.reference.width,height:n.reference.height},positioner:{width:n.floating.width,height:n.floating.height}}}function tA(e){return null!=e&&"current"in e}function tP(e){let{children:t,elementsRef:r,labelsRef:n,onMapChange:a}=e,o=(0,K.useStableCallback)(a),l=i.useRef(0),u=(0,eP.useRefWithInit)(tj).current,c=(0,eP.useRefWithInit)(tI).current,[h,d]=i.useState(0),f=i.useRef(h),p=(0,K.useStableCallback)((e,t)=>{c.set(e,t??null),f.current+=1,d(f.current)}),g=(0,K.useStableCallback)(e=>{c.delete(e),f.current+=1,d(f.current)}),m=i.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(tN).forEach((t,r)=>{let n=c.get(t)??{};e.set(t,{...n,index:r})}),e},[c,h]);(0,en.useIsoLayoutEffect)(()=>{if("function"!=typeof MutationObserver||0===m.size)return;let e=new MutationObserver(e=>{let t=new Set,r=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(r),e.addedNodes.forEach(r)}),0===t.size&&(f.current+=1,d(f.current))});return m.forEach((t,r)=>{r.parentElement&&e.observe(r.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),(0,en.useIsoLayoutEffect)(()=>{f.current===h&&(r.current.length!==m.size&&(r.current.length=m.size),n&&n.current.length!==m.size&&(n.current.length=m.size),l.current=m.size),o(m)},[o,m,r,n,h]),(0,en.useIsoLayoutEffect)(()=>()=>{r.current=[]},[r]),(0,en.useIsoLayoutEffect)(()=>()=>{n&&(n.current=[])},[n]);let y=(0,K.useStableCallback)(e=>(u.add(e),()=>{u.delete(e)}));(0,en.useIsoLayoutEffect)(()=>{u.forEach(e=>e(m))},[u,m]);let b=i.useMemo(()=>({register:p,unregister:g,subscribeMapChange:y,elementsRef:r,labelsRef:n,nextIndexRef:l}),[p,g,y,r,n,l]);return(0,s.jsx)(es.Provider,{value:b,children:t})}function tI(){return new Map}function tj(){return new Set}function tN(e,t){let r=e.compareDocumentPosition(t);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}var tL=e.i(33267),tM=e.i(38768),tD=e.i(21569);let t$=i.forwardRef(function(e,t){let{anchor:r,positionMethod:n="absolute",className:a,render:o,side:l,align:u,sideOffset:c=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:f=5,arrowPadding:p=5,sticky:g=!1,disableAnchorTracking:m=!1,collisionAvoidance:y=eq.DROPDOWN_COLLISION_AVOIDANCE,style:b,...v}=e,{store:w}=D(),x=function(){let e=i.useContext(eJ);if(void 0===e)throw Error((0,j.default)(32));return e}(),E=W(!0),k=w.useState("parent"),S=w.useState("floatingRootContext"),R=w.useState("floatingTreeRoot"),_=w.useState("mounted"),T=w.useState("open"),C=w.useState("modal"),O=w.useState("openMethod"),A=w.useState("activeTriggerElement"),P=w.useState("transitionStatus"),I=w.useState("positionerElement"),L=w.useState("instantType"),M=w.useState("hasViewport"),B=w.useState("lastOpenChangeReason"),F=w.useState("floatingNodeId"),H=w.useState("floatingParentNodeId"),z=S.useState("domReferenceElement"),V=i.useRef(null),G=(0,tM.useAnimationsFinished)(I,!1,!1),J=r,Y=c,X=h,Q=u,Z=y;"context-menu"===k.type&&(J=r??k.context?.anchor,Q=Q??"start",l||"center"===Q||(X=e.alignOffset??2,Y=e.sideOffset??-5));let ee=l,et=Q;"menu"===k.type?(ee=ee??"inline-end",et=et??"start",Z=e.collisionAvoidance??eq.POPUP_COLLISION_AVOIDANCE):"menubar"===k.type&&(ee=ee??"bottom",et=et??"start");let er="context-menu"===k.type,es=function(e){var t,r,n,s,a,o,l,u,c,h,d,f,p,g;let m,y,b,v,{anchor:w,positionMethod:x="absolute",side:E="bottom",sideOffset:k=0,align:S="center",alignOffset:R=0,collisionBoundary:_,collisionPadding:T=5,sticky:C=!1,arrowPadding:O=5,disableAnchorTracking:A=!1,keepMounted:P=!1,floatingRootContext:I,mounted:j,collisionAvoidance:N,shiftCrossAxis:L=!1,nodeId:M,adaptiveOrigin:D,lazyFlip:$=!1,externalTree:U}=e,[B,F]=i.useState(null);j||null===B||F(null);let H=N.side||"flip",W=N.align||"flip",q=N.fallbackAxisSide||"end",z="function"==typeof w?w:void 0,V=(0,K.useStableCallback)(z),G=z?V:w,J=(0,e0.useValueAsRef)(w),Y=(0,e0.useValueAsRef)(j),X="rtl"===tS(),Q=B||({top:"top",right:"right",bottom:"bottom",left:"left","inline-end":X?"left":"right","inline-start":X?"right":"left"})[E],Z="center"===S?Q:`${Q}-${S}`,ee=T,et=+("bottom"===E),er=+("top"===E),es=+("right"===E),ei=+("left"===E);"number"==typeof ee?ee={top:ee+et,right:ee+ei,bottom:ee+er,left:ee+es}:ee&&(ee={top:(ee.top||0)+et,right:(ee.right||0)+ei,bottom:(ee.bottom||0)+er,left:(ee.left||0)+es});let ea={boundary:"clipping-ancestors"===_?"clippingAncestors":_,padding:ee},eo=i.useRef(null),el=(0,e0.useValueAsRef)(k),eu=(0,e0.useValueAsRef)(R),ec=[(t=e=>{let t=tO(e,E,X),r="function"==typeof el.current?el.current(t):el.current,n="function"==typeof eu.current?eu.current(t):eu.current;return{mainAxis:r,crossAxis:n,alignmentAxis:n}},r=["function"!=typeof k?k:0,"function"!=typeof R?R:0,X,E],void 0===(n=t)&&(n=0),{name:(m={name:"offset",options:n,async fn(e){var t,r;let{x:s,y:i,placement:a,middlewareData:o}=e,l=await e6(e,n);return a===(null==(t=o.offset)?void 0:t.placement)&&null!=(r=o.arrow)&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:a}}}}).name,fn:m.fn,options:[t,r]})],eh="none"===W&&"shift"!==H,ed=!eh&&(C||L||"shift"===H),ef="none"===H?null:{name:(y={name:"flip",options:o=s={...ea,padding:{top:ee.top+1,right:ee.right+1,bottom:ee.bottom+1,left:ee.left+1},mainAxis:!L&&"flip"===H,crossAxis:"flip"===W&&"alignment",fallbackAxisSideDirection:q},async fn(e){var t,r,n,s,i;let{placement:a,middlewareData:l,rects:u,initialPlacement:c,platform:h,elements:d}=e,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...v}=(0,eQ.evaluate)(o,e);if(null!=(t=l.arrow)&&t.alignmentOffset)return{};let w=(0,eQ.getSide)(a),x=(0,eQ.getSideAxis)(c),E=(0,eQ.getSide)(c)===c,k=await (null==h.isRTL?void 0:h.isRTL(d.floating)),S=g||(E||!b?[(0,eQ.getOppositePlacement)(c)]:(0,eQ.getExpandedPlacements)(c)),R="none"!==y;!g&&R&&S.push(...(0,eQ.getOppositeAxisPlacements)(c,b,y,k));let _=[c,...S],T=await h.detectOverflow(e,v),C=[],O=(null==(r=l.flip)?void 0:r.overflows)||[];if(f&&C.push(T[w]),p){let e=(0,eQ.getAlignmentSides)(a,u,k);C.push(T[e[0]],T[e[1]])}if(O=[...O,{placement:a,overflows:C}],!C.every(e=>e<=0)){let e=((null==(n=l.flip)?void 0:n.index)||0)+1,t=_[e];if(t&&("alignment"!==p||x===(0,eQ.getSideAxis)(t)||O.every(e=>(0,eQ.getSideAxis)(e.placement)!==x||e.overflows[0]>0)))return{data:{index:e,overflows:O},reset:{placement:t}};let r=null==(s=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>
37e.overflows[1]-t.overflows[1])[0])?void 0:s.placement;if(!r)switch(m){case"bestFit":{let e=null==(i=O.filter(e=>{if(R){let t=(0,eQ.getSideAxis)(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:i[0];e&&(r=e);break}case"initialPlacement":r=c}if(a!==r)return{reset:{placement:r}}}return{}}}).name,fn:y.fn,options:[s,a]},ep=eh?null:(l=e=>{var t,r,n;let s=(0,eR.ownerDocument)(e.elements.floating).documentElement;return{...ea,rootBoundary:L?{x:0,y:0,width:s.clientWidth,height:s.clientHeight}:void 0,mainAxis:"none"!==W,crossAxis:ed,limiter:C||L?void 0:{fn:(void 0===(n=t=e=>{if(!eo.current)return{};let{width:t,height:r}=eo.current.getBoundingClientRect(),n=(0,eQ.getSideAxis)((0,eQ.getSide)(e.placement)),s="y"===n?ee.left+ee.right:ee.top+ee.bottom;return{offset:("y"===n?t:r)/2+s/2}})&&(n={}),{options:n,fn(e){let{x:t,y:r,placement:s,rects:i,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=(0,eQ.evaluate)(n,e),c={x:t,y:r},h=(0,eQ.getSideAxis)(s),d=(0,eQ.getOppositeAxis)(h),f=c[d],p=c[h],g=(0,eQ.evaluate)(o,e),m="number"==typeof g?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){let e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+m.mainAxis,r=i.reference[d]+i.reference[e]-m.mainAxis;f<t?f=t:f>r&&(f=r)}if(u){var y,b;let e="y"===d?"width":"height",t=e3.has((0,eQ.getSide)(s)),r=i.reference[h]-i.floating[e]+(t&&(null==(y=a.offset)?void 0:y[h])||0)+(t?0:m.crossAxis),n=i.reference[h]+i.reference[e]+(t?0:(null==(b=a.offset)?void 0:b[h])||0)-(t?m.crossAxis:0);p<r?p=r:p>n&&(p=n)}return{[d]:f,[h]:p}}}).fn,options:[t,r]}}},u=[ea,C,L,ee,W],void 0===(c=l)&&(c={}),{name:(b={name:"shift",options:c,async fn(e){let{x:t,y:r,placement:n,platform:s}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:o={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=(0,eQ.evaluate)(c,e),u={x:t,y:r},h=await s.detectOverflow(e,l),d=(0,eQ.getSideAxis)((0,eQ.getSide)(n)),f=(0,eQ.getOppositeAxis)(d),p=u[f],g=u[d];if(i){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",r=p+h[e],n=p-h[t];p=(0,eQ.clamp)(r,p,n)}if(a){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",r=g+h[e],n=g-h[t];g=(0,eQ.clamp)(r,g,n)}let m=o.fn({...e,[f]:p,[d]:g});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[f]:i,[d]:a}}}}}).name,fn:b.fn,options:[l,u]});"shift"===H||"shift"===W||"center"===S?ec.push(ep,ef):ec.push(ef,ep),ec.push({name:(v={name:"size",options:f=h={...ea,apply({elements:{floating:e},availableWidth:t,availableHeight:r,rects:n}){if(!Y.current)return;let s=e.style;s.setProperty("--available-width",`${t}px`),s.setProperty("--available-height",`${r}px`);let i=(0,eZ.ownerWindow)(e).devicePixelRatio||1,{x:a,y:o,width:l,height:u}=n.reference,c=(Math.round((a+l)*i)-Math.round(a*i))/i,h=(Math.round((o+u)*i)-Math.round(o*i))/i;s.setProperty("--anchor-width",`${c}px`),s.setProperty("--anchor-height",`${h}px`)}},async fn(e){var t,r;let n,s,{placement:i,rects:a,platform:o,elements:l}=e,{apply:u=()=>{},...c}=(0,eQ.evaluate)(f,e),h=await o.detectOverflow(e,c),d=(0,eQ.getSide)(i),p=(0,eQ.getAlignment)(i),g="y"===(0,eQ.getSideAxis)(i),{width:m,height:y}=a.floating;"top"===d||"bottom"===d?(n=d,s=p===(await (null==o.isRTL?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(s=d,n="end"===p?"top":"bottom");let b=y-h.top-h.bottom,v=m-h.left-h.right,w=(0,eQ.min)(y-h[n],b),x=(0,eQ.min)(m-h[s],v),E=!e.middlewareData.shift,k=w,S=x;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(S=v),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(k=b),E&&!p){let e=(0,eQ.max)(h.left,0),t=(0,eQ.max)(h.right,0),r=(0,eQ.max)(h.top,0),n=(0,eQ.max)(h.bottom,0);g?S=m-2*(0!==e||0!==t?e+t:(0,eQ.max)(h.left,h.right)):k=y-2*(0!==r||0!==n?r+n:(0,eQ.max)(h.top,h.bottom))}await u({...e,availableWidth:S,availableHeight:k});let R=await o.getDimensions(l.floating);return m!==R.width||y!==R.height?{reset:{rects:!0}}:{}}}).name,fn:v.fn,options:[h,d]},(p=()=>({element:eo.current||(0,eR.ownerDocument)(eo.current).createElement("div"),padding:O,offsetParent:"floating"}),g=[O],{name:"arrow",options:p,async fn(e){let{x:t,y:r,placement:n,rects:s,platform:i,elements:a,middlewareData:o}=e,{element:l,padding:u=0,offsetParent:c="real"}=(0,eQ.evaluate)(p,e)||{};if(null==l)return{};
37let h=(0,eQ.getPaddingObject)(u),d={x:t,y:r},f=(0,eQ.getAlignmentAxis)(n),g=(0,eQ.getAxisLength)(f),m=await i.getDimensions(l),y="y"===f,b=y?"clientHeight":"clientWidth",v=s.reference[g]+s.reference[f]-d[f]-s.floating[g],w=d[f]-s.reference[f],x="real"===c?await i.getOffsetParent?.(l):a.floating,E=a.floating[b]||s.floating[g];E&&await i.isElement?.(x)||(E=a.floating[b]||s.floating[g]);let k=E/2-m[g]/2-1,S=Math.min(h[y?"top":"left"],k),R=Math.min(h[y?"bottom":"right"],k),_=E-m[g]-R,T=E/2-m[g]/2+(v/2-w/2),C=(0,eQ.clamp)(S,T,_),O=!o.arrow&&null!=(0,eQ.getAlignment)(n)&&T!==C&&s.reference[g]/2-(T<S?S:R)-m[g]/2<0,A=O?T<S?T-S:T-_:0;return{[f]:d[f]+A,data:{[f]:C,centerOffset:T-C-A,...O&&{alignmentOffset:A}},reset:O}},options:[p,g]}),{name:"transformOrigin",fn(e){let{elements:t,middlewareData:r,placement:n,rects:s,y:i}=e,a=(0,eQ.getSide)(n),o=(0,eQ.getSideAxis)(a),l=eo.current,u=r.arrow?.x||0,c=r.arrow?.y||0,h=l?.clientWidth||0,d=l?.clientHeight||0,f=u+h/2,p=c+d/2,g=Math.abs(r.shift?.y||0),m=s.reference.height/2,y="function"==typeof k?k(tO(e,E,X)):k,b=g>y,v={top:`${f}px calc(100% + ${y}px)`,bottom:`${f}px ${-y}px`,left:`calc(100% + ${y}px) ${p}px`,right:`${-y}px ${p}px`}[a],w=`${f}px ${s.reference.y+m-i}px`;return t.floating.style.setProperty("--transform-origin",ed&&"y"===o&&b?w:v),{}}},tR,D),(0,en.useIsoLayoutEffect)(()=>{!j&&I&&I.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[j,I]);let eg=i.useMemo(()=>({elementResize:!A&&"u">typeof ResizeObserver,layoutShift:!A&&"u">typeof IntersectionObserver}),[A]),{refs:em,elements:ey,x:eb,y:ev,middlewareData:ew,update:eE,placement:ek,context:eS,isPositioned:e_,floatingStyles:eT}=function(e={}){let{nodeId:t,externalTree:r}=e,n=function(e){let{open:t=!1,onOpenChange:r,elements:n={}}=e,s=(0,tw.useId)(),i=null!=(0,eO.useFloatingParentNodeId)(),a=(0,eP.useRefWithInit)(()=>new tx.FloatingRootStore({open:t,transitionStatus:void 0,onOpenChange:r,referenceElement:n.reference??null,floatingElement:n.floating??null,triggerElements:new tE.PopupTriggerMap,floatingId:s,syncOnly:!1,nested:i})).current;return(0,en.useIsoLayoutEffect)(()=>{let e={open:t,floatingId:s};void 0!==n.reference&&(e.referenceElement=n.reference,e.domReferenceElement=(0,ex.isElement)(n.reference)?n.reference:null),void 0!==n.floating&&(e.floatingElement=n.floating),a.update(e)},[t,s,n.reference,n.floating,a]),a.context.onOpenChange=r,a.context.nested=i,a}(e),s=e.rootContext||n,a={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[o,l]=i.useState(null),u=i.useRef(null),c=(0,eO.useFloatingTree)(r);(0,en.useIsoLayoutEffect)(()=>{a.domReference&&(u.current=a.domReference)},[a.domReference]);let h=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:u,open:c}=e,[h,d]=i.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=i.useState(n);tm(f,n)||p(n);let[g,m]=i.useState(null),[y,b]=i.useState(null),v=i.useCallback(e=>{e!==k.current&&(k.current=e,m(e))},[]),w=i.useCallback(e=>{e!==S.current&&(S.current=e,b(e))},[]),x=a||g,E=o||y,k=i.useRef(null),S=i.useRef(null),R=i.useRef(h),_=null!=u,T=tv(u),C=tv(s),O=tv(c),A=i.useCallback(()=>{var e,n;let s,i,a;if(!k.current||!S.current)return;let o={placement:t,strategy:r,middleware:f};C.current&&(o.platform=C.current),(e=k.current,n=S.current,s=new Map,a={...(i={platform:th,...o}).platform,_c:s},e5(e,n,{...i,platform:a})).then(e=>{let t={...e,isPositioned:!1!==O.current};P.current&&!tm(R.current,t)&&(R.current=t,tp.flushSync(()=>{d(t)}))})},[f,t,r,C,O]);tg(()=>{!1===c&&R.current.isPositioned&&(R.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let P=i.useRef(!1);tg(()=>(P.current=!0,()=>{P.current=!1}),[]),tg(()=>{if(x&&(k.current=x),E&&(S.current=E),x&&E){if(T.current)return T.current(x,E,A);A()}},[x,E,A,T,_]);let I=i.useMemo(()=>({reference:k,floating:S,setReference:v,setFloating:w}),[v,w]),j=i.useMemo(()=>({reference:x,floating:E}),[x,E]),N=i.useMemo(()=>{let e={position:r,left:0,top:0};if(!j.floating)return e;let t=tb(j.floating,h.x),n=tb(j.floating,h.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...ty(j.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,j.floating,h.x,h.y]);return i.useMemo(()=>({...h,update:A,refs:I,elements:j,floatingStyles:N}),[h,A,I,j,N])}({...e,elements:{...a,...o&&{reference:o}}}),d=i.useCallback(e=>{let t=(0,ex.isElement)(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;l(t),h.refs.setReference(t)},[h.refs]),[f,p]=i.useState(void 0),[g,m]=i.useState(null);s.useSyncedValue("referenceElement",f??null);let y=(0,ex.isElement)(f)?f:null;s.useSyncedValue("domReferenceElement",void 0===f?a.domReference:y),s.useSyncedValue("floatingElement",g);let b=i.useCallback(e=>{((0,ex.isElement)(e)||null===e)&&(u.current=e,p(e)),((0,ex.isElement)(h.refs.reference.current)||null===h.refs.reference.current||null!==e&&!(0,ex.isElement)(e))&&h.refs.setReference(e)},[h.refs,p]),v=i.useCallback(e=>{m(e),h.refs.setFloating(e)},[h.refs]),w=i.useMemo(()=>({...h.refs,setReference:b,setFloating:v,setPositionReference:d,domReference:u}),[h.refs,b,v,d]),x=i.useMemo(()=>({...h.elements,domReference:a.domReference}),[h.elements,a.domReference]),E=s.useState("open"),k=s.useState("floatingId"),S=i.useMemo(()=>({...h,dataRef:s.context.dataRef,open:E,onOpenChange:s.setOpen,events:s.context.events,floatingId:k,refs:w,elements:x,nodeId:t,rootStore:s}),[h,w,x,t,s,E,k]);return(0,en.useIsoLayoutEffect)(()=>{s.context.dataRef.current.floatingContext=S;let e=c?.nodesRef.current.find(e=>e.id===t);e&&(e.context=S)}),i.useMemo(()=>({...h,context:S,refs:w,elements:x,rootStore:s}),[h,w,x,S,s])}({rootContext:I,open:P?j:void 0,placement:Z,middleware:ec,strategy:x,whileElementsMounted:P?void 0:(...e)=>tf(...e,eg),nodeId:M,externalTree:U}),{sideX:eC,sideY:eA}=ew.adaptiveOrigin||t_,eI=e_?x:"fixed",ej=i.useMemo(()=>{let e=D?{position:eI,[eC]:eb,[eA]:ev}:{position:eI,...eT};return e_||(e.opacity=0),e},[D,eI,eC,eb,eA,ev,eT,e_]),eN=i.useRef(null);(0,en.useIsoLayoutEffect)(()=>
37{if(!j)return;let e=J.current,t="function"==typeof e?e():e,r=(tA(t)?t.current:t)||null;r!==eN.current&&(em.setPositionReference(r),eN.current=r)},[j,em,G,J]),i.useEffect(()=>{if(!j)return;let e=J.current;"function"!=typeof e&&tA(e)&&e.current!==eN.current&&(em.setPositionReference(e.current),eN.current=e.current)},[j,em,G,J]),i.useEffect(()=>{if(P&&j&&ey.domReference&&ey.floating)return tf(ey.domReference,ey.floating,eE,eg)},[P,j,ey,eE,eg]);let eL=(0,eQ.getSide)(ek),eM=tC(E,eL,X),eD=(0,eQ.getAlignment)(ek)||"center",e$=!!ew.hide?.referenceHidden;(0,en.useIsoLayoutEffect)(()=>{$&&j&&e_&&F(eL)},[$,j,e_,eL]);let eU=i.useMemo(()=>({position:"absolute",top:ew.arrow?.y,left:ew.arrow?.x}),[ew.arrow]),eB=ew.arrow?.centerOffset!==0;return i.useMemo(()=>({positionerStyles:ej,arrowStyles:eU,arrowRef:eo,arrowUncentered:eB,side:eM,align:eD,physicalSide:eL,anchorHidden:e$,refs:em,context:eS,isPositioned:e_,update:eE}),[ej,eU,eo,eB,eM,eD,eL,e$,em,eS,e_,eE])}({anchor:J,floatingRootContext:S,positionMethod:E?"fixed":n,mounted:_,side:ee,sideOffset:Y,align:et,alignOffset:X,arrowPadding:er?0:p,collisionBoundary:d,collisionPadding:f,sticky:g,nodeId:F,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:Z,shiftCrossAxis:er&&!("side"in Z&&"flip"===Z.side),externalTree:R,adaptiveOrigin:M?tT:void 0});i.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&w.set("hoverEnabled",!1),e.nodeId!==F&&e.parentNodeId===w.select("floatingParentNodeId")&&w.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.siblingOpen)))}return R.events.on("menuopenchange",e),()=>{R.events.off("menuopenchange",e)}},[w,R.events,F]),i.useEffect(()=>{if(null!=w.select("floatingParentNodeId"))return R.events.on("menuopenchange",e),()=>{R.events.off("menuopenchange",e)};function e(e){if(e.open||e.nodeId!==w.select("floatingParentNodeId"))return;let t=e.reason??q.REASONS.siblingOpen;w.setOpen(!1,(0,ec.createChangeEventDetails)(t))}},[R.events,w]);let ei=(0,eS.useTimeout)();i.useEffect(()=>{T||ei.clear()},[T,ei]),i.useEffect(()=>{function e(e){if(T&&e.nodeId===w.select("floatingParentNodeId"))if(e.target&&A&&A!==e.target){let e=w.select("closeDelay");e>0?ei.isStarted()||ei.start(e,()=>{w.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.siblingOpen))}):w.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.siblingOpen))}else ei.clear()}return R.events.on("itemhover",e),()=>{R.events.off("itemhover",e)}},[R.events,T,A,w,ei]),i.useEffect(()=>{let e={open:T,nodeId:F,parentNodeId:H,reason:w.select("lastOpenChangeReason")};R.events.emit("menuopenchange",e)},[R.events,T,w,F,H]),(0,en.useIsoLayoutEffect)(()=>{let e=V.current;if(z&&(V.current=z),e&&z&&z!==e){w.set("instantType",void 0);let e=new AbortController;return G(()=>{w.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[z,G,w]);let ea={open:T,side:es.side,align:es.align,anchorHidden:es.anchorHidden,nested:"menu"===k.type,instant:L},eo="menubar"===k.type&&k.context.modal,el=C&&B!==q.REASONS.triggerHover;!function(e,t,r,n){let[s,a]=i.useState(!1);(0,en.useIsoLayoutEffect)(()=>{if(!e||!t||null==r)return void a(!1);let n=(0,eR.ownerDocument)(r).documentElement.clientWidth,s=r.offsetWidth;a(n>0&&s>0&&s>=n-20)},[e,t,r]),(0,tD.useScrollLock)(e&&(!t||s),n)}(T&&(eo||el),"touch"===O,I,A);let eu=function(e,t,{styles:r,transitionStatus:n,props:s,refs:i,hidden:a,inert:o=!1}){let l={...r};return o&&(l.pointerEvents="none"),(0,$.useRenderElement)("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:a,style:l},ez(n),s],stateAttributesMapping:U.popupStateMapping})}(e,ea,{styles:es.positionerStyles,transitionStatus:P,props:v,refs:[t,w.useStateSetter("positionerElement")],hidden:!_,inert:!T}),eh=_&&"menu"!==k.type&&("menubar"!==k.type&&C&&B!==q.REASONS.triggerHover||"menubar"===k.type&&k.context.modal),ed=null;return"menubar"===k.type?ed=k.context.contentElement:void 0===k.type&&(ed=A),(0,s.jsxs)(N.Provider,{value:es,children:[eh&&(0,s.jsx)(tL.InternalBackdrop,{ref:"context-menu"===k.type||"nested-context-menu"===k.type?k.context.internalBackdropRef:null,inert:(0,eX.inertValue)(!T),cutout:ed}),(0,s.jsx)(eO.FloatingNode,{id:F,children:(0,s.jsx)(tP,{elementsRef:w.context.
37itemDomElements,labelsRef:w.context.itemLabels,children:eu})})]})}),tU=i.createContext(void 0),tB=i.memo(i.forwardRef(function(e,t){let{render:r,className:n,value:a,defaultValue:o,onValueChange:l,disabled:u=!1,style:c,...h}=e,[d,f]=(0,G.useControlled)({controlled:a,default:o,name:"MenuRadioGroup"}),p=(0,K.useStableCallback)(l),g=(0,K.useStableCallback)((e,t)=>{p?.(e,t),t.isCanceled||f(e)}),m=(0,$.useRenderElement)("div",e,{state:{disabled:u},ref:t,props:{role:"group","aria-disabled":u||void 0,...h}}),y=i.useMemo(()=>({value:d,setValue:g,disabled:u}),[d,g,u]);return(0,s.jsx)(tU.Provider,{value:y,children:m})})),tF=i.createContext(void 0),tH=i.forwardRef(function(e,t){let{render:r,className:n,id:a,label:o,nativeButton:l=!1,disabled:u=!1,closeOnClick:c=!1,value:h,style:d,...f}=e,p=ea({label:o}),g=L(!0),m=(0,eo.useBaseUiId)(a),{store:y}=D(),b=y.useState("isActive",p.index),v=y.useState("itemProps"),{value:w,setValue:x,disabled:E}=function(){let e=i.useContext(tU);if(void 0===e)throw Error((0,j.default)(34));return e}(),k=E||u,S=w===h,{getItemProps:R,itemRef:_}=er({closeOnClick:c,disabled:k,highlighted:b,id:m,store:y,nativeButton:l,nodeId:g?.context.nodeId,itemMetadata:et}),T=i.useMemo(()=>({disabled:k,highlighted:b,checked:S}),[k,b,S]),C=(0,K.useStableCallback)(e=>{x(h,{...(0,ec.createChangeEventDetails)(q.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}})}),O=(0,$.useRenderElement)("div",e,{state:T,stateAttributesMapping:eu,props:[v,{role:"menuitemradio","aria-checked":S,onClick:C},f,R],ref:[_,t,p.ref]});return(0,s.jsx)(tF.Provider,{value:T,children:O})}),tW=i.forwardRef(function(e,t){let{render:r,className:n,style:s,keepMounted:a=!1,...o}=e,l=function(){let e=i.useContext(tF);if(void 0===e)throw Error((0,j.default)(35));return e}(),u=i.useRef(null),{transitionStatus:c,setMounted:h}=(0,ed.useTransitionStatus)(l.checked);(0,ef.useOpenChangeComplete)({open:l.checked,ref:u,onComplete(){l.checked||h(!1)}});let d={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:c};return(0,$.useRenderElement)("span",e,{state:d,stateAttributesMapping:eu,ref:[t,u],props:{"aria-hidden":!0,...o},enabled:a||l.checked})});var tq=e.i(69556),tz=e.i(39892),tV=e.i(73753),tK=e.i(76026),tG=e.i(61837),tJ=e.i(74254),tY=e.i(29314);function tX(e,t,r){switch(e){case"vertical":return t;case"horizontal":return r;default:return t||r}}function tQ(e,t){return tX(t,e===tY.ARROW_UP||e===tY.ARROW_DOWN,e===tY.ARROW_LEFT||e===tY.ARROW_RIGHT)}function tZ(e,t,r){return tX(t,e===tY.ARROW_DOWN,r?e===tY.ARROW_LEFT:e===tY.ARROW_RIGHT)||"Enter"===e||" "===e||""===e}var t0=e.i(52524),t1=e.i(31244);let t2=i.createContext(null);function t5(e){let t=i.useContext(t2);if(null===t&&!e)throw Error((0,j.default)(5));return t}var t8=e.i(62108),t4=e.i(47669),t3=e.i(72139),t6=e.i(61546),t9=e.i(42155);let t7={...t9.popupStoreSelectors,disabled:(0,t4.createSelector)(e=>"menubar"===e.parent.type&&e.parent.context.disabled||e.disabled),modal:(0,t4.createSelector)(e=>(void 0===e.parent.type||"context-menu"===e.parent.type)&&(e.modal??!0)),openMethod:(0,t4.createSelector)(e=>e.openMethod),allowMouseEnter:(0,t4.createSelector)(e=>e.allowMouseEnter),stickIfOpen:(0,t4.createSelector)(e=>e.stickIfOpen),parent:(0,t4.createSelector)(e=>e.parent),rootId:(0,t4.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("rootId"):void 0!==e.parent.type?e.parent.context.rootId:e.rootId),activeIndex:(0,t4.createSelector)(e=>e.activeIndex),isActive:(0,t4.createSelector)((e,t)=>e.activeIndex===t),hoverEnabled:(0,t4.createSelector)(e=>e.hoverEnabled),instantType:(0,t4.createSelector)(e=>e.instantType),lastOpenChangeReason:(0,t4.createSelector)(e=>e.openChangeReason),floatingTreeRoot:(0,t4.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:(0,t4.createSelector)(e=>e.floatingNodeId),floatingParentNodeId:(0,t4.createSelector)(e=>e.floatingParentNodeId),itemProps:(0,t4.createSelector)(e=>e.itemProps),closeDelay:(0,t4.createSelector)(e=>e.closeDelay),hasViewport:(0,t4.createSelector)(e=>e.hasViewport),keyboardEventRelay:(0,t4.createSelector)(e=>e.keyboardEventRelay?e.keyboardEventRelay:"menu"===e.parent.type?e.parent.store.select("keyboardEventRelay"):void 0)};class re extends t3.ReactStore{constructor(e){super({...{...(0,t9.createInitialPopupStoreState)(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new t6.FloatingTreeStore,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:eW.EMPTY_OBJECT,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1},...e},{positionerRef:i.createRef(),popupRef:i.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1}
37,triggerFocusTargetRef:i.createRef(),beforeContentFocusGuardRef:i.createRef(),onOpenChangeComplete:void 0,triggerElements:new tE.PopupTriggerMap},t7),this.unsubscribeParentListener=this.observe("parent",e=>{if(this.unsubscribeParentListener?.(),"menu"===e.type){let t=e.store.select("rootId"),r=e.store.select("floatingTreeRoot"),n=e.store.select("keyboardEventRelay");this.unsubscribeParentListener=e.store.subscribe(()=>{let s=e.store.select("rootId"),i=e.store.select("floatingTreeRoot"),a=e.store.select("keyboardEventRelay");(t!==s||r!==i||n!==a)&&(t=s,r=i,n=a,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}void 0!==e.type&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:t})}static useStore(e,t){let r=(0,eP.useRefWithInit)(()=>new re(t)).current;return e??r}unsubscribeParentListener=null}var rt=e.i(71949);let rr=i.createContext(void 0);function rn(){return i.useContext(rr)}let rs=(0,tz.fastComponent)(function(e){let t,{children:r,open:n,onOpenChange:a,onOpenChangeComplete:o,defaultOpen:l=!1,disabled:u=!1,modal:c,loopFocus:h=!0,orientation:d="vertical",actionsRef:f,closeParentOnEsc:p=!1,handle:g,triggerId:m,defaultTriggerId:y=null,highlightItemOnHover:b=!0}=e,v=W(!0),w=D(!0),x=t5(!0),E=rn(),k=i.useMemo(()=>E&&w?{type:"menu",store:w.store}:x?{type:"menubar",context:x}:v&&!w?{type:"context-menu",context:v}:{type:void 0},[v,w,x,E]),S=re.useStore(g?.store,{open:l,openProp:n,activeTriggerId:y,triggerIdProp:m,parent:k});(0,tq.useOnFirstRender)(()=>{void 0===n&&!1===S.state.open&&!0===l&&S.update({open:!0,activeTriggerId:y})}),S.useControlledProp("openProp",n),S.useControlledProp("triggerIdProp",m),S.useContextCallback("onOpenChangeComplete",o);let R=S.useState("floatingTreeRoot"),_=(0,eO.useFloatingNodeId)(R),T=(0,eO.useFloatingParentNodeId)();(0,en.useIsoLayoutEffect)(()=>{v&&!w?S.update({parent:{type:"context-menu",context:v},floatingNodeId:_,floatingParentNodeId:T}):w&&S.update({floatingNodeId:_,floatingParentNodeId:T})},[v,w,_,T,S]);let C=S.useState("open"),O=S.useState("activeTriggerElement"),A=S.useState("positionerElement"),P=S.useState("hoverEnabled"),I=S.useState("disabled"),j=S.useState("lastOpenChangeReason"),N=S.useState("parent"),L=S.useState("activeIndex"),$=S.useState("payload"),U=S.useState("floatingParentNodeId"),B=i.useRef(null),F=null!=U,{openMethod:H,triggerProps:z}=(0,t8.useOpenInteractionType)(C);S.useSyncedValues({disabled:u,modal:void 0===N.type?c:void 0,openMethod:H,rootId:(0,tw.useId)()}),(0,rt.useImplicitActiveTrigger)(S);let{forceUnmount:V}=(0,rt.useOpenStateTransitions)(C,S,()=>{S.update({allowMouseEnter:!1,stickIfOpen:!0})}),G=i.useRef("context-menu"!==N.type),J=(0,eS.useTimeout)();i.useEffect(()=>{if(C||(B.current=null),"context-menu"===N.type){if(!C){J.clear(),G.current=!1;return}J.start(500,()=>{G.current=!0})}},[J,C,N.type]),(0,en.useIsoLayoutEffect)(()=>{C||P||S.set("hoverEnabled",!0)},[C,P,S]);let Y=i.useRef(!0),X=(0,eS.useTimeout)(),Z=(0,K.useStableCallback)((e,t)=>{let r=t.reason;if(C===e&&t.trigger===O&&j===r||(t.preventUnmountOnClose=()=>{S.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||(t.trigger=O??void 0),a?.(e,t),t.isCanceled))return;S.state.floatingRootContext.dispatchOpenChange(e,t);let n=t.event;if(!1===e&&n?.type==="click"&&"touch"===n.pointerType&&!Y.current)return;if(!e&&null!==L){let e=S.context.itemDomElements.current[L];queueMicrotask(()=>{e?.setAttribute("tabindex","-1")})}e&&r===q.REASONS.triggerFocus?(Y.current=!1,X.start(300,()=>{Y.current=!0})):(Y.current=!0,X.clear());let s=(r===q.REASONS.triggerPress||r===q.REASONS.itemPress)&&0===n.detail&&n?.isTrusted,i=!e&&(r===q.REASONS.escapeKey||null==r),o={open:e,openChangeReason:r};B.current=t.event??null;let l=t.trigger?.id??null;(l||e)&&(o.activeTriggerId=l,o.activeTriggerElement=t.trigger??null),S.update(o),"menubar"===N.type&&(r===q.REASONS.triggerFocus||r===q.REASONS.focusOut||r===q.REASONS.triggerHover||r===q.REASONS.listNavigation||r===q.REASONS.siblingOpen)?S.set("instantType","group"):s||i?S.set("instantType",s?"click":"dismiss"):S.set("instantType",void 0)}),ee=i.useCallback(()=>{S.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.imperativeAction))},[S]);i.useImperativeHandle(f,()=>({unmount:V,close:ee}),[V,ee]),"context-menu"===N.type&&(t=N.context),i.useImperativeHandle(t?.positionerRef,()=>A,[A]),i.useImperativeHandle(t?.actionsRef,()=>({setOpen:Z}),[Z]);let et=(0,t1.useSyncedFloatingRootContext)({popupStore:S,onOpenChange:Z}),er=et.context.events;i.useEffect(()=>{let e=({open:e,eventDetails:t})=>Z(e,t);return er.on("setOpen",e),()=>{er?.off("setOpen",e)}},[er,Z]);let es=(0,tV.useDismiss)(et,{enabled:!I,bubbles:{escapeKey:p&&"menu"===N.type},outsidePress:()=>"context-menu"!==N.type||B.current?.type==="contextmenu"||G.current,externalTree:F?R:void 0}),ei=(0,t0.useRole)(et,{role:"menu"}),ea=tS(),eo=i.useCallback(e=>{S.select("activeIndex")!==e&&S.set("activeIndex",e)},[S]),el=function(e,t){let r="rootStore"in e?e.rootStore:e,n=r.useState("open"),s=r.useState("floatingElement"),a=r.useState("domReferenceElement"),o=r.context.dataRef,{listRef:l,activeIndex:u,onNavigate:c=()=>{},enabled:h=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:g=!1,rtl:m=!1,virtual:y=!1,focusItemOnOpen:b="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:w=!0,disabledIndices:x,orientation:E="vertical",parentOrientation:k,cols:S=1,id:R,resetOnPointerLeave:_=!0,externalTree:T}=t,C=(0,eT.getFloatingFocusElement)(s),O=(0,e0.useValueAsRef)(C),A=(0,eO.useFloatingParentNodeId)(),P=(0,eO.useFloatingTree)(T);(0,en.useIsoLayoutEffect)(()=>{o.current.orientation=E},[o,E]);let I=(0,eT.isTypeableCombobox)(a),j=i.useRef(b),N=i.useRef(d??-1),L=i.useRef(null),M=i.useRef(!0),D=(0,K.useStableCallback)(e=>{c(-1===N.current?null:N.current,e)}),$=i.useRef(D),U=i.useRef(!!s),B=i.useRef(n),F=i.useRef(!1),H=i.useRef(!1),W=i.useRef(null),z=(0,e0.useValueAsRef)(x),V=(0,e0.useValueAsRef)(n),G=(0,e0.useValueAsRef)(d),J=(0,e0.useValueAsRef)(_),Y=(0,K.useStableCallback)(()=>{function e(e){y?P?.events.emit("virtualfocus",e):W.current=(0,tJ.enqueueFocus)(e,{sync:F.current,preventScroll:!0})}let t=l.current[N.current],r=H.current;t&&e(t),(F.current?e=>e():requestAnimationFrame)(()=>{let n=l.current[N.current]||t;!n||(t||e(n),Z&&(r||!M.current)&&n.scrollIntoView?.({block:"nearest",inline:"nearest"}))})});(0,en.useIsoLayoutEffect)(()=>{h&&(n&&s?(N.current=d??-1,j.current&&null!=d&&(H.current=!0,D())):U.current&&(N.current=-1,$.current()))},[h,n,s,d,D]),(0,en.useIsoLayoutEffect)(()=>
37{if(h){if(!n){F.current=!1;return}if(s)if(null==u){if(F.current=!1,null!=G.current)return;if(U.current&&(N.current=-1,Y()),(!B.current||!U.current)&&j.current&&(null!=L.current||!0===j.current&&null==L.current)){let e=0,t=()=>{null==l.current[0]?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=null==L.current||tZ(L.current,E,m)||g?(0,tG.getMinListIndex)(l):(0,tG.getMaxListIndex)(l),L.current=null,D())};t()}}else(0,tG.isIndexOutOfListBounds)(l.current,u)||(N.current=u,Y(),H.current=!1)}},[h,n,s,u,G,g,l,E,m,D,Y,z]),(0,en.useIsoLayoutEffect)(()=>{if(!h||s||!P||y||!U.current)return;let e=P.nodesRef.current,t=e.find(e=>e.id===A)?.context?.elements.floating,r=(0,e_.activeElement)((0,eR.ownerDocument)(s)),n=e.some(e=>e.context&&(0,e_.contains)(e.context.elements.floating,r));t&&!n&&M.current&&t.focus({preventScroll:!0})},[h,s,P,A,y]),(0,en.useIsoLayoutEffect)(()=>{$.current=D,B.current=n,U.current=!!s}),(0,en.useIsoLayoutEffect)(()=>{n||(L.current=null,j.current=b)},[n,b]);let X=null!=u,Q=(0,K.useStableCallback)(e=>{if(!V.current)return;let t=l.current.indexOf(e.currentTarget);-1!==t&&(N.current!==t||u!==t)&&(N.current=t,D(e))}),Z=i.useMemo(()=>({onFocus(e){F.current=!0,Q(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){F.current=!0,H.current=!1,v&&Q(e)},onPointerLeave(e){if(!V.current||!M.current||"touch"===e.pointerType)return;F.current=!0;let t=e.relatedTarget;if(!(!v||l.current.includes(t))&&J.current&&(W.current?.(),W.current=null,N.current=-1,D(e),!y)){let e=O.current,t=(0,e_.activeElement)((0,eR.ownerDocument)(e));e&&(0,e_.contains)(e,t)&&e.focus({preventScroll:!0})}}}),[Q,V,O,v,l,D,J,y]),ee=i.useCallback(()=>k??P?.nodesRef.current.find(e=>e.id===A)?.context?.dataRef?.current.orientation,[A,P,k]),et=(0,K.useStableCallback)(e=>{var t;let s,i;if(M.current=!1,F.current=!0,229===e.which||!V.current&&e.currentTarget===O.current)return;if(g&&(t=e.key,s=m?t===tY.ARROW_RIGHT:t===tY.ARROW_LEFT,i=t===tY.ARROW_UP,"both"===E||"horizontal"===E&&S&&S>1?"Escape"===t:tX(E,s,i))){tQ(e.key,ee())||(0,eD.stopEvent)(e),r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.listNavigation,e.nativeEvent)),(0,ex.isHTMLElement)(a)&&(y?P?.events.emit("virtualfocus",a):a.focus());return}let o=N.current,u=(0,tG.getMinListIndex)(l,x),c=(0,tG.getMaxListIndex)(l,x);if(I||("Home"===e.key&&((0,eD.stopEvent)(e),N.current=u,D(e)),"End"===e.key&&((0,eD.stopEvent)(e),N.current=c,D(e))),S>1){let t=Array.from({length:l.current.length},()=>({width:1,height:1})),r=(0,tG.createGridCellMap)(t,S,!1),n=r.findIndex(e=>null!=e&&!(0,tG.isListIndexDisabled)(l.current,e,x)),s=r.reduce((e,t,r)=>null==t||(0,tG.isListIndexDisabled)(l.current,t,x)?e:r,-1),i=r[(0,tG.getGridNavigatedIndex)(r.map(e=>null!=e?l.current[e]:null),{event:e,orientation:E,loopFocus:p,rtl:m,cols:S,disabledIndices:(0,tG.getGridCellIndices)([...("function"!=typeof x?x:null)||l.current.map((e,t)=>(0,tG.isListIndexDisabled)(l.current,t,x)?t:void 0),void 0],r),minIndex:n,maxIndex:s,prevIndex:(0,tG.getGridCellIndexOfCorner)(N.current>c?u:N.current,t,r,S,e.key===tY.ARROW_DOWN?"bl":e.key===(m?tY.ARROW_LEFT:tY.ARROW_RIGHT)?"tr":"tl"),stopEvent:!0})];if(null!=i&&(N.current=i,D(e)),"both"===E)return}if(tQ(e.key,E)){if((0,eD.stopEvent)(e),n&&!y&&(0,e_.activeElement)(e.currentTarget.ownerDocument)===e.currentTarget){N.current=tZ(e.key,E,m)?u:c,D(e);return}tZ(e.key,E,m)?p?o>=c?f&&o!==l.current.length?N.current=-1:(F.current=!1,N.current=u):N.current=(0,tG.findNonDisabledListIndex)(l.current,{startingIndex:o,disabledIndices:x}):N.current=Math.min(c,(0,tG.findNonDisabledListIndex)(l.current,{startingIndex:o,disabledIndices:x})):p?o<=u?f&&-1!==o?N.current=l.current.length:(F.current=!1,N.current=c):N.current=(0,tG.findNonDisabledListIndex)(l.current,{startingIndex:o,decrement:!0,disabledIndices:x}):N.current=Math.max(u,(0,tG.findNonDisabledListIndex)(l.current,{startingIndex:o,decrement:!0,disabledIndices:x})),(0,tG.isIndexOutOfListBounds)(l.current,N.current)&&(N.current=-1),D(e)}}),er=i.useMemo(()=>y&&n&&X&&{"aria-activedescendant":`${R}-${u}`},[y,n,X,R,u]),es=i.useMemo(()=>({"aria-orientation":"both"===E?void 0:E,...!I?er:{},onKeyDown(e){if("Tab"===e.key&&e.shiftKey&&n&&!y){let t=(0,e_.getTarget)(e.nativeEvent);if(t&&!(0,e_.contains)(O.current,t))return;(0,eD.stopEvent)(e),r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.focusOut,e.nativeEvent)),(0,ex.isHTMLElement)(a)&&a.focus();return}et(e)},onPointerMove(){M.current=!0}}),[er,et,O,E,I,r,n,y,a]),ei=i.useMemo(()=>{function e(e){"auto"===b&&(0,eD.isVirtualClick)(e.nativeEvent)&&(j.current=!y)}function t(e){j.current=b,"auto"===b&&(0,eD.isVirtualPointerEvent)(e.nativeEvent)&&(j.current=!0)}return{onKeyDown(e){var t,n;let s=r.select("open");M.current=!1;let i=e.key.startsWith("Arrow"),a=(t=e.key,n=ee(),tX(n,m?t===tY.ARROW_LEFT:t===tY.ARROW_RIGHT,t===tY.ARROW_DOWN)),o=tQ(e.key,E),u=(g?a:o)||"Enter"===e.key||""===e.key.trim();if(y&&s)return et(e);if(s||w||!i){if(u){let t=tQ(e.key,ee());L.current=g&&t?null:e.key}if(g){a&&((0,eD.stopEvent)(e),s?(N.current=(0,tG.getMinListIndex)(l,z.current),D(e)):r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.listNavigation,e.nativeEvent,e.currentTarget)));return}o&&(null!=G.current&&(N.current=G.current),(0,eD.stopEvent)(e),!s&&w?r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.listNavigation,e.nativeEvent,e.currentTarget)):et(e),s&&D(e))}},onFocus(e){r.select("open")&&!y&&(N.current=-1,D(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[et,z,b,l,g,D,r,w,E,ee,m,G,y]),ea=i.useMemo(()=>({...er,...ei}),[er,ei]);return i.useMemo(()=>h?{reference:ea,floating:es,item:Z,trigger:ei}:{},[h,ea,es,ei,Z])}
37(et,{enabled:!I,listRef:S.context.itemDomElements,activeIndex:L,nested:void 0!==N.type,loopFocus:h,orientation:d,parentOrientation:"menubar"===N.type?N.context.orientation:void 0,rtl:"rtl"===ea,disabledIndices:eW.EMPTY_ARRAY,onNavigate:eo,openOnArrowKeyDown:"context-menu"!==N.type,externalTree:F?R:void 0,focusItemOnHover:b}),eu=i.useCallback(e=>{S.context.typingRef.current=e},[S]),eh=function(e,t){let r="rootStore"in e?e.rootStore:e,n=r.context.dataRef,s=r.useState("open"),{listRef:a,elementsRef:o,activeIndex:l,onMatch:u,onTypingChange:c,enabled:h=!0,resetMs:d=750,selectedIndex:f=null}=t,p=(0,eS.useTimeout)(),g=i.useRef(""),m=i.useRef(f??l??-1),y=i.useRef(null);(0,en.useIsoLayoutEffect)(()=>{(s||null===f)&&(p.clear(),y.current=null,""!==g.current&&(g.current=""))},[s,f,p]),(0,en.useIsoLayoutEffect)(()=>{s&&""===g.current&&(m.current=f??l??-1)},[s,f,l]);let b=(0,K.useStableCallback)(e=>{e?n.current.typing||(n.current.typing=e,c?.(e)):n.current.typing&&(n.current.typing=e,c?.(e))}),v=(0,K.useStableCallback)(e=>{function t(e,r,n=0){if(0===e.length)return -1;let s=(n%e.length+e.length)%e.length,i=r.toLocaleLowerCase();for(let t=0;t<e.length;t+=1){let r=(s+t)%e.length,n=e[r];if(n?.toLocaleLowerCase().startsWith(i)&&function(e){let t=o?.current[e];return!t||(0,tG.isElementVisible)(t)}(r))return r}return -1}let r=a.current;if(g.current.length>0&&" "===e.key&&((0,eD.stopEvent)(e),b(!0)),g.current.length>0&&" "!==g.current[0]&&-1===t(r,g.current)&&" "!==e.key&&b(!1),null==r||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;s&&" "!==e.key&&((0,eD.stopEvent)(e),b(!0));let n=""===g.current;n&&(m.current=f??l??-1),r.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&g.current===e.key&&(g.current="",m.current=y.current),g.current+=e.key,p.start(d,()=>{g.current="",m.current=y.current,b(!1)});let i=n?f??l??-1:m.current,c=t(r,g.current,(i??0)+1);-1!==c?(u?.(c),y.current=c):" "!==e.key&&(g.current="",b(!1))}),w=(0,K.useStableCallback)(e=>{let t=e.relatedTarget,n=r.select("domReferenceElement"),s=r.select("floatingElement"),i=(0,e_.contains)(n,t),a=(0,e_.contains)(s,t);i||a||(p.clear(),g.current="",m.current=y.current,b(!1))}),x=i.useMemo(()=>({onKeyDown:v,onBlur:w}),[v,w]),E=i.useMemo(()=>({onKeyDown:v,onBlur:w}),[v,w]);return i.useMemo(()=>h?{reference:x,floating:E}:{},[h,x,E])}(et,{listRef:S.context.itemLabels,elementsRef:S.context.itemDomElements,activeIndex:L,resetMs:eq.TYPEAHEAD_RESET_MS,onMatch:e=>{C&&e!==L&&S.set("activeIndex",e)},onTypingChange:eu}),{getReferenceProps:ed,getFloatingProps:ef,getItemProps:ep,getTriggerProps:eg}=(0,tK.useInteractions)([es,ei,el,eh]),em=i.useMemo(()=>{let e=(0,Q.mergeProps)(ed(),{onMouseMove(){S.set("allowMouseEnter",!0)}},z);return delete e.role,e},[ed,S,z]),ey=i.useMemo(()=>{let e=eg();if(!e)return e;let t=(0,Q.mergeProps)(e,z);return delete t.role,delete t["aria-controls"],t},[eg,z]),eb=i.useMemo(()=>ef({onMouseMove(){S.set("allowMouseEnter",!0),"menu"===N.type&&S.set("hoverEnabled",!1)},onClick(){S.select("hoverEnabled")&&S.set("hoverEnabled",!1)},onKeyDown(e){let t=S.select("keyboardEventRelay");t&&!e.isPropagationStopped()&&t(e)}}),[ef,N.type,S]),ev=i.useMemo(()=>ep(),[ep]);S.useSyncedValues({floatingRootContext:et,activeTriggerProps:em,inactiveTriggerProps:ey,popupProps:eb,itemProps:ev});let ew=i.useMemo(()=>({store:S,parent:k}),[S,k]),eE=(0,s.jsx)(M.Provider,{value:ew,children:"function"==typeof r?r({payload:$}):r});return void 0===N.type||"context-menu"===N.type?(0,s.jsx)(eO.FloatingTree,{externalTree:R,children:eE}):eE}),ri=.1*.1;function ra(e,t,r,n,s,i){return n>=t!=i>=t&&e<=(s-r)*(t-n)/(i-n)+r}function ro(e,t,r,n,s,i,a,o,l,u){let c=!1;return ra(e,t,r,n,s,i)&&(c=!c),ra(e,t,s,i,a,o)&&(c=!c),ra(e,t,a,o,l,u)&&(c=!c),ra(e,t,l,u,r,n)&&(c=!c),c}function rl(e,t,r,n,s,i){let a=Math.min(r,s),o=Math.max(r,s),l=Math.min(n,i),u=Math.max(n,i);return e>=a&&e<=o&&t>=l&&t<=u}function ru(e={}){let{blockPointerEvents:t=!1}=e,r=new eS.Timeout,n=({x:e,y:t,placement:n,elements:s,onClose:i,nodeId:a,tree:o})=>{let l=n?.split("-")[0],u=!1,c=null,h=null,d="u">typeof performance?performance.now():0;return function(n){r.clear();let f=s.domReference,p=s.floating;if(!f||!p||null==l||null==e||null==t)return;let{clientX:g,clientY:m}=n,y=(0,e_.getTarget)(n),b="mouseleave"===n.type,v=(0,e_.contains)(p,y),w=(0,e_.contains)(f,y);if(v&&(u=!0,!b))return;if(w&&(u=!1,!b)){u=!0;return}if(b&&(0,ex.isElement)(n.relatedTarget)&&(0,e_.contains)(p,n.relatedTarget))return;function x(){return!!(o&&(0,eC.getNodeChildren)(o.nodesRef.current,a).length>0)}function E(){x()||(r.clear(),i())}if(x())return;let k=f.getBoundingClientRect(),S=p.getBoundingClientRect(),R=e>S.right-S.width/2,_=t>S.bottom-S.height/2,T=S.width>k.width,C=S.height>k.height,O=(T?k:S).left,A=(T?k:S).right,P=(C?k:S).top,I=(C?k:S).bottom;if("top"===l&&t>=k.bottom-1||"bottom"===l&&t<=k.top+1||"left"===l&&e>=k.right-1||"right"===l&&e<=k.left+1)return void E();let j=!1;switch(l){case"top":j=rl(g,m,O,k.top+1,A,S.bottom-1);break;case"bottom":j=rl(g,m,O,S.top+1,A,k.bottom-1);break;case"left":j=rl(g,m,S.right-1,I,k.left+1,P);break;case"right":j=rl(g,m,k.right-1,I,S.left+1,P)}if(j)return;if(u&&(!(g>=k.x)||!(g<=k.x+k.width)||!(m>=k.y)||!(m<=k.y+k.height))||!b&&function(e,t){let r=performance.now(),n=r-d;if(null===c||null===h||0===n)return c=e,h=t,d=r,!1;let s=e-c,i=t-h;return c=e,h=t,d=r,s*s+i*i<n*n*ri}(g,m))return void E();let N=!1;switch(l){case"top":{let r=T?.25:2,n=t+.5+1,s=R||T?S.bottom-.5:S.top,i=R?T?S.bottom-.5:S.top:S.bottom-.5;N=ro(g,m,T||R?e+r:e-r,n,T?e-r:R?e+r:e-r,n,S.left,s,S.right,i);break}case"bottom":{let r=T?.25:2,n=t-.5,s=R||T?S.top+.5:S.bottom,i=R?T?S.top+.5:S.bottom:S.top+.5;N=ro(g,m,T||R?e+r:e-r,n,T?e-r:R?e+r:e-r,n,S.left,s,S.right,i);break}case"left":{let r=C?.25:2,n=e+.5+1,s=_||C?S.right-.5:S.left,i=_?C?S.right-.5:S.left:S.right-.5;N=ro(g,m,s,S.top,i,S.bottom,n,C||_?t+r:t-r,n,C?t-r:_?t+r:t-r);break}case"right":{let r=C?.25:2,n=e-.5,s=_||C?S.left+.5:S.right,i=_?C?S.left+.5:S.right:S.left+.5;N=ro(g,m,n,C||_?t+r:t-r,n,C?t-r:_?t+r:t-r,s,S.top,i,S.bottom)}}N?u||r.start(40,E):E()}};return n.__options={...e,blockPointerEvents:t},n}var rc=e.i(72444),rh=e.i(15926);let rd=Z.isMac&&Z.isSafari,rf={current:null};function rp(e,t={}){let r="rootStore"in e?e.rootStore:e,{dataRef:n,events:s}=r.context,{enabled:a=!0,delay:o=0,handleClose:l=null,mouseOnly:u=!1,restMs:c=0,move:h=!0,triggerElementRef:d=rf,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:g,isClosing:m}=t,y=(0,eO.useFloatingTree)(f),b=eM(r),v=i.useRef(!1),w=(0,e0.useValueAsRef)(l),x=(0,e0.useValueAsRef)(o),E=(0,e0.useValueAsRef)(c),k=(0,e0.useValueAsRef)(a),S=(0,e0.useValueAsRef)(m);p&&(b.handleCloseOptions=w.current?.__options);let R=(0,K.useStableCallback)(()=>eB(n.current.openEvent?.type,b.interactedInside)),_=(0,K.useStableCallback)(e=>(0,eT.isTargetInsideEnabledTrigger)(e,r.context.triggerElements)),T=(0,K.useStableCallback)((e,t,n)=>{let s=r.context.triggerElements;return s.hasElement(t)?!e||!(0,e_.contains)(e,t):!!(0,ex.isElement)(n)&&s.hasMatchingElement(e=>
37(0,e_.contains)(e,n))&&(!e||!(0,e_.contains)(e,n))}),C=(0,K.useStableCallback)((e,t=!0)=>{let n=e$(x.current,"close",b.pointerType);n?b.openChangeTimeout.start(n,()=>{r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,e)),y?.events.emit("floating.closed",e)}):t&&(b.openChangeTimeout.clear(),r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,e)),y?.events.emit("floating.closed",e))}),O=(0,K.useStableCallback)(()=>{b.handler&&((0,eR.ownerDocument)(r.select("domReferenceElement")).removeEventListener("mousemove",b.handler),b.handler=void 0)}),A=(0,K.useStableCallback)(()=>{eN(b)});return i.useEffect(()=>O,[O]),i.useEffect(()=>{if(a)return s.on("openchange",e),()=>{s.off("openchange",e)};function e(e){e.open?v.current=!1:(v.current=e.reason===q.REASONS.triggerHover,O(),b.openChangeTimeout.clear(),b.restTimeout.clear(),b.blockMouseMove=!0,b.restTimeoutPending=!1)}},[a,s,b,O]),i.useEffect(()=>{if(!a)return;let e=d.current??(p?r.select("domReferenceElement"):null);if((0,ex.isElement)(e))return h?(0,ek.mergeCleanups)((0,eE.addEventListener)(e,"mousemove",t,{once:!0}),(0,eE.addEventListener)(e,"mouseenter",t),(0,eE.addEventListener)(e,"mouseleave",s)):(0,ek.mergeCleanups)((0,eE.addEventListener)(e,"mouseenter",t),(0,eE.addEventListener)(e,"mouseleave",s));function t(e){if(b.openChangeTimeout.clear(),b.blockMouseMove=!1,u&&!(0,eD.isMouseLikePointerType)(b.pointerType))return;let t=eU(E.current),n=e$(x.current,"open",b.pointerType),s=(0,e_.getTarget)(e),i=e.currentTarget??null,a=r.select("domReferenceElement"),o=i;if((0,ex.isElement)(s)&&!r.context.triggerElements.hasElement(s)){for(let e of r.context.triggerElements.elements())if((0,e_.contains)(e,s)){o=e;break}}(0,ex.isElement)(i)&&(0,ex.isElement)(a)&&!r.context.triggerElements.hasElement(i)&&(0,e_.contains)(i,a)&&(o=a);let l=null!=o&&T(a,o,s),c=r.select("open"),h=S.current?.()??"ending"===r.select("transitionStatus"),d=!c&&h&&v.current,f=!l&&(0,ex.isElement)(o)&&(0,ex.isElement)(a)&&(0,e_.contains)(a,o)&&d,p=t>0&&!n,g=!c||l;l&&(c||d)||f?r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,e,o)):!p&&(n?b.openChangeTimeout.start(n,()=>{g&&r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,e,o))}):g&&r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,e,o)))}function s(e){if(R())return void A();O();let t=r.select("domReferenceElement"),s=(0,eR.ownerDocument)(t);b.restTimeout.clear(),b.restTimeoutPending=!1;let i=n.current.floatingContext??g?.();if(!_(e.relatedTarget)){if(w.current&&i){r.select("open")||b.openChangeTimeout.clear();let t=d.current;b.handler=w.current({...i,tree:y,x:e.clientX,y:e.clientY,onClose(){A(),O(),k.current&&!R()&&t===r.select("domReferenceElement")&&C(e,!0)}}),s.addEventListener("mousemove",b.handler),b.handler(e);return}"touch"===b.pointerType&&(0,e_.contains)(r.select("floatingElement"),e.relatedTarget)||C(e)}}},[O,A,n,x,C,r,a,w,b,p,T,R,_,u,h,E,d,y,k,g,S]),i.useMemo(()=>{if(a)return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,s=r.select("domReferenceElement"),i=r.select("open"),a=T(s,n,e.target);if(u&&!(0,eD.isMouseLikePointerType)(b.pointerType))return;if(i&&a&&b.handleCloseOptions?.blockPointerEvents){let e=r.select("floatingElement");if(e){let t=b.handleCloseOptions?.getScope?.()??n.ownerDocument.body;eL(b,{scopeElement:t,referenceElement:n,floatingElement:e})}}let o=eU(E.current);function l(){if(b.restTimeoutPending=!1,R())return;let e=r.select("open");b.blockMouseMove||e&&!a||r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.triggerHover,t,n))}(!i||a)&&0!==o&&(!a&&b.restTimeoutPending&&e.movementX**2+e.movementY**2<2||(b.restTimeout.clear(),"touch"===b.pointerType?tp.flushSync(()=>{l()}):a&&i?l():(b.restTimeoutPending=!0,b.restTimeout.start(o,l))))}};function e(e){b.pointerType=e.pointerType}},[a,b,R,T,u,r,E])}var rg=e.i(80936);function rm(e){let{render:t,className:r,style:n,state:s=eW.EMPTY_OBJECT,props:a=eW.EMPTY_ARRAY,refs:o=eW.EMPTY_ARRAY,metadata:l,stateAttributesMapping:u,tag:c="div",...h}=e,{compositeProps:d,compositeRef:f}=function(e={}){let{highlightItemOnHover:t,highlightedIndex:r,onHighlightedIndexChange:n}=(0,rg.useCompositeRootContext)(),{ref:s,index:a}=ea(e),o=r===a,l=i.useRef(null),u=(0,Y.useMergedRefs)(s,l);return{compositeProps:i.useMemo(()=>({tabIndex:o?0:-1,onFocus(){n(a)},onMouseMove(){let e=l.current;if(!t||!e)return;let r=e.hasAttribute("disabled")||"true"===e.ariaDisabled;o||r||e.focus()}}),[o,n,a,t]),compositeRef:u,index:a}}({metadata:l});return(0,$.useRenderElement)(c,e,{state:s,ref:[...o,f],props:[d,...a,h],stateAttributesMapping:u})}
37var ry=e.i(82697),rb=e.i(22156);let rv=(0,tz.fastComponentRef)(function(e,t){let r,n,a,o,l,{render:u,className:c,disabled:h=!1,nativeButton:d=!0,id:f,openOnHover:p,delay:g=100,closeDelay:m=0,handle:y,payload:b,style:v,...w}=e,x=D(!0),E=y?.store??x?.store;if(!E)throw Error((0,j.default)(85));let k=(0,eo.useBaseUiId)(f),S=E.useState("isTriggerActive",k),R=E.useState("floatingRootContext"),_=E.useState("isOpenedByTrigger",k),T=i.useRef(null),C=(r=W(!0),n=D(!0),a=t5(!0),i.useMemo(()=>a?{type:"menubar",context:a}:r&&!n?{type:"context-menu",context:r}:{type:void 0},[r,n,a])),O=(0,rg.useCompositeRootContext)(!0),A=(0,eO.useFloatingTree)(),P=i.useMemo(()=>A??new t6.FloatingTreeStore,[A]),I=(0,eO.useFloatingNodeId)(P),N=(0,eO.useFloatingParentNodeId)(),{registerTrigger:L,isMountedByThisTrigger:M}=(0,rt.useTriggerDataForwarding)(k,T,E,{payload:b,closeDelay:m,parent:C,floatingTreeRoot:P,floatingNodeId:I,floatingParentNodeId:N,keyboardEventRelay:O?.relayKeyboardEvent}),B="menubar"===C.type,F=E.useState("disabled"),H=h||F||B&&C.context.disabled,{getButtonProps:z,buttonRef:V}=(0,X.useButton)({disabled:H,native:d});i.useEffect(()=>{_||void 0!==C.type||(E.context.allowMouseUpTriggerRef.current=!1)},[E,_,C.type]);let G=i.useRef(null),J=(0,eS.useTimeout)(),Y=(0,K.useStableCallback)(e=>{if(!G.current)return;J.clear(),E.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if((0,e_.contains)(G.current,t)||(0,e_.contains)(E.select("positionerElement"),t)||t===G.current||null!=t&&function e(t){return(0,ex.isHTMLElement)(t)&&t.hasAttribute("data-rootownerid")?t.getAttribute("data-rootownerid")??void 0:(0,ex.isLastTraversableNode)(t)?void 0:e((0,ex.getParentNode)(t))}(t)===E.select("rootId"))return;let r=function(e){let t=e.getBoundingClientRect(),r=(0,eZ.ownerWindow)(e),n=r.getComputedStyle(e,"::before"),s=r.getComputedStyle(e,"::after");if("none"===n.content&&"none"===s.content)return t;let i=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(s.width)||0,l=parseFloat(s.height)||0,u=Math.max(t.width,i,o),c=Math.max(t.height,a,l),h=u-t.width,d=c-t.height;return{left:t.left-h/2,right:t.right+h/2,top:t.top-d/2,bottom:t.bottom+d/2}}(G.current);e.clientX>=r.left-2&&e.clientX<=r.right+2&&e.clientY>=r.top-2&&e.clientY<=r.bottom+2||P.events.emit("close",{domEvent:e,reason:q.REASONS.cancelOpen})});i.useEffect(()=>{_&&E.select("lastOpenChangeReason")===q.REASONS.triggerHover&&(0,eR.ownerDocument)(G.current).addEventListener("mouseup",Y,{once:!0})},[_,Y,E]);let Q=B&&C.context.hasSubmenuOpen,Z=rp(R,{enabled:(p??Q)&&!H&&"context-menu"!==C.type&&(!B||Q&&!M),handleClose:ru({blockPointerEvents:!B}),mouseOnly:!0,move:!1,restMs:void 0===C.type?g:void 0,delay:{close:m},triggerElementRef:T,externalTree:P,isActiveTrigger:S,isClosing:()=>"ending"===E.select("transitionStatus")}),ee=function(e,t){let r=(0,eS.useTimeout)(),[n,s]=i.useState(!1);return(0,en.useIsoLayoutEffect)(()=>{e&&"trigger-hover"===t?(s(!0),r.start(eq.PATIENT_CLICK_THRESHOLD,()=>{s(!1)})):e||(r.clear(),s(!1))},[e,t,r]),n}(_,E.select("lastOpenChangeReason")),et=(0,rc.useClick)(R,{enabled:!H&&"context-menu"!==C.type,event:_&&B?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:void 0===C.type&&ee}),er=function(e,t={}){let r="rootStore"in e?e.rootStore:e,{events:n,dataRef:s}=r.context,{enabled:a=!0,delay:o}=t,l=i.useRef(!1),u=i.useRef(null),c=(0,eS.useTimeout)(),h=i.useRef(!0);i.useEffect(()=>{let e=r.select("domReferenceElement");if(!a)return;let t=(0,ex.getWindow)(e);return(0,ek.mergeCleanups)((0,eE.addEventListener)(t,"blur",function(){let e=r.select("domReferenceElement");!r.select("open")&&(0,ex.isHTMLElement)(e)&&e===(0,e_.activeElement)((0,eR.ownerDocument)(e))&&(l.current=!0)}),rd&&(0,eE.addEventListener)(t,"keydown",function(){h.current=!0},!0),rd&&(0,eE.addEventListener)(t,"pointerdown",function(){h.current=!1},!0))},[r,a]),i.useEffect(()=>{if(a)return n.on("openchange",e),()=>{n.off("openchange",e)};function e(e){if(e.reason===q.REASONS.triggerPress||e.reason===q.REASONS.escapeKey){let e=r.select("domReferenceElement");(0,ex.isElement)(e)&&(u.current=e,l.current=!0)}}},[n,a,r]);let d=i.useMemo(()=>({onMouseLeave(){l.current=!1,u.current=null},onFocus(e){let t=e.currentTarget;if(l.current){if(u.current===t)return;l.current=!1,u.current=null}let n=(0,e_.getTarget)(e.nativeEvent);if((0,ex.isElement)(n)){if(rd&&!e.relatedTarget){if(!h.current&&!(0,eT.isTypeableElement)(n))return}else if(!(0,eT.matchesFocusVisible)(n))return}let s=(0,eT.isTargetInsideEnabledTrigger)(e.relatedTarget,r.context.triggerElements),{nativeEvent:i,currentTarget:a}=e,d="function"==typeof o?o():o;r.select("open")&&s||0===d||void 0===d?r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.triggerFocus,i,a)):c.start(d,()=>{l.current||r.setOpen(!0,(0,ec.createChangeEventDetails)(q.REASONS.triggerFocus,i,a))})},onBlur(e){l.current=!1,u.current=null;let t=e.relatedTarget,n=e.nativeEvent,i=(0,ex.isElement)(t)&&t.hasAttribute((0,rh.createAttribute)("focus-guard"))&&"outside"===t.getAttribute("data-type");c.start(0,()=>{let e=r.select("domReferenceElement"),a=(0,e_.activeElement)((0,eR.ownerDocument)(e));if(!t&&a===e||(0,e_.contains)(s.current.floatingContext?.refs.floating.current,a)||(0,e_.contains)(e,a)||i)return;let o=t??a;(0,eT.isTargetInsideEnabledTrigger)(o,r.context.triggerElements)||r.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.triggerFocus,n))})}}),[s,r,c,o]);return i.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}(R,{enabled:!H&&Q}),es=function(e){let{enabled:t=!0,mouseDownAction:r,open:n}=e,s=i.useRef(!1);return i.useMemo(()=>t?{onMouseDown:e=>{("open"===r&&!n||"close"===r&&n)&&(s.current=!0,(0,eR.ownerDocument)(e.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:e=>{s.current&&(s.current=!1,e.preventBaseUIHandler())}}:eW.EMPTY_OBJECT,[t,r,n])}({open:_,enabled:B,mouseDownAction:"open"}),ei=(0,tK.useInteractions)([et,er]),ea={disabled:H,open:_},el=E.useState("triggerProps",M),eu=[G,t,V,L,T],eh=[ei.getReferenceProps(),Z??eW.EMPTY_OBJECT,el,{"aria-haspopup":"menu",id:k,onMouseDown:e=>{E.select("open")||(J.start(200,()=>{E.context.allowMouseUpTriggerRef.current=!0}),(0,eR.ownerDocument)(e.currentTarget).addEventListener("mouseup",Y,{once:!0}))}},B?{role:"menuitem"}:{},es,w,z],{preFocusGuardRef:ed,handlePreFocusGuardFocus:ef,handleFocusTargetFocus:ep}=(o=i.useRef(null),l=(0,K.useStableCallback)(e=>{tp.flushSync(()=>{E.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.focusOut,e.nativeEvent,e.currentTarget))});let t=(0,ry.getTabbableBeforeElement)(o.current);t?.focus()}),{preFocusGuardRef:o,handlePreFocusGuardFocus:l,handleFocusTargetFocus:(0,K.useStableCallback)(e=>{let t=E.select("positionerElement");
37if(t&&(0,ry.isOutsideEvent)(e,t))E.context.beforeContentFocusGuardRef.current?.focus();else{tp.flushSync(()=>{E.setOpen(!1,(0,ec.createChangeEventDetails)(q.REASONS.focusOut,e.nativeEvent,e.currentTarget))});let r=(0,ry.getTabbableAfterElement)(E.context.triggerFocusTargetRef.current||T.current);for(;null!==r&&(0,e_.contains)(t,r);){let e=r;if((r=(0,ry.getNextTabbable)(r))===e)break}r?.focus()}})}),eg=(0,$.useRenderElement)("button",e,{enabled:!B,stateAttributesMapping:U.pressableTriggerOpenStateMapping,state:ea,ref:eu,props:eh});return B?(0,s.jsx)(rm,{tag:"button",render:u,className:c,style:v,state:ea,refs:eu,props:eh,stateAttributesMapping:U.pressableTriggerOpenStateMapping}):_?(0,s.jsxs)(i.Fragment,{children:[(0,s.jsx)(rb.FocusGuard,{ref:ed,onFocus:ef},`${k}-pre-focus-guard`),(0,s.jsx)(i.Fragment,{children:eg},k),(0,s.jsx)(rb.FocusGuard,{ref:E.context.triggerFocusTargetRef,onFocus:ep},`${k}-post-focus-guard`)]}):(0,s.jsx)(i.Fragment,{children:eg},k)});var rw=e.i(31164);function rx(e){let t=(0,ex.getComputedStyle)(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,s=(0,ex.isHTMLElement)(e),i=s?e.offsetWidth:r,a=s?e.offsetHeight:n;return((0,eQ.round)(r)!==i||(0,eQ.round)(n)!==a)&&(r=i,n=a),{width:r,height:n}}let rE=()=>!0;function rk(e,t,r){let n=e.style.getPropertyValue(t);return e.style.setProperty(t,r),()=>{e.style.setProperty(t,n)}}function rS(e,t){let r=[];for(let[n,s]of Object.entries(t))r.push(rk(e,n,s));return r.length?()=>{r.forEach(e=>e())}:eW.NOOP}function rR(e,t){let r="auto"===t?"auto":`${t.width}px`,n="auto"===t?"auto":`${t.height}px`;e.style.setProperty("--popup-width",r),e.style.setProperty("--popup-height",n)}function r_(e,t){let r="max-content"===t?"max-content":`${t.width}px`,n="max-content"===t?"max-content":`${t.height}px`;e.style.setProperty("--positioner-width",r),e.style.setProperty("--positioner-height",n)}let rT=((n={}).popupWidth="--popup-width",n.popupHeight="--popup-height",n),rC={activationDirection:e=>e?{"data-activation-direction":e}:null},rO=i.forwardRef(function(e,t){let{render:r,className:n,style:a,children:o,...l}=e,{store:u}=D(),{side:c}=L(),h=u.useState("instantType"),{children:d,state:f}=function(e){let t,{store:r,side:n,cssVars:a,children:o}=e,l=tS(),u=r.useState("activeTriggerElement"),c=r.useState("activeTriggerId"),h=r.useState("open"),d=r.useState("payload"),f=r.useState("mounted"),p=r.useState("popupElement"),g=r.useState("positionerElement"),m=function(e){let[t,r]=i.useState({current:e,previous:null});return e!==t.current&&r({current:e,previous:t.current}),t.previous}(h?u:null),y=function(e,t){let[r,n]=i.useState(0),s=i.useRef(e),a=i.useRef(t),o=i.useRef(!1);return(0,en.useIsoLayoutEffect)(()=>{let r=s.current,i=t!==a.current;e!==r?(n(e=>e+1),o.current=!i):o.current&&i&&(n(e=>e+1),o.current=!1),s.current=e,a.current=t},[e,t]),`${e??"current"}-${r}`}(c,d),b=i.useRef(null),[v,w]=i.useState(null),[x,E]=i.useState(null),k=i.useRef(null),S=i.useRef(null),R=(0,tM.useAnimationsFinished)(k,!0,!1),_=(0,rw.useAnimationFrame)(),[T,C]=i.useState(null),[O,A]=i.useState(!1);(0,en.useIsoLayoutEffect)(()=>(r.set("hasViewport",!0),()=>{r.set("hasViewport",!1)}),[r]);let P=(0,K.useStableCallback)(()=>{k.current?.style.setProperty("animation","none"),k.current?.style.setProperty("transition","none"),S.current?.style.setProperty("display","none")}),I=(0,K.useStableCallback)(e=>{k.current?.style.removeProperty("animation"),k.current?.style.removeProperty("transition"),S.current?.style.removeProperty("display"),e&&C(e)}),j=i.useRef(null);(0,en.useIsoLayoutEffect)(()=>{var e,t;let r,n,s,i;u&&m&&u!==m&&j.current!==u&&b.current&&(w(b.current),A(!0),E((e=m,t=u,r=e.getBoundingClientRect(),n=t.getBoundingClientRect(),s={x:r.left+r.width/2,y:r.top+r.height/2},{horizontal:(i={x:n.left+n.width/2,y:n.top+n.height/2}).x-s.x,vertical:i.y-s.y})),_.request(()=>{tp.flushSync(()=>{A(!1)}),R(()=>{w(null),C(null),b.current=null})}),j.current=u)},[u,m,v,R,_]),(0,en.useIsoLayoutEffect)(()=>{let e=k.current;if(!e)return;let t=(0,eR.ownerDocument)(e).createElement("div");for(let r of Array.from(e.childNodes))t.appendChild(r.cloneNode(!0));b.current=t});let N=null!=v;return t=N?(0,s.jsxs)(i.Fragment,{children:[(0,s.jsx)("div",{"data-previous":!0,inert:(0,eX.inertValue)(!0),ref:S,style:{...T?{[a.popupWidth
37]:`${T.width}px`,[a.popupHeight]:`${T.height}px`}:null,position:"absolute"},"data-ending-style":O?void 0:""},"previous"),(0,s.jsx)("div",{"data-current":!0,ref:k,"data-starting-style":O?"":void 0,children:o},y)]}):(0,s.jsx)("div",{"data-current":!0,ref:k,children:o},y),(0,en.useIsoLayoutEffect)(()=>{let e=S.current;e&&v&&e.replaceChildren(...Array.from(v.childNodes))},[v]),!function(e){let{popupElement:t,positionerElement:r,content:n,mounted:s,enabled:a=rE,onMeasureLayout:o,onMeasureLayoutComplete:l,side:u,direction:c}=e,h=(0,tM.useAnimationsFinished)(t,!0,!1),d=(0,rw.useAnimationFrame)(),f=i.useRef(null),p=i.useRef(null),g=i.useRef(!0),m=i.useRef(eW.NOOP),y=(0,K.useStableCallback)(o),b=(0,K.useStableCallback)(l),v=i.useMemo(()=>{let e="top"===u,t="left"===u;return"rtl"===c?(e=e||"inline-end"===u,t=t||"inline-end"===u):(e=e||"inline-start"===u,t=t||"inline-start"===u),e?{position:"absolute",["top"===u?"bottom":"top"]:"0",[t?"right":"left"]:"0"}:eW.EMPTY_OBJECT},[u,c]);(0,en.useIsoLayoutEffect)(()=>{if(!s||!a()||"function"!=typeof ResizeObserver){m.current=eW.NOOP,g.current=!0,f.current=null,p.current=null;return}if(!t||!r)return;m.current=rS(t,v);let e=new ResizeObserver(e=>{let t=e[0];t&&(p.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),rR(t,"auto");let n=rk(t,"position","static"),i=rk(t,"transform","none"),o=rk(t,"scale","1"),l=rS(r,{"--available-width":"max-content","--available-height":"max-content"});function u(){n(),i(),l(),o()}if(y?.(),g.current||null===f.current){r_(r,"max-content");let n=rx(t);return f.current=n,r_(r,n),u(),b?.(null,n),g.current=!1,()=>{e.disconnect(),m.current(),m.current=eW.NOOP}}rR(t,"auto"),r_(r,"max-content");let c=f.current??p.current,w=rx(t);if(f.current=w,!c)return r_(r,w),u(),b?.(null,w),()=>{e.disconnect(),d.cancel(),m.current(),m.current=eW.NOOP};rR(t,c),u(),b?.(c,w),r_(r,w);let x=new AbortController;return d.request(()=>{rR(t,w),h(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},x.signal)}),()=>{e.disconnect(),x.abort(),d.cancel(),m.current(),m.current=eW.NOOP}},[n,t,r,h,d,a,s,y,b,v])}({popupElement:p,positionerElement:g,mounted:f,content:d,onMeasureLayout:P,onMeasureLayoutComplete:I,side:n,direction:l}),{children:t,state:{activationDirection:function(e){if(e){var t,r;return`${(t=e.horizontal)>5?"right":t<-5?"left":""} ${(r=e.vertical)>5?"down":r<-5?"up":""}`}}(x),transitioning:N}}}({store:u,side:c,cssVars:rT,children:o}),p={activationDirection:f.activationDirection,transitioning:f.transitioning,instant:h};return(0,$.useRenderElement)("div",e,{state:p,ref:t,props:[l,{children:d}],stateAttributesMapping:rC})}),rA=i.forwardRef(function(e,t){let{className:r,render:n,orientation:s="horizontal",style:i,...a}=e;return(0,$.useRenderElement)("div",e,{state:{orientation:s},ref:t,props:[{role:"separator","aria-orientation":s},a]})}),rP=i.forwardRef(function(e,t){let{render:r,className:n,label:s,id:a,nativeButton:o=!1,openOnHover:l=!0,delay:u=100,closeDelay:c=0,disabled:h=!1,style:d,...f}=e,p=ea(),g=L(),{store:m}=D(),y=(0,eo.useBaseUiId)(a),b=m.useState("open"),v=m.useState("floatingRootContext"),w=m.useState("floatingTreeRoot"),x=(0,rt.useTriggerRegistration)(y,m),E=i.useCallback(e=>{let t=x(e);return null!==e&&m.select("open")&&null==m.select("activeTriggerId")&&m.update({activeTriggerId:y,activeTriggerElement:e,closeDelay:c}),t},[x,c,m,y]),k=i.useRef(null),S=i.useCallback(e=>{k.current=e,m.set("activeTriggerElement",e)},[m]),R=rn();if(!R?.parentMenu)throw Error((0,j.default)(37));m.useSyncedValue("closeDelay",c);let _=R.parentMenu,T=_.useState("itemProps"),C=_.useState("isActive",p.index),O=i.useMemo(()=>({type:"submenu-trigger",setActive(){_.set("activeIndex",p.index)}}),[_,p.index]),A=m.useState("disabled"),P=h||A,{getItemProps:I,itemRef:N}=er({closeOnClick:!1,disabled:P,highlighted:C,id:y,store:m,typingRef:_.context.typingRef,nativeButton:o,itemMetadata:O,nodeId:g?.context.nodeId}),M=m.useState("hoverEnabled"),B=_.useState("allowMouseEnter"),F=rp(v,{enabled:M&&l&&!P,handleClose:ru({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:u,delay:B?{open:u,close:c}:0,triggerElementRef:k,externalTree:w,isClosing:()=>"ending"===m.select("transitionStatus")}
37),H=(0,rc.useClick)(v,{enabled:!P,event:"mousedown",toggle:!l,ignoreMouse:l,stickIfOpen:!1}),W=(0,tK.useInteractions)([H]),q=m.useState("triggerProps",!0);return delete q.id,(0,$.useRenderElement)("div",e,{state:{disabled:P,highlighted:C,open:b},stateAttributesMapping:U.triggerOpenStateMapping,props:[W.getReferenceProps(),F,q,T,{tabIndex:b||C?0:-1,onBlur(){C&&_.set("activeIndex",null)}},f,I],ref:[t,p.ref,N,E,S]})});class rI{constructor(){this.store=new re}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,j.default)(83,e));this.store.setOpen(!0,(0,ec.createChangeEventDetails)("imperative-action",void 0,t))}close(){this.store.setOpen(!1,(0,ec.createChangeEventDetails)("imperative-action",void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,B,"Backdrop",0,V,"CheckboxItem",0,eh,"CheckboxItemIndicator",0,ep,"Group",0,em,"GroupLabel",0,ey,"Handle",0,rI,"Item",0,eb,"LinkItem",0,ev,"Popup",0,eK,"Portal",0,eY,"Positioner",0,t$,"RadioGroup",0,tB,"RadioItem",0,tH,"RadioItemIndicator",0,tW,"Root",0,rs,"Separator",0,rA,"SubmenuRoot",0,function(e){let t=D().store,r=i.useMemo(()=>({parentMenu:t}),[t]);return(0,s.jsx)(rr.Provider,{value:r,children:(0,s.jsx)(rs,{...e})})},"SubmenuTrigger",0,rP,"Trigger",0,rv,"Viewport",0,rO,"createHandle",0,function(){return new rI}],38362);var rj=e.i(38362),rj=rj,rN=e.i(51112);let rL=(0,rN.createServerReference)("0026c8e79dceb4a3c236999584ff0d95912f5e22f4",rN.callServer,void 0,rN.findSourceMapURL,"signOut");function rM({user:e}){if(!e)return(0,s.jsx)(o.default,{href:"/signin",className:"ml-1 inline-flex items-center rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:"Sign in"});let t=(e.email||"?").charAt(0).toUpperCase(),r=e.email??"";return(0,s.jsxs)(rj.Root,{children:[(0,s.jsx)(rj.Trigger,{"aria-label":"Account menu",className:"inline-flex size-7 items-center justify-center rounded-full bg-card text-xs font-semibold text-muted-foreground outline-none ring-1 ring-border transition-colors hover:text-foreground hover:ring-border2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:t}),(0,s.jsx)(rj.Portal,{children:(0,s.jsx)(rj.Positioner,{sideOffset:8,align:"end",className:"z-50",children:(0,s.jsxs)(rj.Popup,{className:"min-w-56 rounded-lg border border-border/60 bg-card p-1 text-sm shadow-lg ring-1 ring-foreground/5 outline-none",children:[(0,s.jsxs)("div",{className:"border-b border-border/40 px-3 py-2",children:[(0,s.jsx)("p",{className:"text-[11px] font-mono uppercase tracking-wider text-muted-foreground",children:"Signed in as"}),(0,s.jsx)("p",{className:"mt-0.5 truncate text-sm text-foreground",children:r})]}),(0,s.jsx)(rj.Item,{render:(0,s.jsxs)(o.default,{href:"/account",className:"flex items-center gap-2 rounded-md px-3 py-2 outline-none data-[highlighted]:bg-muted",children:[(0,s.jsx)(I,{"aria-hidden":!0,className:"size-4 text-muted-foreground"}),"Account"]})}),(0,s.jsx)(rj.Item,{render:(0,s.jsx)("form",{action:rL,children:(0,s.jsxs)("button",{type:"submit",className:"flex w-full items-center gap-2 rounded-md px-3 py-2 text-left outline-none data-[highlighted]:bg-muted",children:[(0,s.jsx)(P,{"aria-hidden":!0,className:"size-4 text-muted-foreground"}),"Sign out"]})})})]})})})]})}let rD=(0,f.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);var r$=e.i(19583),rj=rj;function rU({current:e}){let t=(0,h.usePathname)()??"/",r=(0,w.stripLocale)(t);return(0,s.jsxs)(rj.Root,{children:[(0,s.jsxs)(rj.Trigger,{"aria-label":"Change language",className:"inline-flex items-center gap-1.5 rounded-[10px] border border-border px-2.5 py-1.5 text-[13px] text-muted-foreground outline-none transition-colors hover:border-border2 hover:bg-card hover:text-foreground focus-visible:ring-2 focus-visible:ring-primary sm:px-3 sm:py-2",children:[(0,s.jsx)(rD,{className:"size-[17px]","aria-hidden":!0}),(0,s.jsx)("span",{className:"uppercase",children:e}),(0,s.jsx)(d.ChevronDown,{className:"hidden size-3 sm:block","aria-hidden":!0})]}),(0,s.jsx)(rj.Portal,{children:(0,s.jsx)(rj.Positioner,{sideOffset:8,align:"end",className:"z-50",children:(0,s.jsxs)(rj.Popup,{className:"min-w-48 rounded-xl border border-border2 bg-card p-1.5 text-sm shadow-[var(--shadow-lg)] outline-none",children:[(0,s.jsx)(rj.Item,{render:(0,s.jsxs)(o.default,{href:r,className:"flex cursor-pointer items-center gap-2.5 rounded-lg px-3 py-2 outline-none data-[highlighted]:bg-foreground
37/5",children:[(0,s.jsx)("span",{className:"flex-1",children:"English"}),"en"===e&&(0,s.jsx)(r$.Check,{className:"size-4 text-primary","aria-hidden":!0})]})}),w.LANGS.map(t=>(0,s.jsx)(rj.Item,{render:(0,s.jsxs)(o.default,{href:(0,w.hasLocaleVersion)(r)?(0,w.localizeHref)(r,t):`/${t}`,className:"flex cursor-pointer items-center gap-2.5 rounded-lg px-3 py-2 outline-none data-[highlighted]:bg-foreground/5",children:[(0,s.jsx)("span",{className:"flex-1",children:w.LOCALE_META[t].nativeName}),e===t&&(0,s.jsx)(r$.Check,{className:"size-4 text-primary","aria-hidden":!0})]})},t))]})})})]})}function rB({user:e,lang:t="en",onOpenDrawer:r,onOpenSearch:n}){let i=(0,l.useNavVariant)(),a=(0,x.getDict)(t);return(0,s.jsxs)("header",{className:"sticky top-0 z-20 flex h-[62px] shrink-0 items-center gap-4 border-b border-border bg-background px-4 lg:px-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 lg:hidden",children:[(0,s.jsx)("button",{type:"button",onClick:r,"aria-label":"Open menu",className:"-ml-1 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-card hover:text-foreground",children:(0,s.jsx)(S,{className:"size-[22px]","aria-hidden":!0})}),(0,s.jsxs)(o.default,{href:(0,w.localizeHref)("/",t),className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"flex size-7 items-center justify-center overflow-hidden rounded-lg",children:(0,s.jsx)(c,{className:"size-full"})}),(0,s.jsxs)("span",{className:"font-heading text-[17px] font-extrabold tracking-tight",children:["brickster",(0,s.jsx)("span",{className:"text-primary",children:".ai"})]})]})]}),(0,s.jsxs)("button",{type:"button",onClick:n,className:"hidden max-w-[540px] flex-1 items-center gap-2.5 rounded-[11px] border border-border bg-card2 px-3.5 py-2.5 text-left text-muted-foreground outline-none transition-colors hover:border-border2 lg:flex focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[(0,s.jsx)(R.Search,{className:"size-[18px] shrink-0","aria-hidden":!0}),(0,s.jsx)("span",{className:"flex-1 truncate text-[13.5px]",children:i?"Search the archive or ask the assistant":a.topbar.searchPlaceholder}),(0,s.jsx)("kbd",{className:"rounded-[5px] border border-border px-1.5 py-0.5 font-mono text-[11px] text-dim",children:"âK"})]}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:n,"aria-label":"Search",className:"flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-card hover:text-foreground lg:hidden",children:(0,s.jsx)(R.Search,{className:"size-[20px]","aria-hidden":!0})}),(0,s.jsx)(rU,{current:t}),(0,s.jsx)(A,{}),(0,s.jsx)("div",{className:"hidden lg:block",children:void 0===e?(0,s.jsx)("span",{"aria-hidden":!0,className:"ml-1 inline-block h-8 w-[72px]"}):(0,s.jsx)(rM,{user:e})})]})]})}var rF=e.i(85877),rH=e.i(8495),rW=e.i(56229);let rq=[{href:"/feed",label:"Feed",icon:rF.Sparkles},{href:"/assistant",label:"Assistant",icon:rW.BotIcon},{href:"/pulse",label:"Pulse",icon:rW.BubblesIcon},{href:"/compare",label:"Compare",icon:rH.Table}];function rz({onMore:e,lang:t="en"}){let r=(0,x.getDict)(t),n=(0,h.usePathname)();return(0,s.jsxs)("nav",{className:"fixed inset-x-0 bottom-0 z-30 flex h-16 border-t border-border bg-sidebar pb-[env(safe-area-inset-bottom)] lg:hidden",children:[rq.map(({href:e,label:i,icon:l})=>{let u,c=n===(u=(0,w.localizeHref)(e,t))||n.startsWith(`${u}/`);return(0,s.jsxs)(o.default,{href:(0,w.localizeHref)(e,t),onClick:()=>(0,y.track)("nav_click",i,e,"tabbar"),"aria-current":c?"page":void 0,className:(0,a.cn)("flex flex-1 flex-col items-center justify-center gap-1 text-[10.5px] font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",c?"text-primary":"text-dim"),children:[(0,s.jsx)(l,{className:"size-[22px]"}),r.nav.items[e]??i]},e)}),(0,s.jsxs)("button",{type:"button",onClick:e,"aria-label":r.shell.more,className:"flex flex-1 flex-col items-center justify-center gap-1 text-[10.5px] font-semibold text-dim transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",children:[(0,s.jsx)(S,{className:"size-[22px]"}),r.shell.more]})]})}var rV=e.i(7387);let rK=(0,f.default)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}
37],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);function rG({open:e,onClose:t,user:r,lang:n="en"}){let l=(0,x.getDict)(n),u=(0,h.usePathname)(),d=(0,i.useRef)(null),f=(0,i.useRef)(null),p=e=>{let t=(0,w.localizeHref)(e,n);return u===t||u.startsWith(`${t}/`)};return(0,i.useEffect)(()=>{if("u"<typeof document)return;let t=document.body.style.overflow;return e&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow=t}},[e]),(0,i.useEffect)(()=>{if(!e)return;f.current=document.activeElement;let r=d.current;if(!r)return;let n=r.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'),s=n[0],i=n[n.length-1],a=setTimeout(()=>s?.focus(),0);function o(e){if("Escape"===e.key)return void t();if("Tab"!==e.key||!s||!i)return;let n=document.activeElement;e.shiftKey?n!==s&&r.contains(n)||(e.preventDefault(),i.focus()):n===i&&(e.preventDefault(),s.focus())}return window.addEventListener("keydown",o),()=>{clearTimeout(a),window.removeEventListener("keydown",o),f.current?.focus({preventScroll:!0})}},[e,t]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{"aria-hidden":!e,onClick:t,className:(0,a.cn)("fixed inset-0 z-40 bg-black/60 backdrop-blur-sm transition-opacity duration-200 lg:hidden",e?"opacity-100":"pointer-events-none opacity-0")}),(0,s.jsxs)("aside",{ref:d,role:e?"dialog":void 0,"aria-modal":e?"true":void 0,"aria-hidden":!e,inert:!e,"aria-label":l.shell.siteMenu,style:{transform:e?"translateX(0)":"translateX(-100%)"},className:"fixed inset-y-0 left-0 z-50 flex h-dvh w-[288px] flex-col bg-sidebar shadow-2xl transition-transform duration-[280ms] ease-[var(--ease-shell)] lg:hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 px-[18px] pb-4 pt-5",children:[(0,s.jsx)("span",{className:"flex size-[30px] shrink-0 items-center justify-center overflow-hidden rounded-lg",children:(0,s.jsx)(c,{className:"size-full"})}),(0,s.jsxs)("span",{className:"font-heading text-[18px] font-extrabold tracking-tight",children:["brickster",(0,s.jsx)("span",{className:"text-primary",children:".ai"})]}),(0,s.jsx)("button",{type:"button","aria-label":l.shell.closeMenu,onClick:t,className:"ml-auto text-muted-foreground transition-colors hover:text-foreground",children:(0,s.jsx)(rV.X,{className:"size-[22px]"})})]}),(0,s.jsxs)("nav",{className:"flex-1 overflow-y-auto px-3 pb-4",children:[m.ACTIVE_NAV_GROUPS.map(e=>(0,s.jsxs)("div",{className:"mt-3 first:mt-0",children:[(0,s.jsx)("div",{className:"px-3 pb-1 font-mono text-[10px] uppercase tracking-wider text-dim",children:l.nav.groups[e.label]??e.label}),e.items.map(({href:e,label:r,icon:i})=>{let u=p(e);return(0,s.jsxs)(o.default,{href:(0,w.localizeHref)(e,n),onClick:t,"aria-current":u?"page":void 0,className:(0,a.cn)("flex items-center gap-2.5 rounded-[9px] px-3 py-2.5 text-[14px] font-medium transition-colors",u?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-foreground
37/5 hover:text-foreground"),children:[(0,s.jsx)(i,{className:(0,a.cn)("size-[18px] shrink-0",u?"text-primary":"text-dim")}),l.nav.items[e]??r]},e)})]},e.label)),(0,s.jsx)("div",{className:"mt-4 border-t border-border pt-3",children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"truncate px-3 pb-1 text-xs text-muted-foreground",children:r.email}),(0,s.jsxs)(o.default,{href:"/account",onClick:t,"aria-current":p("/account")?"page":void 0,className:(0,a.cn)("flex items-center gap-2.5 rounded-[9px] px-3 py-2.5 text-[14px] font-medium transition-colors",p("/account")?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-foreground/5 hover:text-foreground"),children:[(0,s.jsx)(I,{className:"size-[18px] text-dim","aria-hidden":!0}),l.shell.account]}),(0,s.jsx)("form",{action:rL,children:(0,s.jsxs)("button",{type:"submit",className:"flex w-full items-center gap-2.5 rounded-[9px] px-3 py-2.5 text-[14px] font-medium text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground",children:[(0,s.jsx)(P,{className:"size-[18px] text-dim","aria-hidden":!0}),l.shell.signOut]})})]}):(0,s.jsxs)(o.default,{href:"/signin",onClick:t,className:"flex items-center justify-center gap-2 rounded-[10px] bg-primary px-3 py-2.5 text-[14px] font-semibold text-primary-foreground transition-colors hover:bg-primary/90",children:[(0,s.jsx)(rK,{className:"size-[18px]","aria-hidden":!0}),l.shell.signIn]})})]}),(0,s.jsxs)("div",{className:"shrink-0 border-t border-border px-[18px] py-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(E,{}),(0,s.jsx)(A,{})]}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[11.5px] text-dim",children:m.LEGAL_LINKS.map((e,r)=>(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[r>0&&(0,s.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,s.jsx)(o.default,{href:(0,w.localizeHref)(e.href,n),onClick:t,className:"transition-colors hover:text-foreground",children:l.legal[e.href]??e.label})]},e.href))}),(0,s.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-dim",children:l.shell.independentShort})]})]})]})}var rJ=e.i(17313);let rY=(0,f.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]);var rX=e.i(47926);let rQ=(0,f.default)("life-buoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);var rZ=e.i(48103),r0=e.i(21052),r1=e.i(9724),r2=e.i(84552),r5=e.i(21219),r8=e.i(21158),r4=e.i(38445),r3=e.i(54671),r6=e.i(33030),r9=e.i(61957),r7=e.i(17632);let ne=m.ACTIVE_NAV_GROUPS.flatMap(e=>e.items.map(t=>({...t,group:e.label}))),nt=new Set(ne.map(e=>e.href)),nr={Pages:r3.FileText,Topics:rX.Hash,Compare:rH.Table,Guides:rQ,Roadmap:rZ.Map,News:r0.Newspaper,Releases:r1.Package,Videos:r2.Video,Community:r5.MessagesSquare,Projects:r8.FolderGit2,Articles:r7.BookOpen,Newsletter:r4.Mail};function nn({open:e,onOpenChange:t,lang:r="en"}){let n=(0,x.getDict)(r),o=(0,h.useRouter)(),[l,u]=(0,i.useState)(""),[c,d]=(0,i.useState)(0),[f,p]=(0,i.useState)([]),[g,m]=(0,i.useState)(!1),b=l.trim();(0,i.useEffect)(()=>{if(b.length<2)return;let e=new AbortController,t=setTimeout(()=>{fetch(`/api/search?q=${encodeURIComponent(b)}`,{signal:e.signal}).then(e=>e.ok?e.json():{results:[]}).then(e=>{p(e.results??[]),m(!1)}).catch(()=>{e.signal.aborted||(p([]),m(!1))})},170);return()=>{clearTimeout(t),e.abort()}},[b]);let v=(0,i.useMemo)(()=>{if(!b)return ne.map(e=>({kind:"nav",...e}));let e=b.toLowerCase(),t=[{kind:"assistant",query:b}];for(let r of ne){let s=n.nav.items[r.href]??r.label,i=n.nav.groups[r.group]??r.group;(s.toLowerCase().includes(e)||r.label.toLowerCase().includes(e)||i.toLowerCase().includes(e)||r.group.toLowerCase().includes(e))&&t.push({kind:"nav",...r})}if(b.length>=2)for(let e of f)"Pages"===e.group||nt.has(e.href)||t.push({kind:"result",result:e});return t},[b,f,n]),E=e=>{e||(u(""),d(0),p([])),t(e)},k=e=>{let t=v[e];t&&("assistant"===t.kind?(E(!1),o.push(`/assistant?q=${encodeURIComponent(t.query)}`)):"nav"===t.kind?(E(!1),(0,y.track)("nav_click",t.label,t.href,"command_palette"),o.push((0,w.localizeHref)(t.href,r))):t.result.external?(window.open(t.result.href,"_blank","noopener,noreferrer"),E(!1)):(E(!1),o.push(t.result.href)))};return(0,s.jsx)(rJ.Dialog.Root,{open:e,onOpenChange:E,children:(0,s.jsxs)(rJ.Dialog.Portal,{children:[(0,s.jsx)(rJ.Dialog.Backdrop,{
37className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),(0,s.jsxs)(rJ.Dialog.Popup,{onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),d(e=>Math.min(e+1,v.length-1))):"ArrowUp"===e.key?(e.preventDefault(),d(e=>Math.max(e-1,0))):"Enter"===e.key&&(e.preventDefault(),k(c))},className:"fixed left-1/2 top-[14vh] z-50 flex max-h-[68vh] w-[min(600px,92vw)] -translate-x-1/2 flex-col overflow-hidden rounded-2xl border border-border2 bg-card shadow-2xl outline-none transition-[opacity,transform] duration-150 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",children:[(0,s.jsx)(rJ.Dialog.Title,{className:"sr-only",children:n.palette.srTitle}),(0,s.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3.5",children:[g?(0,s.jsx)(r9.Loader2,{className:"size-[18px] shrink-0 animate-spin text-dim","aria-hidden":!0}):(0,s.jsx)(R.Search,{className:"size-[18px] shrink-0 text-dim","aria-hidden":!0}),(0,s.jsx)("input",{autoFocus:!0,value:l,onChange:e=>{let t=e.target.value;u(t),d(0),m(t.trim().length>=2)},placeholder:n.palette.placeholder,className:"min-w-0 flex-1 bg-transparent text-[15px] text-foreground outline-none placeholder:text-dim"}),(0,s.jsx)("kbd",{className:"rounded-[5px] border border-border px-1.5 py-0.5 font-mono text-[11px] text-dim",children:"esc"})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto p-2",children:[0===v.length?(0,s.jsx)("p",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:n.palette.empty}):v.map((e,t)=>{let r=t===c;if("assistant"===e.kind)return(0,s.jsxs)("button",{type:"button",onMouseMove:()=>d(t),onClick:()=>k(t),className:(0,a.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-[14px] transition-colors",r?"bg-primary/15 text-primary":"text-foreground"),children:[(0,s.jsx)(rF.Sparkles,{className:"size-[18px] shrink-0 text-primary","aria-hidden":!0}),(0,s.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[n.palette.askAssistant," ",(0,s.jsxs)("span",{className:"font-medium",children:["â",e.query,"â"]})]}),(0,s.jsx)(rY,{className:"size-4 shrink-0 text-dim","aria-hidden":!0})]},"assistant");if("nav"===e.kind){let i=e.icon;return(0,s.jsxs)("button",{type:"button",onMouseMove:()=>d(t),onClick:()=>k(t),className:(0,a.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-[14px] transition-colors",r?"bg-foreground
37/5 text-foreground":"text-muted-foreground"),children:[(0,s.jsx)(i,{className:(0,a.cn)("size-[18px] shrink-0",r?"text-foreground":"text-dim")}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n.nav.items[e.href]??e.label}),(0,s.jsx)("span",{className:"shrink-0 text-[11px] text-dim",children:n.nav.groups[e.group]??e.group})]},`nav:${e.href}`)}let i=e.result,o=nr[i.group]??r3.FileText;return(0,s.jsxs)("button",{type:"button",onMouseMove:()=>d(t),onClick:()=>k(t),className:(0,a.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-[14px] transition-colors",r?"bg-foreground/5 text-foreground":"text-muted-foreground"),children:[(0,s.jsx)(o,{className:(0,a.cn)("size-[18px] shrink-0",r?"text-foreground":"text-dim"),"aria-hidden":!0}),(0,s.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,s.jsx)("span",{className:"truncate text-foreground",children:i.title}),i.subtitle?(0,s.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:i.subtitle}):null]}),(0,s.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[11px] text-dim",children:[i.group,i.external?(0,s.jsx)(r6.ArrowUpRight,{className:"size-3","aria-hidden":!0}):null]})]},`res:${i.href}`)}),b.length>=2&&!g&&0===f.length?(0,s.jsx)("p",{className:"px-3 py-3 text-center text-[12.5px] text-dim",children:"No matching items â try the assistant above for a full answer."}):null]})]})]})})}var ns=e.i(72191);e.s(["ShellChrome",0,function({children:e,footer:t,rail:r,lang:n="en"}){let o=(0,x.getDict)(n),[l,u]=(0,i.useState)(!1),[c,h]=(0,i.useState)(!1),[d,f]=(0,i.useState)(!1),[p,g]=(0,i.useState)(void 0),m=(0,i.useCallback)(()=>u(e=>!e),[]),y=(0,i.useCallback)(()=>h(!0),[]),b=(0,i.useCallback)(()=>h(!1),[]),w=(0,i.useCallback)(()=>f(!0),[]);return(0,i.useEffect)(()=>{let e=document.documentElement,t=t=>{"Tab"===t.key&&e.setAttribute("data-kbd","")},r=()=>e.removeAttribute("data-kbd");return window.addEventListener("keydown",t,!0),window.addEventListener("pointerdown",r,!0),()=>{window.removeEventListener("keydown",t,!0),window.removeEventListener("pointerdown",r,!0)}},[]),(0,i.useEffect)(()=>{let e=()=>f(!0);return window.addEventListener("bx:open-palette",e),()=>window.removeEventListener("bx:open-palette",e)},[]),(0,i.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key.toLowerCase()&&(e.preventDefault(),f(!0))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,i.useEffect)(()=>{let e=!0;return fetch("/api/me",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(t=>{e&&g(t?.user??null)}).catch(()=>{e&&g(null)}),()=>{e=!1}},[]),(0,s.jsxs)(v.UserProvider,{value:p,children:[(0,s.jsx)(ns.SavedSync,{}),(0,s.jsx)("a",{href:"#main",onFocus:e=>{document.documentElement.hasAttribute("data-kbd")||e.currentTarget.blur()},className:"sr-only focus:not-sr-only focus:absolute focus:left-3 focus:top-3 focus:z-50 focus:rounded-md focus:bg-primary focus:px-3 focus:py-1.5 focus:text-sm focus:font-medium focus:text-primary-foreground",children:o.shell.skipToContent}),(0,s.jsx)(k,{collapsed:l,onToggle:m,lang:n}),(0,s.jsx)("div",{"aria-hidden":!0,className:(0,a.cn)("pointer-events-none fixed inset-0 z-30 hidden bg-black/50 opacity-0 transition-opacity duration-300 peer-hover/side:opacity-100",l&&"lg:block")}),(0,s.jsxs)("div",{className:(0,a.cn)("flex min-h-dvh flex-col pb-16 transition-[margin] duration-300 ease-[var(--ease-shell)] lg:pb-0",l?"lg:ml-[78px]":"lg:ml-[300px]"),children:[(0,s.jsx)(rB,{user:p,lang:n,onOpenDrawer:y,onOpenSearch:w}),(0,s.jsxs)("div",{className:"flex flex-1",children:[(0,s.jsx)("main",{id:"main",className:"min-w-0 flex-1",children:e}),r?(0,s.jsx)("aside",{className:"hidden w-[320px] shrink-0 border-l border-border xl:block",children:(0,s.jsx)("div",{className:"sticky top-[62px] py-5 pl-5 pr-9",children:r})}):null]}),t]}),(0,s.jsx)(rz,{onMore:y,lang:n}),(0,s.jsx)(rG,{open:c,onClose:b,user:p,lang:n}),(0,s.jsx)(nn,{open:d,onOpenChange:f,lang:n})]})}],25363)}]);
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.