@atproto/oauth-provider-ui 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ var uu=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);import{r as S,j as l,c as re,L as du,A as lu,u as G,U as fu,C as hu,a as wr,b as Bt,T as C,E as pu,d as Tr,e as mu,B as so,f as io,g as hi,R as _u,h as gu,N as pi,i as mi,k as cn,l as yu,m as vu,n as bu,o as xu,p as ao,S as Eu,I as Su,q as wu,s as _i,t as gi,X as Tu,v as Iu,w as ju,x as Ru,y as Cu}from"./error-view-BrIEEpo5.js";var lm=uu((pm,Tc)=>{const oo=S.createContext(null),Zn={didCatch:!1,error:null};class Du extends S.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Zn}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,s=arguments.length,i=new Array(s),a=0;a<s;a++)i[a]=arguments[a];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:i,reason:"imperative-api"}),this.setState(Zn)}}componentDidCatch(t,r){var n,s;(n=(s=this.props).onError)===null||n===void 0||n.call(s,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:s}=this.props;if(n&&r.error!==null&&Nu(t.resetKeys,s)){var i,a;(i=(a=this.props).onReset)===null||i===void 0||i.call(a,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(Zn)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:s}=this.props,{didCatch:i,error:a}=this.state;let c=t;if(i){const u={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")c=r(u);else if(n)c=S.createElement(n,u);else if(s!==void 0)c=s;else throw a}return S.createElement(oo.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},c)}}function Nu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}function ku(e){if(e==null||typeof e.didCatch!="boolean"||typeof e.resetErrorBoundary!="function")throw new Error("ErrorBoundaryContext not found")}function Pu(){const e=S.useContext(oo);ku(e);const[t,r]=S.useState({error:null,hasError:!1}),n=S.useMemo(()=>({resetBoundary:()=>{e.resetErrorBoundary(),r({error:null,hasError:!1})},showBoundary:s=>r({error:s,hasError:!0})}),[e.resetErrorBoundary]);if(t.hasError)throw t.error;return n}function Ee({customizationData:e,title:t,subtitle:r,htmlTitle:n=typeof t=="string"?t:void 0,className:s,children:i,...a}){return l.jsxs("div",{...a,className:re(s,"flex flex-col items-center","md:flex md:flex-row md:items-center md:justify-stretch","min-w-screen min-h-screen"),children:[n&&l.jsx("title",{children:n}),l.jsxs("div",{className:re("px-6 pt-4","w-full","md:max-w-lg","flex flex-row items-center","md:flex-col md:items-end","md:self-stretch","md:max-w-fix md:w-1/2 md:p-4","md:text-right","md:dark:border-r md:dark:border-slate-700","md:bg-slate-100 md:dark:bg-slate-800"),children:[l.jsxs("div",{className:"grid grow content-center md:justify-items-end",children:[t&&l.jsx("h1",{className:"text-primary text-xl font-semibold md:my-4 md:text-2xl lg:text-5xl",children:t},"title"),r&&l.jsx("p",{className:"hidden max-w-xs text-slate-600 md:block dark:text-slate-400",children:r},"subtitle")]}),l.jsx(du,{className:"m-1 md:m-2"},"localeSelector")]}),l.jsx("main",{className:"w-full p-6 md:max-w-3xl md:px-12",children:i})]})}function Au(e,t,r){if(!e)return[t];const n=e.findIndex(r);return n===-1?[...e,t]:[...e.slice(0,n),t,...e.slice(n+1)]}function rt(e,t){const{showBoundary:r}=Pu();return S.useCallback(async(...n)=>{try{return await e(...n)}catch(s){throw s instanceof fu&&r(s),s}},t.concat(r))}function Ou({sessions:e=[],onRedirected:t}){const[r]=S.useState(()=>new lu),[n,s]=S.useState(e),{i18n:i,_:a}=G(),{locale:c}=i,u=S.useCallback(k=>{s(A=>{var I;return k===(((I=A.find(Z=>Z.selected))==null?void 0:I.account.sub)||null)?A:A.map(Z=>({...Z,selected:Z.account.sub===k}))})},[s]),f=S.useCallback(({account:k,ephemeralToken:A,consentRequired:I=!0,selected:Z=!0,loginRequired:B=!1})=>{const M={account:k,ephemeralToken:A,selected:Z,loginRequired:B,consentRequired:I};s(K=>Au(K,M,H=>H.account.sub===k.sub).map(H=>!Z||H===M||!H.selected?H:{...H,selected:!1}))},[s]),d=S.useCallback(k=>{window.location.href=String(k),t&&setTimeout(t)},[t]),p=rt(async(k,A)=>{const I=await r.fetch("POST","/sign-in",{...k,locale:c},{signal:A});f(I)},[r,c,f]),_=rt(async(k,A)=>{await r.fetch("POST","/reset-password-request",{...k,locale:c},{signal:A})},[r,c]),m=rt(async(k,A)=>{await r.fetch("POST","/reset-password-confirm",k,{signal:A})},[r]),x=rt(async(k,A)=>{await r.fetch("POST","/verify-handle-availability",k,{signal:A})},[r]),w=rt(async(k,A)=>{const I=await r.fetch("POST","/sign-up",{...k,locale:c},{signal:A});f(I)},[r,c,f]),R=rt(async(k,A)=>{var B;const I=(B=n.find(M=>M.account.sub===k))==null?void 0:B.ephemeralToken,{url:Z}=await r.fetch("POST","/consent",{sub:k,scope:A},{bearer:I});d(Z)},[r,n,d]),P=rt(async()=>{const{url:k}=await r.fetch("POST","/reject",{});d(k)},[r,d]);return{sessions:n,selectSub:u,doSignIn:p,doInitiatePasswordReset:_,doConfirmResetPassword:m,doValidateNewHandle:x,doSignUp:w,doConsent:R,doReject:P}}function It(e,t){return S.useCallback(()=>e(t),[e,t])}function Uu({clientId:e,clientMetadata:t,clientTrusted:r}){const[n,s]=S.useState(!1),i=r?t.logo_uri:void 0,a=t.client_name||e;return S.useEffect(()=>{s(!1)},[i]),i&&!n?l.jsx("img",{"aria-hidden":!0,src:i,alt:a,className:"-ml-1 size-8",onError:()=>s(!0)}):l.jsx("div",{"aria-hidden":!0,className:"bg-primary flex size-8 items-center justify-center overflow-hidden rounded-full text-white",children:l.jsx(hu,{className:"size-4"})})}function ae({color:e="grey",transparent:t=!1,loading:r=void 0,shape:n="rounded",children:s,className:i,type:a="button",role:c="Button",disabled:u=!1,...f}){const d=a==="submit"||f.onClick!=null;return l.jsx("button",{role:c,type:a,disabled:u||r===!0,tabIndex:(f==null?void 0:f.tabIndex)??(d?0:-1),...f,className:re("touch-manipulation overflow-hidden","truncate tracking-wide",d?"cursor-pointer":null,n==="circle"?"rounded-full":"rounded-md",n==="circle"?"size-8":null,n==="rounded"?"px-6 py-2":n==="padded"?"p-2":void 0,"transition duration-300 ease-in-out","outline-none","focus:ring-primary focus:ring-2 focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-offset-black",e==="primary"?re("accent-slate-100",t?"text-primary bg-transparent":"bg-primary text-primary-contrast"):e==="grey"?re("accent-primary","text-slate-600 dark:text-slate-300","hover:bg-gray-200 dark:hover:bg-gray-700",t?"bg-transparent":"bg-gray-100 dark:bg-gray-800"):void 0,"disabled:opacity-50",i),children:s})}function Zu(e,t){S.useEffect(()=>{const r=n=>{!n.defaultPrevented&&e.current&&!e.current.contains(n.target)&&t(n)};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e,t])}function $u(e){const t=r=>{r.key==="Escape"&&(r.preventDefault(),e())};S.useEffect(()=>(window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}),[e])}function we({hint:e,image:t,title:r,description:n,append:s,className:i,children:a,...c}){const{i18n:u,_:f}=G(),[d,p]=S.useState(!1),_=S.useCallback(()=>p(!1),[]),m=S.useRef(null);$u(_),Zu(m,_);const x=a!=null,w=wr("details-card-");return l.jsxs("div",{ref:m,className:i,...c,children:[l.jsxs("div",{className:"flex items-center justify-start gap-2",children:[l.jsx("div",{className:"ml-2 flex w-8 flex-grow-0 items-center justify-center","aria-hidden":!0,children:t}),l.jsxs("div",{className:"flex flex-1 flex-col","aria-describedby":x?w:void 0,children:[r&&l.jsx("h3",{children:r}),n&&l.jsx("p",{className:"text-sm",children:n})]}),s&&l.jsx("div",{className:"flex shrink-0 grow-0 items-center justify-center",children:s}),x&&l.jsx(ae,{onClick:R=>{R.defaultPrevented||(R.preventDefault(),p(P=>!P))},shape:"circle",title:d?u._({id:"183A6G"}):e??u._({id:"xAo8pm"}),"aria-expanded":d,"aria-label":d?u._({id:"183A6G"}):e??u._({id:"xAo8pm"}),"aria-haspopup":"true","aria-controls":w,children:"?"})]}),x&&l.jsx(Bt,{className:"mt-4",hidden:!d,id:w,"aria-hidden":!d,children:a})]})}var nt={},$n={},or={},yi;function bt(){if(yi)return or;yi=1,Object.defineProperty(or,"__esModule",{value:!0}),or.isScopeStringFor=e,or.isScopeSyntaxFor=t;function e(r,n){if(r.length>n.length){const s=r.charCodeAt(n.length);return s!==58&&s!==63?!1:r.startsWith(n)}else return r===n}function t(r,n){return r.prefix===n}return or}var jt={},vi;function Ir(){if(vi)return jt;vi=1,Object.defineProperty(jt,"__esModule",{value:!0}),jt.minIdx=e,jt.knownValuesValidator=t,jt.isNonNullable=r;function e(n,s){return n===-1?s:s===-1?n:Math.min(n,s)}function t(n){const s=new Set(n);return i=>s.has(i)}function r(n){return n!=null}return jt}var Ln={},cr={},ur={},bi;function xt(){if(bi)return ur;bi=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.ScopeStringSyntax=void 0;const e=Ir();class t{constructor(a,c,u){Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"positional",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:u})}*keys(){this.params&&(yield*this.params.keys())}getSingle(a){var u;if(!((u=this.params)!=null&&u.has(a)))return;const c=this.params.getAll(a);return c.length>1?null:c[0]}getMulti(a){var c;if((c=this.params)!=null&&c.has(a))return this.params.getAll(a)}toString(){var c;let a=this.prefix;return this.positional!==void 0&&(a+=`:${s(encodeURIComponent(this.positional))}`),(c=this.params)!=null&&c.size&&(a+=`?${s(this.params.toString())}`),a}static fromString(a){const c=a.indexOf("?"),u=a.indexOf(":"),f=(0,e.minIdx)(c,u);if(f===-1)return new t(a);const d=a.slice(0,f),p=u!==-1?c===-1?decodeURIComponent(a.slice(u+1)):u<c?decodeURIComponent(a.slice(u+1,c)):void 0:void 0,_=c!==-1&&c<a.length-1?new URLSearchParams(a.slice(c+1)):void 0;return new t(d,p,_)}}ur.ScopeStringSyntax=t;const r=new Set([":","/","+",",","@","%"]),n=new Map(Array.from(r,i=>[encodeURIComponent(i),i]).filter(([i,a])=>i!==a&&i.length===3&&i.startsWith("%")));function s(i){let a=i.length-2;for(let c=0;c<a;c++)if(i.charCodeAt(c)===37){const u=i.slice(c,c+3),f=n.get(u);f&&(i=`${i.slice(0,c)}${f}${i.slice(c+u.length)}`,c+=f.length-1,a-=u.length-f.length)}return i}return ur}var xi;function Mt(){if(xi)return cr;xi=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.Parser=void 0;const e=xt();class t{constructor(s,i,a){Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"positionalName",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"schemaKeys",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.schemaKeys=new Set(Object.keys(i))}format(s){const i=new URLSearchParams;let a;for(const c of this.schemaKeys){const u=s[c];if(u===void 0)continue;const f=this.schema[c],d=f.normalize?f.normalize(u):u;if(!(!f.required&&(f.default===d||f.multiple&&f.default&&r(f.default,d))))if(Array.isArray(d))if(c===this.positionalName&&d.length===1)a=String(d[0]);else{const p=new Set(d.map(String));for(const _ of p)i.append(c,_)}else c===this.positionalName?a=String(d):i.set(c,String(d))}return new e.ScopeStringSyntax(this.prefix,a,i).toString()}parse(s){for(const a of s.keys())if(!this.schemaKeys.has(a))return null;const i=Object.create(null);for(const a of this.schemaKeys){const c=this.schema[a],u=c.multiple?s.getMulti(a):s.getSingle(a);if(u===null)return null;if(u!==void 0){if(a===this.positionalName&&s.positional!==void 0)return null;if(c.multiple){if(!u.length||!u.every(c.validate))return null}else if(!c.validate(u))return null;i[a]=u}else if(a===this.positionalName&&s.positional!==void 0){const{positional:f}=s;if(!c.validate(f))return null;i[a]=c.multiple?[f]:f}else{if(c.required)return null;i[a]=c.default}}return i}}cr.Parser=t;function r(n,s){for(const i of n)if(!s.includes(i))return!1;for(const i of s)if(!n.includes(i))return!1;return!0}return cr}var Ei;function vn(){return Ei||(Ei=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AccountPermission=e.ACCOUNT_ACTIONS=e.ACCOUNT_ATTRIBUTES=void 0;const t=Mt(),r=xt(),n=bt(),s=Ir();e.ACCOUNT_ATTRIBUTES=Object.freeze(["email","repo","status"]),e.ACCOUNT_ACTIONS=Object.freeze(["read","manage"]);class i{constructor(c,u){Object.defineProperty(this,"attr",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"action",{enumerable:!0,configurable:!0,writable:!0,value:u})}matches(c){return this.attr===c.attr&&(this.action.includes("manage")||this.action.includes(c.action))}toString(){return i.parser.format(this)}static fromString(c){if(!(0,n.isScopeStringFor)(c,"account"))return null;const u=r.ScopeStringSyntax.fromString(c);return i.fromSyntax(u)}static fromSyntax(c){const u=i.parser.parse(c);return u?new i(u.attr,u.action):null}static scopeNeededFor(c){return i.parser.format({attr:c.attr,action:[c.action]})}}e.AccountPermission=i,Object.defineProperty(i,"parser",{enumerable:!0,configurable:!0,writable:!0,value:new t.Parser("account",{attr:{multiple:!1,required:!0,validate:(0,s.knownValuesValidator)(e.ACCOUNT_ATTRIBUTES)},action:{multiple:!0,required:!1,validate:(0,s.knownValuesValidator)(e.ACCOUNT_ACTIONS),default:["read"]}},"attr")})}(Ln)),Ln}var Bn={},st={},Si;function Lu(){if(Si)return st;Si=1,Object.defineProperty(st,"__esModule",{value:!0}),st.isMime=t,st.isAccept=r,st.matchesAccept=s,st.matchesAnyAccept=a;function e(c){const u=c.indexOf("/");return!(u===-1||u===0||u===c.length-1||c.includes("/",u+1)||c.includes(" "))}function t(c){return e(c)&&!c.includes("*")}function r(c){return typeof c!="string"?!1:c==="*/*"?!0:e(c)?!c.includes("*")||c.endsWith("/*"):!1}function n(c,u){return c==="*/*"?!0:c.endsWith("/*")?u.startsWith(c.slice(0,-1)):c===u}function s(c,u){return t(u)&&n(c,u)}function i(c,u){for(const f of c)if(n(f,u))return!0;return!1}function a(c,u){return t(u)&&i(c,u)}return st}var wi;function bn(){return wi||(wi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.BlobPermission=e.DEFAULT_ACCEPT=void 0;const t=Lu(),r=Mt(),n=xt(),s=bt();e.DEFAULT_ACCEPT=Object.freeze(["*/*"]);class i{constructor(f){Object.defineProperty(this,"accept",{enumerable:!0,configurable:!0,writable:!0,value:f})}matches(f){return(0,t.matchesAnyAccept)(this.accept,f.mime)}toString(){return i.parser.format(this)}static fromString(f){if(!(0,s.isScopeStringFor)(f,"blob"))return null;const d=n.ScopeStringSyntax.fromString(f);return i.fromSyntax(d)}static fromSyntax(f){const d=i.parser.parse(f);return d?new i(d.accept):null}static scopeNeededFor(f){return i.parser.format({accept:[f.mime]})}}e.BlobPermission=i,Object.defineProperty(i,"parser",{enumerable:!0,configurable:!0,writable:!0,value:new r.Parser("blob",{accept:{multiple:!0,required:!0,validate:t.isAccept,normalize:u=>u.includes("*/*")?e.DEFAULT_ACCEPT:u.map(a).filter(c).sort()}},"accept")});function a(u){return typeof u=="string"?u.toLowerCase():u}function c(u,f,d){if(typeof u!="string"||u.endsWith("/*"))return!0;const p=u.split("/",1)[0];return!d.includes(`${p}/*`)}}(Bn)),Bn}var Mn={},Ti;function xn(){return Ti||(Ti=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IdentityPermission=e.IDENTITY_ATTRIBUTES=void 0;const t=Mt(),r=xt(),n=bt(),s=Ir();e.IDENTITY_ATTRIBUTES=Object.freeze(["handle","*"]);class i{constructor(c){Object.defineProperty(this,"attr",{enumerable:!0,configurable:!0,writable:!0,value:c})}matches(c){return this.attr==="*"||this.attr===c.attr}toString(){return i.parser.format(this)}static fromString(c){if(!(0,n.isScopeStringFor)(c,"identity"))return null;const u=r.ScopeStringSyntax.fromString(c);return i.fromSyntax(u)}static fromSyntax(c){const u=i.parser.parse(c);return u?new i(u.attr):null}static scopeNeededFor(c){return i.parser.format(c)}}e.IdentityPermission=i,Object.defineProperty(i,"parser",{enumerable:!0,configurable:!0,writable:!0,value:new t.Parser("identity",{attr:{multiple:!1,required:!0,validate:(0,s.knownValuesValidator)(e.IDENTITY_ATTRIBUTES)}},"attr")})}(Mn)),Mn}var Vn={},it={},qn={},be={},at={},xe={},Vr={},Gn={},Ii;function En(){return Ii||(Ii=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getParsedType=e.ZodParsedType=e.objectUtil=e.util=void 0;var t;(function(s){s.assertEqual=u=>u;function i(u){}s.assertIs=i;function a(u){throw new Error}s.assertNever=a,s.arrayToEnum=u=>{const f={};for(const d of u)f[d]=d;return f},s.getValidEnumValues=u=>{const f=s.objectKeys(u).filter(p=>typeof u[u[p]]!="number"),d={};for(const p of f)d[p]=u[p];return s.objectValues(d)},s.objectValues=u=>s.objectKeys(u).map(function(f){return u[f]}),s.objectKeys=typeof Object.keys=="function"?u=>Object.keys(u):u=>{const f=[];for(const d in u)Object.prototype.hasOwnProperty.call(u,d)&&f.push(d);return f},s.find=(u,f)=>{for(const d of u)if(f(d))return d},s.isInteger=typeof Number.isInteger=="function"?u=>Number.isInteger(u):u=>typeof u=="number"&&isFinite(u)&&Math.floor(u)===u;function c(u,f=" | "){return u.map(d=>typeof d=="string"?`'${d}'`:d).join(f)}s.joinValues=c,s.jsonStringifyReplacer=(u,f)=>typeof f=="bigint"?f.toString():f})(t||(e.util=t={}));var r;(function(s){s.mergeShapes=(i,a)=>({...i,...a})})(r||(e.objectUtil=r={})),e.ZodParsedType=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const n=s=>{switch(typeof s){case"undefined":return e.ZodParsedType.undefined;case"string":return e.ZodParsedType.string;case"number":return isNaN(s)?e.ZodParsedType.nan:e.ZodParsedType.number;case"boolean":return e.ZodParsedType.boolean;case"function":return e.ZodParsedType.function;case"bigint":return e.ZodParsedType.bigint;case"symbol":return e.ZodParsedType.symbol;case"object":return Array.isArray(s)?e.ZodParsedType.array:s===null?e.ZodParsedType.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?e.ZodParsedType.promise:typeof Map<"u"&&s instanceof Map?e.ZodParsedType.map:typeof Set<"u"&&s instanceof Set?e.ZodParsedType.set:typeof Date<"u"&&s instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}};e.getParsedType=n}(Gn)),Gn}var Ae={},ji;function Is(){if(ji)return Ae;ji=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.ZodError=Ae.quotelessJson=Ae.ZodIssueCode=void 0;const e=En();Ae.ZodIssueCode=e.util.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"]);const t=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");Ae.quotelessJson=t;let r=class co extends Error{get errors(){return this.issues}constructor(s){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=s}format(s){const i=s||function(u){return u.message},a={_errors:[]},c=u=>{for(const f of u.issues)if(f.code==="invalid_union")f.unionErrors.map(c);else if(f.code==="invalid_return_type")c(f.returnTypeError);else if(f.code==="invalid_arguments")c(f.argumentsError);else if(f.path.length===0)a._errors.push(i(f));else{let d=a,p=0;for(;p<f.path.length;){const _=f.path[p];p===f.path.length-1?(d[_]=d[_]||{_errors:[]},d[_]._errors.push(i(f))):d[_]=d[_]||{_errors:[]},d=d[_],p++}}};return c(this),a}static assert(s){if(!(s instanceof co))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(s=i=>i.message){const i={},a=[];for(const c of this.issues)c.path.length>0?(i[c.path[0]]=i[c.path[0]]||[],i[c.path[0]].push(s(c))):a.push(s(c));return{formErrors:a,fieldErrors:i}}get formErrors(){return this.flatten()}};return Ae.ZodError=r,r.create=n=>new r(n),Ae}var Ri;function uo(){if(Ri)return Vr;Ri=1,Object.defineProperty(Vr,"__esModule",{value:!0});const e=En(),t=Is(),r=(n,s)=>{let i;switch(n.code){case t.ZodIssueCode.invalid_type:n.received===e.ZodParsedType.undefined?i="Required":i=`Expected ${n.expected}, received ${n.received}`;break;case t.ZodIssueCode.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(n.expected,e.util.jsonStringifyReplacer)}`;break;case t.ZodIssueCode.unrecognized_keys:i=`Unrecognized key(s) in object: ${e.util.joinValues(n.keys,", ")}`;break;case t.ZodIssueCode.invalid_union:i="Invalid input";break;case t.ZodIssueCode.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${e.util.joinValues(n.options)}`;break;case t.ZodIssueCode.invalid_enum_value:i=`Invalid enum value. Expected ${e.util.joinValues(n.options)}, received '${n.received}'`;break;case t.ZodIssueCode.invalid_arguments:i="Invalid function arguments";break;case t.ZodIssueCode.invalid_return_type:i="Invalid function return type";break;case t.ZodIssueCode.invalid_date:i="Invalid date";break;case t.ZodIssueCode.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(i=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?i=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?i=`Invalid input: must end with "${n.validation.endsWith}"`:e.util.assertNever(n.validation):n.validation!=="regex"?i=`Invalid ${n.validation}`:i="Invalid";break;case t.ZodIssueCode.too_small:n.type==="array"?i=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?i=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?i=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?i=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:i="Invalid input";break;case t.ZodIssueCode.too_big:n.type==="array"?i=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?i=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?i=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?i=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?i=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:i="Invalid input";break;case t.ZodIssueCode.custom:i="Invalid input";break;case t.ZodIssueCode.invalid_intersection_types:i="Intersection results could not be merged";break;case t.ZodIssueCode.not_multiple_of:i=`Number must be a multiple of ${n.multipleOf}`;break;case t.ZodIssueCode.not_finite:i="Number must be finite";break;default:i=s.defaultError,e.util.assertNever(n)}return{message:i}};return Vr.default=r,Vr}var Ci;function js(){if(Ci)return xe;Ci=1;var e=xe&&xe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(xe,"__esModule",{value:!0}),xe.getErrorMap=xe.setErrorMap=xe.defaultErrorMap=void 0;const t=e(uo());xe.defaultErrorMap=t.default;let r=t.default;function n(i){r=i}xe.setErrorMap=n;function s(){return r}return xe.getErrorMap=s,xe}var dr={},Di;function lo(){return Di||(Di=1,function(e){var t=dr&&dr.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.addIssueToContext=e.EMPTY_PATH=e.makeIssue=void 0;const r=js(),n=t(uo()),s=m=>{const{data:x,path:w,errorMaps:R,issueData:P}=m,k=[...w,...P.path||[]],A={...P,path:k};if(P.message!==void 0)return{...P,path:k,message:P.message};let I="";const Z=R.filter(B=>!!B).slice().reverse();for(const B of Z)I=B(A,{data:x,defaultError:I}).message;return{...P,path:k,message:I}};e.makeIssue=s,e.EMPTY_PATH=[];function i(m,x){const w=(0,r.getErrorMap)(),R=(0,e.makeIssue)({issueData:x,data:m.data,path:m.path,errorMaps:[m.common.contextualErrorMap,m.schemaErrorMap,w,w===n.default?void 0:n.default].filter(P=>!!P)});m.common.issues.push(R)}e.addIssueToContext=i;class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(x,w){const R=[];for(const P of w){if(P.status==="aborted")return e.INVALID;P.status==="dirty"&&x.dirty(),R.push(P.value)}return{status:x.value,value:R}}static async mergeObjectAsync(x,w){const R=[];for(const P of w){const k=await P.key,A=await P.value;R.push({key:k,value:A})}return a.mergeObjectSync(x,R)}static mergeObjectSync(x,w){const R={};for(const P of w){const{key:k,value:A}=P;if(k.status==="aborted"||A.status==="aborted")return e.INVALID;k.status==="dirty"&&x.dirty(),A.status==="dirty"&&x.dirty(),k.value!=="__proto__"&&(typeof A.value<"u"||P.alwaysSet)&&(R[k.value]=A.value)}return{status:x.value,value:R}}}e.ParseStatus=a,e.INVALID=Object.freeze({status:"aborted"});const c=m=>({status:"dirty",value:m});e.DIRTY=c;const u=m=>({status:"valid",value:m});e.OK=u;const f=m=>m.status==="aborted";e.isAborted=f;const d=m=>m.status==="dirty";e.isDirty=d;const p=m=>m.status==="valid";e.isValid=p;const _=m=>typeof Promise<"u"&&m instanceof Promise;e.isAsync=_}(dr)),dr}var Yn={},Ni;function Bu(){return Ni||(Ni=1,Object.defineProperty(Yn,"__esModule",{value:!0})),Yn}var E={},lr={},ki;function Mu(){if(ki)return lr;ki=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.errorUtil=void 0;var e;return function(t){t.errToObj=r=>typeof r=="string"?{message:r}:r||{},t.toString=r=>typeof r=="string"?r:r==null?void 0:r.message}(e||(lr.errorUtil=e={})),lr}var Pi;function Vu(){if(Pi)return E;Pi=1;var e=E&&E.__classPrivateFieldGet||function(y,o,h,g){if(h==="a"&&!g)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?y!==o||!g:!o.has(y))throw new TypeError("Cannot read private member from an object whose class did not declare it");return h==="m"?g:h==="a"?g.call(y):g?g.value:o.get(y)},t=E&&E.__classPrivateFieldSet||function(y,o,h,g,v){if(g==="m")throw new TypeError("Private method is not writable");if(g==="a"&&!v)throw new TypeError("Private accessor was defined without a setter");if(typeof o=="function"?y!==o||!v:!o.has(y))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g==="a"?v.call(y,h):v?v.value=h:o.set(y,h),h},r,n;Object.defineProperty(E,"__esModule",{value:!0}),E.boolean=E.bigint=E.array=E.any=E.coerce=E.ZodFirstPartyTypeKind=E.late=E.ZodSchema=E.Schema=E.custom=E.ZodReadonly=E.ZodPipeline=E.ZodBranded=E.BRAND=E.ZodNaN=E.ZodCatch=E.ZodDefault=E.ZodNullable=E.ZodOptional=E.ZodTransformer=E.ZodEffects=E.ZodPromise=E.ZodNativeEnum=E.ZodEnum=E.ZodLiteral=E.ZodLazy=E.ZodFunction=E.ZodSet=E.ZodMap=E.ZodRecord=E.ZodTuple=E.ZodIntersection=E.ZodDiscriminatedUnion=E.ZodUnion=E.ZodObject=E.ZodArray=E.ZodVoid=E.ZodNever=E.ZodUnknown=E.ZodAny=E.ZodNull=E.ZodUndefined=E.ZodSymbol=E.ZodDate=E.ZodBoolean=E.ZodBigInt=E.ZodNumber=E.ZodString=E.datetimeRegex=E.ZodType=void 0,E.NEVER=E.void=E.unknown=E.union=E.undefined=E.tuple=E.transformer=E.symbol=E.string=E.strictObject=E.set=E.record=E.promise=E.preprocess=E.pipeline=E.ostring=E.optional=E.onumber=E.oboolean=E.object=E.number=E.nullable=E.null=E.never=E.nativeEnum=E.nan=E.map=E.literal=E.lazy=E.intersection=E.instanceof=E.function=E.enum=E.effect=E.discriminatedUnion=E.date=void 0;const s=js(),i=Mu(),a=lo(),c=En(),u=Is();class f{constructor(o,h,g,v){this._cachedPath=[],this.parent=o,this.data=h,this._path=g,this._key=v}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}}const d=(y,o)=>{if((0,a.isValid)(o))return{success:!0,data:o.value};if(!y.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const h=new u.ZodError(y.common.issues);return this._error=h,this._error}}};function p(y){if(!y)return{};const{errorMap:o,invalid_type_error:h,required_error:g,description:v}=y;if(o&&(h||g))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return o?{errorMap:o,description:v}:{errorMap:(D,j)=>{var U,O;const{message:$}=y;return D.code==="invalid_enum_value"?{message:$??j.defaultError}:typeof j.data>"u"?{message:(U=$??g)!==null&&U!==void 0?U:j.defaultError}:D.code!=="invalid_type"?{message:j.defaultError}:{message:(O=$??h)!==null&&O!==void 0?O:j.defaultError}},description:v}}class _{get description(){return this._def.description}_getType(o){return(0,c.getParsedType)(o.data)}_getOrReturnCtx(o,h){return h||{common:o.parent.common,data:o.data,parsedType:(0,c.getParsedType)(o.data),schemaErrorMap:this._def.errorMap,path:o.path,parent:o.parent}}_processInputParams(o){return{status:new a.ParseStatus,ctx:{common:o.parent.common,data:o.data,parsedType:(0,c.getParsedType)(o.data),schemaErrorMap:this._def.errorMap,path:o.path,parent:o.parent}}}_parseSync(o){const h=this._parse(o);if((0,a.isAsync)(h))throw new Error("Synchronous parse encountered promise.");return h}_parseAsync(o){const h=this._parse(o);return Promise.resolve(h)}parse(o,h){const g=this.safeParse(o,h);if(g.success)return g.data;throw g.error}safeParse(o,h){var g;const v={common:{issues:[],async:(g=h==null?void 0:h.async)!==null&&g!==void 0?g:!1,contextualErrorMap:h==null?void 0:h.errorMap},path:(h==null?void 0:h.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:(0,c.getParsedType)(o)},b=this._parseSync({data:o,path:v.path,parent:v});return d(v,b)}"~validate"(o){var h,g;const v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:(0,c.getParsedType)(o)};if(!this["~standard"].async)try{const b=this._parseSync({data:o,path:[],parent:v});return(0,a.isValid)(b)?{value:b.value}:{issues:v.common.issues}}catch(b){!((g=(h=b==null?void 0:b.message)===null||h===void 0?void 0:h.toLowerCase())===null||g===void 0)&&g.includes("encountered")&&(this["~standard"].async=!0),v.common={issues:[],async:!0}}return this._parseAsync({data:o,path:[],parent:v}).then(b=>(0,a.isValid)(b)?{value:b.value}:{issues:v.common.issues})}async parseAsync(o,h){const g=await this.safeParseAsync(o,h);if(g.success)return g.data;throw g.error}async safeParseAsync(o,h){const g={common:{issues:[],contextualErrorMap:h==null?void 0:h.errorMap,async:!0},path:(h==null?void 0:h.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:(0,c.getParsedType)(o)},v=this._parse({data:o,path:g.path,parent:g}),b=await((0,a.isAsync)(v)?v:Promise.resolve(v));return d(g,b)}refine(o,h){const g=v=>typeof h=="string"||typeof h>"u"?{message:h}:typeof h=="function"?h(v):h;return this._refinement((v,b)=>{const D=o(v),j=()=>b.addIssue({code:u.ZodIssueCode.custom,...g(v)});return typeof Promise<"u"&&D instanceof Promise?D.then(U=>U?!0:(j(),!1)):D?!0:(j(),!1)})}refinement(o,h){return this._refinement((g,v)=>o(g)?!0:(v.addIssue(typeof h=="function"?h(g,v):h),!1))}_refinement(o){return new ve({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:o}})}superRefine(o){return this._refinement(o)}constructor(o){this.spa=this.safeParseAsync,this._def=o,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),this["~standard"]={version:1,vendor:"zod",validate:h=>this["~validate"](h)}}optional(){return Ie.create(this,this._def)}nullable(){return Ye.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ye.create(this)}promise(){return Tt.create(this,this._def)}or(o){return Xt.create([this,o],this._def)}and(o){return Jt.create(this,o,this._def)}transform(o){return new ve({...p(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:o}})}default(o){const h=typeof o=="function"?o:()=>o;return new nr({...p(this._def),innerType:this,defaultValue:h,typeName:L.ZodDefault})}brand(){return new On({typeName:L.ZodBranded,type:this,...p(this._def)})}catch(o){const h=typeof o=="function"?o:()=>o;return new sr({...p(this._def),innerType:this,catchValue:h,typeName:L.ZodCatch})}describe(o){const h=this.constructor;return new h({...this._def,description:o})}pipe(o){return ir.create(this,o)}readonly(){return ar.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}E.ZodType=_,E.Schema=_,E.ZodSchema=_;const m=/^c[^\s-]{8,}$/i,x=/^[0-9a-z]+$/,w=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,P=/^[a-z0-9_-]{21}$/i,k=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A=/^[-+]?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)?)??$/,I=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Z="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let B;const 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])$/,K=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,H=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ue=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ne=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Y="((\\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])))",de=new RegExp(`^${Y}$`);function zt(y){let o="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return y.precision?o=`${o}\\.\\d{${y.precision}}`:y.precision==null&&(o=`${o}(\\.\\d+)?`),o}function _e(y){return new RegExp(`^${zt(y)}$`)}function Ft(y){let o=`${Y}T${zt(y)}`;const h=[];return h.push(y.local?"Z?":"Z"),y.offset&&h.push("([+-]\\d{2}:?\\d{2})"),o=`${o}(${h.join("|")})`,new RegExp(`^${o}$`)}E.datetimeRegex=Ft;function Me(y,o){return!!((o==="v4"||!o)&&M.test(y)||(o==="v6"||!o)&&H.test(y))}function Ic(y,o){if(!k.test(y))return!1;try{const[h]=y.split("."),g=h.replace(/-/g,"+").replace(/_/g,"/").padEnd(h.length+(4-h.length%4)%4,"="),v=JSON.parse(atob(g));return!(typeof v!="object"||v===null||!v.typ||!v.alg||o&&v.alg!==o)}catch{return!1}}function jc(y,o){return!!((o==="v4"||!o)&&K.test(y)||(o==="v6"||!o)&&ue.test(y))}class ge extends _{_parse(o){if(this._def.coerce&&(o.data=String(o.data)),this._getType(o)!==c.ZodParsedType.string){const b=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(b,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.string,received:b.parsedType}),a.INVALID}const g=new a.ParseStatus;let v;for(const b of this._def.checks)if(b.kind==="min")o.data.length<b.value&&(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.too_small,minimum:b.value,type:"string",inclusive:!0,exact:!1,message:b.message}),g.dirty());else if(b.kind==="max")o.data.length>b.value&&(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.too_big,maximum:b.value,type:"string",inclusive:!0,exact:!1,message:b.message}),g.dirty());else if(b.kind==="length"){const D=o.data.length>b.value,j=o.data.length<b.value;(D||j)&&(v=this._getOrReturnCtx(o,v),D?(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.too_big,maximum:b.value,type:"string",inclusive:!0,exact:!0,message:b.message}):j&&(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.too_small,minimum:b.value,type:"string",inclusive:!0,exact:!0,message:b.message}),g.dirty())}else if(b.kind==="email")I.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"email",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="emoji")B||(B=new RegExp(Z,"u")),B.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"emoji",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="uuid")R.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"uuid",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="nanoid")P.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"nanoid",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="cuid")m.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"cuid",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="cuid2")x.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"cuid2",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="ulid")w.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"ulid",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty());else if(b.kind==="url")try{new URL(o.data)}catch{v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"url",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()}else b.kind==="regex"?(b.regex.lastIndex=0,b.regex.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"regex",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty())):b.kind==="trim"?o.data=o.data.trim():b.kind==="includes"?o.data.includes(b.value,b.position)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.invalid_string,validation:{includes:b.value,position:b.position},message:b.message}),g.dirty()):b.kind==="toLowerCase"?o.data=o.data.toLowerCase():b.kind==="toUpperCase"?o.data=o.data.toUpperCase():b.kind==="startsWith"?o.data.startsWith(b.value)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.invalid_string,validation:{startsWith:b.value},message:b.message}),g.dirty()):b.kind==="endsWith"?o.data.endsWith(b.value)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.invalid_string,validation:{endsWith:b.value},message:b.message}),g.dirty()):b.kind==="datetime"?Ft(b).test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.invalid_string,validation:"datetime",message:b.message}),g.dirty()):b.kind==="date"?de.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.invalid_string,validation:"date",message:b.message}),g.dirty()):b.kind==="time"?_e(b).test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.invalid_string,validation:"time",message:b.message}),g.dirty()):b.kind==="duration"?A.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"duration",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()):b.kind==="ip"?Me(o.data,b.version)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"ip",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()):b.kind==="jwt"?Ic(o.data,b.alg)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"jwt",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()):b.kind==="cidr"?jc(o.data,b.version)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"cidr",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()):b.kind==="base64"?q.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"base64",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()):b.kind==="base64url"?ne.test(o.data)||(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{validation:"base64url",code:u.ZodIssueCode.invalid_string,message:b.message}),g.dirty()):c.util.assertNever(b);return{status:g.value,value:o.data}}_regex(o,h,g){return this.refinement(v=>o.test(v),{validation:h,code:u.ZodIssueCode.invalid_string,...i.errorUtil.errToObj(g)})}_addCheck(o){return new ge({...this._def,checks:[...this._def.checks,o]})}email(o){return this._addCheck({kind:"email",...i.errorUtil.errToObj(o)})}url(o){return this._addCheck({kind:"url",...i.errorUtil.errToObj(o)})}emoji(o){return this._addCheck({kind:"emoji",...i.errorUtil.errToObj(o)})}uuid(o){return this._addCheck({kind:"uuid",...i.errorUtil.errToObj(o)})}nanoid(o){return this._addCheck({kind:"nanoid",...i.errorUtil.errToObj(o)})}cuid(o){return this._addCheck({kind:"cuid",...i.errorUtil.errToObj(o)})}cuid2(o){return this._addCheck({kind:"cuid2",...i.errorUtil.errToObj(o)})}ulid(o){return this._addCheck({kind:"ulid",...i.errorUtil.errToObj(o)})}base64(o){return this._addCheck({kind:"base64",...i.errorUtil.errToObj(o)})}base64url(o){return this._addCheck({kind:"base64url",...i.errorUtil.errToObj(o)})}jwt(o){return this._addCheck({kind:"jwt",...i.errorUtil.errToObj(o)})}ip(o){return this._addCheck({kind:"ip",...i.errorUtil.errToObj(o)})}cidr(o){return this._addCheck({kind:"cidr",...i.errorUtil.errToObj(o)})}datetime(o){var h,g;return typeof o=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:o}):this._addCheck({kind:"datetime",precision:typeof(o==null?void 0:o.precision)>"u"?null:o==null?void 0:o.precision,offset:(h=o==null?void 0:o.offset)!==null&&h!==void 0?h:!1,local:(g=o==null?void 0:o.local)!==null&&g!==void 0?g:!1,...i.errorUtil.errToObj(o==null?void 0:o.message)})}date(o){return this._addCheck({kind:"date",message:o})}time(o){return typeof o=="string"?this._addCheck({kind:"time",precision:null,message:o}):this._addCheck({kind:"time",precision:typeof(o==null?void 0:o.precision)>"u"?null:o==null?void 0:o.precision,...i.errorUtil.errToObj(o==null?void 0:o.message)})}duration(o){return this._addCheck({kind:"duration",...i.errorUtil.errToObj(o)})}regex(o,h){return this._addCheck({kind:"regex",regex:o,...i.errorUtil.errToObj(h)})}includes(o,h){return this._addCheck({kind:"includes",value:o,position:h==null?void 0:h.position,...i.errorUtil.errToObj(h==null?void 0:h.message)})}startsWith(o,h){return this._addCheck({kind:"startsWith",value:o,...i.errorUtil.errToObj(h)})}endsWith(o,h){return this._addCheck({kind:"endsWith",value:o,...i.errorUtil.errToObj(h)})}min(o,h){return this._addCheck({kind:"min",value:o,...i.errorUtil.errToObj(h)})}max(o,h){return this._addCheck({kind:"max",value:o,...i.errorUtil.errToObj(h)})}length(o,h){return this._addCheck({kind:"length",value:o,...i.errorUtil.errToObj(h)})}nonempty(o){return this.min(1,i.errorUtil.errToObj(o))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(o=>o.kind==="datetime")}get isDate(){return!!this._def.checks.find(o=>o.kind==="date")}get isTime(){return!!this._def.checks.find(o=>o.kind==="time")}get isDuration(){return!!this._def.checks.find(o=>o.kind==="duration")}get isEmail(){return!!this._def.checks.find(o=>o.kind==="email")}get isURL(){return!!this._def.checks.find(o=>o.kind==="url")}get isEmoji(){return!!this._def.checks.find(o=>o.kind==="emoji")}get isUUID(){return!!this._def.checks.find(o=>o.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(o=>o.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(o=>o.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(o=>o.kind==="cuid2")}get isULID(){return!!this._def.checks.find(o=>o.kind==="ulid")}get isIP(){return!!this._def.checks.find(o=>o.kind==="ip")}get isCIDR(){return!!this._def.checks.find(o=>o.kind==="cidr")}get isBase64(){return!!this._def.checks.find(o=>o.kind==="base64")}get isBase64url(){return!!this._def.checks.find(o=>o.kind==="base64url")}get minLength(){let o=null;for(const h of this._def.checks)h.kind==="min"&&(o===null||h.value>o)&&(o=h.value);return o}get maxLength(){let o=null;for(const h of this._def.checks)h.kind==="max"&&(o===null||h.value<o)&&(o=h.value);return o}}E.ZodString=ge,ge.create=y=>{var o;return new ge({checks:[],typeName:L.ZodString,coerce:(o=y==null?void 0:y.coerce)!==null&&o!==void 0?o:!1,...p(y)})};function Rc(y,o){const h=(y.toString().split(".")[1]||"").length,g=(o.toString().split(".")[1]||"").length,v=h>g?h:g,b=parseInt(y.toFixed(v).replace(".","")),D=parseInt(o.toFixed(v).replace(".",""));return b%D/Math.pow(10,v)}class Ve extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(o){if(this._def.coerce&&(o.data=Number(o.data)),this._getType(o)!==c.ZodParsedType.number){const b=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(b,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.number,received:b.parsedType}),a.INVALID}let g;const v=new a.ParseStatus;for(const b of this._def.checks)b.kind==="int"?c.util.isInteger(o.data)||(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:b.message}),v.dirty()):b.kind==="min"?(b.inclusive?o.data<b.value:o.data<=b.value)&&(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_small,minimum:b.value,type:"number",inclusive:b.inclusive,exact:!1,message:b.message}),v.dirty()):b.kind==="max"?(b.inclusive?o.data>b.value:o.data>=b.value)&&(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_big,maximum:b.value,type:"number",inclusive:b.inclusive,exact:!1,message:b.message}),v.dirty()):b.kind==="multipleOf"?Rc(o.data,b.value)!==0&&(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.not_multiple_of,multipleOf:b.value,message:b.message}),v.dirty()):b.kind==="finite"?Number.isFinite(o.data)||(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.not_finite,message:b.message}),v.dirty()):c.util.assertNever(b);return{status:v.value,value:o.data}}gte(o,h){return this.setLimit("min",o,!0,i.errorUtil.toString(h))}gt(o,h){return this.setLimit("min",o,!1,i.errorUtil.toString(h))}lte(o,h){return this.setLimit("max",o,!0,i.errorUtil.toString(h))}lt(o,h){return this.setLimit("max",o,!1,i.errorUtil.toString(h))}setLimit(o,h,g,v){return new Ve({...this._def,checks:[...this._def.checks,{kind:o,value:h,inclusive:g,message:i.errorUtil.toString(v)}]})}_addCheck(o){return new Ve({...this._def,checks:[...this._def.checks,o]})}int(o){return this._addCheck({kind:"int",message:i.errorUtil.toString(o)})}positive(o){return this._addCheck({kind:"min",value:0,inclusive:!1,message:i.errorUtil.toString(o)})}negative(o){return this._addCheck({kind:"max",value:0,inclusive:!1,message:i.errorUtil.toString(o)})}nonpositive(o){return this._addCheck({kind:"max",value:0,inclusive:!0,message:i.errorUtil.toString(o)})}nonnegative(o){return this._addCheck({kind:"min",value:0,inclusive:!0,message:i.errorUtil.toString(o)})}multipleOf(o,h){return this._addCheck({kind:"multipleOf",value:o,message:i.errorUtil.toString(h)})}finite(o){return this._addCheck({kind:"finite",message:i.errorUtil.toString(o)})}safe(o){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:i.errorUtil.toString(o)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:i.errorUtil.toString(o)})}get minValue(){let o=null;for(const h of this._def.checks)h.kind==="min"&&(o===null||h.value>o)&&(o=h.value);return o}get maxValue(){let o=null;for(const h of this._def.checks)h.kind==="max"&&(o===null||h.value<o)&&(o=h.value);return o}get isInt(){return!!this._def.checks.find(o=>o.kind==="int"||o.kind==="multipleOf"&&c.util.isInteger(o.value))}get isFinite(){let o=null,h=null;for(const g of this._def.checks){if(g.kind==="finite"||g.kind==="int"||g.kind==="multipleOf")return!0;g.kind==="min"?(h===null||g.value>h)&&(h=g.value):g.kind==="max"&&(o===null||g.value<o)&&(o=g.value)}return Number.isFinite(h)&&Number.isFinite(o)}}E.ZodNumber=Ve,Ve.create=y=>new Ve({checks:[],typeName:L.ZodNumber,coerce:(y==null?void 0:y.coerce)||!1,...p(y)});class qe extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(o){if(this._def.coerce)try{o.data=BigInt(o.data)}catch{return this._getInvalidInput(o)}if(this._getType(o)!==c.ZodParsedType.bigint)return this._getInvalidInput(o);let g;const v=new a.ParseStatus;for(const b of this._def.checks)b.kind==="min"?(b.inclusive?o.data<b.value:o.data<=b.value)&&(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_small,type:"bigint",minimum:b.value,inclusive:b.inclusive,message:b.message}),v.dirty()):b.kind==="max"?(b.inclusive?o.data>b.value:o.data>=b.value)&&(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_big,type:"bigint",maximum:b.value,inclusive:b.inclusive,message:b.message}),v.dirty()):b.kind==="multipleOf"?o.data%b.value!==BigInt(0)&&(g=this._getOrReturnCtx(o,g),(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.not_multiple_of,multipleOf:b.value,message:b.message}),v.dirty()):c.util.assertNever(b);return{status:v.value,value:o.data}}_getInvalidInput(o){const h=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.bigint,received:h.parsedType}),a.INVALID}gte(o,h){return this.setLimit("min",o,!0,i.errorUtil.toString(h))}gt(o,h){return this.setLimit("min",o,!1,i.errorUtil.toString(h))}lte(o,h){return this.setLimit("max",o,!0,i.errorUtil.toString(h))}lt(o,h){return this.setLimit("max",o,!1,i.errorUtil.toString(h))}setLimit(o,h,g,v){return new qe({...this._def,checks:[...this._def.checks,{kind:o,value:h,inclusive:g,message:i.errorUtil.toString(v)}]})}_addCheck(o){return new qe({...this._def,checks:[...this._def.checks,o]})}positive(o){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:i.errorUtil.toString(o)})}negative(o){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:i.errorUtil.toString(o)})}nonpositive(o){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:i.errorUtil.toString(o)})}nonnegative(o){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:i.errorUtil.toString(o)})}multipleOf(o,h){return this._addCheck({kind:"multipleOf",value:o,message:i.errorUtil.toString(h)})}get minValue(){let o=null;for(const h of this._def.checks)h.kind==="min"&&(o===null||h.value>o)&&(o=h.value);return o}get maxValue(){let o=null;for(const h of this._def.checks)h.kind==="max"&&(o===null||h.value<o)&&(o=h.value);return o}}E.ZodBigInt=qe,qe.create=y=>{var o;return new qe({checks:[],typeName:L.ZodBigInt,coerce:(o=y==null?void 0:y.coerce)!==null&&o!==void 0?o:!1,...p(y)})};class Ht extends _{_parse(o){if(this._def.coerce&&(o.data=!!o.data),this._getType(o)!==c.ZodParsedType.boolean){const g=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.boolean,received:g.parsedType}),a.INVALID}return(0,a.OK)(o.data)}}E.ZodBoolean=Ht,Ht.create=y=>new Ht({typeName:L.ZodBoolean,coerce:(y==null?void 0:y.coerce)||!1,...p(y)});class Qe extends _{_parse(o){if(this._def.coerce&&(o.data=new Date(o.data)),this._getType(o)!==c.ZodParsedType.date){const b=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(b,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.date,received:b.parsedType}),a.INVALID}if(isNaN(o.data.getTime())){const b=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(b,{code:u.ZodIssueCode.invalid_date}),a.INVALID}const g=new a.ParseStatus;let v;for(const b of this._def.checks)b.kind==="min"?o.data.getTime()<b.value&&(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.too_small,message:b.message,inclusive:!0,exact:!1,minimum:b.value,type:"date"}),g.dirty()):b.kind==="max"?o.data.getTime()>b.value&&(v=this._getOrReturnCtx(o,v),(0,a.addIssueToContext)(v,{code:u.ZodIssueCode.too_big,message:b.message,inclusive:!0,exact:!1,maximum:b.value,type:"date"}),g.dirty()):c.util.assertNever(b);return{status:g.value,value:new Date(o.data.getTime())}}_addCheck(o){return new Qe({...this._def,checks:[...this._def.checks,o]})}min(o,h){return this._addCheck({kind:"min",value:o.getTime(),message:i.errorUtil.toString(h)})}max(o,h){return this._addCheck({kind:"max",value:o.getTime(),message:i.errorUtil.toString(h)})}get minDate(){let o=null;for(const h of this._def.checks)h.kind==="min"&&(o===null||h.value>o)&&(o=h.value);return o!=null?new Date(o):null}get maxDate(){let o=null;for(const h of this._def.checks)h.kind==="max"&&(o===null||h.value<o)&&(o=h.value);return o!=null?new Date(o):null}}E.ZodDate=Qe,Qe.create=y=>new Qe({checks:[],coerce:(y==null?void 0:y.coerce)||!1,typeName:L.ZodDate,...p(y)});class Ur extends _{_parse(o){if(this._getType(o)!==c.ZodParsedType.symbol){const g=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.symbol,received:g.parsedType}),a.INVALID}return(0,a.OK)(o.data)}}E.ZodSymbol=Ur,Ur.create=y=>new Ur({typeName:L.ZodSymbol,...p(y)});class Wt extends _{_parse(o){if(this._getType(o)!==c.ZodParsedType.undefined){const g=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.undefined,received:g.parsedType}),a.INVALID}return(0,a.OK)(o.data)}}E.ZodUndefined=Wt,Wt.create=y=>new Wt({typeName:L.ZodUndefined,...p(y)});class Kt extends _{_parse(o){if(this._getType(o)!==c.ZodParsedType.null){const g=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.null,received:g.parsedType}),a.INVALID}return(0,a.OK)(o.data)}}E.ZodNull=Kt,Kt.create=y=>new Kt({typeName:L.ZodNull,...p(y)});class Et extends _{constructor(){super(...arguments),this._any=!0}_parse(o){return(0,a.OK)(o.data)}}E.ZodAny=Et,Et.create=y=>new Et({typeName:L.ZodAny,...p(y)});class et extends _{constructor(){super(...arguments),this._unknown=!0}_parse(o){return(0,a.OK)(o.data)}}E.ZodUnknown=et,et.create=y=>new et({typeName:L.ZodUnknown,...p(y)});class ke extends _{_parse(o){const h=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.never,received:h.parsedType}),a.INVALID}}E.ZodNever=ke,ke.create=y=>new ke({typeName:L.ZodNever,...p(y)});class Zr extends _{_parse(o){if(this._getType(o)!==c.ZodParsedType.undefined){const g=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.void,received:g.parsedType}),a.INVALID}return(0,a.OK)(o.data)}}E.ZodVoid=Zr,Zr.create=y=>new Zr({typeName:L.ZodVoid,...p(y)});class ye extends _{_parse(o){const{ctx:h,status:g}=this._processInputParams(o),v=this._def;if(h.parsedType!==c.ZodParsedType.array)return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.array,received:h.parsedType}),a.INVALID;if(v.exactLength!==null){const D=h.data.length>v.exactLength.value,j=h.data.length<v.exactLength.value;(D||j)&&((0,a.addIssueToContext)(h,{code:D?u.ZodIssueCode.too_big:u.ZodIssueCode.too_small,minimum:j?v.exactLength.value:void 0,maximum:D?v.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:v.exactLength.message}),g.dirty())}if(v.minLength!==null&&h.data.length<v.minLength.value&&((0,a.addIssueToContext)(h,{code:u.ZodIssueCode.too_small,minimum:v.minLength.value,type:"array",inclusive:!0,exact:!1,message:v.minLength.message}),g.dirty()),v.maxLength!==null&&h.data.length>v.maxLength.value&&((0,a.addIssueToContext)(h,{code:u.ZodIssueCode.too_big,maximum:v.maxLength.value,type:"array",inclusive:!0,exact:!1,message:v.maxLength.message}),g.dirty()),h.common.async)return Promise.all([...h.data].map((D,j)=>v.type._parseAsync(new f(h,D,h.path,j)))).then(D=>a.ParseStatus.mergeArray(g,D));const b=[...h.data].map((D,j)=>v.type._parseSync(new f(h,D,h.path,j)));return a.ParseStatus.mergeArray(g,b)}get element(){return this._def.type}min(o,h){return new ye({...this._def,minLength:{value:o,message:i.errorUtil.toString(h)}})}max(o,h){return new ye({...this._def,maxLength:{value:o,message:i.errorUtil.toString(h)}})}length(o,h){return new ye({...this._def,exactLength:{value:o,message:i.errorUtil.toString(h)}})}nonempty(o){return this.min(1,o)}}E.ZodArray=ye,ye.create=(y,o)=>new ye({type:y,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...p(o)});function St(y){if(y instanceof W){const o={};for(const h in y.shape){const g=y.shape[h];o[h]=Ie.create(St(g))}return new W({...y._def,shape:()=>o})}else return y instanceof ye?new ye({...y._def,type:St(y.element)}):y instanceof Ie?Ie.create(St(y.unwrap())):y instanceof Ye?Ye.create(St(y.unwrap())):y instanceof Te?Te.create(y.items.map(o=>St(o))):y}class W extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const o=this._def.shape(),h=c.util.objectKeys(o);return this._cached={shape:o,keys:h}}_parse(o){if(this._getType(o)!==c.ZodParsedType.object){const O=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(O,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.object,received:O.parsedType}),a.INVALID}const{status:g,ctx:v}=this._processInputParams(o),{shape:b,keys:D}=this._getCached(),j=[];if(!(this._def.catchall instanceof ke&&this._def.unknownKeys==="strip"))for(const O in v.data)D.includes(O)||j.push(O);const U=[];for(const O of D){const $=b[O],ie=v.data[O];U.push({key:{status:"valid",value:O},value:$._parse(new f(v,ie,v.path,O)),alwaysSet:O in v.data})}if(this._def.catchall instanceof ke){const O=this._def.unknownKeys;if(O==="passthrough")for(const $ of j)U.push({key:{status:"valid",value:$},value:{status:"valid",value:v.data[$]}});else if(O==="strict")j.length>0&&((0,a.addIssueToContext)(v,{code:u.ZodIssueCode.unrecognized_keys,keys:j}),g.dirty());else if(O!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const O=this._def.catchall;for(const $ of j){const ie=v.data[$];U.push({key:{status:"valid",value:$},value:O._parse(new f(v,ie,v.path,$)),alwaysSet:$ in v.data})}}return v.common.async?Promise.resolve().then(async()=>{const O=[];for(const $ of U){const ie=await $.key,Mr=await $.value;O.push({key:ie,value:Mr,alwaysSet:$.alwaysSet})}return O}).then(O=>a.ParseStatus.mergeObjectSync(g,O)):a.ParseStatus.mergeObjectSync(g,U)}get shape(){return this._def.shape()}strict(o){return i.errorUtil.errToObj,new W({...this._def,unknownKeys:"strict",...o!==void 0?{errorMap:(h,g)=>{var v,b,D,j;const U=(D=(b=(v=this._def).errorMap)===null||b===void 0?void 0:b.call(v,h,g).message)!==null&&D!==void 0?D:g.defaultError;return h.code==="unrecognized_keys"?{message:(j=i.errorUtil.errToObj(o).message)!==null&&j!==void 0?j:U}:{message:U}}}:{}})}strip(){return new W({...this._def,unknownKeys:"strip"})}passthrough(){return new W({...this._def,unknownKeys:"passthrough"})}extend(o){return new W({...this._def,shape:()=>({...this._def.shape(),...o})})}merge(o){return new W({unknownKeys:o._def.unknownKeys,catchall:o._def.catchall,shape:()=>({...this._def.shape(),...o._def.shape()}),typeName:L.ZodObject})}setKey(o,h){return this.augment({[o]:h})}catchall(o){return new W({...this._def,catchall:o})}pick(o){const h={};return c.util.objectKeys(o).forEach(g=>{o[g]&&this.shape[g]&&(h[g]=this.shape[g])}),new W({...this._def,shape:()=>h})}omit(o){const h={};return c.util.objectKeys(this.shape).forEach(g=>{o[g]||(h[g]=this.shape[g])}),new W({...this._def,shape:()=>h})}deepPartial(){return St(this)}partial(o){const h={};return c.util.objectKeys(this.shape).forEach(g=>{const v=this.shape[g];o&&!o[g]?h[g]=v:h[g]=v.optional()}),new W({...this._def,shape:()=>h})}required(o){const h={};return c.util.objectKeys(this.shape).forEach(g=>{if(o&&!o[g])h[g]=this.shape[g];else{let b=this.shape[g];for(;b instanceof Ie;)b=b._def.innerType;h[g]=b}}),new W({...this._def,shape:()=>h})}keyof(){return ai(c.util.objectKeys(this.shape))}}E.ZodObject=W,W.create=(y,o)=>new W({shape:()=>y,unknownKeys:"strip",catchall:ke.create(),typeName:L.ZodObject,...p(o)}),W.strictCreate=(y,o)=>new W({shape:()=>y,unknownKeys:"strict",catchall:ke.create(),typeName:L.ZodObject,...p(o)}),W.lazycreate=(y,o)=>new W({shape:y,unknownKeys:"strip",catchall:ke.create(),typeName:L.ZodObject,...p(o)});class Xt extends _{_parse(o){const{ctx:h}=this._processInputParams(o),g=this._def.options;function v(b){for(const j of b)if(j.result.status==="valid")return j.result;for(const j of b)if(j.result.status==="dirty")return h.common.issues.push(...j.ctx.common.issues),j.result;const D=b.map(j=>new u.ZodError(j.ctx.common.issues));return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_union,unionErrors:D}),a.INVALID}if(h.common.async)return Promise.all(g.map(async b=>{const D={...h,common:{...h.common,issues:[]},parent:null};return{result:await b._parseAsync({data:h.data,path:h.path,parent:D}),ctx:D}})).then(v);{let b;const D=[];for(const U of g){const O={...h,common:{...h.common,issues:[]},parent:null},$=U._parseSync({data:h.data,path:h.path,parent:O});if($.status==="valid")return $;$.status==="dirty"&&!b&&(b={result:$,ctx:O}),O.common.issues.length&&D.push(O.common.issues)}if(b)return h.common.issues.push(...b.ctx.common.issues),b.result;const j=D.map(U=>new u.ZodError(U));return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_union,unionErrors:j}),a.INVALID}}get options(){return this._def.options}}E.ZodUnion=Xt,Xt.create=(y,o)=>new Xt({options:y,typeName:L.ZodUnion,...p(o)});const Pe=y=>y instanceof er?Pe(y.schema):y instanceof ve?Pe(y.innerType()):y instanceof tr?[y.value]:y instanceof Ge?y.options:y instanceof rr?c.util.objectValues(y.enum):y instanceof nr?Pe(y._def.innerType):y instanceof Wt?[void 0]:y instanceof Kt?[null]:y instanceof Ie?[void 0,...Pe(y.unwrap())]:y instanceof Ye?[null,...Pe(y.unwrap())]:y instanceof On||y instanceof ar?Pe(y.unwrap()):y instanceof sr?Pe(y._def.innerType):[];class $r extends _{_parse(o){const{ctx:h}=this._processInputParams(o);if(h.parsedType!==c.ZodParsedType.object)return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.object,received:h.parsedType}),a.INVALID;const g=this.discriminator,v=h.data[g],b=this.optionsMap.get(v);return b?h.common.async?b._parseAsync({data:h.data,path:h.path,parent:h}):b._parseSync({data:h.data,path:h.path,parent:h}):((0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[g]}),a.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(o,h,g){const v=new Map;for(const b of h){const D=Pe(b.shape[o]);if(!D.length)throw new Error(`A discriminator value for key \`${o}\` could not be extracted from all schema options`);for(const j of D){if(v.has(j))throw new Error(`Discriminator property ${String(o)} has duplicate value ${String(j)}`);v.set(j,b)}}return new $r({typeName:L.ZodDiscriminatedUnion,discriminator:o,options:h,optionsMap:v,...p(g)})}}E.ZodDiscriminatedUnion=$r;function An(y,o){const h=(0,c.getParsedType)(y),g=(0,c.getParsedType)(o);if(y===o)return{valid:!0,data:y};if(h===c.ZodParsedType.object&&g===c.ZodParsedType.object){const v=c.util.objectKeys(o),b=c.util.objectKeys(y).filter(j=>v.indexOf(j)!==-1),D={...y,...o};for(const j of b){const U=An(y[j],o[j]);if(!U.valid)return{valid:!1};D[j]=U.data}return{valid:!0,data:D}}else if(h===c.ZodParsedType.array&&g===c.ZodParsedType.array){if(y.length!==o.length)return{valid:!1};const v=[];for(let b=0;b<y.length;b++){const D=y[b],j=o[b],U=An(D,j);if(!U.valid)return{valid:!1};v.push(U.data)}return{valid:!0,data:v}}else return h===c.ZodParsedType.date&&g===c.ZodParsedType.date&&+y==+o?{valid:!0,data:y}:{valid:!1}}class Jt extends _{_parse(o){const{status:h,ctx:g}=this._processInputParams(o),v=(b,D)=>{if((0,a.isAborted)(b)||(0,a.isAborted)(D))return a.INVALID;const j=An(b.value,D.value);return j.valid?(((0,a.isDirty)(b)||(0,a.isDirty)(D))&&h.dirty(),{status:h.value,value:j.data}):((0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_intersection_types}),a.INVALID)};return g.common.async?Promise.all([this._def.left._parseAsync({data:g.data,path:g.path,parent:g}),this._def.right._parseAsync({data:g.data,path:g.path,parent:g})]).then(([b,D])=>v(b,D)):v(this._def.left._parseSync({data:g.data,path:g.path,parent:g}),this._def.right._parseSync({data:g.data,path:g.path,parent:g}))}}E.ZodIntersection=Jt,Jt.create=(y,o,h)=>new Jt({left:y,right:o,typeName:L.ZodIntersection,...p(h)});class Te extends _{_parse(o){const{status:h,ctx:g}=this._processInputParams(o);if(g.parsedType!==c.ZodParsedType.array)return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.array,received:g.parsedType}),a.INVALID;if(g.data.length<this._def.items.length)return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.INVALID;!this._def.rest&&g.data.length>this._def.items.length&&((0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h.dirty());const b=[...g.data].map((D,j)=>{const U=this._def.items[j]||this._def.rest;return U?U._parse(new f(g,D,g.path,j)):null}).filter(D=>!!D);return g.common.async?Promise.all(b).then(D=>a.ParseStatus.mergeArray(h,D)):a.ParseStatus.mergeArray(h,b)}get items(){return this._def.items}rest(o){return new Te({...this._def,rest:o})}}E.ZodTuple=Te,Te.create=(y,o)=>{if(!Array.isArray(y))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:y,typeName:L.ZodTuple,rest:null,...p(o)})};class Qt extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(o){const{status:h,ctx:g}=this._processInputParams(o);if(g.parsedType!==c.ZodParsedType.object)return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.object,received:g.parsedType}),a.INVALID;const v=[],b=this._def.keyType,D=this._def.valueType;for(const j in g.data)v.push({key:b._parse(new f(g,j,g.path,j)),value:D._parse(new f(g,g.data[j],g.path,j)),alwaysSet:j in g.data});return g.common.async?a.ParseStatus.mergeObjectAsync(h,v):a.ParseStatus.mergeObjectSync(h,v)}get element(){return this._def.valueType}static create(o,h,g){return h instanceof _?new Qt({keyType:o,valueType:h,typeName:L.ZodRecord,...p(g)}):new Qt({keyType:ge.create(),valueType:o,typeName:L.ZodRecord,...p(h)})}}E.ZodRecord=Qt;class Lr extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(o){const{status:h,ctx:g}=this._processInputParams(o);if(g.parsedType!==c.ZodParsedType.map)return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.map,received:g.parsedType}),a.INVALID;const v=this._def.keyType,b=this._def.valueType,D=[...g.data.entries()].map(([j,U],O)=>({key:v._parse(new f(g,j,g.path,[O,"key"])),value:b._parse(new f(g,U,g.path,[O,"value"]))}));if(g.common.async){const j=new Map;return Promise.resolve().then(async()=>{for(const U of D){const O=await U.key,$=await U.value;if(O.status==="aborted"||$.status==="aborted")return a.INVALID;(O.status==="dirty"||$.status==="dirty")&&h.dirty(),j.set(O.value,$.value)}return{status:h.value,value:j}})}else{const j=new Map;for(const U of D){const O=U.key,$=U.value;if(O.status==="aborted"||$.status==="aborted")return a.INVALID;(O.status==="dirty"||$.status==="dirty")&&h.dirty(),j.set(O.value,$.value)}return{status:h.value,value:j}}}}E.ZodMap=Lr,Lr.create=(y,o,h)=>new Lr({valueType:o,keyType:y,typeName:L.ZodMap,...p(h)});class tt extends _{_parse(o){const{status:h,ctx:g}=this._processInputParams(o);if(g.parsedType!==c.ZodParsedType.set)return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.set,received:g.parsedType}),a.INVALID;const v=this._def;v.minSize!==null&&g.data.size<v.minSize.value&&((0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_small,minimum:v.minSize.value,type:"set",inclusive:!0,exact:!1,message:v.minSize.message}),h.dirty()),v.maxSize!==null&&g.data.size>v.maxSize.value&&((0,a.addIssueToContext)(g,{code:u.ZodIssueCode.too_big,maximum:v.maxSize.value,type:"set",inclusive:!0,exact:!1,message:v.maxSize.message}),h.dirty());const b=this._def.valueType;function D(U){const O=new Set;for(const $ of U){if($.status==="aborted")return a.INVALID;$.status==="dirty"&&h.dirty(),O.add($.value)}return{status:h.value,value:O}}const j=[...g.data.values()].map((U,O)=>b._parse(new f(g,U,g.path,O)));return g.common.async?Promise.all(j).then(U=>D(U)):D(j)}min(o,h){return new tt({...this._def,minSize:{value:o,message:i.errorUtil.toString(h)}})}max(o,h){return new tt({...this._def,maxSize:{value:o,message:i.errorUtil.toString(h)}})}size(o,h){return this.min(o,h).max(o,h)}nonempty(o){return this.min(1,o)}}E.ZodSet=tt,tt.create=(y,o)=>new tt({valueType:y,minSize:null,maxSize:null,typeName:L.ZodSet,...p(o)});class wt extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(o){const{ctx:h}=this._processInputParams(o);if(h.parsedType!==c.ZodParsedType.function)return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.function,received:h.parsedType}),a.INVALID;function g(j,U){return(0,a.makeIssue)({data:j,path:h.path,errorMaps:[h.common.contextualErrorMap,h.schemaErrorMap,(0,s.getErrorMap)(),s.defaultErrorMap].filter(O=>!!O),issueData:{code:u.ZodIssueCode.invalid_arguments,argumentsError:U}})}function v(j,U){return(0,a.makeIssue)({data:j,path:h.path,errorMaps:[h.common.contextualErrorMap,h.schemaErrorMap,(0,s.getErrorMap)(),s.defaultErrorMap].filter(O=>!!O),issueData:{code:u.ZodIssueCode.invalid_return_type,returnTypeError:U}})}const b={errorMap:h.common.contextualErrorMap},D=h.data;if(this._def.returns instanceof Tt){const j=this;return(0,a.OK)(async function(...U){const O=new u.ZodError([]),$=await j._def.args.parseAsync(U,b).catch(Un=>{throw O.addIssue(g(U,Un)),O}),ie=await Reflect.apply(D,this,$);return await j._def.returns._def.type.parseAsync(ie,b).catch(Un=>{throw O.addIssue(v(ie,Un)),O})})}else{const j=this;return(0,a.OK)(function(...U){const O=j._def.args.safeParse(U,b);if(!O.success)throw new u.ZodError([g(U,O.error)]);const $=Reflect.apply(D,this,O.data),ie=j._def.returns.safeParse($,b);if(!ie.success)throw new u.ZodError([v($,ie.error)]);return ie.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...o){return new wt({...this._def,args:Te.create(o).rest(et.create())})}returns(o){return new wt({...this._def,returns:o})}implement(o){return this.parse(o)}strictImplement(o){return this.parse(o)}static create(o,h,g){return new wt({args:o||Te.create([]).rest(et.create()),returns:h||et.create(),typeName:L.ZodFunction,...p(g)})}}E.ZodFunction=wt;class er extends _{get schema(){return this._def.getter()}_parse(o){const{ctx:h}=this._processInputParams(o);return this._def.getter()._parse({data:h.data,path:h.path,parent:h})}}E.ZodLazy=er,er.create=(y,o)=>new er({getter:y,typeName:L.ZodLazy,...p(o)});class tr extends _{_parse(o){if(o.data!==this._def.value){const h=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(h,{received:h.data,code:u.ZodIssueCode.invalid_literal,expected:this._def.value}),a.INVALID}return{status:"valid",value:o.data}}get value(){return this._def.value}}E.ZodLiteral=tr,tr.create=(y,o)=>new tr({value:y,typeName:L.ZodLiteral,...p(o)});function ai(y,o){return new Ge({values:y,typeName:L.ZodEnum,...p(o)})}class Ge extends _{constructor(){super(...arguments),r.set(this,void 0)}_parse(o){if(typeof o.data!="string"){const h=this._getOrReturnCtx(o),g=this._def.values;return(0,a.addIssueToContext)(h,{expected:c.util.joinValues(g),received:h.parsedType,code:u.ZodIssueCode.invalid_type}),a.INVALID}if(e(this,r,"f")||t(this,r,new Set(this._def.values),"f"),!e(this,r,"f").has(o.data)){const h=this._getOrReturnCtx(o),g=this._def.values;return(0,a.addIssueToContext)(h,{received:h.data,code:u.ZodIssueCode.invalid_enum_value,options:g}),a.INVALID}return(0,a.OK)(o.data)}get options(){return this._def.values}get enum(){const o={};for(const h of this._def.values)o[h]=h;return o}get Values(){const o={};for(const h of this._def.values)o[h]=h;return o}get Enum(){const o={};for(const h of this._def.values)o[h]=h;return o}extract(o,h=this._def){return Ge.create(o,{...this._def,...h})}exclude(o,h=this._def){return Ge.create(this.options.filter(g=>!o.includes(g)),{...this._def,...h})}}E.ZodEnum=Ge,r=new WeakMap,Ge.create=ai;class rr extends _{constructor(){super(...arguments),n.set(this,void 0)}_parse(o){const h=c.util.getValidEnumValues(this._def.values),g=this._getOrReturnCtx(o);if(g.parsedType!==c.ZodParsedType.string&&g.parsedType!==c.ZodParsedType.number){const v=c.util.objectValues(h);return(0,a.addIssueToContext)(g,{expected:c.util.joinValues(v),received:g.parsedType,code:u.ZodIssueCode.invalid_type}),a.INVALID}if(e(this,n,"f")||t(this,n,new Set(c.util.getValidEnumValues(this._def.values)),"f"),!e(this,n,"f").has(o.data)){const v=c.util.objectValues(h);return(0,a.addIssueToContext)(g,{received:g.data,code:u.ZodIssueCode.invalid_enum_value,options:v}),a.INVALID}return(0,a.OK)(o.data)}get enum(){return this._def.values}}E.ZodNativeEnum=rr,n=new WeakMap,rr.create=(y,o)=>new rr({values:y,typeName:L.ZodNativeEnum,...p(o)});class Tt extends _{unwrap(){return this._def.type}_parse(o){const{ctx:h}=this._processInputParams(o);if(h.parsedType!==c.ZodParsedType.promise&&h.common.async===!1)return(0,a.addIssueToContext)(h,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.promise,received:h.parsedType}),a.INVALID;const g=h.parsedType===c.ZodParsedType.promise?h.data:Promise.resolve(h.data);return(0,a.OK)(g.then(v=>this._def.type.parseAsync(v,{path:h.path,errorMap:h.common.contextualErrorMap})))}}E.ZodPromise=Tt,Tt.create=(y,o)=>new Tt({type:y,typeName:L.ZodPromise,...p(o)});class ve extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(o){const{status:h,ctx:g}=this._processInputParams(o),v=this._def.effect||null,b={addIssue:D=>{(0,a.addIssueToContext)(g,D),D.fatal?h.abort():h.dirty()},get path(){return g.path}};if(b.addIssue=b.addIssue.bind(b),v.type==="preprocess"){const D=v.transform(g.data,b);if(g.common.async)return Promise.resolve(D).then(async j=>{if(h.value==="aborted")return a.INVALID;const U=await this._def.schema._parseAsync({data:j,path:g.path,parent:g});return U.status==="aborted"?a.INVALID:U.status==="dirty"||h.value==="dirty"?(0,a.DIRTY)(U.value):U});{if(h.value==="aborted")return a.INVALID;const j=this._def.schema._parseSync({data:D,path:g.path,parent:g});return j.status==="aborted"?a.INVALID:j.status==="dirty"||h.value==="dirty"?(0,a.DIRTY)(j.value):j}}if(v.type==="refinement"){const D=j=>{const U=v.refinement(j,b);if(g.common.async)return Promise.resolve(U);if(U instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return j};if(g.common.async===!1){const j=this._def.schema._parseSync({data:g.data,path:g.path,parent:g});return j.status==="aborted"?a.INVALID:(j.status==="dirty"&&h.dirty(),D(j.value),{status:h.value,value:j.value})}else return this._def.schema._parseAsync({data:g.data,path:g.path,parent:g}).then(j=>j.status==="aborted"?a.INVALID:(j.status==="dirty"&&h.dirty(),D(j.value).then(()=>({status:h.value,value:j.value}))))}if(v.type==="transform")if(g.common.async===!1){const D=this._def.schema._parseSync({data:g.data,path:g.path,parent:g});if(!(0,a.isValid)(D))return D;const j=v.transform(D.value,b);if(j instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:h.value,value:j}}else return this._def.schema._parseAsync({data:g.data,path:g.path,parent:g}).then(D=>(0,a.isValid)(D)?Promise.resolve(v.transform(D.value,b)).then(j=>({status:h.value,value:j})):D);c.util.assertNever(v)}}E.ZodEffects=ve,E.ZodTransformer=ve,ve.create=(y,o,h)=>new ve({schema:y,typeName:L.ZodEffects,effect:o,...p(h)}),ve.createWithPreprocess=(y,o,h)=>new ve({schema:o,effect:{type:"preprocess",transform:y},typeName:L.ZodEffects,...p(h)});class Ie extends _{_parse(o){return this._getType(o)===c.ZodParsedType.undefined?(0,a.OK)(void 0):this._def.innerType._parse(o)}unwrap(){return this._def.innerType}}E.ZodOptional=Ie,Ie.create=(y,o)=>new Ie({innerType:y,typeName:L.ZodOptional,...p(o)});class Ye extends _{_parse(o){return this._getType(o)===c.ZodParsedType.null?(0,a.OK)(null):this._def.innerType._parse(o)}unwrap(){return this._def.innerType}}E.ZodNullable=Ye,Ye.create=(y,o)=>new Ye({innerType:y,typeName:L.ZodNullable,...p(o)});class nr extends _{_parse(o){const{ctx:h}=this._processInputParams(o);let g=h.data;return h.parsedType===c.ZodParsedType.undefined&&(g=this._def.defaultValue()),this._def.innerType._parse({data:g,path:h.path,parent:h})}removeDefault(){return this._def.innerType}}E.ZodDefault=nr,nr.create=(y,o)=>new nr({innerType:y,typeName:L.ZodDefault,defaultValue:typeof o.default=="function"?o.default:()=>o.default,...p(o)});class sr extends _{_parse(o){const{ctx:h}=this._processInputParams(o),g={...h,common:{...h.common,issues:[]}},v=this._def.innerType._parse({data:g.data,path:g.path,parent:{...g}});return(0,a.isAsync)(v)?v.then(b=>({status:"valid",value:b.status==="valid"?b.value:this._def.catchValue({get error(){return new u.ZodError(g.common.issues)},input:g.data})})):{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new u.ZodError(g.common.issues)},input:g.data})}}removeCatch(){return this._def.innerType}}E.ZodCatch=sr,sr.create=(y,o)=>new sr({innerType:y,typeName:L.ZodCatch,catchValue:typeof o.catch=="function"?o.catch:()=>o.catch,...p(o)});class Br extends _{_parse(o){if(this._getType(o)!==c.ZodParsedType.nan){const g=this._getOrReturnCtx(o);return(0,a.addIssueToContext)(g,{code:u.ZodIssueCode.invalid_type,expected:c.ZodParsedType.nan,received:g.parsedType}),a.INVALID}return{status:"valid",value:o.data}}}E.ZodNaN=Br,Br.create=y=>new Br({typeName:L.ZodNaN,...p(y)}),E.BRAND=Symbol("zod_brand");class On extends _{_parse(o){const{ctx:h}=this._processInputParams(o),g=h.data;return this._def.type._parse({data:g,path:h.path,parent:h})}unwrap(){return this._def.type}}E.ZodBranded=On;class ir extends _{_parse(o){const{status:h,ctx:g}=this._processInputParams(o);if(g.common.async)return(async()=>{const b=await this._def.in._parseAsync({data:g.data,path:g.path,parent:g});return b.status==="aborted"?a.INVALID:b.status==="dirty"?(h.dirty(),(0,a.DIRTY)(b.value)):this._def.out._parseAsync({data:b.value,path:g.path,parent:g})})();{const v=this._def.in._parseSync({data:g.data,path:g.path,parent:g});return v.status==="aborted"?a.INVALID:v.status==="dirty"?(h.dirty(),{status:"dirty",value:v.value}):this._def.out._parseSync({data:v.value,path:g.path,parent:g})}}static create(o,h){return new ir({in:o,out:h,typeName:L.ZodPipeline})}}E.ZodPipeline=ir;class ar extends _{_parse(o){const h=this._def.innerType._parse(o),g=v=>((0,a.isValid)(v)&&(v.value=Object.freeze(v.value)),v);return(0,a.isAsync)(h)?h.then(v=>g(v)):g(h)}unwrap(){return this._def.innerType}}E.ZodReadonly=ar,ar.create=(y,o)=>new ar({innerType:y,typeName:L.ZodReadonly,...p(o)});function oi(y,o){const h=typeof y=="function"?y(o):typeof y=="string"?{message:y}:y;return typeof h=="string"?{message:h}:h}function ci(y,o={},h){return y?Et.create().superRefine((g,v)=>{var b,D;const j=y(g);if(j instanceof Promise)return j.then(U=>{var O,$;if(!U){const ie=oi(o,g),Mr=($=(O=ie.fatal)!==null&&O!==void 0?O:h)!==null&&$!==void 0?$:!0;v.addIssue({code:"custom",...ie,fatal:Mr})}});if(!j){const U=oi(o,g),O=(D=(b=U.fatal)!==null&&b!==void 0?b:h)!==null&&D!==void 0?D:!0;v.addIssue({code:"custom",...U,fatal:O})}}):Et.create()}E.custom=ci,E.late={object:W.lazycreate};var L;(function(y){y.ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly"})(L||(E.ZodFirstPartyTypeKind=L={}));const Cc=(y,o={message:`Input not instance of ${y.name}`})=>ci(h=>h instanceof y,o);E.instanceof=Cc;const ui=ge.create;E.string=ui;const di=Ve.create;E.number=di;const Dc=Br.create;E.nan=Dc;const Nc=qe.create;E.bigint=Nc;const li=Ht.create;E.boolean=li;const kc=Qe.create;E.date=kc;const Pc=Ur.create;E.symbol=Pc;const Ac=Wt.create;E.undefined=Ac;const Oc=Kt.create;E.null=Oc;const Uc=Et.create;E.any=Uc;const Zc=et.create;E.unknown=Zc;const $c=ke.create;E.never=$c;const Lc=Zr.create;E.void=Lc;const Bc=ye.create;E.array=Bc;const Mc=W.create;E.object=Mc;const Vc=W.strictCreate;E.strictObject=Vc;const qc=Xt.create;E.union=qc;const Gc=$r.create;E.discriminatedUnion=Gc;const Yc=Jt.create;E.intersection=Yc;const zc=Te.create;E.tuple=zc;const Fc=Qt.create;E.record=Fc;const Hc=Lr.create;E.map=Hc;const Wc=tt.create;E.set=Wc;const Kc=wt.create;E.function=Kc;const Xc=er.create;E.lazy=Xc;const Jc=tr.create;E.literal=Jc;const Qc=Ge.create;E.enum=Qc;const eu=rr.create;E.nativeEnum=eu;const tu=Tt.create;E.promise=tu;const fi=ve.create;E.effect=fi,E.transformer=fi;const ru=Ie.create;E.optional=ru;const nu=Ye.create;E.nullable=nu;const su=ve.createWithPreprocess;E.preprocess=su;const iu=ir.create;E.pipeline=iu;const au=()=>ui().optional();E.ostring=au;const ou=()=>di().optional();E.onumber=ou;const cu=()=>li().optional();return E.oboolean=cu,E.coerce={string:y=>ge.create({...y,coerce:!0}),number:y=>Ve.create({...y,coerce:!0}),boolean:y=>Ht.create({...y,coerce:!0}),bigint:y=>qe.create({...y,coerce:!0}),date:y=>Qe.create({...y,coerce:!0})},E.NEVER=a.INVALID,E}var Ai;function Oi(){return Ai||(Ai=1,function(e){var t=at&&at.__createBinding||(Object.create?function(n,s,i,a){a===void 0&&(a=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,a,c)}:function(n,s,i,a){a===void 0&&(a=i),n[a]=s[i]}),r=at&&at.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&t(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(js(),e),r(lo(),e),r(Bu(),e),r(En(),e),r(Vu(),e),r(Is(),e)}(at)),at}var Ui;function Rs(){return Ui||(Ui=1,function(e){var t=be&&be.__createBinding||(Object.create?function(a,c,u,f){f===void 0&&(f=u);var d=Object.getOwnPropertyDescriptor(c,u);(!d||("get"in d?!c.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return c[u]}}),Object.defineProperty(a,f,d)}:function(a,c,u,f){f===void 0&&(f=u),a[f]=c[u]}),r=be&&be.__setModuleDefault||(Object.create?function(a,c){Object.defineProperty(a,"default",{enumerable:!0,value:c})}:function(a,c){a.default=c}),n=be&&be.__importStar||function(a){if(a&&a.__esModule)return a;var c={};if(a!=null)for(var u in a)u!=="default"&&Object.prototype.hasOwnProperty.call(a,u)&&t(c,a,u);return r(c,a),c},s=be&&be.__exportStar||function(a,c){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(c,u)&&t(c,a,u)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;const i=n(Oi());e.z=i,s(Oi(),e),e.default=i}(be)),be}var ot={},Zi;function jr(){if(Zi)return ot;Zi=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.InvalidDidError=ot.DidError=void 0;class e extends Error{constructor(n,s,i,a=400,c){super(s,{cause:c}),Object.defineProperty(this,"did",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:a})}get statusCode(){return this.status}toString(){return`${this.constructor.name} ${this.code} (${this.did}): ${this.message}`}static from(n,s){if(n instanceof e)return n;const i=n instanceof Error?n.message:typeof n=="string"?n:"An unknown error occurred",a=(typeof(n==null?void 0:n.statusCode)=="number"?n.statusCode:void 0)??(typeof(n==null?void 0:n.status)=="number"?n.status:void 0);return new e(s,i,"did-unknown-error",a,n)}}ot.DidError=e;class t extends e{constructor(n,s,i){super(n,s,"did-invalid",400,i)}}return ot.InvalidDidError=t,ot}var ct={},$i;function Cs(){var r;if($i)return ct;$i=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.canParse=void 0,ct.isFragment=e,ct.isHexDigit=t;function e(n,s=0,i=n.length){let a;for(let c=s;c<i;c++)if(a=n.charCodeAt(c),!(a>=65&&a<=90||a>=97&&a<=122||a>=48&&a<=57||a===45||a===46||a===95||a===126)){if(!(a===33||a===36||a===38||a===39||a===40||a===41||a===42||a===43||a===44||a===59||a===61)){if(!(a===58||a===64)){if(!(a===47||a===63))if(a===37){if(c+2>=i||!t(n.charCodeAt(c+1))||!t(n.charCodeAt(c+2)))return!1;c+=2}else return!1}}}return!0}function t(n){return n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102}return ct.canParse=((r=URL.canParse)==null?void 0:r.bind(URL))??((n,s)=>{try{return new URL(n,s),!0}catch{return!1}}),ct}var ut={},ze={},Li;function qu(){if(Li)return ze;Li=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.DID_PLC_PREFIX=void 0,ze.isDidPlc=s,ze.asDidPlc=i,ze.assertDidPlc=a;const e=jr(),t="did:plc:";ze.DID_PLC_PREFIX=t;const r=t.length,n=32;function s(u){if(typeof u!="string"||u.length!==n||!u.startsWith(t))return!1;for(let f=r;f<n;f++)if(!c(u.charCodeAt(f)))return!1;return!0}function i(u){return a(u),u}function a(u){if(typeof u!="string")throw new e.InvalidDidError(typeof u,"DID must be a string");if(!u.startsWith(t))throw new e.InvalidDidError(u,"Invalid did:plc prefix");if(u.length!==n)throw new e.InvalidDidError(u,`did:plc must be ${n} characters long`);for(let f=r;f<n;f++)if(!c(u.charCodeAt(f)))throw new e.InvalidDidError(u,`Invalid character at position ${f}`)}const c=u=>u>=97&&u<=122||u>=50&&u<=55;return ze}var zn={},le={},Bi;function Ds(){if(Bi)return le;Bi=1,Object.defineProperty(le,"__esModule",{value:!0}),le.didSchema=le.DID_PREFIX=void 0,le.assertDidMethod=s,le.extractDidMethod=i,le.assertDidMsid=a,le.assertDid=c,le.isDid=u,le.asDid=f;const e=Rs(),t=jr(),r="did:";le.DID_PREFIX=r;const n=r.length;function s(d,p=0,_=d.length){if(!Number.isFinite(_)||!Number.isFinite(p)||_<p||_>d.length)throw new TypeError("Invalid start or end position");if(_===p)throw new t.InvalidDidError(d,"Empty method name");let m;for(let x=p;x<_;x++)if(m=d.charCodeAt(x),(m<97||m>122)&&(m<48||m>57))throw new t.InvalidDidError(d,`Invalid character at position ${x} in DID method name`)}function i(d){const p=d.indexOf(":",n);return d.slice(n,p)}function a(d,p=0,_=d.length){if(!Number.isFinite(_)||!Number.isFinite(p)||_<p||_>d.length)throw new TypeError("Invalid start or end position");if(_===p)throw new t.InvalidDidError(d,"DID method-specific id must not be empty");let m;for(let x=p;x<_;x++)if(m=d.charCodeAt(x),(m<97||m>122)&&(m<65||m>90)&&(m<48||m>57)&&m!==46&&m!==45&&m!==95){if(m===58){if(x===_-1)throw new t.InvalidDidError(d,'DID cannot end with ":"');continue}if(m===37){if(m=d.charCodeAt(++x),(m<48||m>57)&&(m<65||m>70))throw new t.InvalidDidError(d,`Invalid pct-encoded character at position ${x}`);if(m=d.charCodeAt(++x),(m<48||m>57)&&(m<65||m>70))throw new t.InvalidDidError(d,`Invalid pct-encoded character at position ${x}`);if(x>=_)throw new t.InvalidDidError(d,`Incomplete pct-encoded character at position ${x-2}`);continue}throw new t.InvalidDidError(d,`Disallowed character in DID at position ${x}`)}}function c(d){if(typeof d!="string")throw new t.InvalidDidError(typeof d,"DID must be a string");const{length:p}=d;if(p>2048)throw new t.InvalidDidError(d,"DID is too long (2048 chars max)");if(!d.startsWith(r))throw new t.InvalidDidError(d,`DID requires "${r}" prefix`);const _=d.indexOf(":",n);if(_===-1)throw new t.InvalidDidError(d,"Missing colon after method name");s(d,n,_),a(d,_+1,p)}function u(d){try{return c(d),!0}catch(p){if(p instanceof t.DidError)return!1;throw p}}function f(d){return c(d),d}return le.didSchema=e.z.string().superRefine((d,p)=>{try{return c(d),!0}catch(_){return p.addIssue({code:e.z.ZodIssueCode.custom,message:_ instanceof Error?_.message:"Unexpected error"}),!1}}),le}var Mi;function Gu(){return Mi||(Mi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DID_WEB_PREFIX=void 0,e.isDidWeb=s,e.asDidWeb=i,e.assertDidWeb=a,e.didWebToUrl=c,e.urlToDidWeb=u,e.buildDidWebUrl=f;const t=jr(),r=Ds(),n=Cs();e.DID_WEB_PREFIX="did:web:";function s(d){if(typeof d!="string"||!d.startsWith(e.DID_WEB_PREFIX)||d.charAt(e.DID_WEB_PREFIX.length)===":")return!1;try{(0,r.assertDidMsid)(d,e.DID_WEB_PREFIX.length)}catch{return!1}return(0,n.canParse)(f(d))}function i(d){return a(d),d}function a(d){if(typeof d!="string")throw new t.InvalidDidError(typeof d,"DID must be a string");if(!d.startsWith(e.DID_WEB_PREFIX))throw new t.InvalidDidError(d,"Invalid did:web prefix");if(d.charAt(e.DID_WEB_PREFIX.length)===":")throw new t.InvalidDidError(d,"did:web MSID must not start with a colon");if((0,r.assertDidMsid)(d,e.DID_WEB_PREFIX.length),!(0,n.canParse)(f(d)))throw new t.InvalidDidError(d,"Invalid Web DID")}function c(d){try{return new URL(f(d))}catch(p){throw new t.InvalidDidError(d,"Invalid Web DID",p)}}function u(d){const p=d.port?`%3A${d.port}`:"",_=d.pathname==="/"?"":d.pathname.replaceAll("/",":");return`did:web:${d.hostname}${p}${_}`}function f(d){const p=e.DID_WEB_PREFIX.length,_=d.indexOf(":",p),x=(_===-1?d.slice(p):d.slice(p,_)).replaceAll("%3A",":"),w=_===-1?"":d.slice(_).replaceAll(":","/");return`${x.startsWith("localhost")&&(x.length===9||x.charCodeAt(9)===58)?"http":"https"}://${x}${w}`}}(zn)),zn}var Vi;function fo(){return Vi||(Vi=1,function(e){var t=ut&&ut.__createBinding||(Object.create?function(n,s,i,a){a===void 0&&(a=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,a,c)}:function(n,s,i,a){a===void 0&&(a=i),n[a]=s[i]}),r=ut&&ut.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&t(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(qu(),e),r(Gu(),e)}(ut)),ut}var qr={},qi;function ho(){if(qi)return qr;qi=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.matchesIdentifier=e;function e(t,r,n){return n.charCodeAt(0)===35?n.length===r.length+1&&n.endsWith(r):n.length===r.length+1+t.length&&n.charCodeAt(t.length)===35&&n.startsWith(t)&&n.endsWith(r)}return qr}var Gi;function Yu(){return Gi||(Gi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ATPROTO_VERIFICATION_METHOD_TYPES=e.isAtprotoAudience=e.atprotoDidSchema=void 0,e.isAtprotoDid=a,e.asAtprotoDid=c,e.assertAtprotoDid=u,e.assertAtprotoDidWeb=f,e.isAtprotoDidWeb=d,e.extractAtprotoData=w,e.extractPdsUrl=R,e.isAtprotoAka=P,e.isAtprotoPersonalDataServerService=k,e.isAtprotoVerificationMethod=A;const t=Rs(),r=jr(),n=Cs(),s=fo(),i=ho();e.atprotoDidSchema=t.z.string().refine(a,'Atproto only allows "plc" and "web" DID methods');function a(I){return(0,s.isDidPlc)(I)||d(I)}function c(I){return u(I),I}function u(I){if(typeof I!="string")throw new r.InvalidDidError(typeof I,"DID must be a string");if(I.startsWith(s.DID_PLC_PREFIX))(0,s.assertDidPlc)(I);else if(I.startsWith(s.DID_WEB_PREFIX))f(I);else throw new r.InvalidDidError(I,'Atproto only allows "plc" and "web" DID methods')}function f(I){if((0,s.assertDidWeb)(I),p(I))throw new r.InvalidDidError(I,"Atproto does not allow path components in Web DIDs");if(m(I))throw new r.InvalidDidError(I,"Atproto does not allow port numbers in Web DIDs, except for localhost")}function d(I){return!(!(0,s.isDidWeb)(I)||p(I)||m(I))}function p(I){return I.includes(":",s.DID_WEB_PREFIX.length)}function _(I){return I==="did:web:localhost"||I.startsWith("did:web:localhost:")||I.startsWith("did:web:localhost%3A")}function m(I){if(_(I))return!1;const Z=I.indexOf(":",s.DID_WEB_PREFIX.length);return Z===-1?I.includes("%3A",s.DID_WEB_PREFIX.length):I.lastIndexOf("%3A",Z)!==-1}const x=I=>{if(typeof I!="string")return!1;const Z=I.indexOf("#");return Z===-1||I.indexOf("#",Z+1)!==-1?!1:(0,n.isFragment)(I,Z+1)&&a(I.slice(0,Z))};e.isAtprotoAudience=x;function w(I){var Z,B,M,K;return{did:I.id,aka:(B=(Z=I.alsoKnownAs)==null?void 0:Z.find(P))==null?void 0:B.slice(5),key:(M=I.verificationMethod)==null?void 0:M.find(A,I),pds:(K=I.service)==null?void 0:K.find(k,I)}}function R(I){var B;const Z=(B=I.service)==null?void 0:B.find(k,I);if(!Z)throw new r.DidError(I.id,`Document ${I.id} does not contain a (valid) #atproto_pds service URL`,"did-service-not-found");return new URL(Z.serviceEndpoint)}function P(I){return I.startsWith("at://")}function k(I){return(I==null?void 0:I.type)==="AtprotoPersonalDataServer"&&typeof I.serviceEndpoint=="string"&&(0,n.canParse)(I.serviceEndpoint)&&(0,i.matchesIdentifier)(this.id,"atproto_pds",I.id)}e.ATPROTO_VERIFICATION_METHOD_TYPES=Object.freeze(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019","Multikey"]);function A(I){return typeof I=="object"&&typeof(I==null?void 0:I.publicKeyMultibase)=="string"&&e.ATPROTO_VERIFICATION_METHOD_TYPES.includes(I.type)&&(0,i.matchesIdentifier)(this.id,"atproto",I.id)}}(qn)),qn}var Fn={},Yi;function zu(){return Yi||(Yi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.didDocumentValidator=e.didDocumentSchema=void 0;const t=Rs(),r=Ds(),n=Cs(),s=t.z.string().url("RFC3968 compliant URI"),i=t.z.union([r.didSchema,t.z.array(r.didSchema)]),a=t.z.union([s.refine(m=>{const x=m.indexOf("#");return x===-1?!1:(0,n.isFragment)(m,x+1)},{message:"Missing or invalid fragment in RFC3968 URI"}),t.z.string().refine(m=>m.charCodeAt(0)===35,{message:"Fragment must start with #"}).refine(m=>(0,n.isFragment)(m,1),{message:"Invalid char in URI fragment"})]),c=t.z.object({id:a,type:t.z.string().min(1),controller:i,publicKeyJwk:t.z.record(t.z.string(),t.z.unknown()).optional(),publicKeyMultibase:t.z.string().optional()}),u=a,f=t.z.union([t.z.string(),t.z.array(t.z.string())]),d=t.z.union([s,t.z.record(t.z.string(),s),t.z.array(t.z.union([s,t.z.record(t.z.string(),s)])).nonempty()]),p=t.z.object({id:u,type:f,serviceEndpoint:d}),_=t.z.union([a,c]);e.didDocumentSchema=t.z.object({"@context":t.z.union([t.z.literal("https://www.w3.org/ns/did/v1"),t.z.array(t.z.string().url()).nonempty().refine(m=>m[0]==="https://www.w3.org/ns/did/v1",{message:"First @context must be https://www.w3.org/ns/did/v1"})]),id:r.didSchema,controller:i.optional(),alsoKnownAs:t.z.array(s).optional(),service:t.z.array(p).optional(),authentication:t.z.array(_).optional(),verificationMethod:t.z.array(t.z.union([c,a])).optional()}),e.didDocumentValidator=e.didDocumentSchema.superRefine(({id:m,service:x},w)=>{if(x){const R=new Set;for(let P=0;P<x.length;P++){const k=x[P],A=k.id.startsWith("#")?`${m}${k.id}`:k.id;R.has(A)?w.addIssue({code:t.z.ZodIssueCode.custom,message:`Duplicate service id (${k.id}) found in the document`,path:["service",P,"id"]}):R.add(A)}}})}(Fn)),Fn}var zi;function po(){return zi||(zi=1,function(e){var t=it&&it.__createBinding||(Object.create?function(n,s,i,a){a===void 0&&(a=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,a,c)}:function(n,s,i,a){a===void 0&&(a=i),n[a]=s[i]}),r=it&&it.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&t(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(Yu(),e),r(zu(),e),r(jr(),e),r(Ds(),e),r(fo(),e),r(ho(),e)}(it)),it}var fr={},dt={},Hn={},Fi;function Ns(){return Fi||(Fi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DisallowedDomainError=e.UnsupportedDomainError=e.ReservedHandleError=e.InvalidHandleError=e.DISALLOWED_TLDS=e.INVALID_HANDLE=void 0,e.ensureValidHandle=t,e.ensureValidHandleRegex=n,e.normalizeHandle=s,e.normalizeAndEnsureValidHandle=i,e.isValidHandle=a,e.isValidTld=c,e.INVALID_HANDLE="handle.invalid",e.DISALLOWED_TLDS=[".local",".arpa",".invalid",".localhost",".internal",".example",".alt",".onion"];function t(_){if(!/^[a-zA-Z0-9.-]*$/.test(_))throw new u("Disallowed characters in handle (ASCII letters, digits, dashes, periods only)");if(_.length>253)throw new u("Handle is too long (253 chars max)");const m=_.split(".");if(m.length<2)throw new u("Handle domain needs at least two parts");for(let x=0;x<m.length;x++){const w=m[x];if(w.length<1)throw new u("Handle parts can not be empty");if(w.length>63)throw new u("Handle part too long (max 63 chars)");if(w.endsWith("-")||w.startsWith("-"))throw new u("Handle parts can not start or end with hyphens");if(x+1===m.length&&!/^[a-zA-Z]/.test(w))throw new u("Handle final component (TLD) must start with ASCII letter")}}const r=/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;function n(_){if(_.length>253)throw new u("Handle is too long (253 chars max)");if(!r.test(_))throw new u("Handle didn't validate via regex")}function s(_){return _.toLowerCase()}function i(_){const m=s(_);return t(m),m}function a(_){return _.length<=253&&r.test(_)}function c(_){for(const m of e.DISALLOWED_TLDS)if(_.endsWith(m))return!1;return!0}class u extends Error{}e.InvalidHandleError=u;class f extends Error{}e.ReservedHandleError=f;class d extends Error{}e.UnsupportedDomainError=d;class p extends Error{}e.DisallowedDomainError=p}(Hn)),Hn}var lt={},Hi;function ks(){if(Hi)return lt;Hi=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.InvalidDidError=void 0,lt.ensureValidDid=e,lt.ensureValidDidRegex=t;function e(n){if(!n.startsWith("did:"))throw new r('DID requires "did:" prefix');if(!/^[a-zA-Z0-9._:%-]*$/.test(n))throw new r("Disallowed characters in DID (ASCII letters, digits, and a couple other characters only)");const{length:s,1:i}=n.split(":");if(s<3)throw new r("DID requires prefix, method, and method-specific content");if(!/^[a-z]+$/.test(i))throw new r("DID method must be lower-case letters");if(n.endsWith(":")||n.endsWith("%"))throw new r('DID can not end with ":" or "%"');if(n.length>2*1024)throw new r("DID is too long (2048 chars max)")}function t(n){if(!/^did:[a-z]+:[a-zA-Z0-9._:%-]*[a-zA-Z0-9._-]$/.test(n))throw new r("DID didn't validate via regex");if(n.length>2*1024)throw new r("DID is too long (2048 chars max)")}class r extends Error{}return lt.InvalidDidError=r,lt}var fe={},Wi;function Ps(){if(Wi)return fe;Wi=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.InvalidNsidError=fe.NSID=void 0,fe.ensureValidNsid=t,fe.parseNsid=r,fe.isValidNsid=n,fe.validateNsid=s,fe.ensureValidNsidRegex=d,fe.validateNsidRegex=p;class e{static parse(x){return new e(x)}static create(x,w){const R=[...x.split(".").reverse(),w].join(".");return new e(R)}static isValid(x){return n(x)}static from(x){return x instanceof e?x:Array.isArray(x)?new e(x.join(".")):new e(String(x))}constructor(x){Object.defineProperty(this,"segments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.segments=r(x)}get authority(){return this.segments.slice(0,this.segments.length-1).reverse().join(".")}get name(){return this.segments.at(this.segments.length-1)}toString(){return this.segments.join(".")}}fe.NSID=e;function t(m){const x=s(m);if(!x.success)throw new _(x.message)}function r(m){const x=s(m);if(!x.success)throw new _(x.message);return x.value}function n(m){return p(m).success}function s(m){if(m.length>317)return{success:!1,message:"NSID is too long (317 chars max)"};if(i(m))return{success:!1,message:"Disallowed characters in NSID (ASCII letters, digits, dashes, periods only)"};const x=m.split(".");if(x.length<3)return{success:!1,message:"NSID needs at least three parts"};for(const w of x){if(w.length<1)return{success:!1,message:"NSID parts can not be empty"};if(w.length>63)return{success:!1,message:"NSID part too long (max 63 chars)"};if(c(w)||u(w))return{success:!1,message:"NSID parts can not start or end with hyphen"}}return a(x[0])?{success:!1,message:"NSID first part may not start with a digit"}:f(x[x.length-1])?{success:!0,value:x}:{success:!1,message:"NSID name part must be only letters and digits (and no leading digit)"}}function i(m){return!/^[a-zA-Z0-9.-]*$/.test(m)}function a(m){const x=m.charCodeAt(0);return x>=48&&x<=57}function c(m){return m.charCodeAt(0)===45}function u(m){return m.charCodeAt(m.length-1)===45}function f(m){return!a(m)&&!m.includes("-")}function d(m){const x=p(m);if(!x.success)throw new _(x.message)}function p(m){return m.length>317?{success:!1,message:"NSID is too long (317 chars max)"}:/^[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?:\.[a-zA-Z](?:[a-zA-Z0-9]{0,62})?)$/.test(m)?{success:!0,value:m}:{success:!1,message:"NSID didn't validate via regex"}}class _ extends Error{}return fe.InvalidNsidError=_,fe}var ft={},Gr={},Ki;function As(){if(Ki)return Gr;Ki=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.ensureValidAtIdentifier=r;const e=ks(),t=Ns();function r(n){try{n.startsWith("did:")?(0,e.ensureValidDidRegex)(n):(0,t.ensureValidHandleRegex)(n)}catch(s){throw new t.InvalidHandleError("Invalid DID or handle",{cause:s})}}return Gr}var hr={},Xi;function Fu(){if(Xi)return hr;Xi=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.ensureValidAtUri=s,hr.ensureValidAtUriRegex=i;const e=As(),t=ks(),r=Ns(),n=Ps();function s(a){const c=a.indexOf("#");if(c!==-1){if(a.charCodeAt(c+1)!==47)throw new Error("ATURI fragment must be non-empty and start with slash");if(a.includes("#",c+1))throw new Error('ATURI can have at most one "#", separating fragment out');const w=a.slice(c+1);if(!/^\/[a-zA-Z0-9._~:@!$&')(*+,;=%[\]/-]*$/.test(w))throw new Error("Disallowed characters in ATURI fragment (ASCII)")}const u=c===-1?a:a.slice(0,c);if(u.length>8*1024)throw new Error("ATURI is far too long");if(!u.startsWith("at://"))throw new Error('ATURI must start with "at://"');if(!/^[a-zA-Z0-9._~:@!$&')(*+,;=%/-]*$/.test(u))throw new Error("Disallowed characters in ATURI (ASCII)");const f=u.indexOf("/",5),d=f===-1?u.slice(5):u.slice(5,f);try{(0,e.ensureValidAtIdentifier)(d)}catch(w){throw new Error("ATURI authority must be a valid handle or DID",{cause:w})}const p=f===-1?-1:f+1,_=p===-1?-1:u.indexOf("/",p);if(p!==-1){const w=_===-1?u.slice(p):u.slice(p,_);if(w.length===0)throw new Error("ATURI can not have a slash after authority without a path segment");if(!(0,n.isValidNsid)(w))throw new Error("ATURI requires first path segment (if supplied) to be valid NSID")}const m=_===-1?-1:_+1,x=m===-1?-1:u.indexOf("/",m);if(m!==-1&&m===u.length)throw new Error("ATURI can not have a slash after collection, unless record key is provided");if(x!==-1)throw new Error("ATURI path can have at most two parts, and no trailing slash")}function i(a){const c=/^at:\/\/(?<authority>[a-zA-Z0-9._:%-]+)(\/(?<collection>[a-zA-Z0-9-.]+)(\/(?<rkey>[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?<fragment>\/[a-zA-Z0-9._~:@!$&%')(*+,;=\-[\]/\\]*))?$/,u=a.match(c);if(!u||!u.groups)throw new Error("ATURI didn't validate via regex");const f=u.groups;try{(0,r.ensureValidHandleRegex)(f.authority)}catch{try{(0,t.ensureValidDidRegex)(f.authority)}catch{throw new Error("ATURI authority must be a valid handle or DID")}}if(f.collection&&!(0,n.isValidNsid)(f.collection))throw new Error("ATURI collection path segment must be a valid NSID");if(a.length>8*1024)throw new Error("ATURI is far too long")}return hr}var Ji;function Hu(){return Ji||(Ji=1,function(e){var t=ft&&ft.__createBinding||(Object.create?function(f,d,p,_){_===void 0&&(_=p);var m=Object.getOwnPropertyDescriptor(d,p);(!m||("get"in m?!d.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return d[p]}}),Object.defineProperty(f,_,m)}:function(f,d,p,_){_===void 0&&(_=p),f[_]=d[p]}),r=ft&&ft.__exportStar||function(f,d){for(var p in f)p!=="default"&&!Object.prototype.hasOwnProperty.call(d,p)&&t(d,f,p)};Object.defineProperty(e,"__esModule",{value:!0}),e.AtUri=e.ATP_URI_REGEX=void 0;const n=As(),s=Ps();r(Fu(),e),e.ATP_URI_REGEX=/^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;const i=/^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;class a{constructor(d,p){Object.defineProperty(this,"hash",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathname",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"searchParams",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const _=p!==void 0?Object.assign(typeof p=="string"?c(p):{host:p.host},u(d)):c(d);(0,n.ensureValidAtIdentifier)(_.host),this.hash=_.hash??"",this.host=_.host,this.pathname=_.pathname??"",this.searchParams=_.searchParams}static make(d,p,_){let m=d;return p&&(m+="/"+p),_&&(m+="/"+_),new a(m)}get protocol(){return"at:"}get origin(){return`at://${this.host}`}get hostname(){return this.host}set hostname(d){(0,n.ensureValidAtIdentifier)(d),this.host=d}get search(){return this.searchParams.toString()}set search(d){this.searchParams=new URLSearchParams(d)}get collection(){return this.pathname.split("/").filter(Boolean)[0]||""}set collection(d){(0,s.ensureValidNsid)(d);const p=this.pathname.split("/").filter(Boolean);p[0]=d,this.pathname=p.join("/")}get rkey(){return this.pathname.split("/").filter(Boolean)[1]||""}set rkey(d){const p=this.pathname.split("/").filter(Boolean);p[0]||(p[0]="undefined"),p[1]=d,this.pathname=p.join("/")}get href(){return this.toString()}toString(){let d=this.pathname||"/";d.startsWith("/")||(d=`/${d}`);let p="";this.searchParams.size&&(p=`?${this.searchParams.toString()}`);let _=this.hash;return _&&!_.startsWith("#")&&(_=`#${_}`),`at://${this.host}${d}${p}${_}`}}e.AtUri=a;function c(f){const d=f.match(e.ATP_URI_REGEX);if(!d)throw new Error(`Invalid AT uri: ${f}`);return{host:d[2],hash:d[5],pathname:d[3],searchParams:new URLSearchParams(d[4])}}function u(f){const d=f.match(i);if(!d)throw new Error(`Invalid path: ${f}`);return{hash:d[3],pathname:d[1],searchParams:new URLSearchParams(d[2])}}}(ft)),ft}var ht={},Qi;function Wu(){if(Qi)return ht;Qi=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.InvalidTidError=void 0,ht.ensureValidTid=r,ht.isValidTid=n;const e=13,t=/^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/;function r(i){if(i.length!==e)throw new s(`TID must be ${e} characters`);if(!t.test(i))throw new s("TID syntax not valid (regex)")}function n(i){return i.length===e&&t.test(i)}class s extends Error{}return ht.InvalidTidError=s,ht}var pt={},ea;function Ku(){if(ea)return pt;ea=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.InvalidRecordKeyError=void 0,pt.ensureValidRecordKey=s,pt.isValidRecordKey=i;const e=512,t=1,r=new Set([".",".."]),n=/^[a-zA-Z0-9_~.:-]{1,512}$/;function s(c){if(c.length>e||c.length<t)throw new a(`record key must be ${t} to ${e} characters`);if(r.has(c))throw new a('record key can not be "." or ".."');if(!n.test(c))throw new a("record key syntax not valid (regex)")}function i(c){return c.length>=t&&c.length<=e&&n.test(c)&&!r.has(c)}class a extends Error{}return pt.InvalidRecordKeyError=a,pt}var je={},ta;function Xu(){if(ta)return je;ta=1,Object.defineProperty(je,"__esModule",{value:!0}),je.InvalidDatetimeError=je.normalizeDatetimeAlways=void 0,je.ensureValidDatetime=e,je.isValidDatetime=t,je.normalizeDatetime=r;function e(i){const a=new Date(i);if(isNaN(a.getTime()))throw new s("datetime did not parse as ISO 8601");if(a.toISOString().startsWith("-"))throw new s("datetime normalized to a negative time");if(!/^[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](.[0-9]{1,20})?(Z|([+-][0-2][0-9]:[0-5][0-9]))$/.test(i))throw new s("datetime didn't validate via regex");if(i.length>64)throw new s("datetime is too long (64 chars max)");if(i.endsWith("-00:00"))throw new s('datetime can not use "-00:00" for UTC timezone');if(i.startsWith("000"))throw new s("datetime so close to year zero not allowed")}function t(i){try{e(i)}catch(a){if(a instanceof s)return!1;throw a}return!0}function r(i){if(t(i)){const u=new Date(i).toISOString();if(t(u))return u}if(!/.*(([+-]\d\d:?\d\d)|[a-zA-Z])$/.test(i)){const u=new Date(i+"Z");if(!isNaN(u.getTime())){const f=u.toISOString();if(t(f))return f}}const a=new Date(i);if(isNaN(a.getTime()))throw new s("datetime did not parse as any timestamp format");const c=a.toISOString();if(t(c))return c;throw new s("datetime normalized to invalid timestamp string")}const n=i=>{try{return r(i)}catch(a){if(a instanceof s)return new Date(0).toISOString();throw a}};je.normalizeDatetimeAlways=n;class s extends Error{}return je.InvalidDatetimeError=s,je}var ra;function Ju(){return ra||(ra=1,function(e){var t=dt&&dt.__createBinding||(Object.create?function(n,s,i,a){a===void 0&&(a=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,a,c)}:function(n,s,i,a){a===void 0&&(a=i),n[a]=s[i]}),r=dt&&dt.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&t(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ns(),e),r(ks(),e),r(Ps(),e),r(Hu(),e),r(As(),e),r(Wu(),e),r(Ku(),e),r(Xu(),e)}(dt)),dt}var na;function Os(){if(na)return fr;na=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.isNsid=void 0;const e=Ju(),t=r=>typeof r=="string"&&(0,e.isValidNsid)(r);return fr.isNsid=t,fr}var pr={},sa;function Qu(){if(sa)return pr;sa=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.LexPermissionSyntax=void 0;const e=Array.isArray;class t{constructor(n){Object.defineProperty(this,"lexPermission",{enumerable:!0,configurable:!0,writable:!0,value:n})}get prefix(){return this.lexPermission.resource}get positional(){}get(n){if(n!=="type"&&n!=="resource"&&Object.hasOwn(this.lexPermission,n))return this.lexPermission[n]}*keys(){for(const n of Object.keys(this.lexPermission))this.get(n)!==void 0&&(yield n)}getSingle(n){const s=this.get(n);return e(s)?null:s}getMulti(n){const s=this.get(n);if(s!==void 0)return e(s)?s:null}toJSON(){return this.lexPermission}}return pr.LexPermissionSyntax=t,pr}var Wn={},ia;function Rr(){return ia||(ia=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RepoPermission=e.isCollectionParam=e.isRepoAction=e.REPO_ACTIONS=e.isNsid=void 0;const t=Os();Object.defineProperty(e,"isNsid",{enumerable:!0,get:function(){return t.isNsid}});const r=Mt(),n=xt(),s=bt(),i=Ir();e.REPO_ACTIONS=Object.freeze(["create","update","delete"]),e.isRepoAction=(0,i.knownValuesValidator)(e.REPO_ACTIONS);const a=f=>f==="*"||(0,t.isNsid)(f);e.isCollectionParam=a;class c{constructor(d,p){Object.defineProperty(this,"collection",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"action",{enumerable:!0,configurable:!0,writable:!0,value:p})}matches({action:d,collection:p}){return this.action.includes(d)&&(this.collection.includes("*")||this.collection.includes(p))}toString(){return c.parser.format(this)}static fromString(d){if(!(0,s.isScopeStringFor)(d,"repo"))return null;const p=n.ScopeStringSyntax.fromString(d);return c.fromSyntax(p)}static fromSyntax(d){const p=c.parser.parse(d);return p?new c(p.collection,p.action):null}static scopeNeededFor(d){return c.parser.format({collection:[d.collection],action:[d.action]})}}e.RepoPermission=c,Object.defineProperty(c,"parser",{enumerable:!0,configurable:!0,writable:!0,value:new r.Parser("repo",{collection:{multiple:!0,required:!0,validate:e.isCollectionParam,normalize:f=>f.length>1?f.includes("*")?["*"]:[...new Set(f)].sort():f},action:{multiple:!0,required:!1,validate:e.isRepoAction,default:e.REPO_ACTIONS,normalize:f=>f===e.REPO_ACTIONS?e.REPO_ACTIONS:e.REPO_ACTIONS.filter(u,f)}},"collection")});function u(f){return this.includes(f)}}(Wn)),Wn}var Kn={},aa;function Cr(){return aa||(aa=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.RpcPermission=e.isAudParam=e.isLxmParam=e.isNsid=e.isAtprotoAudience=void 0;const t=po();Object.defineProperty(e,"isAtprotoAudience",{enumerable:!0,get:function(){return t.isAtprotoAudience}});const r=Os();Object.defineProperty(e,"isNsid",{enumerable:!0,get:function(){return r.isNsid}});const n=Mt(),s=xt(),i=bt(),a=f=>f==="*"||(0,r.isNsid)(f);e.isLxmParam=a;const c=f=>f==="*"||(0,t.isAtprotoAudience)(f);e.isAudParam=c;class u{constructor(d,p){Object.defineProperty(this,"aud",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"lxm",{enumerable:!0,configurable:!0,writable:!0,value:p})}matches(d){const{aud:p,lxm:_}=this;return(p==="*"||p===d.aud)&&(_.includes("*")||_.includes(d.lxm))}toString(){return u.parser.format(this)}static fromString(d){if(!(0,i.isScopeStringFor)(d,"rpc"))return null;const p=s.ScopeStringSyntax.fromString(d);return u.fromSyntax(p)}static fromSyntax(d){const p=u.parser.parse(d);return!p||p.aud==="*"&&p.lxm.includes("*")?null:new u(p.aud,p.lxm)}static scopeNeededFor(d){return u.parser.format({aud:d.aud,lxm:[d.lxm]})}}e.RpcPermission=u,Object.defineProperty(u,"parser",{enumerable:!0,configurable:!0,writable:!0,value:new n.Parser("rpc",{lxm:{multiple:!0,required:!0,validate:e.isLxmParam,normalize:f=>f.length>1&&f.includes("*")?["*"]:[...new Set(f)].sort()},aud:{multiple:!1,required:!0,validate:e.isAudParam}},"lxm")})}(Kn)),Kn}var oa;function mo(){return oa||(oa=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.IncludeScope=e.isNsid=void 0;const t=po(),r=Os();Object.defineProperty(e,"isNsid",{enumerable:!0,get:function(){return r.isNsid}});const n=Mt(),s=Qu(),i=xt(),a=bt(),c=Rr(),u=Cr();class f{constructor(m,x=void 0){Object.defineProperty(this,"nsid",{enumerable:!0,configurable:!0,writable:!0,value:m}),Object.defineProperty(this,"aud",{enumerable:!0,configurable:!0,writable:!0,value:x})}toString(){return f.parser.format(this)}toPermissions(m){return Array.from(this.buildPermissions(m))}toScopes(m){return Array.from(this.buildPermissions(m),x=>x.toString())}*buildPermissions(m){for(const x of m.permissions){const w=this.parseLexPermission(x);if(!w)continue;const R=d(w);R&&this.isAllowedPermission(R)&&(yield R)}}parseLexPermission(m){if(p(m,"repo"))return new s.LexPermissionSyntax(m);if(p(m,"rpc")){if(m.aud!==void 0&&m.aud!=="*")return null;if(m.inheritAud===!0&&m.aud===void 0&&this.aud!==void 0){const{inheritAud:x,...w}=m;return new s.LexPermissionSyntax({aud:this.aud,...w})}return new s.LexPermissionSyntax(m)}return null}isAllowedPermission(m){if(m instanceof u.RpcPermission)return m.lxm.every(this.isParentAuthorityOf,this);if(m instanceof c.RepoPermission)return m.collection.every(this.isParentAuthorityOf,this);throw new TypeError(`Unexpected permission ${m}`)}isParentAuthorityOf(m){if(m==="*")return!1;const x=this.nsid,w=x.lastIndexOf(".");if(w===-1)throw new TypeError('Dot character (".") missing from lexicon NSID');if(w>=m.length-1)return!1;for(let R=w;R>=0;R--)if(x.charCodeAt(R)!==m.charCodeAt(R))return!1;return!0}static fromString(m){if(!(0,a.isScopeStringFor)(m,"include"))return null;const x=i.ScopeStringSyntax.fromString(m);return f.fromSyntax(x)}static fromSyntax(m){const x=f.parser.parse(m);return x?new f(x.nsid,x.aud):null}}e.IncludeScope=f,Object.defineProperty(f,"parser",{enumerable:!0,configurable:!0,writable:!0,value:new n.Parser("include",{nsid:{multiple:!1,required:!0,validate:r.isNsid},aud:{multiple:!1,required:!1,validate:t.isAtprotoAudience}},"nsid")});function d(_){return(0,a.isScopeSyntaxFor)(_,"repo")?c.RepoPermission.fromSyntax(_):(0,a.isScopeSyntaxFor)(_,"rpc")?u.RpcPermission.fromSyntax(_):null}function p(_,m){return _.resource===m}}(Vn)),Vn}var ca;function ed(){return ca||(ca=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.STATIC_SCOPE_VALUES=e.isScopeStringFor=void 0,e.isStaticScopeValue=f,e.isAtprotoOauthScope=d,e.normalizeAtprotoOauthScope=p,e.normalizeAtprotoOauthScopeValue=_;const t=bt();Object.defineProperty(e,"isScopeStringFor",{enumerable:!0,get:function(){return t.isScopeStringFor}});const r=Ir(),n=vn(),s=bn(),i=xn(),a=mo(),c=Rr(),u=Cr();e.STATIC_SCOPE_VALUES=Object.freeze(["atproto","transition:email","transition:generic","transition:chat.bsky"]);function f(m){return e.STATIC_SCOPE_VALUES.includes(m)}function d(m){return f(m)||n.AccountPermission.fromString(m)!=null||s.BlobPermission.fromString(m)!=null||i.IdentityPermission.fromString(m)!=null||a.IncludeScope.fromString(m)!=null||c.RepoPermission.fromString(m)!=null||u.RpcPermission.fromString(m)!=null}function p(m){return m.split(" ").map(_).filter(r.isNonNullable).sort().join(" ")}function _(m){if(f(m))return m;for(const x of[n.AccountPermission,s.BlobPermission,i.IdentityPermission,a.IncludeScope,c.RepoPermission,u.RpcPermission]){const w=x.fromString(m);if(w)return w.toString()}return null}}($n)),$n}var mr={},ua;function Us(){if(ua)return mr;ua=1,Object.defineProperty(mr,"__esModule",{value:!0}),mr.ScopeMissingError=void 0;class e extends Error{get statusCode(){return this.status}constructor(r){super(`Missing required scope "${r}"`),Object.defineProperty(this,"scope",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ScopeMissingError"}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:403}),Object.defineProperty(this,"expose",{enumerable:!0,configurable:!0,writable:!0,value:!0})}}return mr.ScopeMissingError=e,mr}var _r={},gr={},Xn={},da;function _o(){return da||(da=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ScopesSet=e.ScopeMissingError=void 0;const t=Us();Object.defineProperty(e,"ScopeMissingError",{enumerable:!0,get:function(){return t.ScopeMissingError}});const r=vn(),n=bn(),s=xn(),i=Rr(),a=Cr();class c extends Set{matches(_,m){for(const x of this)if(f(x,_,m))return!0;return!1}assert(_,m){if(!this.matches(_,m)){const x=u(_,m);throw new t.ScopeMissingError(x)}}some(_){for(const m of this)if(_(m))return!0;return!1}every(_){for(const m of this)if(!_(m))return!1;return!0}*filter(_){for(const m of this)_(m)&&(yield m)}*map(_){for(const m of this)yield _(m)}static fromString(_){return new c(_==null?void 0:_.split(" "))}}e.ScopesSet=c;function u(p,_){switch(p){case"account":return r.AccountPermission.scopeNeededFor(_);case"identity":return s.IdentityPermission.scopeNeededFor(_);case"repo":return i.RepoPermission.scopeNeededFor(_);case"rpc":return a.RpcPermission.scopeNeededFor(_);case"blob":return n.BlobPermission.scopeNeededFor(_)}throw new TypeError(`Unknown resource: ${p}`)}function f(p,_,m){const x=d(_,p);return x?x.matches(m):!1}function d(p,_){switch(p){case"account":return r.AccountPermission.fromString(_);case"identity":return s.IdentityPermission.fromString(_);case"repo":return i.RepoPermission.fromString(_);case"rpc":return a.RpcPermission.fromString(_);case"blob":return n.BlobPermission.fromString(_);default:return null}}}(Xn)),Xn}var la;function go(){if(la)return gr;la=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.ScopePermissions=void 0;const e=Us(),t=vn(),r=bn(),n=xn(),s=Rr(),i=Cr(),a=_o();class c{constructor(f){Object.defineProperty(this,"scopes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.scopes=new a.ScopesSet(f?typeof f=="string"?f.split(" "):f:void 0)}allowsAccount(f){return this.scopes.matches("account",f)}assertAccount(f){if(!this.allowsAccount(f)){const d=t.AccountPermission.scopeNeededFor(f);throw new e.ScopeMissingError(d)}}allowsIdentity(f){return this.scopes.matches("identity",f)}assertIdentity(f){if(!this.allowsIdentity(f)){const d=n.IdentityPermission.scopeNeededFor(f);throw new e.ScopeMissingError(d)}}allowsBlob(f){return this.scopes.matches("blob",f)}assertBlob(f){if(!this.allowsBlob(f)){const d=r.BlobPermission.scopeNeededFor(f);throw new e.ScopeMissingError(d)}}allowsRepo(f){return this.scopes.matches("repo",f)}assertRepo(f){if(!this.allowsRepo(f)){const d=s.RepoPermission.scopeNeededFor(f);throw new e.ScopeMissingError(d)}}allowsRpc(f){return this.scopes.matches("rpc",f)}assertRpc(f){if(!this.allowsRpc(f)){const d=i.RpcPermission.scopeNeededFor(f);throw new e.ScopeMissingError(d)}}}return gr.ScopePermissions=c,gr}var fa;function td(){if(fa)return _r;fa=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.ScopePermissionsTransition=void 0;const e=go();class t extends e.ScopePermissions{get hasTransitionGeneric(){return this.scopes.has("transition:generic")}get hasTransitionEmail(){return this.scopes.has("transition:email")}get hasTransitionChatBsky(){return this.scopes.has("transition:chat.bsky")}allowsAccount(n){return n.attr==="email"&&n.action==="read"&&this.hasTransitionEmail?!0:super.allowsAccount(n)}allowsBlob(n){return this.hasTransitionGeneric?!0:super.allowsBlob(n)}allowsRepo(n){return this.hasTransitionGeneric?!0:super.allowsRepo(n)}allowsRpc(n){const{lxm:s}=n;return this.hasTransitionGeneric&&s==="*"||this.hasTransitionGeneric&&!s.startsWith("chat.bsky.")||this.hasTransitionChatBsky&&s.startsWith("chat.bsky.")?!0:super.allowsRpc(n)}}return _r.ScopePermissionsTransition=t,_r}var ha;function rd(){return ha||(ha=1,function(e){var t=nt&&nt.__createBinding||(Object.create?function(n,s,i,a){a===void 0&&(a=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,a,c)}:function(n,s,i,a){a===void 0&&(a=i),n[a]=s[i]}),r=nt&&nt.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&t(s,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(ed(),e),r(Us(),e),r(td(),e),r(go(),e),r(_o(),e),r(vn(),e),r(bn(),e),r(xn(),e),r(mo(),e),r(Rr(),e),r(Cr(),e)}(nt)),nt}var oe=rd();const Zs=S.forwardRef(({className:e,invalid:t,disabled:r,...n},s)=>l.jsx("input",{...n,type:"checkbox",ref:s,disabled:r,className:re(["block size-4 rounded-md border-2","accent-primary","transition duration-300 ease-in-out","outline-none","focus:ring-primary focus:ring-2 focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-offset-black",t&&"accent-error focus:border-error",r&&"bg-contrast-50 text-contrast-500 cursor-not-allowed",e])}));Zs.displayName="Checkbox";function nd({scope:e,permissionSets:t,clientTrusted:r=!1,clientFirstParty:n=!1,allowEmail:s,onAllowEmail:i,className:a="",...c}){const u=S.useMemo(()=>Array.from(new Set(e==null?void 0:e.split(" ").map(d=>oe.IncludeScope.fromString(d)).filter(d=>d!=null))),[e]),f=S.useMemo(()=>new oe.ScopePermissionsTransition(e),[e]);return f.scopes.size===0||f.scopes.size===1&&f.scopes.has("atproto")?null:l.jsxs("div",{className:`flex flex-col gap-2 ${a}`,...c,role:"list",children:[l.jsx(od,{permissions:f,allowEmail:s,onAllowEmail:i}),l.jsx(fd,{permissions:f}),l.jsx(cd,{permissions:f}),l.jsx(dd,{permissions:f}),l.jsx(ld,{permissions:f}),l.jsx(sd,{includeScopes:u,permissionSets:t}),l.jsx(ud,{permissions:f}),(!n||!r)&&l.jsx(ad,{className:"mt-2",permissions:f})]})}function sd({includeScopes:e,permissionSets:t}){return e.length?l.jsx(l.Fragment,{children:e.map((r,n)=>l.jsx(id,{includeScope:r,permissionSet:t[r.nsid]},n))}):null}function id({includeScope:e,permissionSet:t}){const{nsid:r}=e,n=S.useMemo(()=>t?new oe.ScopePermissionsTransition(e.toScopes(t)):null,[e,t]);return l.jsxs(we,{role:"listitem",image:xo(r)?l.jsx(so,{className:"size-6"}):$s(r)?l.jsx(io,{className:"size-6"}):r.startsWith("com.atproto.moderation.")?l.jsx(_u,{className:"size-6"}):l.jsx(gu,{className:"size-6"}),title:l.jsx(hi,{object:t,property:"title",fallback:r}),description:l.jsx(hi,{object:t,property:"detail",fallback:t!=null&&t.title?r:null}),children:[l.jsx("p",{className:"mt-1",children:l.jsx(C,{id:"ZEwA2R"})}),n?l.jsxs(l.Fragment,{children:[l.jsx(yo,{className:"mt-2",permissions:n}),l.jsx(vo,{className:"mt-2",permissions:n})]}):null]})}function ad({permissions:e,type:t="alert",prominent:r=!0,...n}){return S.useMemo(()=>e.allowsIdentity({attr:"*"}),[e])?l.jsx(Bt,{...n,type:t,prominent:r,children:l.jsx("p",{children:l.jsx(C,{id:"zb3TS0",components:{0:l.jsx("b",{}),1:l.jsx("b",{})}})})}):null}function od({permissions:e,allowEmail:t,onAllowEmail:r}){const{i18n:n,_:s}=G(),i=S.useMemo(()=>["manage","read"].find(a=>e.allowsAccount({attr:"email",action:a})),[e]);return i?l.jsx("label",{className:r?"cursor-pointer":void 0,children:l.jsx(we,{role:"listitem",image:l.jsx(pu,{className:"size-6"}),title:n._({id:"O3oNi5"}),description:i==="manage"?l.jsx(C,{id:"FLm/n9"}):l.jsx(C,{id:"fEvm25"}),append:r&&l.jsx(Zs,{className:"m-2",checked:t,onChange:a=>r(a.target.checked)})})}):null}function cd({permissions:e}){const{i18n:t,_:r}=G();return e.allowsAccount({attr:"status",action:"manage"})?l.jsx(we,{role:"listitem",image:l.jsx(mu,{className:"size-6"}),title:t._({id:"AeXO77"}),description:t._({id:"NKHn7N"})}):null}function ud({permissions:e}){return S.useMemo(()=>{if(e.allowsAccount({attr:"repo",action:"manage"}))return!1;let r=!1;for(const n of e.scopes){const s=oe.RpcPermission.fromString(n);if(s){if(r=!0,bo(s.aud)||s.lxm.every(is))continue;return!1}const i=oe.RepoPermission.fromString(n);if(i){if(r=!0,i.collection.every(is))continue;return!1}}return r},[e])?null:l.jsxs(l.Fragment,{children:[l.jsx(pd,{permissions:e}),l.jsx(hd,{permissions:e})]})}function dd({permissions:e}){const t=S.useMemo(()=>e.scopes.some(_d),[e]),r=S.useMemo(()=>e.scopes.some(gd),[e]);return t||r?l.jsx(we,{role:"listitem",image:l.jsx(so,{className:"size-6"}),title:"Bluesky",description:t&&r?l.jsx(C,{id:"0ZqxWk"}):l.jsx(C,{id:"YRqkn2"})}):null}function ld({permissions:e}){const{i18n:t,_:r}=G();return S.useMemo(()=>e.hasTransitionChatBsky||e.scopes.some(md),[e])?l.jsx(we,{role:"listitem",image:l.jsx(io,{className:"size-6"}),title:t._({id:"AHZflp"}),description:t._({id:"yZDyOS"})}):null}function fd({permissions:e}){const{i18n:t,_:r}=G(),n=S.useMemo(()=>e.allowsIdentity({attr:"*"})?"*":e.allowsIdentity({attr:"handle"})?"handle":null,[e]);return n?l.jsx(we,{role:"listitem",image:l.jsx(Tr,{className:"h-6"}),title:t._({id:"ePYQjq"}),description:n==="*"?l.jsx(C,{id:"hqGoYC",components:{0:l.jsx("b",{}),1:l.jsx("b",{})}}):l.jsx(C,{id:"lbjZdy",components:{0:l.jsx("b",{})}})}):null}function hd({permissions:e}){const{i18n:t,_:r}=G();return e.hasTransitionGeneric?l.jsx(we,{role:"listitem",image:l.jsx(mi,{className:"size-6"}),title:t._({id:"OX6vme"}),description:l.jsx(C,{id:"17SnJo",components:{0:l.jsx("b",{})}}),children:l.jsx("p",{children:l.jsx(pa,{})})}):e.scopes.some(n=>oe.RpcPermission.fromString(n)!=null)?l.jsxs(we,{role:"listitem",image:l.jsx(mi,{className:"size-6"}),title:t._({id:"OX6vme"}),description:t._({id:"RZlEhS"}),children:[l.jsx("p",{children:l.jsx(pa,{})}),l.jsx("p",{className:"mt-1",children:l.jsx(C,{id:"ZEwA2R"})}),l.jsx(yo,{className:"mt-2",permissions:e})]}):null}function pa(){return l.jsx(C,{id:"sVs8xu"})}function yo({permissions:e,className:t="",...r}){const n=S.useMemo(()=>{const s=new Map;for(const i of e.scopes){const a=oe.RpcPermission.fromString(i);if(!a)continue;let c=s.get(a.aud);c||s.set(a.aud,c=new Set);for(const u of a.lxm)c.add(u)}return Array.from(s.entries()).sort(([i],[a])=>i.localeCompare(a)).map(([i,a])=>[i,a.has("*")?["*"]:Array.from(a).sort((c,u)=>c.localeCompare(u))])},[e]);return n.length?l.jsxs("table",{className:`w-full table-auto ${t}`,...r,children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-sm",children:[l.jsx("th",{className:"text-left font-normal",children:l.jsx(C,{id:"b4SMYa"})}),l.jsx("th",{className:"text-left font-normal",children:l.jsx(C,{id:"nURwxX"})})]})}),l.jsx("tbody",{children:n.map(([s,i])=>i.map((a,c,u)=>l.jsxs("tr",{className:"text-xs",children:[l.jsx("td",{className:c>0?"pt-1":void 0,children:l.jsx(yd,{lxm:a})}),c===0&&l.jsx("td",{className:"align-top",rowSpan:u.length,children:l.jsx(vd,{aud:s})})]},a)))})]}):null}function pd({permissions:e}){const{i18n:t,_:r}=G();return e.hasTransitionGeneric||e.allowsAccount({attr:"repo",action:"manage"})||e.allowsRepo({collection:"*",action:"create"})&&e.allowsRepo({collection:"*",action:"delete"})&&e.allowsRepo({collection:"*",action:"update"})?l.jsxs(we,{role:"listitem",image:l.jsx(pi,{className:"size-6"}),title:t._({id:"IreQBq"}),description:t._({id:"NnNRWU"}),children:[l.jsx("p",{children:l.jsx(ma,{})}),l.jsx("p",{className:"mt-1",children:l.jsx(C,{id:"jhMKee",components:{0:l.jsx("b",{})}})})]}):e.scopes.some(n=>oe.RepoPermission.fromString(n)!=null)?l.jsxs(we,{role:"listitem",image:l.jsx(pi,{className:"size-6"}),title:t._({id:"IreQBq"}),description:t._({id:"xs63gu"}),children:[l.jsx("p",{children:l.jsx(ma,{})}),l.jsx("p",{className:"mt-1",children:l.jsx(C,{id:"ZEwA2R"})}),l.jsx(vo,{className:"mt-2",permissions:e})]}):null}function ma(){return l.jsx(C,{id:"Gmgygg"})}function vo({permissions:e,className:t,...r}){const{i18n:n,_:s}=G(),i=S.useMemo(()=>{const f=new Map;for(const d of e.scopes){const p=oe.RepoPermission.fromString(d);if(p)for(const _ of p.collection)if(f.has(_)){const m=f.get(_);for(const x of p.action)m[x]=!0}else f.set(_,{create:p.action.includes("create"),update:p.action.includes("update"),delete:p.action.includes("delete")})}return f},[e]),a=S.useMemo(()=>e.hasTransitionGeneric?[new oe.BlobPermission(["*/*"])]:Array.from(e.scopes.map(f=>oe.BlobPermission.fromString(f))).filter(f=>f!=null),[e]);if(!i.size)return null;const c=i.get("*"),u=S.useMemo(()=>Array.from(i.entries()).sort(([f],[d])=>f.localeCompare(d)),[i]);return l.jsxs("table",{className:`w-full table-auto text-left ${t}`,...r,children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-sm",children:[l.jsx("th",{className:"font-normal",children:n._({id:"q+hNag"})}),l.jsx("th",{className:"text-center font-normal",children:n._({id:"hYgDIe"})}),l.jsx("th",{className:"text-center font-normal",children:n._({id:"EkH9pt"})}),l.jsx("th",{className:"text-center font-normal",children:n._({id:"cnGeoo"})})]})}),l.jsxs("tbody",{children:[u.map(([f,d],p)=>l.jsxs("tr",{className:"text-xs",children:[l.jsx("td",{className:p>0?"pt-1":void 0,children:l.jsx(bd,{coll:f})}),l.jsx("td",{className:"text-center",children:c!=null&&c.create||d.create?l.jsx(cn,{className:"inline-block size-3"}):null}),l.jsx("td",{className:"text-center",children:c!=null&&c.update||d.update?l.jsx(cn,{className:"inline-block size-3"}):null}),l.jsx("td",{className:"text-center",children:c!=null&&c.delete||d.delete?l.jsx(cn,{className:"inline-block size-3"}):null})]},f)),a.length>0&&l.jsxs("tr",{children:[l.jsx("td",{className:"pt-2",children:l.jsx(C,{id:"4X0Qky"})}),l.jsx("td",{colSpan:3,className:"pt-2 text-center",children:l.jsx(C,{id:"sCtyHQ"})})]})]})]})}function bo(e){return e==="did:web:bsky.app#bsky_appview"}function xo(e){return e.startsWith("app.bsky.")}function $s(e){return e.startsWith("chat.bsky.")}function md(e){if(e==="transition:chat.bsky")return!0;const t=oe.RpcPermission.fromString(e);return!t||bo(t.aud)?!1:t.lxm.includes("*")||t.lxm.some($s)}function is(e){return e==="*"?!1:e==="com.atproto.moderation.createReport"||xo(e)||$s(e)}function _d(e){if(e==="transition:generic")return!0;const t=oe.RepoPermission.fromString(e);return t?t.collection.includes("*")||t.collection.some(is):!1}function gd(e){if(e==="transition:generic")return!0;const t=oe.RpcPermission.fromString(e);return t?t.lxm.includes("app.bsky.actor.getPreferences")||t.lxm.includes("app.bsky.graph.block")||t.lxm.includes("app.bsky.graph.muteActor")||t.lxm.includes("app.bsky.graph.muteActorList")||t.lxm.includes("app.bsky.graph.muteThread")||t.lxm.includes("app.bsky.graph.unmuteActor")||t.lxm.includes("app.bsky.graph.unmuteActorList")||t.lxm.includes("app.bsky.graph.unmuteThread")||t.lxm.includes("app.bsky.graph.getMutes")||t.lxm.includes("*"):!1}function yd({lxm:e,...t}){return e==="*"?l.jsx(Nt,{...t,children:l.jsx(C,{id:"P5xSNt"})}):l.jsx(Eo,{...t,nsid:e})}function vd({aud:e,...t}){if(e.startsWith("did:web:api.bsky.app#"))return l.jsx(Nt,{...t,title:e,children:l.jsx(C,{id:"3GEYP0"})});if(e.startsWith("did:web:api.bsky.chat#"))return l.jsx(Nt,{...t,title:e,children:l.jsx(C,{id:"eglFj/"})});if(e.startsWith("did:web:")&&e.includes("#")){const r=e.slice(8,e.indexOf("#"));return l.jsx(Nt,{...t,title:e,children:l.jsx(C,{id:"BO3Kuy",values:{domain:r},components:{0:l.jsx("b",{})}})})}return e==="*"?l.jsx(Nt,{...t,children:l.jsx(C,{id:"UuQciw"})}):l.jsx(So,{...t,title:e,children:e})}function bd({coll:e,...t}){return e==="*"?l.jsx(Nt,{...t,children:l.jsx(C,{id:"a6yfpg"})}):l.jsx(Eo,{...t,nsid:e})}function Nt({children:e,className:t="",...r}){return l.jsx("em",{...r,className:`text-slate-500 ${t}`,children:e})}function Eo({nsid:e,...t}){return l.jsx(So,{...t,children:e.split(".").map((r,n)=>n===0?r:l.jsxs(S.Fragment,{children:[".",l.jsx("wbr",{}),r]},n))})}function So({children:e,className:t="",...r}){return l.jsx("code",{...r,className:`text-slate-500 ${t}`,children:e})}function Ls({actions:e,cancel:t,append:r,children:n,prepend:s,disabled:i,inert:a=i,...c}){return l.jsxs("form",{...c,inert:a,className:"flex flex-col gap-4",children:[s&&l.jsx("div",{children:s},"prepend"),l.jsx("div",{className:"space-y-4",children:n},"children"),r&&l.jsx("div",{children:r},"append"),(e||t)&&l.jsxs("div",{className:"flex flex-row-reverse flex-wrap items-center justify-end space-x-2 space-x-reverse",children:[e,l.jsx("div",{className:"flex-auto"}),t]},"buttons")]})}function _a({account:e,...t}){return l.jsx("b",{...t,children:e.preferred_username||e.email||e.sub})}const xd=e=>{try{const t=new URL(e);return t.protocol==="https:"&&t.pathname==="/oauth-client-metadata.json"&&!t.port&&!t.search}catch{return!1}};function Ed({url:e,proto:t=!1,host:r=!0,path:n=!1,query:s=!1,hash:i=!1,as:a="span",...c}){const u=S.useMemo(()=>e instanceof URL?e:new URL(e),[e]);return l.jsxs(a,{...c,children:[t&&l.jsx(yr,{value:`${u.protocol}//`,...t===!0?null:t}),r&&l.jsx(yr,{value:u.host,...r===!0?{faded:!1,bold:!0}:r}),n&&l.jsx(yr,{value:u.pathname,...n===!0?null:n}),s&&l.jsx(yr,{value:u.search,...s===!0?null:s}),i&&l.jsx(yr,{value:u.hash,...i===!0?null:i})]})}function yr({value:e,faded:t=!0,bold:r=!1}){const n=r?"b":"span";return l.jsx(n,{className:t?"opacity-50":"",children:e})}function Sd({clientId:e,clientMetadata:t,clientTrusted:r,...n}){const s=S.useMemo(()=>{try{return new URL(e)}catch{return null}},[e]);if(r&&t.client_name)return l.jsx("span",{...n,children:t.client_name});if((s==null?void 0:s.protocol)==="http:")return l.jsx("span",{...n,children:l.jsx(C,{id:"eYNzrj"})});if((s==null?void 0:s.protocol)==="https:"){const i=xd(e);return l.jsx(Ed,{...n,url:s,proto:!i,host:!0,path:!i,query:!i,hash:!1})}return l.jsx("span",{...n,children:e})}function wd(e){return e.startsWith("transition:")}function Td(e){const t=oe.AccountPermission.fromString(e);return t?t.matches({attr:"email",action:"read"}):!1}function Id(e){return e==null?void 0:e.split(" ").filter(t=>!Td(t)).join(" ")}function jd({clientId:e,clientMetadata:t,clientTrusted:r,clientFirstParty:n,permissionSets:s,account:i,scope:a,onConsent:c,consentLabel:u,onReject:f,rejectLabel:d,onBack:p,backLabel:_,...m}){const{i18n:x,_:w}=G(),[R,P]=S.useState(!0),k=!(a!=null&&a.split(" ").some(wd));return l.jsxs(Ls,{...m,onSubmit:A=>{A.preventDefault();const I=k&&!R?Id(a):a;c(I)},cancel:p&&l.jsx(ae,{onClick:p,children:_||l.jsx(C,{id:"iH8pgl"})}),actions:l.jsxs(l.Fragment,{children:[l.jsx(ae,{type:"submit",color:"primary",children:u||l.jsx(C,{id:"yIVrHZ"})}),l.jsx(ae,{onClick:f,children:d||l.jsx(C,{id:"54JiGG"})})]}),children:[l.jsx(we,{image:l.jsx(Uu,{clientId:e,clientMetadata:t,clientTrusted:r}),title:l.jsx(Sd,{clientId:e,clientMetadata:t,clientTrusted:r}),description:!a||a==="atproto"?l.jsx(C,{id:"AM8FL/",components:{0:l.jsx(_a,{account:i})}}):l.jsx(C,{id:"sUabXh",components:{0:l.jsx(_a,{account:i})}}),hint:x._({id:"69Gavs"}),children:a?l.jsxs(l.Fragment,{children:[l.jsx("p",{children:l.jsx(C,{id:"Poe314"})}),l.jsx("ul",{className:"mt-2",children:a.split(" ").map(A=>l.jsx("li",{children:l.jsx("code",{children:A})},A))})]}):null}),l.jsx(nd,{scope:a,permissionSets:s,clientTrusted:r,clientFirstParty:n,allowEmail:k?R:!0,onAllowEmail:k?P:void 0}),l.jsx("p",{children:l.jsx(C,{id:"TQzU6E",values:{0:u||l.jsx(C,{id:"yIVrHZ"})},components:{0:l.jsx("b",{}),1:l.jsx("a",{role:"link",href:t.tos_uri,rel:"nofollow noopener",target:"_blank",className:t.tos_uri?"text-primary underline":void 0}),2:l.jsx("a",{role:"link",href:t.policy_uri,rel:"nofollow noopener",target:"_blank",className:t.policy_uri?"text-primary underline":void 0})}})})]})}function Rd({clientId:e,clientMetadata:t,clientTrusted:r,clientFirstParty:n,permissionSets:s,account:i,scope:a,onConsent:c,onReject:u,onBack:f,title:d,subtitle:p=l.jsx(C,{id:"QdVx1C",values:{0:i.preferred_username||i.email||i.sub},components:{0:l.jsx("b",{className:"text-slate-800 dark:text-slate-200"})}}),..._}){const{i18n:m,_:x}=G();return l.jsx(Ee,{..._,title:d??m._({id:"yIVrHZ"}),subtitle:p,children:l.jsx(jd,{clientId:e,clientMetadata:t,clientTrusted:r,clientFirstParty:n,permissionSets:s,account:i,scope:a,onBack:f,onConsent:c,onReject:u})})}const Sn=S.createContext({disabled:!1});Sn.displayName="FieldsetContext";function Le({label:e,children:t,disabled:r,...n}){const s=wr({prefix:"fieldset-"}),i=S.useMemo(()=>({disabled:r??!1,labelId:e?s:void 0}),[r,e,s]);return l.jsxs("fieldset",{...n,"aria-labelledby":s,disabled:r,children:[e&&l.jsx("legend",{id:s,className:"mb-1 text-sm font-medium text-slate-600 dark:text-slate-400",children:e},"title"),l.jsx("div",{className:"flex flex-col space-y-4",children:l.jsx(Sn,{value:i,children:t})})]})}function Cd(e,{ref:t,onLoading:r,onError:n}={}){const[s,i]=S.useState(!1),[a,c]=S.useState(),u=S.useCallback(m=>{c(m),n==null||n(m)},[n]),f=S.useCallback(m=>{i(m),r==null||r(m)},[r]),d=S.useRef(null),p=S.useRef(null);S.useEffect(()=>(p.current=()=>{var m;(m=d.current)==null||m.abort(),d.current=null,u(void 0),f(!1)},()=>{p.current=null}),[u,f]),S.useImperativeHandle(t,()=>({reset:()=>{var m;return(m=p.current)==null?void 0:m.call(p)}}),[]),S.useEffect(()=>()=>{var m;(m=d.current)==null||m.abort(),d.current=null},[]);const _=S.useCallback(async()=>{var w;(w=d.current)==null||w.abort(),f(!0),u(void 0);const m=new AbortController,{signal:x}=m;d.current=m;try{await e(x)}catch(R){m===d.current?u(R instanceof Error?R:new Error(String(R))):Dd(x,R)||console.warn("Async action error after abort",R)}finally{m===d.current&&(d.current=null,f(!1)),m.abort()}},[e,f,u]);return{loading:s,error:a,run:_}}function Dd(e,t){return e.aborted&&(e.reason===t||e.reason===(t==null?void 0:t.cause)||t instanceof DOMException&&t.name==="AbortError")}const Nd=({error:e})=>l.jsx(yu,{error:e});function Vt({invalid:e,disabled:t,onSubmit:r,submitLabel:n,onCancel:s=void 0,cancelLabel:i,errorRender:a=Nd,ref:c,onLoading:u,onError:f,children:d,...p}){const{run:_,loading:m,error:x}=Cd(r,{ref:c,onError:f,onLoading:u}),w=S.useCallback(R=>{R.preventDefault(),R.currentTarget.reportValidity()&&!t&&!e&&_()},[t,e,_]);return l.jsx(Ls,{...p,onSubmit:w,disabled:t||m,prepend:x!=null?a({error:x}):void 0,cancel:s&&l.jsx(ae,{onClick:s,children:i||l.jsx(C,{id:"dEgA5A"})}),actions:l.jsx(ae,{color:"primary",type:"submit",loading:m,disabled:t,children:n||l.jsx(C,{id:"hQRttt"})}),children:d})}const Ue=8,kd=/(\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/,Yr=/[A-Z]/,zr=/[a-z]/,Fr=/[0-9]/,Hr=/[^a-zA-Z0-9]/;var gt=function(e){return e[e.weak=1]="weak",e[e.moderate=2]="moderate",e[e.strong=3]="strong",e[e.extra=4]="extra",e}({});function wo(e){return e.length<Ue?1:e.length>=Ue+12?4:e.length>=Ue+8?Oe(e,[Hr])||Oe(e,[Yr,zr,Fr],2)?4:3:e.length>=Ue&&Oe(e,[kd])?3:e.length>=Ue+6?Oe(e,[Hr])||Oe(e,[Yr,zr,Fr],2)?3:2:e.length>=Ue+4?Oe(e,[Hr])||Oe(e,[Yr,zr,Fr],2)?2:1:e.length>=Ue&&(Oe(e,[Hr])||Oe(e,[Yr,zr,Fr]))?2:1}function Oe(e,t,r=t.length){if(r<1||r>t.length)throw new TypeError("Invalid regexpsCountToMatch");for(const n of t)if(n.test(e)&&(r--,r===0))return!0;return!1}function Pd({password:e,...t}){const{i18n:r,_:n}=G(),s=wo(e);return l.jsx("span",{...t,"aria-label":r._({id:"osAB4a"}),children:s===gt.extra?l.jsx(C,{id:"/Ltc/k"}):s===gt.strong?l.jsx(C,{id:"LLx/nr"}):s===gt.moderate?l.jsx(C,{id:"dvYuhh"}):e?l.jsx(C,{id:"9ls/Vs"}):l.jsx(C,{id:"VU3Nrn"})})}function Ad({password:e,className:t,...r}){const{i18n:n,_:s}=G(),i=e?wo(e):0,a="bg-gray-300 dark:bg-slate-500",c=i===gt.extra||i===gt.strong?"bg-success":i===gt.moderate?"bg-warning":"bg-error";return l.jsx("div",{...r,className:re("flex h-1 w-full space-x-2",t),role:"meter","aria-label":n._({id:"xfNKwI"}),"aria-valuemin":0,"aria-valuemax":gt.extra,"aria-valuenow":i,children:Array.from({length:4},(u,f)=>l.jsx("div",{className:`h-1 w-1/4 rounded-sm ${i>f?c:a}`},f))})}function Od(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Je(e){return t=>{for(const r of e)r&&Od(r,t)}}function Ud({visible:e,toggleVisible:t,onClick:r,...n}){const{i18n:s,_:i}=G();return l.jsx(ae,{...n,shape:"padded",onClick:a=>{r==null||r(a),a.defaultPrevented||t()},"aria-label":e?s._({id:"vLyv1R"}):s._({id:"huXYDE"}),children:e?l.jsx(vu,{className:"w-5","aria-hidden":!0}):l.jsx(bu,{className:"w-5","aria-hidden":!0})})}function hn({icon:e,append:t,bellow:r,actionable:n,className:s,children:i,onFocus:a,onBlur:c,...u}){const[f,d]=S.useState(!1);return n??(n=u.onClick!=null),l.jsxs("div",{...u,onFocus:p=>{a==null||a(p),p.defaultPrevented||d(!0)},onBlur:p=>{c==null||c(p),p.defaultPrevented||d(!1)},className:re("min-h-12","max-w-full","overflow-hidden","rounded-lg","transition duration-300 ease-in-out","outline-none","focus:ring-primary focus:ring-2 focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-offset-black","has-focus:ring-primary has-focus:ring-2 has-focus:ring-offset-1 has-focus:ring-offset-white dark:has-focus:ring-offset-black","bg-gray-100 dark:bg-gray-800",n?"cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-700":void 0,s),children:[l.jsxs("div",{className:re("px-1","min-h-12 w-full","flex items-center justify-stretch","rounded-lg",r?"rounded-bl-none rounded-br-none":void 0,"text-slate-600 dark:text-slate-300"),children:[e&&l.jsx("div",{className:re("flex shrink-0 grow-0 items-center justify-center","mx-2",f?"text-primary":"text-slate-500"),children:e}),i,l.jsx("div",{className:"ml-1 flex shrink-0 grow-0 items-center",children:t})]}),r&&l.jsx("div",{className:re("space-x-2 px-3 py-2","flex flex-row items-center gap-1","rounded-br-2 rounded-bl-2","bg-gray-200 dark:bg-slate-700","text-gray-700 dark:text-gray-300","text-sm italic"),children:r})]})}function qt({icon:e,append:t,bellow:r,className:n,onFocus:s,onBlur:i,ref:a,disabled:c,title:u,"aria-label":f=u,"aria-labelledby":d,placeholder:p=f,..._}){const m=S.useContext(Sn),x=S.useRef(null),w=S.useRef(!1);return l.jsx(hn,{icon:e,append:t,bellow:r,className:re("cursor-text",n),tabIndex:-1,actionable:!1,onClick:R=>{var P;x.current!==R.target&&(R.preventDefault(),R.stopPropagation(),(P=x.current)==null||P.focus())},onMouseDown:R=>{w.current&&R.target!==x.current&&(R.preventDefault(),R.stopPropagation())},children:l.jsx("input",{..._,disabled:c??m.disabled,title:u,placeholder:p,"aria-label":f,"aria-labelledby":d??m.labelId,ref:Je([a,x]),className:"outline-hidden w-full text-ellipsis bg-transparent bg-clip-padding text-base text-inherit dark:placeholder-gray-500",onFocus:R=>{s==null||s(R),R.defaultPrevented||(w.current=!0)},onBlur:R=>{i==null||i(R),R.defaultPrevented||(w.current=!1)}})})}function To({autoHide:e=!0,onBlur:t,onChange:r,append:n,autoComplete:s="current-password",icon:i=l.jsx(xu,{className:"w-5"}),value:a,defaultValue:c=a,ref:u,title:f,dir:d="auto",autoCapitalize:p="none",autoCorrect:_="off",spellCheck:m="false",...x}){const{i18n:w,_:R}=G(),P=S.useRef(null),[k,A]=S.useState(!1),[I,Z]=S.useState(typeof c=="string"?c:""),B=S.useCallback(M=>{r==null||r(M),Z(M.target.value)},[r]);return l.jsx(qt,{...x,title:f??w._({id:"8ZsakT"}),ref:Je([u,P]),dir:d,autoCapitalize:p,autoCorrect:_,spellCheck:m,icon:i,onBlur:e?M=>{t==null||t(M),M.defaultPrevented||A(!1)}:t,value:I,onChange:B,type:k?"text":"password",autoComplete:s,append:l.jsxs(l.Fragment,{children:[l.jsx(Ud,{className:"m-1",visible:k,toggleVisible:()=>{var M;A(K=>!K),(M=P.current)==null||M.focus()}}),n]})})}function Io({password:e="",onPassword:t,onChange:r,autoComplete:n="new-password",minLength:s=Ue,...i}){const{i18n:a,_:c}=G(),[u,f]=S.useState(e),d=S.useCallback(p=>{const{value:_}=p.target;r==null||r(p),!p.defaultPrevented&&(f(_),t==null||t(p.target.validity.valid?_:void 0))},[r,t]);return l.jsx(To,{...i,placeholder:a._({id:"3tOlz6"}),"aria-label":a._({id:"0StR7t"}),title:a._({id:"5CqSPX",values:{MIN_PASSWORD_LENGTH:Ue}}),minLength:s,onChange:d,value:u,autoComplete:n,bellow:l.jsxs(l.Fragment,{children:[l.jsx(Ad,{password:u}),l.jsx(Pd,{className:"grow-1 min-w-max text-xs text-gray-500 dark:text-gray-400",password:u})]})})}const Zd="XXXXX-XXXXX";function jo({example:e=Zd,onToken:t,icon:r=l.jsx(ao,{className:"w-5"}),title:n=e,onChange:s,value:i,defaultValue:a=i,...c}){const{i18n:u,_:f}=G(),[d,p]=S.useState(typeof a=="string"?a:"");return l.jsx(qt,{...c,type:"text",autoCapitalize:"characters",autoCorrect:"off",autoComplete:"one-time-code",spellCheck:"false",minLength:11,maxLength:11,dir:"auto",icon:r,pattern:"^[A-Z2-7]{5}-[A-Z2-7]{5}$",placeholder:u._({id:"0hTJM+",values:{example:e}}),title:n,value:d,onChange:_=>{const{value:m,selectionEnd:x,selectionStart:w}=_.currentTarget,R=ga(m);_.currentTarget.value=R;const P=x??w;if(P!=null){const k=ga(m.slice(0,P));_.currentTarget.selectionStart=_.currentTarget.selectionEnd=k.length}p(R),s==null||s(_),_.isDefaultPrevented()||t==null||t(R.length===11?R:null)}})}function ga(e){const t=e.toUpperCase().replaceAll(/[^A-Z2-7]/g,"");return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5,10)}`}function $d({onSubmit:e,invalid:t,...r}){const n=wr({prefix:"reset-pwd-email-"}),s=S.useRef(null),[i,a]=S.useState(null),[c,u]=S.useState(void 0);return l.jsxs(Vt,{...r,onSubmit:f=>{if(i&&c)return e({token:i,password:c},f)},invalid:t||!i||!c,children:[l.jsx(Bt,{id:n,type:"status",children:l.jsx(C,{id:"imRJNy"})}),l.jsx(Le,{label:l.jsx(C,{id:"vJgYMA"}),children:l.jsx(jo,{name:"code","aria-labelledby":n,enterKeyHint:"next",required:!0,autoFocus:!0,onToken:f=>{var d;a(f),f&&((d=s.current)==null||d.focus())}})}),l.jsx(Le,{label:l.jsx(C,{id:"/nT6AE"}),children:l.jsx(Io,{ref:s,name:"password",enterKeyHint:"done",required:!0,password:c,onPassword:u})})]})}function Ro({onEmail:e,autoCapitalize:t="none",autoComplete:r="email",autoCorrect:n="off",dir:s="auto",icon:i=l.jsx(Tr,{className:"w-5"}),onBlur:a,onChange:c,pattern:u="^[^@]+@[^@]+\\.[^@]+$",spellCheck:f="false",value:d,defaultValue:p=d,title:_,...m}){const{i18n:x,_:w}=G(),[R,P]=S.useState(typeof p=="string"?p:""),k=S.useCallback(A=>{const I=A.target.value.toLowerCase();P(I),c==null||c(A),e==null||e(A.target.validity.valid?I:void 0)},[c,e]);return l.jsx(qt,{...m,title:_??x._({id:"ATGYL1"}),type:"email",autoCapitalize:t,autoCorrect:n,dir:s,spellCheck:f,icon:i,pattern:u,autoComplete:r,value:R,onChange:k,onBlur:a})}function Ld({emailDefault:e,onSubmit:t,invalid:r,ref:n,...s}){const{i18n:i,_:a}=G(),c=wr({prefix:"reset-pwd-email-"}),[u,f]=S.useState(e),d=S.useRef(null),p=S.useCallback(_=>{if(u)return t({email:u},_)},[u,t]);return l.jsx(Vt,{...s,ref:Je([n,d]),invalid:r||!u,onSubmit:p,children:l.jsxs(Le,{label:l.jsx(C,{id:"ATGYL1"}),children:[l.jsx(Ro,{name:"email",placeholder:i._({id:"xRPn3U"}),"aria-labelledby":c,title:i._({id:"ATGYL1"}),required:!0,autoFocus:!0,value:u,onEmail:_=>{var m;(m=d.current)==null||m.reset(),f(_)}}),l.jsx(Bt,{type:"status",id:c,children:l.jsx(C,{id:"cHrOqs"})})]})})}function Bd({emailDefault:e,onresetPasswordRequest:t,onResetPasswordConfirm:r,onBack:n,...s}){const{i18n:i,_:a}=G(),[c,u]=S.useState(0);if(c===0)return l.jsxs(Ee,{...s,title:s.title||i._({id:"dn8X5t"}),subtitle:s.subtitle||l.jsx(C,{id:"Esfg1M"}),children:[l.jsx(Ld,{emailDefault:e,submitLabel:l.jsx(C,{id:"hXzOVo"}),onSubmit:async(f,d)=>{await t(f,d),d.aborted||u(1)},cancelLabel:l.jsx(C,{id:"iH8pgl"}),onCancel:n}),l.jsx("hr",{className:"my-5 border-gray-300 dark:border-gray-700"}),l.jsx("center",{children:l.jsx(ae,{transparent:!0,onClick:()=>u(1),children:l.jsx(C,{id:"FTT4a4"})})})]});if(c===1)return l.jsx(Ee,{...s,title:s.title||i._({id:"KbS2K9"}),subtitle:s.subtitle||l.jsx(C,{id:"xg/UcZ"}),children:l.jsx($d,{submitLabel:l.jsx(C,{id:"hXzOVo"}),onSubmit:async(f,d)=>{await r(f,d),d.aborted||u(2)},cancelLabel:l.jsx(C,{id:"iH8pgl"}),onCancel:n})});if(c===2)return l.jsx(Ee,{...s,title:s.title||i._({id:"fSy6T1"}),subtitle:s.subtitle||l.jsx(C,{id:"+qGdcW"}),children:l.jsxs("center",{children:[l.jsx("h2",{className:"pb-2 text-xl font-bold",children:l.jsx(C,{id:"DKeVgZ"})}),l.jsx("p",{className:"pb-4",children:l.jsx(C,{id:"67nRLM"})}),l.jsx(ae,{color:"primary",onClick:n,children:l.jsx(C,{id:"UaXeX3"})})]})});throw new Error(`Invalid view: ${c}`)}function Md({className:e,children:t,id:r,ref:n,disabled:s,title:i,"aria-label":a=i,"aria-labelledby":c,...u}){const f=wr("input-checkbox-"),d=S.useRef(null),p=S.useRef(null),_=S.useContext(Sn),m=r??f;return l.jsx(hn,{className:re("cursor-pointer",e),icon:l.jsx(Zs,{...u,disabled:s??_.disabled,title:i,"aria-label":a,"aria-labelledby":t?void 0:c??_.labelId,ref:Je([n,p]),id:m}),tabIndex:-1,onClick:({target:x})=>{var w,R;x!==d.current&&x!==p.current&&((w=p.current)==null||w.click(),(R=p.current)==null||R.focus())},children:t&&l.jsx("label",{ref:d,htmlFor:m,className:"block w-full cursor-pointer select-none leading-[1.6]",children:t})})}function Wr({usernameDefault:e="",usernameReadonly:t=!1,rememberDefault:r=!1,onSubmit:n,onBack:s,backLabel:i,onForgotPassword:a,ref:c,invalid:u,children:f,...d}){const{i18n:p,_}=G(),[m,x]=S.useState(e),[w,R]=S.useState(""),[P,k]=S.useState(r),[A,I]=S.useState(null),[Z,B]=S.useState(null),[M,K]=S.useState(!1),H=S.useRef(null),ue=S.useCallback(()=>{I(null),B(null)},[I,B]),q=S.useCallback(()=>{var Y;ue(),(Y=H.current)==null||Y.reset()},[ue,H]),ne=S.useCallback(async Y=>{try{await n({username:m,password:w,remember:P,...Z?{[Z.type]:A}:{}},Y)}catch(de){if(Y.aborted)return;if(de instanceof Eu){B(de);return}throw de instanceof Su&&ue(),de}},[m,w,P,Z,A,n]);return l.jsxs(Vt,{...d,ref:Je([c,H]),onLoading:K,onCancel:s,cancelLabel:i??p._({id:"iH8pgl"}),append:f,invalid:u||!m||!w||Z!=null&&!A,submitLabel:Z?l.jsx(C,{id:"UwGV9B"}):l.jsx(C,{id:"yKDCQ1"}),onSubmit:ne,children:[l.jsx(Le,{disabled:M,label:l.jsx(C,{id:"sJGljQ"}),children:l.jsx(qt,{icon:l.jsx(Tr,{className:"w-5"}),name:"username",type:"text",title:p._({id:"nZx9mr"}),autoCapitalize:"none",autoCorrect:"off",autoComplete:"username",spellCheck:"false",dir:"auto",enterKeyHint:"next",required:!0,readOnly:t,disabled:t,autoFocus:!t,value:m,onChange:Y=>{q(),x(Y.target.value)}})}),l.jsx(Le,{disabled:M,label:l.jsx(C,{id:"8ZsakT"}),children:l.jsx(To,{name:"password",onChange:Y=>{q(),R(Y.target.value)},append:a&&l.jsx(ae,{className:"text-sm",type:"button",onClick:()=>{a(m!=null&&m.includes("@")?m:void 0)},"aria-label":p._({id:"slOprG"}),children:l.jsx(C,{id:"F4OP4y"})}),enterKeyHint:Z?"next":"done",disabled:M,autoFocus:t,required:!0})}),l.jsx(Bt,{role:"alert",title:l.jsx(C,{id:"r6y+jM"}),children:l.jsx(C,{id:"+Z2ZNt"})}),l.jsx(Md,{name:"remember",title:p._({id:"1TxdLU"}),enterKeyHint:Z?"next":"done",checked:P,onChange:Y=>k(Y.target.checked),children:l.jsx(C,{id:"1TxdLU"})}),Z&&l.jsx(Le,{disabled:M,label:l.jsx(C,{id:"4blS0m"}),children:l.jsxs("div",{children:[l.jsx(jo,{title:p._({id:"ioZOzk"}),enterKeyHint:"done",required:!0,autoFocus:!0,value:A??"",onToken:I}),l.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:l.jsx(C,{id:"B+Yy3b",values:{0:Z.hint}})})]})},"2fa")]})}function Vd({src:e,alt:t}){const[r,n]=S.useState(!1);return S.useEffect(()=>{n(!1)},[e]),e&&!r?l.jsx("img",{"aria-hidden":!0,src:e,alt:t,className:"-ml-1 h-6 w-6 rounded-full",onError:()=>n(!0)}):l.jsx("div",{"aria-hidden":!0,className:"bg-primary border-primary h-6 w-6 overflow-hidden rounded-full border-2 border-solid text-white",children:l.jsx(wu,{className:"-mx-1 -mb-1"})})}function qd({accounts:e,onAccount:t,onOther:r=void 0,onBack:n,onSignUp:s,backLabel:i,children:a,...c}){const{i18n:u,_:f}=G();return l.jsxs(Ls,{...c,append:a,actions:s&&l.jsx(ae,{onClick:s,color:"primary",transparent:!0,children:l.jsx(C,{id:"e+RpCP"})}),cancel:n&&l.jsx(ae,{onClick:n,children:i||l.jsx(C,{id:"iH8pgl"})}),children:[l.jsx("p",{className:"text-sm font-medium text-slate-600 dark:text-slate-400",children:l.jsx(C,{id:"FT1MVS"})}),e.map(d=>l.jsx(hn,{tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&t(d)},onClick:()=>t(d),role:"button","aria-label":u._({id:"N9o7n5",values:{0:d.name}}),icon:l.jsx(Vd,{src:d.picture,alt:u._({id:"kfcRb0"})}),append:l.jsx(_i,{"aria-hidden":!0,className:"h-4"}),children:l.jsxs("span",{className:"flex flex-wrap items-center",children:[d.name&&l.jsx("span",{className:"mr-2 truncate font-medium","arial-label":u._({id:"6YtxFj"}),children:d.name}),l.jsx("span",{className:"truncate text-sm text-neutral-500 dark:text-neutral-400","arial-label":u._({id:"sJGljQ"}),children:d.preferred_username||d.email||d.sub})]})},d.sub)),r&&l.jsx(hn,{tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&r()},onClick:r,"aria-label":u._({id:"cR9UpQ"}),role:"button",append:l.jsx(_i,{"aria-hidden":!0,className:"h-4"}),icon:l.jsx(Tr,{"aria-hidden":!0,className:"h-4"}),children:l.jsx("span",{className:"truncate text-slate-700 dark:text-slate-400",children:l.jsx(C,{id:"+TaG50"})})},"other")]})}function Gd({loginHint:e,sessions:t,selectSub:r,onSignIn:n,onSignUp:s,onForgotPassword:i,onBack:a,backLabel:c,title:u,subtitle:f,...d}){const{i18n:p,_}=G(),m=S.useMemo(()=>t.find(k=>k.selected),[t]),x=S.useCallback(()=>r(null),[r]),w=S.useMemo(()=>t.map(k=>k.account),[t]),[R,P]=S.useState(t.length===0);return u??(u=p._({id:"cQae5I"})),S.useEffect(()=>{m&&P(!1)},[m]),m?m.loginRequired?l.jsx(Ee,{...d,title:u,subtitle:f??l.jsx(C,{id:"HaGV2g"}),children:l.jsx(Wr,{onSubmit:n,onForgotPassword:i,onBack:x,usernameDefault:m.account.preferred_username||m.account.sub,usernameReadonly:!0,rememberDefault:!0})}):null:e?l.jsx(Ee,{...d,title:u,subtitle:f??l.jsx(C,{id:"NgaR6B"}),children:l.jsx(Wr,{onSubmit:n,onForgotPassword:i,onBack:a,backLabel:c,usernameDefault:e,usernameReadonly:!0})}):t.length===0?l.jsx(Ee,{...d,title:u,subtitle:f??l.jsx(C,{id:"T0KLp4"}),children:l.jsx(Wr,{onSubmit:n,onForgotPassword:i,onBack:a,backLabel:c})}):R?l.jsx(Ee,{...d,title:u,subtitle:f??l.jsx(C,{id:"T0KLp4"}),children:l.jsx(Wr,{onSubmit:n,onForgotPassword:i,onBack:()=>P(!1)})}):l.jsx(Ee,{...d,title:u,subtitle:f??l.jsx(C,{id:"o3dwub"}),children:l.jsx(qd,{accounts:w,onAccount:k=>r(k.sub),onOther:()=>P(!0),onBack:a,backLabel:c,onSignUp:s})})}const Ze=e=>e!=null&&e!==!1,Yd=e=>Ze(e)&&e.invalid===!0,zd=e=>!Ze(e)||e.invalid===!1;function Fd(e){const t=e.findIndex(Ze),r=e.findLastIndex(Ze),n=e.findIndex(Yd),[s,i]=S.useState(t),a=S.useCallback(A=>A!==-1&&e[A]?(i(A),!0):!1,[e.map(Ze).join()]),c=e.findLastIndex((A,I)=>Ze(A)&&I<s),u=e.findIndex((A,I)=>Ze(A)&&I>s),f=S.useCallback(()=>a(t),[a,t]),d=S.useCallback(()=>a(r),[a,r]),p=S.useCallback(()=>a(c),[a,c]),_=S.useCallback(()=>a(u),[a,u]),m=S.useCallback(()=>a(n),[a,n]),x=s+1+e.reduce((A,I,Z)=>Z>=s||Ze(I)?A:A-1,0),w=e.filter(Ze).length,R=e.every(zd),P=s===-1||!e[s]?void 0:e[s],k=s===-1;return S.useEffect(()=>{k&&f()},[k]),{current:P,currentPosition:x,count:w,completed:R,atFirst:x===1,atLast:x===w,toFirst:f,toLast:d,toPrev:p,toNext:_,toRequired:m}}function Hd({prevLabel:e,nextLabel:t,onBack:r,backLabel:n,onDone:s,doneLabel:i,steps:a,className:c,...u}){var B,M;const{atFirst:f,atLast:d,count:p,current:_,currentPosition:m,completed:x,toNext:w,toPrev:R,toRequired:P}=Fd(a),k=S.useCallback(()=>{w()||P()},[w,P]),A={current:!0,invalid:_?_.invalid:!1,prevLabel:f&&n||e||l.jsx(C,{id:"iH8pgl"}),prev:f?r:R,nextLabel:d&&i||t||l.jsx(C,{id:"hXzOVo"}),next:d&&x?s:k},I=(B=_==null?void 0:_.titleRender)==null?void 0:B.call(_,A),Z=(M=_==null?void 0:_.contentRender)==null?void 0:M.call(_,A);return l.jsxs("div",{className:re(c,"flex flex-col"),...u,children:[l.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:l.jsx(C,{id:"BEx8rG",values:{currentPosition:m,count:p}})}),I&&l.jsx("h2",{className:"mb-4 text-xl font-medium",children:I}),Z]})}function Wd({links:e,className:t,...r}){const n=e==null?void 0:e.find(s=>s.rel==="help");return n?l.jsx("p",{...r,className:re("rounded-md bg-slate-100 p-3 text-sm text-slate-800 dark:bg-slate-800 dark:text-slate-400",t),children:l.jsx(C,{id:"87VTIH",components:{0:l.jsx("a",{role:"link",href:n.href,rel:n.rel,target:"_blank",className:"text-primary"})}})}):null}function Kd({inviteCodeRequired:e=!0,credentials:t,onCredentials:r,onNext:n,nextLabel:s,onPrev:i,prevLabel:a,children:c,ref:u,invalid:f,...d}){const{i18n:p,_}=G(),[m,x]=S.useState(t==null?void 0:t.email),[w,R]=S.useState(t==null?void 0:t.password),[P,k]=S.useState(t==null?void 0:t.inviteCode),A=S.useRef(null),I=()=>{var B;return(B=A.current)==null?void 0:B.reset()},Z=S.useMemo(()=>m&&w&&(!e||P)?{email:m,password:w,inviteCode:e?P:void 0}:void 0,[m,w,P,e]);return S.useEffect(()=>{r==null||r(Z)},[Z,r]),l.jsxs(Vt,{...d,ref:Je([u,A]),invalid:f||!Z,onCancel:i,cancelLabel:a,onSubmit:n,submitLabel:s,append:c,children:[e&&l.jsx(Le,{label:l.jsx(C,{id:"6KlkHI"}),children:l.jsx(qt,{icon:l.jsx(ao,{className:"w-5"}),autoFocus:!0,name:"inviteCode",title:p._({id:"6KlkHI"}),placeholder:p._({id:"jxqcgY"}),required:!0,value:P||"",onChange:B=>{k(B.target.value||void 0),I()},enterKeyHint:"next"})}),l.jsx(Le,{label:l.jsx(C,{id:"O3oNi5"}),children:l.jsx(Ro,{autoFocus:!e,name:"email",enterKeyHint:"next",required:!0,defaultValue:m,onEmail:B=>{x(B),I()}})}),l.jsx(Le,{label:l.jsx(C,{id:"8ZsakT"}),children:l.jsx(Io,{name:"password",enterKeyHint:"next",required:!0,password:w,onPassword:B=>{R(B),I()}})})]})}function Jn({links:e,className:t,...r}){const n=e==null?void 0:e.find(i=>i.rel==="terms-of-service"),s=e==null?void 0:e.find(i=>i.rel==="privacy-policy");return l.jsx("p",{className:re("text-sm text-slate-500 dark:text-slate-400",t),...r,children:l.jsx(C,{id:"mBUXx0",values:{0:n?l.jsx(gi,{className:"text-primary underline",link:n,children:l.jsx(C,{id:"xowcRf"})}):l.jsx(C,{id:"xowcRf"}),1:s?l.jsx(gi,{className:"text-primary underline",link:s,children:l.jsx(C,{id:"LcET2C"})}):l.jsx(C,{id:"LcET2C"})}})})}const Xd=18,Co=3,Do=30,Jd=e=>Co+e.length<=Do&&e.startsWith(".")&&!e.endsWith(".");function Qd(e){const t=Co,r=Math.min(Xd,Do-e.length),n=S.useCallback(s=>{const i=s.length>=t&&s.length<=r,a=/^[a-z0-9][a-z0-9-]+[a-z0-9]$/g.test(s);return{validLength:i,validCharset:a,valid:i&&a}},[r,t]);return{minLength:t,maxLength:r,validateSegment:n}}function el({domains:e,onNext:t,nextLabel:r,onPrev:n,prevLabel:s,handle:i,onHandle:a,invalid:c,children:u,ref:f,...d}){const{i18n:p,_}=G(),m=e.filter(Jd),x=S.useRef(null),[w,R]=S.useState(()=>{const q=m.findIndex(ne=>i==null?void 0:i.endsWith(ne));return q===-1?0:q}),[P,k]=S.useState(()=>(i==null?void 0:i.split(".")[0])||"");S.useEffect(()=>{R(q=>Math.min(q,m.length-1))},[m.length]);const A=m[w]||m[0]||null,{minLength:I,maxLength:Z,validateSegment:B}=Qd(A),M=B(P),K=A&&M.valid?`${P}${A}`:void 0;S.useEffect(()=>{var q;(q=x.current)==null||q.reset(),a==null||a(K)},[a,K]);const H=S.useRef(null),ue=`@${P}${A}`;return l.jsxs(Vt,{...d,ref:Je([f,x]),onCancel:n,cancelLabel:s,onSubmit:t,submitLabel:r,invalid:c||!K,append:u,children:[l.jsxs("div",{children:[l.jsx(ya,{hasValue:!!P,valid:M.validLength,children:l.jsx(C,{id:"4Rgp24",values:{minLength:I,maxLength:Z}})}),l.jsx(ya,{hasValue:!!P,valid:M.validCharset,children:l.jsx(C,{id:"yDlXDJ"})})]}),l.jsx(qt,{ref:H,icon:l.jsx(Tr,{className:"w-5"}),name:"handle",type:"text",title:p._({id:"LX2sHe"}),pattern:"[a-z0-9][a-z0-9\\-]+[a-z0-9]",minLength:I,maxLength:Z,autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",dir:"auto",enterKeyHint:"done",autoFocus:!0,required:!0,value:P,onChange:q=>{const ne=q.target.value.toLowerCase(),Y=q.target.selectionStart,de=q.target.selectionEnd;q.target.value=ne,q.target.setSelectionRange(Y,de),k(ne)},append:m.length>1&&l.jsx("select",{onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),value:w,"aria-label":p._({id:"HB+TbB"}),onChange:q=>{var ne;R(Number(q.target.value)),(ne=H.current)==null||ne.focus()},className:re("block w-full","text-sm","accent-primary","cursor-pointer","bg-gray-100 dark:bg-gray-800","hover:bg-gray-200 dark:hover:bg-gray-700","transition duration-300 ease-in-out","outline-none","focus:ring-primary focus:ring-2 focus:ring-offset-1 focus:ring-offset-white dark:focus:ring-offset-black","text-slate-600 dark:text-slate-300","rounded-lg","p-2 pr-1"),children:m.map((q,ne)=>l.jsx("option",{value:ne,children:q},q))}),bellow:l.jsx(C,{id:"r/b/p8",values:{0:P.length?l.jsx("strong",{className:"text-gray-800 dark:text-gray-200",children:ue}):l.jsx("span",{"aria-hidden":!0,className:"w-24 rounded-md bg-gray-300 p-2 dark:bg-slate-600"})}})}),l.jsx(Bt,{type:"status",children:l.jsx(C,{id:"B9VwbO"})})]})}function ya({valid:e,hasValue:t,children:r,className:n,...s}){const{i18n:i,_:a}=G();return l.jsxs("div",{...s,className:re("flex flex-row items-center gap-2",n),children:[t?l.jsx(l.Fragment,{children:e?l.jsx(cn,{className:"text-success inline-block h-4 w-4",title:i._({id:"nfagfM"})}):l.jsx(Tu,{className:"text-error inline-block h-4 w-4",title:i._({id:"JHB/Ky"})})}):l.jsx("div",{"aria-hidden":!0,className:"flex h-4 w-4 items-center justify-center",children:l.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-300 dark:bg-slate-600"})}),l.jsx("div",{className:"text-sm",children:r})]})}function he(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function as(e,t){return as=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},as(e,t)}function tl(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,as(e,t)}var No=Object.defineProperty,rl=Object.defineProperties,nl=Object.getOwnPropertyDescriptors,pn=Object.getOwnPropertySymbols,ko=Object.prototype.hasOwnProperty,Po=Object.prototype.propertyIsEnumerable,va=(e,t,r)=>t in e?No(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))ko.call(t,r)&&va(e,r,t[r]);if(pn)for(var r of pn(t))Po.call(t,r)&&va(e,r,t[r]);return e},V=(e,t)=>rl(e,nl(t)),sl=(e,t)=>{var r={};for(var n in e)ko.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&pn)for(var n of pn(e))t.indexOf(n)<0&&Po.call(e,n)&&(r[n]=e[n]);return r},Ao=(e,t)=>{for(var r in t)No(e,r,{get:t[r],enumerable:!0})},Bs=(e,t,r)=>new Promise((n,s)=>{var i=u=>{try{c(r.next(u))}catch(f){s(f)}},a=u=>{try{c(r.throw(u))}catch(f){s(f)}},c=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,a);c((r=r.apply(e,t)).next())});function il(e){return Object.entries(e).filter(([,t])=>t||t===!1).map(([t,r])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(r))}`).join("&")}function Oo(e){let t=e&&e.ownerDocument||document,r=t.defaultView||t.parentWindow||window;return{document:t,window:r}}function Uo(e){return e||document.head}var al="hCaptcha-script",un="hCaptchaOnLoad",os="script-error",Dt="@hCaptcha/loader",Zo=Object.prototype.toString;function $o(e){switch(Zo.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Be(e,Error)}}function Gt(e,t){return Zo.call(e)===`[object ${t}]`}function Ms(e){return Gt(e,"ErrorEvent")}function ba(e){return Gt(e,"DOMError")}function ol(e){return Gt(e,"DOMException")}function Ke(e){return Gt(e,"String")}function Lo(e){return e===null||typeof e!="object"&&typeof e!="function"}function Ot(e){return Gt(e,"Object")}function wn(e){return typeof Event<"u"&&Be(e,Event)}function cl(e){return typeof Element<"u"&&Be(e,Element)}function ul(e){return Gt(e,"RegExp")}function Vs(e){return!!(e&&e.then&&typeof e.then=="function")}function dl(e){return Ot(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function Bo(e){return typeof e=="number"&&e!==e}function Be(e,t){try{return e instanceof t}catch{return!1}}function Mo(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function Pt(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function xa(e,t){if(!Array.isArray(e))return"";let r=[];for(let n=0;n<e.length;n++){let s=e[n];try{Mo(s)?r.push("[VueViewModel]"):r.push(String(s))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function ll(e,t,r=!1){return Ke(e)?ul(t)?t.test(e):Ke(t)?r?e===t:e.includes(t):!1:!1}function Dr(e,t=[],r=!1){return t.some(n=>ll(e,n,r))}function fl(e,t,r=250,n,s,i,a){if(!i.exception||!i.exception.values||!a||!Be(a.originalException,Error))return;let c=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;c&&(i.exception.values=hl(cs(e,t,s,a.originalException,n,i.exception.values,c,0),r))}function cs(e,t,r,n,s,i,a,c){if(i.length>=r+1)return i;let u=[...i];if(Be(n[s],Error)){Ea(a,c);let f=e(t,n[s]),d=u.length;Sa(f,s,d,c),u=cs(e,t,r,n[s],s,[f,...u],f,d)}return Array.isArray(n.errors)&&n.errors.forEach((f,d)=>{if(Be(f,Error)){Ea(a,c);let p=e(t,f),_=u.length;Sa(p,`errors[${d}]`,_,c),u=cs(e,t,r,f,s,[p,...u],p,_)}}),u}function Ea(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=V(T({},e.mechanism),{is_exception_group:!0,exception_id:t})}function Sa(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=V(T({},e.mechanism),{type:"chained",source:t,exception_id:r,parent_id:n})}function hl(e,t){return e.map(r=>(r.value&&(r.value=Pt(r.value,t)),r))}function Kr(e){return e&&e.Math==Math?e:void 0}var Q=typeof globalThis=="object"&&Kr(globalThis)||typeof window=="object"&&Kr(window)||typeof self=="object"&&Kr(self)||typeof global=="object"&&Kr(global)||function(){return this}()||{};function Nr(){return Q}function Vo(e,t,r){let n=r||Q,s=n.__SENTRY__=n.__SENTRY__||{};return s[e]||(s[e]=t())}var dn=Nr(),pl=80;function Ut(e,t={}){try{let r=e,n=5,s=[],i=0,a=0,c=" > ",u=c.length,f,d=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||pl;for(;r&&i++<n&&(f=ml(r,d),!(f==="html"||i>1&&a+s.length*u+f.length>=p));)s.push(f),a+=f.length,r=r.parentNode;return s.reverse().join(c)}catch{return"<unknown>"}}function ml(e,t){let r=e,n=[],s,i,a,c,u;if(!r||!r.tagName)return"";n.push(r.tagName.toLowerCase());let f=t&&t.length?t.filter(p=>r.getAttribute(p)).map(p=>[p,r.getAttribute(p)]):null;if(f&&f.length)f.forEach(p=>{n.push(`[${p[0]}="${p[1]}"]`)});else if(r.id&&n.push(`#${r.id}`),s=r.className,s&&Ke(s))for(i=s.split(/\s+/),u=0;u<i.length;u++)n.push(`.${i[u]}`);let d=["aria-label","type","name","title","alt"];for(u=0;u<d.length;u++)a=d[u],c=r.getAttribute(a),c&&n.push(`[${a}="${c}"]`);return n.join("")}function _l(){try{return dn.document.location.href}catch{return""}}function gl(e){return dn.document&&dn.document.querySelector?dn.document.querySelector(e):null}var yl="Sentry Logger ",us=["debug","info","warn","error","log","assert","trace"],mn={};function qo(e){if(!("console"in Q))return e();let t=Q.console,r={},n=Object.keys(mn);n.forEach(s=>{let i=mn[s];r[s]=t[s],t[s]=i});try{return e()}finally{n.forEach(s=>{t[s]=r[s]})}}function vl(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1}};return typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?us.forEach(r=>{t[r]=(...n)=>{e&&qo(()=>{Q.console[r](`${yl}[${r}]:`,...n)})}}):us.forEach(r=>{t[r]=()=>{}}),t}var N=vl(),bl=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function xl(e){return e==="http"||e==="https"}function Tn(e,t=!1){let{host:r,path:n,pass:s,port:i,projectId:a,protocol:c,publicKey:u}=e;return`${c}://${u}${t&&s?`:${s}`:""}@${r}${i?`:${i}`:""}/${n&&`${n}/`}${a}`}function El(e){let t=bl.exec(e);if(!t){console.error(`Invalid Sentry Dsn: ${e}`);return}let[r,n,s="",i,a="",c]=t.slice(1),u="",f=c,d=f.split("/");if(d.length>1&&(u=d.slice(0,-1).join("/"),f=d.pop()),f){let p=f.match(/^\d+/);p&&(f=p[0])}return Go({host:i,pass:s,path:u,projectId:f,port:a,protocol:r,publicKey:n})}function Go(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Sl(e){if(!(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__))return!0;let{port:t,projectId:r,protocol:n}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(N.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?xl(n)?t&&isNaN(parseInt(t,10))?(N.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(N.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(N.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function wl(e){let t=typeof e=="string"?El(e):Go(e);if(!(!t||!Sl(t)))return t}var De=class extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}};function se(e,t,r){if(!(t in e))return;let n=e[t],s=r(n);typeof s=="function"&&Yo(s,n),e[t]=s}function qs(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Yo(e,t){try{let r=t.prototype||{};e.prototype=t.prototype=r,qs(e,"__sentry_original__",t)}catch{}}function Gs(e){return e.__sentry_original__}function Tl(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function zo(e){if($o(e))return T({message:e.message,name:e.name,stack:e.stack},Ta(e));if(wn(e)){let t=T({type:e.type,target:wa(e.target),currentTarget:wa(e.currentTarget)},Ta(e));return typeof CustomEvent<"u"&&Be(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function wa(e){try{return cl(e)?Ut(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Ta(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function Il(e,t=40){let r=Object.keys(zo(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return Pt(r[0],t);for(let n=r.length;n>0;n--){let s=r.slice(0,n).join(", ");if(!(s.length>t))return n===r.length?s:Pt(s,t)}return""}function We(e){return ds(e,new Map)}function ds(e,t){if(Ot(e)){let r=t.get(e);if(r!==void 0)return r;let n={};t.set(e,n);for(let s of Object.keys(e))typeof e[s]<"u"&&(n[s]=ds(e[s],t));return n}if(Array.isArray(e)){let r=t.get(e);if(r!==void 0)return r;let n=[];return t.set(e,n),e.forEach(s=>{n.push(ds(s,t))}),n}return e}var Fo=50,Ia=/\(error: (.*)\)/,ja=/captureMessage|captureException/;function jl(...e){let t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0)=>{let s=[],i=r.split(`
2
+ `);for(let a=n;a<i.length;a++){let c=i[a];if(c.length>1024)continue;let u=Ia.test(c)?c.replace(Ia,"$1"):c;if(!u.match(/\S*Error: /)){for(let f of t){let d=f(u);if(d){s.push(d);break}}if(s.length>=Fo)break}}return Rl(s)}}function Rl(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),ja.test(t[t.length-1].function||"")&&(t.pop(),ja.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,Fo).map(r=>V(T({},r),{filename:r.filename||t[t.length-1].filename,function:r.function||"?"}))}var Qn="<anonymous>";function Xe(e){try{return!e||typeof e!="function"?Qn:e.name||Qn}catch{return Qn}}var ls=Nr();function Cl(){if(!("fetch"in ls))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function fs(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Dl(){if(!Cl())return!1;if(fs(ls.fetch))return!0;let e=!1,t=ls.document;if(t&&typeof t.createElement=="function")try{let r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=fs(r.contentWindow.fetch)),t.head.removeChild(r)}catch(r){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return e}var Xr=Nr();function Nl(){let e=Xr.chrome,t=e&&e.app&&e.app.runtime,r="history"in Xr&&!!Xr.history.pushState&&!!Xr.history.replaceState;return!t&&r}var te=Nr(),kt="__sentry_xhr_v2__",xr={},Ra={};function kl(e){if(!Ra[e])switch(Ra[e]=!0,e){case"console":Pl();break;case"dom":Ml();break;case"xhr":Ul();break;case"fetch":Al();break;case"history":Zl();break;case"error":Vl();break;case"unhandledrejection":ql();break;default:(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("unknown instrumentation type:",e);return}}function me(e,t){xr[e]=xr[e]||[],xr[e].push(t),kl(e)}function Se(e,t){if(!(!e||!xr[e]))for(let r of xr[e]||[])try{r(t)}catch(n){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.error(`Error while triggering instrumentation handler.
3
+ Type: ${e}
4
+ Name: ${Xe(r)}
5
+ Error:`,n)}}function Pl(){"console"in Q&&us.forEach(function(e){e in Q.console&&se(Q.console,e,function(t){return mn[e]=t,function(...r){Se("console",{args:r,level:e});let n=mn[e];n&&n.apply(Q.console,r)}})})}function Al(){Dl()&&se(Q,"fetch",function(e){return function(...t){let{method:r,url:n}=Ol(t),s={args:t,fetchData:{method:r,url:n},startTimestamp:Date.now()};return Se("fetch",T({},s)),e.apply(Q,t).then(i=>(Se("fetch",V(T({},s),{endTimestamp:Date.now(),response:i})),i),i=>{throw Se("fetch",V(T({},s),{endTimestamp:Date.now(),error:i})),i})}})}function hs(e,t){return!!e&&typeof e=="object"&&!!e[t]}function Ca(e){return typeof e=="string"?e:e?hs(e,"url")?e.url:e.toString?e.toString():"":""}function Ol(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){let[r,n]=e;return{url:Ca(r),method:hs(n,"method")?String(n.method).toUpperCase():"GET"}}let t=e[0];return{url:Ca(t),method:hs(t,"method")?String(t.method).toUpperCase():"GET"}}function Ul(){if(!te.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;se(e,"open",function(t){return function(...r){let n=r[1],s=this[kt]={method:Ke(r[0])?r[0].toUpperCase():r[0],url:r[1],request_headers:{}};Ke(n)&&s.method==="POST"&&n.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let i=()=>{let a=this[kt];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}Se("xhr",{args:r,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:this})}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?se(this,"onreadystatechange",function(a){return function(...c){return i(),a.apply(this,c)}}):this.addEventListener("readystatechange",i),se(this,"setRequestHeader",function(a){return function(...c){let[u,f]=c,d=this[kt];return d&&(d.request_headers[u.toLowerCase()]=f),a.apply(this,c)}}),t.apply(this,r)}}),se(e,"send",function(t){return function(...r){let n=this[kt];return n&&r[0]!==void 0&&(n.body=r[0]),Se("xhr",{args:r,startTimestamp:Date.now(),xhr:this}),t.apply(this,r)}})}var Jr;function Zl(){if(!Nl())return;let e=te.onpopstate;te.onpopstate=function(...r){let n=te.location.href,s=Jr;if(Jr=n,Se("history",{from:s,to:n}),e)try{return e.apply(this,r)}catch{}};function t(r){return function(...n){let s=n.length>2?n[2]:void 0;if(s){let i=Jr,a=String(s);Jr=a,Se("history",{from:i,to:a})}return r.apply(this,n)}}se(te.history,"pushState",t),se(te.history,"replaceState",t)}var $l=1e3,Qr,en;function Ll(e,t){if(!e||e.type!==t.type)return!0;try{if(e.target!==t.target)return!0}catch{}return!1}function Bl(e){if(e.type!=="keypress")return!1;try{let t=e.target;if(!t||!t.tagName)return!0;if(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)return!1}catch{}return!0}function Da(e,t=!1){return r=>{if(!r||en===r||Bl(r))return;let n=r.type==="keypress"?"input":r.type;Qr===void 0?(e({event:r,name:n,global:t}),en=r):Ll(en,r)&&(e({event:r,name:n,global:t}),en=r),clearTimeout(Qr),Qr=te.setTimeout(()=>{Qr=void 0},$l)}}function Ml(){if(!te.document)return;let e=Se.bind(null,"dom"),t=Da(e,!0);te.document.addEventListener("click",t,!1),te.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(r=>{let n=te[r]&&te[r].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(se(n,"addEventListener",function(s){return function(i,a,c){if(i==="click"||i=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__=u.__sentry_instrumentation_handlers__||{},d=f[i]=f[i]||{refCount:0};if(!d.handler){let p=Da(e);d.handler=p,s.call(this,i,p,c)}d.refCount++}catch{}return s.call(this,i,a,c)}}),se(n,"removeEventListener",function(s){return function(i,a,c){if(i==="click"||i=="keypress")try{let u=this,f=u.__sentry_instrumentation_handlers__||{},d=f[i];d&&(d.refCount--,d.refCount<=0&&(s.call(this,i,d.handler,c),d.handler=void 0,delete f[i]),Object.keys(f).length===0&&delete u.__sentry_instrumentation_handlers__)}catch{}return s.call(this,i,a,c)}}))})}var tn=null;function Vl(){tn=te.onerror,te.onerror=function(e,t,r,n,s){return Se("error",{column:n,error:s,line:r,msg:e,url:t}),tn&&!tn.__SENTRY_LOADER__?tn.apply(this,arguments):!1},te.onerror.__SENTRY_INSTRUMENTED__=!0}var rn=null;function ql(){rn=te.onunhandledrejection,te.onunhandledrejection=function(e){return Se("unhandledrejection",e),rn&&!rn.__SENTRY_LOADER__?rn.apply(this,arguments):!0},te.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Gl(){let e=typeof WeakSet=="function",t=e?new WeakSet:[];function r(s){if(e)return t.has(s)?!0:(t.add(s),!1);for(let i=0;i<t.length;i++)if(t[i]===s)return!0;return t.push(s),!1}function n(s){if(e)t.delete(s);else for(let i=0;i<t.length;i++)if(t[i]===s){t.splice(i,1);break}}return[r,n]}function ce(){let e=Q,t=e.crypto||e.msCrypto,r=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>t.getRandomValues(new Uint8Array(1))[0])}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function Ho(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function He(e){let{message:t,event_id:r}=e;if(t)return t;let n=Ho(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function ps(e,t,r){let n=e.exception=e.exception||{},s=n.values=n.values||[],i=s[0]=s[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function Sr(e,t){let r=Ho(e);if(!r)return;let n={type:"generic",handled:!0},s=r.mechanism;if(r.mechanism=T(T(T({},n),s),t),t&&"data"in t){let i=T(T({},s&&s.data),t.data);r.mechanism.data=i}}function Na(e){if(e&&e.__sentry_captured__)return!0;try{qs(e,"__sentry_captured__",!0)}catch{}return!1}function Yl(e){return Array.isArray(e)?e:[e]}function zl(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function Fl(){return"npm"}function Hl(){return!zl()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Wl(e,t){return e.require(t)}function Fe(e,t=100,r=1/0){try{return ms("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Wo(e,t=3,r=100*1024){let n=Fe(e,t);return Ql(n)>r?Wo(e,t-1,r):n}function ms(e,t,r=1/0,n=1/0,s=Gl()){let[i,a]=s;if(t==null||["number","boolean","string"].includes(typeof t)&&!Bo(t))return t;let c=Kl(e,t);if(!c.startsWith("[object "))return c;if(t.__sentry_skip_normalization__)return t;let u=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(u===0)return c.replace("object ","");if(i(t))return"[Circular ~]";let f=t;if(f&&typeof f.toJSON=="function")try{let m=f.toJSON();return ms("",m,u-1,n,s)}catch{}let d=Array.isArray(t)?[]:{},p=0,_=zo(t);for(let m in _){if(!Object.prototype.hasOwnProperty.call(_,m))continue;if(p>=n){d[m]="[MaxProperties ~]";break}let x=_[m];d[m]=ms(m,x,u-1,n,s),p++}return a(t),d}function Kl(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(Mo(t))return"[VueViewModel]";if(dl(t))return"[SyntheticEvent]";if(typeof t=="number"&&t!==t)return"[NaN]";if(typeof t=="function")return`[Function: ${Xe(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;let r=Xl(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Xl(e){let t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}function Jl(e){return~-encodeURI(e).split(/%..|./).length}function Ql(e){return Jl(JSON.stringify(e))}var $e;(function(e){e[e.PENDING=0]="PENDING";let t=1;e[e.RESOLVED=t]="RESOLVED";let r=2;e[e.REJECTED=r]="REJECTED"})($e||($e={}));function yt(e){return new pe(t=>{t(e)})}function Ys(e){return new pe((t,r)=>{r(e)})}var pe=class{constructor(e){pe.prototype.__init.call(this),pe.prototype.__init2.call(this),pe.prototype.__init3.call(this),pe.prototype.__init4.call(this),this._state=$e.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(t){this._reject(t)}}then(e,t){return new pe((r,n)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){n(i)}},s=>{if(!t)n(s);else try{r(t(s))}catch(i){n(i)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new pe((t,r)=>{let n,s;return this.then(i=>{s=!1,n=i,e&&e()},i=>{s=!0,n=i,e&&e()}).then(()=>{if(s){r(n);return}t(n)})})}__init(){this._resolve=e=>{this._setResult($e.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult($e.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===$e.PENDING){if(Vs(t)){t.then(this._resolve,this._reject);return}this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===$e.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===$e.RESOLVED&&t[1](this._value),this._state===$e.REJECTED&&t[2](this._value),t[0]=!0)})}}};function ef(e){let t=[];function r(){return e===void 0||t.length<e}function n(a){return t.splice(t.indexOf(a),1)[0]}function s(a){if(!r())return Ys(new De("Not adding Promise because buffer limit was reached."));let c=a();return t.indexOf(c)===-1&&t.push(c),c.then(()=>n(c)).then(null,()=>n(c).then(null,()=>{})),c}function i(a){return new pe((c,u)=>{let f=t.length;if(!f)return c(!0);let d=setTimeout(()=>{a&&a>0&&c(!1)},a);t.forEach(p=>{yt(p).then(()=>{--f||(clearTimeout(d),c(!0))},u)})})}return{$:t,add:s,drain:i}}function es(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}var tf=["fatal","error","warning","log","info","debug"];function rf(e){return e==="warn"?"warning":tf.includes(e)?e:"log"}var Ko=Nr(),_s={nowSeconds:()=>Date.now()/1e3};function nf(){let{performance:e}=Ko;if(!e||!e.now)return;let t=Date.now()-e.now();return{now:()=>e.now(),timeOrigin:t}}function sf(){try{return Wl(Tc,"perf_hooks").performance}catch{return}}var ts=Hl()?sf():nf(),ka=ts===void 0?_s:{nowSeconds:()=>(ts.timeOrigin+ts.now())/1e3},In=_s.nowSeconds.bind(_s),vt=ka.nowSeconds.bind(ka),Ne=(()=>{let{performance:e}=Ko;if(!e||!e.now)return;let t=3600*1e3,r=e.now(),n=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,i=s<t,a=e.timing&&e.timing.navigationStart,c=typeof a=="number"?Math.abs(a+r-n):t,u=c<t;return i||u?s<=c?e.timeOrigin:a:n})(),gs="baggage",Xo="sentry-",af=/^sentry-/,of=8192;function cf(e){if(!Ke(e)&&!Array.isArray(e))return;let t={};if(Array.isArray(e))t=e.reduce((n,s)=>{let i=Pa(s);return T(T({},n),i)},{});else{if(!e)return;t=Pa(e)}let r=Object.entries(t).reduce((n,[s,i])=>{if(s.match(af)){let a=s.slice(Xo.length);n[a]=i}return n},{});if(Object.keys(r).length>0)return r}function ys(e){if(!e)return;let t=Object.entries(e).reduce((r,[n,s])=>(s&&(r[`${Xo}${n}`]=s),r),{});return uf(t)}function Pa(e){return e.split(",").map(t=>t.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((t,[r,n])=>(t[r]=n,t),{})}function uf(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[r,n],s)=>{let i=`${encodeURIComponent(r)}=${encodeURIComponent(n)}`,a=s===0?i:`${t},${i}`;return a.length>of?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Not adding key: ${r} with val: ${n} to baggage header due to exceeding baggage size limits.`),t):a},"")}var df=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function lf(e){if(!e)return;let t=e.match(df);if(!t)return;let r;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}function ff(e,t){let r=lf(e),n=cf(t),{traceId:s,parentSpanId:i,parentSampled:a}=r||{},c={traceId:s||ce(),spanId:ce().substring(16),sampled:a};return i&&(c.parentSpanId=i),n&&(c.dsc=n),{traceparentData:r,dynamicSamplingContext:n,propagationContext:c}}function zs(e=ce(),t=ce().substring(16),r){let n="";return r!==void 0&&(n=r?"-1":"-0"),`${e}-${t}${n}`}function kr(e,t=[]){return[e,t]}function hf(e,t){let[r,n]=e;return[r,[...n,t]]}function Aa(e,t){let r=e[1];for(let n of r){let s=n[0].type;if(t(n,s))return!0}return!1}function vs(e,t){return(t||new TextEncoder).encode(e)}function pf(e,t){let[r,n]=e,s=JSON.stringify(r);function i(a){typeof s=="string"?s=typeof a=="string"?s+a:[vs(s,t),a]:s.push(typeof a=="string"?vs(a,t):a)}for(let a of n){let[c,u]=a;if(i(`
6
+ ${JSON.stringify(c)}
7
+ `),typeof u=="string"||u instanceof Uint8Array)i(u);else{let f;try{f=JSON.stringify(u)}catch{f=JSON.stringify(Fe(u))}i(f)}}return typeof s=="string"?s:mf(s)}function mf(e){let t=e.reduce((s,i)=>s+i.length,0),r=new Uint8Array(t),n=0;for(let s of e)r.set(s,n),n+=s.length;return r}function _f(e,t){let r=typeof e.data=="string"?vs(e.data,t):e.data;return[We({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}var gf={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor"};function Oa(e){return gf[e]}function Jo(e){if(!e||!e.sdk)return;let{name:t,version:r}=e.sdk;return{name:t,version:r}}function yf(e,t,r,n){let s=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return T(T(T({event_id:e.event_id,sent_at:new Date().toISOString()},t&&{sdk:t}),!!r&&n&&{dsn:Tn(n)}),s&&{trace:We(T({},s))})}function vf(e,t,r){let n=[{type:"client_report"},{timestamp:In(),discarded_events:e}];return kr(t?{dsn:t}:{},[n])}function bf(e,t=Date.now()){let r=parseInt(`${e}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}function xf(e,t){return e[t]||e.all||0}function Ef(e,t,r=Date.now()){return xf(e,t)>r}function Sf(e,{statusCode:t,headers:r},n=Date.now()){let s=T({},e),i=r&&r["x-sentry-rate-limits"],a=r&&r["retry-after"];if(i)for(let c of i.trim().split(",")){let[u,f]=c.split(":",2),d=parseInt(u,10),p=(isNaN(d)?60:d)*1e3;if(!f)s.all=n+p;else for(let _ of f.split(";"))s[_]=n+p}else a?s.all=n+bf(a,n):t===429&&(s.all=n+60*1e3);return s}var Fs="production";function Hs(){return Vo("globalEventProcessors",()=>[])}function wf(e){Hs().push(e)}function _n(e,t,r,n=0){return new pe((s,i)=>{let a=e[n];if(t===null||typeof a!="function")s(t);else{let c=a(T({},t),r);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&a.id&&c===null&&N.log(`Event processor "${a.id}" dropped event`),Vs(c)?c.then(u=>_n(e,u,r,n+1).then(s)).then(null,i):_n(e,c,r,n+1).then(s).then(null,i)}})}function Tf(e){let t=vt(),r={sid:ce(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>jf(r)};return e&&Zt(r,e),r}function Zt(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||vt(),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:ce()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function If(e,t){let r={};e.status==="ok"&&(r={status:"exited"}),Zt(e,r)}function jf(e){return We({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}var Rf=100,At=class{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Ua()}static clone(e){let t=new At;return e&&(t._breadcrumbs=[...e._breadcrumbs],t._tags=T({},e._tags),t._extra=T({},e._extra),t._contexts=T({},e._contexts),t._user=e._user,t._level=e._level,t._span=e._span,t._session=e._session,t._transactionName=e._transactionName,t._fingerprint=e._fingerprint,t._eventProcessors=[...e._eventProcessors],t._requestSession=e._requestSession,t._attachments=[...e._attachments],t._sdkProcessingMetadata=T({},e._sdkProcessingMetadata),t._propagationContext=T({},e._propagationContext)),t}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{},this._session&&Zt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags=T(T({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,t){return this._tags=V(T({},this._tags),{[e]:t}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=T(T({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,t){return this._extra=V(T({},this._extra),{[e]:t}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){let e=this.getSpan();return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;if(typeof e=="function"){let t=e(this);return t instanceof At?t:this}return e instanceof At?(this._tags=T(T({},this._tags),e._tags),this._extra=T(T({},this._extra),e._extra),this._contexts=T(T({},this._contexts),e._contexts),e._user&&Object.keys(e._user).length&&(this._user=e._user),e._level&&(this._level=e._level),e._fingerprint&&(this._fingerprint=e._fingerprint),e._requestSession&&(this._requestSession=e._requestSession),e._propagationContext&&(this._propagationContext=e._propagationContext)):Ot(e)&&(e=e,this._tags=T(T({},this._tags),e.tags),this._extra=T(T({},this._extra),e.extra),this._contexts=T(T({},this._contexts),e.contexts),e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession),e.propagationContext&&(this._propagationContext=e.propagationContext)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Ua(),this}addBreadcrumb(e,t){let r=typeof t=="number"?t:Rf;if(r<=0)return this;let n=T({timestamp:In()},e),s=this._breadcrumbs;return s.push(n),this._breadcrumbs=s.length>r?s.slice(-r):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(e,t={},r){if(this._extra&&Object.keys(this._extra).length&&(e.extra=T(T({},this._extra),e.extra)),this._tags&&Object.keys(this._tags).length&&(e.tags=T(T({},this._tags),e.tags)),this._user&&Object.keys(this._user).length&&(e.user=T(T({},this._user),e.user)),this._contexts&&Object.keys(this._contexts).length&&(e.contexts=T(T({},this._contexts),e.contexts)),this._level&&(e.level=this._level),this._transactionName&&(e.transaction=this._transactionName),this._span){e.contexts=T({trace:this._span.getTraceContext()},e.contexts);let i=this._span.transaction;if(i){e.sdkProcessingMetadata=T({dynamicSamplingContext:i.getDynamicSamplingContext()},e.sdkProcessingMetadata);let a=i.name;a&&(e.tags=T({transaction:a},e.tags))}}this._applyFingerprint(e);let n=this._getBreadcrumbs(),s=[...e.breadcrumbs||[],...n];return e.breadcrumbs=s.length>0?s:void 0,e.sdkProcessingMetadata=V(T(T({},e.sdkProcessingMetadata),this._sdkProcessingMetadata),{propagationContext:this._propagationContext}),_n([...r||[],...Hs(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=T(T({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}_getBreadcrumbs(){return this._breadcrumbs}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}_applyFingerprint(e){e.fingerprint=e.fingerprint?Yl(e.fingerprint):[],this._fingerprint&&(e.fingerprint=e.fingerprint.concat(this._fingerprint)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}};function Ua(){return{traceId:ce(),spanId:ce().substring(16)}}var Qo=4,Cf=100,Ws=class{constructor(e,t=new At,r=Qo){this._version=r,this._stack=[{scope:t}],e&&this.bindClient(e)}isOlderThan(e){return this._version<e}bindClient(e){let t=this.getStackTop();t.client=e,e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){let e=At.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(e){let t=this.pushScope();try{e(t)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){let r=this._lastEventId=t&&t.event_id?t.event_id:ce(),n=new Error("Sentry syntheticException");return this._withClient((s,i)=>{s.captureException(e,V(T({originalException:e,syntheticException:n},t),{event_id:r}),i)}),r}captureMessage(e,t,r){let n=this._lastEventId=r&&r.event_id?r.event_id:ce(),s=new Error(e);return this._withClient((i,a)=>{i.captureMessage(e,t,V(T({originalException:e,syntheticException:s},r),{event_id:n}),a)}),n}captureEvent(e,t){let r=t&&t.event_id?t.event_id:ce();return e.type||(this._lastEventId=r),this._withClient((n,s)=>{n.captureEvent(e,V(T({},t),{event_id:r}),s)}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){let{scope:r,client:n}=this.getStackTop();if(!n)return;let{beforeBreadcrumb:s=null,maxBreadcrumbs:i=Cf}=n.getOptions&&n.getOptions()||{};if(i<=0)return;let a=In(),c=T({timestamp:a},e),u=s?qo(()=>s(c,t)):c;u!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",u,t),r.addBreadcrumb(u,i))}setUser(e){this.getScope().setUser(e)}setTags(e){this.getScope().setTags(e)}setExtras(e){this.getScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t)}configureScope(e){let{scope:t,client:r}=this.getStackTop();r&&e(t)}run(e){let t=Za(this);try{e(this)}finally{Za(t)}}getIntegration(e){let t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){let r=this._callExtensionMethod("startTransaction",e,t);if((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&!r){let n=this.getClient();console.warn(n?`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
8
+ Sentry.addTracingExtensions();
9
+ Sentry.init({...});
10
+ `:"Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")}return r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){let e=this.getStackTop().scope,t=e.getSession();t&&If(t),this._sendSessionUpdate(),e.setSession()}startSession(e){let{scope:t,client:r}=this.getStackTop(),{release:n,environment:s=Fs}=r&&r.getOptions()||{},{userAgent:i}=Q.navigator||{},a=Tf(T(T({release:n,environment:s,user:t.getUser()},i&&{userAgent:i}),e)),c=t.getSession&&t.getSession();return c&&c.status==="ok"&&Zt(c,{status:"exited"}),this.endSession(),t.setSession(a),a}shouldSendDefaultPii(){let e=this.getClient(),t=e&&e.getOptions();return!!(t&&t.sendDefaultPii)}_sendSessionUpdate(){let{scope:e,client:t}=this.getStackTop(),r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}_withClient(e){let{scope:t,client:r}=this.getStackTop();r&&e(r,t)}_callExtensionMethod(e,...t){let r=Pr().__SENTRY__;if(r&&r.extensions&&typeof r.extensions[e]=="function")return r.extensions[e].apply(this,t);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Extension method ${e} couldn't be found, doing nothing.`)}};function Pr(){return Q.__SENTRY__=Q.__SENTRY__||{extensions:{},hub:void 0},Q}function Za(e){let t=Pr(),r=bs(t);return ec(t,e),r}function ee(){let e=Pr();if(e.__SENTRY__&&e.__SENTRY__.acs){let t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return Df(e)}function Df(e=Pr()){return(!Nf(e)||bs(e).isOlderThan(Qo))&&ec(e,new Ws),bs(e)}function Nf(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function bs(e){return Vo("hub",()=>new Ws,e)}function ec(e,t){if(!e)return!1;let r=e.__SENTRY__=e.__SENTRY__||{};return r.hub=t,!0}function Ks(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=ee().getClient(),r=e||t&&t.getOptions();return!!r&&(r.enableTracing||"tracesSampleRate"in r||"tracesSampler"in r)}function Ar(e){return ee().getScope().getTransaction()}var $a=!1;function kf(){$a||($a=!0,me("error",xs),me("unhandledrejection",xs))}function xs(){let e=Ar();if(e){let t="internal_error";(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Transaction: ${t} -> Global error occured`),e.setStatus(t)}}xs.tag="sentry_tracingErrorCallback";var tc=class{constructor(e=1e3){this._maxlen=e,this.spans=[]}add(e){this.spans.length>this._maxlen?e.spanRecorder=void 0:this.spans.push(e)}},rc=class{constructor(e={}){this.traceId=e.traceId||ce(),this.spanId=e.spanId||ce().substring(16),this.startTimestamp=e.startTimestamp||vt(),this.tags=e.tags||{},this.data=e.data||{},this.instrumenter=e.instrumenter||"sentry",this.origin=e.origin||"manual",e.parentSpanId&&(this.parentSpanId=e.parentSpanId),"sampled"in e&&(this.sampled=e.sampled),e.op&&(this.op=e.op),e.description&&(this.description=e.description),e.name&&(this.description=e.name),e.status&&(this.status=e.status),e.endTimestamp&&(this.endTimestamp=e.endTimestamp)}get name(){return this.description||""}set name(e){this.setName(e)}startChild(e){let t=new rc(V(T({},e),{parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId}));if(t.spanRecorder=this.spanRecorder,t.spanRecorder&&t.spanRecorder.add(t),t.transaction=this.transaction,(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&t.transaction){let r=e&&e.op||"< unknown op >",n=t.transaction.name||"< unknown name >",s=t.transaction.spanId,i=`[Tracing] Starting '${r}' span on transaction '${n}' (${s}).`;t.transaction.metadata.spanMetadata[t.spanId]={logMessage:i},N.log(i)}return t}setTag(e,t){return this.tags=V(T({},this.tags),{[e]:t}),this}setData(e,t){return this.data=V(T({},this.data),{[e]:t}),this}setStatus(e){return this.status=e,this}setHttpStatus(e){this.setTag("http.status_code",String(e)),this.setData("http.response.status_code",e);let t=Pf(e);return t!=="unknown_error"&&this.setStatus(t),this}setName(e){this.description=e}isSuccess(){return this.status==="ok"}finish(e){if((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&this.transaction&&this.transaction.spanId!==this.spanId){let{logMessage:t}=this.transaction.metadata.spanMetadata[this.spanId];t&&N.log(t.replace("Starting","Finishing"))}this.endTimestamp=typeof e=="number"?e:vt()}toTraceparent(){return zs(this.traceId,this.spanId,this.sampled)}toContext(){return We({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})}updateWithContext(e){return this.data=e.data||{},this.description=e.description,this.endTimestamp=e.endTimestamp,this.op=e.op,this.parentSpanId=e.parentSpanId,this.sampled=e.sampled,this.spanId=e.spanId||this.spanId,this.startTimestamp=e.startTimestamp||this.startTimestamp,this.status=e.status,this.tags=e.tags||{},this.traceId=e.traceId||this.traceId,this}getTraceContext(){return We({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})}toJSON(){return We({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId,origin:this.origin})}};function Pf(e){if(e<400&&e>=100)return"ok";if(e>=400&&e<500)switch(e){case 401:return"unauthenticated";case 403:return"permission_denied";case 404:return"not_found";case 409:return"already_exists";case 413:return"failed_precondition";case 429:return"resource_exhausted";default:return"invalid_argument"}if(e>=500&&e<600)switch(e){case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline_exceeded";default:return"internal_error"}return"unknown_error"}function jn(e,t,r){let n=t.getOptions(),{publicKey:s}=t.getDsn()||{},{segment:i}=r&&r.getUser()||{},a=We({environment:n.environment||Fs,release:n.release,user_segment:i,public_key:s,trace_id:e});return t.emit&&t.emit("createDsc",a),a}var nc=class extends rc{constructor(e,t){super(e),delete this.description,this._measurements={},this._contexts={},this._hub=t||ee(),this._name=e.name||"",this.metadata=V(T({source:"custom"},e.metadata),{spanMetadata:{}}),this._trimEnd=e.trimEnd,this.transaction=this;let r=this.metadata.dynamicSamplingContext;r&&(this._frozenDynamicSamplingContext=T({},r))}get name(){return this._name}set name(e){this.setName(e)}setName(e,t="custom"){this._name=e,this.metadata.source=t}initSpanRecorder(e=1e3){this.spanRecorder||(this.spanRecorder=new tc(e)),this.spanRecorder.add(this)}setContext(e,t){t===null?delete this._contexts[e]:this._contexts[e]=t}setMeasurement(e,t,r=""){this._measurements[e]={value:t,unit:r}}setMetadata(e){this.metadata=T(T({},this.metadata),e)}finish(e){let t=this._finishTransaction(e);if(t)return this._hub.captureEvent(t)}toContext(){let e=super.toContext();return We(V(T({},e),{name:this.name,trimEnd:this._trimEnd}))}updateWithContext(e){return super.updateWithContext(e),this.name=e.name||"",this._trimEnd=e.trimEnd,this}getDynamicSamplingContext(){if(this._frozenDynamicSamplingContext)return this._frozenDynamicSamplingContext;let e=this._hub||ee(),t=e.getClient();if(!t)return{};let r=e.getScope(),n=jn(this.traceId,t,r),s=this.metadata.sampleRate;s!==void 0&&(n.sample_rate=`${s}`);let i=this.metadata.source;return i&&i!=="url"&&(n.transaction=this.name),this.sampled!==void 0&&(n.sampled=String(this.sampled)),n}setHub(e){this._hub=e}_finishTransaction(e){if(this.endTimestamp!==void 0)return;this.name||((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),super.finish(e);let t=this._hub.getClient();if(t&&t.emit&&t.emit("finishTransaction",this),this.sampled!==!0){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","transaction");return}let r=this.spanRecorder?this.spanRecorder.spans.filter(i=>i!==this&&i.endTimestamp):[];this._trimEnd&&r.length>0&&(this.endTimestamp=r.reduce((i,a)=>i.endTimestamp&&a.endTimestamp?i.endTimestamp>a.endTimestamp?i:a:i).endTimestamp);let n=this.metadata,s=T({contexts:V(T({},this._contexts),{trace:this.getTraceContext()}),spans:r,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",sdkProcessingMetadata:V(T({},n),{dynamicSamplingContext:this.getDynamicSamplingContext()})},n.source&&{transaction_info:{source:n.source}});return Object.keys(this._measurements).length>0&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),s.measurements=this._measurements),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`),s}},ln={idleTimeout:1e3,finalTimeout:3e4,heartbeatInterval:5e3},Af="finishReason",Rt=["heartbeatFailed","idleTimeout","documentHidden","finalTimeout","externalFinish","cancelled"],Of=class extends tc{constructor(e,t,r,n){super(n),this._pushActivity=e,this._popActivity=t,this.transactionSpanId=r}add(e){e.spanId!==this.transactionSpanId&&(e.finish=t=>{e.endTimestamp=typeof t=="number"?t:vt(),this._popActivity(e.spanId)},e.endTimestamp===void 0&&this._pushActivity(e.spanId)),super.add(e)}},Uf=class extends nc{constructor(e,t,r=ln.idleTimeout,n=ln.finalTimeout,s=ln.heartbeatInterval,i=!1){super(e,t),this._idleHub=t,this._idleTimeout=r,this._finalTimeout=n,this._heartbeatInterval=s,this._onScope=i,this.activities={},this._heartbeatCounter=0,this._finished=!1,this._idleTimeoutCanceledPermanently=!1,this._beforeFinishCallbacks=[],this._finishReason=Rt[4],i&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`),t.configureScope(a=>a.setSpan(this))),this._restartIdleTimeout(),setTimeout(()=>{this._finished||(this.setStatus("deadline_exceeded"),this._finishReason=Rt[3],this.finish())},this._finalTimeout)}finish(e=vt()){if(this._finished=!0,this.activities={},this.op==="ui.action.click"&&this.setTag(Af,this._finishReason),this.spanRecorder){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] finishing IdleTransaction",new Date(e*1e3).toISOString(),this.op);for(let t of this._beforeFinishCallbacks)t(this,e);this.spanRecorder.spans=this.spanRecorder.spans.filter(t=>{if(t.spanId===this.spanId)return!0;t.endTimestamp||(t.endTimestamp=e,t.setStatus("cancelled"),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(t,void 0,2)));let r=t.startTimestamp<e,n=(this._finalTimeout+this._idleTimeout)/1e3,s=t.endTimestamp-this.startTimestamp<n;if(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__){let i=JSON.stringify(t,void 0,2);r?s||N.log("[Tracing] discarding Span since it finished after Transaction final timeout",i):N.log("[Tracing] discarding Span since it happened after Transaction was finished",i)}return r&&s}),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] flushing IdleTransaction")}else(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] No active IdleTransaction");if(this._onScope){let t=this._idleHub.getScope();t.getTransaction()===this&&t.setSpan(void 0)}return super.finish(e)}registerBeforeFinishCallback(e){this._beforeFinishCallbacks.push(e)}initSpanRecorder(e){if(!this.spanRecorder){let t=n=>{this._finished||this._pushActivity(n)},r=n=>{this._finished||this._popActivity(n)};this.spanRecorder=new Of(t,r,this.spanId,e),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("Starting heartbeat"),this._pingHeartbeat()}this.spanRecorder.add(this)}cancelIdleTimeout(e,{restartOnChildSpanChange:t}={restartOnChildSpanChange:!0}){this._idleTimeoutCanceledPermanently=t===!1,this._idleTimeoutID&&(clearTimeout(this._idleTimeoutID),this._idleTimeoutID=void 0,Object.keys(this.activities).length===0&&this._idleTimeoutCanceledPermanently&&(this._finishReason=Rt[5],this.finish(e)))}setFinishReason(e){this._finishReason=e}_restartIdleTimeout(e){this.cancelIdleTimeout(),this._idleTimeoutID=setTimeout(()=>{!this._finished&&Object.keys(this.activities).length===0&&(this._finishReason=Rt[1],this.finish(e))},this._idleTimeout)}_pushActivity(e){this.cancelIdleTimeout(void 0,{restartOnChildSpanChange:!this._idleTimeoutCanceledPermanently}),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] pushActivity: ${e}`),this.activities[e]=!0,(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] new activities count",Object.keys(this.activities).length)}_popActivity(e){if(this.activities[e]&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] popActivity ${e}`),delete this.activities[e],(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] new activities count",Object.keys(this.activities).length)),Object.keys(this.activities).length===0){let t=vt();this._idleTimeoutCanceledPermanently?(this._finishReason=Rt[5],this.finish(t)):this._restartIdleTimeout(t+this._idleTimeout/1e3)}}_beat(){if(this._finished)return;let e=Object.keys(this.activities).join("");e===this._prevHeartbeatString?this._heartbeatCounter++:this._heartbeatCounter=1,this._prevHeartbeatString=e,this._heartbeatCounter>=3?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus("deadline_exceeded"),this._finishReason=Rt[0],this.finish()):this._pingHeartbeat()}_pingHeartbeat(){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`),setTimeout(()=>{this._beat()},this._heartbeatInterval)}};function Zf(){let e=this.getScope().getSpan();return e?{"sentry-trace":e.toTraceparent()}:{}}function sc(e,t,r){if(!Ks(t))return e.sampled=!1,e;if(e.sampled!==void 0)return e.setMetadata({sampleRate:Number(e.sampled)}),e;let n;return typeof t.tracesSampler=="function"?(n=t.tracesSampler(r),e.setMetadata({sampleRate:Number(n)})):r.parentSampled!==void 0?n=r.parentSampled:typeof t.tracesSampleRate<"u"?(n=t.tracesSampleRate,e.setMetadata({sampleRate:Number(n)})):(n=1,e.setMetadata({sampleRate:n})),$f(n)?n?(e.sampled=Math.random()<n,e.sampled?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] starting ${e.op} transaction - ${e.name}`),e):((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(n)})`),e)):((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),e.sampled=!1,e):((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("[Tracing] Discarding transaction because of invalid sample rate."),e.sampled=!1,e)}function $f(e){return Bo(e)||!(typeof e=="number"||typeof e=="boolean")?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`),!1):e<0||e>1?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function Lf(e,t){let r=this.getClient(),n=r&&r.getOptions()||{},s=n.instrumenter||"sentry",i=e.instrumenter||"sentry";s!==i&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.error(`A transaction was started with instrumenter=\`${i}\`, but the SDK is configured with the \`${s}\` instrumenter.
11
+ The transaction will not be sampled. Please use the ${s} instrumentation to start transactions.`),e.sampled=!1);let a=new nc(e,this);return a=sc(a,n,T({parentSampled:e.parentSampled,transactionContext:e},t)),a.sampled&&a.initSpanRecorder(n._experiments&&n._experiments.maxSpans),r&&r.emit&&r.emit("startTransaction",a),a}function La(e,t,r,n,s,i,a){let c=e.getClient(),u=c&&c.getOptions()||{},f=new Uf(t,e,r,n,a,s);return f=sc(f,u,T({parentSampled:t.parentSampled,transactionContext:t},i)),f.sampled&&f.initSpanRecorder(u._experiments&&u._experiments.maxSpans),c&&c.emit&&c.emit("startTransaction",f),f}function Bf(){let e=Pr();e.__SENTRY__&&(e.__SENTRY__.extensions=e.__SENTRY__.extensions||{},e.__SENTRY__.extensions.startTransaction||(e.__SENTRY__.extensions.startTransaction=Lf),e.__SENTRY__.extensions.traceHeaders||(e.__SENTRY__.extensions.traceHeaders=Zf),kf())}function Mf(e,t){return ee().captureException(e,{captureContext:t})}function Vf(e){ee().withScope(e)}var qf="7";function Gf(e){let t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}function Yf(e){return`${Gf(e)}${e.projectId}/envelope/`}function zf(e,t){return Tl(T({sentry_key:e.publicKey,sentry_version:qf},t&&{sentry_client:`${t.name}/${t.version}`}))}function Ff(e,t={}){let r=typeof t=="string"?t:t.tunnel,n=typeof t=="string"||!t._metadata?void 0:t._metadata.sdk;return r||`${Yf(e)}?${zf(e,n)}`}function Hf(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]]),e}function Wf(e,t,r,n){let s=Jo(r),i=T(T({sent_at:new Date().toISOString()},s&&{sdk:s}),!!n&&t&&{dsn:Tn(t)}),a="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return kr(i,[a])}function Kf(e,t,r,n){let s=Jo(r),i=e.type&&e.type!=="replay_event"?e.type:"event";Hf(e,r&&r.sdk);let a=yf(e,s,n,t);return delete e.sdkProcessingMetadata,kr(a,[[{type:i},e]])}var Ba=[];function Xf(e,t){let r={};return t.forEach(n=>{n&&ic(e,n,r)}),r}function ic(e,t,r){if(r[t.name]=t,Ba.indexOf(t.name)===-1&&(t.setupOnce(wf,ee),Ba.push(t.name)),e.on&&typeof t.preprocessEvent=="function"){let n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(s,i)=>n(s,i,e))}if(e.addEventProcessor&&typeof t.processEvent=="function"){let n=t.processEvent.bind(t),s=Object.assign((i,a)=>n(i,a,e),{id:t.name});e.addEventProcessor(s)}(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`Integration installed: ${t.name}`)}function Jf(e,t,r,n,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=e,c=V(T({},t),{event_id:t.event_id||r.event_id||ce(),timestamp:t.timestamp||In()}),u=r.integrations||e.integrations.map(_=>_.name);Qf(c,e),rh(c,u),t.type===void 0&&eh(c,e.stackParser);let f=n;r.captureContext&&(f=At.clone(f).update(r.captureContext));let d=yt(c),p=s&&s.getEventProcessors?s.getEventProcessors():[];if(f){if(f.getAttachments){let _=[...r.attachments||[],...f.getAttachments()];_.length&&(r.attachments=_)}d=f.applyToEvent(c,r,p)}else d=_n([...p,...Hs()],c,r);return d.then(_=>(_&&th(_),typeof i=="number"&&i>0?nh(_,i,a):_))}function Qf(e,t){let{environment:r,release:n,dist:s,maxValueLength:i=250}=t;"environment"in e||(e.environment="environment"in t?r:Fs),e.release===void 0&&n!==void 0&&(e.release=n),e.dist===void 0&&s!==void 0&&(e.dist=s),e.message&&(e.message=Pt(e.message,i));let a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=Pt(a.value,i));let c=e.request;c&&c.url&&(c.url=Pt(c.url,i))}var Ma=new WeakMap;function eh(e,t){let r=Q._sentryDebugIds;if(!r)return;let n,s=Ma.get(t);s?n=s:(n=new Map,Ma.set(t,n));let i=Object.keys(r).reduce((a,c)=>{let u,f=n.get(c);f?u=f:(u=t(c),n.set(c,u));for(let d=u.length-1;d>=0;d--){let p=u[d];if(p.filename){a[p.filename]=r[c];break}}return a},{});try{e.exception.values.forEach(a=>{a.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=i[c.filename])})})}catch{}}function th(e){let t={};try{e.exception.values.forEach(n=>{n.stacktrace.frames.forEach(s=>{s.debug_id&&(s.abs_path?t[s.abs_path]=s.debug_id:s.filename&&(t[s.filename]=s.debug_id),delete s.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let r=e.debug_meta.images;Object.keys(t).forEach(n=>{r.push({type:"sourcemap",code_file:n,debug_id:t[n]})})}function rh(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function nh(e,t,r){if(!e)return null;let n=T(T(T(T(T({},e),e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(s=>T(T({},s),s.data&&{data:Fe(s.data,t,r)}))}),e.user&&{user:Fe(e.user,t,r)}),e.contexts&&{contexts:Fe(e.contexts,t,r)}),e.extra&&{extra:Fe(e.extra,t,r)});return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=Fe(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(s=>(s.data&&(s.data=Fe(s.data,t,r)),s))),n}var Va="Not capturing exception because it's already been captured.",sh=class{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=wl(e.dsn):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("No DSN provided, client will not send events."),this._dsn){let t=Ff(this._dsn,e);this._transport=e.transport(V(T({recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:t}))}}captureException(e,t,r){if(Na(e)){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(Va);return}let n=t&&t.event_id;return this._process(this.eventFromException(e,t).then(s=>this._captureEvent(s,t,r)).then(s=>{n=s})),n}captureMessage(e,t,r,n){let s=r&&r.event_id,i=Lo(e)?this.eventFromMessage(String(e),t,r):this.eventFromException(e,r);return this._process(i.then(a=>this._captureEvent(a,r,n)).then(a=>{s=a})),s}captureEvent(e,t,r){if(t&&t.originalException&&Na(t.originalException)){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(Va);return}let n=t&&t.event_id;return this._process(this._captureEvent(e,t,r).then(s=>{n=s})),n}captureSession(e){typeof e.release!="string"?(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),Zt(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let t=this._transport;return t?this._isClientDoneProcessing(e).then(r=>t.flush(e).then(n=>r&&n)):yt(!0)}close(e){return this.flush(e).then(t=>(this.getOptions().enabled=!1,t))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&(this._integrations=Xf(this,this._options.integrations),this._integrationsInitialized=!0)}getIntegrationById(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){ic(this,e,this._integrations)}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=Kf(e,this._dsn,this._options._metadata,this._options.tunnel);for(let s of t.attachments||[])r=hf(r,_f(s,this._options.transportOptions&&this._options.transportOptions.textEncoder));let n=this._sendEnvelope(r);n&&n.then(s=>this.emit("afterSendEvent",e,s),null)}sendSession(e){let t=Wf(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,r){if(this._options.sendClientReports){let n=`${e}:${t}`;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`Adding outcome: "${n}"`),this._outcomes[n]=this._outcomes[n]+1||1}}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach(r=>r(...t))}_updateSessionFromEvent(e,t){let r=!1,n=!1,s=t.exception&&t.exception.values;if(s){n=!0;for(let a of s){let c=a.mechanism;if(c&&c.handled===!1){r=!0;break}}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(Zt(e,V(T({},r&&{status:"crashed"}),{errors:e.errors||Number(n||r)})),this.captureSession(e))}_isClientDoneProcessing(e){return new pe(t=>{let r=0,n=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),t(!0)):(r+=n,e&&r>=e&&(clearInterval(s),t(!1)))},n)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,r){let n=this.getOptions(),s=Object.keys(this._integrations);return!t.integrations&&s.length>0&&(t.integrations=s),this.emit("preprocessEvent",e,t),Jf(n,e,t,r,this).then(i=>{if(i===null)return i;let{propagationContext:a}=i.sdkProcessingMetadata||{};if(!(i.contexts&&i.contexts.trace)&&a){let{traceId:c,spanId:u,parentSpanId:f,dsc:d}=a;i.contexts=T({trace:{trace_id:c,span_id:u,parent_span_id:f}},i.contexts);let p=d||jn(c,this,r);i.sdkProcessingMetadata=T({dynamicSamplingContext:p},i.sdkProcessingMetadata)}return i})}_captureEvent(e,t={},r){return this._processEvent(e,t,r).then(n=>n.event_id,n=>{if(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__){let s=n;s.logLevel==="log"?N.log(s.message):N.warn(s)}})}_processEvent(e,t,r){let n=this.getOptions(),{sampleRate:s}=n,i=oc(e),a=ac(e),c=e.type||"error",u=`before send for type \`${c}\``;if(a&&typeof s=="number"&&Math.random()>s)return this.recordDroppedEvent("sample_rate","error",e),Ys(new De(`Discarding event because it's not included in the random sample (sampling rate = ${s})`,"log"));let f=c==="replay_event"?"replay":c;return this._prepareEvent(e,t,r).then(d=>{if(d===null)throw this.recordDroppedEvent("event_processor",f,e),new De("An event processor returned `null`, will not send event.","log");if(t.data&&t.data.__sentry__===!0)return d;let p=ah(n,d,t);return ih(p,u)}).then(d=>{if(d===null)throw this.recordDroppedEvent("before_send",f,e),new De(`${u} returned \`null\`, will not send event.`,"log");let p=r&&r.getSession();!i&&p&&this._updateSessionFromEvent(p,d);let _=d.transaction_info;if(i&&_&&d.transaction!==e.transaction){let m="custom";d.transaction_info=V(T({},_),{source:m})}return this.sendEvent(d,t),d}).then(null,d=>{throw d instanceof De?d:(this.captureException(d,{data:{__sentry__:!0},originalException:d}),new De(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
12
+ Reason: ${d}`))})}_process(e){this._numProcessing++,e.then(t=>(this._numProcessing--,t),t=>(this._numProcessing--,t))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,t=>{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.error("Error while sending event:",t)});(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.error("Transport disabled")}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.keys(e).map(t=>{let[r,n]=t.split(":");return{reason:r,category:n,quantity:e[t]}})}};function ih(e,t){let r=`${t} must return \`null\` or a valid event.`;if(Vs(e))return e.then(n=>{if(!Ot(n)&&n!==null)throw new De(r);return n},n=>{throw new De(`${t} rejected with ${n}`)});if(!Ot(e)&&e!==null)throw new De(r);return e}function ah(e,t,r){let{beforeSend:n,beforeSendTransaction:s}=e;return ac(t)&&n?n(t,r):oc(t)&&s?s(t,r):t}function ac(e){return e.type===void 0}function oc(e){return e.type==="transaction"}var oh=30;function cc(e,t,r=ef(e.bufferSize||oh)){let n={},s=a=>r.drain(a);function i(a){let c=[];if(Aa(a,(p,_)=>{let m=Oa(_);if(Ef(n,m)){let x=qa(p,_);e.recordDroppedEvent("ratelimit_backoff",m,x)}else c.push(p)}),c.length===0)return yt();let u=kr(a[0],c),f=p=>{Aa(u,(_,m)=>{let x=qa(_,m);e.recordDroppedEvent(p,Oa(m),x)})},d=()=>t({body:pf(u,e.textEncoder)}).then(p=>(p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),n=Sf(n,p),p),p=>{throw f("network_error"),p});return r.add(d).then(p=>p,p=>{if(p instanceof De)return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.error("Skipped sending event because buffer is full."),f("queue_overflow"),yt();throw p})}return i.__sentry__baseTransport__=!0,{send:i,flush:s}}function qa(e,t){if(!(t!=="event"&&t!=="transaction"))return Array.isArray(e)?e[1]:void 0}var Ga="7.73.0",uc={};Ao(uc,{FunctionToString:()=>Xs,InboundFilters:()=>Js});var Ya,Xs=class{static __initStatic(){this.id="FunctionToString"}constructor(){this.name=Xs.id}setupOnce(){Ya=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Gs(this)||this;return Ya.apply(t,e)}}catch{}}};Xs.__initStatic();var ch=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/],uh=[/^.*healthcheck.*$/,/^.*healthy.*$/,/^.*live.*$/,/^.*ready.*$/,/^.*heartbeat.*$/,/^.*\/health$/,/^.*\/healthz$/],Js=class{static __initStatic(){this.id="InboundFilters"}constructor(e={}){this.name=Js.id,this._options=e}setupOnce(e,t){}processEvent(e,t,r){let n=r.getOptions(),s=dh(this._options,n);return lh(e,s)?null:e}};Js.__initStatic();function dh(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:ch],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:uh],ignoreInternal:e.ignoreInternal!==void 0?e.ignoreInternal:!0}}function lh(e,t){return t.ignoreInternal&&gh(e)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Event dropped due to being internal Sentry Error.
13
+ Event: ${He(e)}`),!0):fh(e,t.ignoreErrors)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
14
+ Event: ${He(e)}`),!0):hh(e,t.ignoreTransactions)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
15
+ Event: ${He(e)}`),!0):ph(e,t.denyUrls)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Event dropped due to being matched by \`denyUrls\` option.
16
+ Event: ${He(e)}.
17
+ Url: ${gn(e)}`),!0):mh(e,t.allowUrls)?!1:((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`Event dropped due to not being matched by \`allowUrls\` option.
18
+ Event: ${He(e)}.
19
+ Url: ${gn(e)}`),!0)}function fh(e,t){return e.type||!t||!t.length?!1:_h(e).some(r=>Dr(r,t))}function hh(e,t){if(e.type!=="transaction"||!t||!t.length)return!1;let r=e.transaction;return r?Dr(r,t):!1}function ph(e,t){if(!t||!t.length)return!1;let r=gn(e);return r?Dr(r,t):!1}function mh(e,t){if(!t||!t.length)return!0;let r=gn(e);return r?Dr(r,t):!0}function _h(e){let t=[];e.message&&t.push(e.message);let r;try{r=e.exception.values[e.exception.values.length-1]}catch{}return r&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`)),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&t.length===0&&N.error(`Could not extract message for event ${He(e)}`),t}function gh(e){try{return e.exception.values[0].type==="SentryError"}catch{}return!1}function yh(e=[]){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function gn(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?yh(t):null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.error(`Cannot extract url for event ${He(e)}`),null}}var F=Q,Es=0;function dc(){return Es>0}function vh(){Es++,setTimeout(()=>{Es--})}function $t(e,t={},r){if(typeof e!="function")return e;try{let s=e.__sentry_wrapped__;if(s)return s;if(Gs(e))return e}catch{return e}let n=function(){let s=Array.prototype.slice.call(arguments);try{r&&typeof r=="function"&&r.apply(this,arguments);let i=s.map(a=>$t(a,t));return e.apply(this,i)}catch(i){throw vh(),Vf(a=>{a.addEventProcessor(c=>(t.mechanism&&(ps(c,void 0),Sr(c,t.mechanism)),c.extra=V(T({},c.extra),{arguments:s}),c)),Mf(i)}),i}};try{for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}catch{}Yo(n,e),qs(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return e.name}})}catch{}return n}function lc(e,t){let r=Qs(e,t),n={type:t&&t.name,value:Sh(t)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function bh(e,t,r,n){let s=ee().getClient(),i=s&&s.getOptions().normalizeDepth,a={exception:{values:[{type:wn(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:Ih(t,{isUnhandledRejection:n})}]},extra:{__serialized__:Wo(t,i)}};if(r){let c=Qs(e,r);c.length&&(a.exception.values[0].stacktrace={frames:c})}return a}function rs(e,t){return{exception:{values:[lc(e,t)]}}}function Qs(e,t){let r=t.stacktrace||t.stack||"",n=Eh(t);try{return e(r,n)}catch{}return[]}var xh=/Minified React error #\d+;/i;function Eh(e){if(e){if(typeof e.framesToPop=="number")return e.framesToPop;if(xh.test(e.message))return 1}return 0}function Sh(e){let t=e&&e.message;return t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function wh(e,t,r,n){let s=r&&r.syntheticException||void 0,i=ei(e,t,s,n);return Sr(i),i.level="error",r&&r.event_id&&(i.event_id=r.event_id),yt(i)}function Th(e,t,r="info",n,s){let i=n&&n.syntheticException||void 0,a=Ss(e,t,i,s);return a.level=r,n&&n.event_id&&(a.event_id=n.event_id),yt(a)}function ei(e,t,r,n,s){let i;if(Ms(t)&&t.error)return rs(e,t.error);if(ba(t)||ol(t)){let a=t;if("stack"in t)i=rs(e,t);else{let c=a.name||(ba(a)?"DOMError":"DOMException"),u=a.message?`${c}: ${a.message}`:c;i=Ss(e,u,r,n),ps(i,u)}return"code"in a&&(i.tags=V(T({},i.tags),{"DOMException.code":`${a.code}`})),i}return $o(t)?rs(e,t):Ot(t)||wn(t)?(i=bh(e,t,r,s),Sr(i,{synthetic:!0}),i):(i=Ss(e,t,r,n),ps(i,`${t}`),Sr(i,{synthetic:!0}),i)}function Ss(e,t,r,n){let s={message:t};if(n&&r){let i=Qs(e,r);i.length&&(s.exception={values:[{value:t,stacktrace:{frames:i}}]})}return s}function Ih(e,{isUnhandledRejection:t}){let r=Il(e),n=t?"promise rejection":"exception";return Ms(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:wn(e)?`Event \`${jh(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function jh(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Rh(e,{metadata:t,tunnel:r,dsn:n}){let s=T(T({event_id:e.event_id,sent_at:new Date().toISOString()},t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}}),!!r&&!!n&&{dsn:Tn(n)}),i=Ch(e);return kr(s,[i])}function Ch(e){return[{type:"user_report"},e]}var Dh=class extends sh{constructor(e){let t=F.SENTRY_SDK_SOURCE||Fl();e._metadata=e._metadata||{},e._metadata.sdk=e._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:`${t}:@sentry/browser`,version:Ga}],version:Ga},super(e),e.sendClientReports&&F.document&&F.document.addEventListener("visibilitychange",()=>{F.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,t){return wh(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return Th(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("SDK not enabled, will not capture user feedback.");return}let t=Rh(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r)}_flushOutcomes(){let e=this._clearOutcomes();if(e.length===0){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("No outcomes to send");return}if(!this._dsn){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("No dsn provided, will not send outcomes");return}(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("Sending outcomes:",e);let t=vf(e,this._options.tunnel&&Tn(this._dsn));this._sendEnvelope(t)}},br;function Nh(){if(br)return br;if(fs(F.fetch))return br=F.fetch.bind(F);let e=F.document,t=F.fetch;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r);let n=r.contentWindow;n&&n.fetch&&(t=n.fetch),e.head.removeChild(r)}catch(r){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return br=t.bind(F)}function kh(){br=void 0}function Ph(e,t=Nh()){let r=0,n=0;function s(i){let a=i.body.length;r+=a,n++;let c=T({body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15},e.fetchOptions);try{return t(e.url,c).then(u=>(r-=a,n--,{statusCode:u.status,headers:{"x-sentry-rate-limits":u.headers.get("X-Sentry-Rate-Limits"),"retry-after":u.headers.get("Retry-After")}}))}catch(u){return kh(),r-=a,n--,Ys(u)}}return cc(e,s)}var Ah=4;function Oh(e){function t(r){return new pe((n,s)=>{let i=new XMLHttpRequest;i.onerror=s,i.onreadystatechange=()=>{i.readyState===Ah&&n({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")}})},i.open("POST",e.url);for(let a in e.headers)Object.prototype.hasOwnProperty.call(e.headers,a)&&i.setRequestHeader(a,e.headers[a]);i.send(r.body)})}return cc(e,t)}var Rn="?",Uh=30,Zh=40,$h=50;function ti(e,t,r,n){let s={filename:e,function:t,in_app:!0};return r!==void 0&&(s.lineno=r),n!==void 0&&(s.colno=n),s}var Lh=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Bh=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mh=e=>{let t=Lh.exec(e);if(t){if(t[2]&&t[2].indexOf("eval")===0){let s=Bh.exec(t[2]);s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3])}let[r,n]=fc(t[1]||Rn,t[2]);return ti(n,r,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}},Vh=[Uh,Mh],qh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Gh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Yh=e=>{let t=qh.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){let s=Gh.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}let r=t[3],n=t[1]||Rn;return[n,r]=fc(n,r),ti(r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},zh=[$h,Yh],Fh=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Hh=e=>{let t=Fh.exec(e);return t?ti(t[2],t[1]||Rn,+t[3],t[4]?+t[4]:void 0):void 0},Wh=[Zh,Hh],Kh=[Vh,zh,Wh],Xh=jl(...Kh),fc=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:Rn,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Yt=class{static __initStatic(){this.id="GlobalHandlers"}constructor(e){this.name=Yt.id,this._options=T({onerror:!0,onunhandledrejection:!0},e),this._installFunc={onerror:Jh,onunhandledrejection:Qh}}setupOnce(){Error.stackTraceLimit=50;let e=this._options;for(let t in e){let r=this._installFunc[t];r&&e[t]&&(rp(t),r(),this._installFunc[t]=void 0)}}};Yt.__initStatic();function Jh(){me("error",e=>{let[t,r,n]=mc();if(!t.getIntegration(Yt))return;let{msg:s,url:i,line:a,column:c,error:u}=e;if(dc()||u&&u.__sentry_own_request__)return;let f=u===void 0&&Ke(s)?tp(s,i,a,c):hc(ei(r,u||s,void 0,n,!1),i,a,c);f.level="error",pc(t,u,f,"onerror")})}function Qh(){me("unhandledrejection",e=>{let[t,r,n]=mc();if(!t.getIntegration(Yt))return;let s=e;try{"reason"in e?s=e.reason:"detail"in e&&"reason"in e.detail&&(s=e.detail.reason)}catch{}if(dc()||s&&s.__sentry_own_request__)return!0;let i=Lo(s)?ep(s):ei(r,s,void 0,n,!0);i.level="error",pc(t,s,i,"onunhandledrejection")})}function ep(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function tp(e,t,r,n){let s=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,i=Ms(e)?e.message:e,a="Error",c=i.match(s);return c&&(a=c[1],i=c[2]),hc({exception:{values:[{type:a,value:i}]}},t,r,n)}function hc(e,t,r,n){let s=e.exception=e.exception||{},i=s.values=s.values||[],a=i[0]=i[0]||{},c=a.stacktrace=a.stacktrace||{},u=c.frames=c.frames||[],f=isNaN(parseInt(n,10))?void 0:n,d=isNaN(parseInt(r,10))?void 0:r,p=Ke(t)&&t.length>0?t:_l();return u.length===0&&u.push({colno:f,filename:p,function:"?",in_app:!0,lineno:d}),e}function rp(e){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`Global Handler attached: ${e}`)}function pc(e,t,r,n){Sr(r,{handled:!1,type:n}),e.captureEvent(r,{originalException:t})}function mc(){let e=ee(),t=e.getClient(),r=t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[e,r.stackParser,r.attachStacktrace]}var np=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],ri=class{static __initStatic(){this.id="TryCatch"}constructor(e){this.name=ri.id,this._options=T({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},e)}setupOnce(){this._options.setTimeout&&se(F,"setTimeout",za),this._options.setInterval&&se(F,"setInterval",za),this._options.requestAnimationFrame&&se(F,"requestAnimationFrame",sp),this._options.XMLHttpRequest&&"XMLHttpRequest"in F&&se(XMLHttpRequest.prototype,"send",ip);let e=this._options.eventTarget;e&&(Array.isArray(e)?e:np).forEach(ap)}};ri.__initStatic();function za(e){return function(...t){let r=t[0];return t[0]=$t(r,{mechanism:{data:{function:Xe(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function sp(e){return function(t){return e.apply(this,[$t(t,{mechanism:{data:{function:"requestAnimationFrame",handler:Xe(e)},handled:!1,type:"instrument"}})])}}function ip(e){return function(...t){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(n=>{n in r&&typeof r[n]=="function"&&se(r,n,function(s){let i={mechanism:{data:{function:n,handler:Xe(s)},handled:!1,type:"instrument"}},a=Gs(s);return a&&(i.mechanism.data.handler=Xe(a)),$t(s,i)})}),e.apply(this,t)}}function ap(e){let t=F,r=t[e]&&t[e].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(se(r,"addEventListener",function(n){return function(s,i,a){try{typeof i.handleEvent=="function"&&(i.handleEvent=$t(i.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Xe(i),target:e},handled:!1,type:"instrument"}}))}catch{}return n.apply(this,[s,$t(i,{mechanism:{data:{function:"addEventListener",handler:Xe(i),target:e},handled:!1,type:"instrument"}}),a])}}),se(r,"removeEventListener",function(n){return function(s,i,a){let c=i;try{let u=c&&c.__sentry_wrapped__;u&&n.call(this,s,u,a)}catch{}return n.call(this,s,c,a)}}))}var nn=1024,Cn=class{static __initStatic(){this.id="Breadcrumbs"}constructor(e){this.name=Cn.id,this.options=T({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},e)}setupOnce(){if(this.options.console&&me("console",up),this.options.dom&&me("dom",cp(this.options.dom)),this.options.xhr&&me("xhr",dp),this.options.fetch&&me("fetch",lp),this.options.history&&me("history",fp),this.options.sentry){let e=ee().getClient();e&&e.on&&e.on("beforeSendEvent",op)}}};Cn.__initStatic();function op(e){ee().addBreadcrumb({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:He(e)},{event:e})}function cp(e){function t(r){let n,s=typeof e=="object"?e.serializeAttribute:void 0,i=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;i&&i>nn&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`\`dom.maxStringLength\` cannot exceed ${nn}, but a value of ${i} was configured. Sentry will use ${nn} instead.`),i=nn),typeof s=="string"&&(s=[s]);try{let a=r.event;n=hp(a)?Ut(a.target,{keyAttrs:s,maxStringLength:i}):Ut(a,{keyAttrs:s,maxStringLength:i})}catch{n="<unknown>"}n.length!==0&&ee().addBreadcrumb({category:`ui.${r.name}`,message:n},{event:r.event,name:r.name,global:r.global})}return t}function up(e){let t={category:"console",data:{arguments:e.args,logger:"console"},level:rf(e.level),message:xa(e.args," ")};if(e.level==="assert")if(e.args[0]===!1)t.message=`Assertion failed: ${xa(e.args.slice(1)," ")||"console.assert"}`,t.data.arguments=e.args.slice(1);else return;ee().addBreadcrumb(t,{input:e.args,level:e.level})}function dp(e){let{startTimestamp:t,endTimestamp:r}=e,n=e.xhr[kt];if(!t||!r||!n)return;let{method:s,url:i,status_code:a,body:c}=n,u={method:s,url:i,status_code:a},f={xhr:e.xhr,input:c,startTimestamp:t,endTimestamp:r};ee().addBreadcrumb({category:"xhr",data:u,type:"http"},f)}function lp(e){let{startTimestamp:t,endTimestamp:r}=e;if(r&&!(e.fetchData.url.match(/sentry_key/)&&e.fetchData.method==="POST"))if(e.error){let n=e.fetchData,s={data:e.error,input:e.args,startTimestamp:t,endTimestamp:r};ee().addBreadcrumb({category:"fetch",data:n,level:"error",type:"http"},s)}else{let n=V(T({},e.fetchData),{status_code:e.response&&e.response.status}),s={input:e.args,response:e.response,startTimestamp:t,endTimestamp:r};ee().addBreadcrumb({category:"fetch",data:n,type:"http"},s)}}function fp(e){let t=e.from,r=e.to,n=es(F.location.href),s=es(t),i=es(r);s.path||(s=n),n.protocol===i.protocol&&n.host===i.host&&(r=i.relative),n.protocol===s.protocol&&n.host===s.host&&(t=s.relative),ee().addBreadcrumb({category:"navigation",data:{from:t,to:r}})}function hp(e){return!!e&&!!e.target}var pp="cause",mp=5,Dn=class{static __initStatic(){this.id="LinkedErrors"}constructor(e={}){this.name=Dn.id,this._key=e.key||pp,this._limit=e.limit||mp}setupOnce(){}preprocessEvent(e,t,r){let n=r.getOptions();fl(lc,n.stackParser,n.maxValueLength,this._key,this._limit,e,t)}};Dn.__initStatic();var Nn=class{static __initStatic(){this.id="HttpContext"}constructor(){this.name=Nn.id}setupOnce(){}preprocessEvent(e){if(!F.navigator&&!F.location&&!F.document)return;let t=e.request&&e.request.url||F.location&&F.location.href,{referrer:r}=F.document||{},{userAgent:n}=F.navigator||{},s=T(T(T({},e.request&&e.request.headers),r&&{Referer:r}),n&&{"User-Agent":n}),i=V(T(T({},e.request),t&&{url:t}),{headers:s});e.request=i}};Nn.__initStatic();var kn=class{static __initStatic(){this.id="Dedupe"}constructor(){this.name=kn.id}setupOnce(e,t){}processEvent(e){if(e.type)return e;try{if(_p(e,this._previousEvent))return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return this._previousEvent=e}};kn.__initStatic();function _p(e,t){return t?!!(gp(e,t)||yp(e,t)):!1}function gp(e,t){let r=e.message,n=t.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!gc(e,t)||!_c(e,t))}function yp(e,t){let r=Fa(t),n=Fa(e);return!(!r||!n||r.type!==n.type||r.value!==n.value||!gc(e,t)||!_c(e,t))}function _c(e,t){let r=Ha(e),n=Ha(t);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let s=0;s<n.length;s++){let i=n[s],a=r[s];if(i.filename!==a.filename||i.lineno!==a.lineno||i.colno!==a.colno||i.function!==a.function)return!1}return!0}function gc(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function Fa(e){return e.exception&&e.exception.values&&e.exception.values[0]}function Ha(e){let t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}var yc={};Ao(yc,{Breadcrumbs:()=>Cn,Dedupe:()=>kn,GlobalHandlers:()=>Yt,HttpContext:()=>Nn,LinkedErrors:()=>Dn,TryCatch:()=>ri});var z=Q;function vp(){z&&z.document?z.document.addEventListener("visibilitychange",()=>{let e=Ar();if(z.document.hidden&&e){let t="cancelled";(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Transaction: ${t} -> since tab moved to the background, op: ${e.op}`),e.status||e.setStatus(t),e.setTag("visibilitychange","document.hidden"),e.finish()}}):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("[Tracing] Could not set up background tab detection due to lack of global document")}var ni=(e,t,r)=>{let n,s;return i=>{t.value>=0&&(i||r)&&(s=t.value-(n||0),(s||n===void 0)&&(n=t.value,t.delta=s,e(t)))}},bp=()=>`v3-${Date.now()}-${Math.floor(Math.random()*8999999999999)+1e12}`,xp=()=>{let e=z.performance.timing,t=z.performance.navigation.type,r={entryType:"navigation",startTime:0,type:t==2?"back_forward":t===1?"reload":"navigate"};for(let n in e)n!=="navigationStart"&&n!=="toJSON"&&(r[n]=Math.max(e[n]-e.navigationStart,0));return r},vc=()=>z.__WEB_VITALS_POLYFILL__?z.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||xp()):z.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0],bc=()=>{let e=vc();return e&&e.activationStart||0},si=(e,t)=>{let r=vc(),n="navigate";return r&&(z.document.prerendering||bc()>0?n="prerender":n=r.type.replace(/_/g,"-")),{name:e,value:typeof t>"u"?-1:t,rating:"good",delta:0,entries:[],id:bp(),navigationType:n}},Or=(e,t,r)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(s=>{t(s.getEntries())});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch{}},Pn=(e,t)=>{let r=n=>{(n.type==="pagehide"||z.document.visibilityState==="hidden")&&(e(n),t&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))};addEventListener("visibilitychange",r,!0),addEventListener("pagehide",r,!0)},Ep=e=>{let t=si("CLS",0),r,n=0,s=[],i=c=>{c.forEach(u=>{if(!u.hadRecentInput){let f=s[0],d=s[s.length-1];n&&s.length!==0&&u.startTime-d.startTime<1e3&&u.startTime-f.startTime<5e3?(n+=u.value,s.push(u)):(n=u.value,s=[u]),n>t.value&&(t.value=n,t.entries=s,r&&r())}})},a=Or("layout-shift",i);if(a){r=ni(e,t);let c=()=>{i(a.takeRecords()),r(!0)};return Pn(c),c}},fn=-1,Sp=()=>z.document.visibilityState==="hidden"&&!z.document.prerendering?0:1/0,wp=()=>{Pn(({timeStamp:e})=>{fn=e},!0)},ii=()=>(fn<0&&(fn=Sp(),wp()),{get firstHiddenTime(){return fn}}),Tp=e=>{let t=ii(),r=si("FID"),n,s=c=>{c.startTime<t.firstHiddenTime&&(r.value=c.processingStart-c.startTime,r.entries.push(c),n(!0))},i=c=>{c.forEach(s)},a=Or("first-input",i);n=ni(e,r),a&&Pn(()=>{i(a.takeRecords()),a.disconnect()},!0)},Wa={},Ip=e=>{let t=ii(),r=si("LCP"),n,s=a=>{let c=a[a.length-1];if(c){let u=Math.max(c.startTime-bc(),0);u<t.firstHiddenTime&&(r.value=u,r.entries=[c],n())}},i=Or("largest-contentful-paint",s);if(i){n=ni(e,r);let a=()=>{Wa[r.id]||(s(i.takeRecords()),i.disconnect(),Wa[r.id]=!0,n(!0))};return["keydown","click"].forEach(c=>{addEventListener(c,a,{once:!0,capture:!0})}),Pn(a,!0),a}};function ns(e){return typeof e=="number"&&isFinite(e)}function Lt(e,t){var r=t,{startTimestamp:n}=r,s=sl(r,["startTimestamp"]);return n&&e.startTimestamp>n&&(e.startTimestamp=n),e.startChild(T({startTimestamp:n},s))}function J(e){return e/1e3}function xc(){return z&&z.addEventListener&&z.performance}var Ka=0,X={},Ce,Er;function jp(){let e=xc();if(e&&Ne){e.mark&&z.performance.mark("sentry-tracing-init"),kp();let t=Dp(),r=Np();return()=>{t&&t(),r&&r()}}return()=>{}}function Rp(){Or("longtask",e=>{for(let t of e){let r=Ar();if(!r)return;let n=J(Ne+t.startTime),s=J(t.duration);r.startChild({description:"Main UI thread blocked",op:"ui.long-task",origin:"auto.ui.browser.metrics",startTimestamp:n,endTimestamp:n+s})}})}function Cp(){Or("event",e=>{for(let t of e){let r=Ar();if(!r)return;if(t.name==="click"){let n=J(Ne+t.startTime),s=J(t.duration);r.startChild({description:Ut(t.target),op:`ui.interaction.${t.name}`,origin:"auto.ui.browser.metrics",startTimestamp:n,endTimestamp:n+s})}}},{durationThreshold:0})}function Dp(){return Ep(e=>{let t=e.entries.pop();t&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding CLS"),X.cls={value:e.value,unit:""},Er=t)})}function Np(){return Ip(e=>{let t=e.entries.pop();t&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding LCP"),X.lcp={value:e.value,unit:"millisecond"},Ce=t)})}function kp(){Tp(e=>{let t=e.entries.pop();if(!t)return;let r=J(Ne),n=J(t.startTime);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding FID"),X.fid={value:e.value,unit:"millisecond"},X["mark.fid"]={value:r+n,unit:"second"}})}function Pp(e){let t=xc();if(!t||!z.performance.getEntries||!Ne)return;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Tracing] Adding & adjusting spans using Performance API");let r=J(Ne),n=t.getEntries(),s,i;if(n.slice(Ka).forEach(a=>{let c=J(a.startTime),u=J(a.duration);if(!(e.op==="navigation"&&r+c<e.startTimestamp))switch(a.entryType){case"navigation":{Op(e,a,r),s=r+J(a.responseStart),i=r+J(a.requestStart);break}case"mark":case"paint":case"measure":{Ap(e,a,c,u,r);let f=ii(),d=a.startTime<f.firstHiddenTime;a.name==="first-paint"&&d&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding FP"),X.fp={value:a.startTime,unit:"millisecond"}),a.name==="first-contentful-paint"&&d&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding FCP"),X.fcp={value:a.startTime,unit:"millisecond"});break}case"resource":{let f=a.name.replace(z.location.origin,"");Zp(e,a,f,c,u,r);break}}}),Ka=Math.max(n.length-1,0),$p(e),e.op==="pageload"){typeof s=="number"&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding TTFB"),X.ttfb={value:(s-e.startTimestamp)*1e3,unit:"millisecond"},typeof i=="number"&&i<=s&&(X["ttfb.requestTime"]={value:(s-i)*1e3,unit:"millisecond"})),["fcp","fp","lcp"].forEach(c=>{if(!X[c]||r>=e.startTimestamp)return;let u=X[c].value,f=r+J(u),d=Math.abs((f-e.startTimestamp)*1e3),p=d-u;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Measurements] Normalized ${c} from ${u} to ${d} (${p})`),X[c].value=d});let a=X["mark.fid"];a&&X.fid&&(Lt(e,{description:"first input delay",endTimestamp:a.value+J(X.fid.value),op:"ui.action",origin:"auto.ui.browser.metrics",startTimestamp:a.value}),delete X["mark.fid"]),"fcp"in X||delete X.cls,Object.keys(X).forEach(c=>{e.setMeasurement(c,X[c].value,X[c].unit)}),Lp(e)}Ce=void 0,Er=void 0,X={}}function Ap(e,t,r,n,s){let i=s+r,a=i+n;return Lt(e,{description:t.name,endTimestamp:a,op:t.entryType,origin:"auto.resource.browser.metrics",startTimestamp:i}),i}function Op(e,t,r){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(n=>{sn(e,t,n,r)}),sn(e,t,"secureConnection",r,"TLS/SSL","connectEnd"),sn(e,t,"fetch",r,"cache","domainLookupStart"),sn(e,t,"domainLookup",r,"DNS"),Up(e,t,r)}function sn(e,t,r,n,s,i){let a=i?t[i]:t[`${r}End`],c=t[`${r}Start`];!c||!a||Lt(e,{op:"browser",origin:"auto.browser.browser.metrics",description:s||r,startTimestamp:n+J(c),endTimestamp:n+J(a)})}function Up(e,t,r){Lt(e,{op:"browser",origin:"auto.browser.browser.metrics",description:"request",startTimestamp:r+J(t.requestStart),endTimestamp:r+J(t.responseEnd)}),Lt(e,{op:"browser",origin:"auto.browser.browser.metrics",description:"response",startTimestamp:r+J(t.responseStart),endTimestamp:r+J(t.responseEnd)})}function Zp(e,t,r,n,s,i){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;let a={};"transferSize"in t&&(a["http.response_transfer_size"]=t.transferSize),"encodedBodySize"in t&&(a["http.response_content_length"]=t.encodedBodySize),"decodedBodySize"in t&&(a["http.decoded_response_content_length"]=t.decodedBodySize),"renderBlockingStatus"in t&&(a["resource.render_blocking_status"]=t.renderBlockingStatus);let c=i+n,u=c+s;Lt(e,{description:r,endTimestamp:u,op:t.initiatorType?`resource.${t.initiatorType}`:"resource.other",origin:"auto.resource.browser.metrics",startTimestamp:c,data:a})}function $p(e){let t=z.navigator;if(!t)return;let r=t.connection;r&&(r.effectiveType&&e.setTag("effectiveConnectionType",r.effectiveType),r.type&&e.setTag("connectionType",r.type),ns(r.rtt)&&(X["connection.rtt"]={value:r.rtt,unit:"millisecond"})),ns(t.deviceMemory)&&e.setTag("deviceMemory",`${t.deviceMemory} GB`),ns(t.hardwareConcurrency)&&e.setTag("hardwareConcurrency",String(t.hardwareConcurrency))}function Lp(e){Ce&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding LCP Data"),Ce.element&&e.setTag("lcp.element",Ut(Ce.element)),Ce.id&&e.setTag("lcp.id",Ce.id),Ce.url&&e.setTag("lcp.url",Ce.url.trim().slice(0,200)),e.setTag("lcp.size",Ce.size)),Er&&Er.sources&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log("[Measurements] Adding CLS Data"),Er.sources.forEach((t,r)=>e.setTag(`cls.source.${r+1}`,Ut(t.node))))}var ws=["localhost",/^\/(?!\/)/],Ts={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,tracingOrigins:ws,tracePropagationTargets:ws};function Bp(e){let{traceFetch:t,traceXHR:r,tracePropagationTargets:n,tracingOrigins:s,shouldCreateSpanForRequest:i,enableHTTPTimings:a}=T({traceFetch:Ts.traceFetch,traceXHR:Ts.traceXHR},e),c=typeof i=="function"?i:d=>!0,u=d=>Gp(d,n||s),f={};t&&me("fetch",d=>{let p=Yp(d,c,u,f);a&&p&&Xa(p)}),r&&me("xhr",d=>{let p=Fp(d,c,u,f);a&&p&&Xa(p)})}function Mp(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function Xa(e){let t=e.data.url,r=new PerformanceObserver(n=>{n.getEntries().forEach(s=>{Mp(s)&&s.name.endsWith(t)&&(qp(s).forEach(i=>e.setData(...i)),r.disconnect())})});r.observe({entryTypes:["resource"]})}function Vp(e){let t="unknown",r="unknown",n="";for(let s of e){if(s==="/"){[t,r]=e.split("/");break}if(!isNaN(Number(s))){t=n==="h"?"http":n,r=e.split(n)[1];break}n+=s}return n===e&&(t=n),{name:t,version:r}}function Re(e=0){return((Ne||performance.timeOrigin)+e)/1e3}function qp(e){let{name:t,version:r}=Vp(e.nextHopProtocol),n=[];return n.push(["network.protocol.version",r],["network.protocol.name",t]),Ne?[...n,["http.request.redirect_start",Re(e.redirectStart)],["http.request.fetch_start",Re(e.fetchStart)],["http.request.domain_lookup_start",Re(e.domainLookupStart)],["http.request.domain_lookup_end",Re(e.domainLookupEnd)],["http.request.connect_start",Re(e.connectStart)],["http.request.secure_connection_start",Re(e.secureConnectionStart)],["http.request.connection_end",Re(e.connectEnd)],["http.request.request_start",Re(e.requestStart)],["http.request.response_start",Re(e.responseStart)],["http.request.response_end",Re(e.responseEnd)]]:n}function Gp(e,t){return Dr(e,t||ws)}function Yp(e,t,r,n){if(!Ks()||!e.fetchData)return;let s=t(e.fetchData.url);if(e.endTimestamp&&s){let _=e.fetchData.__span;if(!_)return;let m=n[_];if(m){if(e.response){m.setHttpStatus(e.response.status);let x=e.response&&e.response.headers&&e.response.headers.get("content-length"),w=parseInt(x);w>0&&m.setData("http.response_content_length",w)}else e.error&&m.setStatus("internal_error");m.finish(),delete n[_]}return}let i=ee(),a=i.getScope(),c=i.getClient(),u=a.getSpan(),{method:f,url:d}=e.fetchData,p=s&&u?u.startChild({data:{url:d,type:"fetch","http.method":f},description:`${f} ${d}`,op:"http.client",origin:"auto.http.browser"}):void 0;if(p&&(e.fetchData.__span=p.spanId,n[p.spanId]=p),r(e.fetchData.url)&&c){let _=e.args[0];e.args[1]=e.args[1]||{};let m=e.args[1];m.headers=zp(_,c,a,m,p)}return p}function zp(e,t,r,n,s){let i=s||r.getSpan(),a=i&&i.transaction,{traceId:c,sampled:u,dsc:f}=r.getPropagationContext(),d=i?i.toTraceparent():zs(c,void 0,u),p=a?a.getDynamicSamplingContext():f||jn(c,t,r),_=ys(p),m=typeof Request<"u"&&Be(e,Request)?e.headers:n.headers;if(m)if(typeof Headers<"u"&&Be(m,Headers)){let x=new Headers(m);return x.append("sentry-trace",d),_&&x.append(gs,_),x}else if(Array.isArray(m)){let x=[...m,["sentry-trace",d]];return _&&x.push([gs,_]),x}else{let x="baggage"in m?m.baggage:void 0,w=[];return Array.isArray(x)?w.push(...x):x&&w.push(x),_&&w.push(_),V(T({},m),{"sentry-trace":d,baggage:w.length>0?w.join(","):void 0})}else return{"sentry-trace":d,baggage:_}}function Fp(e,t,r,n){let s=e.xhr,i=s&&s[kt];if(!Ks()||s&&s.__sentry_own_request__||!s||!i)return;let a=t(i.url);if(e.endTimestamp&&a){let p=s.__sentry_xhr_span_id__;if(!p)return;let _=n[p];_&&(_.setHttpStatus(i.status_code),_.finish(),delete n[p]);return}let c=ee(),u=c.getScope(),f=u.getSpan(),d=a&&f?f.startChild({data:V(T({},i.data),{type:"xhr","http.method":i.method,url:i.url}),description:`${i.method} ${i.url}`,op:"http.client",origin:"auto.http.browser"}):void 0;if(d&&(s.__sentry_xhr_span_id__=d.spanId,n[s.__sentry_xhr_span_id__]=d),s.setRequestHeader&&r(i.url))if(d){let p=d&&d.transaction,_=p&&p.getDynamicSamplingContext(),m=ys(_);Ja(s,d.toTraceparent(),m)}else{let p=c.getClient(),{traceId:_,sampled:m,dsc:x}=u.getPropagationContext(),w=zs(_,void 0,m),R=x||(p?jn(_,p,u):void 0),P=ys(R);Ja(s,w,P)}return d}function Ja(e,t,r){try{e.setRequestHeader("sentry-trace",t),r&&e.setRequestHeader(gs,r)}catch{}}function Hp(e,t=!0,r=!0){if(!z||!z.location){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn("Could not initialize routing instrumentation due to invalid location");return}let n=z.location.href,s;t&&(s=e({name:z.location.pathname,startTimestamp:Ne?Ne/1e3:void 0,op:"pageload",origin:"auto.pageload.browser",metadata:{source:"url"}})),r&&me("history",({to:i,from:a})=>{if(a===void 0&&n&&n.indexOf(i)!==-1){n=void 0;return}a!==i&&(n=void 0,s&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Finishing current transaction with op: ${s.op}`),s.finish()),s=e({name:z.location.pathname,op:"navigation",origin:"auto.navigation.browser",metadata:{source:"url"}}))})}var Wp="BrowserTracing",Kp=T(V(T({},ln),{markBackgroundTransactions:!0,routingInstrumentation:Hp,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0,enableLongTask:!0,_experiments:{}}),Ts),Xp=class{constructor(e){this.name=Wp,this._hasSetTracePropagationTargets=!1,Bf(),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&(this._hasSetTracePropagationTargets=!!(e&&(e.tracePropagationTargets||e.tracingOrigins))),this.options=T(T({},Kp),e),this.options._experiments.enableLongTask!==void 0&&(this.options.enableLongTask=this.options._experiments.enableLongTask),e&&!e.tracePropagationTargets&&e.tracingOrigins&&(this.options.tracePropagationTargets=e.tracingOrigins),this._collectWebVitals=jp(),this.options.enableLongTask&&Rp(),this.options._experiments.enableInteractions&&Cp()}setupOnce(e,t){this._getCurrentHub=t;let r=t().getClient(),n=r&&r.getOptions(),{routingInstrumentation:s,startTransactionOnLocationChange:i,startTransactionOnPageLoad:a,markBackgroundTransactions:c,traceFetch:u,traceXHR:f,shouldCreateSpanForRequest:d,enableHTTPTimings:p,_experiments:_}=this.options,m=n&&n.tracePropagationTargets,x=m||this.options.tracePropagationTargets;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&this._hasSetTracePropagationTargets&&m&&N.warn("[Tracing] The `tracePropagationTargets` option was set in the BrowserTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used."),s(w=>{let R=this._createRouteTransaction(w);return this.options._experiments.onStartRouteTransaction&&this.options._experiments.onStartRouteTransaction(R,w,t),R},a,i),c&&vp(),_.enableInteractions&&this._registerInteractionListener(),Bp({traceFetch:u,traceXHR:f,tracePropagationTargets:x,shouldCreateSpanForRequest:d,enableHTTPTimings:p})}_createRouteTransaction(e){if(!this._getCurrentHub){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`[Tracing] Did not create ${e.op} transaction because _getCurrentHub is invalid.`);return}let t=this._getCurrentHub(),{beforeNavigate:r,idleTimeout:n,finalTimeout:s,heartbeatInterval:i}=this.options,a=e.op==="pageload",c=a?Qa("sentry-trace"):"",u=a?Qa("baggage"):"",{traceparentData:f,dynamicSamplingContext:d,propagationContext:p}=ff(c,u),_=V(T(T({},e),f),{metadata:V(T({},e.metadata),{dynamicSamplingContext:f&&!d?{}:d}),trimEnd:!0}),m=typeof r=="function"?r(_):_,x=m===void 0?V(T({},_),{sampled:!1}):m;x.metadata=x.name!==_.name?V(T({},x.metadata),{source:"custom"}):x.metadata,this._latestRouteName=x.name,this._latestRouteSource=x.metadata&&x.metadata.source,x.sampled===!1&&(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Will not send ${x.op} transaction because of beforeNavigate.`),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.log(`[Tracing] Starting ${x.op} transaction on scope`);let{location:w}=z,R=La(t,x,n,s,!0,{location:w},i),P=t.getScope();return a&&f?P.setPropagationContext(p):P.setPropagationContext({traceId:R.traceId,spanId:R.spanId,parentSpanId:R.parentSpanId,sampled:R.sampled}),R.registerBeforeFinishCallback(k=>{this._collectWebVitals(),Pp(k)}),R}_registerInteractionListener(){let e,t=()=>{let{idleTimeout:r,finalTimeout:n,heartbeatInterval:s}=this.options,i="ui.action.click",a=Ar();if(a&&a.op&&["navigation","pageload"].includes(a.op)){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`[Tracing] Did not create ${i} transaction because a pageload or navigation transaction is in progress.`);return}if(e&&(e.setFinishReason("interactionInterrupted"),e.finish(),e=void 0),!this._getCurrentHub){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`[Tracing] Did not create ${i} transaction because _getCurrentHub is invalid.`);return}if(!this._latestRouteName){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&N.warn(`[Tracing] Did not create ${i} transaction because _latestRouteName is missing.`);return}let c=this._getCurrentHub(),{location:u}=z,f={name:this._latestRouteName,op:i,trimEnd:!0,metadata:{source:this._latestRouteSource||"url"}};e=La(c,f,r,n,!0,{location:u},s)};["click"].forEach(r=>{addEventListener(r,t,{once:!1,capture:!0})})}};function Qa(e){let t=gl(`meta[name=${e}]`);return t?t.getAttribute("content"):void 0}var Ec={};F.Sentry&&F.Sentry.Integrations&&(Ec=F.Sentry.Integrations);T(T(T({},Ec),uc),yc);var Jp="https://d233059272824702afc8c43834c4912d@sentry.hcaptcha.com/6",an=null;function Sc(e,t){if(e===!1)return ss(e);if(an)return ss(an,t);let r=new Dh({dsn:Jp,transport:window.fetch?Ph:Oh,stackParser:Xh,integrations:[new Cn,new Yt,new Dn,new kn,new Nn,new Xp]});return an=new Ws(r),ss(an,t)}function ss(e,t={key:"source",value:"@hCaptcha/loader"}){return{addBreadcrumb:r=>{e&&e.addBreadcrumb(r)},captureMessage:r=>{e&&e.withScope(function(n){n.setTag(t.key,t.value),e.captureMessage(r)})},captureException:r=>{e&&e.withScope(function(n){n.setTag(t.key,t.value),e.captureEvent({message:os,level:"error",extra:r})})}}}function Qp({scriptLocation:e,query:t,loadAsync:r=!0,crossOrigin:n,apihost:s="https://js.hcaptcha.com",cleanup:i=!0,secureApi:a=!1,scriptSource:c=""}={}){let u=Uo(e),f=Oo(u);return new Promise((d,p)=>{let _=f.document.createElement("script");_.id=al,c?_.src=`${c}?onload=${un}`:a?_.src=`${s}/1/secure-api.js?onload=${un}`:_.src=`${s}/1/api.js?onload=${un}`,_.crossOrigin=n,_.async=r;let m=(x,w)=>{try{!a&&i&&u.removeChild(_),w(x)}catch(R){p(R)}};_.onload=x=>m(x,d),_.onerror=x=>m(x,p),_.src+=t!==""?`&${t}`:"",u.appendChild(_)})}var on=[];function em(e={cleanup:!0},t){try{t.addBreadcrumb({category:Dt,message:"hCaptcha loader params",data:e});let r=Uo(e.scriptLocation),n=Oo(r),s=on.find(({scope:a})=>a===n.window);if(s)return t.addBreadcrumb({category:Dt,message:"hCaptcha already loaded"}),s.promise;let i=new Promise((a,c)=>Bs(this,null,function*(){try{n.window[un]=()=>{t.addBreadcrumb({category:Dt,message:"hCaptcha script called onload function"}),a(n.window.hcaptcha)};let u=il({custom:e.custom,render:e.render,sentry:e.sentry,assethost:e.assethost,imghost:e.imghost,reportapi:e.reportapi,endpoint:e.endpoint,host:e.host,recaptchacompat:e.recaptchacompat,hl:e.hl});yield Qp(T({query:u},e)),t.addBreadcrumb({category:Dt,message:"hCaptcha loaded",data:s})}catch(u){t.addBreadcrumb({category:Dt,message:"hCaptcha failed to load",data:u});let f=on.findIndex(d=>d.scope===n.window);f!==-1&&on.splice(f,1),t.captureException(u),c(new Error(os))}}));return on.push({promise:i,scope:n.window}),i}catch(r){return t.captureException(r),Promise.reject(new Error(os))}}function wc(e,t=0){return Bs(this,null,function*(){let r=t<2?"Retry loading hCaptcha Api":"Exceeded maximum retries",n=Sc(e.sentry);try{return yield em(e,n)}catch(s){return n.addBreadcrumb({SENTRY_SOURCE:Dt,message:r,data:{error:s}}),t>=2?(n.captureException(s),Promise.reject(s)):(t+=1,wc(e,t))}})}function tm(){return Bs(this,arguments,function*(e={}){return yield wc(e)})}function eo(e){var t=e&&e.ownerDocument||document,r=t.defaultView||t.parentWindow||window;return{document:t,window:r}}function to(e){return e||document.head}var Ct={key:"source",value:"@hCaptcha/react"},vr={mounted:"hCaptcha component mounted",expired:"hCaptcha expired",unmounted:"hCaptcha component unmounted",reset:"hCaptcha reset",removed:"hCaptcha removed"},rm=function(e){tl(t,e);function t(n){var s;return s=e.call(this,n)||this,s._hcaptcha=void 0,s.renderCaptcha=s.renderCaptcha.bind(he(s)),s.resetCaptcha=s.resetCaptcha.bind(he(s)),s.removeCaptcha=s.removeCaptcha.bind(he(s)),s.isReady=s.isReady.bind(he(s)),s._onReady=null,s.loadCaptcha=s.loadCaptcha.bind(he(s)),s.handleOnLoad=s.handleOnLoad.bind(he(s)),s.handleSubmit=s.handleSubmit.bind(he(s)),s.handleExpire=s.handleExpire.bind(he(s)),s.handleError=s.handleError.bind(he(s)),s.handleOpen=s.handleOpen.bind(he(s)),s.handleClose=s.handleClose.bind(he(s)),s.handleChallengeExpired=s.handleChallengeExpired.bind(he(s)),s.ref=S.createRef(),s.apiScriptRequested=!1,s.sentryHub=null,s.captchaId="",s.state={isApiReady:!1,isRemoved:!1,elementId:n.id},s}var r=t.prototype;return r.componentDidMount=function(){var s=this,i=to(this.props.scriptLocation),a=eo(i);this._hcaptcha=a.window.hcaptcha||void 0;var c=typeof this._hcaptcha<"u";if(this.sentryHub=Sc(this.props.sentry,Ct),this.sentryHub.addBreadcrumb({category:Ct.value,message:vr.mounted}),c){this.setState({isApiReady:!0},function(){s.renderCaptcha()});return}this.loadCaptcha()},r.componentWillUnmount=function(){var s=this._hcaptcha,i=this.captchaId;this.isReady()&&(s.reset(i),s.remove(i),this.sentryHub.addBreadcrumb({category:Ct.value,message:vr.unmounted}))},r.shouldComponentUpdate=function(s,i){return!(this.state.isApiReady!==i.isApiReady||this.state.isRemoved!==i.isRemoved)},r.componentDidUpdate=function(s){var i=this,a=["sitekey","size","theme","tabindex","languageOverride","endpoint"],c=a.every(function(u){return s[u]===i.props[u]});c||this.removeCaptcha(function(){i.renderCaptcha()})},r.loadCaptcha=function(){if(!this.apiScriptRequested){var s=this.props,i=s.apihost,a=s.assethost,c=s.endpoint,u=s.host,f=s.imghost,d=s.languageOverride,p=s.reCaptchaCompat,_=s.reportapi,m=s.sentry,x=s.custom,w=s.loadAsync,R=s.scriptLocation,P=s.scriptSource,k=s.secureApi,A=s.cleanup,I=A===void 0?!0:A,Z={render:"explicit",apihost:i,assethost:a,endpoint:c,hl:d,host:u,imghost:f,recaptchacompat:p===!1?"off":null,reportapi:_,sentry:m,custom:x,loadAsync:w,scriptLocation:R,scriptSource:P,secureApi:k,cleanup:I};tm(Z).then(this.handleOnLoad,this.handleError).catch(this.handleError),this.apiScriptRequested=!0}},r.renderCaptcha=function(s){var i=this,a=this.props.onReady,c=this.state.isApiReady,u=this.captchaId;if(!(!c||u)){var f=Object.assign({"open-callback":this.handleOpen,"close-callback":this.handleClose,"error-callback":this.handleError,"chalexpired-callback":this.handleChallengeExpired,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),d=this._hcaptcha,p=d.render(this.ref.current,f);this.captchaId=p,this.setState({isRemoved:!1},function(){s&&s(),a&&a(),i._onReady&&i._onReady(p)})}},r.resetCaptcha=function(){var s=this._hcaptcha,i=this.captchaId;this.isReady()&&(s.reset(i),this.sentryHub.addBreadcrumb({category:Ct.value,message:vr.reset}))},r.removeCaptcha=function(s){var i=this._hcaptcha,a=this.captchaId;this.isReady()&&(this.setState({isRemoved:!0},function(){i.remove(a),s&&s()}),this.sentryHub.addBreadcrumb({category:Ct.value,message:vr.removed}))},r.handleOnLoad=function(){var s=this;this.setState({isApiReady:!0},function(){try{var i=to(s.props.scriptLocation),a=eo(i);s._hcaptcha=a.window.hcaptcha,s.renderCaptcha(function(){var c=s.props.onLoad;c&&c()})}catch(c){s.sentryHub.captureException(c)}})},r.handleSubmit=function(s){var i=this.props.onVerify,a=this.state.isRemoved,c=this._hcaptcha,u=this.captchaId;if(!(typeof c>"u"||a)){var f=c.getResponse(u),d=c.getRespKey(u);i&&i(f,d)}},r.handleExpire=function(){var s=this.props.onExpire,i=this._hcaptcha,a=this.captchaId;this.isReady()&&(i.reset(a),s&&s(),this.sentryHub.addBreadcrumb({category:Ct.value,message:vr.expired}))},r.handleError=function(s){var i=this.props.onError,a=this._hcaptcha,c=this.captchaId;this.isReady()&&a.reset(c),i&&i(s)},r.isReady=function(){var s=this.state,i=s.isApiReady,a=s.isRemoved;return i&&!a},r.handleOpen=function(){!this.isReady()||!this.props.onOpen||this.props.onOpen()},r.handleClose=function(){!this.isReady()||!this.props.onClose||this.props.onClose()},r.handleChallengeExpired=function(){!this.isReady()||!this.props.onChalExpired||this.props.onChalExpired()},r.execute=function(s){var i=this;s===void 0&&(s=null),s=typeof s=="object"?s:null;try{var a=this._hcaptcha,c=this.captchaId;if(!this.isReady()){var u,f=new Promise(function(d,p){i._onReady=function(_){try{var m=i._hcaptcha;s&&s.async?m.execute(_,s).then(d).catch(p):d(m.execute(_,s))}catch(x){p(x)}}});return(u=s)!=null&&u.async?f:null}return a.execute(c,s)}catch(d){return this.sentryHub.captureException(d),s&&s.async?Promise.reject(d):null}},r.close=function(){var s=this._hcaptcha,i=this.captchaId;if(this.isReady())return s.close(i)},r.setData=function(s){var i=this._hcaptcha,a=this.captchaId;this.isReady()&&(s&&typeof s!="object"&&(s=null),i.setData(a,s))},r.getResponse=function(){var s=this._hcaptcha;return s.getResponse(this.captchaId)},r.getRespKey=function(){var s=this._hcaptcha;return s.getRespKey(this.captchaId)},r.render=function(){var s=this.state.elementId;return S.createElement("div",{ref:this.ref,id:s})},t}(S.Component);const mt=typeof window>"u"?null:window.matchMedia("(prefers-color-scheme: dark)");function nm(){const[e,t]=S.useState(mt!=null&&mt.matches?"dark":"light");return S.useEffect(()=>{if(!mt)return;const r=()=>{t(mt.matches?"dark":"light")};return mt.addEventListener("change",r),()=>{mt.removeEventListener("change",r)}},[]),e}function sm({siteKey:e,token:t,onToken:r,prevLabel:n,onPrev:s,nextLabel:i,onNext:a,ref:c,invalid:u,children:f,...d}){const p=S.useRef(null),_=nm(),[m,x]=S.useState(t),w=S.useCallback(()=>{var k;(k=p.current)==null||k.execute()},[]),R=S.useCallback((k,A)=>{x(k),r(k,A)},[r]),P=S.useCallback(k=>{if(m)return a(k);if(p.current)p.current.execute();else throw new Error("Unable to load hCaptcha")},[m,a]);return l.jsx(Vt,{...d,cancelLabel:n,onCancel:s,submitLabel:i,onSubmit:P,append:f,invalid:u||!m,children:l.jsx(rm,{theme:_,sitekey:e,onLoad:w,onVerify:R,ref:Je([c,p])})})}function im({customizationData:{availableUserDomains:e=[],hcaptchaSiteKey:t=void 0,inviteCodeRequired:r=!0,links:n}={},onValidateNewHandle:s,onDone:i,onBack:a,backLabel:c,title:u,subtitle:f,...d}){const{i18n:p,_}=G(),[m,x]=S.useState(void 0),[w,R]=S.useState(void 0),[P,k]=S.useState(void 0),A=t==null?void 0:P||!1,I=S.useCallback(Z=>{if(m&&w&&A!==!1)return i({...m,handle:w,hcaptchaToken:A},Z)},[m,w,A,i]);return l.jsxs(Ee,{...d,title:u??p._({id:"IS0nrP"}),subtitle:f??l.jsx(C,{id:"qjBGxf"}),children:[l.jsx(Hd,{doneLabel:l.jsx(C,{id:"e+RpCP"}),onBack:a,backLabel:c,onDone:I,steps:[{invalid:!w,titleRender:()=>l.jsx(C,{id:"khEQ02"}),contentRender:({prev:Z,prevLabel:B,next:M,nextLabel:K,invalid:H})=>l.jsx(el,{className:"grow",invalid:H,domains:e,handle:w,onHandle:R,prevLabel:B,onPrev:Z,nextLabel:K,onNext:async ue=>{if(w&&await s({handle:w},ue),!ue.aborted)return M(ue)},children:l.jsx(Jn,{links:n})})},{invalid:!m,titleRender:()=>l.jsx(C,{id:"gdRnT7"}),contentRender:({prev:Z,prevLabel:B,next:M,nextLabel:K,invalid:H})=>l.jsx(Kd,{className:"grow",invalid:H,prevLabel:B,onPrev:Z,nextLabel:K,onNext:M,inviteCodeRequired:r,credentials:m,onCredentials:x,children:l.jsx(Jn,{links:n})})},t!=null&&{invalid:A===!1,titleRender:()=>l.jsx(C,{id:"aIar4b"}),contentRender:({prev:Z,prevLabel:B,next:M,nextLabel:K,invalid:H})=>l.jsx(sm,{className:"grow",invalid:H,siteKey:t,token:P,onToken:k,prevLabel:B,onPrev:Z,nextLabel:K,onNext:M,children:l.jsx(Jn,{links:n})})}]}),l.jsx(Wd,{className:"mt-4",links:n})]})}function am({onSignUp:e,onSignIn:t,onCancel:r,...n}){const{i18n:s,_:i}=G();return l.jsxs(Iu,{...n,title:n.title??s._({id:"OX6vme"}),children:[e&&l.jsx(ae,{className:"m-1 w-60 min-w-min max-w-full",color:t?"primary":void 0,onClick:e,children:l.jsx(C,{id:"mpt9T+"})}),t&&l.jsx(ae,{className:"m-1 w-60 min-w-min max-w-full",color:e?void 0:"primary",onClick:t,children:l.jsx(C,{id:"yKDCQ1"})}),r&&l.jsx(ae,{className:"m-1 w-60 min-w-min max-w-full",onClick:r,children:l.jsx(C,{id:"dEgA5A"})})]})}function om(e,t,r,n){return e==="create"&&t?1:r||!t||n?2:0}function cm({authorizeData:e,initialSessions:t,customizationData:r,...n}){var Ft;const{i18n:s,_:i}=G(),a=e.loginHint!=null,c=!!t.length,u=!!((Ft=r==null?void 0:r.availableUserDomains)!=null&&Ft.length),f=!a&&u,d=om(e.promptMode,u,a,c),[p,_]=S.useState(d),m=It(_,5),x=It(_,2),w=It(_,3),R=It(_,1),P=It(_,4),[k,A]=S.useState(void 0),{sessions:I,selectSub:Z,doValidateNewHandle:B,doSignUp:M,doSignIn:K,doInitiatePasswordReset:H,doConfirmResetPassword:ue,doConsent:q,doReject:ne}=Ou({sessions:t,onRedirected:m}),Y=!f||I.length?2:0,de=It(_,Y),zt=f?R:void 0,_e=I.find(Me=>Me.selected&&!Me.loginRequired);if(S.useEffect(()=>{_e&&(_e.consentRequired?P():q(_e.account.sub))},[_e,q,P]),S.useEffect(()=>{p===1&&!f&&_(Y)},[p,Y,!f]),S.useEffect(()=>{p===4&&!_e&&_(Y)},[p,Y,!_e]),S.useEffect(()=>{p===0&&Y!==0&&_(Y)},[p,Y]),p===0)return l.jsx(am,{...n,customizationData:r,onSignIn:x,onSignUp:zt,onCancel:ne});if(p===1)return l.jsx(im,{...n,customizationData:r,onValidateNewHandle:B,onBack:de,onDone:M});if(p===3)return l.jsx(Bd,{...n,emailDefault:k,onresetPasswordRequest:H,onResetPasswordConfirm:ue,onBack:de});if(p===2)return l.jsx(Gd,{...n,loginHint:e.loginHint,sessions:I,selectSub:Z,onSignIn:K,onSignUp:zt,onBack:Y===2?ne:de,backLabel:Y===2?s._({id:"dEgA5A"}):void 0,onForgotPassword:Me=>{w(),A(Me)}});if(p===4)return _e?l.jsx(Rd,{...n,clientId:e.clientId,clientMetadata:e.clientMetadata,clientTrusted:e.clientTrusted,clientFirstParty:e.clientFirstParty,permissionSets:e.permissionSets,account:_e.account,scope:e.scope,onConsent:Me=>q(_e.account.sub,Me),onReject:ne,onBack:a?void 0:()=>{Z(null),de()}}):null;if(p===5)return l.jsx(Ee,{...n,title:n.title??s._({id:"UCOd1e"}),children:l.jsx(C,{id:"qq6QQ5"})});throw new Error("Unexpected application state")}const{__authorizeData:yn,__customizationData:ro,__sessions:um}=window,_t=new URL(window.location.href);_t.pathname==="/oauth/authorize"&&!_t.searchParams.has("request_uri")&&(_t.search="",_t.searchParams.set("client_id",yn.clientId),_t.searchParams.set("request_uri",yn.requestUri),window.history.replaceState(history.state,"",_t.pathname+_t.search));const dm=document.getElementById("root");var no;ju.createRoot(dm).render(l.jsx(S.StrictMode,{children:l.jsx(Ru,{userLocales:(no=yn.uiLocales)==null?void 0:no.split(" "),children:l.jsx(Du,{fallbackRender:({error:e})=>l.jsx(Cu,{error:e,customizationData:ro}),children:l.jsx(cm,{authorizeData:yn,customizationData:ro,initialSessions:um})})})}))});export default lm();
20
+ //# sourceMappingURL=authorization-page-rtYWhk8x.js.map