(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[946],{485:function(e,t,r){"use strict";r.r(t),r.d(t,{Headers:function(){return n},Request:function(){return a},Response:function(){return o},fetch:function(){return i}});var s=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=s.fetch;t.default=s.fetch.bind(s);let n=s.Headers,a=s.Request,o=s.Response},5257:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=s(r(485)),n=s(r(3038));class a{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=i.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,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,s;let i=null,a=null,o=null,l=e.status,u=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(a="text/csv"===this.headers.Accept?t:this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}let s=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),n=null===(r=e.headers.get("content-range"))||void 0===r?void 0:r.split("/");s&&n&&n.length>1&&(o=parseInt(n[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(a)&&(a.length>1?(i={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,o=null,l=406,u="Not Acceptable"):a=1===a.length?a[0]:null)}else{let t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(a=[],i=null,l=200,u="OK")}catch(r){404===e.status&&""===t?(l=204,u="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(s=null==i?void 0:i.details)||void 0===s?void 0:s.includes("0 rows"))&&(i=null,l=200,u="OK"),i&&this.shouldThrowOnError)throw new n.default(i)}return{error:i,data:a,count:o,status:l,statusText:u}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,s;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!==(s=null==e?void 0:e.code)&&void 0!==s?s:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}}t.default=a},9590:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=s(r(9824)),n=s(r(2495)),a=r(2168);class o{constructor(e,{headers:t={},schema:r,fetch:s}={}){this.url=e,this.headers=Object.assign(Object.assign({},a.DEFAULT_HEADERS),t),this.schemaName=r,this.fetch=s}from(e){let t=new URL(`${this.url}/${e}`);return new i.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new o(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:s=!1,count:i}={}){let a,o;let l=new URL(`${this.url}/rpc/${e}`);r||s?(a=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{l.searchParams.append(e,t)})):(a="POST",o=t);let u=Object.assign({},this.headers);return i&&(u.Prefer=`count=${i}`),new n.default({method:a,url:l,headers:u,schema:this.schemaName,body:o,fetch:this.fetch,allowEmpty:!1})}}t.default=o},3038:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}t.default=r},2495:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=s(r(3377));class n extends i.default{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:s}={}){let i="";"plain"===s?i="pl":"phrase"===s?i="ph":"websearch"===s&&(i="w");let n=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}t.default=n},9824:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=s(r(2495));class n{constructor(e,{headers:t={},schema:r,fetch:s}){this.url=e,this.headers=t,this.schema=r,this.fetch=s}select(e,{head:t=!1,count:r}={}){let s=!1,n=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e)).join("");return this.url.searchParams.set("select",n),r&&(this.headers.Prefer=`count=${r}`),new i.default({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 s=[];if(this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),r||s.push("missing=default"),this.headers.Prefer=s.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 i.default({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:s,defaultToNull:n=!0}={}){let a=[`resolution=${r?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&a.push(this.headers.Prefer),s&&a.push(`count=${s}`),n||a.push("missing=default"),this.headers.Prefer=a.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 i.default({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 i.default({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 i.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}t.default=n},3377:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=s(r(5257));class n extends i.default{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:s,referencedTable:i=s}={}){let n=i?`${i}.order`:"order",a=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){let i=void 0===s?"offset":`${s}.offset`,n=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(n,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.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}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:n="text"}={}){var a;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=null!==(a=this.headers.Accept)&&void 0!==a?a:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${n}; 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}}t.default=n},2168:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;let s=r(1780);t.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${s.version}`}},9640:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;let i=s(r(9590));t.PostgrestClient=i.default;let n=s(r(9824));t.PostgrestQueryBuilder=n.default;let a=s(r(2495));t.PostgrestFilterBuilder=a.default;let o=s(r(3377));t.PostgrestTransformBuilder=o.default;let l=s(r(5257));t.PostgrestBuilder=l.default,t.default={PostgrestClient:i.default,PostgrestQueryBuilder:n.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:l.default}},1780:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},6614:function(e,t,r){"use strict";let s;r.d(t,{createBrowserClient:function(){return tJ}});let i=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)};class n extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class a extends n{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class o extends n{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class l extends n{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}(V=Z||(Z={})).Any="any",V.ApNortheast1="ap-northeast-1",V.ApNortheast2="ap-northeast-2",V.ApSouth1="ap-south-1",V.ApSoutheast1="ap-southeast-1",V.ApSoutheast2="ap-southeast-2",V.CaCentral1="ca-central-1",V.EuCentral1="eu-central-1",V.EuWest1="eu-west-1",V.EuWest2="eu-west-2",V.EuWest3="eu-west-3",V.SaEast1="sa-east-1",V.UsEast1="us-east-1",V.UsWest1="us-west-1",V.UsWest2="us-west-2";class u{constructor(e,{headers:t={},customFetch:r,region:s=Z.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=i(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var r,s,i,n,u;return s=this,i=void 0,n=void 0,u=function*(){try{let s;let{headers:i,method:n,body:u}=t,h={},{region:c}=t;c||(c=this.region),c&&"any"!==c&&(h["x-region"]=c),u&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&("undefined"!=typeof Blob&&u instanceof Blob||u instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",s=u):"string"==typeof u?(h["Content-Type"]="text/plain",s=u):"undefined"!=typeof FormData&&u instanceof FormData?s=u:(h["Content-Type"]="application/json",s=JSON.stringify(u)));let d=yield this.fetch(`${this.url}/${e}`,{method:n||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),i),body:s}).catch(e=>{throw new a(e)}),f=d.headers.get("x-relay-error");if(f&&"true"===f)throw new o(d);if(!d.ok)throw new l(d);let p=(null!==(r=d.headers.get("Content-Type"))&&void 0!==r?r:"text/plain").split(";")[0].trim();return{data:"application/json"===p?yield d.json():"application/octet-stream"===p?yield d.blob():"text/event-stream"===p?d:"multipart/form-data"===p?yield d.formData():yield d.text(),error:null}}catch(e){return{data:null,error:e}}},new(n||(n=Promise))(function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function a(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var s;t.done?e(t.value):((s=t.value)instanceof n?s:new n(function(e){e(s)})).then(r,a)}o((u=u.apply(s,i||[])).next())})}}let{PostgrestClient:h,PostgrestQueryBuilder:c,PostgrestFilterBuilder:d,PostgrestTransformBuilder:f,PostgrestBuilder:p}=r(9640),m={"X-Client-Info":"realtime-js/2.10.2"};(ee=q||(q={}))[ee.connecting=0]="connecting",ee[ee.open=1]="open",ee[ee.closing=2]="closing",ee[ee.closed=3]="closed",(et=z||(z={})).closed="closed",et.errored="errored",et.joined="joined",et.joining="joining",et.leaving="leaving",(er=K||(K={})).close="phx_close",er.error="phx_error",er.join="phx_join",er.reply="phx_reply",er.leave="phx_leave",er.access_token="access_token",(J||(J={})).websocket="websocket",(es=W||(W={})).Connecting="connecting",es.Open="open",es.Closing="closing",es.Closed="closed";class y{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 s=t.getUint8(1),i=t.getUint8(2),n=this.HEADER_LENGTH+2,a=r.decode(e.slice(n,n+s));n+=s;let o=r.decode(e.slice(n,n+i));return n+=i,{ref:null,topic:a,event:o,payload:JSON.parse(r.decode(e.slice(n,e.byteLength)))}}}class g{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))}}(ei=H||(H={})).abstime="abstime",ei.bool="bool",ei.date="date",ei.daterange="daterange",ei.float4="float4",ei.float8="float8",ei.int2="int2",ei.int4="int4",ei.int4range="int4range",ei.int8="int8",ei.int8range="int8range",ei.json="json",ei.jsonb="jsonb",ei.money="money",ei.numeric="numeric",ei.oid="oid",ei.reltime="reltime",ei.text="text",ei.time="time",ei.timestamp="timestamp",ei.timestamptz="timestamptz",ei.timetz="timetz",ei.tsrange="tsrange",ei.tstzrange="tstzrange";let v=(e,t,r={})=>{var s;let i=null!==(s=r.skipTypes)&&void 0!==s?s:[];return Object.keys(t).reduce((r,s)=>(r[s]=_(s,e,t,i),r),{})},_=(e,t,r,s)=>{let i=t.find(t=>t.name===e),n=null==i?void 0:i.type,a=r[e];return n&&!s.includes(n)?b(n,a):w(a)},b=(e,t)=>{if("_"===e.charAt(0))return T(t,e.slice(1,e.length));switch(e){case H.bool:return k(t);case H.float4:case H.float8:case H.int2:case H.int4:case H.int8:case H.numeric:case H.oid:return S(t);case H.json:case H.jsonb:return x(t);case H.timestamp:return E(t);case H.abstime:case H.date:case H.daterange:case H.int4range:case H.int8range:case H.money:case H.reltime:case H.text:case H.time:case H.timestamptz:case H.timetz:case H.tsrange:case H.tstzrange:default:return w(t)}},w=e=>e,k=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},S=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},x=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},T=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,s=e[r];if("{"===e[0]&&"}"===s){let s;let i=e.slice(1,r);try{s=JSON.parse("["+i+"]")}catch(e){s=i?i.split(","):[]}return s.map(e=>b(t,e))}return e},E=e=>"string"==typeof e?e.replace(" ","T"):e,A=e=>{let t=e;return(t=(t=t.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")};class O{constructor(e,t,r={},s=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,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}_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}}(en=G||(G={})).SYNC="sync",en.JOIN="join",en.LEAVE="leave";class j{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:s}=this.caller;this.joinRef=this.channel._joinRef(),this.state=j.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=j.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],s()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:s}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=j.syncDiff(this.state,e,t,r),s())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,s){let i=this.cloneDeep(e),n=this.transformState(t),a={},o={};return this.map(i,(e,t)=>{n[e]||(o[e]=t)}),this.map(n,(e,t)=>{let r=i[e];if(r){let s=t.map(e=>e.presence_ref),i=r.map(e=>e.presence_ref),n=t.filter(e=>0>i.indexOf(e.presence_ref)),l=r.filter(e=>0>s.indexOf(e.presence_ref));n.length>0&&(a[e]=n),l.length>0&&(o[e]=l)}else a[e]=t}),this.syncDiff(i,{joins:a,leaves:o},r,s)}static syncDiff(e,t,r,s){let{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(t,s)=>{var i;let n=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(s),n.length>0){let r=e[t].map(e=>e.presence_ref),s=n.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...s)}r(t,n,s)}),this.map(n,(t,r)=>{let i=e[t];if(!i)return;let n=r.map(e=>e.presence_ref);i=i.filter(e=>0>n.indexOf(e.presence_ref)),e[t]=i,s(t,i,r),0===i.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let s=e[r];return"metas"in s?t[r]=s.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(ea=Y||(Y={})).ALL="*",ea.INSERT="INSERT",ea.UPDATE="UPDATE",ea.DELETE="DELETE",(eo=X||(X={})).BROADCAST="broadcast",eo.PRESENCE="presence",eo.POSTGRES_CHANGES="postgres_changes",(el=Q||(Q={})).SUBSCRIBED="SUBSCRIBED",el.TIMED_OUT="TIMED_OUT",el.CLOSED="CLOSED",el.CHANNEL_ERROR="CHANNEL_ERROR";class C{constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=z.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new O(this,K.join,this.params,this.timeout),this.rejoinTimer=new g(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=z.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=z.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=z.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=z.errored,this.rejoinTimer.scheduleTimeout())}),this._on(K.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new j(this),this.broadcastEndpointURL=A(this.socket.endPoint)+"/api/broadcast"}subscribe(e,t=this.timeout){var r,s;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:n,private:a}}=this.params;this._onError(t=>e&&e("CHANNEL_ERROR",t)),this._onClose(()=>e&&e("CLOSED"));let o={},l={broadcast:i,presence:n,postgres_changes:null!==(s=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==s?s:[],private:a};this.socket.accessToken&&(o.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:l},o)),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 s=this.bindings.postgres_changes,i=null!==(r=null==s?void 0:s.length)&&void 0!==r?r:0,n=[];for(let r=0;r<i;r++){let i=s[r],{filter:{event:a,schema:o,table:l,filter:u}}=i,h=t&&t[r];if(h&&h.event===a&&h.schema===o&&h.table===l&&h.filter===u)n.push(Object.assign(Object.assign({},i),{id:h.id}));else{this.unsubscribe(),e&&e("CHANNEL_ERROR",Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=n,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,s;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var s,i,n;let a=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(n=null===(i=null===(s=this.params)||void 0===s?void 0:s.config)||void 0===i?void 0:i.broadcast)||void 0===n?void 0:n.ack)||r("ok"),a.receive("ok",()=>r("ok")),a.receive("error",()=>r("error")),a.receive("timeout",()=>r("timed out"))});{let{event:i,payload:n}=e,a={method:"POST",headers:{Authorization:this.socket.accessToken?`Bearer ${this.socket.accessToken}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:n}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,a,null!==(r=t.timeout)&&void 0!==r?r:this.timeout);return await (null===(s=e.body)||void 0===s?void 0:s.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=z.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(K.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{let s=new O(this,K.leave,{},e);s.receive("ok",()=>{t(),r("ok")}).receive("timeout",()=>{t(),r("timed out")}).receive("error",()=>{r("error")}),s.send(),this._canPush()||s.trigger("ok",{})})}async _fetchWithTimeout(e,t,r){let s=new AbortController,i=setTimeout(()=>s.abort(),r),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:s.signal}));return clearTimeout(i),n}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new O(this,e,t,r);return this._canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var s,i;let n=e.toLocaleLowerCase(),{close:a,error:o,leave:l,join:u}=K;if(r&&[a,o,l,u].indexOf(n)>=0&&r!==this._joinRef())return;let h=this._onMessage(n,t,r);if(t&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null===(s=this.bindings.postgres_changes)||void 0===s||s.filter(e=>{var t,r,s;return(null===(t=e.filter)||void 0===t?void 0:t.event)==="*"||(null===(s=null===(r=e.filter)||void 0===r?void 0:r.event)||void 0===s?void 0:s.toLocaleLowerCase())===n}).map(e=>e.callback(h,r)):null===(i=this.bindings[n])||void 0===i||i.filter(e=>{var r,s,i,a,o,l;if(!["broadcast","presence","postgres_changes"].includes(n))return e.type.toLocaleLowerCase()===n;if("id"in e){let n=e.id,a=null===(r=e.filter)||void 0===r?void 0:r.event;return n&&(null===(s=t.ids)||void 0===s?void 0:s.includes(n))&&("*"===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 h&&"ids"in h){let e=h.data,{schema:t,table:r,commit_timestamp:s,type:i,errors:n}=e;h=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:s,eventType:i,new:{},old:{},errors:n}),this._getPayloadRecords(e))}e.callback(h,r)})}_isClosed(){return this.state===z.closed}_isJoined(){return this.state===z.joined}_isJoining(){return this.state===z.joining}_isLeaving(){return this.state===z.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let s=e.toLocaleLowerCase(),i={type:s,filter:t,callback:r};return this.bindings[s]?this.bindings[s].push(i):this.bindings[s]=[i],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(e=>{var s;return!((null===(s=e.type)||void 0===s?void 0:s.toLocaleLowerCase())===r&&C.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(K.close,{},e)}_onError(e){this._on(K.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=z.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=v(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=v(e.columns,e.old_record)),t}}let P=()=>{},$="undefined"!=typeof WebSocket;class R{constructor(e,t){var s;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=m,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=P,this.conn=null,this.sendBuffer=[],this.serializer=new y,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,485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},this.endPoint=`${e}/${J.websocket}`,this.httpEndpoint=A(e),(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({},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===(s=null==t?void 0:t.params)||void 0===s?void 0:s.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 g(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($){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new I(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),r.e(223).then(r.t.bind(r,5223,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 q.connecting:return W.Connecting;case q.open:return W.Open;case q.closing:return W.Closing;default:return W.Closed}}isConnected(){return this.connectionState()===W.Open}channel(e,t={config:{}}){let r=new C(`realtime:${e}`,t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:s,ref:i}=e,n=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};this.log("push",`${t} ${r} (${i})`,s),this.isConnected()?n():this.sendBuffer.push(n)}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(K.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:s,ref:i}=e;(i&&i===this.pendingHeartbeatRef||r===(null==s?void 0:s.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${s.status||""} ${t} ${r} ${i&&"("+i+")"||""}`,s),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,s,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))}_triggerChanError(){this.channels.forEach(e=>e._trigger(K.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${r}${s}`}_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 I{constructor(e,t,r){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=q.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=r.close}}class N extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function L(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class U extends N{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class D extends N{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let B=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,485)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},F=()=>{var e,t,s,i;return e=void 0,t=void 0,s=void 0,i=function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,485))).Response:Response},new(s||(s=Promise))(function(r,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})},M=e=>{if(Array.isArray(e))return e.map(e=>M(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=M(r)}),t};var V,Z,q,z,K,J,W,H,G,Y,X,Q,ee,et,er,es,ei,en,ea,eo,el,eu=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function a(e){try{l(s.next(e))}catch(e){n(e)}}function o(e){try{l(s.throw(e))}catch(e){n(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((s=s.apply(e,t||[])).next())})};let eh=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),ec=(e,t,r)=>eu(void 0,void 0,void 0,function*(){e instanceof(yield F())&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{t(new U(eh(r),e.status||500))}).catch(e=>{t(new D(eh(e),e))}):t(new D(eh(e),e))}),ed=(e,t,r,s)=>{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),s&&(i.body=JSON.stringify(s)),Object.assign(Object.assign({},i),r))};function ef(e,t,r,s,i,n){return eu(this,void 0,void 0,function*(){return new Promise((a,o)=>{e(r,ed(t,s,i,n)).then(e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?e:e.json()}).then(e=>a(e)).catch(e=>ec(e,o,s))})})}function ep(e,t,r,s){return eu(this,void 0,void 0,function*(){return ef(e,"GET",t,r,s)})}function em(e,t,r,s,i){return eu(this,void 0,void 0,function*(){return ef(e,"POST",t,s,i,r)})}function ey(e,t,r,s,i){return eu(this,void 0,void 0,function*(){return ef(e,"DELETE",t,s,i,r)})}var eg=r(6434).Buffer,ev=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function a(e){try{l(s.next(e))}catch(e){n(e)}}function o(e){try{l(s.throw(e))}catch(e){n(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((s=s.apply(e,t||[])).next())})};let e_={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},eb={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ew{constructor(e,t={},r,s){this.url=e,this.headers=t,this.bucketId=r,this.fetch=B(s)}uploadOrUpdate(e,t,r,s){return ev(this,void 0,void 0,function*(){try{let i;let n=Object.assign(Object.assign({},eb),s),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)}),o=n.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",n.cacheControl),i.append("",r),o&&i.append("metadata",this.encodeMetadata(o))):"undefined"!=typeof FormData&&r instanceof FormData?((i=r).append("cacheControl",n.cacheControl),o&&i.append("metadata",this.encodeMetadata(o))):(i=r,a["cache-control"]=`max-age=${n.cacheControl}`,a["content-type"]=n.contentType,o&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(o)))),(null==s?void 0:s.headers)&&(a=Object.assign(Object.assign({},a),s.headers));let l=this._removeEmptyFolders(t),u=this._getFinalPath(l),h=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:e,body:i,headers:a},(null==n?void 0:n.duplex)?{duplex:n.duplex}:{})),c=yield h.json();if(h.ok)return{data:{path:l,id:c.Id,fullPath:c.Key},error:null};return{data:null,error:c}}catch(e){if(L(e))return{data:null,error:e};throw e}})}upload(e,t,r){return ev(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,s){return ev(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),n=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${n}`);a.searchParams.set("token",t);try{let e;let t=Object.assign({upsert:eb.upsert},s),n=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,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);let o=yield this.fetch(a.toString(),{method:"PUT",body:e,headers:n}),l=yield o.json();if(o.ok)return{data:{path:i,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(L(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return ev(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),s=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(s["x-upsert"]="true");let i=yield em(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:s}),n=new URL(this.url+i.url),a=n.searchParams.get("token");if(!a)throw new N("No token returned by API");return{data:{signedUrl:n.toString(),path:e,token:a},error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}update(e,t,r){return ev(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return ev(this,void 0,void 0,function*(){try{return{data:yield em(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}copy(e,t,r){return ev(this,void 0,void 0,function*(){try{return{data:{path:(yield em(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return ev(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e),i=yield em(this.fetch,`${this.url}/object/sign/${s}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i={signedUrl:encodeURI(`${this.url}${i.signedURL}${n}`)},error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return ev(this,void 0,void 0,function*(){try{let s=yield em(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:s.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null})),error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}download(e,t){return ev(this,void 0,void 0,function*(){let r=void 0!==(null==t?void 0:t.transform),s=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=s?`?${s}`:"";try{let t=this._getFinalPath(e),s=yield ep(this.fetch,`${this.url}/${r?"render/image/authenticated":"object"}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield s.blob(),error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}info(e){return ev(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield ep(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:M(e),error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}exists(e){return ev(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,s){return eu(this,void 0,void 0,function*(){return ef(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)})}(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(L(e)&&e instanceof D){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),s=[],i=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&s.push(i);let n=void 0!==(null==t?void 0:t.transform),a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==a&&s.push(a);let o=s.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${n?"render/image":"object"}/public/${r}${o}`)}}}remove(e){return ev(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(L(e))return{data:null,error:e};throw e}})}list(e,t,r){return ev(this,void 0,void 0,function*(){try{let s=Object.assign(Object.assign(Object.assign({},e_),t),{prefix:e||""});return{data:yield em(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==eg?eg.from(e).toString("base64"):btoa(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.7.0"};var eS=function(e,t,r,s){return new(r||(r=Promise))(function(i,n){function a(e){try{l(s.next(e))}catch(e){n(e)}}function o(e){try{l(s.throw(e))}catch(e){n(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((s=s.apply(e,t||[])).next())})};class ex{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},ek),t),this.fetch=B(r)}listBuckets(){return eS(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(L(e))return{data:null,error:e};throw e}})}getBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(L(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 em(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(L(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,s,i){return eu(this,void 0,void 0,function*(){return ef(e,"PUT",t,s,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(L(e))return{data:null,error:e};throw e}})}emptyBucket(e){return eS(this,void 0,void 0,function*(){try{return{data:yield em(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(L(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(L(e))return{data:null,error:e};throw e}})}}class eT extends ex{constructor(e,t={},r){super(e,t,r)}from(e){return new ew(this.url,this.headers,e,this.fetch)}}let eE="";"undefined"!=typeof Deno?eE="deno":"undefined"!=typeof document?eE="web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?eE="react-native":eE="node";let eA={headers:{"X-Client-Info":`supabase-js-${eE}/2.45.4`}},eO={schema:"public"},ej={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eC={};var eP=r(485);let e$=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=eP.default:t=fetch,(...e)=>t(...e)},eR=()=>"undefined"==typeof Headers?eP.Headers:Headers,eI=(e,t,r)=>{let s=e$(r),i=eR();return(r,n)=>{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==n?void 0:n.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),s(r,Object.assign(Object.assign({},n),{headers:l}))},new(l||(l=Promise))(function(e,t){function r(e){try{i(u.next(e))}catch(e){t(e)}}function s(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,s)}i((u=u.apply(a,o||[])).next())})}},eN="2.65.0",eL={"X-Client-Info":`gotrue-js/${eN}`},eU="X-Supabase-Api-Version",eD={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eB=()=>"undefined"!=typeof document,eF={tested:!1,writable:!1},eM=()=>{if(!eB())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(eF.tested)return eF.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),eF.tested=!0,eF.writable=!0}catch(e){eF.tested=!0,eF.writable=!1}return eF.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,485)).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,ez=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},eK=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},eJ=async(e,t)=>{await e.removeItem(t)};class eW{constructor(){this.promise=new eW.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function eH(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,s,i,n,a,o;let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",h=0;for(e=e.replace("-","+").replace("_","/");h<e.length;)i=l.indexOf(e.charAt(h++)),n=l.indexOf(e.charAt(h++)),a=l.indexOf(e.charAt(h++)),o=l.indexOf(e.charAt(h++)),t=i<<2|n>>4,r=(15&n)<<4|a>>2,s=(3&a)<<6|o,u+=String.fromCharCode(t),64!=a&&0!=r&&(u+=String.fromCharCode(r)),64!=o&&0!=s&&(u+=String.fromCharCode(s));return u}(t[1]))}async function eG(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function eY(e){return("0"+e.toString(16)).substr(-2)}async function eX(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 eQ(e){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"undefined"!=typeof TextEncoder?btoa(await eX(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 e0(e,t,r=!1){let s=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let s=0;s<56;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,eY).join("")}(),i=s;r&&(i+="/PASSWORD_RECOVERY"),await ez(e,`${t}-code-verifier`,i);let n=await eQ(s),a=s===n?"plain":"s256";return[n,a]}eW.promiseConstructor=Promise;let e1=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;class e2 extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function e4(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class e6 extends e2{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class e5 extends e2{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class e8 extends e2{constructor(e,t,r,s){super(e,r,s),this.name=t,this.status=r}}class e3 extends e8{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class e9 extends e8{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class e7 extends e8{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class te extends e8{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 tt extends e8{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 tr extends e8{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function ts(e){return e4(e)&&"AuthRetryableFetchError"===e.name}class ti extends e8{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}var tn=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)0>t.indexOf(s[i])&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r};let ta=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),to=[502,503,504];async function tl(e){var t;let r,s;if(!eq(e))throw new tr(ta(e),0);if(to.includes(e.status))throw new tr(ta(e),e.status);try{r=await e.json()}catch(e){throw new e5(ta(e),e)}let i=function(e){let t=e.headers.get(eU);if(!t||!t.match(e1))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(i&&i.getTime()>=eD["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?s=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(s=r.error_code),s){if("weak_password"===s)throw new ti(ta(r),e.status,(null===(t=r.weak_password)||void 0===t?void 0:t.reasons)||[]);if("session_not_found"===s)throw new e3}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 ti(ta(r),e.status,r.weak_password.reasons);throw new e6(ta(r),e.status||500,s)}let tu=(e,t,r,s)=>{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(s),Object.assign(Object.assign({},i),r))};async function th(e,t,r,s){var i;let n=Object.assign({},null==s?void 0:s.headers);n[eU]||(n[eU]=eD["2024-01-01"].name),(null==s?void 0:s.jwt)&&(n.Authorization=`Bearer ${s.jwt}`);let a=null!==(i=null==s?void 0:s.query)&&void 0!==i?i:{};(null==s?void 0:s.redirectTo)&&(a.redirect_to=s.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await tc(e,t,r+o,{headers:n,noResolveJson:null==s?void 0:s.noResolveJson},{},null==s?void 0:s.body);return(null==s?void 0:s.xform)?null==s?void 0:s.xform(l):{data:Object.assign({},l),error:null}}async function tc(e,t,r,s,i,n){let a;let o=tu(t,s,i,n);try{a=await e(r,Object.assign({},o))}catch(e){throw console.error(e),new tr(ta(e),0)}if(a.ok||await tl(a),null==s?void 0:s.noResolveJson)return a;try{return await a.json()}catch(e){await tl(e)}}function td(e){var t,r;let s=null;return e.access_token&&e.refresh_token&&e.expires_in&&(s=Object.assign({},e),!e.expires_at)&&(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)),{data:{session:s,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function tf(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 tp(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function tm(e){return{data:e,error:null}}function ty(e){let{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:n}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:n},user:Object.assign({},tn(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function tg(e){return e}var tv=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)0>t.indexOf(s[i])&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r};class t_{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 th(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(e4(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await th(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tp})}catch(e){if(e4(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=tv(e,["options"]),s=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(s.new_email=null==r?void 0:r.newEmail,delete s.newEmail),await th(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:ty,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(e4(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await th(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tp})}catch(e){if(e4(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,s,i,n,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await th(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===(s=null==e?void 0:e.perPage)||void 0===s?void 0:s.toString())&&void 0!==i?i:""},xform:tg});if(u.error)throw u.error;let h=await u.json(),c=null!==(n=u.headers.get("x-total-count"))&&void 0!==n?n:0,d=null!==(o=null===(a=u.headers.get("link"))||void 0===a?void 0:a.split(","))&&void 0!==o?o:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(c)),{data:Object.assign(Object.assign({},h),l),error:null}}catch(e){if(e4(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await th(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tp})}catch(e){if(e4(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await th(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tp})}catch(e){if(e4(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await th(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tp})}catch(e){if(e4(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{let{data:t,error:r}=await th(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(e4(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await th(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(e4(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 tw(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let tk={debug:!!(globalThis&&eM()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tS extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tx extends tS{}async function tT(e,t,r){tk.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),tk.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:s.signal},async s=>{if(s){tk.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,s.name);try{return await r()}finally{tk.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,s.name)}}else{if(0===t)throw tk.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tx(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(tk.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:eL,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function tA(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.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=tO.nextInstanceID,tO.nextInstanceID+=1,this.instanceID>0&&eB()&&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 s=Object.assign(Object.assign({},tE),e);if(this.logDebugMessages=!!s.debug,"function"==typeof s.debug&&(this.logger=s.debug),this.persistSession=s.persistSession,this.storageKey=s.storageKey,this.autoRefreshToken=s.autoRefreshToken,this.admin=new t_({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=eZ(s.fetch),this.lock=s.lock||tA,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,s.lock?this.lock=s.lock:eB()&&(null===(t=null==globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=tT:this.lock=tA,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?s.storage?this.storage=s.storage:eM()?this.storage=tb:(this.memoryStorage={},this.storage=tw(this.memoryStorage)):(this.memoryStorage={},this.storage=tw(this.memoryStorage)),eB()&&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} (${eN}) ${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=!!eB()&&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:s,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",s,"redirect type",i),await this._saveSession(s),setTimeout(async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(e4(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,s;try{let{data:i,error:n}=await th(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===(s=null==e?void 0:e.options)||void 0===s?void 0:s.captchaToken}},xform:td});if(n||!i)return{data:{user:null,session:null},error:n};let a=i.session,o=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:o,session:a},error:null}}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,s;try{let i;if("email"in e){let{email:r,password:s,options:n}=e,a=null,o=null;"pkce"===this.flowType&&([a,o]=await e0(this.storage,this.storageKey)),i=await th(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:r,password:s,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:td})}else if("phone"in e){let{phone:t,password:n,options:a}=e;i=await th(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(r=null==a?void 0:a.data)&&void 0!==r?r:{},channel:null!==(s=null==a?void 0:a.channel)&&void 0!==s?s:"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:n,error:a}=i;if(a||!n)return{data:{user:null,session:null},error:a};let o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:s,options:i}=e;t=await th(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:tf})}else if("phone"in e){let{phone:r,password:s,options:i}=e;t=await th(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:tf})}else throw new e7("You must provide either an email or phone number and a password");let{data:r,error:s}=t;if(s)return{data:{user:null,session:null},error:s};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new e9};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:s}}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(s=e.options)||void 0===s?void 0:s.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 eK(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(null!=t?t:"").split("/");try{let{data:t,error:i}=await th(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:td});if(await eJ(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user)return{data:{user:null,session:null,redirectType:null},error:new e9};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign(Object.assign({},t),{redirectType:null!=s?s:null}),error:i}}catch(e){if(e4(e))return{data:{user:null,session:null,redirectType:null},error:e};throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:s,access_token:i,nonce:n}=e,{data:a,error:o}=await th(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform: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 e9};return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:o}}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,s,i,n;try{if("email"in e){let{email:s,options:i}=e,n=null,a=null;"pkce"===this.flowType&&([n,a]=await e0(this.storage,this.storageKey));let{error:o}=await th(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:s,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},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:n,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 th(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(s=null==r?void 0:r.data)&&void 0!==s?s:{},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!==(n=null==r?void 0:r.channel)&&void 0!==n?n:"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(e4(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let s,i;"options"in e&&(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(r=e.options)||void 0===r?void 0:r.captchaToken);let{data:n,error:a}=await th(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:td});if(a)throw a;if(!n)throw Error("An error occurred on token verification.");let o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,s;try{let i=null,n=null;return"pkce"===this.flowType&&([i,n]=await e0(this.storage,this.storageKey)),await th(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===(s=null==e?void 0:e.options)||void 0===s?void 0:s.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:n}),headers:this.headers,xform:tm})}catch(e){if(e4(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:s}=await th(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:s}})}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:s,options:i}=e,{error:n}=await th(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){let{phone:r,type:s,options:i}=e,{data:n,error:a}=await th(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a}}throw new e7("You must provide either an email or phone number and a type")}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let e=null,t=await eK(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 valid"),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=this.suppressGetSessionWarning;e=new Proxy(e,{get:(e,r,s)=>(t||"user"!==r||(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=!0,this.suppressGetSessionWarning=!0),Reflect.get(e,r,s))})}return{data:{session:e},error:null}}let{session:s,error:i}=await this._callRefreshToken(e.refresh_token);if(i)return{data:{session:null},error:i};return{data:{session:s},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{if(e)return await th(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tp});return await this._useSession(async e=>{var t,r,s;let{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await th(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(s=null===(r=i.session)||void 0===r?void 0:r.access_token)&&void 0!==s?s:void 0,xform:tp}):{data:{user:null},error:new e3}})}catch(e){if(e4(e))return e4(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await eJ(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{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:s,error:i}=r;if(i)throw i;if(!s.session)throw new e3;let n=s.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await e0(this.storage,this.storageKey));let{data:l,error:u}=await th(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:tp});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}})}catch(e){if(e4(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return eH(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,s=!0,i=null,n=eH(e.access_token);if(n.exp&&(s=(r=n.exp)<=t),s){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:s,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:s.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(e4(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:s,error:i}=t;if(i)throw i;e=null!==(r=s.session)&&void 0!==r?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new e3;let{session:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:s?{data:{user:s.user,session:s},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(e4(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!eB())throw new te("No browser detected.");if("implicit"!==this.flowType||this._isImplicitGrantFlow()){if("pkce"==this.flowType&&!e)throw new tt("Not a valid PKCE flow url.")}else throw new te("Not a valid implicit grant flow url.");let t=eV(window.location.href);if(e){if(!t.code)throw new tt("No code detected.");let{data:e,error:r}=await this._exchangeCodeForSession(t.code);if(r)throw r;let s=new URL(window.location.href);return s.searchParams.delete("code"),window.history.replaceState(window.history.state,"",s.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new te(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:s,access_token:i,refresh_token:n,expires_in:a,expires_at:o,token_type:l}=t;if(!i||!a||!n||!l)throw new te("No session defined in URL");let u=Math.round(Date.now()/1e3),h=parseInt(a),c=u+h;o&&(c=parseInt(o));let d=c-u;1e3*d<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${h}s`);let f=c-h;u-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,c,u):u-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",f,c,u);let{data:p,error:m}=await this._getUser(i);if(m)throw m;let y={provider_token:r,provider_refresh_token:s,access_token:i,expires_in:h,expires_at:c,refresh_token:n,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:t.type},error:null}}catch(e){if(e4(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){let e=eV(window.location.href);return!!(eB()&&(e.access_token||e.error_description))}async _isPKCEFlow(){let e=eV(window.location.href),t=await eK(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:s,error:i}=t;if(i)return{error:i};let n=null===(r=s.session)||void 0===r?void 0:r.access_token;if(n){let{error:t}=await this.admin.signOut(n,e);if(t&&!(e4(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await eJ(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,s;try{let{data:{session:s},error:i}=t;if(i)throw i;await (null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(t){await (null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,s=null;"pkce"===this.flowType&&([r,s]=await e0(this.storage,this.storageKey,!0));try{return await th(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(e4(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(e4(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{let{data:r,error:s}=await this._useSession(async t=>{var r,s,i,n,a;let{data:o,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(r=e.options)||void 0===r?void 0:r.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await th(this.fetch,"GET",u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(s)throw s;return!eB()||(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(e4(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,s;let{data:i,error:n}=t;if(n)throw n;return await th(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(s=null===(r=i.session)||void 0===r?void 0:r.access_token)&&void 0!==s?s:void 0})})}catch(e){if(e4(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,s;let i=Date.now();return await (r=async r=>(r>0&&await eG(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await th(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:td})),s=(e,t)=>t&&ts(t)&&Date.now()+200*Math.pow(2,e)-i<3e4,new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{let t=await r(i);if(!s(i,null,t)){e(t);return}}catch(e){if(!s(i,e)){t(e);return}}})()}))}catch(e){if(this._debug(t,"error",e),e4(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),eB()&&!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 eK(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 s=Math.round(Date.now()/1e3),i=(null!==(e=r.expires_at)&&void 0!==e?e:1/0)<s+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),ts(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 s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new eW;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 s={session:t.session,error:null};return this.refreshingDeferred.resolve(s),s}catch(e){if(this._debug(s,"error",e),e4(e)){let r={session:null,error:e};return ts(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(s,"end")}}async _notifyAllSubscribers(e,t,r=!0){let s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let s=[],i=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){s.push(e)}});if(await Promise.all(i),s.length>0){for(let e=0;e<s.length;e+=1)console.error(s[e]);throw s[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await ez(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await eJ(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&eB()&&(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 s=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),s<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof tS)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!eB()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-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 s=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await e0(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});s.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);s.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:s,error:i}=t;return i?{data:null,error:i}:await th(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(r=null==s?void 0:s.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e4(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,s;let{data:i,error:n}=t;if(n)return{data:null,error:n};let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:{issuer:e.issuer}),{data:o,error:l}=await th(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token});return l?{data:null,error:l}:("phone"===e.factorType&&delete o.totp,"totp"===e.factorType&&(null===(s=null==o?void 0:o.totp)||void 0===s?void 0:s.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(e4(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:s,error:i}=t;if(i)return{data:null,error:i};let{data:n,error:a}=await th(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(r=null==s?void 0:s.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)+n.expires_in},n)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",n),{data:n,error:a})})}catch(e){if(e4(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:s,error:i}=t;return i?{data:null,error:i}:await th(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:null===(r=null==s?void 0:s.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e4(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)||[],s=r.filter(e=>"totp"===e.factor_type&&"verified"===e.status),i=r.filter(e=>"phone"===e.factor_type&&"verified"===e.status);return{data:{all:r,totp:s,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:s},error:i}=e;if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let n=this._decodeJWT(s.access_token),a=null;n.aal&&(a=n.aal);let o=a;return(null!==(r=null===(t=s.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:n.amr||[]},error:null}}))}}tO.nextInstanceID=0;var tj=tO;class tC extends tj{constructor(e){super(e)}}class tP{constructor(e,t,r){var s,i,n;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw Error("supabaseUrl is required.");if(!t)throw Error("supabaseKey is required.");let a=e.replace(/\/$/,"");this.realtimeUrl=`${a}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${a}/auth/v1`,this.storageUrl=`${a}/storage/v1`,this.functionsUrl=`${a}/functions/v1`;let o=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l=function(e,t){let{db:r,auth:s,realtime:i,global:n}=e,{db:a,auth:o,realtime:l,global:u}=t,h={db:Object.assign(Object.assign({},a),r),auth:Object.assign(Object.assign({},o),s),realtime:Object.assign(Object.assign({},l),i),global:Object.assign(Object.assign({},u),n),accessToken:()=>{var e,t,r,s;return e=this,t=void 0,s=function*(){return""},new(r=void 0,r=Promise)(function(i,n){function a(e){try{l(s.next(e))}catch(e){n(e)}}function o(e){try{l(s.throw(e))}catch(e){n(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((s=s.apply(e,t||[])).next())})}};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}(null!=r?r:{},{db:eO,realtime:eC,auth:Object.assign(Object.assign({},ej),{storageKey:o}),global:eA});this.storageKey=null!==(s=l.auth.storageKey)&&void 0!==s?s:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(n=l.auth)&&void 0!==n?n:{},this.headers,l.global.fetch),this.fetch=eI(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},l.realtime)),this.rest=new h(`${a}/rest/v1`,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),l.accessToken||this._listenForAuthEvents()}get functions(){return new u(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new eT(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,s,i,n;return r=this,s=void 0,i=void 0,n=function*(){if(this.accessToken)return yield this.accessToken();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(n.next(e))}catch(e){t(e)}}function o(e){try{l(n.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((n=n.apply(r,s||[])).next())})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,storageKey:i,flowType:n,lock:a,debug:o},l,u){var h;let c={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new tC({url:this.authUrl,headers:Object.assign(Object.assign({},c),l),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,flowType:n,lock:a,debug:o,fetch:u,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new R(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 t$=(e,t,r)=>new tP(e,t,r);var tR=r(469);function tI(){return"undefined"!=typeof window&&void 0!==window.document}let tN={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4},tL=/^(.*)[.](0|[1-9][0-9]*)$/;function tU(e,t){if(e===t)return!0;let r=e.match(tL);return!!r&&r[1]===t}function tD(e,t,r){let s=r??3180,i=encodeURIComponent(t);if(i.length<=s)return[{name:e,value:t}];let n=[];for(;i.length>0;){let e=i.slice(0,s),t=e.lastIndexOf("%");t>s-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}n.push(r),i=i.slice(e.length)}return n.map((t,r)=>({name:`${e}.${r}`,value:t}))}async function tB(e,t){let r=await t(e);if(r)return r;let s=[];for(let r=0;;r++){let i=`${e}.${r}`,n=await t(i);if(!n)break;s.push(n)}return s.length>0?s.join(""):null}let tF="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),tM=" 	\n\r=".split(""),tV=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<tM.length;t+=1)e[tM[t].charCodeAt(0)]=-2;for(let t=0;t<tF.length;t+=1)e[tF[t].charCodeAt(0)]=t;return e})();function tZ(e){let t=[],r=0,s=0;if(function(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){let t=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127){t(e);return}if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(s,t)}}(e,e=>{for(r=r<<8|e,s+=8;s>=6;){let e=r>>s-6&63;t.push(tF[e]),s-=6}}),s>0)for(r<<=6-s,s=6;s>=6;){let e=r>>s-6&63;t.push(tF[e]),s-=6}return t.join("")}function tq(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},s={utf8seq:0,codepoint:0},i=0,n=0;for(let t=0;t<e.length;t+=1){let a=tV[e.charCodeAt(t)];if(a>-1)for(i=i<<6|a,n+=6;n>=8;)(function(e,t,r){if(0===t.utf8seq){if(e<=127){r(e);return}for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}})(i>>n-8&255,s,r),n-=8;else if(-2===a)continue;else throw Error(`Invalid Base64-URL character "${e.at(t)}" at position ${t}`)}return t.join("")}let tz="base64-";async function tK({getAll:e,setAll:t,setItems:r,removedItems:s},i){let n=i.cookieEncoding,a=i.cookieOptions??null,o=await e([...r?Object.keys(r):[],...s?Object.keys(s):[]]),l=o?.map(({name:e})=>e)||[],u=Object.keys(s).flatMap(e=>l.filter(t=>tU(t,e))),h=Object.keys(r).flatMap(e=>{let t=new Set(l.filter(t=>tU(t,e))),s=r[e];"base64url"===n&&(s=tz+tZ(s));let i=tD(e,s);return i.forEach(e=>{t.delete(e.name)}),u.push(...t),i}),c={...tN,...a,maxAge:0},d={...tN,...a,maxAge:tN.maxAge};delete c.name,delete d.name,await t([...u.map(e=>({name:e,value:"",options:c})),...h.map(({name:e,value:t})=>({name:e,value:t,options:d}))])}function tJ(e,t,r){let i=r?.isSingleton===!0||(!r||!("isSingleton"in r))&&tI();if(i&&s)return s;if(!e||!t)throw Error(`@supabase/ssr: Your project's URL and API key are required to create a Supabase client!

Check your Supabase project's API settings to find these values

https://supabase.com/dashboard/project/_/settings/api`);let{storage:n}=function(e,t){let r,s;let i=e.cookies??null,n=e.cookieEncoding,a={},o={};if(i){if("get"in i){let e=async e=>{let t=e.flatMap(e=>[e,...Array.from({length:5}).map((t,r)=>`${e}.${r}`)]),r=[];for(let e=0;e<t.length;e+=1){let s=await i.get(t[e]);(s||"string"==typeof s)&&r.push({name:t[e],value:s})}return r};if(r=async t=>await e(t),"set"in i&&"remove"in i)s=async e=>{for(let t=0;t<e.length;t+=1){let{name:r,value:s,options:n}=e[t];s?await i.set(r,s,n):await i.remove(r,n)}};else if(t)s=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in i){if(r=async()=>await i.getAll(),"setAll"in i)s=i.setAll;else if(t)s=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)")}else throw Error(`@supabase/ssr: ${t?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${tI()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`)}else if(!t&&tI()){let e=()=>{let e=(0,tR.Q)(document.cookie);return Object.keys(e).map(t=>({name:t,value:e[t]}))};r=()=>e(),s=e=>{e.forEach(({name:e,value:t,options:r})=>{document.cookie=(0,tR.q)(e,t,r)})}}else if(t)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else r=()=>[],s=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return t?{getAll:r,setAll:s,setItems:a,removedItems:o,storage:{isServer:!0,getItem:async e=>{if("string"==typeof a[e])return a[e];if(o[e])return null;let t=await r([e]),s=await tB(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});if(!s)return null;let i=s;return s.startsWith(tz)&&(i=tq(s.substring(tz.length))),i},setItem:async(t,i)=>{t.endsWith("-code-verifier")&&await tK({getAll:r,setAll:s,setItems:{[t]:i},removedItems:{}},{cookieOptions:e?.cookieOptions??null,cookieEncoding:n}),a[t]=i,delete o[t]},removeItem:async e=>{delete a[e],o[e]=!0}}}:{getAll:r,setAll:s,setItems:a,removedItems:o,storage:{isServer:!1,getItem:async e=>{let t=await r([e]),s=await tB(e,async e=>{let r=t?.find(({name:t})=>t===e)||null;return r?r.value:null});if(!s)return null;let i=s;return s.startsWith(tz)&&(i=tq(s.substring(tz.length))),i},setItem:async(t,i)=>{let a=await r([t]),o=new Set((a?.map(({name:e})=>e)||[]).filter(e=>tU(e,t))),l=i;"base64url"===n&&(l=tz+tZ(i));let u=tD(t,l);u.forEach(({name:e})=>{o.delete(e)});let h={...tN,...e?.cookieOptions,maxAge:0},c={...tN,...e?.cookieOptions,maxAge:tN.maxAge};delete h.name,delete c.name;let d=[...[...o].map(e=>({name:e,value:"",options:h})),...u.map(({name:e,value:t})=>({name:e,value:t,options:c}))];d.length>0&&await s(d)},removeItem:async t=>{let i=await r([t]),n=(i?.map(({name:e})=>e)||[]).filter(e=>tU(e,t)),a={...tN,...e?.cookieOptions,maxAge:0};delete a.name,n.length>0&&await s(n.map(e=>({name:e,value:"",options:a})))}}}}({...r,cookieEncoding:r?.cookieEncoding??"base64url"},!1),a=t$(e,t,{...r,global:{...r?.global,headers:{...r?.global?.headers,"X-Client-Info":"supabase-ssr/0.5.1"}},auth:{...r?.auth,...r?.cookieOptions?.name?{storageKey:r.cookieOptions.name}:null,flowType:"pkce",autoRefreshToken:tI(),detectSessionInUrl:tI(),persistSession:!0,storage:n}});return i&&(s=a),a}},469: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={},s=(t||{}).decode||i,n=0;n<e.length;){var a=e.indexOf("=",n);if(-1===a)break;var o=e.indexOf(";",n);if(-1===o)o=e.length;else if(o<a){n=e.lastIndexOf(";",a-1)+1;continue}var l=e.slice(n,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,s)}n=o+1}return r},t.q=function(e,t,i){var a=i||{},o=a.encode||n;if("function"!=typeof o)throw TypeError("option encode is invalid");if(!s.test(e))throw TypeError("argument name is invalid");var l=o(t);if(l&&!s.test(l))throw TypeError("argument val is invalid");var u=e+"="+l;if(null!=a.maxAge){var h=a.maxAge-0;if(isNaN(h)||!isFinite(h))throw TypeError("option maxAge is invalid");u+="; Max-Age="+Math.floor(h)}if(a.domain){if(!s.test(a.domain))throw TypeError("option domain is invalid");u+="; Domain="+a.domain}if(a.path){if(!s.test(a.path))throw TypeError("option path is invalid");u+="; Path="+a.path}if(a.expires){var c=a.expires;if("[object Date]"!==r.call(c)&&!(c instanceof Date)||isNaN(c.valueOf()))throw TypeError("option expires is invalid");u+="; Expires="+c.toUTCString()}if(a.httpOnly&&(u+="; HttpOnly"),a.secure&&(u+="; Secure"),a.partitioned&&(u+="; Partitioned"),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,s=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function i(e){return -1!==e.indexOf("%")?decodeURIComponent(e):e}function n(e){return encodeURIComponent(e)}},6540:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]])},6434:function(e){!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],s=t[1];return(r+s)*3/4-s},t.toByteArray=function(e){var t,r,n=l(e),a=n[0],o=n[1],u=new i((a+o)*3/4-o),h=0,c=o>0?a-4:a;for(r=0;r<c;r+=4)t=s[e.charCodeAt(r)]<<18|s[e.charCodeAt(r+1)]<<12|s[e.charCodeAt(r+2)]<<6|s[e.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;return 2===o&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,u[h++]=255&t),1===o&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t),u},t.fromByteArray=function(e){for(var t,s=e.length,i=s%3,n=[],a=0,o=s-i;a<o;a+=16383)n.push(function(e,t,s){for(var i,n=[],a=t;a<s;a+=3)n.push(r[(i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]))>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return n.join("")}(e,a,a+16383>o?o:a+16383));return 1===i?n.push(r[(t=e[s-1])>>2]+r[t<<4&63]+"=="):2===i&&n.push(r[(t=(e[s-2]<<8)+e[s-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),n.join("")};for(var r=[],s=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=n.length;a<o;++a)r[a]=n[a],s[n.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var s=r===t?0:4-r%4;return[r,s]}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},72:function(e,t,r){"use strict";var s=r(675),i=r(783),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|f(e,t),s=a(r),i=s.write(e,t);return i!==r&&(s=s.slice(0,i)),s}(e,t);if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return function(e,t,r){var s;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(s=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),s}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var s=e.valueOf&&e.valueOf();if(null!=s&&s!==e)return o.from(s,t,r);var i=function(e){if(o.isBuffer(e)){var t,r=0|d(e.length),s=a(r);return 0===s.length||e.copy(s,0,0,r),s}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?a(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return u(e),a(e<0?0:0|d(e))}function c(e){for(var t=e.length<0?0:0|d(e.length),r=a(t),s=0;s<t;s+=1)r[s]=255&e[s];return r}function d(e){if(e>=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,s=arguments.length>2&&!0===arguments[2];if(!s&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(i)return s?-1:T(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var i,n,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var s=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>s)&&(r=s);for(var i="",n=t;n<r;++n)i+=C[e[n]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var s="";r=Math.min(e.length,r);for(var i=t;i<r;++i)s+=String.fromCharCode(127&e[i]);return s}(this,t,r);case"latin1":case"binary":return function(e,t,r){var s="";r=Math.min(e.length,r);for(var i=t;i<r;++i)s+=String.fromCharCode(e[i]);return s}(this,t,r);case"base64":return i=t,n=r,0===i&&n===this.length?s.fromByteArray(this):s.fromByteArray(this.slice(i,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var s=e.slice(t,r),i="",n=0;n<s.length;n+=2)i+=String.fromCharCode(s[n]+256*s[n+1]);return i}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,r){var s=e[t];e[t]=e[r],e[r]=s}function y(e,t,r,s,i){var n;if(0===e.length)return -1;if("string"==typeof r?(s=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(n=r=+r)!=n&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=o.from(t,s)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,s,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,s,i);throw TypeError("val must be string, number or Buffer")}function g(e,t,r,s,i){var n,a=1,o=e.length,l=t.length;if(void 0!==s&&("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var h=-1;for(n=r;n<o;n++)if(u(e,n)===u(t,-1===h?0:n-h)){if(-1===h&&(h=n),n-h+1===l)return h*a}else -1!==h&&(n-=n-h),h=-1}else for(r+l>o&&(r=o-l),n=r;n>=0;n--){for(var c=!0,d=0;d<l;d++)if(u(e,n+d)!==u(t,d)){c=!1;break}if(c)return n}return -1}function v(e,t,r){r=Math.min(e.length,r);for(var s=[],i=t;i<r;){var n,a,o,l,u=e[i],h=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:(192&(n=e[i+1]))==128&&(l=(31&u)<<6|63&n)>127&&(h=l);break;case 3:n=e[i+1],a=e[i+2],(192&n)==128&&(192&a)==128&&(l=(15&u)<<12|(63&n)<<6|63&a)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:n=e[i+1],a=e[i+2],o=e[i+3],(192&n)==128&&(192&a)==128&&(192&o)==128&&(l=(15&u)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(h=l)}null===h?(h=65533,c=1):h>65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|1023&h),s.push(h),i+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",s=0;s<t;)r+=String.fromCharCode.apply(String,e.slice(s,s+=4096));return r}(s)}function _(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function b(e,t,r,s,i,n){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<n)throw RangeError('"value" argument is out of bounds');if(r+s>e.length)throw RangeError("Index out of range")}function w(e,t,r,s,i,n){if(r+s>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,s,n){return t=+t,r>>>=0,n||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,s,23,4),r+4}function S(e,t,r,s,n){return t=+t,r>>>=0,n||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,s,52,8),r+8}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return h(e)},o.allocUnsafeSlow=function(e){return h(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(j(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),j(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,s=t.length,i=0,n=Math.min(r,s);i<n;++i)if(e[i]!==t[i]){r=e[i],s=t[i];break}return r<s?-1:s<r?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,s=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var n=e[r];if(j(n,Uint8Array)&&(n=o.from(n)),!o.isBuffer(n))throw TypeError('"list" argument must be an Array of Buffers');n.copy(s,i),i+=n.length}return s},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,r,s,i){if(j(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===s&&(s=0),void 0===i&&(i=this.length),t<0||r>e.length||s<0||i>this.length)throw RangeError("out of range index");if(s>=i&&t>=r)return 0;if(s>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,s>>>=0,i>>>=0,this===e)return 0;for(var n=i-s,a=r-t,l=Math.min(n,a),u=this.slice(s,i),h=e.slice(t,r),c=0;c<l;++c)if(u[c]!==h[c]){n=u[c],a=h[c];break}return n<a?-1:a<n?1:0},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},o.prototype.write=function(e,t,r,s){if(void 0===t)s="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)s=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===s&&(s="utf8")):(s=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,n,a,o,l,u,h,c,d,f,p,m,y=this.length-t;if((void 0===r||r>y)&&(r=y),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var g=!1;;)switch(s){case"hex":return function(e,t,r,s){r=Number(r)||0;var i=e.length-r;s?(s=Number(s))>i&&(s=i):s=i;var n=t.length;s>n/2&&(s=n/2);for(var a=0;a<s;++a){var o=parseInt(t.substr(2*a,2),16);if(o!=o)break;e[r+a]=o}return a}(this,e,t,r);case"utf8":case"utf-8":return l=t,u=r,O(T(e,this.length-l),this,l,u);case"ascii":return h=t,c=r,O(E(e),this,h,c);case"latin1":case"binary":return i=this,n=e,a=t,o=r,O(E(n),i,a,o);case"base64":return d=t,f=r,O(A(e),this,d,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p=t,m=r,O(function(e,t){for(var r,s,i=[],n=0;n<e.length&&!((t-=2)<0);++n)s=(r=e.charCodeAt(n))>>8,i.push(r%256),i.push(s);return i}(e,this.length-p),this,p,m);default:if(g)throw TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),g=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var s=this.subarray(e,t);return Object.setPrototypeOf(s,o.prototype),s},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var s=this[e],i=1,n=0;++n<t&&(i*=256);)s+=this[e+n]*i;return s},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var s=this[e+--t],i=1;t>0&&(i*=256);)s+=this[e+--t]*i;return s},o.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var s=this[e],i=1,n=0;++n<t&&(i*=256);)s+=this[e+n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var s=t,i=1,n=this[e+--s];s>0&&(i*=256);)n+=this[e+--s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readInt8=function(e,t){return(e>>>=0,t||_(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,s){if(e=+e,t>>>=0,r>>>=0,!s){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var n=1,a=0;for(this[t]=255&e;++a<r&&(n*=256);)this[t+a]=e/n&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,s){if(e=+e,t>>>=0,r>>>=0,!s){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var n=r-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var n=0,a=1,o=0;for(this[t]=255&e;++n<r&&(a*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/a>>0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var n=r-1,a=1,o=0;for(this[t+n]=255&e;--n>=0&&(a*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/a>>0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,s){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),s||0===s||(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s<r&&(s=r),s===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(s<0)throw RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t<s-r&&(s=e.length-t+r);var i=s-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,s);else if(this===e&&r<t&&t<s)for(var n=i-1;n>=0;--n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,s),t);return i},o.prototype.fill=function(e,t,r,s){if("string"==typeof e){if("string"==typeof t?(s=t,t=0,r=this.length):"string"==typeof r&&(s=r,r=this.length),void 0!==s&&"string"!=typeof s)throw TypeError("encoding must be a string");if("string"==typeof s&&!o.isEncoding(s))throw TypeError("Unknown encoding: "+s);if(1===e.length){var i,n=e.charCodeAt(0);("utf8"===s&&n<128||"latin1"===s)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=o.isBuffer(e)?e:o.from(e,s),l=a.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var x=/[^+/0-9A-Za-z-_]/g;function T(e,t){t=t||1/0;for(var r,s=e.length,i=null,n=[],a=0;a<s;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===s){(t-=3)>-1&&n.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&n.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&n.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;n.push(r)}else if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return n}function E(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function A(e){return s.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,s){for(var i=0;i<s&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function j(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var C=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var s=16*r,i=0;i<16;++i)t[s+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,s,i){var n,a,o=8*i-s-1,l=(1<<o)-1,u=l>>1,h=-7,c=r?i-1:0,d=r?-1:1,f=e[t+c];for(c+=d,n=f&(1<<-h)-1,f>>=-h,h+=o;h>0;n=256*n+e[t+c],c+=d,h-=8);for(a=n&(1<<-h)-1,n>>=-h,h+=s;h>0;a=256*a+e[t+c],c+=d,h-=8);if(0===n)n=1-u;else{if(n===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,s),n-=u}return(f?-1:1)*a*Math.pow(2,n-s)},t.write=function(e,t,r,s,i,n){var a,o,l,u=8*n-i-1,h=(1<<u)-1,c=h>>1,d=23===i?5960464477539062e-23:0,f=s?0:n-1,p=s?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(o=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+c>=1?t+=d/l:t+=d*Math.pow(2,1-c),t*l>=2&&(a++,l/=2),a+c>=h?(o=0,a=h):a+c>=1?(o=(t*l-1)*Math.pow(2,i),a+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&o,f+=p,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*m}}},r={};function s(e){var i=r[e];if(void 0!==i)return i.exports;var n=r[e]={exports:{}},a=!0;try{t[e](n,n.exports,s),a=!1}finally{a&&delete r[e]}return n.exports}s.ab="//";var i=s(72);e.exports=i}()},3590:function(e,t,r){"use strict";r.d(t,{F:function(){return u}});var s=r(9501);let i=(e,t,r)=>{if(e&&"reportValidity"in e){let i=(0,s.U2)(r,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},n=(e,t)=>{for(let r in t.fields){let s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?i(s.ref,r,e):s.refs&&s.refs.forEach(t=>i(t,r,e))}},a=(e,t)=>{t.shouldUseNativeValidation&&n(e,t);let r={};for(let i in e){let n=(0,s.U2)(t.fields,i),a=Object.assign(e[i]||{},{ref:n&&n.ref});if(o(t.names||Object.keys(e),i)){let e=Object.assign({},(0,s.U2)(r,i));(0,s.t8)(e,"root",a),(0,s.t8)(r,i,e)}else(0,s.t8)(r,i,a)}return r},o=(e,t)=>e.some(e=>e.startsWith(t+"."));var l=function(e,t){for(var r={};e.length;){var i=e[0],n=i.code,a=i.message,o=i.path.join(".");if(!r[o]){if("unionErrors"in i){var l=i.unionErrors[0].errors[0];r[o]={message:l.message,type:l.code}}else r[o]={message:a,type:n}}if("unionErrors"in i&&i.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var u=r[o].types,h=u&&u[i.code];r[o]=(0,s.KN)(o,t,r,n,h?[].concat(h,i.message):i.message)}e.shift()}return r},u=function(e,t,r){return void 0===r&&(r={}),function(s,i,o){try{return Promise.resolve(function(i,a){try{var l=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](s,t)).then(function(e){return o.shouldUseNativeValidation&&n({},o),{errors:{},values:r.raw?s:e}})}catch(e){return a(e)}return l&&l.then?l.then(void 0,a):l}(0,function(e){if(Array.isArray(null==e?void 0:e.errors))return{values:{},errors:a(l(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}}}},6394:function(e,t,r){"use strict";r.d(t,{f:function(){return o}});var s=r(2265),i=r(6840),n=r(7437),a=s.forwardRef((e,t)=>(0,n.jsx)(i.WV.label,{...e,ref:t,onMouseDown:t=>{var r;t.target.closest("button, input, select, textarea")||(null===(r=e.onMouseDown)||void 0===r||r.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));a.displayName="Label";var o=a},7712:function(e,t,r){"use strict";r.d(t,{j:function(){return n}});let s=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,i=function(){for(var e,t,r=0,s="";r<arguments.length;)(e=arguments[r++])&&(t=function e(t){var r,s,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t){if(Array.isArray(t))for(r=0;r<t.length;r++)t[r]&&(s=e(t[r]))&&(i&&(i+=" "),i+=s);else for(r in t)t[r]&&(i&&(i+=" "),i+=r)}return i}(e))&&(s&&(s+=" "),s+=t);return s},n=(e,t)=>r=>{var n;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 n=s(t)||s(i);return a[e][n]}),u=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return i(e,l,null==t?void 0:null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:s,...i}=t;return Object.entries(i).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...u}[t]):({...o,...u})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},9501:function(e,t,r){"use strict";r.d(t,{Gc:function(){return E},KN:function(){return U},Qr:function(){return L},RV:function(){return A},U2:function(){return g},cI:function(){return eS},t8:function(){return w}});var s=r(2265),i=e=>"checkbox"===e.type,n=e=>e instanceof Date,a=e=>null==e;let o=e=>"object"==typeof e;var l=e=>!a(e)&&!Array.isArray(e)&&o(e)&&!n(e),u=e=>l(e)&&e.target?i(e.target)?e.target.checked:e.target.value:e,h=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,c=(e,t)=>e.has(h(t)),d=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||d(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):[],y=e=>void 0===e,g=(e,t,r)=>{if(!t||!l(e))return r;let s=m(t.split(/[,[\].]+?/)).reduce((e,t)=>a(e)?e:e[t],e);return y(s)||s===e?y(e[t])?r:e[t]:s},v=e=>"boolean"==typeof e,_=e=>/^\w*$/.test(e),b=e=>m(e.replace(/["|']|\]/g,"").split(/\.|\[/)),w=(e,t,r)=>{let s=-1,i=_(t)?[t]:b(t),n=i.length,a=n-1;for(;++s<n;){let t=i[s],n=r;if(s!==a){let r=e[t];n=l(r)||Array.isArray(r)?r:isNaN(+i[s+1])?{}:[]}if("__proto__"===t)return;e[t]=n,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"},T=s.createContext(null),E=()=>s.useContext(T),A=e=>{let{children:t,...r}=e;return s.createElement(T.Provider,{value:r},t)};var O=(e,t,r,s=!0)=>{let i={defaultValues:t._defaultValues};for(let n in e)Object.defineProperty(i,n,{get:()=>(t._proxyFormState[n]!==S.all&&(t._proxyFormState[n]=!s||S.all),r&&(r[n]=!0),e[n])});return i},j=e=>l(e)&&!Object.keys(e).length,C=(e,t,r,s)=>{r(e);let{name:i,...n}=e;return j(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find(e=>t[e]===(!s||S.all))},P=e=>Array.isArray(e)?e:[e],$=(e,t,r)=>!e||!t||e===t||P(e).some(e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e)));function R(e){let t=s.useRef(e);t.current=e,s.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,N=(e,t,r,s,i)=>I(e)?(s&&t.watch.add(e),g(r,e,i)):Array.isArray(e)?e.map(e=>(s&&t.watch.add(e),g(r,e))):(s&&(t.watchAll=!0),r);let L=e=>e.render(function(e){let t=E(),{name:r,disabled:i,control:n=t.control,shouldUnregister:a}=e,o=c(n._names.array,r),l=function(e){let t=E(),{control:r=t.control,name:i,defaultValue:n,disabled:a,exact:o}=e||{},l=s.useRef(i);l.current=i,R({disabled:a,subject:r._subjects.values,next:e=>{$(l.current,e.name,o)&&h(p(N(l.current,r._names,e.values||r._formValues,!1,n)))}});let[u,h]=s.useState(r._getWatch(i,n));return s.useEffect(()=>r._removeUnmounted()),u}({control:n,name:r,defaultValue:g(n._formValues,r,g(n._defaultValues,r,e.defaultValue)),exact:!0}),h=function(e){let t=E(),{control:r=t.control,disabled:i,name:n,exact:a}=e||{},[o,l]=s.useState(r._formState),u=s.useRef(!0),h=s.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),c=s.useRef(n);return c.current=n,R({disabled:i,next:e=>u.current&&$(c.current,e.name,a)&&C(e,h.current,r._updateFormState)&&l({...r._formState,...e}),subject:r._subjects.state}),s.useEffect(()=>(u.current=!0,h.current.isValid&&r._updateValid(!0),()=>{u.current=!1}),[r]),O(o,r,h.current,!1)}({control:n,name:r,exact:!0}),d=s.useRef(n.register(r,{...e.rules,value:l,...v(e.disabled)?{disabled:e.disabled}:{}}));return s.useEffect(()=>{let e=n._options.shouldUnregister||a,t=(e,t)=>{let r=g(n._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=p(g(n._options.defaultValues,r));w(n._defaultValues,r,e),y(g(n._formValues,r))&&w(n._formValues,r,e)}return()=>{(o?e&&!n._state.action:e)?n.unregister(r):t(r,!1)}},[r,n,o,a]),s.useEffect(()=>{g(n._fields,r)&&n._updateDisabledField({disabled:i,fields:n._fields,name:r,value:g(n._fields,r)._f.value})},[i,r,n]),{field:{name:r,value:l,...v(i)||h.disabled?{disabled:h.disabled||i}:{},onChange:s.useCallback(e=>d.current.onChange({target:{value:u(e),name:r},type:k.CHANGE}),[r]),onBlur:s.useCallback(()=>d.current.onBlur({target:{value:g(n._formValues,r),name:r},type:k.BLUR}),[r,n]),ref:s.useCallback(e=>{let t=g(n._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[n._fields,r])},formState:h,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(h.errors,r)},isDirty:{enumerable:!0,get:()=>!!g(h.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!g(h.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!g(h.validatingFields,r)},error:{enumerable:!0,get:()=>g(h.errors,r)}})}}(e));var U=(e,t,r,s,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:i||!0}}:{},D=e=>({isOnSubmit:!e||e===S.onSubmit,isOnBlur:e===S.onBlur,isOnChange:e===S.onChange,isOnAll:e===S.all,isOnTouch:e===S.onTouched}),B=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let F=(e,t,r,s)=>{for(let i of r||Object.keys(e)){let r=g(e,i);if(r){let{_f:e,...n}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!s||e.ref&&t(e.ref,e.name)&&!s)return!0;if(F(n,t))break}else if(l(n)&&F(n,t))break}}};var M=(e,t,r)=>{let s=P(g(e,r));return w(s,"root",t[r]),w(e,r,s),e},V=e=>"file"===e.type,Z=e=>"function"==typeof e,q=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),K=e=>"radio"===e.type,J=e=>e instanceof RegExp;let W={value:!1,isValid:!1},H={value:!0,isValid:!0};var G=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&&!y(e[0].attributes.value)?y(e[0].value)||""===e[0].value?H:{value:e[0].value,isValid:!0}:H:W}return W};let Y={isValid:!1,value:null};var X=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Y):Y;function Q(e,t,r="validate"){if(z(e)||Array.isArray(e)&&e.every(z)||v(e)&&!e)return{type:r,message:z(e)?e:"",ref:t}}var ee=e=>l(e)&&!J(e)?e:{value:e,message:""},et=async(e,t,r,s,n)=>{let{ref:o,refs:u,required:h,maxLength:c,minLength:d,min:f,max:p,pattern:m,validate:_,name:b,valueAsNumber:w,mount:k,disabled:S}=e._f,T=g(t,b);if(!k||S)return{};let E=u?u[0]:o,A=e=>{s&&E.reportValidity&&(E.setCustomValidity(v(e)?"":e||""),E.reportValidity())},O={},C=K(o),P=i(o),$=(w||V(o))&&y(o.value)&&y(T)||q(o)&&""===o.value||""===T||Array.isArray(T)&&!T.length,R=U.bind(null,b,r,O),N=(e,t,r,s=x.maxLength,i=x.minLength)=>{let n=e?t:r;O[b]={type:e?s:i,message:n,ref:o,...R(e?s:i,n)}};if(n?!Array.isArray(T)||!T.length:h&&(!(C||P)&&($||a(T))||v(T)&&!T||P&&!G(u).isValid||C&&!X(u).isValid)){let{value:e,message:t}=z(h)?{value:!!h,message:h}:ee(h);if(e&&(O[b]={type:x.required,message:t,ref:E,...R(x.required,t)},!r))return A(t),O}if(!$&&(!a(f)||!a(p))){let e,t;let s=ee(p),i=ee(f);if(a(T)||isNaN(T)){let r=o.valueAsDate||new Date(T),n=e=>new Date(new Date().toDateString()+" "+e),a="time"==o.type,l="week"==o.type;I(s.value)&&T&&(e=a?n(T)>n(s.value):l?T>s.value:r>new Date(s.value)),I(i.value)&&T&&(t=a?n(T)<n(i.value):l?T<i.value:r<new Date(i.value))}else{let r=o.valueAsNumber||(T?+T:T);a(s.value)||(e=r>s.value),a(i.value)||(t=r<i.value)}if((e||t)&&(N(!!e,s.message,i.message,x.max,x.min),!r))return A(O[b].message),O}if((c||d)&&!$&&(I(T)||n&&Array.isArray(T))){let e=ee(c),t=ee(d),s=!a(e.value)&&T.length>+e.value,i=!a(t.value)&&T.length<+t.value;if((s||i)&&(N(s,e.message,t.message),!r))return A(O[b].message),O}if(m&&!$&&I(T)){let{value:e,message:t}=ee(m);if(J(e)&&!T.match(e)&&(O[b]={type:x.pattern,message:t,ref:o,...R(x.pattern,t)},!r))return A(t),O}if(_){if(Z(_)){let e=Q(await _(T,t),E);if(e&&(O[b]={...e,...R(x.validate,e.message)},!r))return A(e.message),O}else if(l(_)){let e={};for(let s in _){if(!j(e)&&!r)break;let i=Q(await _[s](T,t),E,s);i&&(e={...i,...R(s,i.message)},A(i.message),r&&(O[b]=e))}if(!j(e)&&(O[b]={ref:E,...e},!r))return O}}return A(!0),O};function er(e,t){let r=Array.isArray(t)?t:_(t)?[t]:b(t),s=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,s=0;for(;s<r;)e=y(e)?s++:e[t[s++]];return e}(e,r),i=r.length-1,n=r[i];return s&&delete s[n],0!==i&&(l(s)&&j(s)||Array.isArray(s)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!y(e[t]))return!1;return!0}(s))&&er(e,r.slice(0,-1)),e}var es=()=>{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 en(e,t){if(ei(e)||ei(t))return e===t;if(n(e)&&n(t))return e.getTime()===t.getTime();let r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let i of r){let r=e[i];if(!s.includes(i))return!1;if("ref"!==i){let e=t[i];if(n(r)&&n(e)||l(r)&&l(e)||Array.isArray(r)&&Array.isArray(e)?!en(r,e):r!==e)return!1}}return!0}var ea=e=>"select-multiple"===e.type,eo=e=>K(e)||i(e),el=e=>q(e)&&e.isConnected,eu=e=>{for(let t in e)if(Z(e[t]))return!0;return!1};function eh(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])?[]:{},eh(e[r],t[r])):a(e[r])||(t[r]=!0);return t}var ec=(e,t)=>(function e(t,r,s){let i=Array.isArray(t);if(l(t)||i)for(let i in t)Array.isArray(t[i])||l(t[i])&&!eu(t[i])?y(r)||ei(s[i])?s[i]=Array.isArray(t[i])?eh(t[i],[]):{...eh(t[i])}:e(t[i],a(r)?{}:r[i],s[i]):s[i]=!en(t[i],r[i]);return s})(e,t,eh(t)),ed=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>y(e)?e:t?""===e?NaN:e?+e:e:r&&I(e)?new Date(e):s?s(e):e;function ef(e){let t=e.ref;return(e.refs?e.refs.every(e=>e.disabled):t.disabled)?void 0:V(t)?t.files:K(t)?X(e.refs).value:ea(t)?[...t.selectedOptions].map(({value:e})=>e):i(t)?G(e.refs).value:ed(y(t.value)?e.ref.value:t.value,e)}var ep=(e,t,r,s)=>{let i={};for(let r of e){let e=g(t,r);e&&w(i,r,e._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:s}},em=e=>y(e)?e:J(e)?e.source:l(e)?J(e.value)?e.value.source:e.value:e;let ey="AsyncFunction";var eg=e=>(!e||!e.validate)&&!!(Z(e.validate)&&e.validate.constructor.name===ey||l(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ey)),ev=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function e_(e,t,r){let s=g(e,r);if(s||_(r))return{error:s,name:r};let i=r.split(".");for(;i.length;){let s=i.join("."),n=g(t,s),a=g(e,s);if(n&&!Array.isArray(n)&&r!==s)break;if(a&&a.type)return{name:s,error:a};i.pop()}return{name:r}}var eb=(e,t,r,s,i)=>!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?s.isOnBlur:i.isOnBlur)?!e:(r?!s.isOnChange:!i.isOnChange)||e),ew=(e,t)=>!m(g(e,t)).length&&er(e,t);let ek={mode:S.onSubmit,reValidateMode:S.onChange,shouldFocusError:!0};function eS(e={}){let t=s.useRef(),r=s.useRef(),[o,h]=s.useState({isDirty:!1,isValidating:!1,isLoading:Z(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Z(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(e={}){let t,r={...ek,...e},s={submitCount:0,isDirty:!1,isLoading:Z(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},o={},h=(l(r.defaultValues)||l(r.values))&&p(r.defaultValues||r.values)||{},d=r.shouldUnregister?{}:p(h),_={action:!1,mount:!1,watch:!1},b={mount:new Set,unMount:new Set,array:new Set,watch:new Set},x=0,T={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},E={values:es(),array:es(),state:es()},A=D(r.mode),O=D(r.reValidateMode),C=r.criteriaMode===S.all,$=e=>t=>{clearTimeout(x),x=setTimeout(e,t)},R=async t=>{if(!e.disabled&&(T.isValid||t)){let e=r.resolver?j((await W()).errors):await G(o,!0);e!==s.isValid&&E.state.next({isValid:e})}},L=(t,r)=>{!e.disabled&&(T.isValidating||T.validatingFields)&&((t||Array.from(b.mount)).forEach(e=>{e&&(r?w(s.validatingFields,e,r):er(s.validatingFields,e))}),E.state.next({validatingFields:s.validatingFields,isValidating:!j(s.validatingFields)}))},U=(e,t)=>{w(s.errors,e,t),E.state.next({errors:s.errors})},z=(e,t,r,s)=>{let i=g(o,e);if(i){let n=g(d,e,y(r)?g(h,e):r);y(n)||s&&s.defaultChecked||t?w(d,e,t?n:ef(i._f)):Q(e,n),_.mount&&R()}},K=(t,r,i,n,a)=>{let l=!1,u=!1,c={name:t};if(!e.disabled){let e=!!(g(o,t)&&g(o,t)._f&&g(o,t)._f.disabled);if(!i||n){T.isDirty&&(u=s.isDirty,s.isDirty=c.isDirty=Y(),l=u!==c.isDirty);let i=e||en(g(h,t),r);u=!!(!e&&g(s.dirtyFields,t)),i||e?er(s.dirtyFields,t):w(s.dirtyFields,t,!0),c.dirtyFields=s.dirtyFields,l=l||T.dirtyFields&&!i!==u}if(i){let e=g(s.touchedFields,t);e||(w(s.touchedFields,t,i),c.touchedFields=s.touchedFields,l=l||T.touchedFields&&e!==i)}l&&a&&E.state.next(c)}return l?c:{}},J=(r,i,n,a)=>{let o=g(s.errors,r),l=T.isValid&&v(i)&&s.isValid!==i;if(e.delayError&&n?(t=$(()=>U(r,n)))(e.delayError):(clearTimeout(x),t=null,n?w(s.errors,r,n):er(s.errors,r)),(n?!en(o,n):o)||!j(a)||l){let e={...a,...l&&v(i)?{isValid:i}:{},errors:s.errors,name:r};s={...s,...e},E.state.next(e)}},W=async e=>{L(e,!0);let t=await r.resolver(d,r.context,ep(e||b.mount,o,r.criteriaMode,r.shouldUseNativeValidation));return L(e),t},H=async e=>{let{errors:t}=await W(e);if(e)for(let r of e){let e=g(t,r);e?w(s.errors,r,e):er(s.errors,r)}else s.errors=t;return t},G=async(e,t,i={valid:!0})=>{for(let n in e){let a=e[n];if(a){let{_f:e,...o}=a;if(e){let o=b.array.has(e.name),l=a._f&&eg(a._f);l&&T.validatingFields&&L([n],!0);let u=await et(a,d,C,r.shouldUseNativeValidation&&!t,o);if(l&&T.validatingFields&&L([n]),u[e.name]&&(i.valid=!1,t))break;t||(g(u,e.name)?o?M(s.errors,u,e.name):w(s.errors,e.name,u[e.name]):er(s.errors,e.name))}j(o)||await G(o,t,i)}}return i.valid},Y=(t,r)=>!e.disabled&&(t&&r&&w(d,t,r),!en(eS(),h)),X=(e,t,r)=>N(e,b,{..._.mount?d:y(t)?h:I(e)?{[e]:t}:t},r,t),Q=(e,t,r={})=>{let s=g(o,e),n=t;if(s){let r=s._f;r&&(r.disabled||w(d,e,ed(t,r)),n=q(r.ref)&&a(t)?"":t,ea(r.ref)?[...r.ref.options].forEach(e=>e.selected=n.includes(e.value)):r.refs?i(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(n)?!!n.find(t=>t===e.value):n===e.value)):r.refs[0]&&(r.refs[0].checked=!!n):r.refs.forEach(e=>e.checked=e.value===n):V(r.ref)?r.ref.value="":(r.ref.value=n,r.ref.type||E.values.next({name:e,values:{...d}})))}(r.shouldDirty||r.shouldTouch)&&K(e,n,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&ey(e)},ee=(e,t,r)=>{for(let s in t){let i=t[s],a=`${e}.${s}`,u=g(o,a);(b.array.has(e)||l(i)||u&&!u._f)&&!n(i)?ee(a,i,r):Q(a,i,r)}},ei=(e,t,r={})=>{let i=g(o,e),n=b.array.has(e),l=p(t);w(d,e,l),n?(E.array.next({name:e,values:{...d}}),(T.isDirty||T.dirtyFields)&&r.shouldDirty&&E.state.next({name:e,dirtyFields:ec(h,d),isDirty:Y(e,l)})):!i||i._f||a(l)?Q(e,l,r):ee(e,l,r),B(e,b)&&E.state.next({...s}),E.values.next({name:_.mount?e:void 0,values:{...d}})},eu=async i=>{_.mount=!0;let a=i.target,l=a.name,h=!0,c=g(o,l),f=e=>{h=Number.isNaN(e)||n(e)&&isNaN(e.getTime())||en(e,g(d,l,e))};if(c){let n,p;let m=a.type?ef(c._f):u(i),y=i.type===k.BLUR||i.type===k.FOCUS_OUT,v=!ev(c._f)&&!r.resolver&&!g(s.errors,l)&&!c._f.deps||eb(y,g(s.touchedFields,l),s.isSubmitted,O,A),_=B(l,b,y);w(d,l,m),y?(c._f.onBlur&&c._f.onBlur(i),t&&t(0)):c._f.onChange&&c._f.onChange(i);let S=K(l,m,y,!1),x=!j(S)||_;if(y||E.values.next({name:l,type:i.type,values:{...d}}),v)return T.isValid&&("onBlur"===e.mode?y&&R():R()),x&&E.state.next({name:l,..._?{}:S});if(!y&&_&&E.state.next({...s}),r.resolver){let{errors:e}=await W([l]);if(f(m),h){let t=e_(s.errors,o,l),r=e_(e,o,t.name||l);n=r.error,l=r.name,p=j(e)}}else L([l],!0),n=(await et(c,d,C,r.shouldUseNativeValidation))[l],L([l]),f(m),h&&(n?p=!1:T.isValid&&(p=await G(o,!0)));h&&(c._f.deps&&ey(c._f.deps),J(l,p,n,S))}},eh=(e,t)=>{if(g(s.errors,t)&&e.focus)return e.focus(),1},ey=async(e,t={})=>{let i,n;let a=P(e);if(r.resolver){let t=await H(y(e)?e:a);i=j(t),n=e?!a.some(e=>g(t,e)):i}else e?((n=(await Promise.all(a.map(async e=>{let t=g(o,e);return await G(t&&t._f?{[e]:t}:t)}))).every(Boolean))||s.isValid)&&R():n=i=await G(o);return E.state.next({...!I(e)||T.isValid&&i!==s.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:s.errors}),t.shouldFocus&&!n&&F(o,eh,e?a:b.mount),n},eS=e=>{let t={..._.mount?d:h};return y(e)?t:I(e)?g(t,e):e.map(e=>g(t,e))},ex=(e,t)=>({invalid:!!g((t||s).errors,e),isDirty:!!g((t||s).dirtyFields,e),error:g((t||s).errors,e),isValidating:!!g(s.validatingFields,e),isTouched:!!g((t||s).touchedFields,e)}),eT=(e,t,r)=>{let i=(g(o,e,{_f:{}})._f||{}).ref,{ref:n,message:a,type:l,...u}=g(s.errors,e)||{};w(s.errors,e,{...u,...t,ref:i}),E.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},eE=(e,t={})=>{for(let i of e?P(e):b.mount)b.mount.delete(i),b.array.delete(i),t.keepValue||(er(o,i),er(d,i)),t.keepError||er(s.errors,i),t.keepDirty||er(s.dirtyFields,i),t.keepTouched||er(s.touchedFields,i),t.keepIsValidating||er(s.validatingFields,i),r.shouldUnregister||t.keepDefaultValue||er(h,i);E.values.next({values:{...d}}),E.state.next({...s,...t.keepDirty?{isDirty:Y()}:{}}),t.keepIsValid||R()},eA=({disabled:e,name:t,field:r,fields:s,value:i})=>{if(v(e)&&_.mount||e){let n=e?void 0:y(i)?ef(r?r._f:g(s,t)._f):i;w(d,t,n),K(t,n,!1,!1,!0)}},eO=(t,s={})=>{let i=g(o,t),n=v(s.disabled)||v(e.disabled);return w(o,t,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:t}},name:t,mount:!0,...s}}),b.mount.add(t),i?eA({field:i,disabled:v(s.disabled)?s.disabled:e.disabled,name:t,value:s.value}):z(t,!0,s.value),{...n?{disabled:s.disabled||e.disabled}:{},...r.progressive?{required:!!s.required,min:em(s.min),max:em(s.max),minLength:em(s.minLength),maxLength:em(s.maxLength),pattern:em(s.pattern)}:{},name:t,onChange:eu,onBlur:eu,ref:e=>{if(e){eO(t,s),i=g(o,t);let r=y(e.value)&&e.querySelectorAll&&e.querySelectorAll("input,select,textarea")[0]||e,n=eo(r),a=i._f.refs||[];(n?a.find(e=>e===r):r===i._f.ref)||(w(o,t,{_f:{...i._f,...n?{refs:[...a.filter(el),r,...Array.isArray(g(h,t))?[{}]:[]],ref:{type:r.type,name:t}}:{ref:r}}}),z(t,!1,void 0,r))}else(i=g(o,t,{}))._f&&(i._f.mount=!1),(r.shouldUnregister||s.shouldUnregister)&&!(c(b.array,t)&&_.action)&&b.unMount.add(t)}}},ej=()=>r.shouldFocusError&&F(o,eh,b.mount),eC=(e,t)=>async i=>{let n;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let a=p(d);if(E.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await W();s.errors=e,a=t}else await G(o);if(er(s.errors,"root"),j(s.errors)){E.state.next({errors:{}});try{await e(a,i)}catch(e){n=e}}else t&&await t({...s.errors},i),ej(),setTimeout(ej);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:j(s.errors)&&!n,submitCount:s.submitCount+1,errors:s.errors}),n)throw n},eP=(t,r={})=>{let i=t?p(t):h,n=p(i),a=j(t),l=a?h:n;if(r.keepDefaultValues||(h=i),!r.keepValues){if(r.keepDirtyValues)for(let e of Array.from(new Set([...b.mount,...Object.keys(ec(h,d))])))g(s.dirtyFields,e)?w(l,e,g(d,e)):ei(e,g(l,e));else{if(f&&y(t))for(let e of b.mount){let t=g(o,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(q(e)){let t=e.closest("form");if(t){t.reset();break}}}}o={}}d=e.shouldUnregister?r.keepDefaultValues?p(h):{}:p(l),E.array.next({values:{...l}}),E.values.next({values:{...l}})}b={mount:r.keepDirtyValues?b.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},_.mount=!T.isValid||!!r.keepIsValid||!!r.keepDirtyValues,_.watch=!!e.shouldUnregister,E.state.next({submitCount:r.keepSubmitCount?s.submitCount:0,isDirty:!a&&(r.keepDirty?s.isDirty:!!(r.keepDefaultValues&&!en(t,h))),isSubmitted:!!r.keepIsSubmitted&&s.isSubmitted,dirtyFields:a?{}:r.keepDirtyValues?r.keepDefaultValues&&d?ec(h,d):s.dirtyFields:r.keepDefaultValues&&t?ec(h,t):r.keepDirty?s.dirtyFields:{},touchedFields:r.keepTouched?s.touchedFields:{},errors:r.keepErrors?s.errors:{},isSubmitSuccessful:!!r.keepIsSubmitSuccessful&&s.isSubmitSuccessful,isSubmitting:!1})},e$=(e,t)=>eP(Z(e)?e(d):e,t);return{control:{register:eO,unregister:eE,getFieldState:ex,handleSubmit:eC,setError:eT,_executeSchema:W,_getWatch:X,_getDirty:Y,_updateValid:R,_removeUnmounted:()=>{for(let e of b.unMount){let t=g(o,e);t&&(t._f.refs?t._f.refs.every(e=>!el(e)):!el(t._f.ref))&&eE(e)}b.unMount=new Set},_updateFieldArray:(t,r=[],i,n,a=!0,l=!0)=>{if(n&&i&&!e.disabled){if(_.action=!0,l&&Array.isArray(g(o,t))){let e=i(g(o,t),n.argA,n.argB);a&&w(o,t,e)}if(l&&Array.isArray(g(s.errors,t))){let e=i(g(s.errors,t),n.argA,n.argB);a&&w(s.errors,t,e),ew(s.errors,t)}if(T.touchedFields&&l&&Array.isArray(g(s.touchedFields,t))){let e=i(g(s.touchedFields,t),n.argA,n.argB);a&&w(s.touchedFields,t,e)}T.dirtyFields&&(s.dirtyFields=ec(h,d)),E.state.next({name:t,isDirty:Y(t,r),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else w(d,t,r)},_updateDisabledField:eA,_getFieldArray:t=>m(g(_.mount?d:h,t,e.shouldUnregister?g(h,t,[]):[])),_reset:eP,_resetDefaultValues:()=>Z(r.defaultValues)&&r.defaultValues().then(e=>{e$(e,r.resetOptions),E.state.next({isLoading:!1})}),_updateFormState:e=>{s={...s,...e}},_disableForm:e=>{v(e)&&(E.state.next({disabled:e}),F(o,(t,r)=>{let s=g(o,r);s&&(t.disabled=s._f.disabled||e,Array.isArray(s._f.refs)&&s._f.refs.forEach(t=>{t.disabled=s._f.disabled||e}))},0,!1))},_subjects:E,_proxyFormState:T,_setErrors:e=>{s.errors=e,E.state.next({errors:s.errors,isValid:!1})},get _fields(){return o},get _formValues(){return d},get _state(){return _},set _state(value){_=value},get _defaultValues(){return h},get _names(){return b},set _names(value){b=value},get _formState(){return s},set _formState(value){s=value},get _options(){return r},set _options(value){r={...r,...value}}},trigger:ey,register:eO,handleSubmit:eC,watch:(e,t)=>Z(e)?E.values.subscribe({next:r=>e(X(void 0,t),r)}):X(e,t,!0),setValue:ei,getValues:eS,reset:e$,resetField:(e,t={})=>{g(o,e)&&(y(t.defaultValue)?ei(e,p(g(h,e))):(ei(e,t.defaultValue),w(h,e,p(t.defaultValue))),t.keepTouched||er(s.touchedFields,e),t.keepDirty||(er(s.dirtyFields,e),s.isDirty=t.defaultValue?Y(e,p(g(h,e))):Y()),!t.keepError&&(er(s.errors,e),T.isValid&&R()),E.state.next({...s}))},clearErrors:e=>{e&&P(e).forEach(e=>er(s.errors,e)),E.state.next({errors:e?s.errors:{}})},unregister:eE,setError:eT,setFocus:(e,t={})=>{let r=g(o,e),s=r&&r._f;if(s){let e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:ex}}(e),formState:o});let d=t.current.control;return d._options=e,R({subject:d._subjects.state,next:e=>{C(e,d._proxyFormState,d._updateFormState,!0)&&h({...d._formState})}}),s.useEffect(()=>d._disableForm(e.disabled),[d,e.disabled]),s.useEffect(()=>{if(d._proxyFormState.isDirty){let e=d._getDirty();e!==o.isDirty&&d._subjects.state.next({isDirty:e})}},[d,o.isDirty]),s.useEffect(()=>{e.values&&!en(e.values,r.current)?(d._reset(e.values,d._options.resetOptions),r.current=e.values,h(e=>({...e}))):d._resetDefaultValues()},[e.values,d]),s.useEffect(()=>{e.errors&&d._setErrors(e.errors)},[e.errors,d]),s.useEffect(()=>{d._state.mount||(d._updateValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),s.useEffect(()=>{e.shouldUnregister&&d._subjects.values.next({values:d._getWatch()})},[e.shouldUnregister,d]),s.useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[o]),t.current.formState=O(o,d),t.current}},1229:function(e,t,r){"use strict";var s,i,n,a,o,l,u,h,c;let d;r.d(t,{Ry:function(){return e$},Z_:function(){return eP}}),(u=s||(s={})).assertEqual=e=>e,u.assertIs=function(e){},u.assertNever=function(e){throw Error()},u.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},u.getValidEnumValues=e=>{let t=u.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let s of t)r[s]=e[s];return u.objectValues(r)},u.objectValues=e=>u.objectKeys(e).map(function(t){return e[t]}),u.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},u.find=(e,t)=>{for(let r of e)if(t(r))return r},u.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,u.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},u.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(i||(i={})).mergeShapes=(e,t)=>({...e,...t});let f=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),p=e=>{switch(typeof e){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(e)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":if(Array.isArray(e))return f.array;if(null===e)return f.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return f.promise;if("undefined"!=typeof Map&&e instanceof Map)return f.map;if("undefined"!=typeof Set&&e instanceof Set)return f.set;if("undefined"!=typeof Date&&e instanceof Date)return f.date;return f.object;default:return f.unknown}},m=s.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 y 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:[]},s=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(s);else if("invalid_return_type"===i.code)s(i.returnTypeError);else if("invalid_arguments"===i.code)s(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,s=0;for(;s<i.path.length;){let r=i.path[s];s===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(this),r}static assert(e){if(!(e instanceof y))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,s.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);let g=(e,t)=>{let r;switch(e.code){case m.invalid_type:r=e.received===f.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,s.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:r=`Unrecognized key(s) in object: ${s.joinValues(e.keys,", ")}`;break;case m.invalid_union:r="Invalid input";break;case m.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${s.joinValues(e.options)}`;break;case m.invalid_enum_value:r=`Invalid enum value. Expected ${s.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:r="Invalid function arguments";break;case m.invalid_return_type:r="Invalid function return type";break;case m.invalid_date:r="Invalid date";break;case m.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}"`:s.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case m.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 m.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 m.custom:r="Invalid input";break;case m.invalid_intersection_types:r="Intersection results could not be merged";break;case m.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:r="Number must be finite";break;default:r=t.defaultError,s.assertNever(e)}return{message:r}},v=e=>{let{data:t,path:r,errorMaps:s,issueData:i}=e,n=[...r,...i.path||[]],a={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let o="";for(let e of s.filter(e=>!!e).slice().reverse())o=e(a,{data:t,defaultError:o}).message;return{...i,path:n,message:o}};function _(e,t){let r=v({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,g,g==g?void 0:g].filter(e=>!!e)});e.common.issues.push(r)}class b{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 s of t){if("aborted"===s.status)return w;"dirty"===s.status&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,s=await e.value;r.push({key:t,value:s})}return b.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let s of t){let{key:t,value:i}=s;if("aborted"===t.status||"aborted"===i.status)return w;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||s.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let w=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),S=e=>({status:"valid",value:e}),x=e=>"aborted"===e.status,T=e=>"dirty"===e.status,E=e=>"valid"===e.status,A=e=>"undefined"!=typeof Promise&&e instanceof Promise;function O(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)}function j(e,t,r,s,i){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!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"===s?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(h=n||(n={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},h.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class C{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}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 P=(e,t)=>{if(E(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 y(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:s,description:i}=e;if(t&&(r||s))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 n,a;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:i.defaultError}:void 0===i.data?{message:null!==(n=null!=o?o:s)&&void 0!==n?n: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 R{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 p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(A(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 s={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:p(e)},i=this._parseSync({data:e,path:s.path,parent:s});return P(s,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:p(e)},s=this._parse({data:e,path:r.path,parent:r});return P(r,await (A(s)?s:Promise.resolve(s)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,s)=>{let i=e(t),n=()=>s.addIssue({code:m.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,s)=>!!e(r)||(s.addIssue("function"==typeof t?t(r,s):t),!1))}_refinement(e){return new ek({schema:this,typeName:l.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return eS.create(this,this._def)}nullable(){return ex.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return en.create(this,this._def)}promise(){return ew.create(this,this._def)}or(e){return eo.create([this,e],this._def)}and(e){return eh.create(this,e,this._def)}transform(e){return new ek({...$(this._def),schema:this,typeName:l.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eT({...$(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:l.ZodDefault})}brand(){return new eO({typeName:l.ZodBranded,type:this,...$(this._def)})}catch(e){return new eE({...$(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:l.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ej.create(this,e)}readonly(){return eC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let I=/^c[^\s-]{8,}$/i,N=/^[0-9a-z]+$/,L=/^[0-9A-HJKMNP-TV-Z]{26}$/,U=/^[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,D=/^[a-z0-9_-]{21}$/i,B=/^[-+]?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)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,M=/^(?:(?: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])$/,V=/^(([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})))$/,Z=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,q="((\\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])))",z=RegExp(`^${q}$`);function K(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}class J extends R{_parse(e){var t,r;let i;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.string,received:t.parsedType}),w}let n=new b;for(let a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(_(i=this._getOrReturnCtx(e,i),{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if("max"===a.kind)e.data.length>a.value&&(_(i=this._getOrReturnCtx(e,i),{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if("length"===a.kind){let t=e.data.length>a.value,r=e.data.length<a.value;(t||r)&&(i=this._getOrReturnCtx(e,i),t?_(i,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):r&&_(i,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if("email"===a.kind)F.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"email",code:m.invalid_string,message:a.message}),n.dirty());else if("emoji"===a.kind)d||(d=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),d.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"emoji",code:m.invalid_string,message:a.message}),n.dirty());else if("uuid"===a.kind)U.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"uuid",code:m.invalid_string,message:a.message}),n.dirty());else if("nanoid"===a.kind)D.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"nanoid",code:m.invalid_string,message:a.message}),n.dirty());else if("cuid"===a.kind)I.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"cuid",code:m.invalid_string,message:a.message}),n.dirty());else if("cuid2"===a.kind)N.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"cuid2",code:m.invalid_string,message:a.message}),n.dirty());else if("ulid"===a.kind)L.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"ulid",code:m.invalid_string,message:a.message}),n.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(t){_(i=this._getOrReturnCtx(e,i),{validation:"url",code:m.invalid_string,message:a.message}),n.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"regex",code:m.invalid_string,message:a.message}),n.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(_(i=this._getOrReturnCtx(e,i),{code:m.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(_(i=this._getOrReturnCtx(e,i),{code:m.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(_(i=this._getOrReturnCtx(e,i),{code:m.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):"datetime"===a.kind?(function(e){let t=`${q}T${K(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(a).test(e.data)||(_(i=this._getOrReturnCtx(e,i),{code:m.invalid_string,validation:"datetime",message:a.message}),n.dirty()):"date"===a.kind?z.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{code:m.invalid_string,validation:"date",message:a.message}),n.dirty()):"time"===a.kind?RegExp(`^${K(a)}$`).test(e.data)||(_(i=this._getOrReturnCtx(e,i),{code:m.invalid_string,validation:"time",message:a.message}),n.dirty()):"duration"===a.kind?B.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"duration",code:m.invalid_string,message:a.message}),n.dirty()):"ip"===a.kind?(t=e.data,("v4"===(r=a.version)||!r)&&M.test(t)||("v6"===r||!r)&&V.test(t)||(_(i=this._getOrReturnCtx(e,i),{validation:"ip",code:m.invalid_string,message:a.message}),n.dirty())):"base64"===a.kind?Z.test(e.data)||(_(i=this._getOrReturnCtx(e,i),{validation:"base64",code:m.invalid_string,message:a.message}),n.dirty()):s.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:m.invalid_string,...n.errToObj(r)})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...n.errToObj(e)})}url(e){return this._addCheck({kind:"url",...n.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...n.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...n.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...n.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...n.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...n.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...n.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...n.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...n.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,...n.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,...n.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...n.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...n.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...n.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...n.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...n.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...n.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...n.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...n.errToObj(t)})}nonempty(e){return this.min(1,n.errToObj(e))}trim(){return new J({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new J({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new J({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get 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}}J.create=e=>{var t;return new J({checks:[],typeName:l.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class W extends R{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)!==f.number){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.number,received:t.parsedType}),w}let r=new b;for(let i of this._def.checks)"int"===i.kind?s.isInteger(e.data)||(_(t=this._getOrReturnCtx(e,t),{code:m.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):"min"===i.kind?(i.inclusive?e.data<i.value:e.data<=i.value)&&(_(t=this._getOrReturnCtx(e,t),{code:m.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"max"===i.kind?(i.inclusive?e.data>i.value:e.data>=i.value)&&(_(t=this._getOrReturnCtx(e,t),{code:m.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"multipleOf"===i.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,i=r>s?r:s;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,i.value)&&(_(t=this._getOrReturnCtx(e,t),{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(_(t=this._getOrReturnCtx(e,t),{code:m.not_finite,message:i.message}),r.dirty()):s.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,n.toString(t))}gt(e,t){return this.setLimit("min",e,!1,n.toString(t))}lte(e,t){return this.setLimit("max",e,!0,n.toString(t))}lt(e,t){return this.setLimit("max",e,!1,n.toString(t))}setLimit(e,t,r,s){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.toString(s)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:n.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:n.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:n.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:n.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:n.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:n.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:n.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:n.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&&s.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)}}W.create=e=>new W({checks:[],typeName:l.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class H extends R{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)!==f.bigint){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.bigint,received:t.parsedType}),w}let r=new b;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?e.data<i.value:e.data<=i.value)&&(_(t=this._getOrReturnCtx(e,t),{code:m.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"max"===i.kind?(i.inclusive?e.data>i.value:e.data>=i.value)&&(_(t=this._getOrReturnCtx(e,t),{code:m.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(_(t=this._getOrReturnCtx(e,t),{code:m.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):s.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,n.toString(t))}gt(e,t){return this.setLimit("min",e,!1,n.toString(t))}lte(e,t){return this.setLimit("max",e,!0,n.toString(t))}lt(e,t){return this.setLimit("max",e,!1,n.toString(t))}setLimit(e,t,r,s){return new H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.toString(s)}]})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:n.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:n.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:n.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:n.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.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}}H.create=e=>{var t;return new H({checks:[],typeName:l.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class G extends R{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.boolean,received:t.parsedType}),w}return S(e.data)}}G.create=e=>new G({typeName:l.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class Y extends R{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.date,received:t.parsedType}),w}if(isNaN(e.data.getTime()))return _(this._getOrReturnCtx(e),{code:m.invalid_date}),w;let r=new b;for(let i of this._def.checks)"min"===i.kind?e.data.getTime()<i.value&&(_(t=this._getOrReturnCtx(e,t),{code:m.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):"max"===i.kind?e.data.getTime()>i.value&&(_(t=this._getOrReturnCtx(e,t),{code:m.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):s.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:n.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:n.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}}Y.create=e=>new Y({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:l.ZodDate,...$(e)});class X extends R{_parse(e){if(this._getType(e)!==f.symbol){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.symbol,received:t.parsedType}),w}return S(e.data)}}X.create=e=>new X({typeName:l.ZodSymbol,...$(e)});class Q extends R{_parse(e){if(this._getType(e)!==f.undefined){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.undefined,received:t.parsedType}),w}return S(e.data)}}Q.create=e=>new Q({typeName:l.ZodUndefined,...$(e)});class ee extends R{_parse(e){if(this._getType(e)!==f.null){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.null,received:t.parsedType}),w}return S(e.data)}}ee.create=e=>new ee({typeName:l.ZodNull,...$(e)});class et extends R{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}}et.create=e=>new et({typeName:l.ZodAny,...$(e)});class er extends R{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}}er.create=e=>new er({typeName:l.ZodUnknown,...$(e)});class es extends R{_parse(e){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.never,received:t.parsedType}),w}}es.create=e=>new es({typeName:l.ZodNever,...$(e)});class ei extends R{_parse(e){if(this._getType(e)!==f.undefined){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.void,received:t.parsedType}),w}return S(e.data)}}ei.create=e=>new ei({typeName:l.ZodVoid,...$(e)});class en extends R{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return _(t,{code:m.invalid_type,expected:f.array,received:t.parsedType}),w;if(null!==s.exactLength){let e=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(e||i)&&(_(t,{code:e?m.too_big:m.too_small,minimum:i?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(_(t,{code:m.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(_(t,{code:m.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>s.type._parseAsync(new C(t,e,t.path,r)))).then(e=>b.mergeArray(r,e));let i=[...t.data].map((e,r)=>s.type._parseSync(new C(t,e,t.path,r)));return b.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new en({...this._def,minLength:{value:e,message:n.toString(t)}})}max(e,t){return new en({...this._def,maxLength:{value:e,message:n.toString(t)}})}length(e,t){return new en({...this._def,exactLength:{value:e,message:n.toString(t)}})}nonempty(e){return this.min(1,e)}}en.create=(e,t)=>new en({type:e,minLength:null,maxLength:null,exactLength:null,typeName:l.ZodArray,...$(t)});class ea extends R{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=s.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.object,received:t.parsedType}),w}let{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),n=[];if(!(this._def.catchall instanceof es&&"strip"===this._def.unknownKeys))for(let e in r.data)i.includes(e)||n.push(e);let a=[];for(let e of i){let t=s[e],i=r.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new C(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof es){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of n)a.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(_(r,{code:m.unrecognized_keys,keys:n}),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 n){let s=r.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new C(r,s,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of a){let r=await t.key,s=await t.value;e.push({key:r,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>b.mergeObjectSync(t,e)):b.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return n.errToObj,new ea({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var s,i,a,o;let l=null!==(a=null===(i=(s=this._def).errorMap)||void 0===i?void 0:i.call(s,t,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=n.errToObj(e).message)&&void 0!==o?o:l}:{message:l}}}:{}})}strip(){return new ea({...this._def,unknownKeys:"strip"})}passthrough(){return new ea({...this._def,unknownKeys:"passthrough"})}extend(e){return new ea({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ea({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:l.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ea({...this._def,catchall:e})}pick(e){let t={};return s.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new ea({...this._def,shape:()=>t})}omit(e){let t={};return s.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new ea({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ea){let r={};for(let s in t.shape){let i=t.shape[s];r[s]=eS.create(e(i))}return new ea({...t._def,shape:()=>r})}return t instanceof en?new en({...t._def,type:e(t.element)}):t instanceof eS?eS.create(e(t.unwrap())):t instanceof ex?ex.create(e(t.unwrap())):t instanceof ec?ec.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return s.objectKeys(this.shape).forEach(r=>{let s=this.shape[r];e&&!e[r]?t[r]=s:t[r]=s.optional()}),new ea({...this._def,shape:()=>t})}required(e){let t={};return s.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eS;)e=e._def.innerType;t[r]=e}}),new ea({...this._def,shape:()=>t})}keyof(){return ev(s.objectKeys(this.shape))}}ea.create=(e,t)=>new ea({shape:()=>e,unknownKeys:"strip",catchall:es.create(),typeName:l.ZodObject,...$(t)}),ea.strictCreate=(e,t)=>new ea({shape:()=>e,unknownKeys:"strict",catchall:es.create(),typeName:l.ZodObject,...$(t)}),ea.lazycreate=(e,t)=>new ea({shape:e,unknownKeys:"strip",catchall:es.create(),typeName:l.ZodObject,...$(t)});class eo extends R{_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 y(e.ctx.common.issues));return _(t,{code:m.invalid_union,unionErrors:r}),w});{let e;let s=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&s.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=s.map(e=>new y(e));return _(t,{code:m.invalid_union,unionErrors:i}),w}}get options(){return this._def.options}}eo.create=(e,t)=>new eo({options:e,typeName:l.ZodUnion,...$(t)});let el=e=>{if(e instanceof ey)return el(e.schema);if(e instanceof ek)return el(e.innerType());if(e instanceof eg)return[e.value];if(e instanceof e_)return e.options;if(e instanceof eb)return s.objectValues(e.enum);if(e instanceof eT)return el(e._def.innerType);if(e instanceof Q)return[void 0];else if(e instanceof ee)return[null];else if(e instanceof eS)return[void 0,...el(e.unwrap())];else if(e instanceof ex)return[null,...el(e.unwrap())];else if(e instanceof eO)return el(e.unwrap());else if(e instanceof eC)return el(e.unwrap());else if(e instanceof eE)return el(e._def.innerType);else return[]};class eu extends R{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return _(t,{code:m.invalid_type,expected:f.object,received:t.parsedType}),w;let r=this.discriminator,s=t.data[r],i=this.optionsMap.get(s);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(_(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let s=new Map;for(let r of t){let t=el(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(s.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,r)}}return new eu({typeName:l.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...$(r)})}}class eh extends R{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(e,i)=>{if(x(e)||x(i))return w;let n=function e(t,r){let i=p(t),n=p(r);if(t===r)return{valid:!0,data:t};if(i===f.object&&n===f.object){let i=s.objectKeys(r),n=s.objectKeys(t).filter(e=>-1!==i.indexOf(e)),a={...t,...r};for(let s of n){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a[s]=i.data}return{valid:!0,data:a}}if(i===f.array&&n===f.array){if(t.length!==r.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return i===f.date&&n===f.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,i.value);return n.valid?((T(e)||T(i))&&t.dirty(),{status:t.value,value:n.data}):(_(r,{code:m.invalid_intersection_types}),w)};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])=>i(e,t)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eh.create=(e,t,r)=>new eh({left:e,right:t,typeName:l.ZodIntersection,...$(r)});class ec extends R{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return _(r,{code:m.invalid_type,expected:f.array,received:r.parsedType}),w;if(r.data.length<this._def.items.length)return _(r,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((e,t)=>{let s=this._def.items[t]||this._def.rest;return s?s._parse(new C(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>b.mergeArray(t,e)):b.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new ec({...this._def,rest:e})}}ec.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ec({items:e,typeName:l.ZodTuple,rest:null,...$(t)})};class ed extends R{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!==f.object)return _(r,{code:m.invalid_type,expected:f.object,received:r.parsedType}),w;let s=[],i=this._def.keyType,n=this._def.valueType;for(let e in r.data)s.push({key:i._parse(new C(r,e,r.path,e)),value:n._parse(new C(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?b.mergeObjectAsync(t,s):b.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return new ed(t instanceof R?{keyType:e,valueType:t,typeName:l.ZodRecord,...$(r)}:{keyType:J.create(),valueType:e,typeName:l.ZodRecord,...$(t)})}}class ef extends R{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!==f.map)return _(r,{code:m.invalid_type,expected:f.map,received:r.parsedType}),w;let s=this._def.keyType,i=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:s._parse(new C(r,e,r.path,[n,"key"])),value:i._parse(new C(r,t,r.path,[n,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of n){let s=await r.key,i=await r.value;if("aborted"===s.status||"aborted"===i.status)return w;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of n){let s=r.key,i=r.value;if("aborted"===s.status||"aborted"===i.status)return w;("dirty"===s.status||"dirty"===i.status)&&t.dirty(),e.set(s.value,i.value)}return{status:t.value,value:e}}}}ef.create=(e,t,r)=>new ef({valueType:t,keyType:e,typeName:l.ZodMap,...$(r)});class ep extends R{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return _(r,{code:m.invalid_type,expected:f.set,received:r.parsedType}),w;let s=this._def;null!==s.minSize&&r.data.size<s.minSize.value&&(_(r,{code:m.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&r.data.size>s.maxSize.value&&(_(r,{code:m.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let i=this._def.valueType;function n(e){let r=new Set;for(let s of e){if("aborted"===s.status)return w;"dirty"===s.status&&t.dirty(),r.add(s.value)}return{status:t.value,value:r}}let a=[...r.data.values()].map((e,t)=>i._parse(new C(r,e,r.path,t)));return r.common.async?Promise.all(a).then(e=>n(e)):n(a)}min(e,t){return new ep({...this._def,minSize:{value:e,message:n.toString(t)}})}max(e,t){return new ep({...this._def,maxSize:{value:e,message:n.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ep.create=(e,t)=>new ep({valueType:e,minSize:null,maxSize:null,typeName:l.ZodSet,...$(t)});class em extends R{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return _(t,{code:m.invalid_type,expected:f.function,received:t.parsedType}),w;function r(e,r){return v({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,g,g].filter(e=>!!e),issueData:{code:m.invalid_arguments,argumentsError:r}})}function s(e,r){return v({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,g,g].filter(e=>!!e),issueData:{code:m.invalid_return_type,returnTypeError:r}})}let i={errorMap:t.common.contextualErrorMap},n=t.data;if(this._def.returns instanceof ew){let e=this;return S(async function(...t){let a=new y([]),o=await e._def.args.parseAsync(t,i).catch(e=>{throw a.addIssue(r(t,e)),a}),l=await Reflect.apply(n,this,o);return await e._def.returns._def.type.parseAsync(l,i).catch(e=>{throw a.addIssue(s(l,e)),a})})}{let e=this;return S(function(...t){let a=e._def.args.safeParse(t,i);if(!a.success)throw new y([r(t,a.error)]);let o=Reflect.apply(n,this,a.data),l=e._def.returns.safeParse(o,i);if(!l.success)throw new y([s(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new em({...this._def,args:ec.create(e).rest(er.create())})}returns(e){return new em({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new em({args:e||ec.create([]).rest(er.create()),returns:t||er.create(),typeName:l.ZodFunction,...$(r)})}}class ey extends R{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})}}ey.create=(e,t)=>new ey({getter:e,typeName:l.ZodLazy,...$(t)});class eg extends R{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ev(e,t){return new e_({values:e,typeName:l.ZodEnum,...$(t)})}eg.create=(e,t)=>new eg({value:e,typeName:l.ZodLiteral,...$(t)});class e_ extends R{constructor(){super(...arguments),a.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{expected:s.joinValues(r),received:t.parsedType,code:m.invalid_type}),w}if(O(this,a,"f")||j(this,a,new Set(this._def.values),"f"),!O(this,a,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return _(t,{received:t.data,code:m.invalid_enum_value,options:r}),w}return S(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 e_.create(e,{...this._def,...t})}exclude(e,t=this._def){return e_.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}a=new WeakMap,e_.create=ev;class eb extends R{constructor(){super(...arguments),o.set(this,void 0)}_parse(e){let t=s.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){let e=s.objectValues(t);return _(r,{expected:s.joinValues(e),received:r.parsedType,code:m.invalid_type}),w}if(O(this,o,"f")||j(this,o,new Set(s.getValidEnumValues(this._def.values)),"f"),!O(this,o,"f").has(e.data)){let e=s.objectValues(t);return _(r,{received:r.data,code:m.invalid_enum_value,options:e}),w}return S(e.data)}get enum(){return this._def.values}}o=new WeakMap,eb.create=(e,t)=>new eb({values:e,typeName:l.ZodNativeEnum,...$(t)});class ew extends R{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==f.promise&&!1===t.common.async?(_(t,{code:m.invalid_type,expected:f.promise,received:t.parsedType}),w):S((t.parsedType===f.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ew.create=(e,t)=>new ew({type:e,typeName:l.ZodPromise,...$(t)});class ek extends R{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===l.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:e=>{_(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let e=i.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return w;let s=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===s.status?w:"dirty"===s.status||"dirty"===t.value?k(s.value):s});{if("aborted"===t.value)return w;let s=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===s.status?w:"dirty"===s.status||"dirty"===t.value?k(s.value):s}}if("refinement"===i.type){let e=e=>{let t=i.refinement(e,n);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?w:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===s.status?w:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.value})}}if("transform"===i.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>E(e)?Promise.resolve(i.transform(e.value,n)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!E(e))return e;let s=i.transform(e.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}s.assertNever(i)}}ek.create=(e,t,r)=>new ek({schema:e,typeName:l.ZodEffects,effect:t,...$(r)}),ek.createWithPreprocess=(e,t,r)=>new ek({schema:t,effect:{type:"preprocess",transform:e},typeName:l.ZodEffects,...$(r)});class eS extends R{_parse(e){return this._getType(e)===f.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eS.create=(e,t)=>new eS({innerType:e,typeName:l.ZodOptional,...$(t)});class ex extends R{_parse(e){return this._getType(e)===f.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ex.create=(e,t)=>new ex({innerType:e,typeName:l.ZodNullable,...$(t)});class eT extends R{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eT.create=(e,t)=>new eT({innerType:e,typeName:l.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});class eE extends R{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return A(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eE.create=(e,t)=>new eE({innerType:e,typeName:l.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});class eA extends R{_parse(e){if(this._getType(e)!==f.nan){let t=this._getOrReturnCtx(e);return _(t,{code:m.invalid_type,expected:f.nan,received:t.parsedType}),w}return{status:"valid",value:e.data}}}eA.create=e=>new eA({typeName:l.ZodNaN,...$(e)}),Symbol("zod_brand");class eO extends R{_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 ej extends R{_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?w:"dirty"===e.status?(t.dirty(),k(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?w:"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 ej({in:e,out:t,typeName:l.ZodPipeline})}}class eC extends R{_parse(e){let t=this._def.innerType._parse(e),r=e=>(E(e)&&(e.value=Object.freeze(e.value)),e);return A(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}eC.create=(e,t)=>new eC({innerType:e,typeName:l.ZodReadonly,...$(t)}),ea.lazycreate,(c=l||(l={})).ZodString="ZodString",c.ZodNumber="ZodNumber",c.ZodNaN="ZodNaN",c.ZodBigInt="ZodBigInt",c.ZodBoolean="ZodBoolean",c.ZodDate="ZodDate",c.ZodSymbol="ZodSymbol",c.ZodUndefined="ZodUndefined",c.ZodNull="ZodNull",c.ZodAny="ZodAny",c.ZodUnknown="ZodUnknown",c.ZodNever="ZodNever",c.ZodVoid="ZodVoid",c.ZodArray="ZodArray",c.ZodObject="ZodObject",c.ZodUnion="ZodUnion",c.ZodDiscriminatedUnion="ZodDiscriminatedUnion",c.ZodIntersection="ZodIntersection",c.ZodTuple="ZodTuple",c.ZodRecord="ZodRecord",c.ZodMap="ZodMap",c.ZodSet="ZodSet",c.ZodFunction="ZodFunction",c.ZodLazy="ZodLazy",c.ZodLiteral="ZodLiteral",c.ZodEnum="ZodEnum",c.ZodEffects="ZodEffects",c.ZodNativeEnum="ZodNativeEnum",c.ZodOptional="ZodOptional",c.ZodNullable="ZodNullable",c.ZodDefault="ZodDefault",c.ZodCatch="ZodCatch",c.ZodPromise="ZodPromise",c.ZodBranded="ZodBranded",c.ZodPipeline="ZodPipeline",c.ZodReadonly="ZodReadonly";let eP=J.create;W.create,eA.create,H.create,G.create,Y.create,X.create,Q.create,ee.create,et.create,er.create,es.create,ei.create,en.create;let e$=ea.create;ea.strictCreate,eo.create,eu.create,eh.create,ec.create,ed.create,ef.create,ep.create,em.create,ey.create,eg.create,e_.create,eb.create,ew.create,ek.create,eS.create,ex.create,ek.createWithPreprocess,ej.create}}]);