PageSourceSearch

https://www.mednotes.ai/_next/static/chunks/563-1734a13266e8eddc.js

js mednotes.ai collected 2026-10-05 12:15:08 UTC 261,027 bytes, 5 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[563],{80485:function(e,t,r){"use strict";r.r(t),r.d(t,{Headers:function(){return s},Request:function(){return a},Response:function(){return o},fetch:function(){return i}});var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw Error("unable to locate global object")}();let i=n.fetch;t.default=n.fetch.bind(n);let s=n.Headers,a=n.Request,o=n.Response},5478:function(e,t,r){"use strict";r.d(t,{Ry:function(){return u}});var n=new WeakMap,i=new WeakMap,s={},a=0,o=function(e){return e&&(e.host||o(e.parentNode))},l=function(e,t,r,l){var u=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=o(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});s[r]||(s[r]=new WeakMap);var c=s[r],d=[],h=new Set,f=new Set(u),p=function(e){!e||h.has(e)||(h.add(e),p(e.parentNode))};u.forEach(p);var m=function(e){!e||f.has(e)||Array.prototype.forEach.call(e.children,function(e){if(h.has(e))m(e);else try{var t=e.getAttribute(l),s=null!==t&&"false"!==t,a=(n.get(e)||0)+1,o=(c.get(e)||0)+1;n.set(e,a),c.set(e,o),d.push(e),1===a&&s&&i.set(e,!0),1===o&&e.setAttribute(r,"true"),s||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return m(t),h.clear(),a++,function(){d.forEach(function(e){var t=n.get(e)-1,s=c.get(e)-1;n.set(e,t),c.set(e,s),t||(i.has(e)||e.removeAttribute(l),i.delete(e)),s||e.removeAttribute(r)}),--a||(n=new WeakMap,n=new WeakMap,i=new WeakMap,s={})}},u=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||("undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),l(n,i,r,"aria-hidden")):function(){return null}}},90469:function(e,t){"use strict";t.Q=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");for(var r={},n=(t||{}).decode||i,s=0;s<e.length;){var a=e.indexOf("=",s);if(-1===a)break;var o=e.indexOf(";",s);if(-1===o)o=e.length;else if(o<a){s=e.lastIndexOf(";",a-1)+1;continue}var l=e.slice(s,a).trim();if(void 0===r[l]){var u=e.slice(a+1,o).trim();34===u.charCodeAt(0)&&(u=u.slice(1,-1)),r[l]=function(e,t){try{return t(e)}catch(t){return e}}(u,n)}s=o+1}return r},t.q=function(e,t,i){var a=i||{},o=a.encode||s;if("function"!=typeof o)throw TypeError("option encode is invalid");if(!n.test(e))throw TypeError("argument name is invalid");var l=o(t);if(l&&!n.test(l))throw TypeError("argument val is invalid");var u=e+"="+l;if(null!=a.maxAge){var c=a.maxAge-0;if(isNaN(c)||!isFinite(c))throw TypeError("option maxAge is invalid");u+="; Max-Age="+Math.floor(c)}if(a.domain){if(!n.test(a.domain))throw TypeError("option domain is invalid");u+="; Domain="+a.domain}if(a.path){if(!n.test(a.path))throw TypeError("option path is invalid");u+="; Path="+a.path}if(a.expires){var d=a.expires;if("[object Date]"!==r.call(d)&&!(d instanceof Date)||isNaN(d.valueOf()))throw TypeError("option expires is invali
1d");u+="; Expires="+d.toUTCString()}if(a.httpOnly&&(u+="; HttpOnly"),a.secure&&(u+="; Secure"),a.priority)switch("string"==typeof a.priority?a.priority.toLowerCase():a.priority){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw TypeError("option priority is invalid")}if(a.sameSite)switch("string"==typeof a.sameSite?a.sameSite.toLowerCase():a.sameSite){case!0:case"strict":u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"none":u+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return u};var r=Object.prototype.toString,n=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function i(e){return -1!==e.indexOf("%")?decodeURIComponent(e):e}function s(e){return encodeURIComponent(e)}},79205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&r.indexOf(e)===t).join(" ")};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:u="",children:c,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...a,width:i,height:i,stroke:r,strokeWidth:l?24*Number(o)/Number(i):o,className:s("lucide",u),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(c)?c:[c]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,a)=>{let{className:l,...u}=r;return(0,n.createElement)(o,{ref:a,iconNode:t,className:s("lucide-".concat(i(e)),l),...u})});return r.displayName="".concat(e),r}},13041:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]])},92369:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("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"}]])},29374:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]])},85770:function(e,t,r){"use strict";r.d(t,{Av:function(){return a},pF:function(){return n},xv:function(){return s},zi:function(){return i}});var n="right-scroll-bar-position",i="width-before-scroll-bar",s="with-scroll-bars-hidden",a="--removed-body-scroll-bar-size"},5517:function(e,t,r){"use strict";r.d(t,{jp:function(){return m}});var n=r(2265),i=r(18704),s=r(85770),a={left:0,top:0,right:0,gap:0},o=function(e){return parseInt(e||"",10)||0},l=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[o(r),o(n),o(i)]},u=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return a;var t=l(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},c=(0,i.Ws)(),d="data-scroll-locked",h=function(e,t,r,n){var i=e.left,a=e.top,o=e.right,l=e.gap;return void 0===r&&(r="margin"),"\n  .".concat(s.xv," {\n   overflow: hidden ").concat(n,";\n   padding-right: ").concat(l,"px ").concat(n,";\n  }\n  body[").concat(d,"] {\n    overflow: hidden ").concat(n,";\n    overscroll-behavior: contain;\n    ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n    padding-left: ".concat(i,"px;\n    padding-top: ").concat(a,"px;\n    padding-right: ").concat(o,"px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(l,"px ").concat(n,";\n    "),"padding"===r&&"padding-right: ".concat(l,"px ").concat(n,";
1")].filter(Boolean).join(""),"\n  }\n  \n  .").concat(s.pF," {\n    right: ").concat(l,"px ").concat(n,";\n  }\n  \n  .").concat(s.zi," {\n    margin-right: ").concat(l,"px ").concat(n,";\n  }\n  \n  .").concat(s.pF," .").concat(s.pF," {\n    right: 0 ").concat(n,";\n  }\n  \n  .").concat(s.zi," .").concat(s.zi," {\n    margin-right: 0 ").concat(n,";\n  }\n  \n  body[").concat(d,"] {\n    ").concat(s.Av,": ").concat(l,"px;\n  }\n")},f=function(){var e=parseInt(document.body.getAttribute(d)||"0",10);return isFinite(e)?e:0},p=function(){n.useEffect(function(){return document.body.setAttribute(d,(f()+1).toString()),function(){var e=f()-1;e<=0?document.body.removeAttribute(d):document.body.setAttribute(d,e.toString())}},[])},m=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,s=void 0===i?"margin":i;p();var a=n.useMemo(function(){return u(s)},[s]);return n.createElement(c,{styles:h(a,!t,s,r?"":"!important")})}},18704:function(e,t,r){"use strict";r.d(t,{Ws:function(){return o}});var n,i=r(2265),s=function(){var e=0,t=null;return{add:function(i){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=n||r.nc;return t&&e.setAttribute("nonce",t),e}())){var s,a;(s=t).styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},a=function(){var e=s();return function(t,r){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},o=function(){var e=a();return function(t){return e(t.styles,t.dynamic),null}}},17325:function(e,t,r){"use strict";r.d(t,{q:function(){return o}});var n=r(2265);function i(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var s="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,a=new WeakMap;function o(e,t){var r,o,l,u=(r=t||null,o=function(t){return e.forEach(function(e){return i(e,t)})},(l=(0,n.useState)(function(){return{value:r,callback:o,facade:{get current(){return l.value},set current(value){var e=l.value;e!==value&&(l.value=value,l.callback(value,e))}}}})[0]).callback=o,l.facade);return s(function(){var t=a.get(u);if(t){var r=new Set(t),n=new Set(e),s=u.current;r.forEach(function(e){n.has(e)||i(e,null)}),n.forEach(function(e){r.has(e)||i(e,s)})}a.set(u,e)},[e]),u}},71931:function(e,t,r){"use strict";r.d(t,{Nr:function(){return s}});var n=r(2265);function i(e,t){return e===t}function s(e,t,r){var s=r&&r.equalityFn||i,a=(0,n.useRef)(e),o=(0,n.useState)({})[1],l=function(e,t,r){var i=this,s=(0,n.useRef)(null),a=(0,n.useRef)(0),o=(0,n.useRef)(null),l=(0,n.useRef)([]),u=(0,n.useRef)(),c=(0,n.useRef)(),d=(0,n.useRef)(e),h=(0,n.useRef)(!0);d.current=e;var f="undefined"!=typeof window,p=!t&&0!==t&&f;if("function"!=typeof e)throw TypeError("Expected a function");t=+t||0;var m=!!(r=r||{}).leading,v=!("trailing"in r)||!!r.trailing,y="maxWait"in r,g="debounceOnServer"in r&&!!r.debounceOnServer,b=y?Math.max(+r.maxWait||0,t):null;return(0,n.useEffect)(function(){return h.current=!0,function(){h.current=!1}},[]),(0,n.useMemo)(function(){var e=function(e){var t=l.current,r=u.current;return l.current=u.current=null,a.current=e,c.current=d.current.apply(r,t)},r=function(e,t){p&&cancelAnimationFrame(o.current),o.current=p?requestAnimationFrame(e):setTimeout(e,t)},n=function(e){if(!h.current)return!1;var r=e-s.current;return!s.current||r>=t||r<0||y&&e-a.current>=b},_=function(t){return o.current=null,v&&l.current?e(t):(l.current=u.current=null,c.current)},w=function e(){var i=Date.now();if(n(i))return _(i);if(h.current){var o=t-(i-s.current);r(e,y?Math.min(o,b-(i-a.current)):o)}},k=function(){if(f||g){var d=Date.now(),p=n(d);if(l.current=[].slice.call(arguments),u.current=i,s.current=d,p){if(!o.current&&h.current)return a.current=s.current,r(w,t),m?e(s.current):c.current;if(y)return r(w,t),e(s.current)}return o.current||r(w,t),c.current}};return k.cancel=function(){o.current&&(p?cancelAnimationFrame(o.current):clearTimeout(o.current)),a.current=0,l.current=s.current=u.current=o.current=null},k.isPending=function(){return!!o.current},k.flush=function(){return o.current?_(Date.now()):c.current},k},[m,y,t,b,v,p,f,g])}((0,n.useCallback)(function(e){a.current=e,o({})},[o]),t,r),u=(0,n.useRef)(e);return s(u.current,e)||(l(e),u.current=e),[a.current,l]}},49085:function(e,t,r){"use strict";r.d(t,{L:function(){return a}});var n=r(5853),i=r(2265),s=function(e){var t=e.sideCar,r=(0,n._T)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw Error("Sidecar medium not found");return i.createElement(s,(0,n.pi)({},r))};function a(e,t){return e.useMedium(t),s}
1s.isSideCarExport=!0},31412:function(e,t,r){"use strict";r.d(t,{_:function(){return s}});var n=r(5853);function i(e){return e}function s(e){void 0===e&&(e={});var t,r,s,a=(void 0===t&&(t=i),r=[],s=!1,{read:function(){if(s)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:null},useMedium:function(e){var n=t(e,s);return r.push(n),function(){r=r.filter(function(e){return e!==n})}},assignSyncMedium:function(e){for(s=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){s=!0;var t=[];if(r.length){var n=r;r=[],n.forEach(e),t=r}var i=function(){var r=t;t=[],r.forEach(e)},a=function(){return Promise.resolve().then(i)};a(),r={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),r}}}});return a.options=(0,n.pi)({async:!0,ssr:!1},e),a}},25566:function(e){var t,r,n,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l=[],u=!1,c=-1;function d(){u&&n&&(u=!1,n.length?l=n.concat(l):c=-1,l.length&&h())}function h(){if(!u){var e=o(d);u=!0;for(var t=l.length;t;){for(n=l,l=[];++c<t;)n&&n[c].run();c=-1,t=l.length}n=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new f(e,t)),1!==l.length||u||o(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}},6741:function(e,t,r){"use strict";function n(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}r.d(t,{M:function(){return n}})},70928:function(e,t,r){"use strict";r.d(t,{aU:function(){return L},$j:function(){return F},VY:function(){return D},dk:function(){return M},aV:function(){return $},h_:function(){return I},fC:function(){return P},Dx:function(){return U},xz:function(){return N}});var n=r(2265),i=r(57437);function s(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}function a(...e){return n.useCallback(s(...e),e)}var o=r(97928),l=r(6741);n.forwardRef((e,t)=>{let{children:r,...s}=e,a=n.Children.toArray(r),o=a.find(d);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,i.jsx)(u,{...s,ref:t,children:n.isValidElement(e)?n.cloneElement(e,void 0,r):null})}return(0,i.jsx)(u,{...s,ref:t,children:r})}).displayName="Slot";var u=n.forwardRef((e,t)=>{let{children:r,...i}=e;if(n.isValidElement(r)){let e,a;let o=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.ref:(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.props.ref:r.props.ref||r.ref;return n.cloneElement(r,{...function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{s(...e),i(...e)}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}
1:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(i,r.props),ref:t?s(t,o):o})}return n.Children.count(r)>1?n.Children.only(null):null});u.displayName="SlotClone";var c=({children:e})=>(0,i.jsx)(i.Fragment,{children:e});function d(e){return n.isValidElement(e)&&e.type===c}var h="AlertDialog",[f,p]=function(e,t=[]){let r=[],s=()=>{let t=r.map(e=>n.createContext(e));return function(r){let i=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:i}}),[r,i])}};return s.scopeName=e,[function(t,s){let a=n.createContext(s),o=r.length;function l(t){let{scope:r,children:s,...l}=t,u=r?.[e][o]||a,c=n.useMemo(()=>l,Object.values(l));return(0,i.jsx)(u.Provider,{value:c,children:s})}return r=[...r,s],l.displayName=t+"Provider",[l,function(r,i){let l=i?.[e][o]||a,u=n.useContext(l);if(u)return u;if(void 0!==s)return s;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let i=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}(s,...t)]}(h,[o.p8]),m=(0,o.p8)(),v=e=>{let{__scopeAlertDialog:t,...r}=e,n=m(t);return(0,i.jsx)(o.fC,{...n,...r,modal:!0})};v.displayName=h;var y=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...n}=e,s=m(r);return(0,i.jsx)(o.xz,{...s,...n,ref:t})});y.displayName="AlertDialogTrigger";var g=e=>{let{__scopeAlertDialog:t,...r}=e,n=m(t);return(0,i.jsx)(o.h_,{...n,...r})};g.displayName="AlertDialogPortal";var b=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...n}=e,s=m(r);return(0,i.jsx)(o.aV,{...s,...n,ref:t})});b.displayName="AlertDialogOverlay";var _="AlertDialogContent",[w,k]=f(_),S=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,children:s,...u}=e,d=m(r),h=n.useRef(null),f=a(t,h),p=n.useRef(null);return(0,i.jsx)(o.jm,{contentName:_,titleName:x,docsSlug:"alert-dialog",children:(0,i.jsx)(w,{scope:r,cancelRef:p,children:(0,i.jsxs)(o.VY,{role:"alertdialog",...d,...u,ref:f,onOpenAutoFocus:(0,l.M)(u.onOpenAutoFocus,e=>{var t;e.preventDefault(),null===(t=p.current)||void 0===t||t.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,i.jsx)(c,{children:s}),(0,i.jsx)(A,{contentRef:h})]})})})});S.displayName=_;var x="AlertDialogTitle",E=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...n}=e,s=m(r);return(0,i.jsx)(o.Dx,{...s,...n,ref:t})});E.displayName=x;var T="AlertDialogDescription",O=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...n}=e,s=m(r);return(0,i.jsx)(o.dk,{...s,...n,ref:t})});O.displayName=T;var C=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...n}=e,s=m(r);return(0,i.jsx)(o.x8,{...s,...n,ref:t})});C.displayName="AlertDialogAction";var j="AlertDialogCancel",R=n.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=k(j,r),l=m(r),u=a(t,s);return(0,i.jsx)(o.x8,{...l,...n,ref:u})});R.displayName=j;var A=e=>{let{contentRef:t}=e,r="`".concat(_,"` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the `").concat(_,"` by passing a `").concat(T,"` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an `id` and passing the same value to the `aria-describedby` prop in `").concat(_,"`. If the description is confusing or duplicative for sighted users, you can use the `@radix-ui/react-visually-hidden` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog");return n.useEffect(()=>{var e;document.getElementById(null===(e=t.current)||void 0===e?void 0:e.getAttribute("aria-describedby"))||console.warn(r)},[r,t]),null},P=v,N=y,I=g,$=b,D=S,L=C,F=R,U=E,M=O},97928:function(e,t,r){"use strict";r.d(t,{x8:function(){return eV},VY:function(){return eF},dk:function(){return eM},aV:function(){return eL}
1,h_:function(){return eD},fC:function(){return eI},Dx:function(){return eU},xz:function(){return e$},jm:function(){return eR},p8:function(){return ei}});var n,i=r(2265),s=r(6741);function a(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}function o(...e){return i.useCallback(a(...e),e)}var l=r(57437),u=r(82425),c=r(46484),d=r(54887),h=i.forwardRef((e,t)=>{let{children:r,...n}=e,s=i.Children.toArray(r),a=s.find(m);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,l.jsx)(f,{...n,ref:t,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return(0,l.jsx)(f,{...n,ref:t,children:r})});h.displayName="Slot";var f=i.forwardRef((e,t)=>{let{children:r,...n}=e;if(i.isValidElement(r)){let e,s;let o=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.ref:(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.props.ref:r.props.ref||r.ref;return i.cloneElement(r,{...function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{s(...e),i(...e)}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props),ref:t?a(t,o):o})}return i.Children.count(r)>1?i.Children.only(null):null});f.displayName="SlotClone";var p=({children:e})=>(0,l.jsx)(l.Fragment,{children:e});function m(e){return i.isValidElement(e)&&e.type===p}var v=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,t)=>{let r=i.forwardRef((e,r)=>{let{asChild:n,...i}=e,s=n?h:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,l.jsx)(s,{...i,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function y(e){let t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...e)=>t.current?.(...e),[])}var g=r(52558),b="dismissableLayer.update",_=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),w=i.forwardRef((e,t)=>{var r,a;let{disableOutsidePointerEvents:u=!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,...m}=e,w=i.useContext(_),[x,E]=i.useState(null),T=null!==(a=null==x?void 0:x.ownerDocument)&&void 0!==a?a:null===(r=globalThis)||void 0===r?void 0:r.document,[,O]=i.useState({}),C=o(t,e=>E(e)),j=Array.from(w.layers),[R]=[...w.layersWithOutsidePointerEventsDisabled].slice(-1),A=j.indexOf(R),P=x?j.indexOf(x):-1,N=w.layersWithOutsidePointerEventsDisabled.size>0,I=P>=A,$=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=globalThis)||void 0===t?void 0:t.document,n=y(e),s=i.useRef(!1),a=i.useRef(()=>{});return i.useEffect(()=>{let e=e=>{if(e.target&&!s.current){let t=function(){S("dismissableLayer.pointerDownOutside",n,i,{discrete:!0})},i={originalEvent:e};"touch"===e.pointerType?(r.removeEventListener("click",a.current),a.current=t,r.addEventListener("click",a.current,{once:!0})):t()}else r.removeEventListener("click",a.current);s.current=!1},t=window.setTimeout(()=>{r.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),r.removeEventListener("pointerdown",e),r.removeEventListener("click",a.current)}},[r,n]),{onPointerDownCapture:()=>s.current=!0}}(e=>{let t=e.target,r=[...w.branches].some(e=>e.contains(t));!I||r||(null==d||d(e),null==f||f(e),e.defaultPrevented||null==p||p())},T),D=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=globalThis)||void 0===t?void 0:t.document,n=y(e),s=i.useRef(!1);return i.useEffect(()=>{let e=e=>{e.target&&!s.current&&S("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return r.addEventListener("focusin",e),()=>r.removeEventListener("focusin",e)},[r,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}(e=>{let t=e.target;[...w.branches].some(e=>e.contains(t))||(null==h||h(e),null==f||f(e),e.defaultPrevented||null==p||p())},T);return(0,g.e)(e=>{P!==w.layers.size-1||(null==c||c(e),!e.defaultPrevented&&p&&(e.preventDefault(),p()))},T),i.useEffect(()=>{if(x)return u&&(0===w.layersWithOutsidePointerEventsDisabled.size&&(n=T.body.style.pointerEvents,T.body.style.pointerEvents="none"),w.layersWithOutsidePointerEventsDisabled.add(x)),w.layers.add(x),k(),()=>{u&&1===w.layersWithOutsidePointerEventsDisabled.size&&(T.body.style.pointerEvents=n)}},[x,T,u,w]),i.useEffect(()=>()=>{x&&(w.layers.delete(x),w.layersWithOutsidePointerEventsDisabled.delete(x),k())},[x,w]),i.useEffect(()=>{let e=()=>O({});return document.addEventListener(b,e),()=>document.removeEventListener(b,e)},[]),(0,l.jsx)(v.div,{...m,ref:C,style:{pointerEvents:N?I?"auto":"none":void 0,...e.style},onFocusCapture:(0,s.M)(e.onFocusCapture,D.onFocusCapture),onBlurCapture:(0,s.M)(e.onBlurCapture,D.onBlurCapture),onPointerDownCapture:(0,s.M)(e.onPointerDownCapture,$.onPointerDownCapture)})});function k(){let e=new CustomEvent(b);document.dispatchEvent(e)}function S(e,t,r,n){let{discrete:i}=n,s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});(t&&s.addEventListener(e,t,{once:!0}),i)?s&&d.flushSync(()=>s.dispatchEvent(a)):s.dispatchEvent(a)}w.displayName="DismissableLayer",i.forwardRef((e,t)=>
1{let r=i.useContext(_),n=i.useRef(null),s=o(t,n);return i.useEffect(()=>{let e=n.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,l.jsx)(v.div,{...e,ref:s})}).displayName="DismissableLayerBranch";var x=r(76310),E=globalThis?.document?i.useLayoutEffect:()=>{},T=i.forwardRef((e,t)=>{var r,n;let{container:s,...a}=e,[o,u]=i.useState(!1);E(()=>u(!0),[]);let c=s||o&&(null===(n=globalThis)||void 0===n?void 0:null===(r=n.document)||void 0===r?void 0:r.body);return c?d.createPortal((0,l.jsx)(v.div,{...a,ref:t}),c):null});T.displayName="Portal";var O=e=>{var t,r;let n,s;let{present:a,children:l}=e,u=function(e){var t,r;let[n,s]=i.useState(),a=i.useRef({}),o=i.useRef(e),l=i.useRef("none"),[u,c]=(t=e?"mounted":"unmounted",r={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},i.useReducer((e,t)=>{let n=r[e][t];return null!=n?n:e},t));return i.useEffect(()=>{let e=C(a.current);l.current="mounted"===u?e:"none"},[u]),E(()=>{let t=a.current,r=o.current;if(r!==e){let n=l.current,i=C(t);e?c("MOUNT"):"none"===i||(null==t?void 0:t.display)==="none"?c("UNMOUNT"):r&&n!==i?c("ANIMATION_OUT"):c("UNMOUNT"),o.current=e}},[e,c]),E(()=>{if(n){let e=e=>{let t=C(a.current).includes(e.animationName);e.target===n&&t&&d.flushSync(()=>c("ANIMATION_END"))},t=e=>{e.target===n&&(l.current=C(a.current))};return n.addEventListener("animationstart",t),n.addEventListener("animationcancel",e),n.addEventListener("animationend",e),()=>{n.removeEventListener("animationstart",t),n.removeEventListener("animationcancel",e),n.removeEventListener("animationend",e)}}c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:i.useCallback(e=>{e&&(a.current=getComputedStyle(e)),s(e)},[])}}(a),c="function"==typeof l?l({present:u.isPresent}):i.Children.only(l),h=o(u.ref,(n=null===(t=Object.getOwnPropertyDescriptor(c.props,"ref"))||void 0===t?void 0:t.get)&&"isReactWarning"in n&&n.isReactWarning?c.ref:(n=null===(r=Object.getOwnPropertyDescriptor(c,"ref"))||void 0===r?void 0:r.get)&&"isReactWarning"in n&&n.isReactWarning?c.props.ref:c.props.ref||c.ref);return"function"==typeof l||u.isPresent?i.cloneElement(c,{ref:h}):null};function C(e){return(null==e?void 0:e.animationName)||"none"}O.displayName="Presence";var j=0;function R(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var A=r(5853),P=r(85770),N=r(17325),I=(0,r(31412)._)(),$=function(){},D=i.forwardRef(function(e,t){var r=i.useRef(null),n=i.useState({onScrollCapture:$,onWheelCapture:$,onTouchMoveCapture:$}),s=n[0],a=n[1],o=e.forwardProps,l=e.children,u=e.className,c=e.removeScrollBar,d=e.enabled,h=e.shards,f=e.sideCar,p=e.noIsolation,m=e.inert,v=e.allowPinchZoom,y=e.as,g=e.gapMode,b=(0,A._T)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=(0,N.q)([r,t]),w=(0,A.pi)((0,A.pi)({},b),s);return i.createElement(i.Fragment,null,d&&i.createElement(f,{sideCar:I,removeScrollBar:c,shards:h,noIsolation:p,inert:m,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:g}),o?i.cloneElement(i.Children.only(l),(0,A.pi)((0,A.pi)({},w),{ref:_})):i.createElement(void 0===y?"div":y,(0,A.pi)({},w,{className:u,ref:_}),l))});D.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},D.classNames={fullWidth:P.zi,zeroRight:P.pF};var L=r(49085),F=r(5517),U=r(18704),M=!1;if("undefined"!=typeof window)try{var V=Object.defineProperty({},"passive",{get:function(){return M=!0,!0}});window.addEventListener("test",V,V),window.removeEventListener("test",V,V)}catch(e){M=!1}var Z=!!M&&{passive:!1},q=function(e,t){var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&"TEXTAREA"!==e.tagName&&"visible"===r[t])},B=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),z(e,n)){var i=W(e,n);if(i[1]>i[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},z=function(e,t){return"v"===e?q(t,"overflowY"):q(t,"overflowX")},W=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},K=function(e,t,r,n,i){var s,a=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),o=a*n,l=r.target,u=t.contains(l),c=!1,d=o>0,h=0,f=0;do{var p=W(e,l),m=p[0],v=p[1]-p[2]-a*m;(m||v)&&z(e,l)&&(h+=v,f+=m),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return d&&(i&&1>Math.abs(h)||!i&&o>h)?c=!0:!d&&(i&&1>Math.abs(f)||!i&&-o>f)&&(c=!0),c},G=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},H=function(e){return[e.deltaX,e.deltaY]},J=function(e){return e&&"current"in e?e.current:e},Q=0,Y=[],X=(0,L.L)(I,function(e){var t=i.useRef([]),r=i.useRef([0,0]),n=i.useRef(),s=i.useState(Q++)[0],a=i.useState(U.Ws)[0],o=i.useRef(e);i.useEffect(function(){o.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=(0,A.ev)([e.lockRef.current],(e.shards||[]).map(J),!0).filter(
1Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=i.useCallback(function(e,t){if("touches"in e&&2===e.touches.length)return!o.current.allowPinchZoom;var i,s=G(e),a=r.current,l="deltaX"in e?e.deltaX:a[0]-s[0],u="deltaY"in e?e.deltaY:a[1]-s[1],c=e.target,d=Math.abs(l)>Math.abs(u)?"h":"v";if("touches"in e&&"h"===d&&"range"===c.type)return!1;var h=B(d,c);if(!h)return!0;if(h?i=d:(i="v"===d?"h":"v",h=B(d,c)),!h)return!1;if(!n.current&&"changedTouches"in e&&(l||u)&&(n.current=i),!i)return!0;var f=n.current||i;return K(f,t,e,"h"===f?l:u,!0)},[]),u=i.useCallback(function(e){if(Y.length&&Y[Y.length-1]===a){var r="deltaY"in e?H(e):G(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta)[0]===r[0]&&n[1]===r[1]})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var i=(o.current.shards||[]).map(J).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?l(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=i.useCallback(function(e,r,n,i){var s={name:e,delta:r,target:n,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),d=i.useCallback(function(e){r.current=G(e),n.current=void 0},[]),h=i.useCallback(function(t){c(t.type,H(t),t.target,l(t,e.lockRef.current))},[]),f=i.useCallback(function(t){c(t.type,G(t),t.target,l(t,e.lockRef.current))},[]);i.useEffect(function(){return Y.push(a),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",u,Z),document.addEventListener("touchmove",u,Z),document.addEventListener("touchstart",d,Z),function(){Y=Y.filter(function(e){return e!==a}),document.removeEventListener("wheel",u,Z),document.removeEventListener("touchmove",u,Z),document.removeEventListener("touchstart",d,Z)}},[]);var p=e.removeScrollBar,m=e.inert;return i.createElement(i.Fragment,null,m?i.createElement(a,{styles:"\n  .block-interactivity-".concat(s," {pointer-events: none;}\n  .allow-interactivity-").concat(s," {pointer-events: all;}\n")}):null,p?i.createElement(F.jp,{gapMode:e.gapMode}):null)}),ee=i.forwardRef(function(e,t){return i.createElement(D,(0,A.pi)({},e,{ref:t,sideCar:X}))});ee.classNames=D.classNames;var et=r(5478),er="Dialog",[en,ei]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>i.createContext(e));return function(r){let n=r?.[e]||t;return i.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=i.createContext(n),a=r.length;function o(t){let{scope:r,children:n,...o}=t,u=r?.[e][a]||s,c=i.useMemo(()=>o,Object.values(o));return(0,l.jsx)(u.Provider,{value:c,children:n})}return r=[...r,n],o.displayName=t+"Provider",[o,function(r,o){let l=o?.[e][a]||s,u=i.useContext(l);if(u)return u;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let i=r(e)[`__scope${n}`];return{...t,...i}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(er),[es,ea]=en(er),eo=e=>{let{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:o=!0}=e,d=i.useRef(null),h=i.useRef(null),[f=!1,p]=(0,c.T)({prop:n,defaultProp:s,onChange:a});return(0,l.jsx)(es,{scope:t,triggerRef:d,contentRef:h,contentId:(0,u.M)(),titleId:(0,u.M)(),descriptionId:(0,u.M)(),open:f,onOpenChange:p,onOpenToggle:i.useCallback(()=>p(e=>!e),[p]),modal:o,children:r})};eo.displayName=er;var el="DialogTrigger",eu=i.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ea(el,r),a=o(t,i.triggerRef);return(0,l.jsx)(v.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":eC(i.open),...n,ref:a,onClick:(0,s.M)(e.onClick,i.onOpenToggle)})});eu.displayName=el;var ec="DialogPortal",[ed,eh]=en(ec,{forceMount:void 0}),ef=e=>{let{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=ea(ec,t);return(0,l.jsx)(ed,{scope:t,forceMount:r,children:i.Children.map(n,e=>(0,l.jsx)(O,{present:r||a.open,children:(0,l.jsx)(T,{asChild:!0,container:s,children:e})}))})};
1ef.displayName=ec;var ep="DialogOverlay",em=i.forwardRef((e,t)=>{let r=eh(ep,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=ea(ep,e.__scopeDialog);return s.modal?(0,l.jsx)(O,{present:n||s.open,children:(0,l.jsx)(ev,{...i,ref:t})}):null});em.displayName=ep;var ev=i.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ea(ep,r);return(0,l.jsx)(ee,{as:h,allowPinchZoom:!0,shards:[i.contentRef],children:(0,l.jsx)(v.div,{"data-state":eC(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ey="DialogContent",eg=i.forwardRef((e,t)=>{let r=eh(ey,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=ea(ey,e.__scopeDialog);return(0,l.jsx)(O,{present:n||s.open,children:s.modal?(0,l.jsx)(eb,{...i,ref:t}):(0,l.jsx)(e_,{...i,ref:t})})});eg.displayName=ey;var eb=i.forwardRef((e,t)=>{let r=ea(ey,e.__scopeDialog),n=i.useRef(null),a=o(t,r.contentRef,n);return i.useEffect(()=>{let e=n.current;if(e)return(0,et.Ry)(e)},[]),(0,l.jsx)(ew,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,s.M)(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null===(t=r.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:(0,s.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,s.M)(e.onFocusOutside,e=>e.preventDefault())})}),e_=i.forwardRef((e,t)=>{let r=ea(ey,e.__scopeDialog),n=i.useRef(!1),s=i.useRef(!1);return(0,l.jsx)(ew,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var i,a;null===(i=e.onCloseAutoFocus)||void 0===i||i.call(e,t),t.defaultPrevented||(n.current||null===(a=r.triggerRef.current)||void 0===a||a.focus(),t.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:t=>{var i,a;null===(i=e.onInteractOutside)||void 0===i||i.call(e,t),t.defaultPrevented||(n.current=!0,"pointerdown"!==t.detail.originalEvent.type||(s.current=!0));let o=t.target;(null===(a=r.triggerRef.current)||void 0===a?void 0:a.contains(o))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),ew=i.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...u}=e,c=ea(ey,r),d=i.useRef(null),h=o(t,d);return i.useEffect(()=>{var e,t;let r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=r[0])&&void 0!==e?e:R()),document.body.insertAdjacentElement("beforeend",null!==(t=r[1])&&void 0!==t?t:R()),j++,()=>{1===j&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),j--}},[]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(x.M,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:(0,l.jsx)(w,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":eC(c.open
1),...u,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(eP,{titleId:c.titleId}),(0,l.jsx)(eN,{contentRef:d,descriptionId:c.descriptionId})]})]})}),ek="DialogTitle",eS=i.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ea(ek,r);return(0,l.jsx)(v.h2,{id:i.titleId,...n,ref:t})});eS.displayName=ek;var ex="DialogDescription",eE=i.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ea(ex,r);return(0,l.jsx)(v.p,{id:i.descriptionId,...n,ref:t})});eE.displayName=ex;var eT="DialogClose",eO=i.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=ea(eT,r);return(0,l.jsx)(v.button,{type:"button",...n,ref:t,onClick:(0,s.M)(e.onClick,()=>i.onOpenChange(!1))})});function eC(e){return e?"open":"closed"}eO.displayName=eT;var ej="DialogTitleWarning",[eR,eA]=function(e,t){let r=i.createContext(t);function n(e){let{children:t,...n}=e,s=i.useMemo(()=>n,Object.values(n));return(0,l.jsx)(r.Provider,{value:s,children:t})}return n.displayName=e+"Provider",[n,function(n){let s=i.useContext(r);if(s)return s;if(void 0!==t)return t;throw Error(`\`${n}\` must be used within \`${e}\``)}]}(ej,{contentName:ey,titleName:ek,docsSlug:"dialog"}),eP=e=>{let{titleId:t}=e,r=eA(ej),n="`".concat(r.contentName,"` requires a `").concat(r.titleName,"` for the component to be accessible for screen reader users.\n\nIf you want to hide the `").concat(r.titleName,"`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/").concat(r.docsSlug);return i.useEffect(()=>{t&&!document.getElementById(t)&&console.error(n)},[n,t]),null},eN=e=>{let{contentRef:t,descriptionId:r}=e,n=eA("DialogDescriptionWarning"),s="Warning: Missing `Description` or `aria-describedby={undefined}` for {".concat(n.contentName,"}.");return i.useEffect(()=>{var e;let n=null===(e=t.current)||void 0===e?void 0:e.getAttribute("aria-describedby");r&&n&&!document.getElementById(r)&&console.warn(s)},[s,t,r]),null},eI=eo,e$=eu,eD=ef,eL=em,eF=eg,eU=eS,eM=eE,eV=eO},76310:function(e,t,r){"use strict";let n;r.d(t,{M:function(){return v}});var i=r(2265);function s(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}r(54887);var a=r(57437),o=i.forwardRef((e,t)=>{let{children:r,...n}=e,s=i.Children.toArray(r),o=s.find(c);if(o){let e=o.props.children,r=s.map(t=>t!==o?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,a.jsx)(l,{...n,ref:t,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return(0,a.jsx)(l,{...n,ref:t,children:r})});o.displayName="Slot";var l=i.forwardRef((e,t)=>{let{children:r,...n}=e;if(i.isValidElement(r)){let e,a;let o=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.ref:(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.props.ref:r.props.ref||r.ref;return i.cloneElement(r,{...function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{s(...e),i(...e)}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props),ref:t?s(t,o):o})}return i.Children.count(r)>1?i.Children.only(null):null});l.displayName="SlotClone";var u=({children:e})=>(0,a.jsx)(a.Fragment,{children:e});function c(e){return i.isValidElement(e)&&e.type===u}var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,t)=>{let r=i.forwardRef((e,r)=>{let{asChild:n,...i}=e,s=n?o:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,a.jsx)(s,{...i,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function h(e){let t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...e)=>t.current?.(...e),[])}var f="focusScope.autoFocusOnMount",p="focusScope.autoFocusOnUnmount",m={bubbles:!1,cancelable:!0},v=i.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[c,v]=i.useState(null),w=h(o),k=h(l),S=i.useRef(null),x=function(...e){return i.useCallback(s(...e),e)}(t,e=>v(e)),E=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(n){let e=function(e){if(E.paused||!c)return;let t=e.target;c.contains(t)?S.current=t:b(S.current,{select:!0})},t=function(e){if(E.paused||!c)return;let t=e.relatedTarget;null===t||c.contains(t)||b(S.current,{select:!0})};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&b(c)});return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,c,E.paused]),i.useEffect(()=>{if(c){_.add(E);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(f,m);c.addEventListener(f,w),c.dispatchEvent(t),t.defaultPrevented||(function(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.activeElement;for(let n of e)if(b(n,{select:t}),document.activeElement!==r)return}(y(c).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&b(c))}return()=>{c.removeEventListener(f,w),setTimeout(()=>{let t=new CustomEvent(p,m);c.addEventListener(p,k),c.dispatchEvent(t),t.defaultPrevented||b(null!=e?e:document.body,{select:!0}),c.removeEventListener(p,k),_.remove(E)},0)}}},[c,w,k,E]);let T=i.useCallback(e=>{if(!r&&!n||E.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[n,s]=function(e){let t=y(e);return[g(t,e),g(t.reverse(),e)]}(t);n&&s?e.shiftKey||i!==s?e.shiftKey&&i===n&&(e.preventDefault(),r&&b(s,{select:!0})):(e.preventDefault(),r&&b(n,{select:!0})):i===t&&e.preventDefault()}},[r,n,E.paused]);return(0,a.jsx)(d.div,{tabIndex:-1,...u,ref:x,onKeyDown:T})});function y(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function g(e,t){for(let r of e)if(!function(e,t){let{upTo:r}=t;if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===r||e!==r);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function b(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}v.displayName="FocusScope";var _=(n=[],{add(e){let t=n[0];e!==t&&(null==t||t.pause()),(n=w(n,e)).unshift(e)},remove(e){var t;null===(t=(n=w(n,e))[0])||void 0===t||t.resume()}});function w(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}},82425:function(e,t,r){"use strict";r.d(t,{M:function(){return l}});var n=r(2265),i=r.t(n,2),s=globalThis?.document?n.useLayoutEffect:()=>{},a=i["useId".toString()]||(()=>void 0),o=0;function l(e){let[t,r]=n.useState(a());return s(()=>{e||r(e=>e??String(o++))},[e]),e||(t?`radix-${t}`:"")}},98482:function(e,t,r){"use strict";r.d(t,{g7:function(){return o},Z8:function(){return a}});var n=r(2265);function i(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var s=r(57437);function a(e){let t=function(e){let t=n.forwardRef((e,t)=>
1{let{children:r,...s}=e;if(n.isValidElement(r)){let e,a;let o=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.ref:(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning?r.props.ref:r.props.ref||r.ref,l=function(e,t){let r={...t};for(let n in t){let i=e[n],s=t[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(r[n]=i):"style"===n?r[n]={...i,...s}:"className"===n&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}(s,r.props);return r.type!==n.Fragment&&(l.ref=t?function(...e){return t=>{let r=!1,n=e.map(e=>{let n=i(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():i(e[t],null)}}}}(t,o):o),n.cloneElement(r,l)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}(e),r=n.forwardRef((e,r)=>{let{children:i,...a}=e,o=n.Children.toArray(i),l=o.find(u);if(l){let e=l.props.children,i=o.map(t=>t!==l?t:n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null);return(0,s.jsx)(t,{...a,ref:r,children:n.isValidElement(e)?n.cloneElement(e,void 0,i):null})}return(0,s.jsx)(t,{...a,ref:r,children:i})});return r.displayName=`${e}.Slot`,r}var o=a("Slot"),l=Symbol("radix.slottable");function u(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===l}},46484:function(e,t,r){"use strict";r.d(t,{T:function(){return s}});var n=r(2265);function i(e){let t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}function s({prop:e,defaultProp:t,onChange:r=()=>{}}){let[s,a]=function({defaultProp:e,onChange:t}){let r=n.useState(e),[s]=r,a=n.useRef(s),o=i(t);return n.useEffect(()=>{a.current!==s&&(o(s),a.current=s)},[s,a,o]),r}({defaultProp:t,onChange:r}),o=void 0!==e,l=o?e:s,u=i(r);return[l,n.useCallback(t=>{if(o){let r="function"==typeof t?t(e):t;r!==e&&u(r)}else a(t)},[o,e,a,u])]}},52558:function(e,t,r){"use strict";r.d(t,{e:function(){return i}});var n=r(2265);function i(e,t=globalThis?.document){let r=function(e){let t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}(e);n.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}},93561:function(e,t,r){"use strict";r.d(t,{AY:function(){return tW}});let n=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,80485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)};class i extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class s extends i{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class a extends i{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class o extends i{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(u=c||(c={})).Any="any",u.ApNortheast1="ap-northeast-1",u.ApNortheast2="ap-northeast-2",u.ApSouth1="ap-south-1",u.ApSoutheast1="ap-southeast-1",u.ApSoutheast2="ap-southeast-2",u.CaCentral1="ca-central-1",u.EuCentral1="eu-central-1",u.EuWest1="eu-west-1",u.EuWest2="eu-west-2",u.EuWest3="eu-west-3",u.SaEast1="sa-east-1",u.UsEast1="us-east-1",u.UsWest1="us-west-1",u.UsWest2="us-west-2";class l{constructor(e,{headers:t={},customFetch:r,region:i=c.Any}={}){this.url=e,this.headers=t,this.region=i,this.fetch=n(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var r,n,i,l,u;return n=this,i=void 0,l=void 0,u=function*(){try{let n;let{headers:i,method:l,body:u}=t,c={},{region:d}=t;d||(d=this.region),d&&"any"!==d&&(c["x-region"]=d),u&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&("undefined"!=typeof Blob&&u instanceof Blob||u instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",n=u):"string"==typeof u?(c["Content-Type"]="text/plain",n=u):"undefined"!=typeof FormData&&u instanceof FormData?n=u:(c["Content-Type"]="application/json",n=JSON.stringify(u)));let h=yield this.fetch(`${this.url}/${e}`,{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:n}).catch(e=>{throw new s(e)}),f=h.headers.get("x-relay-error");
1if(f&&"true"===f)throw new a(h);if(!h.ok)throw new o(h);let p=(null!==(r=h.headers.get("Content-Type"))&&void 0!==r?r:"text/plain").split(";")[0].trim();return{data:"application/json"===p?yield h.json():"application/octet-stream"===p?yield h.blob():"multipart/form-data"===p?yield h.formData():yield h.text(),error:null}}catch(e){return{data:null,error:e}}},new(l||(l=Promise))(function(e,t){function r(e){try{a(u.next(e))}catch(e){t(e)}}function s(e){try{a(u.throw(e))}catch(e){t(e)}}function a(t){var n;t.done?e(t.value):((n=t.value)instanceof l?n:new l(function(e){e(n)})).then(r,s)}a((u=u.apply(n,i||[])).next())})}}var u,c,d,h,f,p,m,v,y,g,b,_,w,k,S,x,E,T,O,C,j,R,A=r(80485);class P extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class N{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"==typeof fetch?this.fetch=A.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let r=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,r,n;let i=null,s=null,a=null,o=e.status,l=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(s="text/csv"===this.headers.Accept?t:this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}let n=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),u=null===(r=e.headers.get("content-range"))||void 0===r?void 0:r.split("/");n&&u&&u.length>1&&(a=parseInt(u[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(s)&&(s.length>1?(i={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,a=null,o=406,l="Not Acceptable"):s=1===s.length?s[0]:null)}else{let t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(s=[],i=null,o=200,l="OK")}catch(r){404===e.status&&""===t?(o=204,l="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(n=null==i?void 0:i.details)||void 0===n?void 0:n.includes("0 rows"))&&(i=null,o=200,l="OK"),i&&this.shouldThrowOnError)throw new P(i)}return{error:i,data:s,count:a,status:o,statusText:l}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,n;return{error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!==(r=null==e?void 0:e.stack)&&void 0!==r?r:""}`,hint:"",code:`${null!==(n=null==e?void 0:e.code)&&void 0!==n?n:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}}class I extends N{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.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){let s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${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 i=void 0===n?"offset":`${n}.offset`,s=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}
1explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var a;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=null!==(a=this.headers.Accept)&&void 0!==a?a:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class $ extends I{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}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&RegExp("[,()]").test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`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 i="";"plain"===n?i="pl":"phrase"===n?i="ph":"websearch"===n&&(i="w");let s=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${s}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let 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}}class D{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=t,this.schema=r,this.fetch=n}select(e,{head:t=!1,count:r}={}){let n=!1,i=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!n?"":('"'===e&&(n=!n),e)).join("");return this.url.searchParams.set("select",i),r&&(this.headers.Prefer=`count=${r}`),new $({method:t?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:r=!0}={}){let n=[];if(this.headers.Prefer&&n.push(this.headers.Prefer),t&&n.push(`count=${t}`),r||n.push("missing=default"),this.headers.Prefer=n.join(","),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}"`);this.url.searchParams.set("columns",e.join(","))}}return new $({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){let s=[`resolution=${r?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&s.push(this.headers.Prefer),n&&s.push(`count=${n}`),i||s.push("missing=default"),this.headers.Prefer=s.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>
1e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new $({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){let r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),this.headers.Prefer=r.join(","),new $({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){let t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new $({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}let L={"X-Client-Info":"postgrest-js/1.15.0"};class F{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=Object.assign(Object.assign({},L),t),this.schemaName=r,this.fetch=n}from(e){return new D(new URL(`${this.url}/${e}`),{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new F(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:i}={}){let s,a;let o=new URL(`${this.url}/rpc/${e}`);r?(s="HEAD",Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,`${t}`)})):n?(s="GET",Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,`${t}`)})):(s="POST",a=t);let l=Object.assign({},this.headers);return i&&(l.Prefer=`count=${i}`),new $({method:s,url:o,headers:l,schema:this.schemaName,body:a,fetch:this.fetch,allowEmpty:!1})}}let U={"X-Client-Info":"realtime-js/2.9.3"};(k=d||(d={}))[k.connecting=0]="connecting",k[k.open=1]="open",k[k.closing=2]="closing",k[k.closed=3]="closed",(S=h||(h={})).closed="closed",S.errored="errored",S.joined="joined",S.joining="joining",S.leaving="leaving",(x=f||(f={})).close="phx_close",x.error="phx_error",x.join="phx_join",x.reply="phx_reply",x.leave="phx_leave",x.access_token="access_token",(p||(p={})).websocket="websocket",(E=m||(m={})).Connecting="connecting",E.Open="open",E.Closing="closing",E.Closed="closed";class M{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class V{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=this.HEADER_LENGTH+2,a=r.decode(e.slice(s,s+n));s+=n;let o=r.decode(e.slice(s,s+i));return s+=i,{ref:null,topic:a,event:o,payload:JSON.parse(r.decode(e.slice(s,e.byteLength)))}}}class Z{constructor(e,t,r={},n=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=n,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null===(r=this.receivedResp)||void 0===r?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){this.timeoutTimer||(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))}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}
1_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}(T=v||(v={})).SYNC="sync",T.JOIN="join",T.LEAVE="leave";class q{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:n}=this.caller;this.joinRef=this.channel._joinRef(),this.state=q.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=q.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],n()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=q.syncDiff(this.state,e,t,r),n())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,n){let i=this.cloneDeep(e),s=this.transformState(t),a={},o={};return this.map(i,(e,t)=>{s[e]||(o[e]=t)}),this.map(s,(e,t)=>{let r=i[e];if(r){let n=t.map(e=>e.presence_ref),i=r.map(e=>e.presence_ref),s=t.filter(e=>0>i.indexOf(e.presence_ref)),l=r.filter(e=>0>n.indexOf(e.presence_ref));s.length>0&&(a[e]=s),l.length>0&&(o[e]=l)}else a[e]=t}),this.syncDiff(i,{joins:a,leaves:o},r,n)}static syncDiff(e,t,r,n){let{joins:i,leaves:s}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),n||(n=()=>{}),this.map(i,(t,n)=>{var i;let s=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(n),s.length>0){let r=e[t].map(e=>e.presence_ref),n=s.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...n)}r(t,s,n)}),this.map(s,(t,r)=>{let i=e[t];if(!i)return;let s=r.map(e=>e.presence_ref);i=i.filter(e=>0>s.indexOf(e.presence_ref)),e[t]=i,n(t,i,r),0===i.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let n=e[r];return"metas"in n?t[r]=n.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=n,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(O=y||(y={})).abstime="abstime",O.bool="bool",O.date="date",O.daterange="daterange",O.float4="float4",O.float8="float8",O.int2="int2",O.int4="int4",O.int4range="int4range",O.int8="int8",O.int8range="int8range",O.json="json",O.jsonb="jsonb",O.money="money",O.numeric="numeric",O.oid="oid",O.reltime="reltime",O.text="text",O.time="time",O.timestamp="timestamp",O.timestamptz="timestamptz",O.timetz="timetz",O.tsrange="tsrange",O.tstzrange="tstzrange";let B=(e,t,r={})=>{var n;let i=null!==(n=r.skipTypes)&&void 0!==n?n:[];return Object.keys(t).reduce((r,n)=>(r[n]=z(n,e,t,i),r),{})},z=(e,t,r,n)=>{let i=t.find(t=>t.name===e),s=null==i?void 0:i.type,a=r[e];return s&&!n.includes(s)?W(s,a):K(a)},W=(e,t)=>{if("_"===e.charAt(0))return Q(t,e.slice(1,e.length));switch(e){case y.bool:return G(t);case y.float4:case y.float8:case y.int2:case y.int4:case y.int8:case y.numeric:case y.oid:return H(t);case y.json:case y.jsonb:return J(t);case y.timestamp:return Y(t);case y.abstime:case y.date:case y.daterange:case y.int4range:case y.int8range:case y.money:case y.reltime:case y.text:case y.time:case y.timestamptz:case y.timetz:case y.tsrange:case y.tstzrange:default:return K(t)}},K=e=>e,G=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},H=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},J=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},Q=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){let n;let i=e.slice(1,r);try{n=JSON.parse("["+i+"]")}catch(e){n=i?i.split(","):[]}return n.map(e=>W(t,e))}return e},Y=e=>"string"==typeof e?e.replace(" ","T"):e;(C=g||(g={})).ALL="*",C.INSERT="INSERT",C.UPDATE="UPDATE",C.DELETE="DELETE",(j=b||(b={})).BROADCAST="broadcast",j.PRESENCE="presence",j.POSTGRES_CHANGES="postgres_changes",(R=_||(_={})).SUBSCRIBED="SUBSCRIBED",R.TIMED_OUT="TIMED_OUT",R.CLOSED="CLOSED",R.CHANNEL_ERROR="CHANNEL_ERROR";class X{constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=h.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new Z(this,f.join,this.params,this.timeout),this.rejoinTimer=new M(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=h.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e
1=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=h.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=h.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=h.errored,this.rejoinTimer.scheduleTimeout())}),this._on(f.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new q(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,t=this.timeout){var r,n;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{let{config:{broadcast:i,presence:s}}=this.params;this._onError(t=>e&&e("CHANNEL_ERROR",t)),this._onClose(()=>e&&e("CLOSED"));let a={},o={broadcast:i,presence:s,postgres_changes:null!==(n=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==n?n:[]};this.socket.accessToken&&(a.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:o},a)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",({postgres_changes:t})=>{var r;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0===t){e&&e("SUBSCRIBED");return}{let n=this.bindings.postgres_changes,i=null!==(r=null==n?void 0:n.length)&&void 0!==r?r:0,s=[];for(let r=0;r<i;r++){let i=n[r],{filter:{event:a,schema:o,table:l,filter:u}}=i,c=t&&t[r];if(c&&c.event===a&&c.schema===o&&c.table===l&&c.filter===u)s.push(Object.assign(Object.assign({},i),{id:c.id}));else{this.unsubscribe(),e&&e("CHANNEL_ERROR",Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=s,e&&e("SUBSCRIBED");return}}).receive("error",t=>{e&&e("CHANNEL_ERROR",Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this._on(e,t,r)}async send(e,t={}){var r,n;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var n,i,s;let a=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(s=null===(i=null===(n=this.params)||void 0===n?void 0:n.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.ack)||r("ok"),a.receive("ok",()=>r("ok")),a.receive("timeout",()=>r("timed out"))});{let{event:i,payload:s}=e,a={method:"POST",headers:{apikey:null!==(r=this.socket.apiKey)&&void 0!==r?r:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:s}]})};try{if((await this._fetchWithTimeout(this.broadcastEndpointURL,a,null!==(n=t.timeout)&&void 0!==n?n:this.timeout)).ok)return"ok";return"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=h.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(f.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{let n=new Z(this,f.leave,{},e);n.receive("ok",()=>{t(),r("ok")}).receive("timeout",()=>{t(),r("timed out")}).receive("error",()=>{r("error")}),n.send(),this._canPush()||n.trigger("ok",{})})}_broadcastEndpointURL(){let e=this.socket.endPoint;
1return(e=(e=e.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,t,r){let n=new AbortController,i=setTimeout(()=>n.abort(),r),s=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),s}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new Z(this,e,t,r);return this._canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var n,i;let s=e.toLocaleLowerCase(),{close:a,error:o,leave:l,join:u}=f;if(r&&[a,o,l,u].indexOf(s)>=0&&r!==this._joinRef())return;let c=this._onMessage(s,t,r);if(t&&!c)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?null===(n=this.bindings.postgres_changes)||void 0===n||n.filter(e=>{var t,r,n;return(null===(t=e.filter)||void 0===t?void 0:t.event)==="*"||(null===(n=null===(r=e.filter)||void 0===r?void 0:r.event)||void 0===n?void 0:n.toLocaleLowerCase())===s}).map(e=>e.callback(c,r)):null===(i=this.bindings[s])||void 0===i||i.filter(e=>{var r,n,i,a,o,l;if(!["broadcast","presence","postgres_changes"].includes(s))return e.type.toLocaleLowerCase()===s;if("id"in e){let s=e.id,a=null===(r=e.filter)||void 0===r?void 0:r.event;return s&&(null===(n=t.ids)||void 0===n?void 0:n.includes(s))&&("*"===a||(null==a?void 0:a.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{let r=null===(o=null===(a=null==e?void 0:e.filter)||void 0===a?void 0:a.event)||void 0===o?void 0:o.toLocaleLowerCase();return"*"===r||r===(null===(l=null==t?void 0:t.event)||void 0===l?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof c&&"ids"in c){let e=c.data,{schema:t,table:r,commit_timestamp:n,type:i,errors:s}=e;c=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:n,eventType:i,new:{},old:{},errors:s}),this._getPayloadRecords(e))}e.callback(c,r)})}_isClosed(){return this.state===h.closed}_isJoined(){return this.state===h.joined}_isJoining(){return this.state===h.joining}_isLeaving(){return this.state===h.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let n=e.toLocaleLowerCase(),i={type:n,filter:t,callback:r};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(e=>{var n;return!((null===(n=e.type)||void 0===n?void 0:n.toLocaleLowerCase())===r&&X.isEqual(e.filter,t))}),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(f.close,{},e)}_onError(e){this._on(f.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=h.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=B(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=B(e.columns,e.old_record)),t}}let ee=()=>{},et="undefined"!=typeof WebSocket;class er{constructor(e,t){var n;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=U,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=ee,this.conn=null,this.sendBuffer=[],this.serializer=new V,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,80485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},this.endPoint=`${e}/${p.websocket}`,(null==t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(null==t?void 0:t.params)&&(this.params=t.params),(null==t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({}
1,this.headers),t.headers)),(null==t?void 0:t.timeout)&&(this.timeout=t.timeout),(null==t?void 0:t.logger)&&(this.logger=t.logger),(null==t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);let i=null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey;i&&(this.accessToken=i,this.apiKey=i),this.reconnectAfterMs=(null==t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null==t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null==t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new M(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(et){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new en(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),r.e(223).then(r.t.bind(r,55223,23)).then(({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case d.connecting:return m.Connecting;case d.open:return m.Open;case d.closing:return m.Closing;default:return m.Closed}}isConnected(){return this.connectionState()===m.Open}channel(e,t={config:{}}){let r=new X(`realtime:${e}`,t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:n,ref:i}=e,s=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};this.log("push",`${t} ${r} (${i})`,n),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(f.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t._joinRef()!==e._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:r,payload:n,ref:i}=e;(i&&i===this.pendingHeartbeatRef||r===(null==n?void 0:n.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${n.status||""} ${t} ${r} ${i&&"("+i+")"||""}`,n),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,n,i)),this.stateChangeCallbacks.message.forEach(t=>t(e))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}
1_triggerChanError(){this.channels.forEach(e=>e._trigger(f.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return`${e}${r}${n}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class en{constructor(e,t,r){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=d.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=r.close}}class ei extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function es(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class ea extends ei{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class eo extends ei{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let el=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,80485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},eu=()=>{var e,t,n,i;return e=void 0,t=void 0,n=void 0,i=function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,80485))).Response:Response},new(n||(n=Promise))(function(r,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function o(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};var ec=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})};let ed=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),eh=(e,t)=>ec(void 0,void 0,void 0,function*(){e instanceof(yield eu())?e.json().then(r=>{t(new ea(ed(r),e.status||500))}).catch(e=>{t(new eo(ed(e),e))}):t(new eo(ed(e),e))}),ef=(e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};function ep(e,t,r,n,i,s){return ec(this,void 0,void 0,function*(){return new Promise((a,o)=>{e(r,ef(t,n,i,s)).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>a(e)).catch(e=>eh(e,o))})})}function em(e,t,r,n){return ec(this,void 0,void 0,function*(){return ep(e,"GET",t,r,n)})}function ev(e,t,r,n,i){return ec(this,void 0,void 0,function*(){return ep(e,"POST",t,n,i,r)})}function ey(e,t,r,n,i){return ec(this,void 0,void 0,function*(){return ep(e,"DELETE",t,n,i,r)})}var eg=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})};let eb={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},e_={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ew{constructor(e,t={},r,n){this.url=e,this.headers=t,this.bucketId=r,this.fetch=el(n)}uploadOrUpdate(e,t,r,n){return eg(this,void 0,void 0,function*(){try{let i;let s=Object.assign(Object.assign({},e_),n),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(s.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",s.cacheControl),i.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(i=r).append("cacheControl",s.cacheControl):(i=r,a["cache-control"]=`max-age=${s.cacheControl}`,a["content-type"]=s.contentType);let o=this._removeEmptyFolders(t),l=this._getFinalPath(o),u=yield this.fetch(`${this.url}/object/${l}`,Object.assign({method:e,body:i,headers:a},(null==s?void 0:s.duplex)?{duplex:s.duplex}:{})),c=yield u.json();if(u.ok)return{data:{path:o,id:c.Id,fullPath:c.Key},error:null};return{data:null,error:c}}catch(e){if(es(e))return{data:null,error:e};throw e}})}upload(e,t,r){return eg(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,n){return eg(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),s=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${s}`);a.searchParams.set("token",t);try{let e;let t=Object.assign({upsert:e_.upsert},n),s=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,s["cache-control"]=`max-age=${t.cacheControl}`,s["content-type"]=t.contentType);let o=yield this.fetch(a.toString(),{method:"PUT",body:e,headers:s}),l=yield o.json();if(o.ok)return{data:{path:i,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(es(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e){return eg(this,void 0,void 0,function*(){try{let t=this._getFinalPath(e),r=yield ev(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),n=new URL(this.url+r.url),i=n.searchParams.get("token");if(!i)throw new ei("No token returned by API");return{data:{signedUrl:n.toString(),path:e,token:i},error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}update(e,t,r){return eg(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t){return eg(this,void 0,void 0,function*(){try{return{data:yield ev(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}copy(e,t){return eg(this,void 0,void 0,function*(){try{return{data:{path:(yield ev(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers})).Key},error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return eg(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=yield ev(this.fetch,`${this.url}/object/sign/${n}
1`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),s=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i={signedUrl:encodeURI(`${this.url}${i.signedURL}${s}`)},error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return eg(this,void 0,void 0,function*(){try{let n=yield ev(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:n.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null})),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}download(e,t){return eg(this,void 0,void 0,function*(){let r=void 0!==(null==t?void 0:t.transform),n=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=n?`?${n}`:"";try{let t=this._getFinalPath(e),n=yield em(this.fetch,`${this.url}/${r?"render/image/authenticated":"object"}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield n.blob(),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),n=[],i=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&n.push(i);let s=void 0!==(null==t?void 0:t.transform),a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==a&&n.push(a);let o=n.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${s?"render/image":"object"}/public/${r}${o}`)}}}remove(e){return eg(this,void 0,void 0,function*(){try{return{data:yield ey(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}list(e,t,r){return eg(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},eb),t),{prefix:e||""});return{data:yield ev(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}let ek={"X-Client-Info":"storage-js/2.5.5"};var eS=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function a(e){try{l(n.next(e))}catch(e){s(e)}}function o(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((n=n.apply(e,t||[])).next())})};class ex{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},ek),t),this.fetch=el(r)}listBuckets(){return eS(this,void 0,void 0,function*(){try{return{data:yield em(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}getBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield em(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}createBucket(e,t={public:!1}){return eS(this,void 0,void 0,function*(){try{return{data:yield ev(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return eS(this,void 0,void 0,function*(){try{return{data:yield function(e,t,r,n,i){return ec(this,void 0,void 0,function*(){return ep(e,"PUT",t,n,void 0,r)})}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}emptyBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield ev(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}deleteBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield ey(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(es(e))return{data:null,error:e};throw e}})}}class eE extends ex{constructor(e,t={},r){super(e,t,r)}from(e){return new ew(this.url,this.headers,e,this.fetch)}}let eT="";"undefined"!=typeof Deno?eT="deno":"undefined"!=typeof document?eT="web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?eT="react-native":eT="node";let eO={headers:{"X-Client-Info":`supabase-js-${eT}/2.42.0`}},eC={schema:"public"},ej={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eR={},eA=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=A.default:t=fetch,(...e)=>t(...e)},eP=()=>"undefined"==typeof Headers?A.Headers:Headers,eN=(e,t,r)=>{let n=eA(r),i=eP();return(r,s)=>{var a,o,l,u;return a=void 0,o=void 0,l=void 0,u=function*(){var a;let o=null!==(a=yield t())&&void 0!==a?a:e,l=new i(null==s?void 0:s.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),n(r,Object.assign(Object.assign({},s),{headers:l}))},new(l||(l=Promise))(function(e,t){function r(e){try{i(u.next(e))}catch(e){t(e)}}function n(e){try{i(u.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):((i=t.value)instanceof l?i:new l(function(e){e(i)})).then(r,n)}i((u=u.apply(a,o||[])).next())})}},eI="2.63.0",e$={"X-Client-Info":`gotrue-js/${eI}`},eD="X-Supabase-Api-Version",eL={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eF=()=>"undefined"!=typeof document,eU={tested:!1,writable:!1},eM=()=>
1{if(!eF())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(eU.tested)return eU.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),eU.tested=!0,eU.writable=!0}catch(e){eU.tested=!0,eU.writable=!1}return eU.writable};function eV(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}let eZ=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,80485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},eq=e=>"object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json,eB=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},ez=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},eW=async(e,t)=>{await e.removeItem(t)};class eK{constructor(){this.promise=new eK.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function eG(e){let t=e.split(".");if(3!==t.length)throw Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw Error("JWT is not valid: payload is not in base64url format");return JSON.parse(function(e){let t,r,n,i,s,a,o;let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(e=e.replace("-","+").replace("_","/");c<e.length;)i=l.indexOf(e.charAt(c++)),s=l.indexOf(e.charAt(c++)),a=l.indexOf(e.charAt(c++)),o=l.indexOf(e.charAt(c++)),t=i<<2|s>>4,r=(15&s)<<4|a>>2,n=(3&a)<<6|o,u+=String.fromCharCode(t),64!=a&&0!=r&&(u+=String.fromCharCode(r)),64!=o&&0!=n&&(u+=String.fromCharCode(n));return u}(t[1]))}async function eH(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function eJ(e){return("0"+e.toString(16)).substr(-2)}async function eQ(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 eY(e){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"undefined"!=typeof TextEncoder?btoa(await eQ(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):(console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e)}async function eX(e,t,r=!1){let n=function(){let e=new Uint32Array(56);if("undefined"==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,eJ).join("")}(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await eB(e,`${t}-code-verifier`,i);let s=await eY(n),a=n===s?"plain":"s256";return[s,a]}eK.promiseConstructor=Promise;let e0=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;class e1 extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function e2(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class e4 extends e1{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class e5 extends e1{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class e9 extends e1{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class e3 extends e9{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class e8 extends e9{constructor(){super("Auth session or user missing","AuthInvalidToken
1ResponseError",500,void 0)}}class e7 extends e9{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class e6 extends e9{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class te extends e9{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class tt extends e9{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function tr(e){return e2(e)&&"AuthRetryableFetchError"===e.name}class tn extends e9{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}var ti=function(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 i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let ts=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),ta=[502,503,504];async function to(e){var t;let r,n;if(!eq(e))throw new tt(ts(e),0);if(ta.includes(e.status))throw new tt(ts(e),e.status);try{r=await e.json()}catch(e){throw new e5(ts(e),e)}let i=function(e){let t=e.headers.get(eD);if(!t||!t.match(e0))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(i&&i.getTime()>=eL["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 tn(ts(r),e.status,(null===(t=r.weak_password)||void 0===t?void 0:t.reasons)||[])}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 tn(ts(r),e.status,r.weak_password.reasons);throw new e4(ts(r),e.status||500,n)}let tl=(e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function tu(e,t,r,n){var i;let s=Object.assign({},null==n?void 0:n.headers);s[eD]||(s[eD]=eL["2024-01-01"].name),(null==n?void 0:n.jwt)&&(s.Authorization=`Bearer ${n.jwt}`);let a=null!==(i=null==n?void 0:n.query)&&void 0!==i?i:{};(null==n?void 0:n.redirectTo)&&(a.redirect_to=n.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await tc(e,t,r+o,{headers:s,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 tc(e,t,r,n,i,s){let a;let o=tl(t,n,i,s);try{a=await e(r,Object.assign(Object.assign({},o),{cache:"no-store"}))}catch(e){throw console.error(e),new tt(ts(e),0)}if(a.ok||await to(a),null==n?void 0:n.noResolveJson)return a;try{return await a.json()}catch(e){await to(e)}}function td(e){var t,r;let n=null;return e.access_token&&e.refresh_token&&e.expires_in&&(n=Object.assign({},e),!e.expires_at)&&(n.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)),{data:{session:n,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function th(e){let t=td(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 tf(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function tp(e){return{data:e,error:null}}function tm(e){let{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},user:Object.assign({},ti(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function tv(e){return e}var ty=function(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 i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};class tg{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=eZ(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await tu(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await tu(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=ty(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 tu(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:tm,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(e2(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tu(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,n,i,s,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await tu(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?void 0:t.toString())&&void 0!==r?r:"",per_page:null!==(i=null===(n=null==e?void 0:e.perPage)||void 0===n?void 0:n.toString())&&void 0!==i?i:""},xform:tv});if(u.error)throw u.error;let c=await u.json(),d=null!==(s=u.headers.get("x-total-count"))&&void 0!==s?s:0,h=null!==(o=null===(a=u.headers.get("link"))||void 0===a?void 0:a.split(","))&&void 0!==o?o:[];return h.length>
10&&(h.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(d)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(e2(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await tu(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await tu(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await tu(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{let{data:t,error:r}=await tu(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(e2(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await tu(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}}let tb={getItem:e=>eM()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{eM()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{eM()&&globalThis.localStorage.removeItem(e)}};function t_(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let tw={debug:!!(globalThis&&eM()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tk extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tS extends tk{}async function tx(e,t,r){tw.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),tw.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async n=>{if(n){tw.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{tw.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}else{if(0===t)throw tw.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tS(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(tw.debug)try{let e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}})}!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();let tE={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:e$,flowType:"implicit",debug:!1};async function tT(e,t,r){return await r()}class tO{constructor(e){var t,r;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.insecureGetSessionWarningShown=!1,this.instanceID=tO.nextInstanceID,tO.nextInstanceID+=1,this.instanceID>0&&eF()&&console.warn("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.");let n=Object.assign(Object.assign({},tE),e);if(this.logDebugMessages=!!n.debug,"function"==typeof n.debug&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new tg({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=eZ(n.fetch),this.lock=n.lock||tT,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,n.lock?this.lock=n.lock:eF()&&(null===(t=null==globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=tx:this.lock=tT,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)},this.persistSession?n.storage?this.storage=n.storage:eM()?this.storage=tb:(this.memoryStorage={},this.storage=t_(this.memoryStorage)):(this.memoryStorage={},this.storage=t_(this.memoryStorage)),eF()&&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===(r=this.broadcastChannel)||void 0===r||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${eI}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){try{let e=!!eF()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:t,error:r}=await this._getSessionFromURL(e);if(r){if(this._debug("#_initialize()","error detecting session from URL",r),(null==r?void 0:r.message)==="Identity is already linked"||(null==r?void 0:r.message)==="Identity is already linked to another user")return{error:r};return await this._removeSession(),{error:r}}let{session:n,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",n,"redirect type",i),await this._saveSession(n),setTimeout(async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(e2(e))return{error:e};return{error:new e5("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{await this._removeSession();let{data:i,error:s}=await tu(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!==(r=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==r?r:{},gotrue_meta_security:{captcha_token:null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.captchaToken}},xform:td});if(s||!i)return{data:{user:null,session:null},error:s};let a=i.session,o=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:o,session:a},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,n;try{let i;if(await this._removeSession(),"email"in e){let{email:r,password:n,options:s}=e,a=null,o=null;"pkce"===this.flowType&&([a,o]=await eX(this.storage,this.storageKey)),i=await tu(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==s?void 0:s.emailRedirectTo,body:{email:r,password:n,data:null!==(t=null==s?void 0:s.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:a,code_challenge_method:o},xform:td})}else if("phone"in e){let{phone:t,password:s,options:a}=e;i=await tu(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:s,data:null!==(r=null==a?void 0:a.data)&&void 0!==r?r:{},channel:null!==(n=null==a?void 0:a.channel)&&void 0!==n?n:"sms",gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:td})}else throw new e7("You must provide either an email or phone number and a password");let{data:s,error:a}=i;if(a||!s)return{data:{user:null,session:null},error:a};let o=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if(await this._removeSession(),"email"in e){let{email:r,password:n,options:i}=e;t=await tu(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:th})}else if("phone"in e){let{phone:r,password:n,options:i}=e;t=await tu(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:th})}else throw new e7("You must provide either an email or phone number and a password");let{data:r,error:n}=t;if(n)return{data:{user:null,session:null},error:n};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new e8};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,n,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(n=e.options)||void 0===n?void 0:n.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){let t=await ez(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/"),{data:i,error:s}=await tu(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:td});return(await eW(this.storage,`${this.storageKey}-code-verifier`),s)?{data:{user:null,session:null,redirectType:null},error:s}:i&&i.session&&i.user?(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:null!=n?n:null}),error:s}):{data:{user:null,session:null,redirectType:null},error:new e8}}async signInWithIdToken(e){await this._removeSession();try{let{options:t,provider:r,token:n,access_token:i,nonce:s}=e,{data:a,error:o}=await tu(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:s,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:td});if(o)return{data:{user:null,session:null},error:o};if(!a||!a.session||!a.user)return{data:{user:null,session:null},error:new e8};return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:o}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,n,i,s;try{if(await this._removeSession(),"email"in e){let{email:n,options:i}=e,s=null,a=null;"pkce"===this.flowType&&([s,a]=await eX(this.storage,this.storageKey));let{error:o}=await tu(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{}
1,create_user:null===(r=null==i?void 0:i.shouldCreateUser)||void 0===r||r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:s,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}if("phone"in e){let{phone:t,options:r}=e,{data:a,error:o}=await tu(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(n=null==r?void 0:r.data)&&void 0!==n?n:{},create_user:null===(i=null==r?void 0:r.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!==(s=null==r?void 0:r.channel)&&void 0!==s?s:"sms"}});return{data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o}}throw new e7("You must provide either an email or phone number.")}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let n,i;"email_change"!==e.type&&"phone_change"!==e.type&&await this._removeSession(),"options"in e&&(n=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(r=e.options)||void 0===r?void 0:r.captchaToken);let{data:s,error:a}=await tu(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:td});if(a)throw a;if(!s)throw Error("An error occurred on token verification.");let o=s.session,l=s.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,n;try{await this._removeSession();let i=null,s=null;return"pkce"===this.flowType&&([i,s]=await eX(this.storage,this.storageKey)),await tu(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?void 0:t.redirectTo)&&void 0!==r?r:void 0}),(null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:s}),headers:this.headers,xform:tp})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,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 e3;let{error:n}=await tu(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{"email_change"!=e.type&&"phone_change"!=e.type&&await this._removeSession();let t=`${this.url}/resend`;if("email"in e){let{email:r,type:n,options:i}=e,{error:s}=await tu(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:s}}if("phone"in e){let{phone:r,type:n,options:i}=e,{data:s,error:a}=await tu(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:a}}throw new e7("You must provide either an email or phone number and a type")}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){await this.initializePromise;let e=await this._acquireLock(-1,async()=>this._useSession(async e=>e));return e.data&&this.storage.isServer&&!this.insecureGetSessionWarningShown&&(console.warn("Using supabase.auth.getSession() is potentially insecure as it loads data directly from the storage medium (typically cookies) which may not be authentic. Prefer using supabase.auth.getUser() instead. To suppress this warning call supabase.auth.getUser() before you call supabase.auth.getSession()."),this.insecureGetSessionWarningShown=!0),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 e=null,t=await ez(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not val
1id"),await this._removeSession())),!e)return{data:{session:null},error:null};let r=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.storage.isServer){let t=e.user;delete e.user,Object.defineProperty(e,"user",{enumerable:!0,get:()=>(e.__suppressUserWarning||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 many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t),set:e=>{t=e}})}return{data:{session:e},error:null}}let{session:n,error:i}=await this._callRefreshToken(e.refresh_token);if(i)return{data:{session:null},error:i};return{data:{session:n},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(-1,async()=>await this._getUser());return t.data&&this.storage.isServer&&(this.insecureGetSessionWarningShown=!0),t}async _getUser(e){try{if(e)return await tu(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tf});return await this._useSession(async e=>{var t,r;let{data:n,error:i}=e;if(i)throw i;return await tu(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(t=n.session)||void 0===t?void 0:t.access_token)&&void 0!==r?r:void 0,xform:tf})})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:n,error:i}=r;if(i)throw i;if(!n.session)throw new e3;let s=n.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await eX(this.storage,this.storageKey));let{data:l,error:u}=await tu(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:s.access_token,xform:tf});if(u)throw u;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return eG(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new e3;let t=Date.now()/1e3,r=t,n=!0,i=null,s=eG(e.access_token);if(s.exp&&(n=(r=s.exp)<=t),n){let{session:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};i=t}else{let{data:n,error:s}=await this._getUser(e.access_token);if(s)throw s;i={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(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(e2(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:n,error:i}=t;if(i)throw i;e=null!==(r=n.session)&&void 0!==r?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new e3;let{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!eF())throw new e6("No browser detected.");if("implicit"!==this.flowType||this._isImplicitGrantFlow()){if("pkce"==this.flowType&&!e)throw new te("Not a valid PKCE flow url.")}else throw new e6("Not a valid implicit grant flow url.");let t=eV(window.location.href);if(e){if(!t.code)throw new te("No code detected.");let{data:e,error:r}=await this._exchangeCodeForSession(t.code);
1if(r)throw r;let n=new URL(window.location.href);return n.searchParams.delete("code"),window.history.replaceState(window.history.state,"",n.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new e6(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});let{provider_token:r,provider_refresh_token:n,access_token:i,refresh_token:s,expires_in:a,expires_at:o,token_type:l}=t;if(!i||!a||!s||!l)throw new e6("No session defined in URL");let u=Math.round(Date.now()/1e3),c=parseInt(a),d=u+c;o&&(d=parseInt(o));let h=d-u;1e3*h<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${c}s`);let f=d-c;u-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,d,u):u-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",f,d,u);let{data:p,error:m}=await this._getUser(i);if(m)throw m;let v={provider_token:r,provider_refresh_token:n,access_token:i,expires_in:c,expires_at:d,refresh_token:s,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:v,redirectType:t.type},error:null}}catch(e){if(e2(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){let e=eV(window.location.href);return!!(eF()&&(e.access_token||e.error_description))}async _isPKCEFlow(){let e=eV(window.location.href),t=await ez(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:n,error:i}=t;if(i)return{error:i};let s=null===(r=n.session)||void 0===r?void 0:r.access_token;if(s){let{error:t}=await this.admin.signOut(s,e);if(t&&!(e2(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await eW(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),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(-1,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:i}=t;if(i)throw i;await (null===(r=this.stateChangeEmitters.get(e))||void 0===r?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?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await eX(this.storage,this.storageKey,!0));try{return await tu(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(e2(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{let{data:r,error:n}=await this._useSession(async t=>{var r,n,i,s,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?void 0:r.redirectTo,scopes:null===(n=e.options)||void 0===n?void 0:n.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await tu(this.fetch,"GET",u,{headers:this.headers,jwt:null!==(a=null===(s=o.session)||void 0===s?void 0:s.access_token)&&void 0!==a?a:void 0})});if(n)throw n;return!eF()||(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),{data:{provider:e.provider,url:null==r?void 0:r.url},error:null}}catch(t){if(e2(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)throw s;
1return await tu(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(n=null===(r=i.session)||void 0===r?void 0:r.access_token)&&void 0!==n?n:void 0})})}catch(e){if(e2(e))return{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 i=Date.now();return await (r=async r=>(await eH(200*r),this._debug(t,"refreshing attempt",r),await tu(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:td})),n=(e,t,r)=>r&&r.error&&tr(r.error)&&Date.now()+(e+1)*200-i<3e4,new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{let t=await r(i);if(!n(i,null,t)){e(t);return}}catch(e){if(!n(i,e)){t(e);return}}})()}))}catch(e){if(this._debug(t,"error",e),e2(e))return{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),eF()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e;let t="#_recoverAndRefresh()";this._debug(t,"begin");try{let r=await ez(this.storage,this.storageKey);if(this._debug(t,"session from storage",r),!this._isValidSession(r)){this._debug(t,"session is not valid"),null!==r&&await this._removeSession();return}let n=Math.round(Date.now()/1e3),i=(null!==(e=r.expires_at)&&void 0!==e?e:1/0)<n+10;if(this._debug(t,`session has${i?"":" not"} expired with margin of 10s`),i){if(this.autoRefreshToken&&r.refresh_token){let{error:e}=await this._callRefreshToken(r.refresh_token);e&&(console.error(e),tr(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(e){this._debug(t,"error",e),console.error(e);return}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new e3;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new eK;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new e3;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let n={session:t.session,error:null};return this.refreshingDeferred.resolve(n),n}catch(e){if(this._debug(n,"error",e),e2(e)){let r={session:null,error:e};return tr(e)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(r),r}throw null===(r=this.refreshingDeferred)||void 0===r||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=[],i=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(i),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),await eB(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await eW(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&eF()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}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){this._debug("#_autoRefreshTokenTick()","no session");return}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.isAcquireTimeout||e instanceof tk)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!eF()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(
1await this.initializePromise,await this._acquireLock(-1,async()=>{if("visible"!==document.visibilityState){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}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 eX(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:i}=t;return i?{data:null,error:i}:await tu(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)return{data:null,error:s};let{data:a,error:o}=await tu(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token});return o?{data:null,error:o}:((null===(n=null==a?void 0:a.totp)||void 0===n?void 0:n.qr_code)&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),{data:a,error:null})})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;if(i)return{data:null,error:i};let{data:s,error:a}=await tu(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token});return a?{data:null,error:a}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:a})})}catch(e){if(e2(e))return{data:null,error:e};throw e}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;return i?{data:null,error:i}:await tu(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e2(e))return{data:null,error:e};throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};let r=(null==e?void 0:e.factors)||[],n=r.filter(e=>"totp"===e.factor_type&&"verified"===e.status);return{data:{all:r,totp:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:n},error:i}=e;if(i)return{data:null,error:i};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let s=this._decodeJWT(n.access_token),a=null;s.aal&&(a=s.aal);let o=a;return(null!==(r=null===(t=n.user.factors)||void 0===t?void 0:t.filter(e=>"verified"===e.status))&&void 0!==r?r:[]).length>0&&(o="aal2"),{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:s.amr||[]},error:null}}))}}tO.nextInstanceID=0;var tC=tO;class tj extends tC{constructor(e){super(e)}}class tR{constructor(e,t,r){var n,i,s,a,o,l,u,c;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw Error("supabaseUrl is required.");
1if(!t)throw Error("supabaseKey is required.");let d=e.replace(/\/$/,"");this.realtimeUrl=`${d}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${d}/auth/v1`,this.storageUrl=`${d}/storage/v1`,this.functionsUrl=`${d}/functions/v1`;let h=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,f=function(e,t){let{db:r,auth:n,realtime:i,global:s}=e,{db:a,auth:o,realtime:l,global:u}=t;return{db:Object.assign(Object.assign({},a),r),auth:Object.assign(Object.assign({},o),n),realtime:Object.assign(Object.assign({},l),i),global:Object.assign(Object.assign({},u),s)}}(null!=r?r:{},{db:eC,realtime:eR,auth:Object.assign(Object.assign({},ej),{storageKey:h}),global:eO});this.storageKey=null!==(i=null===(n=f.auth)||void 0===n?void 0:n.storageKey)&&void 0!==i?i:"",this.headers=null!==(a=null===(s=f.global)||void 0===s?void 0:s.headers)&&void 0!==a?a:{},this.auth=this._initSupabaseAuthClient(null!==(o=f.auth)&&void 0!==o?o:{},this.headers,null===(l=f.global)||void 0===l?void 0:l.fetch),this.fetch=eN(t,this._getAccessToken.bind(this),null===(u=f.global)||void 0===u?void 0:u.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},f.realtime)),this.rest=new F(`${d}/rest/v1`,{headers:this.headers,schema:null===(c=f.db)||void 0===c?void 0:c.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new l(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new eE(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={}){return this.rest.rpc(e,t,r)}channel(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()}_getAccessToken(){var e,t,r,n,i,s;return r=this,n=void 0,i=void 0,s=function*(){let{data:r}=yield this.auth.getSession();return null!==(t=null===(e=r.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null},new(i||(i=Promise))(function(e,t){function a(e){try{l(s.next(e))}catch(e){t(e)}}function o(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof i?r:new i(function(e){e(r)})).then(a,o)}l((s=s.apply(r,n||[])).next())})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,storageKey:i,flowType:s,debug:a},o,l){let u={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new tj({url:this.authUrl,headers:Object.assign(Object.assign({},u),o),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,flowType:s,debug:a,fetch:l})}_initRealtimeClient(e){return new er(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({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.realtime.setAuth(null!=r?r:null),this.changedAccessToken=r):"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}let tA=(e,t,r)=>new tR(e,t,r);function tP(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function tN(e){return function t(r){return 0==arguments.length||tP(r)?t:e.apply(this,arguments)}}function tI(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return tP(r)?t:tN(function(t){return e(r,t)});default:return tP(r)&&tP(n)?t:tP(r)?tN(function(t){return e(t,n)}):tP(n)?tN(function(t){return e(r,t)}):e(r,n)}}}function t$(e){return function t(r,n,i){switch(arguments.length){case 0:return t;case 1:return tP(r)?t:tI(function(t,n){return e(r,t,n)});case 2:return tP(r)&&tP(n)?t:tP(r)?tI(function(t,r){return e(t,n,r)}):tP(n)?tI(function(t,n){return e(r,t,n)}):tN(function(t){return e(r,n,t)});default:return tP(r)&&tP(n)&&tP(i)?t:tP(r)&&tP(n)?tI(function(t,r){return e(t,r,i)}):tP(r)&&tP(i)?tI(function(t,r){return e(t,n,r)}):tP(n)&&tP(i)?tI(function(t,n){return e(r,t,n)}):tP(r)?tN(function(t){return e(t,n,i)}):tP(n)?tN(function(t){return e(r,t,i)}):tP(i)?tN(function(t){return e(r,n,t)}):e(r,n,i)}}}function tD(e){return"[object Object]"===Object.prototype.toString.call(e)}function tL(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var tF=t$(function(e,t,r){var n,i={};for(n in r=r||{},t=t||{})tL(n,t)&&(i[n]=tL(n,r)?e(n,t[n],r[n]):t[n]);for(n in r)tL(n,r)&&!tL(n,i)&&(i[n]=r[n]);return i}),tU=t$(function e(t,r,n){return tF(function(r,n,i){return tD(n)&&tD(i)?e(t,n,i):t(r,n,i)},r,n)}),tM=tI(function(e,t){return tU(function(e,t,r){return r},e,t)}),tV=r(90469);function tZ(){return"undefined"!=typeof window&&void 0!==window.document}var tq={path:"/",sameSite:"lax",httpOnly:!1,maxAge:31536e6};async function tB(e,t){let r=await t(e);if(r)return r;let n=[];for(let r=0;;r++){let i=`${e}.${r}`,s=await t(i);if(!s)break;n.push(s)}if(n.length>0)return n.join("")}async function tz(e,t,r){if(await t(e)){await r(e);return}for(let n=0;;n++){let i=`${e}.${n}`;if(!await t(i))break;await r(i)}}function tW(e,t,r){let n,i;if(!e||!t)throw Error(`Your project's URL and Key are required to create a Supabase client!
2
3Check your Supabase project's API settings to find these values
4
5https://supabase.com/dashboard/project/_/settings/api`);let s={},a=!0;r&&({cookies:s={},isSingleton:a=!0,cookieOptions:n,...i}=r,s=s||{}),(null==n?void 0:n.name)&&(i.auth={...i.auth,storageKey:n.name});let o=tM({global:{headers:{"X-Client-Info":"supabase-ssr/0.3.0"}},auth:{flowType:"pkce",autoRefreshToken:tZ(),detectSessionInUrl:tZ(),persistSession:!0,storage:{isServer:!1,getItem:async e=>await tB(e,async e=>"function"==typeof s.get?await s.get(e):tZ()?(0,tV.Q)(document.cookie)[e]:void 0),setItem:async(e,t)=>{let r=await function(e,t,r){let n=(void 0)??3180,i=encodeURIComponent(t);if(i.length<=n)return[{name:e,value:t}];let s=[];for(;i.length>0;){let e=i.slice(0,n),t=e.lastIndexOf("%");t>n-3&&(e=e.slice(0,t));let r="";for(;e.length>0;)try{r=decodeURIComponent(e);break}catch(t){if(t instanceof URIError&&"%"===e.at(-3)&&e.length>3)e=e.slice(0,e.length-3);else throw t}s.push(r),i=i.slice(e.length)}return s.map((t,r)=>({name:`${e}.${r}`,value:t}))}(e,t);await Promise.all(r.map(async e=>{"function"==typeof s.set?await s.set(e.name,e.value,{...tq,...n,maxAge:tq.maxAge}):tZ()&&(document.cookie=(0,tV.q)(e.name,e.value,{...tq,...n,maxAge:tq.maxAge}))}))},removeItem:async e=>{if("function"==typeof s.remove&&"function"!=typeof s.get){console.log("Removing chunked cookie without a `get` method is not supported.\n\n	When you call the `createBrowserClient` function from the `@supabase/ssr` package, make sure you declare both a `get` and `remove` method on the `cookies` object.\n\nhttps://supabase.com/docs/guides/auth/server-side/creating-a-client");return}await tz(e,async e=>"function"==typeof s.get?await s.get(e):tZ()?(0,tV.Q)(document.cookie)[e]:void 0,async e=>{"function"==typeof s.remove?await s.remove(e,{...tq,...n,maxAge:0}
5):tZ()&&(document.cookie=(0,tV.q)(e,"",{...tq,...n,maxAge:0}))})}}}},i);if(a){let r=tZ();if(r&&w)return w;let n=tA(e,t,o);return r&&(w=n),n}return tA(e,t,o)}},5264:function(e,t,r){"use strict";r.d(t,{D:function(){return a}});var n=r(31229),i=r(25566),s=r(25566);function a(e){let t="object"==typeof e.client?e.client:{},r="object"==typeof e.server?e.server:{},a=e.shared,o=e.runtimeEnv?e.runtimeEnv:{...s.env,...e.experimental__runtimeEnv};return function(e){let t=e.runtimeEnvStrict??e.runtimeEnv??i.env;if(e.emptyStringAsUndefined)for(let[e,r]of Object.entries(t))""===r&&delete t[e];if(e.skipValidation)return t;let r="object"==typeof e.client?e.client:{},s="object"==typeof e.server?e.server:{},a="object"==typeof e.shared?e.shared:{},o=n.z.object(r),l=n.z.object(s),u=n.z.object(a),c=e.isServer??"undefined"==typeof window,d=o.merge(u),h=l.merge(u).merge(o),f=c?h.safeParse(t):d.safeParse(t),p=e.onValidationError??(e=>{throw console.error("❌ Invalid environment variables:",e.flatten().fieldErrors),Error("Invalid environment variables")}),m=e.onInvalidAccess??(e=>{throw Error("❌ Attempted to access a server-side environment variable on the client")});if(!1===f.success)return p(f.error);let v=t=>!e.clientPrefix||!t.startsWith(e.clientPrefix)&&!(t in u.shape),y=e=>c||!v(e),g=e=>"__esModule"===e||"$$typeof"===e,b=(e.extends??[]).reduce((e,t)=>Object.assign(e,t),{});return new Proxy(Object.assign(f.data,b),{get(e,t){if("string"==typeof t&&!g(t))return y(t)?Reflect.get(e,t):m(t)}})}({...e,shared:a,client:t,server:r,clientPrefix:"NEXT_PUBLIC_",runtimeEnv:o})}},87045:function(e,t,r){"use strict";r.d(t,{j:function(){return s}});var n=r(24112),i=r(45345),s=new class extends n.l{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!i.sk&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}}},2894:function(e,t,r){"use strict";r.d(t,{R:function(){return o},m:function(){return a}});var n=r(18238),i=r(7989),s=r(11255),a=class extends i.F{#n;#i;#s;constructor(e){super(),this.mutationId=e.mutationId,this.#i=e.mutationCache,this.#n=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#n.includes(e)||(this.#n.push(e),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#n=this.#n.filter(t=>t!==e),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#n.length||("pending"===this.state.status?this.scheduleGc():this.#i.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){this.#s=(0,s.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#i.canRun(this)});let t="pending"===this.state.status,r=!this.#s.canStart();try{if(!t){this.#a({type:"pending",variables:e,isPaused:r}),await this.#i.config.onMutate?.(e,this);let t=await this.options.onMutate?.(e);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:r})}let n=await this.#s.start();return await this.#i.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#i.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#a({type:"success",data:n}),n}catch(t){try{throw await this.#i.config.onError?.(t,e,this.state.context,this),await this.options.onError?.(t,e,this.state.context),await this.#i.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,t,e,this.state.context),t}finally{this.#a({type:"error",error:t})}}finally{this.#i.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};
5case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.V.batch(()=>{this.#n.forEach(t=>{t.onMutationUpdate(e)}),this.#i.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},18238:function(e,t,r){"use strict";r.d(t,{V:function(){return n}});var n=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},i=e=>setTimeout(e,0),s=n=>{t?e.push(n):i(()=>{r(n)})},a=()=>{let t=e;e=[],t.length&&i(()=>{n(()=>{t.forEach(e=>{r(e)})})})};return{batch:e=>{let r;t++;try{r=e()}finally{--t||a()}return r},batchCalls:e=>(...t)=>{s(()=>{e(...t)})},schedule:s,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{i=e}}}()},57853:function(e,t,r){"use strict";r.d(t,{N:function(){return s}});var n=r(24112),i=r(45345),s=new class extends n.l{#o=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!i.sk&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}}},21733:function(e,t,r){"use strict";r.d(t,{A:function(){return o},z:function(){return l}});var n=r(45345),i=r(18238),s=r(11255),a=r(7989),o=class extends a.F{#l;#u;#c;#s;#d;#h;constructor(e){super(),this.#h=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#c=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#l=function(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=e.state??this.#l,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(e){this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#c.remove(this)}setData(e,t){let r=(0,n.oE)(this.state.data,e,this.options);return this.#a({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#a({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(n.ZT).catch(n.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#l)}isActive(){return this.observers.some(e=>!1!==(0,n.Nc)(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!(0,n.Kp)(this.state.dataUpdatedAt,e)}onFocus(){let e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){let e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#c.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>
5t!==e),this.observers.length||(this.#s&&(this.#h?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#c.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,i=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#h=!0,r.signal)})},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{let e=(0,n.cG)(this.options,t),r={queryKey:this.queryKey,meta:this.meta};return(i(r),this.#h=!1,this.options.persister)?this.options.persister(e,r,this):e(r)}};i(a),this.options.behavior?.onFetch(a,this),this.#u=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#a({type:"fetch",meta:a.fetchOptions?.meta});let o=e=>{(0,s.DV)(e)&&e.silent||this.#a({type:"error",error:e}),(0,s.DV)(e)||(this.#c.config.onError?.(e,this),this.#c.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#s=(0,s.Mz)({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{if(void 0===e){o(Error(`${this.queryHash} data is undefined`));return}this.setData(e),this.#c.config.onSuccess?.(e,this),this.#c.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:o,onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#s.start()}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...l(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let r=e.error;if((0,s.DV)(r)&&r.revert&&this.#u)return{...this.#u,fetchStatus:"idle"};return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),i.V.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#c.notify({query:this,type:"updated",action:e})})}};function l(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,s.Kw)(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}},7989:function(e,t,r){"use strict";r.d(t,{F:function(){return i}});var n=r(45345),i=class{#f;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,n.PN)(this.gcTime)&&(this.#f=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(n.sk?1/0:3e5))}clearGcTimeout(){this.#f&&(clearTimeout(this.#f),this.#f=void 0)}}},11255:function(e,t,r){"use strict";r.d(t,{DV:function(){return u},Kw:function(){return o},Mz:function(){return c}});var n=r(87045),i=r(57853),s=r(45345);function a(e){return Math.min(1e3*2**e,3e4)}function o(e){return(e??"online")!=="online"||i.N.isOnline()}var l=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function u(e){return e instanceof l}function c(e){let t,r,u,c=!1,d=0,h=!1,f=new Promise((e,t)=>{r=e,u=t}),p=()=>n.j.isFocused()&&("always"===e.networkMode||i.N.isOnline())&&e.canRun(),m=()=>
5o(e.networkMode)&&e.canRun(),v=n=>{h||(h=!0,e.onSuccess?.(n),t?.(),r(n))},y=r=>{h||(h=!0,e.onError?.(r),t?.(),u(r))},g=()=>new Promise(r=>{t=e=>{(h||p())&&r(e)},e.onPause?.()}).then(()=>{t=void 0,h||e.onContinue?.()}),b=()=>{let t;if(h)return;let r=0===d?e.initialPromise:void 0;try{t=r??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(v).catch(t=>{if(h)return;let r=e.retry??(s.sk?0:3),n=e.retryDelay??a,i="function"==typeof n?n(d,t):n,o=!0===r||"number"==typeof r&&d<r||"function"==typeof r&&r(d,t);if(c||!o){y(t);return}d++,e.onFail?.(d,t),(0,s._v)(i).then(()=>p()?void 0:g()).then(()=>{c?y(t):b()})})};return{promise:f,cancel:t=>{h||(y(new l(t)),e.abort?.())},continue:()=>(t?.(),f),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1},canStart:m,start:()=>(m()?b():g().then(b),f)}}},24112:function(e,t,r){"use strict";r.d(t,{l:function(){return n}});var n=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},45345:function(e,t,r){"use strict";r.d(t,{CN:function(){return S},Ht:function(){return k},KC:function(){return l},Kp:function(){return o},Nc:function(){return u},PN:function(){return a},Rm:function(){return h},SE:function(){return s},VS:function(){return m},VX:function(){return w},X7:function(){return d},Ym:function(){return f},ZT:function(){return i},_v:function(){return b},_x:function(){return c},cG:function(){return x},oE:function(){return _},sk:function(){return n},to:function(){return p}});var n="undefined"==typeof window||"Deno"in globalThis;function i(){}function s(e,t){return"function"==typeof e?e(t):e}function a(e){return"number"==typeof e&&e>=0&&e!==1/0}function o(e,t){return Math.max(e+(t||0)-Date.now(),0)}function l(e,t){return"function"==typeof e?e(t):e}function u(e,t){return"function"==typeof e?e(t):e}function c(e,t){let{type:r="all",exact:n,fetchStatus:i,predicate:s,queryKey:a,stale:o}=e;if(a){if(n){if(t.queryHash!==h(a,t.options))return!1}else if(!p(t.queryKey,a))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof o||t.isStale()===o)&&(!i||i===t.state.fetchStatus)&&(!s||!!s(t))}function d(e,t){let{exact:r,status:n,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(r){if(f(t.options.mutationKey)!==f(s))return!1}else if(!p(t.options.mutationKey,s))return!1}return(!n||t.state.status===n)&&(!i||!!i(t))}function h(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>y(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function p(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&!Object.keys(t).some(r=>!p(e[r],t[r]))}function m(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function v(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function y(e){if(!g(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!(g(r)&&r.hasOwnProperty("isPrototypeOf"))&&Object.getPrototypeOf(e)===Object.prototype}function g(e){return"[object Object]"===Object.prototype.toString.call(e)}function b(e){return new Promise(t=>{setTimeout(t,e)})}function _(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=v(t)&&v(r);if(n||y(t)&&y(r)){let i=n?t:Object.keys(t),s=i.length,a=n?r:Object.keys(r),o=a.length,l=n?[]:{},u=0;for(let s=0;s<o;s++){let o=n?s:a[s];(!n&&i.includes(o)||n)&&void 0===t[o]&&void 0===r[o]?(l[o]=void 0,u++):(l[o]=e(t[o],r[o]),l[o]===t[o]&&void 0!==t[o]&&u++)}return s===o&&u===s?t:l}return r}(e,t):t}function w(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n}function k(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var S=Symbol();function x(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==S?e.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`))}},29827:function(e,t,r){"use strict";r.d(t,{NL:function(){return a},aH:function(){return o}});var n=r(2265),i=r(57437),s=n.createContext(void 0),a=e=>{let t=n.useContext(s);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},o=e=>{let{client:t,children:r}=e;return n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,i.jsx)(s.Provider,{value:t,children:r})}},21770:function(e,t,r){"use strict";r.d(t,{D:function(){return d}});var n=r(2265),i=r(2894),s=r(18238),a=r(24112),o=r(45345),l=class extends a.l{#p;#m=void 0;#v;#y;constructor(e,t){super(),this.#p=e,this.setOptions(t),this.bindMethods(),this.#g()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#p.defaultMutationOptions(e),(0,o.VS)(this.options,t)||this.#p.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#v,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.Ym)(t.mutationKey)!==(0,o.Ym)(this.options.mutationKey)?this.reset():this.#v?.state.status==="pending"&&this.#v.
5setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#v?.removeObserver(this)}onMutationUpdate(e){this.#g(),this.#b(e)}getCurrentResult(){return this.#m}reset(){this.#v?.removeObserver(this),this.#v=void 0,this.#g(),this.#b()}mutate(e,t){return this.#y=t,this.#v?.removeObserver(this),this.#v=this.#p.getMutationCache().build(this.#p,this.options),this.#v.addObserver(this),this.#v.execute(e)}#g(){let e=this.#v?.state??(0,i.R)();this.#m={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#b(e){s.V.batch(()=>{if(this.#y&&this.hasListeners()){let t=this.#m.variables,r=this.#m.context;e?.type==="success"?(this.#y.onSuccess?.(e.data,t,r),this.#y.onSettled?.(e.data,null,t,r)):e?.type==="error"&&(this.#y.onError?.(e.error,t,r),this.#y.onSettled?.(void 0,e.error,t,r))}this.listeners.forEach(e=>{e(this.#m)})})}},u=r(29827),c=r(51172);function d(e,t){let r=(0,u.NL)(t),[i]=n.useState(()=>new l(r,e));n.useEffect(()=>{i.setOptions(e)},[i,e]);let a=n.useSyncExternalStore(n.useCallback(e=>i.subscribe(s.V.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=n.useCallback((e,t)=>{i.mutate(e,t).catch(c.Z)},[i]);if(a.error&&(0,c.L)(i.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}},16593:function(e,t,r){"use strict";let n;r.d(t,{a:function(){return O}});var i=r(45345),s=r(18238),a=r(87045),o=r(24112),l=r(21733),u=class extends o.l{constructor(e,t){super(),this.options=t,this.#p=e,this.#_=null,this.bindMethods(),this.setOptions(t)}#p;#w=void 0;#k=void 0;#m=void 0;#S;#x;#_;#E;#T;#O;#C;#j;#R;#A=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#w.addObserver(this),c(this.#w,this.options)?this.#P():this.updateResult(),this.#N())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return d(this.#w,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return d(this.#w,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#I(),this.#$(),this.#w.removeObserver(this)}setOptions(e,t){let r=this.options,n=this.#w;if(this.options=this.#p.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,i.Nc)(this.options.enabled,this.#w))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#D(),this.#w.setOptions(this.options),r._defaulted&&!(0,i.VS)(this.options,r)&&this.#p.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#w,observer:this});let s=this.hasListeners();s&&h(this.#w,n,this.options,r)&&this.#P(),this.updateResult(t),s&&(this.#w!==n||(0,i.Nc)(this.options.enabled,this.#w)!==(0,i.Nc)(r.enabled,this.#w)||(0,i.KC)(this.options.staleTime,this.#w)!==(0,i.KC)(r.staleTime,this.#w))&&this.#L();let a=this.#F();s&&(this.#w!==n||(0,i.Nc)(this.options.enabled,this.#w)!==(0,i.Nc)(r.enabled,this.#w)||a!==this.#R)&&this.#U(a)}getOptimisticResult(e){let t=this.#p.getQueryCache().build(this.#p,e),r=this.createResult(t,e);return(0,i.VS)(this.getCurrentResult(),r)||(this.#m=r,this.#x=this.options,this.#S=this.#w.state),r}getCurrentResult(){return this.#m}trackResult(e,t){let r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})}),r}trackProp(e){this.#A.add(e)}getCurrentQuery(){return this.#w}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#p.defaultQueryOptions(e),r=this.#p.getQueryCache().build(this.#p,t);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#P({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#m))}#P(e){this.#D();let t=this.#w.fetch(this.options,e);return e?.throwOnError||(t=t.catch(i.ZT)),t}#L(){this.#I();let e=(0,i.KC)(this.options.staleTime,this.#w);if(i.sk||this.#m.isStale||!(0,i.PN)(e))return;let t=(0,i.Kp)(this.#m.dataUpdatedAt,e);this.#C=setTimeout(()=>{this.#m.isStale||this.updateResult()},t+1)}#F(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#w):this.options.refetchInterval)??!1}#U(e){this.#$(),this.#R=e,!i.sk&&!1!==(0,i.Nc)(this.options.enabled,this.#w)&&(0,i.PN)(this.#R)&&0!==this.#R&&(this.#j=setInterval(()=>
5{(this.options.refetchIntervalInBackground||a.j.isFocused())&&this.#P()},this.#R))}#N(){this.#L(),this.#U(this.#F())}#I(){this.#C&&(clearTimeout(this.#C),this.#C=void 0)}#$(){this.#j&&(clearInterval(this.#j),this.#j=void 0)}createResult(e,t){let r;let n=this.#w,s=this.options,a=this.#m,o=this.#S,u=this.#x,d=e!==n?e.state:this.#k,{state:p}=e,m={...p},v=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&c(e,t),a=r&&h(e,n,t,s);(i||a)&&(m={...m,...(0,l.z)(p.data,e.options)}),"isRestoring"===t._optimisticResults&&(m.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:b}=m;if(t.select&&void 0!==m.data){if(a&&m.data===o?.data&&t.select===this.#E)r=this.#T;else try{this.#E=t.select,r=t.select(m.data),r=(0,i.oE)(a?.data,r,t),this.#T=r,this.#_=null}catch(e){this.#_=e}}else r=m.data;if(void 0!==t.placeholderData&&void 0===r&&"pending"===b){let e;if(a?.isPlaceholderData&&t.placeholderData===u?.placeholderData)e=a.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#O?.state.data,this.#O):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#_=null}catch(e){this.#_=e}void 0!==e&&(b="success",r=(0,i.oE)(a?.data,e,t),v=!0)}this.#_&&(y=this.#_,r=this.#T,g=Date.now(),b="error");let _="fetching"===m.fetchStatus,w="pending"===b,k="error"===b,S=w&&_,x=void 0!==r;return{status:b,fetchStatus:m.fetchStatus,isPending:w,isSuccess:"success"===b,isError:k,isInitialLoading:S,isLoading:S,data:r,dataUpdatedAt:m.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:_,isRefetching:_&&!w,isLoadingError:k&&!x,isPaused:"paused"===m.fetchStatus,isPlaceholderData:v,isRefetchError:k&&x,isStale:f(e,t),refetch:this.refetch}}updateResult(e){let t=this.#m,r=this.createResult(this.#w,this.options);if(this.#S=this.#w.state,this.#x=this.options,void 0!==this.#S.data&&(this.#O=this.#w),(0,i.VS)(r,t))return;this.#m=r;let n={};e?.listeners!==!1&&(()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#A.size)return!0;let n=new Set(r??this.#A);return this.options.throwOnError&&n.add("error"),Object.keys(this.#m).some(e=>this.#m[e]!==t[e]&&n.has(e))})()&&(n.listeners=!0),this.#b({...n,...e})}#D(){let e=this.#p.getQueryCache().build(this.#p,this.options);if(e===this.#w)return;let t=this.#w;this.#w=e,this.#k=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#N()}#b(e){s.V.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#m)}),this.#p.getQueryCache().notify({query:this.#w,type:"observerResultsUpdated"})})}};function c(e,t){return!1!==(0,i.Nc)(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)||void 0!==e.state.data&&d(e,t,t.refetchOnMount)}function d(e,t,r){if(!1!==(0,i.Nc)(t.enabled,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&f(e,t)}return!1}function h(e,t,r,n){return(e!==t||!1===(0,i.Nc)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&f(e,r)}function f(e,t){return!1!==(0,i.Nc)(t.enabled,e)&&e.isStaleByTime((0,i.KC)(t.staleTime,e))}var p=r(2265);r(57437);var m=p.createContext((n=!1,{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n})),v=()=>p.useContext(m),y=r(29827),g=p.createContext(!1),b=()=>p.useContext(g);g.Provider;var _=r(51172),w=(e,t)=>{(e.suspense||e.throwOnError)&&!t.isReset()&&(e.retryOnMount=!1)},k=e=>{p.useEffect(()=>{e.clearReset()},[e])},S=e=>{let{result:t,errorResetBoundary:r,throwOnError:n,query:i}=e;return t.isError&&!r.isReset()&&!t.isFetching&&i&&(0,_.L)(n,[t.error,i])},x=e=>{e.suspense&&("number"!=typeof e.staleTime&&(e.staleTime=1e3),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3)))},E=(e,t)=>e?.suspense&&t.isPending,T=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function O(e,t){return function(e,t,r){var n,i,a,o;let l=(0,y.NL)(r),u=b(),c=v(),d=l.defaultQueryOptions(e);
5null===(i=l.getDefaultOptions().queries)||void 0===i||null===(n=i._experimental_beforeQuery)||void 0===n||n.call(i,d),d._optimisticResults=u?"isRestoring":"optimistic",x(d),w(d,c),k(c);let[h]=p.useState(()=>new t(l,d)),f=h.getOptimisticResult(d);if(p.useSyncExternalStore(p.useCallback(e=>{let t=u?()=>void 0:h.subscribe(s.V.batchCalls(e));return h.updateResult(),t},[h,u]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),p.useEffect(()=>{h.setOptions(d,{listeners:!1})},[d,h]),E(d,f))throw T(d,h,c);if(S({result:f,errorResetBoundary:c,throwOnError:d.throwOnError,query:l.getQueryCache().get(d.queryHash)}))throw f.error;return null===(o=l.getDefaultOptions().queries)||void 0===o||null===(a=o._experimental_afterQuery)||void 0===a||a.call(o,d,f),d.notifyOnChangeProps?f:h.trackResult(f)}(e,u,t)}},51172:function(e,t,r){"use strict";function n(e,t){return"function"==typeof e?e(...t):!!e}function i(){}r.d(t,{L:function(){return n},Z:function(){return i}})},77712:function(e,t,r){"use strict";r.d(t,{j:function(){return s}});let n=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,i=function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=function e(t){var r,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t){if(Array.isArray(t))for(r=0;r<t.length;r++)t[r]&&(n=e(t[r]))&&(i&&(i+=" "),i+=n);else for(r in t)t[r]&&(i&&(i+=" "),i+=r)}return i}(e))&&(n&&(n+=" "),n+=t);return n},s=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return i(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:o}=t,l=Object.keys(a).map(e=>{let t=null==r?void 0:r[e],i=null==o?void 0:o[e];if(null===t)return null;let s=n(t)||n(i);return a[e][s]}),u=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return i(e,l,null==t?void 0:null===(s=t.compoundVariants)||void 0===s?void 0:s.reduce((e,t)=>{let{class:r,className:n,...i}=t;return Object.entries(i).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...u}[t]):({...o,...u})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},29501:function(e,t,r){"use strict";r.d(t,{Gc:function(){return T},KN:function(){return L},Qr:function(){return D},RV:function(){return O},U2:function(){return y},cI:function(){return eS},t8:function(){return w}});var n=r(2265),i=e=>"checkbox"===e.type,s=e=>e instanceof Date,a=e=>null==e;let o=e=>"object"==typeof e;var l=e=>!a(e)&&!Array.isArray(e)&&o(e)&&!s(e),u=e=>l(e)&&e.target?i(e.target)?e.target.checked:e.target.value:e,c=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,d=(e,t)=>e.has(c(t)),h=e=>{let t=e.constructor&&e.constructor.prototype;return l(t)&&t.hasOwnProperty("isPrototypeOf")},f="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function p(e){let t;let r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(f&&(e instanceof Blob||e instanceof FileList))&&(r||l(e))))return e;else if(t=r?[]:{},r||h(e))for(let r in e)e.hasOwnProperty(r)&&(t[r]=p(e[r]));else t=e;return t}var m=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,y=(e,t,r)=>{if(!t||!l(e))return r;let n=m(t.split(/[,[\].]+?/)).reduce((e,t)=>a(e)?e:e[t],e);return v(n)||n===e?v(e[t])?r:e[t]:n},g=e=>"boolean"==typeof e,b=e=>/^\w*$/.test(e),_=e=>m(e.replace(/["|']|\]/g,"").split(/\.|\[/)),w=(e,t,r)=>{let n=-1,i=b(t)?[t]:_(t),s=i.length,a=s-1;for(;++n<s;){let t=i[n],s=r;if(n!==a){let r=e[t];
5s=l(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t)return;e[t]=s,e=e[t]}return e};let k={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},S={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},x={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},E=n.createContext(null),T=()=>n.useContext(E),O=e=>{let{children:t,...r}=e;return n.createElement(E.Provider,{value:r},t)};var C=(e,t,r,n=!0)=>{let i={defaultValues:t._defaultValues};for(let s in e)Object.defineProperty(i,s,{get:()=>(t._proxyFormState[s]!==S.all&&(t._proxyFormState[s]=!n||S.all),r&&(r[s]=!0),e[s])});return i},j=e=>l(e)&&!Object.keys(e).length,R=(e,t,r,n)=>{r(e);let{name:i,...s}=e;return j(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||S.all))},A=e=>Array.isArray(e)?e:[e],P=(e,t,r)=>!e||!t||e===t||A(e).some(e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e)));function N(e){let t=n.useRef(e);t.current=e,n.useEffect(()=>{let r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var I=e=>"string"==typeof e,$=(e,t,r,n,i)=>I(e)?(n&&t.watch.add(e),y(r,e,i)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),y(r,e))):(n&&(t.watchAll=!0),r);let D=e=>e.render(function(e){let t=T(),{name:r,disabled:i,control:s=t.control,shouldUnregister:a}=e,o=d(s._names.array,r),l=function(e){let t=T(),{control:r=t.control,name:i,defaultValue:s,disabled:a,exact:o}=e||{},l=n.useRef(i);l.current=i,N({disabled:a,subject:r._subjects.values,next:e=>{P(l.current,e.name,o)&&c(p($(l.current,r._names,e.values||r._formValues,!1,s)))}});let[u,c]=n.useState(r._getWatch(i,s));return n.useEffect(()=>r._removeUnmounted()),u}({control:s,name:r,defaultValue:y(s._formValues,r,y(s._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){let t=T(),{control:r=t.control,disabled:i,name:s,exact:a}=e||{},[o,l]=n.useState(r._formState),u=n.useRef(!0),c=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=n.useRef(s);return d.current=s,N({disabled:i,next:e=>u.current&&P(d.current,e.name,a)&&R(e,c.current,r._updateFormState)&&l({...r._formState,...e}),subject:r._subjects.state}),n.useEffect(()=>(u.current=!0,c.current.isValid&&r._updateValid(!0),()=>{u.current=!1}),[r]),C(o,r,c.current,!1)}({control:s,name:r,exact:!0}),h=n.useRef(s.register(r,{...e.rules,value:l,...g(e.disabled)?{disabled:e.disabled}:{}}));return n.useEffect(()=>{let e=s._options.shouldUnregister||a,t=(e,t)=>{let r=y(s._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=p(y(s._options.defaultValues,r));w(s._defaultValues,r,e),v(y(s._formValues,r))&&w(s._formValues,r,e)}return()=>{(o?e&&!s._state.action:e)?s.unregister(r):t(r,!1)}},[r,s,o,a]),n.useEffect(()=>{y(s._fields,r)&&s._updateDisabledField({disabled:i,fields:s._fields,name:r,value:y(s._fields,r)._f.value})},[i,r,s]),{field:{name:r,value:l,...g(i)||c.disabled?{disabled:c.disabled||i}:{},onChange:n.useCallback(e=>h.current.onChange({target:{value:u(e),name:r},type:k.CHANGE}),[r]),onBlur:n.useCallback(()=>h.current.onBlur({target:{value:y(s._formValues,r),name:r},type:k.BLUR}),[r,s]),ref:n.useCallback(e=>{let t=y(s._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[s._fields,r])},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!y(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!y(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!y(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!y(c.validatingFields,r)},error:{enumerable:!0,get:()=>y(c.errors,r)}})}}(e));var L=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},F=e=>({isOnSubmit:!e||e===S.onSubmit,isOnBlur:e===S.onBlur,isOnChange:e===S.onChange,isOnAll:e===S.all,isOnTouch:e===S.onTouched}),U=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let M=(e,t,r,n)=>{for(let i of r||Object.keys(e)){let r=y(e,i);if(r){let{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!n||e.ref&&t(e.ref,e.name)&&!n)return!0;
5if(M(s,t))break}else if(l(s)&&M(s,t))break}}};var V=(e,t,r)=>{let n=A(y(e,r));return w(n,"root",t[r]),w(e,r,n),e},Z=e=>"file"===e.type,q=e=>"function"==typeof e,B=e=>{if(!f)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},z=e=>I(e),W=e=>"radio"===e.type,K=e=>e instanceof RegExp;let G={value:!1,isValid:!1},H={value:!0,isValid:!0};var J=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?H:{value:e[0].value,isValid:!0}:H:G}return G};let Q={isValid:!1,value:null};var Y=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Q):Q;function X(e,t,r="validate"){if(z(e)||Array.isArray(e)&&e.every(z)||g(e)&&!e)return{type:r,message:z(e)?e:"",ref:t}}var ee=e=>l(e)&&!K(e)?e:{value:e,message:""},et=async(e,t,r,n,s)=>{let{ref:o,refs:u,required:c,maxLength:d,minLength:h,min:f,max:p,pattern:m,validate:b,name:_,valueAsNumber:w,mount:k,disabled:S}=e._f,E=y(t,_);if(!k||S)return{};let T=u?u[0]:o,O=e=>{n&&T.reportValidity&&(T.setCustomValidity(g(e)?"":e||""),T.reportValidity())},C={},R=W(o),A=i(o),P=(w||Z(o))&&v(o.value)&&v(E)||B(o)&&""===o.value||""===E||Array.isArray(E)&&!E.length,N=L.bind(null,_,r,C),$=(e,t,r,n=x.maxLength,i=x.minLength)=>{let s=e?t:r;C[_]={type:e?n:i,message:s,ref:o,...N(e?n:i,s)}};if(s?!Array.isArray(E)||!E.length:c&&(!(R||A)&&(P||a(E))||g(E)&&!E||A&&!J(u).isValid||R&&!Y(u).isValid)){let{value:e,message:t}=z(c)?{value:!!c,message:c}:ee(c);if(e&&(C[_]={type:x.required,message:t,ref:T,...N(x.required,t)},!r))return O(t),C}if(!P&&(!a(f)||!a(p))){let e,t;let n=ee(p),i=ee(f);if(a(E)||isNaN(E)){let r=o.valueAsDate||new Date(E),s=e=>new Date(new Date().toDateString()+" "+e),a="time"==o.type,l="week"==o.type;I(n.value)&&E&&(e=a?s(E)>s(n.value):l?E>n.value:r>new Date(n.value)),I(i.value)&&E&&(t=a?s(E)<s(i.value):l?E<i.value:r<new Date(i.value))}else{let r=o.valueAsNumber||(E?+E:E);a(n.value)||(e=r>n.value),a(i.value)||(t=r<i.value)}if((e||t)&&($(!!e,n.message,i.message,x.max,x.min),!r))return O(C[_].message),C}if((d||h)&&!P&&(I(E)||s&&Array.isArray(E))){let e=ee(d),t=ee(h),n=!a(e.value)&&E.length>+e.value,i=!a(t.value)&&E.length<+t.value;if((n||i)&&($(n,e.message,t.message),!r))return O(C[_].message),C}if(m&&!P&&I(E)){let{value:e,message:t}=ee(m);if(K(e)&&!E.match(e)&&(C[_]={type:x.pattern,message:t,ref:o,...N(x.pattern,t)},!r))return O(t),C}if(b){if(q(b)){let e=X(await b(E,t),T);if(e&&(C[_]={...e,...N(x.validate,e.message)},!r))return O(e.message),C}else if(l(b)){let e={};for(let n in b){if(!j(e)&&!r)break;let i=X(await b[n](E,t),T,n);i&&(e={...i,...N(n,i.message)},O(i.message),r&&(C[_]=e))}if(!j(e)&&(C[_]={ref:T,...e},!r))return C}}return O(!0),C};function er(e,t){let r=Array.isArray(t)?t:b(t)?[t]:_(t),n=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,n=0;for(;n<r;)e=v(e)?n++:e[t[n++]];return e}(e,r),i=r.length-1,s=r[i];return n&&delete n[s],0!==i&&(l(n)&&j(n)||Array.isArray(n)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}(n))&&er(e,r.slice(0,-1)),e}var en=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},ei=e=>a(e)||!o(e);function es(e,t){if(ei(e)||ei(t))return e===t;if(s(e)&&s(t))return e.getTime()===t.getTime();let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){let r=e[i];if(!n.includes(i))return!1;if("ref"!==i){let e=t[i];if(s(r)&&s(e)||l(r)&&l(e)||Array.isArray(r)&&Array.isArray(e)?!es(r,e):r!==e)return!1}}return!0}var ea=e=>"select-multiple"===e.type,eo=e=>W(e)||i(e),el=e=>B(e)&&e.isConnected,eu=e=>{for(let t in e)if(q(e[t]))return!0;return!1};function ec(e,t={}){let r=Array.isArray(e);if(l(e)||r)for(let r in e)Array.isArray(e[r])||l(e[r])&&!eu(e[r])?(t[r]=Array.isArray(e[r])?[]:{},ec(e[r],t[r])):a(e[r])||(t[r]=!0);return t}var ed=(e,t)=>(function e(t,r,n){let i=Array.isArray(t);if(l(t)||i)for(let i in t)Array.isArray(t[i])||l(t[i])&&!eu(t[i])?v(r)||ei(n[i])?n[i]=Array.isArray(t[i])?ec(t[i],[]):{...ec(t[i])}:e(t[i],a(r)?{}:r[i],n[i]):n[i]=!es(t[i],r[i]);return n}
5)(e,t,ec(t)),eh=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>v(e)?e:t?""===e?NaN:e?+e:e:r&&I(e)?new Date(e):n?n(e):e;function ef(e){let t=e.ref;return(e.refs?e.refs.every(e=>e.disabled):t.disabled)?void 0:Z(t)?t.files:W(t)?Y(e.refs).value:ea(t)?[...t.selectedOptions].map(({value:e})=>e):i(t)?J(e.refs).value:eh(v(t.value)?e.ref.value:t.value,e)}var ep=(e,t,r,n)=>{let i={};for(let r of e){let e=y(t,r);e&&w(i,r,e._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},em=e=>v(e)?e:K(e)?e.source:l(e)?K(e.value)?e.value.source:e.value:e;let ev="AsyncFunction";var ey=e=>(!e||!e.validate)&&!!(q(e.validate)&&e.validate.constructor.name===ev||l(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ev)),eg=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function eb(e,t,r){let n=y(e,r);if(n||b(r))return{error:n,name:r};let i=r.split(".");for(;i.length;){let n=i.join("."),s=y(t,n),a=y(e,n);if(s&&!Array.isArray(s)&&r!==n)break;if(a&&a.type)return{name:n,error:a};i.pop()}return{name:r}}var e_=(e,t,r,n,i)=>!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?!n.isOnChange:!i.isOnChange)||e),ew=(e,t)=>!m(y(e,t)).length&&er(e,t);let ek={mode:S.onSubmit,reValidateMode:S.onChange,shouldFocusError:!0};function eS(e={}){let t=n.useRef(),r=n.useRef(),[o,c]=n.useState({isDirty:!1,isValidating:!1,isLoading:q(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:q(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(e={}){let t,r={...ek,...e},n={submitCount:0,isDirty:!1,isLoading:q(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},o={},c=(l(r.defaultValues)||l(r.values))&&p(r.defaultValues||r.values)||{},h=r.shouldUnregister?{}:p(c),b={action:!1,mount:!1,watch:!1},_={mount:new Set,unMount:new Set,array:new Set,watch:new Set},x=0,E={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},T={values:en(),array:en(),state:en()},O=F(r.mode),C=F(r.reValidateMode),R=r.criteriaMode===S.all,P=e=>t=>{clearTimeout(x),x=setTimeout(e,t)},N=async e=>{if(E.isValid||e){let e=r.resolver?j((await G()).errors):await J(o,!0);e!==n.isValid&&T.state.next({isValid:e})}},D=(e,t)=>{(E.isValidating||E.validatingFields)&&((e||Array.from(_.mount)).forEach(e=>{e&&(t?w(n.validatingFields,e,t):er(n.validatingFields,e))}),T.state.next({validatingFields:n.validatingFields,isValidating:!j(n.validatingFields)}))},L=(e,t)=>{w(n.errors,e,t),T.state.next({errors:n.errors})},z=(e,t,r,n)=>{let i=y(o,e);if(i){let s=y(h,e,v(r)?y(c,e):r);v(s)||n&&n.defaultChecked||t?w(h,e,t?s:ef(i._f)):X(e,s),b.mount&&N()}},W=(e,t,r,i,s)=>{let a=!1,l=!1,u={name:e},d=!!(y(o,e)&&y(o,e)._f&&y(o,e)._f.disabled);if(!r||i){E.isDirty&&(l=n.isDirty,n.isDirty=u.isDirty=Q(),a=l!==u.isDirty);let r=d||es(y(c,e),t);l=!!(!d&&y(n.dirtyFields,e)),r||d?er(n.dirtyFields,e):w(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,a=a||E.dirtyFields&&!r!==l}if(r){let t=y(n.touchedFields,e);t||(w(n.touchedFields,e,r),u.touchedFields=n.touchedFields,a=a||E.touchedFields&&t!==r)}return a&&s&&T.state.next(u),a?u:{}},K=(r,i,s,a)=>{let o=y(n.errors,r),l=E.isValid&&g(i)&&n.isValid!==i;if(e.delayError&&s?(t=P(()=>L(r,s)))(e.delayError):(clearTimeout(x),t=null,s?w(n.errors,r,s):er(n.errors,r)),(s?!es(o,s):o)||!j(a)||l){let e={...a,...l&&g(i)?{isValid:i}:{},errors:n.errors,name:r};n={...n,...e},T.state.next(e)}},G=async e=>{D(e,!0);let t=await r.resolver(h,r.context,ep(e||_.mount,o,r.criteriaMode,r.shouldUseNativeValidation));return D(e),t},H=async e=>{let{errors:t}=await G(e);if(e)for(let r of e){let e=y(t,r);e?w(n.errors,r,e):er(n.errors,r)}else n.errors=t;return t},J=async(e,t,i={valid:!0})=>{for(let s in e){let a=e[s];if(a){let{_f:e,...o}=a;if(e){let o=_.array.has(e.name),l=a._f&&ey(a._f);l&&E.validatingFields&&D([s],!0);let u=await et(a,h,R,r.shouldUseNativeValidation&&!t,o);
5if(l&&E.validatingFields&&D([s]),u[e.name]&&(i.valid=!1,t))break;t||(y(u,e.name)?o?V(n.errors,u,e.name):w(n.errors,e.name,u[e.name]):er(n.errors,e.name))}j(o)||await J(o,t,i)}}return i.valid},Q=(e,t)=>(e&&t&&w(h,e,t),!es(ex(),c)),Y=(e,t,r)=>$(e,_,{...b.mount?h:v(t)?c:I(e)?{[e]:t}:t},r,t),X=(e,t,r={})=>{let n=y(o,e),s=t;if(n){let r=n._f;r&&(r.disabled||w(h,e,eh(t,r)),s=B(r.ref)&&a(t)?"":t,ea(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?i(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(s)?!!s.find(t=>t===e.value):s===e.value)):r.refs[0]&&(r.refs[0].checked=!!s):r.refs.forEach(e=>e.checked=e.value===s):Z(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||T.values.next({name:e,values:{...h}})))}(r.shouldDirty||r.shouldTouch)&&W(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&eS(e)},ee=(e,t,r)=>{for(let n in t){let i=t[n],a=`${e}.${n}`,l=y(o,a);!_.array.has(e)&&ei(i)&&(!l||l._f)||s(i)?X(a,i,r):ee(a,i,r)}},eu=(e,t,r={})=>{let i=y(o,e),s=_.array.has(e),l=p(t);w(h,e,l),s?(T.array.next({name:e,values:{...h}}),(E.isDirty||E.dirtyFields)&&r.shouldDirty&&T.state.next({name:e,dirtyFields:ed(c,h),isDirty:Q(e,l)})):!i||i._f||a(l)?X(e,l,r):ee(e,l,r),U(e,_)&&T.state.next({...n}),T.values.next({name:b.mount?e:void 0,values:{...h}})},ec=async i=>{b.mount=!0;
5let s=i.target,a=s.name,l=!0,c=y(o,a),d=e=>{l=Number.isNaN(e)||es(e,y(h,a,e))};if(c){let f,p;let m=s.type?ef(c._f):u(i),v=i.type===k.BLUR||i.type===k.FOCUS_OUT,g=!eg(c._f)&&!r.resolver&&!y(n.errors,a)&&!c._f.deps||e_(v,y(n.touchedFields,a),n.isSubmitted,C,O),b=U(a,_,v);w(h,a,m),v?(c._f.onBlur&&c._f.onBlur(i),t&&t(0)):c._f.onChange&&c._f.onChange(i);let S=W(a,m,v,!1),x=!j(S)||b;if(v||T.values.next({name:a,type:i.type,values:{...h}}),g)return E.isValid&&("onBlur"===e.mode?v&&N():N()),x&&T.state.next({name:a,...b?{}:S});if(!v&&b&&T.state.next({...n}),r.resolver){let{errors:e}=await G([a]);if(d(m),l){let t=eb(n.errors,o,a),r=eb(e,o,t.name||a);f=r.error,a=r.name,p=j(e)}}else D([a],!0),f=(await et(c,h,R,r.shouldUseNativeValidation))[a],D([a]),d(m),l&&(f?p=!1:E.isValid&&(p=await J(o,!0)));l&&(c._f.deps&&eS(c._f.deps),K(a,p,f,S))}},ev=(e,t)=>{if(y(n.errors,t)&&e.focus)return e.focus(),1},eS=async(e,t={})=>{let i,s;let a=A(e);if(r.resolver){let t=await H(v(e)?e:a);i=j(t),s=e?!a.some(e=>y(t,e)):i}else e?((s=(await Promise.all(a.map(async e=>{let t=y(o,e);return await J(t&&t._f?{[e]:t}:t)}))).every(Boolean))||n.isValid)&&N():s=i=await J(o);return T.state.next({...!I(e)||E.isValid&&i!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:n.errors}),t.shouldFocus&&!s&&M(o,ev,e?a:_.mount),s},ex=e=>{let t={...b.mount?h:c};return v(e)?t:I(e)?y(t,e):e.map(e=>y(t,e))},eE=(e,t)=>({invalid:!!y((t||n).errors,e),isDirty:!!y((t||n).dirtyFields,e),error:y((t||n).errors,e),isValidating:!!y(n.validatingFields,e),isTouched:!!y((t||n).touchedFields,e)}),eT=(e,t,r)=>{let i=(y(o,e,{_f:{}})._f||{}).ref,{ref:s,message:a,type:l,...u}=y(n.errors,e)||{};w(n.errors,e,{...u,...t,ref:i}),T.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},eO=(e,t={})=>{for(let i of e?A(e):_.mount)_.mount.delete(i),_.array.delete(i),t.keepValue||(er(o,i),er(h,i)),t.keepError||er(n.errors,i),t.keepDirty||er(n.dirtyFields,i),t.keepTouched||er(n.touchedFields,i),t.keepIsValidating||er(n.validatingFields,i),r.shouldUnregister||t.keepDefaultValue||er(c,i);T.values.next({values:{...h}}),T.state.next({...n,...t.keepDirty?{isDirty:Q()}:{}}),t.keepIsValid||N()},eC=({disabled:e,name:t,field:r,fields:n,value:i})=>{if(g(e)&&b.mount||e){let s=e?void 0:v(i)?ef(r?r._f:y(n,t)._f):i;w(h,t,s),W(t,s,!1,!1,!0)}},ej=(t,n={})=>{let i=y(o,t),s=g(n.disabled)||g(e.disabled);return w(o,t,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:t}},name:t,mount:!0,...n}}),_.mount.add(t),i?eC({field:i,disabled:g(n.disabled)?n.disabled:e.disabled,name:t,value:n.value}):z(t,!0,n.value),{...s?{disabled:n.disabled||e.disabled}:{},...r.progressive?{required:!!n.required,min:em(n.min),max:em(n.max),minLength:em(n.minLength),maxLength:em(n.maxLength),pattern:em(n.pattern)}:{},name:t,onChange:ec,onBlur:ec,ref:e=>{if(e){ej(t,n),i=y(o,t);let r=v(e.value)&&e.querySelectorAll&&e.querySelectorAll("input,select,textarea")[0]||e,s=eo(r),a=i._f.refs||[];(s?a.find(e=>e===r):r===i._f.ref)||(w(o,t,{_f:{...i._f,...s?{refs:[...a.filter(el),r,...Array.isArray(y(c,t))?[{}]:[]],ref:{type:r.type,name:t}}:{ref:r}}}),z(t,!1,void 0,r))}else(i=y(o,t,{}))._f&&(i._f.mount=!1),(r.shouldUnregister||n.shouldUnregister)&&!(d(_.array,t)&&b.action)&&_.unMount.add(t)}}},eR=()=>r.shouldFocusError&&M(o,ev,_.mount),eA=(e,t)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let a=p(h);if(T.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await G();n.errors=e,a=t}else await J(o);if(er(n.errors,"root"),j(n.errors)){T.state.next({errors:{}});try{await e(a,i)}catch(e){s=e}}else t&&await t({...n.errors},i),eR(),setTimeout(eR);if(T.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:j(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},eP=(t,r={})=>{let i=t?p(t):c,s=p(i),a=j(t),l=a?c:s;if(r.keepDefaultValues||(c=i),!r.keepValues){if(r.keepDirtyValues)for(let e of _.mount)y(n.dirtyFields,e)?w(l,e,y(h,e)):eu(e,y(l,e));else{if(f&&v(t))for(let e of _.mount){let t=y(o,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(B(e)){let t=e.closest("form");if(t){t.reset();break}}}}o={}}h=e.shouldUnregister?r.keepDefaultValues?p(c):{}:p(l),T.array.next({values:{...l}}),T.values.next({values:{...l}})}_={mount:r.keepDirtyValues?_.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},b.mount=!E.isValid||!!r.keepIsValid||!!r.keepDirtyValues,b.watch=!!e.shouldUnregister,T.state.next({submitCount:r.keepSubmitCount?n.submitCount:0,isDirty:!a&&(r.keepDirty?n.isDirty:!!(r.keepDefaultValues&&!es(t,c))),isSubmitted:!!r.keepIsSubmitted&&n.isSubmitted,dirtyFields:a?{}:r.keepDirtyValues?r.keepDefaultValues&&h?ed(c,h):n.dirtyFields:r.keepDefaultValues&&t?ed(c,t):r.keepDirty?n.dirtyFields:{},touchedFields:r.keepTouched?n.touchedFields:{},errors:r.keepErrors?n.errors:{},isSubmitSuccessful:!!r.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},eN=(e,t)=>eP(q(e)?e(h):e,t);return{control:{register:ej,unregister:eO,getFieldState:eE,handleSubmit:eA,setError:eT,_executeSchema:G,_getWatch:Y,_getDirty:Q,_updateV
5alid:N,_removeUnmounted:()=>{for(let e of _.unMount){let t=y(o,e);t&&(t._f.refs?t._f.refs.every(e=>!el(e)):!el(t._f.ref))&&eO(e)}_.unMount=new Set},_updateFieldArray:(e,t=[],r,i,s=!0,a=!0)=>{if(i&&r){if(b.action=!0,a&&Array.isArray(y(o,e))){let t=r(y(o,e),i.argA,i.argB);s&&w(o,e,t)}if(a&&Array.isArray(y(n.errors,e))){let t=r(y(n.errors,e),i.argA,i.argB);s&&w(n.errors,e,t),ew(n.errors,e)}if(E.touchedFields&&a&&Array.isArray(y(n.touchedFields,e))){let t=r(y(n.touchedFields,e),i.argA,i.argB);s&&w(n.touchedFields,e,t)}E.dirtyFields&&(n.dirtyFields=ed(c,h)),T.state.next({name:e,isDirty:Q(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else w(h,e,t)},_updateDisabledField:eC,_getFieldArray:t=>m(y(b.mount?h:c,t,e.shouldUnregister?y(c,t,[]):[])),_reset:eP,_resetDefaultValues:()=>q(r.defaultValues)&&r.defaultValues().then(e=>{eN(e,r.resetOptions),T.state.next({isLoading:!1})}),_updateFormState:e=>{n={...n,...e}},_disableForm:e=>{g(e)&&(T.state.next({disabled:e}),M(o,(t,r)=>{let n=y(o,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:T,_proxyFormState:E,_setErrors:e=>{n.errors=e,T.state.next({errors:n.errors,isValid:!1})},get _fields(){return o},get _formValues(){return h},get _state(){return b},set _state(value){b=value},get _defaultValues(){return c},get _names(){return _},set _names(value){_=value},get _formState(){return n},set _formState(value){n=value},get _options(){return r},set _options(value){r={...r,...value}}},trigger:eS,register:ej,handleSubmit:eA,watch:(e,t)=>q(e)?T.values.subscribe({next:r=>e(Y(void 0,t),r)}):Y(e,t,!0),setValue:eu,getValues:ex,reset:eN,resetField:(e,t={})=>{y(o,e)&&(v(t.defaultValue)?eu(e,p(y(c,e))):(eu(e,t.defaultValue),w(c,e,p(t.defaultValue))),t.keepTouched||er(n.touchedFields,e),t.keepDirty||(er(n.dirtyFields,e),n.isDirty=t.defaultValue?Q(e,p(y(c,e))):Q()),!t.keepError&&(er(n.errors,e),E.isValid&&N()),T.state.next({...n}))},clearErrors:e=>{e&&A(e).forEach(e=>er(n.errors,e)),T.state.next({errors:e?n.errors:{}})},unregister:eO,setError:eT,setFocus:(e,t={})=>{let r=y(o,e),n=r&&r._f;if(n){let e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:eE}}(e),formState:o});let h=t.current.control;return h._options=e,N({subject:h._subjects.state,next:e=>{R(e,h._proxyFormState,h._updateFormState,!0)&&c({...h._formState})}}),n.useEffect(()=>h._disableForm(e.disabled),[h,e.disabled]),n.useEffect(()=>{if(h._proxyFormState.isDirty){let e=h._getDirty();e!==o.isDirty&&h._subjects.state.next({isDirty:e})}},[h,o.isDirty]),n.useEffect(()=>{e.values&&!es(e.values,r.current)?(h._reset(e.values,h._options.resetOptions),r.current=e.values,c(e=>({...e}))):h._resetDefaultValues()},[e.values,h]),n.useEffect(()=>{e.errors&&h._setErrors(e.errors)},[e.errors,h]),n.useEffect(()=>{h._state.mount||(h._updateValid(),h._state.mount=!0),h._state.watch&&(h._state.watch=!1,h._subjects.state.next({...h._formState})),h._removeUnmounted()}),n.useEffect(()=>{e.shouldUnregister&&h._subjects.values.next({values:h._getWatch()})},[e.shouldUnregister,h]),t.current.formState=C(o,h),t.current}},69398:function(e,t,r){"use strict";function n(e,t){if(!e)throw Error("Invariant failed")}r.d(t,{Z:function(){return n}})},5853:function(e,t,r){"use strict";r.d(t,{_T:function(){return i},ev:function(){return s},pi:function(){return n}});var n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(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 i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function s(e,t,r){if(r||2==arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError},31229:function(e,t,r){"use strict";let n;r.d(t,{Ry:function(){return eZ},Z_:function(){return eC},z:function(){return to}}),(e7=tt||(tt={})).assertEqual=e=>e,e7.assertIs=function(e){},e7.assertNever=function(e){throw Error()},e7.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},e7.getValidEnumValues=e=>{let t=e7.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let n of t)r[n]=e[n];return e7.objectValues(r)},e7.objectValues=e=>e7.objectKeys(e).map(function(t){return e[t]}),e7.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e7.find=(e,t)=>{for(let r of e)if(t(r))return r},e7.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e7.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e7.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(tr||(tr={})).mergeShapes=(e,t)=>({...e,...t});let i=tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),s=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":if(Array.isArray(e))return i.array;if(null===e)return i.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return i.promise;if("undefined"!=typeof Map&&e instanceof Map)return i.map;if("undefined"!=typeof Set&&e instanceof Set)return i.set;if("undefined"!=typeof Date&&e instanceof Date)return i.date;return i.object;default:return i.unknown}}
vendor: 5,774 bytes, line 5
5,a=tt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class o extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){let r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof o))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}o.create=e=>new o(e);let l=(e,t)=>{let r;switch(e.code){case a.invalid_type:r=e.received===i.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case a.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:r=`Unrecognized key(s) in object: ${tt.joinValues(e.keys,", ")}`;break;case a.invalid_union:r="Invalid input";break;case a.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${tt.joinValues(e.options)}`;break;case a.invalid_enum_value:r=`Invalid enum value. Expected ${tt.joinValues(e.options)}, received '${e.received}'`;break;case a.invalid_arguments:r="Invalid function arguments";break;case a.invalid_return_type:r="Invalid function return type";break;case a.invalid_date:r="Invalid date";break;case a.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:tt.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case a.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case a.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case a.custom:r="Invalid input";break;case a.invalid_intersection_types:r="Intersection results could not be merged";break;case a.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case a.not_finite:r="Number must be finite";break;default:r=t.defaultError,tt.assertNever(e)}return{message:r}},u=l;function c(){return u}let d=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";for(let e of n.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}};function h(e,t){let r=c(),n=d({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===l?void 0:l].filter(e=>!!e)});e.common.issues.push(n)}class f{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if("aborted"===n.status)return p;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return f.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:t,value:i}=n;if("aborted"===t.status||"aborted"===i.status)return p;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||n.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let p=Object.freeze({status:"aborted"}),m=e=>({status:"dirty",value:e}),v=e=>
5({status:"valid",value:e}),y=e=>"aborted"===e.status,g=e=>"dirty"===e.status,b=e=>"valid"===e.status,_=e=>"undefined"!=typeof Promise&&e instanceof Promise;function w(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function k(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(e6=tn||(tn={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},e6.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class S{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let x=(e,t)=>{if(b(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new o(e.common.issues);return this._error=t,this._error}}};function E(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var s,a;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!==(s=null!=o?o:n)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(a=null!=o?o:r)&&void 0!==a?a:i.defaultError}},description:i}}class T{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return s(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new f,ctx:{common:e.parent.common,data:e.data,parsedType:s(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(_(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:s(e)},i=this._parseSync({data:e,path:n.path,parent:n});return x(n,i)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:s(e)},n=this._parse({data:e,path:r.path,parent:r});return x(r,await (_(n)?n:Promise.resolve(n)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,n)=>{let i=e(t),s=()=>n.addIssue({code:a.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(s(),!1)):!!i||(s(),!1)})}refinement(e,t){return this._refinement((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1))}_refinement(e){return new ev({schema:this,typeName:ta.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ey.create(this,this._def)}nullable(){return eg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return X.create(this,this._def)}promise(){return em.create(this,this._def)}or(e){return et.create([this,e],this._def)}and(e){return ei.create(this,e,this._def)}transform(e){return new ev({...E(this._def),schema:this,typeName:ta.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eb({...E(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:ta.ZodDefault})}brand(){return new eS({typeName:ta.ZodBranded,type:this,...E(this._def)})}catch(e){return new e_({...E(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:ta.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ex.create(this,e)}readonly(){return eE.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let O=/^c[^\s-]{8,}
5$/i,C=/^[0-9a-z]+$/,j=/^[0-9A-HJKMNP-TV-Z]{26}$/,R=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,A=/^[a-z0-9_-]{21}$/i,P=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,N=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,I=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,D=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,L="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",F=RegExp(`^${L}$`);function U(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function M(e){let t=`${L}T${U(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class V extends T{_parse(e){var t,r;let s;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==i.string){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.string,received:t.parsedType}),p}let o=new f;for(let i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(h(s=this._getOrReturnCtx(e,s),{code:a.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if("max"===i.kind)e.data.length>i.value&&(h(s=this._getOrReturnCtx(e,s),{code:a.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),o.dirty());else if("length"===i.kind){let t=e.data.length>i.value,r=e.data.length<i.value;(t||r)&&(s=this._getOrReturnCtx(e,s),t?h(s,{code:a.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):r&&h(s,{code:a.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),o.dirty())}else if("email"===i.kind)N.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"email",code:a.invalid_string,message:i.message}),o.dirty());else if("emoji"===i.kind)n||(n=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"emoji",code:a.invalid_string,message:i.message}),o.dirty());else if("uuid"===i.kind)R.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"uuid",code:a.invalid_string,message:i.message}),o.dirty());else if("nanoid"===i.kind)A.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"nanoid",code:a.invalid_string,message:i.message}),o.dirty());else if("cuid"===i.kind)O.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"cuid",code:a.invalid_string,message:i.message}),o.dirty());else if("cuid2"===i.kind)C.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"cuid2",code:a.invalid_string,message:i.message}),o.dirty());else if("ulid"===i.kind)j.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"ulid",code:a.invalid_string,message:i.message}),o.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(t){h(s=this._getOrReturnCtx(e,s),{validation:"url",code:a.invalid_string,message:i.message}),o.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"regex",code:a.invalid_string,message:i.message}),o.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(h(s=this._getOrReturnCtx(e,s),{code:a.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),o.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(h(s=this._getOrReturnCtx(e,s),{code:a.invalid_string,validation:{startsWith:i.value},message:i.message}),o.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(h(s=this._getOrReturnCtx(e,s),{code:a.invalid_string,validation:{endsWith:i.value},message:i.message}),o.dirty()):"datetime"===i.kind?M(i).test(e.data)||(h(s=this._getOrReturnCtx(e,s),{code:a.invalid_string,validation:"datetime",message:i.message}),o.dirty()):"date"===i.kind?F.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{code:a.invalid_string,validation:"date",message:i.message}),o.dirty()):"time"===i.kind?RegExp(`^${U(i)}$`).test(e.data)||(h(s=this._getOrReturnCtx(e,s),{code:a.invalid_string,validation:"time",message:i.message}),o.dirty()):"duration"===i.kind?P.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"duration",code:a.invalid_string,message:i.message}),o.dirty()):"ip"===i.kind?(t=e.data,("v4"===(r=i.version)||!r)&&I.test(t)||("v6"===r||!r)&&$.test(t)||(h(s=this._getOrReturnCtx(e,s),{validation:"ip",code:a.invalid_string,message:i.message}),o.dirty())):"base64"===i.kind?D.test(e.data)||(h(s=this._getOrReturnCtx(e,s),{validation:"base64",code:a.invalid_string,message:i.message}),o.dirty()):tt.assertNever(i);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:a.invalid_string,...tn.errToObj(r)})}_addCheck(e){return new V({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tn.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...tn.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...tn.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tn.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tn.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tn.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tn.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tn.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tn.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tn.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tn.errToObj(t)})}nonempty(e){return this.min(1,tn.errToObj(e))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}
5get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}V.create=e=>{var t;return new V({checks:[],typeName:ta.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...E(e)})};class Z extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==i.number){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.number,received:t.parsedType}),p}let r=new f;for(let n of this._def.checks)"int"===n.kind?tt.isInteger(e.data)||(h(t=this._getOrReturnCtx(e,t),{code:a.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(h(t=this._getOrReturnCtx(e,t),{code:a.not_finite,message:n.message}),r.dirty()):tt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tn.toString(t))}setLimit(e,t,r,n){return new Z({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tn.toString(n)}]})}_addCheck(e){return new Z({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tn.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tn.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&tt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Z.create=e=>new Z({checks:[],typeName:ta.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...E(e)});class q extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==i.bigint){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.bigint,received:t.parsedType}),p}let r=new f;for(let n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(h(t=this._getOrReturnCtx(e,t),{code:a.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):tt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tn.toString(t))}setLimit(e,t,r,n){return new q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tn.toString(n)}]})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}
5positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tn.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}q.create=e=>{var t;return new q({checks:[],typeName:ta.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...E(e)})};class B extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==i.boolean){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.boolean,received:t.parsedType}),p}return v(e.data)}}B.create=e=>new B({typeName:ta.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...E(e)});class z extends T{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==i.date){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.date,received:t.parsedType}),p}if(isNaN(e.data.getTime()))return h(this._getOrReturnCtx(e),{code:a.invalid_date}),p;let r=new f;for(let n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(h(t=this._getOrReturnCtx(e,t),{code:a.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):tt.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tn.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tn.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}z.create=e=>new z({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ta.ZodDate,...E(e)});class W extends T{_parse(e){if(this._getType(e)!==i.symbol){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.symbol,received:t.parsedType}),p}return v(e.data)}}W.create=e=>new W({typeName:ta.ZodSymbol,...E(e)});class K extends T{_parse(e){if(this._getType(e)!==i.undefined){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.undefined,received:t.parsedType}),p}return v(e.data)}}K.create=e=>new K({typeName:ta.ZodUndefined,...E(e)});class G extends T{_parse(e){if(this._getType(e)!==i.null){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.null,received:t.parsedType}),p}return v(e.data)}}G.create=e=>new G({typeName:ta.ZodNull,...E(e)});class H extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return v(e.data)}}H.create=e=>new H({typeName:ta.ZodAny,...E(e)});class J extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return v(e.data)}}J.create=e=>new J({typeName:ta.ZodUnknown,...E(e)});class Q extends T{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.never,received:t.parsedType}),p}}Q.create=e=>new Q({typeName:ta.ZodNever,...E(e)});class Y extends T{_parse(e){if(this._getType(e)!==i.undefined){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.void,received:t.parsedType}),p}return v(e.data)}}Y.create=e=>new Y({typeName:ta.ZodVoid,...E(e)});class X extends T{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==i.array)return h(t,{code:a.invalid_type,expected:i.array,received:t.parsedType}),p;if(null!==n.exactLength){let e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(h(t,{code:e?a.too_big:a.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(h(t,{code:a.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(h(t,{code:a.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>n.type._parseAsync(new S(t,e,t.path,r)))).then(e=>f.mergeArray(r,e));let s=[...t.data].map((e,r)=>n.type._parseSync(new S(t,e,t.path,r)));return f.mergeArray(r,s)}
5get element(){return this._def.type}min(e,t){return new X({...this._def,minLength:{value:e,message:tn.toString(t)}})}max(e,t){return new X({...this._def,maxLength:{value:e,message:tn.toString(t)}})}length(e,t){return new X({...this._def,exactLength:{value:e,message:tn.toString(t)}})}nonempty(e){return this.min(1,e)}}X.create=(e,t)=>new X({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ta.ZodArray,...E(t)});class ee extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=tt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==i.object){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.object,received:t.parsedType}),p}let{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Q&&"strip"===this._def.unknownKeys))for(let e in r.data)s.includes(e)||o.push(e);let l=[];for(let e of s){let t=n[e],i=r.data[e];l.push({key:{status:"valid",value:e},value:t._parse(new S(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Q){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of o)l.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)o.length>0&&(h(r,{code:a.unrecognized_keys,keys:o}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of o){let n=r.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new S(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of l){let r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>f.mergeObjectSync(t,e)):f.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return tn.errToObj,new ee({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,s,a;let o=null!==(s=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=tn.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new ee({...this._def,unknownKeys:"strip"})}passthrough(){return new ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ta.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ee({...this._def,catchall:e})}pick(e){let t={};return tt.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new ee({...this._def,shape:()=>t})}omit(e){let t={};return tt.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new ee({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ee){let r={};for(let n in t.shape){let i=t.shape[n];r[n]=ey.create(e(i))}return new ee({...t._def,shape:()=>r})}return t instanceof X?new X({...t._def,type:e(t.element)}):t instanceof ey?ey.create(e(t.unwrap())):t instanceof eg?eg.create(e(t.unwrap())):t instanceof es?es.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return tt.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new ee({...this._def,shape:()=>t})}required(e){let t={};return tt.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ey;)e=e._def.innerType;t[r]=e}}),new ee({...this._def,shape:()=>t})}keyof(){return eh(tt.objectKeys(this.shape))}}ee.create=(e,t)=>new ee({shape:()=>e,unknownKeys:"strip",catchall:Q.create(),typeName:ta.ZodObject,...E(t)}),ee.strictCreate=(e,t)=>new ee({shape:()=>e,unknownKeys:"strict",catchall:Q.create(),typeName:ta.ZodObject,...E(t)}),ee.lazycreate=(e,t)=>new ee({shape:e,unknownKeys:"strip",catchall:Q.create(),typeName:ta.ZodObject,...E(t)});class et extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new o(e.ctx.common.issues));return h(t,{code:a.invalid_union,unionErrors:r}),p});{let e;let n=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=n.map(e=>new o(e));return h(t,{code:a.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}}et.create=(e,t)=>
5new et({options:e,typeName:ta.ZodUnion,...E(t)});let er=e=>{if(e instanceof ec)return er(e.schema);if(e instanceof ev)return er(e.innerType());if(e instanceof ed)return[e.value];if(e instanceof ef)return e.options;if(e instanceof ep)return tt.objectValues(e.enum);if(e instanceof eb)return er(e._def.innerType);if(e instanceof K)return[void 0];else if(e instanceof G)return[null];else if(e instanceof ey)return[void 0,...er(e.unwrap())];else if(e instanceof eg)return[null,...er(e.unwrap())];else if(e instanceof eS)return er(e.unwrap());else if(e instanceof eE)return er(e.unwrap());else if(e instanceof e_)return er(e._def.innerType);else return[]};class en extends T{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return h(t,{code:a.invalid_type,expected:i.object,received:t.parsedType}),p;let r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:a.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let r of t){let t=er(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new en({typeName:ta.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...E(r)})}}class ei extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(y(e)||y(n))return p;let o=function e(t,r){let n=s(t),a=s(r);if(t===r)return{valid:!0,data:t};if(n===i.object&&a===i.object){let n=tt.objectKeys(r),i=tt.objectKeys(t).filter(e=>-1!==n.indexOf(e)),s={...t,...r};for(let n of i){let i=e(t[n],r[n]);if(!i.valid)return{valid:!1};s[n]=i.data}return{valid:!0,data:s}}if(n===i.array&&a===i.array){if(t.length!==r.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=e(t[i],r[i]);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}return n===i.date&&a===i.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,n.value);return o.valid?((g(e)||g(n))&&t.dirty(),{status:t.value,value:o.data}):(h(r,{code:a.invalid_intersection_types}),p)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ei.create=(e,t,r)=>new ei({left:e,right:t,typeName:ta.ZodIntersection,...E(r)});class es extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.array)return h(r,{code:a.invalid_type,expected:i.array,received:r.parsedType}),p;if(r.data.length<this._def.items.length)return h(r,{code:a.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&r.data.length>this._def.items.length&&(h(r,{code:a.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new S(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(n).then(e=>f.mergeArray(t,e)):f.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new es({...this._def,rest:e})}}es.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new es({items:e,typeName:ta.ZodTuple,rest:null,...E(t)})};class ea extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.object)return h(r,{code:a.invalid_type,expected:i.object,received:r.parsedType}),p;let n=[],s=this._def.keyType,o=this._def.valueType;for(let e in r.data)n.push({key:s._parse(new S(r,e,r.path,e)),value:o._parse(new S(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?f.mergeObjectAsync(t,n):f.mergeObjectSync(t,n)}
5get element(){return this._def.valueType}static create(e,t,r){return new ea(t instanceof T?{keyType:e,valueType:t,typeName:ta.ZodRecord,...E(r)}:{keyType:V.create(),valueType:e,typeName:ta.ZodRecord,...E(t)})}}class eo extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.map)return h(r,{code:a.invalid_type,expected:i.map,received:r.parsedType}),p;let n=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([e,t],i)=>({key:n._parse(new S(r,e,r.path,[i,"key"])),value:s._parse(new S(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of o){let n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return p;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of o){let n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return p;("dirty"===n.status||"dirty"===i.status)&&t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}eo.create=(e,t,r)=>new eo({valueType:t,keyType:e,typeName:ta.ZodMap,...E(r)});class el extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.set)return h(r,{code:a.invalid_type,expected:i.set,received:r.parsedType}),p;let n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(h(r,{code:a.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(h(r,{code:a.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let s=this._def.valueType;function o(e){let r=new Set;for(let n of e){if("aborted"===n.status)return p;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}let l=[...r.data.values()].map((e,t)=>s._parse(new S(r,e,r.path,t)));return r.common.async?Promise.all(l).then(e=>o(e)):o(l)}min(e,t){return new el({...this._def,minSize:{value:e,message:tn.toString(t)}})}max(e,t){return new el({...this._def,maxSize:{value:e,message:tn.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}el.create=(e,t)=>new el({valueType:e,minSize:null,maxSize:null,typeName:ta.ZodSet,...E(t)});class eu extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return h(t,{code:a.invalid_type,expected:i.function,received:t.parsedType}),p;function r(e,r){return d({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,c(),l].filter(e=>!!e),issueData:{code:a.invalid_arguments,argumentsError:r}})}function n(e,r){return d({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,c(),l].filter(e=>!!e),issueData:{code:a.invalid_return_type,returnTypeError:r}})}let s={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof em){let e=this;return v(async function(...t){let i=new o([]),a=await e._def.args.parseAsync(t,s).catch(e=>{throw i.addIssue(r(t,e)),i}),l=await Reflect.apply(u,this,a);return await e._def.returns._def.type.parseAsync(l,s).catch(e=>{throw i.addIssue(n(l,e)),i})})}{let e=this;return v(function(...t){let i=e._def.args.safeParse(t,s);if(!i.success)throw new o([r(t,i.error)]);let a=Reflect.apply(u,this,i.data),l=e._def.returns.safeParse(a,s);if(!l.success)throw new o([n(a,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new eu({...this._def,args:es.create(e).rest(J.create())})}returns(e){return new eu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new eu({args:e||es.create([]).rest(J.create()),returns:t||J.create(),typeName:ta.ZodFunction,...E(r)})}}class ec extends T{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ec.create=(e,t)=>
5new ec({getter:e,typeName:ta.ZodLazy,...E(t)});class ed extends T{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:a.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eh(e,t){return new ef({values:e,typeName:ta.ZodEnum,...E(t)})}ed.create=(e,t)=>new ed({value:e,typeName:ta.ZodLiteral,...E(t)});class ef extends T{constructor(){super(...arguments),ti.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return h(t,{expected:tt.joinValues(r),received:t.parsedType,code:a.invalid_type}),p}if(w(this,ti,"f")||k(this,ti,new Set(this._def.values),"f"),!w(this,ti,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return h(t,{received:t.data,code:a.invalid_enum_value,options:r}),p}return v(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ef.create(e,{...this._def,...t})}exclude(e,t=this._def){return ef.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ti=new WeakMap,ef.create=eh;class ep extends T{constructor(){super(...arguments),ts.set(this,void 0)}_parse(e){let t=tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==i.string&&r.parsedType!==i.number){let e=tt.objectValues(t);return h(r,{expected:tt.joinValues(e),received:r.parsedType,code:a.invalid_type}),p}if(w(this,ts,"f")||k(this,ts,new Set(tt.getValidEnumValues(this._def.values)),"f"),!w(this,ts,"f").has(e.data)){let e=tt.objectValues(t);return h(r,{received:r.data,code:a.invalid_enum_value,options:e}),p}return v(e.data)}get enum(){return this._def.values}}ts=new WeakMap,ep.create=(e,t)=>new ep({values:e,typeName:ta.ZodNativeEnum,...E(t)});class em extends T{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==i.promise&&!1===t.common.async?(h(t,{code:a.invalid_type,expected:i.promise,received:t.parsedType}),p):v((t.parsedType===i.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}em.create=(e,t)=>new em({type:e,typeName:ta.ZodPromise,...E(t)});class ev extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ta.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{h(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){let e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return p;let n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?p:"dirty"===n.status||"dirty"===t.value?m(n.value):n});{if("aborted"===t.value)return p;let n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?p:"dirty"===n.status||"dirty"===t.value?m(n.value):n}}if("refinement"===n.type){let e=e=>{let t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?p:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?p:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}}if("transform"===n.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>b(e)?Promise.resolve(n.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!b(e))return e;let s=n.transform(e.value,i);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}tt.assertNever(n)}}ev.create=(e,t,r)=>new ev({schema:e,typeName:ta.ZodEffects,effect:t,...E(r)}),ev.createWithPreprocess=(e,t,r)=>new ev({schema:t,effect:{type:"preprocess",transform:e},typeName:ta.ZodEffects,...E(r)});class ey extends T{_parse(e){return this._getType(e)===i.undefined?v(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ey.create=(e,t)=>
5new ey({innerType:e,typeName:ta.ZodOptional,...E(t)});class eg extends T{_parse(e){return this._getType(e)===i.null?v(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eg.create=(e,t)=>new eg({innerType:e,typeName:ta.ZodNullable,...E(t)});class eb extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===i.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eb.create=(e,t)=>new eb({innerType:e,typeName:ta.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...E(t)});class e_ extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return _(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new o(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new o(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}e_.create=(e,t)=>new e_({innerType:e,typeName:ta.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...E(t)});class ew extends T{_parse(e){if(this._getType(e)!==i.nan){let t=this._getOrReturnCtx(e);return h(t,{code:a.invalid_type,expected:i.nan,received:t.parsedType}),p}return{status:"valid",value:e.data}}}ew.create=e=>new ew({typeName:ta.ZodNaN,...E(e)});let ek=Symbol("zod_brand");class eS extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ex extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),m(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ex({in:e,out:t,typeName:ta.ZodPipeline})}}class eE extends T{_parse(e){let t=this._def.innerType._parse(e),r=e=>(b(e)&&(e.value=Object.freeze(e.value)),e);return _(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function eT(e,t={},r){return e?H.create().superRefine((n,i)=>{var s,a;if(!e(n)){let e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===a||a;i.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:o})}}):H.create()}eE.create=(e,t)=>new eE({innerType:e,typeName:ta.ZodReadonly,...E(t)});let eO={object:ee.lazycreate};(te=ta||(ta={})).ZodString="ZodString",te.ZodNumber="ZodNumber",te.ZodNaN="ZodNaN",te.ZodBigInt="ZodBigInt",te.ZodBoolean="ZodBoolean",te.ZodDate="ZodDate",te.ZodSymbol="ZodSymbol",te.ZodUndefined="ZodUndefined",te.ZodNull="ZodNull",te.ZodAny="ZodAny",te.ZodUnknown="ZodUnknown",te.ZodNever="ZodNever",te.ZodVoid="ZodVoid",te.ZodArray="ZodArray",te.ZodObject="ZodObject",te.ZodUnion="ZodUnion",te.ZodDiscriminatedUnion="ZodDiscriminatedUnion",te.ZodIntersection="ZodIntersection",te.ZodTuple="ZodTuple",te.ZodRecord="ZodRecord",te.ZodMap="ZodMap",te.ZodSet="ZodSet",te.ZodFunction="ZodFunction",te.ZodLazy="ZodLazy",te.ZodLiteral="ZodLiteral",te.ZodEnum="ZodEnum",te.ZodEffects="ZodEffects",te.ZodNativeEnum="ZodNativeEnum",te.ZodOptional="ZodOptional",te.ZodNullable="ZodNullable",te.ZodDefault="ZodDefault",te.ZodCatch="ZodCatch",te.ZodPromise="ZodPromise",te.ZodBranded="ZodBranded",te.ZodPipeline="ZodPipeline",te.ZodReadonly="ZodReadonly";let eC=V.create,ej=Z.create,eR=ew.create,eA=q.create,eP=B.create,eN=z.create,eI=W.create,e$=K.create,eD=G.create,eL=H.create,eF=J.create,eU=Q.create,eM=Y.create,eV=X.create,eZ=ee.create,eq=ee.strictCreate,eB=et.create,ez=en.create,eW=ei.create,eK=es.create,eG=ea.create,eH=eo.create,eJ=el.create,eQ=eu.create,eY=ec.create,eX=ed.create,e0=ef.create,e1=ep.create,e2=em.create,e4=ev.create,e5=ey.create,e9=eg.create,e3=ev.createWithPreprocess,e8=ex.create;var e7,e6,te,tt,tr,tn,ti,ts,ta,to=Object.freeze({__proto__:null,defaultErrorMap:l,setErrorMap:function(e){u=e},getErrorMap:c,makeIssue:d,EMPTY_PATH:[],addIssueToContext:h,ParseStatus:f,INVALID:p,DIRTY:m,OK:v,isAborted:y,isDirty:g,isValid:b,isAsync:_,get util(){return tt},get objectUtil(){return tr},ZodParsedType:i,getParsedType:s,ZodType:T,datetimeRegex:M,ZodString:V,ZodNumber:Z,ZodBigInt:q,ZodBoolean:B,ZodDate:z,ZodSymbol:W,ZodUndefined:K,ZodNull:G,ZodAny:H,ZodUnknown:J,ZodNever:Q,ZodVoid:Y,ZodArray:X,ZodObject:ee,ZodUnion:et,ZodDiscriminatedUnion:en,ZodIntersection:ei,ZodTuple:es,ZodRecord:ea,ZodMap:eo,ZodSet:el,ZodFunction:eu,ZodLazy:ec,ZodLiteral:ed,ZodEnum:ef,ZodNativeEnum:ep,ZodPromise:em,ZodEffects:ev,ZodTransformer:ev,ZodOptional:ey,ZodNullable:eg,ZodDefault:eb,ZodCatch:e_,ZodNaN:ew,BRAND:ek,ZodBranded:eS,ZodPipeline:ex,ZodReadonly:eE,custom:eT,Schema:T,ZodSchema:T,late:eO,get ZodFirstPartyTypeKind(){return ta},coerce:{string:e=>V.create({...e,coerce:!0}),number:e=>Z.create({...e,coerce:!0}),boolean:e=>B.create({...e,coerce:!0}),bigint:e=>q.create({...e,coerce:!0}),date:e=>z.create({...e,coerce:!0})},any:eL,array:eV,bigint:eA,boolean:eP,date:eN,discriminatedUnion:ez,effect:e4,enum:e0,function:eQ,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>eT(t=>t instanceof e,t),intersection:eW,lazy:eY,literal:eX,map:eH,nan:eR,nativeEnum:e1,never:eU,null:eD,nullable:e9,number:ej,object:eZ,oboolean:()=>eP().optional(),onumber:()=>ej().optional(),optional:e5,ostring:()=>eC().optional(),pipeline:e8,preprocess:e3,promise:e2,record:eG,set:eJ,strictObject:eq,string:eC,symbol:eI,transformer:e4,tuple:eK,undefined:e$,union:eB,unknown:eF,void:eM,NEVER:p,ZodIssueCode:a,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:o})},3011:function(e,t,r){"use strict";r.d(t,{U:function(){return l}});var n=r(2265);let i=e=>{let t;let r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,s={setState:n,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(n,i,s);return s},s=e=>e?i(e):i,a=e=>e,o=e=>{let t=s(e),r=e=>(function(e,t=a){let r=n.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return n.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},l=e=>e?o(e):o}}]);

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.