@mcpjam/inspector 1.0.10 → 1.0.11
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"
|
|
1
|
+
(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"ab7117357aec98811abcabe505c36dc2e49dcdc5"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="130de1bc-d683-45db-aa72-7a7d76812823",t._sentryDebugIdIdentifier="sentry-dbid-130de1bc-d683-45db-aa72-7a7d76812823")})()}catch{}function OX(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function nh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var TS={exports:{}},bp={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -1778,7 +1778,7 @@ An authorization_code was supplied for a login which did not originate at the ap
|
|
|
1778
1778
|
|
|
1779
1779
|
* This could have been an attempted Login CSRF attack. You were not affected.
|
|
1780
1780
|
* The developer may not have configured a Login Initiation endpoint.`);const i=new URL(window.location.toString());i.search="",window.sessionStorage.removeItem(ss.codeVerifier),window.history.replaceState({},"",i)};hm=async function(){ar(this,gx,setTimeout(()=>{Kn(this,In,wN).call(this)&&Vt(this,vx).call(this)?Kn(this,In,pm).call(this).catch(t=>{console.debug(t)}).finally(()=>Kn(this,In,hm).call(this)):Kn(this,In,hm).call(this)},1e3))};pm=async function({organizationId:t}={}){if(Vt(this,yr).tag==="AUTHENTICATING"){await Vt(this,yr).response;return}const e=Vt(this,yr);ar(this,yr,{tag:"AUTHENTICATING",response:Kn(this,In,Wq).call(this,{organizationId:t,beginningState:e})}),await Vt(this,yr).response};Wq=async function({organizationId:t,beginningState:e}){try{return await dme(vme,async()=>{if(t)sessionStorage.setItem(W3,t);else{const r=Kn(this,In,SN).call(this);r?t=X0(r)?.org_id:t=sessionStorage.getItem(W3)??void 0}const n=await Vt(this,uu).authenticateWithRefreshToken({refreshToken:qq({devMode:Vt(this,Ia)}),organizationId:t,useCookie:Vt(this,In,EN)});return ar(this,yr,{tag:"AUTHENTICATED"}),Bq(n,{devMode:Vt(this,Ia)}),Kn(this,In,kN).call(this,n),n})}catch(n){throw n instanceof _N&&n.name==="AcquisitionTimeoutError"?(console.warn("Couldn't acquire refresh lock."),ar(this,yr,e),n):(e.tag!=="INITIAL"&&console.debug(n),n instanceof mx?(Hq({devMode:Vt(this,Ia)}),e.tag!=="INITIAL"&&Vt(this,Km)&&Vt(this,Km).call(this,{signIn:this.signIn.bind(this)}),ar(this,yr,{tag:"ERROR"})):ar(this,yr,{tag:"AUTHENTICATED"}),n)}};wN=function(){switch(Vt(this,yr).tag){case"INITIAL":case"AUTHENTICATING":return!0;case"ERROR":return!1;case"AUTHENTICATED":const t=Ps.getItem(ss.accessToken),e=Ps.getItem(ss.expiresAt);if(!t||!e)return!0;const n=Vt(this,bx)*1e3;return e-n<Date.now()}};nm=async function({context:t,invitationToken:e,loginHint:n,organizationId:r,passwordResetToken:s,state:i,type:a}){const{codeVerifier:l,codeChallenge:c}=await eme();return window.sessionStorage.setItem(ss.codeVerifier,l),Vt(this,uu).getAuthorizationUrl({codeChallenge:c,codeChallengeMethod:"S256",context:t,invitationToken:e,loginHint:n,organizationId:r,passwordResetToken:s,redirectUri:Vt(this,fm),screenHint:a,state:i?JSON.stringify(i):void 0})};SN=function(){return Ps.getItem(ss.accessToken)};EN=function(){return!Vt(this,Ia)};kN=async function(t){if(Vt(this,Ym)){const{refreshToken:e,...n}=t;Vt(this,Ym).call(this,n)}};async function bme(t,e={}){const n=new yme(t,e);return await n.initialize(),n}var xme=Object.defineProperty,_me=Object.defineProperties,wme=Object.getOwnPropertyDescriptors,Y3=Object.getOwnPropertySymbols,Sme=Object.prototype.hasOwnProperty,Eme=Object.prototype.propertyIsEnumerable,K3=(t,e,n)=>e in t?xme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wy=(t,e)=>{for(var n in e||(e={}))Sme.call(e,n)&&K3(t,n,e[n]);if(Y3)for(var n of Y3(e))Eme.call(e,n)&&K3(t,n,e[n]);return t},X3=(t,e)=>_me(t,wme(e)),cb=(t,e,n)=>new Promise((r,s)=>{var i=c=>{try{l(n.next(c))}catch(d){s(d)}},a=c=>{try{l(n.throw(c))}catch(d){s(d)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,a);l((n=n.apply(t,e)).next())}),xx={isLoading:!0,user:null,role:null,organizationId:null,permissions:[],featureFlags:[],impersonator:null},Yq=w.createContext(xx);function va(){const t=w.useContext(Yq);if(t===xx)throw new Error("useAuth must be used within an AuthKitProvider");return t}function kme(t){const{clientId:e,devMode:n,apiHostname:r,https:s,port:i,redirectUri:a,children:l,onRefresh:c,onRefreshFailure:d,onRedirectCallback:p,refreshBufferInterval:h}=t,[g,v]=w.useState(Q3),[b,x]=w.useState(xx),E=w.useCallback(S=>{const{user:k,accessToken:T,organizationId:N=null,impersonator:j=null}=S,{role:A=null,permissions:R=[],feature_flags:M=[]}=X0(T);x(P=>{const O=X3(wy({},P),{user:k,organizationId:N,role:A,permissions:R,featureFlags:M,impersonator:j});return Tme(P,O)?P:O}),c?.(S)},[g]);return w.useEffect(()=>{function S(){const k=setTimeout(()=>{bme(e,{apiHostname:r,port:i,https:s,redirectUri:a,devMode:n,onRedirectCallback:p,onRefresh:E,onRefreshFailure:d,refreshBufferInterval:h}).then(T=>cb(this,null,function*(){const N=T.getUser();v({getAccessToken:T.getAccessToken.bind(T),getUser:T.getUser.bind(T),signIn:T.signIn.bind(T),signUp:T.signUp.bind(T),signOut:T.signOut.bind(T),switchToOrganization:T.switchToOrganization.bind(T)}),x(j=>X3(wy({},j),{isLoading:!1,user:N}))}))});return()=>{clearTimeout(k)}}return v(Q3),x(xx),S()},[e,r,s,i,a,h]),w.createElement(Yq.Provider,{value:wy(wy({},g),b)},l)}function Tme(t,e){var n,r,s,i,a,l;return((n=t.user)==null?void 0:n.updatedAt)===((r=e.user)==null?void 0:r.updatedAt)&&t.organizationId===e.organizationId&&t.role===e.role&&t.permissions.length===e.permissions.length&&t.permissions.every((c,d)=>c===e.permissions[d])&&t.featureFlags.length===e.featureFlags.length&&t.featureFlags.every((c,d)=>c===e.featureFlags[d])&&((s=t.impersonator)==null?void 0:s.email)===((i=e.impersonator)==null?void 0:i.email)&&((a=t.impersonator)==null?void 0:a.reason)===((l=e.impersonator)==null?void 0:l.reason)}var Q3={signIn:()=>cb(void 0,null,function*(){}),signUp:()=>cb(void 0,null,function*(){}),getUser:()=>null,getAccessToken:()=>Promise.reject(new aC),switchToOrganization:()=>Promise.resolve(),signOut:()=>cb(void 0,null,function*(){})};const Cme=["meta-llama/llama-3.3-70b-instruct","openai/gpt-oss-120b","x-ai/grok-4-fast","openai/gpt-5-nano"],ia=t=>Cme.includes(t);var rm=(t=>(t.CLAUDE_OPUS_4_0="claude-opus-4-0",t.CLAUDE_SONNET_4_0="claude-sonnet-4-0",t.CLAUDE_3_7_SONNET_LATEST="claude-3-7-sonnet-latest",t.CLAUDE_3_5_SONNET_LATEST="claude-3-5-sonnet-latest",t.CLAUDE_3_5_HAIKU_LATEST="claude-3-5-haiku-latest",t.GPT_4_1="gpt-4.1",t.GPT_4_1_MINI="gpt-4.1-mini",t.GPT_4_1_NANO="gpt-4.1-nano",t.GPT_4O="gpt-4o",t.GPT_4O_MINI="gpt-4o-mini",t.GPT_4_TURBO="gpt-4-turbo",t.GPT_4="gpt-4",t.GPT_5="gpt-5",t.GPT_3_5_TURBO="gpt-3.5-turbo",t.DEEPSEEK_CHAT="deepseek-chat",t.DEEPSEEK_REASONER="deepseek-reasoner",t.GEMINI_2_5_PRO="gemini-2.5-pro",t.GEMINI_2_5_FLASH="gemini-2.5-flash",t.GEMINI_2_5_FLASH_LITE="gemini-2.5-flash-lite",t.GEMINI_2_0_FLASH_EXP="gemini-2.0-flash-exp",t.GEMINI_1_5_PRO="gemini-1.5-pro",t.GEMINI_1_5_PRO_002="gemini-1.5-pro-002",t.GEMINI_1_5_FLASH="gemini-1.5-flash",t.GEMINI_1_5_FLASH_002="gemini-1.5-flash-002",t.GEMINI_1_5_FLASH_8B="gemini-1.5-flash-8b",t.GEMINI_1_5_FLASH_8B_001="gemini-1.5-flash-8b-001",t.GEMMA_3_2B="gemma-3-2b",t.GEMMA_3_9B="gemma-3-9b",t.GEMMA_3_27B="gemma-3-27b",t.GEMMA_2_2B="gemma-2-2b",t.GEMMA_2_9B="gemma-2-9b",t.GEMMA_2_27B="gemma-2-27b",t.CODE_GEMMA_2B="codegemma-2b",t.CODE_GEMMA_7B="codegemma-7b",t))(rm||{});const Ame=[{id:"claude-opus-4-0",name:"Claude Opus 4",provider:"anthropic"},{id:"claude-sonnet-4-0",name:"Claude Sonnet 4",provider:"anthropic"},{id:"claude-3-7-sonnet-latest",name:"Claude Sonnet 3.7",provider:"anthropic"},{id:"claude-3-5-sonnet-latest",name:"Claude Sonnet 3.5",provider:"anthropic"},{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5",provider:"anthropic"},{id:"gpt-4.1",name:"GPT-4.1",provider:"openai"},{id:"gpt-4.1-mini",name:"GPT-4.1 Mini",provider:"openai"},{id:"gpt-4.1-nano",name:"GPT-4.1 Nano",provider:"openai"},{id:"gpt-4o",name:"GPT-4o",provider:"openai"},{id:"gpt-4o-mini",name:"GPT-4o Mini",provider:"openai"},{id:"deepseek-chat",name:"DeepSeek Chat",provider:"deepseek"},{id:"deepseek-reasoner",name:"DeepSeek Reasoner",provider:"deepseek"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google"},{id:"gemini-2.0-flash-exp",name:"Gemini 2.0 Flash Experimental",provider:"google"},{id:"gemini-1.5-pro-002",name:"Gemini 1.5 Pro 002",provider:"google"},{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",provider:"google"},{id:"gemini-1.5-flash-002",name:"Gemini 1.5 Flash 002",provider:"google"},{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",provider:"google"},{id:"meta-llama/llama-3.3-70b-instruct",name:"Llama 3.3 70B (Free)",provider:"meta"},{id:"openai/gpt-oss-120b",name:"GPT-OSS 120B (Free)",provider:"openai"},{id:"x-ai/grok-4-fast",name:"Grok 4 Fast (Free)",provider:"x-ai"},{id:"openai/gpt-5-nano",name:"GPT-5 Nano (Free)",provider:"openai"}],J3={serverUrl:"",tokens:null,isAuthenticating:!1,error:null,statusMessage:null},Z3="mcp-inspector-provider-tokens",u1={anthropic:"",openai:"",deepseek:"",google:"",ollama:"local",ollamaBaseUrl:"http://localhost:11434/api"};function TN(){const[t,e]=w.useState(u1),[n,r]=w.useState(!1);w.useEffect(()=>{if(typeof window<"u"){try{const h=localStorage.getItem(Z3);if(h){const g=JSON.parse(h);e(g)}}catch(h){console.warn("Failed to load provider tokens from localStorage:",h)}r(!0)}},[]),w.useEffect(()=>{if(n&&typeof window<"u")try{localStorage.setItem(Z3,JSON.stringify(t))}catch(h){console.warn("Failed to save provider tokens to localStorage:",h)}},[t,n]);const s=w.useCallback((h,g)=>{e(v=>({...v,[h]:g}))},[]),i=w.useCallback(h=>{e(g=>({...g,[h]:""}))},[]),a=w.useCallback(()=>{e(u1)},[]),l=w.useCallback(h=>!!t[h]?.trim(),[t]),c=w.useCallback(h=>t[h]||"",[t]),d=w.useCallback(()=>t.ollamaBaseUrl||u1.ollamaBaseUrl,[t.ollamaBaseUrl]),p=w.useCallback(h=>{e(g=>({...g,ollamaBaseUrl:h}))},[]);return{tokens:t,setToken:s,clearToken:i,clearAllTokens:a,hasToken:l,getToken:c,getOllamaBaseUrl:d,setOllamaBaseUrl:p}}class Ff{baseUrl;static normalizeBaseUrl(e){const n=(e||"").replace(/\/+$/,"");return/\/api$/.test(n)?n:`${n}/api`}constructor(e="http://localhost:11434/api"){this.baseUrl=Ff.normalizeBaseUrl(e)}setBaseUrl(e){this.baseUrl=Ff.normalizeBaseUrl(e)}async isOllamaRunning(){try{return(await fetch(`${this.baseUrl}/version`,{method:"GET",signal:AbortSignal.timeout(3e3)})).ok}catch{return!1}}async getAvailableModels(){try{const e=await fetch(`${this.baseUrl}/tags`,{method:"GET",signal:AbortSignal.timeout(5e3)});return e.ok?(await e.json()).models.map(r=>r.name):[]}catch(e){return console.warn("Failed to fetch Ollama models:",e),[]}}async checkModelExists(e){return(await this.getAvailableModels()).some(r=>r===e||r.startsWith(`${e}:`))}async getFilteredAvailableModels(e){const n=await this.getAvailableModels();return e.filter(r=>n.some(s=>s===r||s.startsWith(`${r}:`)))}async getToolCapableModels(){const e=await this.getAvailableModels();return e.length===0?[]:(await Promise.all(e.map(async r=>{try{const s=await fetch(`${this.baseUrl}/show`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:r}),signal:AbortSignal.timeout(5e3)});return s.ok&&(await s.json()).capabilities.includes("tools")?r:null}catch{return null}}))).flatMap(r=>r?[r]:[])}}const Kq=new Ff,Rme=async t=>{const e=t?new Ff(t):Kq;return await e.isOllamaRunning()?{isRunning:!0,availableModels:await e.getAvailableModels()}:{isRunning:!1,availableModels:[]}},Nme=async t=>(t?new Ff(t):Kq).getToolCapableModels();async function*jme(t){const e=new TextDecoder;let n="";try{for(;;){const{done:r,value:s}=await t.read();if(r)break;n+=e.decode(s,{stream:!0});const i=n.split(`
|
|
1781
|
-
`);n=i.pop()||"";for(const a of i){if(!a.startsWith("data: "))continue;const l=a.slice(6).trim();if(l){if(l==="[DONE]"){yield"[DONE]";return}try{yield JSON.parse(l)}catch{continue}}}}}finally{try{t.releaseLock?.()}catch{}}}function Xq(t={}){const{getToken:e,hasToken:n,tokens:r,getOllamaBaseUrl:s}=TN(),i=ga(),{initialMessages:a=[],systemPrompt:l,temperature:c,onMessageSent:d,onMessageReceived:p,onError:h,onModelChange:g,sendMessagesToBackend:v=!1,selectedServers:b=[]}=t,[x,E]=w.useState({messages:a,isLoading:!1,connectionStatus:"disconnected"}),[S,k]=w.useState(""),[T,N]=w.useState("idle"),[j,A]=w.useState(null),[R,M]=w.useState([]),[P,O]=w.useState(!1),[L,z]=w.useState(null),[G,W]=w.useState(!1),X=w.useRef(null),F=w.useRef(x.messages),{getAccessToken:Y}=va();w.useEffect(()=>{F.current=x.messages},[x.messages]),w.useEffect(()=>{const B=async()=>{const{isRunning:oe,availableModels:fe}=await Rme(s());O(oe),oe&&i.capture("ollama_running");const xe=oe?await Nme(s()):[],Ae=new Set(xe),Oe=fe.map(Re=>{const Je=Ae.has(Re);return{id:Re,name:Re,provider:"ollama",disabled:!Je,disabledReason:Je?void 0:"Model does not support tool calling"}});M(Oe)};B();const J=setInterval(B,3e4);return()=>clearInterval(J)},[s]),w.useEffect(()=>{if(!j||!re.some(B=>B.id===j.id)){const B=Mme(re,P);A(B??null)}},[r,R,P,n,j]);const V=w.useCallback(B=>B?ia(B.id)?"router":B.provider==="ollama"?P&&R.some(oe=>oe.id===B.id||oe.id.startsWith(`${B.id}:`))?"local":"":e(B.provider):"",[e,P,R]),te=w.useMemo(()=>V(j),[j,V]),I=w.useCallback(B=>{A(B),g&&g(B)},[g]),re=w.useMemo(()=>{const B={anthropic:n("anthropic"),openai:n("openai"),deepseek:n("deepseek"),google:n("google"),ollama:P,meta:!1,"x-ai":!1},J=Ame.filter(oe=>ia(oe.id)?!0:B[oe.provider]);return P&&R.length>0?J.concat(R):J},[P,R,n]),ue=w.useCallback((B,J,oe,fe,xe,Ae)=>{switch(B.type){case"text":{oe.current+=B.content;const Oe=Ae.current[Ae.current.length-1];Oe&&Oe.type==="text"?Oe.content=(Oe.content||"")+B.content:Ae.current=[...Ae.current,{id:`text-${Date.now()}`,type:"text",content:B.content,timestamp:new Date}],E(Re=>({...Re,messages:Re.messages.map(Je=>Je.id===J.id?{...Je,content:oe.current,contentBlocks:[...Ae.current]}:Je)}));break}case"tool_call":{const Oe={...B.toolCall,timestamp:new Date(B.toolCall.timestamp)};fe.current=[...fe.current,Oe],Ae.current=[...Ae.current,{id:`tool-call-${Oe.id}`,type:"tool_call",toolCall:Oe,timestamp:new Date}],E(Re=>({...Re,messages:Re.messages.map(Je=>Je.id===J.id?{...Je,toolCalls:[...fe.current],contentBlocks:[...Ae.current]}:Je)}));break}case"tool_result":{const Oe={...B.toolResult,timestamp:new Date(B.toolResult.timestamp)};xe.current=[...xe.current,Oe],fe.current=fe.current.map(Re=>Re.id===Oe.toolCallId?{...Re,status:Oe.error?"error":"completed"}:Re),Ae.current=Ae.current.map(Re=>Re.type==="tool_call"&&Re.toolCall?.id===Oe.toolCallId?{...Re,toolCall:{...Re.toolCall,status:Oe.error?"error":"completed"},toolResult:Oe}:Re),E(Re=>({...Re,messages:Re.messages.map(Je=>Je.id===J.id?{...Je,toolCalls:[...fe.current],toolResults:[...xe.current],contentBlocks:[...Ae.current]}:Je)}));break}case"elicitation_request":{z({requestId:B.requestId,message:B.message,schema:B.schema,timestamp:B.timestamp});break}case"elicitation_complete":{z(null);break}case"trace_step":break;case"error":throw new Error(B.error)}},[]),D=w.useCallback(async B=>{const J=v||j&&ia(j.id);if(!J&&(!j||!te))throw new Error("Missing required configuration: model and apiKey are required");const oe=pL("assistant","");E(fe=>({...fe,messages:[...fe.messages,oe]}));try{let fe=null;if(J&&Y)try{const He=await Y();He&&(fe=`Bearer ${He}`)}catch(He){console.warn("[useChat] failed to retrieve access token",He)}const xe=await fetch("/api/mcp/chat",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...fe?{Authorization:fe}:{}},body:JSON.stringify({model:j,provider:j.provider,apiKey:te,systemPrompt:l,temperature:c,messages:F.current.concat(B),ollamaBaseUrl:s(),sendMessagesToBackend:J,selectedServers:b}),signal:X.current?.signal});if(!xe.ok){const He=await xe.text();let mt;try{mt=JSON.parse(He)}catch{throw new Error(`Chat request failed: ${xe.status}`)}throw new Error(mt.error||"Chat request failed")}const Ae=xe.body?.getReader(),Oe={current:""},Re={current:[]},Je={current:[]},ft={current:[]};if(Ae){for await(const He of jme(Ae)){if(He==="[DONE]")break;try{ue(He,oe,Oe,Re,Je,ft)}catch(mt){console.warn("Failed applying SSE event",mt)}}E(He=>({...He,isLoading:!1}))}else E(He=>({...He,isLoading:!1}));if(!Oe.current&&!Re.current.length&&console.warn("No content received from stream"),p){const He={...oe,content:Oe.current};p(He)}}catch(fe){throw E(xe=>({...xe,isLoading:!1})),fe}finally{X.current=null}},[j,te,l,p,ue,s,v,Y,b]),Z=w.useCallback(async(B,J)=>{if(!B.trim()||x.isLoading)return;const oe=pL("user",B,J);E(fe=>({...fe,messages:[...fe.messages,oe],isLoading:!0,error:void 0})),d&&d(oe),X.current=new AbortController;try{await D(oe),N("idle")}catch(fe){const xe=fe instanceof Error?fe.message:"An error occurred";E(Ae=>({...Ae,isLoading:!1,error:xe})),N("error"),h?.(xe)}},[x.isLoading,d,D,h]),he=w.useCallback(()=>{X.current&&X.current.abort(),E(B=>({...B,isLoading:!1})),N("idle"),X.current=null},[]),q=w.useCallback(async B=>{const J=F.current,oe=J.findIndex(xe=>xe.id===B);if(oe===-1||oe===0)return;const fe=J[oe-1];if(fe.role==="user"){E(xe=>({...xe,messages:xe.messages.slice(0,oe),isLoading:!0})),X.current=new AbortController;try{await D(fe),N("idle")}catch(xe){const Ae=xe instanceof Error?xe.message:"An error occurred";E(Oe=>({...Oe,isLoading:!1,error:Ae})),N("error"),h?.(Ae)}}},[x.isLoading,d,D,h]),U=w.useCallback(B=>{E(J=>({...J,messages:J.messages.filter(oe=>oe.id!==B)}))},[]),K=w.useCallback(()=>{E(B=>({...B,messages:[],error:void 0})),k("")},[]),ae=w.useCallback(async(B,J)=>{if(!L){console.warn("Cannot handle elicitation response: no active request");return}W(!0);try{let oe=null;B==="accept"?oe={action:"accept",content:J||{}}:oe={action:B};const fe=await fetch("/api/mcp/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"elicitation_response",requestId:L.requestId,response:oe})});if(!fe.ok){const xe=`HTTP error! status: ${fe.status}`;throw new Error(xe)}z(null)}catch(oe){const fe=oe instanceof Error?oe.message:"Unknown error";console.error("Error responding to elicitation request:",fe),h&&h("Error responding to elicitation request")}finally{W(!1)}},[L,h]);return w.useEffect(()=>()=>{X.current&&X.current.abort()},[]),{messages:x.messages,isLoading:x.isLoading,error:x.error,connectionStatus:x.connectionStatus,status:T,input:S,setInput:k,model:j,availableModels:re,hasValidApiKey:!!te,elicitationRequest:L,elicitationLoading:G,sendMessage:Z,stopGeneration:he,regenerateMessage:q,deleteMessage:U,clearChat:K,setModel:I,handleElicitationResponse:ae}}function Mme(t,e){if(e){const r=t.find(s=>s.provider==="ollama");if(r)return r}const n=[rm.CLAUDE_3_5_SONNET_LATEST,rm.GPT_4O,rm.DEEPSEEK_CHAT,rm.GEMINI_2_5_FLASH];for(const r of n){const s=t.find(i=>i.id===r);if(s)return s}return t[0]}const CN=w.createContext({});function AN(t){const e=w.useRef(null);return e.current===null&&(e.current=t()),e.current}const RN=typeof window<"u",Qq=RN?w.useLayoutEffect:w.useEffect,Q0=w.createContext(null);function NN(t,e){t.indexOf(e)===-1&&t.push(e)}function jN(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Vo=(t,e,n)=>n>e?e:n<t?t:n;let MN=()=>{};const Go={},Jq=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Zq(t){return typeof t=="object"&&t!==null}const eV=t=>/^0[^.\s]+$/u.test(t);function ON(t){let e;return()=>(e===void 0&&(e=t()),e)}const Pi=t=>t,Ome=(t,e)=>n=>e(t(n)),Ng=(...t)=>t.reduce(Ome),Xm=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class IN{constructor(){this.subscriptions=[]}add(e){return NN(this.subscriptions,e),()=>jN(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Va=t=>t*1e3,Ci=t=>t/1e3;function tV(t,e){return e?t*(1e3/e):0}const nV=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ime=1e-7,Pme=12;function Dme(t,e,n,r,s){let i,a,l=0;do a=e+(n-e)/2,i=nV(a,r,s)-t,i>0?n=a:e=a;while(Math.abs(i)>Ime&&++l<Pme);return a}function jg(t,e,n,r){if(t===e&&n===r)return Pi;const s=i=>Dme(i,0,1,t,n);return i=>i===0||i===1?i:nV(s(i),e,r)}const rV=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,sV=t=>e=>1-t(1-e),iV=jg(.33,1.53,.69,.99),PN=sV(iV),aV=rV(PN),oV=t=>(t*=2)<1?.5*PN(t):.5*(2-Math.pow(2,-10*(t-1))),DN=t=>1-Math.sin(Math.acos(t)),lV=sV(DN),cV=rV(DN),Lme=jg(.42,0,1,1),$me=jg(0,0,.58,1),uV=jg(.42,0,.58,1),zme=t=>Array.isArray(t)&&typeof t[0]!="number",dV=t=>Array.isArray(t)&&typeof t[0]=="number",Fme={linear:Pi,easeIn:Lme,easeInOut:uV,easeOut:$me,circIn:DN,circInOut:cV,circOut:lV,backIn:PN,backInOut:aV,backOut:iV,anticipate:oV},Ume=t=>typeof t=="string",e4=t=>{if(dV(t)){MN(t.length===4);const[e,n,r,s]=t;return jg(e,n,r,s)}else if(Ume(t))return Fme[t];return t},Sy=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Bme(t,e){let n=new Set,r=new Set,s=!1,i=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(p){a.has(p)&&(d.schedule(p),t()),p(l)}const d={schedule:(p,h=!1,g=!1)=>{const b=g&&s?n:r;return h&&a.add(p),b.has(p)||b.add(p),p},cancel:p=>{r.delete(p),a.delete(p)},process:p=>{if(l=p,s){i=!0;return}s=!0,[n,r]=[r,n],n.forEach(c),n.clear(),s=!1,i&&(i=!1,d.process(p))}};return d}const Hme=40;function fV(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Sy.reduce((T,N)=>(T[N]=Bme(i),T),{}),{setup:l,read:c,resolveKeyframes:d,preUpdate:p,update:h,preRender:g,render:v,postRender:b}=a,x=()=>{const T=Go.useManualTiming?s.timestamp:performance.now();n=!1,Go.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(T-s.timestamp,Hme),1)),s.timestamp=T,s.isProcessing=!0,l.process(s),c.process(s),d.process(s),p.process(s),h.process(s),g.process(s),v.process(s),b.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(x))},E=()=>{n=!0,r=!0,s.isProcessing||t(x)};return{schedule:Sy.reduce((T,N)=>{const j=a[N];return T[N]=(A,R=!1,M=!1)=>(n||E(),j.schedule(A,R,M)),T},{}),cancel:T=>{for(let N=0;N<Sy.length;N++)a[Sy[N]].cancel(T)},state:s,steps:a}}const{schedule:Dn,cancel:nc,state:Gr,steps:d1}=fV(typeof requestAnimationFrame<"u"?requestAnimationFrame:Pi,!0);let ub;function qme(){ub=void 0}const Ds={now:()=>(ub===void 0&&Ds.set(Gr.isProcessing||Go.useManualTiming?Gr.timestamp:performance.now()),ub),set:t=>{ub=t,queueMicrotask(qme)}},hV=t=>e=>typeof e=="string"&&e.startsWith(t),LN=hV("--"),Vme=hV("var(--"),$N=t=>Vme(t)?Gme.test(t.split("/*")[0].trim()):!1,Gme=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,hh={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Qm={...hh,transform:t=>Vo(0,1,t)},Ey={...hh,default:1},mm=t=>Math.round(t*1e5)/1e5,zN=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Wme(t){return t==null}const Yme=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,FN=(t,e)=>n=>!!(typeof n=="string"&&Yme.test(n)&&n.startsWith(t)||e&&!Wme(n)&&Object.prototype.hasOwnProperty.call(n,e)),pV=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,l]=r.match(zN);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},Kme=t=>Vo(0,255,t),f1={...hh,transform:t=>Math.round(Kme(t))},tu={test:FN("rgb","red"),parse:pV("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+f1.transform(t)+", "+f1.transform(e)+", "+f1.transform(n)+", "+mm(Qm.transform(r))+")"};function Xme(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const cC={test:FN("#"),parse:Xme,transform:tu.transform},Mg=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Dl=Mg("deg"),Ga=Mg("%"),wt=Mg("px"),Qme=Mg("vh"),Jme=Mg("vw"),t4={...Ga,parse:t=>Ga.parse(t)/100,transform:t=>Ga.transform(t*100)},tf={test:FN("hsl","hue"),parse:pV("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ga.transform(mm(e))+", "+Ga.transform(mm(n))+", "+mm(Qm.transform(r))+")"},vr={test:t=>tu.test(t)||cC.test(t)||tf.test(t),parse:t=>tu.test(t)?tu.parse(t):tf.test(t)?tf.parse(t):cC.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?tu.transform(t):tf.transform(t),getAnimatableNone:t=>{const e=vr.parse(t);return e.alpha=0,vr.transform(e)}},Zme=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ege(t){return isNaN(t)&&typeof t=="string"&&(t.match(zN)?.length||0)+(t.match(Zme)?.length||0)>0}const mV="number",gV="color",tge="var",nge="var(",n4="${}",rge=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Jm(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(rge,c=>(vr.test(c)?(r.color.push(i),s.push(gV),n.push(vr.parse(c))):c.startsWith(nge)?(r.var.push(i),s.push(tge),n.push(c)):(r.number.push(i),s.push(mV),n.push(parseFloat(c))),++i,n4)).split(n4);return{values:n,split:l,indexes:r,types:s}}function vV(t){return Jm(t).values}function yV(t){const{split:e,types:n}=Jm(t),r=e.length;return s=>{let i="";for(let a=0;a<r;a++)if(i+=e[a],s[a]!==void 0){const l=n[a];l===mV?i+=mm(s[a]):l===gV?i+=vr.transform(s[a]):i+=s[a]}return i}}const sge=t=>typeof t=="number"?0:vr.test(t)?vr.getAnimatableNone(t):t;function ige(t){const e=vV(t);return yV(t)(e.map(sge))}const rc={test:ege,parse:vV,createTransformer:yV,getAnimatableNone:ige};function h1(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function age({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,a=0;if(!e)s=i=a=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=h1(c,l,t+1/3),i=h1(c,l,t),a=h1(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function _x(t,e){return n=>n>0?e:t}const Hn=(t,e,n)=>t+(e-t)*n,p1=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},oge=[cC,tu,tf],lge=t=>oge.find(e=>e.test(t));function r4(t){const e=lge(t);if(!e)return!1;let n=e.parse(t);return e===tf&&(n=age(n)),n}const s4=(t,e)=>{const n=r4(t),r=r4(e);if(!n||!r)return _x(t,e);const s={...n};return i=>(s.red=p1(n.red,r.red,i),s.green=p1(n.green,r.green,i),s.blue=p1(n.blue,r.blue,i),s.alpha=Hn(n.alpha,r.alpha,i),tu.transform(s))},uC=new Set(["none","hidden"]);function cge(t,e){return uC.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function uge(t,e){return n=>Hn(t,e,n)}function UN(t){return typeof t=="number"?uge:typeof t=="string"?$N(t)?_x:vr.test(t)?s4:hge:Array.isArray(t)?bV:typeof t=="object"?vr.test(t)?s4:dge:_x}function bV(t,e){const n=[...t],r=n.length,s=t.map((i,a)=>UN(i)(i,e[a]));return i=>{for(let a=0;a<r;a++)n[a]=s[a](i);return n}}function dge(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=UN(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function fge(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],a=t.indexes[i][r[i]],l=t.values[a]??0;n[s]=l,r[i]++}return n}const hge=(t,e)=>{const n=rc.createTransformer(e),r=Jm(t),s=Jm(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?uC.has(t)&&!s.values.length||uC.has(e)&&!r.values.length?cge(t,e):Ng(bV(fge(r,s),s.values),n):_x(t,e)};function xV(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Hn(t,e,n):UN(t)(t,e)}const pge=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Dn.update(e,n),stop:()=>nc(e),now:()=>Gr.isProcessing?Gr.timestamp:Ds.now()}},_V=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},wx=2e4;function BN(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<wx;)e+=n,r=t.next(e);return e>=wx?1/0:e}function mge(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(BN(r),wx);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Ci(s)}}const gge=5;function wV(t,e,n){const r=Math.max(e-gge,0);return tV(n-t(r),e-r)}const Xn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},m1=.001;function vge({duration:t=Xn.duration,bounce:e=Xn.bounce,velocity:n=Xn.velocity,mass:r=Xn.mass}){let s,i,a=1-e;a=Vo(Xn.minDamping,Xn.maxDamping,a),t=Vo(Xn.minDuration,Xn.maxDuration,Ci(t)),a<1?(s=d=>{const p=d*a,h=p*t,g=p-n,v=dC(d,a),b=Math.exp(-h);return m1-g/v*b},i=d=>{const h=d*a*t,g=h*n+n,v=Math.pow(a,2)*Math.pow(d,2)*t,b=Math.exp(-h),x=dC(Math.pow(d,2),a);return(-s(d)+m1>0?-1:1)*((g-v)*b)/x}):(s=d=>{const p=Math.exp(-d*t),h=(d-n)*t+1;return-m1+p*h},i=d=>{const p=Math.exp(-d*t),h=(n-d)*(t*t);return p*h});const l=5/t,c=bge(s,i,l);if(t=Va(t),isNaN(c))return{stiffness:Xn.stiffness,damping:Xn.damping,duration:t};{const d=Math.pow(c,2)*r;return{stiffness:d,damping:a*2*Math.sqrt(r*d),duration:t}}}const yge=12;function bge(t,e,n){let r=n;for(let s=1;s<yge;s++)r=r-t(r)/e(r);return r}function dC(t,e){return t*Math.sqrt(1-e*e)}const xge=["duration","bounce"],_ge=["stiffness","damping","mass"];function i4(t,e){return e.some(n=>t[n]!==void 0)}function wge(t){let e={velocity:Xn.velocity,stiffness:Xn.stiffness,damping:Xn.damping,mass:Xn.mass,isResolvedFromDuration:!1,...t};if(!i4(t,_ge)&&i4(t,xge))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Vo(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Xn.mass,stiffness:s,damping:i}}else{const n=vge(t);e={...e,...n,mass:Xn.mass},e.isResolvedFromDuration=!0}return e}function Sx(t=Xn.visualDuration,e=Xn.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:p,duration:h,velocity:g,isResolvedFromDuration:v}=wge({...n,velocity:-Ci(n.velocity||0)}),b=g||0,x=d/(2*Math.sqrt(c*p)),E=a-i,S=Ci(Math.sqrt(c/p)),k=Math.abs(E)<5;r||(r=k?Xn.restSpeed.granular:Xn.restSpeed.default),s||(s=k?Xn.restDelta.granular:Xn.restDelta.default);let T;if(x<1){const j=dC(S,x);T=A=>{const R=Math.exp(-x*S*A);return a-R*((b+x*S*E)/j*Math.sin(j*A)+E*Math.cos(j*A))}}else if(x===1)T=j=>a-Math.exp(-S*j)*(E+(b+S*E)*j);else{const j=S*Math.sqrt(x*x-1);T=A=>{const R=Math.exp(-x*S*A),M=Math.min(j*A,300);return a-R*((b+x*S*E)*Math.sinh(M)+j*E*Math.cosh(M))/j}}const N={calculatedDuration:v&&h||null,next:j=>{const A=T(j);if(v)l.done=j>=h;else{let R=j===0?b:0;x<1&&(R=j===0?Va(b):wV(T,j,A));const M=Math.abs(R)<=r,P=Math.abs(a-A)<=s;l.done=M&&P}return l.value=l.done?a:A,l},toString:()=>{const j=Math.min(BN(N),wx),A=_V(R=>N.next(j*R).value,j,30);return j+"ms "+A},toTransition:()=>{}};return N}Sx.applyToOptions=t=>{const e=mge(t,100,Sx);return t.ease=e.ease,t.duration=Va(e.duration),t.type="keyframes",t};function fC({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:l,max:c,restDelta:d=.5,restSpeed:p}){const h=t[0],g={done:!1,value:h},v=M=>l!==void 0&&M<l||c!==void 0&&M>c,b=M=>l===void 0?c:c===void 0||Math.abs(l-M)<Math.abs(c-M)?l:c;let x=n*e;const E=h+x,S=a===void 0?E:a(E);S!==E&&(x=S-h);const k=M=>-x*Math.exp(-M/r),T=M=>S+k(M),N=M=>{const P=k(M),O=T(M);g.done=Math.abs(P)<=d,g.value=g.done?S:O};let j,A;const R=M=>{v(g.value)&&(j=M,A=Sx({keyframes:[g.value,b(g.value)],velocity:wV(T,M,g.value),damping:s,stiffness:i,restDelta:d,restSpeed:p}))};return R(0),{calculatedDuration:null,next:M=>{let P=!1;return!A&&j===void 0&&(P=!0,N(M),R(M)),j!==void 0&&M>=j?A.next(M-j):(!P&&N(M),g)}}}function Sge(t,e,n){const r=[],s=n||Go.mix||xV,i=t.length-1;for(let a=0;a<i;a++){let l=s(t[a],t[a+1]);if(e){const c=Array.isArray(e)?e[a]||Pi:e;l=Ng(c,l)}r.push(l)}return r}function Ege(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(MN(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=Sge(e,r,s),c=l.length,d=p=>{if(a&&p<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(p<t[h+1]);h++);const g=Xm(t[h],t[h+1],p);return l[h](g)};return n?p=>d(Vo(t[0],t[i-1],p)):d}function kge(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=Xm(0,e,r);t.push(Hn(n,1,s))}}function Tge(t){const e=[0];return kge(e,t.length-1),e}function Cge(t,e){return t.map(n=>n*e)}function Age(t,e){return t.map(()=>e||uV).splice(0,t.length-1)}function gm({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=zme(r)?r.map(e4):e4(r),i={done:!1,value:e[0]},a=Cge(n&&n.length===e.length?n:Tge(e),t),l=Ege(a,e,{ease:Array.isArray(s)?s:Age(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const Rge=t=>t!==null;function HN(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(Rge),l=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!l||r===void 0?i[l]:r}const Nge={decay:fC,inertia:fC,tween:gm,keyframes:gm,spring:Sx};function SV(t){typeof t.type=="string"&&(t.type=Nge[t.type])}class qN{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const jge=t=>t/100;class VN extends qN{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Ds.now()&&this.tick(Ds.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;SV(e);const{type:n=gm,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=e;let{keyframes:l}=e;const c=n||gm;c!==gm&&typeof l[0]!="number"&&(this.mixKeyframes=Ng(jge,xV(l[0],l[1])),l=[0,100]);const d=c({...e,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=BN(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=d}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:p,repeat:h,repeatType:g,repeatDelay:v,type:b,onUpdate:x,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const S=this.currentTime-d*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?S<0:S>s;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,N=r;if(h){const M=Math.min(this.currentTime,s)/l;let P=Math.floor(M),O=M%1;!O&&M>=1&&(O=1),O===1&&P--,P=Math.min(P,h+1),!!(P%2)&&(g==="reverse"?(O=1-O,v&&(O-=v/l)):g==="mirror"&&(N=a)),T=Vo(0,1,O)*l}const j=k?{done:!1,value:p[0]}:N.next(T);i&&(j.value=i(j.value));let{done:A}=j;!k&&c!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return R&&b!==fC&&(j.value=HN(p,this.options,E,this.speed)),x&&x(j.value),R&&this.finish(),j}then(e,n){return this.finished.then(e,n)}get duration(){return Ci(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ci(e)}get time(){return Ci(this.currentTime)}set time(e){e=Va(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ds.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Ci(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=pge,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ds.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Mge(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const nu=t=>t*180/Math.PI,hC=t=>{const e=nu(Math.atan2(t[1],t[0]));return pC(e)},Oge={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:hC,rotateZ:hC,skewX:t=>nu(Math.atan(t[1])),skewY:t=>nu(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},pC=t=>(t=t%360,t<0&&(t+=360),t),a4=hC,o4=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),l4=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ige={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:o4,scaleY:l4,scale:t=>(o4(t)+l4(t))/2,rotateX:t=>pC(nu(Math.atan2(t[6],t[5]))),rotateY:t=>pC(nu(Math.atan2(-t[2],t[0]))),rotateZ:a4,rotate:a4,skewX:t=>nu(Math.atan(t[4])),skewY:t=>nu(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function mC(t){return t.includes("scale")?1:0}function gC(t,e){if(!t||t==="none")return mC(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Ige,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Oge,s=l}if(!s)return mC(e);const i=r[e],a=s[1].split(",").map(Dge);return typeof i=="function"?i(a):a[i]}const Pge=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return gC(n,e)};function Dge(t){return parseFloat(t.trim())}const ph=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mh=new Set(ph),c4=t=>t===hh||t===wt,Lge=new Set(["x","y","z"]),$ge=ph.filter(t=>!Lge.has(t));function zge(t){const e=[];return $ge.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const du={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>gC(e,"x"),y:(t,{transform:e})=>gC(e,"y")};du.translateX=du.x;du.translateY=du.y;const fu=new Set;let vC=!1,yC=!1,bC=!1;function EV(){if(yC){const t=Array.from(fu).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=zge(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{r.getValue(i)?.set(a)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}yC=!1,vC=!1,fu.forEach(t=>t.complete(bC)),fu.clear()}function kV(){fu.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(yC=!0)})}function Fge(){bC=!0,kV(),EV(),bC=!1}class GN{constructor(e,n,r,s,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(fu.add(this),vC||(vC=!0,Dn.read(kV),Dn.resolveKeyframes(EV))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const l=r.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&i===void 0&&s.set(e[0])}Mge(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),fu.delete(this)}cancel(){this.state==="scheduled"&&(fu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Uge=t=>t.startsWith("--");function Bge(t,e,n){Uge(e)?t.style.setProperty(e,n):t.style[e]=n}const Hge=ON(()=>window.ScrollTimeline!==void 0),qge={};function Vge(t,e){const n=ON(t);return()=>qge[e]??n()}const TV=Vge(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),sm=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,u4={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:sm([0,.65,.55,1]),circOut:sm([.55,0,1,.45]),backIn:sm([.31,.01,.66,-.59]),backOut:sm([.33,1.53,.69,.99])};function CV(t,e){if(t)return typeof t=="function"?TV()?_V(t,e):"ease-out":dV(t)?sm(t):Array.isArray(t)?t.map(n=>CV(n,e)||u4.easeOut):u4[t]}function Gge(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:l="easeOut",times:c}={},d=void 0){const p={[e]:n};c&&(p.offset=c);const h=CV(l,s);Array.isArray(h)&&(p.easing=h);const g={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return d&&(g.pseudoElement=d),t.animate(p,g)}function AV(t){return typeof t=="function"&&"applyToOptions"in t}function Wge({type:t,...e}){return AV(t)&&TV()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Yge extends qN{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,MN(typeof e.type!="string");const d=Wge(e);this.animation=Gge(n,r,s,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const p=HN(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(p):Bge(n,r,p),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Ci(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ci(e)}get time(){return Ci(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Va(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Hge()?(this.animation.timeline=e,Pi):n(this)}}const RV={anticipate:oV,backInOut:aV,circInOut:cV};function Kge(t){return t in RV}function Xge(t){typeof t.ease=="string"&&Kge(t.ease)&&(t.ease=RV[t.ease])}const d4=10;class Qge extends Yge{constructor(e){Xge(e),SV(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...a}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const l=new VN({...a,autoplay:!1}),c=Va(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-d4).value,l.sample(c).value,d4),l.stop()}}const f4=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(rc.test(t)||t==="0")&&!t.startsWith("url("));function Jge(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Zge(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=f4(s,e),l=f4(i,e);return!a||!l?!1:Jge(t)||(n==="spring"||AV(n))&&r}function xC(t){t.duration=0,t.type="keyframes"}const eve=new Set(["opacity","clipPath","filter","transform"]),tve=ON(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function nve(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:a}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=e.owner.getProps();return tve()&&n&&eve.has(n)&&(n!=="transform"||!d)&&!c&&!r&&s!=="mirror"&&i!==0&&a!=="inertia"}const rve=40;class sve extends qN{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",keyframes:l,name:c,motionValue:d,element:p,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ds.now();const g={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,name:c,motionValue:d,element:p,...h},v=p?.KeyframeResolver||GN;this.keyframeResolver=new v(l,(b,x,E)=>this.onKeyframesResolved(b,x,g,!E),c,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:i,type:a,velocity:l,delay:c,isHandoff:d,onUpdate:p}=r;this.resolvedAt=Ds.now(),Zge(e,i,a,l)||((Go.instantAnimations||!c)&&p?.(HN(e,r,n)),e[0]=e[e.length-1],xC(r),r.repeat=0);const g={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>rve?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},v=!d&&nve(g)?new Qge({...g,element:g.motionValue.owner.current}):new VN(g);v.finished.then(()=>this.notifyFinished()).catch(Pi),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Fge()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const ive=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ave(t){const e=ive.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function NV(t,e,n=1){const[r,s]=ave(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const a=i.trim();return Jq(a)?parseFloat(a):a}return $N(s)?NV(s,e,n+1):s}function WN(t,e){return t?.[e]??t?.default??t}const jV=new Set(["width","height","top","left","right","bottom",...ph]),ove={test:t=>t==="auto",parse:t=>t},MV=t=>e=>e.test(t),OV=[hh,wt,Ga,Dl,Jme,Qme,ove],h4=t=>OV.find(MV(t));function lve(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||eV(t):!0}const cve=new Set(["brightness","contrast","saturate","opacity"]);function uve(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(zN)||[];if(!r)return t;const s=n.replace(r,"");let i=cve.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const dve=/\b([a-z-]*)\(.*?\)/gu,_C={...rc,getAnimatableNone:t=>{const e=t.match(dve);return e?e.map(uve).join(" "):t}},p4={...hh,transform:Math.round},fve={rotate:Dl,rotateX:Dl,rotateY:Dl,rotateZ:Dl,scale:Ey,scaleX:Ey,scaleY:Ey,scaleZ:Ey,skew:Dl,skewX:Dl,skewY:Dl,distance:wt,translateX:wt,translateY:wt,translateZ:wt,x:wt,y:wt,z:wt,perspective:wt,transformPerspective:wt,opacity:Qm,originX:t4,originY:t4,originZ:wt},YN={borderWidth:wt,borderTopWidth:wt,borderRightWidth:wt,borderBottomWidth:wt,borderLeftWidth:wt,borderRadius:wt,radius:wt,borderTopLeftRadius:wt,borderTopRightRadius:wt,borderBottomRightRadius:wt,borderBottomLeftRadius:wt,width:wt,maxWidth:wt,height:wt,maxHeight:wt,top:wt,right:wt,bottom:wt,left:wt,padding:wt,paddingTop:wt,paddingRight:wt,paddingBottom:wt,paddingLeft:wt,margin:wt,marginTop:wt,marginRight:wt,marginBottom:wt,marginLeft:wt,backgroundPositionX:wt,backgroundPositionY:wt,...fve,zIndex:p4,fillOpacity:Qm,strokeOpacity:Qm,numOctaves:p4},hve={...YN,color:vr,backgroundColor:vr,outlineColor:vr,fill:vr,stroke:vr,borderColor:vr,borderTopColor:vr,borderRightColor:vr,borderBottomColor:vr,borderLeftColor:vr,filter:_C,WebkitFilter:_C},IV=t=>hve[t];function PV(t,e){let n=IV(t);return n!==_C&&(n=rc),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const pve=new Set(["auto","none","0"]);function mve(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!pve.has(i)&&Jm(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=PV(n,s)}class gve extends GN{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),$N(d))){const p=NV(d,n.current);p!==void 0&&(e[c]=p),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!jV.has(r)||e.length!==2)return;const[s,i]=e,a=h4(s),l=h4(i);if(a!==l)if(c4(a)&&c4(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else du[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||lve(e[s]))&&r.push(s);r.length&&mve(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=du[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=du[n](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function vve(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const s=n?.[t]??r.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const DV=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function LV(t){return Zq(t)&&"offsetHeight"in t}const m4=30,yve=t=>!isNaN(parseFloat(t));class bve{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=Ds.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Ds.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yve(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new IN);const r=this.events[e].add(n);return e==="change"?()=>{r(),Dn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ds.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>m4)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,m4);return tV(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Uf(t,e){return new bve(t,e)}const{schedule:KN}=fV(queueMicrotask,!1),Qi={x:!1,y:!1};function $V(){return Qi.x||Qi.y}function xve(t){return t==="x"||t==="y"?Qi[t]?null:(Qi[t]=!0,()=>{Qi[t]=!1}):Qi.x||Qi.y?null:(Qi.x=Qi.y=!0,()=>{Qi.x=Qi.y=!1})}function zV(t,e){const n=vve(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function g4(t){return!(t.pointerType==="touch"||$V())}function _ve(t,e,n={}){const[r,s,i]=zV(t,n),a=l=>{if(!g4(l))return;const{target:c}=l,d=e(c,l);if(typeof d!="function"||!c)return;const p=h=>{g4(h)&&(d(h),c.removeEventListener("pointerleave",p))};c.addEventListener("pointerleave",p,s)};return r.forEach(l=>{l.addEventListener("pointerenter",a,s)}),i}const FV=(t,e)=>e?t===e?!0:FV(t,e.parentElement):!1,XN=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,wve=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Sve(t){return wve.has(t.tagName)||t.tabIndex!==-1}const db=new WeakSet;function v4(t){return e=>{e.key==="Enter"&&t(e)}}function g1(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Eve=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=v4(()=>{if(db.has(n))return;g1(n,"down");const s=v4(()=>{g1(n,"up")}),i=()=>g1(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function y4(t){return XN(t)&&!$V()}function kve(t,e,n={}){const[r,s,i]=zV(t,n),a=l=>{const c=l.currentTarget;if(!y4(l))return;db.add(c);const d=e(c,l),p=(v,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",g),db.has(c)&&db.delete(c),y4(v)&&typeof d=="function"&&d(v,{success:b})},h=v=>{p(v,c===window||c===document||n.useGlobalTarget||FV(c,v.target))},g=v=>{p(v,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",g,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,s),LV(l)&&(l.addEventListener("focus",d=>Eve(d,s)),!Sve(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function UV(t){return Zq(t)&&"ownerSVGElement"in t}function Tve(t){return UV(t)&&t.tagName==="svg"}const is=t=>!!(t&&t.getVelocity),Cve=[...OV,vr,rc],Ave=t=>Cve.find(MV(t)),QN=w.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function b4(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Rve(...t){return e=>{let n=!1;const r=t.map(s=>{const i=b4(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():b4(t[s],null)}}}}function Nve(...t){return w.useCallback(Rve(...t),t)}class jve extends w.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=LV(r)&&r.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=s-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Mve({children:t,isPresent:e,anchorX:n,root:r}){const s=w.useId(),i=w.useRef(null),a=w.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=w.useContext(QN),c=Nve(i,t?.ref);return w.useInsertionEffect(()=>{const{width:d,height:p,top:h,left:g,right:v}=a.current;if(e||!i.current||!d||!p)return;const b=n==="left"?`left: ${g}`:`right: ${v}`;i.current.dataset.motionPopId=s;const x=document.createElement("style");l&&(x.nonce=l);const E=r??document.head;return E.appendChild(x),x.sheet&&x.sheet.insertRule(`
|
|
1781
|
+
`);n=i.pop()||"";for(const a of i){if(!a.startsWith("data: "))continue;const l=a.slice(6).trim();if(l){if(l==="[DONE]"){yield"[DONE]";return}try{yield JSON.parse(l)}catch{continue}}}}}finally{try{t.releaseLock?.()}catch{}}}function Xq(t={}){const{getToken:e,hasToken:n,tokens:r,getOllamaBaseUrl:s}=TN(),i=ga(),{initialMessages:a=[],systemPrompt:l,temperature:c,onMessageSent:d,onMessageReceived:p,onError:h,onModelChange:g,sendMessagesToBackend:v=!1,selectedServers:b=[]}=t,[x,E]=w.useState({messages:a,isLoading:!1,connectionStatus:"disconnected"}),[S,k]=w.useState(""),[T,N]=w.useState("idle"),[j,A]=w.useState(null),[R,M]=w.useState([]),[P,O]=w.useState(!1),[L,z]=w.useState(null),[G,W]=w.useState(!1),X=w.useRef(null),F=w.useRef(x.messages),{getAccessToken:Y}=va();w.useEffect(()=>{F.current=x.messages},[x.messages]),w.useEffect(()=>{const B=async()=>{const{isRunning:oe,availableModels:fe}=await Rme(s());O(oe),oe&&i.capture("ollama_running");const xe=oe?await Nme(s()):[],Ae=new Set(xe),Oe=fe.map(Re=>{const Je=Ae.has(Re);return{id:Re,name:Re,provider:"ollama",disabled:!Je,disabledReason:Je?void 0:"Model does not support tool calling"}});M(Oe)};B();const J=setInterval(B,3e4);return()=>clearInterval(J)},[s]),w.useEffect(()=>{if(!j||!re.some(B=>B.id===j.id)){const B=Mme(re,P);A(B??null)}},[r,R,P,n,j]);const V=w.useCallback(B=>B?ia(B.id)?"router":B.provider==="ollama"?P&&R.some(oe=>oe.id===B.id||oe.id.startsWith(`${B.id}:`))?"local":"":e(B.provider):"",[e,P,R]),te=w.useMemo(()=>V(j),[j,V]),I=w.useCallback(B=>{A(B),g&&g(B)},[g]),re=w.useMemo(()=>{const B={anthropic:n("anthropic"),openai:n("openai"),deepseek:n("deepseek"),google:n("google"),ollama:P,meta:!1,"x-ai":!1},J=Ame.filter(oe=>ia(oe.id)?!0:B[oe.provider]);return P&&R.length>0?J.concat(R):J},[P,R,n]),ue=w.useCallback((B,J,oe,fe,xe,Ae)=>{switch(B.type){case"text":{oe.current+=B.content;const Oe=Ae.current[Ae.current.length-1];Oe&&Oe.type==="text"?Oe.content=(Oe.content||"")+B.content:Ae.current=[...Ae.current,{id:`text-${Date.now()}`,type:"text",content:B.content,timestamp:new Date}],E(Re=>({...Re,messages:Re.messages.map(Je=>Je.id===J.id?{...Je,content:oe.current,contentBlocks:[...Ae.current]}:Je)}));break}case"tool_call":{const Oe={...B.toolCall,timestamp:new Date(B.toolCall.timestamp)};fe.current=[...fe.current,Oe],Ae.current=[...Ae.current,{id:`tool-call-${Oe.id}`,type:"tool_call",toolCall:Oe,timestamp:new Date}],E(Re=>({...Re,messages:Re.messages.map(Je=>Je.id===J.id?{...Je,toolCalls:[...fe.current],contentBlocks:[...Ae.current]}:Je)}));break}case"tool_result":{const Oe={...B.toolResult,timestamp:new Date(B.toolResult.timestamp)};xe.current=[...xe.current,Oe],fe.current=fe.current.map(Re=>Re.id===Oe.toolCallId?{...Re,status:Oe.error?"error":"completed"}:Re),Ae.current=Ae.current.map(Re=>Re.type==="tool_call"&&Re.toolCall?.id===Oe.toolCallId?{...Re,toolCall:{...Re.toolCall,status:Oe.error?"error":"completed"},toolResult:Oe}:Re),E(Re=>({...Re,messages:Re.messages.map(Je=>Je.id===J.id?{...Je,toolCalls:[...fe.current],toolResults:[...xe.current],contentBlocks:[...Ae.current]}:Je)}));break}case"elicitation_request":{z({requestId:B.requestId,message:B.message,schema:B.schema,timestamp:B.timestamp});break}case"elicitation_complete":{z(null);break}case"trace_step":break;case"error":throw new Error(B.error)}},[]),D=w.useCallback(async B=>{const J=v||j&&ia(j.id);if(!J&&(!j||!te))throw new Error("Missing required configuration: model and apiKey are required");const oe=pL("assistant","");E(fe=>({...fe,messages:[...fe.messages,oe]}));try{let fe=null;if(J&&Y)try{const He=await Y();He&&(fe=`Bearer ${He}`)}catch(He){console.warn("[useChat] failed to retrieve access token",He)}const xe=await fetch("/api/mcp/chat",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...fe?{Authorization:fe}:{}},body:JSON.stringify({model:j,provider:j.provider,apiKey:te,systemPrompt:l,temperature:c,messages:F.current.concat(B),ollamaBaseUrl:s(),sendMessagesToBackend:J,selectedServers:b}),signal:X.current?.signal});if(!xe.ok){const He=await xe.text();let mt;try{mt=JSON.parse(He)}catch{throw new Error(`Chat request failed: ${xe.status}`)}throw new Error(mt.error||"Chat request failed")}const Ae=xe.body?.getReader(),Oe={current:""},Re={current:[]},Je={current:[]},ft={current:[]};if(Ae){for await(const He of jme(Ae)){if(He==="[DONE]")break;try{ue(He,oe,Oe,Re,Je,ft)}catch(mt){console.warn("Failed applying SSE event",mt)}}E(He=>({...He,isLoading:!1}))}else E(He=>({...He,isLoading:!1}));if(!Oe.current&&!Re.current.length&&console.warn("No content received from stream"),p){const He={...oe,content:Oe.current};p(He)}}catch(fe){throw E(xe=>({...xe,isLoading:!1})),fe}finally{X.current=null}},[j,te,l,p,ue,s,v,Y,b]),Z=w.useCallback(async(B,J)=>{if(!B.trim()||x.isLoading)return;const oe=pL("user",B,J);E(fe=>({...fe,messages:[...fe.messages,oe],isLoading:!0,error:void 0})),d&&d(oe),X.current=new AbortController;try{await D(oe),N("idle")}catch(fe){const xe=fe instanceof Error?fe.message:"An error occurred";E(Ae=>({...Ae,isLoading:!1,error:xe})),N("error"),h?.(xe)}},[x.isLoading,d,D,h]),he=w.useCallback(()=>{X.current&&X.current.abort(),E(B=>({...B,isLoading:!1})),N("idle"),X.current=null},[]),q=w.useCallback(async B=>{const J=F.current,oe=J.findIndex(xe=>xe.id===B);if(oe===-1||oe===0)return;const fe=J[oe-1];if(fe.role==="user"){E(xe=>({...xe,messages:xe.messages.slice(0,oe),isLoading:!0})),X.current=new AbortController;try{await D(fe),N("idle")}catch(xe){const Ae=xe instanceof Error?xe.message:"An error occurred";E(Oe=>({...Oe,isLoading:!1,error:Ae})),N("error"),h?.(Ae)}}},[x.isLoading,d,D,h]),U=w.useCallback(B=>{E(J=>({...J,messages:J.messages.filter(oe=>oe.id!==B)}))},[]),K=w.useCallback(()=>{E(B=>({...B,messages:[],error:void 0})),k("")},[]),ae=w.useCallback(async(B,J)=>{if(!L){console.warn("Cannot handle elicitation response: no active request");return}W(!0);try{let oe=null;B==="accept"?oe={action:"accept",content:J||{}}:oe={action:B};const fe=await fetch("/api/mcp/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"elicitation_response",requestId:L.requestId,response:oe})});if(!fe.ok){const xe=`HTTP error! status: ${fe.status}`;throw new Error(xe)}z(null)}catch(oe){const fe=oe instanceof Error?oe.message:"Unknown error";console.error("Error responding to elicitation request:",fe),h&&h("Error responding to elicitation request")}finally{W(!1)}},[L,h]);return w.useEffect(()=>()=>{X.current&&X.current.abort()},[]),{messages:x.messages,isLoading:x.isLoading,error:x.error,connectionStatus:x.connectionStatus,status:T,input:S,setInput:k,model:j,availableModels:re,hasValidApiKey:!!te,elicitationRequest:L,elicitationLoading:G,sendMessage:Z,stopGeneration:he,regenerateMessage:q,deleteMessage:U,clearChat:K,setModel:I,handleElicitationResponse:ae}}function Mme(t,e){if(e){const r=t.find(s=>s.provider==="ollama");if(r)return r}const n=[rm.CLAUDE_3_5_SONNET_LATEST,rm.GPT_4O,rm.DEEPSEEK_CHAT,rm.GEMINI_2_5_FLASH];for(const r of n){const s=t.find(i=>i.id===r);if(s)return s}return t[0]}const CN=w.createContext({});function AN(t){const e=w.useRef(null);return e.current===null&&(e.current=t()),e.current}const RN=typeof window<"u",Qq=RN?w.useLayoutEffect:w.useEffect,Q0=w.createContext(null);function NN(t,e){t.indexOf(e)===-1&&t.push(e)}function jN(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Vo=(t,e,n)=>n>e?e:n<t?t:n;let MN=()=>{};const Go={},Jq=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Zq(t){return typeof t=="object"&&t!==null}const eV=t=>/^0[^.\s]+$/u.test(t);function ON(t){let e;return()=>(e===void 0&&(e=t()),e)}const Pi=t=>t,Ome=(t,e)=>n=>e(t(n)),Ng=(...t)=>t.reduce(Ome),Xm=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class IN{constructor(){this.subscriptions=[]}add(e){return NN(this.subscriptions,e),()=>jN(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const a=this.subscriptions[i];a&&a(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Va=t=>t*1e3,Ci=t=>t/1e3;function tV(t,e){return e?t*(1e3/e):0}const nV=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ime=1e-7,Pme=12;function Dme(t,e,n,r,s){let i,a,l=0;do a=e+(n-e)/2,i=nV(a,r,s)-t,i>0?n=a:e=a;while(Math.abs(i)>Ime&&++l<Pme);return a}function jg(t,e,n,r){if(t===e&&n===r)return Pi;const s=i=>Dme(i,0,1,t,n);return i=>i===0||i===1?i:nV(s(i),e,r)}const rV=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,sV=t=>e=>1-t(1-e),iV=jg(.33,1.53,.69,.99),PN=sV(iV),aV=rV(PN),oV=t=>(t*=2)<1?.5*PN(t):.5*(2-Math.pow(2,-10*(t-1))),DN=t=>1-Math.sin(Math.acos(t)),lV=sV(DN),cV=rV(DN),Lme=jg(.42,0,1,1),$me=jg(0,0,.58,1),uV=jg(.42,0,.58,1),zme=t=>Array.isArray(t)&&typeof t[0]!="number",dV=t=>Array.isArray(t)&&typeof t[0]=="number",Fme={linear:Pi,easeIn:Lme,easeInOut:uV,easeOut:$me,circIn:DN,circInOut:cV,circOut:lV,backIn:PN,backInOut:aV,backOut:iV,anticipate:oV},Ume=t=>typeof t=="string",e5=t=>{if(dV(t)){MN(t.length===4);const[e,n,r,s]=t;return jg(e,n,r,s)}else if(Ume(t))return Fme[t];return t},Sy=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Bme(t,e){let n=new Set,r=new Set,s=!1,i=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(p){a.has(p)&&(d.schedule(p),t()),p(l)}const d={schedule:(p,h=!1,g=!1)=>{const b=g&&s?n:r;return h&&a.add(p),b.has(p)||b.add(p),p},cancel:p=>{r.delete(p),a.delete(p)},process:p=>{if(l=p,s){i=!0;return}s=!0,[n,r]=[r,n],n.forEach(c),n.clear(),s=!1,i&&(i=!1,d.process(p))}};return d}const Hme=40;function fV(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Sy.reduce((T,N)=>(T[N]=Bme(i),T),{}),{setup:l,read:c,resolveKeyframes:d,preUpdate:p,update:h,preRender:g,render:v,postRender:b}=a,x=()=>{const T=Go.useManualTiming?s.timestamp:performance.now();n=!1,Go.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(T-s.timestamp,Hme),1)),s.timestamp=T,s.isProcessing=!0,l.process(s),c.process(s),d.process(s),p.process(s),h.process(s),g.process(s),v.process(s),b.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(x))},E=()=>{n=!0,r=!0,s.isProcessing||t(x)};return{schedule:Sy.reduce((T,N)=>{const j=a[N];return T[N]=(A,R=!1,M=!1)=>(n||E(),j.schedule(A,R,M)),T},{}),cancel:T=>{for(let N=0;N<Sy.length;N++)a[Sy[N]].cancel(T)},state:s,steps:a}}const{schedule:Dn,cancel:nc,state:Gr,steps:d1}=fV(typeof requestAnimationFrame<"u"?requestAnimationFrame:Pi,!0);let ub;function qme(){ub=void 0}const Ds={now:()=>(ub===void 0&&Ds.set(Gr.isProcessing||Go.useManualTiming?Gr.timestamp:performance.now()),ub),set:t=>{ub=t,queueMicrotask(qme)}},hV=t=>e=>typeof e=="string"&&e.startsWith(t),LN=hV("--"),Vme=hV("var(--"),$N=t=>Vme(t)?Gme.test(t.split("/*")[0].trim()):!1,Gme=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,hh={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Qm={...hh,transform:t=>Vo(0,1,t)},Ey={...hh,default:1},mm=t=>Math.round(t*1e5)/1e5,zN=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Wme(t){return t==null}const Yme=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,FN=(t,e)=>n=>!!(typeof n=="string"&&Yme.test(n)&&n.startsWith(t)||e&&!Wme(n)&&Object.prototype.hasOwnProperty.call(n,e)),pV=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,l]=r.match(zN);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},Kme=t=>Vo(0,255,t),f1={...hh,transform:t=>Math.round(Kme(t))},tu={test:FN("rgb","red"),parse:pV("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+f1.transform(t)+", "+f1.transform(e)+", "+f1.transform(n)+", "+mm(Qm.transform(r))+")"};function Xme(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const cC={test:FN("#"),parse:Xme,transform:tu.transform},Mg=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Dl=Mg("deg"),Ga=Mg("%"),wt=Mg("px"),Qme=Mg("vh"),Jme=Mg("vw"),t5={...Ga,parse:t=>Ga.parse(t)/100,transform:t=>Ga.transform(t*100)},tf={test:FN("hsl","hue"),parse:pV("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ga.transform(mm(e))+", "+Ga.transform(mm(n))+", "+mm(Qm.transform(r))+")"},vr={test:t=>tu.test(t)||cC.test(t)||tf.test(t),parse:t=>tu.test(t)?tu.parse(t):tf.test(t)?tf.parse(t):cC.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?tu.transform(t):tf.transform(t),getAnimatableNone:t=>{const e=vr.parse(t);return e.alpha=0,vr.transform(e)}},Zme=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ege(t){return isNaN(t)&&typeof t=="string"&&(t.match(zN)?.length||0)+(t.match(Zme)?.length||0)>0}const mV="number",gV="color",tge="var",nge="var(",n5="${}",rge=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Jm(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace(rge,c=>(vr.test(c)?(r.color.push(i),s.push(gV),n.push(vr.parse(c))):c.startsWith(nge)?(r.var.push(i),s.push(tge),n.push(c)):(r.number.push(i),s.push(mV),n.push(parseFloat(c))),++i,n5)).split(n5);return{values:n,split:l,indexes:r,types:s}}function vV(t){return Jm(t).values}function yV(t){const{split:e,types:n}=Jm(t),r=e.length;return s=>{let i="";for(let a=0;a<r;a++)if(i+=e[a],s[a]!==void 0){const l=n[a];l===mV?i+=mm(s[a]):l===gV?i+=vr.transform(s[a]):i+=s[a]}return i}}const sge=t=>typeof t=="number"?0:vr.test(t)?vr.getAnimatableNone(t):t;function ige(t){const e=vV(t);return yV(t)(e.map(sge))}const rc={test:ege,parse:vV,createTransformer:yV,getAnimatableNone:ige};function h1(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function age({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,a=0;if(!e)s=i=a=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=h1(c,l,t+1/3),i=h1(c,l,t),a=h1(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function _x(t,e){return n=>n>0?e:t}const Hn=(t,e,n)=>t+(e-t)*n,p1=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},oge=[cC,tu,tf],lge=t=>oge.find(e=>e.test(t));function r5(t){const e=lge(t);if(!e)return!1;let n=e.parse(t);return e===tf&&(n=age(n)),n}const s5=(t,e)=>{const n=r5(t),r=r5(e);if(!n||!r)return _x(t,e);const s={...n};return i=>(s.red=p1(n.red,r.red,i),s.green=p1(n.green,r.green,i),s.blue=p1(n.blue,r.blue,i),s.alpha=Hn(n.alpha,r.alpha,i),tu.transform(s))},uC=new Set(["none","hidden"]);function cge(t,e){return uC.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function uge(t,e){return n=>Hn(t,e,n)}function UN(t){return typeof t=="number"?uge:typeof t=="string"?$N(t)?_x:vr.test(t)?s5:hge:Array.isArray(t)?bV:typeof t=="object"?vr.test(t)?s5:dge:_x}function bV(t,e){const n=[...t],r=n.length,s=t.map((i,a)=>UN(i)(i,e[a]));return i=>{for(let a=0;a<r;a++)n[a]=s[a](i);return n}}function dge(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=UN(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function fge(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],a=t.indexes[i][r[i]],l=t.values[a]??0;n[s]=l,r[i]++}return n}const hge=(t,e)=>{const n=rc.createTransformer(e),r=Jm(t),s=Jm(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?uC.has(t)&&!s.values.length||uC.has(e)&&!r.values.length?cge(t,e):Ng(bV(fge(r,s),s.values),n):_x(t,e)};function xV(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Hn(t,e,n):UN(t)(t,e)}const pge=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Dn.update(e,n),stop:()=>nc(e),now:()=>Gr.isProcessing?Gr.timestamp:Ds.now()}},_V=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},wx=2e4;function BN(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<wx;)e+=n,r=t.next(e);return e>=wx?1/0:e}function mge(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(BN(r),wx);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Ci(s)}}const gge=5;function wV(t,e,n){const r=Math.max(e-gge,0);return tV(n-t(r),e-r)}const Xn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},m1=.001;function vge({duration:t=Xn.duration,bounce:e=Xn.bounce,velocity:n=Xn.velocity,mass:r=Xn.mass}){let s,i,a=1-e;a=Vo(Xn.minDamping,Xn.maxDamping,a),t=Vo(Xn.minDuration,Xn.maxDuration,Ci(t)),a<1?(s=d=>{const p=d*a,h=p*t,g=p-n,v=dC(d,a),b=Math.exp(-h);return m1-g/v*b},i=d=>{const h=d*a*t,g=h*n+n,v=Math.pow(a,2)*Math.pow(d,2)*t,b=Math.exp(-h),x=dC(Math.pow(d,2),a);return(-s(d)+m1>0?-1:1)*((g-v)*b)/x}):(s=d=>{const p=Math.exp(-d*t),h=(d-n)*t+1;return-m1+p*h},i=d=>{const p=Math.exp(-d*t),h=(n-d)*(t*t);return p*h});const l=5/t,c=bge(s,i,l);if(t=Va(t),isNaN(c))return{stiffness:Xn.stiffness,damping:Xn.damping,duration:t};{const d=Math.pow(c,2)*r;return{stiffness:d,damping:a*2*Math.sqrt(r*d),duration:t}}}const yge=12;function bge(t,e,n){let r=n;for(let s=1;s<yge;s++)r=r-t(r)/e(r);return r}function dC(t,e){return t*Math.sqrt(1-e*e)}const xge=["duration","bounce"],_ge=["stiffness","damping","mass"];function i5(t,e){return e.some(n=>t[n]!==void 0)}function wge(t){let e={velocity:Xn.velocity,stiffness:Xn.stiffness,damping:Xn.damping,mass:Xn.mass,isResolvedFromDuration:!1,...t};if(!i5(t,_ge)&&i5(t,xge))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Vo(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Xn.mass,stiffness:s,damping:i}}else{const n=vge(t);e={...e,...n,mass:Xn.mass},e.isResolvedFromDuration=!0}return e}function Sx(t=Xn.visualDuration,e=Xn.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:p,duration:h,velocity:g,isResolvedFromDuration:v}=wge({...n,velocity:-Ci(n.velocity||0)}),b=g||0,x=d/(2*Math.sqrt(c*p)),E=a-i,S=Ci(Math.sqrt(c/p)),k=Math.abs(E)<5;r||(r=k?Xn.restSpeed.granular:Xn.restSpeed.default),s||(s=k?Xn.restDelta.granular:Xn.restDelta.default);let T;if(x<1){const j=dC(S,x);T=A=>{const R=Math.exp(-x*S*A);return a-R*((b+x*S*E)/j*Math.sin(j*A)+E*Math.cos(j*A))}}else if(x===1)T=j=>a-Math.exp(-S*j)*(E+(b+S*E)*j);else{const j=S*Math.sqrt(x*x-1);T=A=>{const R=Math.exp(-x*S*A),M=Math.min(j*A,300);return a-R*((b+x*S*E)*Math.sinh(M)+j*E*Math.cosh(M))/j}}const N={calculatedDuration:v&&h||null,next:j=>{const A=T(j);if(v)l.done=j>=h;else{let R=j===0?b:0;x<1&&(R=j===0?Va(b):wV(T,j,A));const M=Math.abs(R)<=r,P=Math.abs(a-A)<=s;l.done=M&&P}return l.value=l.done?a:A,l},toString:()=>{const j=Math.min(BN(N),wx),A=_V(R=>N.next(j*R).value,j,30);return j+"ms "+A},toTransition:()=>{}};return N}Sx.applyToOptions=t=>{const e=mge(t,100,Sx);return t.ease=e.ease,t.duration=Va(e.duration),t.type="keyframes",t};function fC({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:l,max:c,restDelta:d=.5,restSpeed:p}){const h=t[0],g={done:!1,value:h},v=M=>l!==void 0&&M<l||c!==void 0&&M>c,b=M=>l===void 0?c:c===void 0||Math.abs(l-M)<Math.abs(c-M)?l:c;let x=n*e;const E=h+x,S=a===void 0?E:a(E);S!==E&&(x=S-h);const k=M=>-x*Math.exp(-M/r),T=M=>S+k(M),N=M=>{const P=k(M),O=T(M);g.done=Math.abs(P)<=d,g.value=g.done?S:O};let j,A;const R=M=>{v(g.value)&&(j=M,A=Sx({keyframes:[g.value,b(g.value)],velocity:wV(T,M,g.value),damping:s,stiffness:i,restDelta:d,restSpeed:p}))};return R(0),{calculatedDuration:null,next:M=>{let P=!1;return!A&&j===void 0&&(P=!0,N(M),R(M)),j!==void 0&&M>=j?A.next(M-j):(!P&&N(M),g)}}}function Sge(t,e,n){const r=[],s=n||Go.mix||xV,i=t.length-1;for(let a=0;a<i;a++){let l=s(t[a],t[a+1]);if(e){const c=Array.isArray(e)?e[a]||Pi:e;l=Ng(c,l)}r.push(l)}return r}function Ege(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(MN(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const a=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=Sge(e,r,s),c=l.length,d=p=>{if(a&&p<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(p<t[h+1]);h++);const g=Xm(t[h],t[h+1],p);return l[h](g)};return n?p=>d(Vo(t[0],t[i-1],p)):d}function kge(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=Xm(0,e,r);t.push(Hn(n,1,s))}}function Tge(t){const e=[0];return kge(e,t.length-1),e}function Cge(t,e){return t.map(n=>n*e)}function Age(t,e){return t.map(()=>e||uV).splice(0,t.length-1)}function gm({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=zme(r)?r.map(e5):e5(r),i={done:!1,value:e[0]},a=Cge(n&&n.length===e.length?n:Tge(e),t),l=Ege(a,e,{ease:Array.isArray(s)?s:Age(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const Rge=t=>t!==null;function HN(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(Rge),l=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!l||r===void 0?i[l]:r}const Nge={decay:fC,inertia:fC,tween:gm,keyframes:gm,spring:Sx};function SV(t){typeof t.type=="string"&&(t.type=Nge[t.type])}class qN{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const jge=t=>t/100;class VN extends qN{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Ds.now()&&this.tick(Ds.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;SV(e);const{type:n=gm,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=e;let{keyframes:l}=e;const c=n||gm;c!==gm&&typeof l[0]!="number"&&(this.mixKeyframes=Ng(jge,xV(l[0],l[1])),l=[0,100]);const d=c({...e,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=BN(d));const{calculatedDuration:p}=d;this.calculatedDuration=p,this.resolvedDuration=p+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=d}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:p,repeat:h,repeatType:g,repeatDelay:v,type:b,onUpdate:x,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const S=this.currentTime-d*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?S<0:S>s;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,N=r;if(h){const M=Math.min(this.currentTime,s)/l;let P=Math.floor(M),O=M%1;!O&&M>=1&&(O=1),O===1&&P--,P=Math.min(P,h+1),!!(P%2)&&(g==="reverse"?(O=1-O,v&&(O-=v/l)):g==="mirror"&&(N=a)),T=Vo(0,1,O)*l}const j=k?{done:!1,value:p[0]}:N.next(T);i&&(j.value=i(j.value));let{done:A}=j;!k&&c!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return R&&b!==fC&&(j.value=HN(p,this.options,E,this.speed)),x&&x(j.value),R&&this.finish(),j}then(e,n){return this.finished.then(e,n)}get duration(){return Ci(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ci(e)}get time(){return Ci(this.currentTime)}set time(e){e=Va(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ds.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Ci(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=pge,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ds.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Mge(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const nu=t=>t*180/Math.PI,hC=t=>{const e=nu(Math.atan2(t[1],t[0]));return pC(e)},Oge={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:hC,rotateZ:hC,skewX:t=>nu(Math.atan(t[1])),skewY:t=>nu(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},pC=t=>(t=t%360,t<0&&(t+=360),t),a5=hC,o5=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),l5=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ige={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:o5,scaleY:l5,scale:t=>(o5(t)+l5(t))/2,rotateX:t=>pC(nu(Math.atan2(t[6],t[5]))),rotateY:t=>pC(nu(Math.atan2(-t[2],t[0]))),rotateZ:a5,rotate:a5,skewX:t=>nu(Math.atan(t[4])),skewY:t=>nu(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function mC(t){return t.includes("scale")?1:0}function gC(t,e){if(!t||t==="none")return mC(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=Ige,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Oge,s=l}if(!s)return mC(e);const i=r[e],a=s[1].split(",").map(Dge);return typeof i=="function"?i(a):a[i]}const Pge=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return gC(n,e)};function Dge(t){return parseFloat(t.trim())}const ph=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mh=new Set(ph),c5=t=>t===hh||t===wt,Lge=new Set(["x","y","z"]),$ge=ph.filter(t=>!Lge.has(t));function zge(t){const e=[];return $ge.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const du={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>gC(e,"x"),y:(t,{transform:e})=>gC(e,"y")};du.translateX=du.x;du.translateY=du.y;const fu=new Set;let vC=!1,yC=!1,bC=!1;function EV(){if(yC){const t=Array.from(fu).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=zge(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{r.getValue(i)?.set(a)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}yC=!1,vC=!1,fu.forEach(t=>t.complete(bC)),fu.clear()}function kV(){fu.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(yC=!0)})}function Fge(){bC=!0,kV(),EV(),bC=!1}class GN{constructor(e,n,r,s,i,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(fu.add(this),vC||(vC=!0,Dn.read(kV),Dn.resolveKeyframes(EV))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const l=r.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&i===void 0&&s.set(e[0])}Mge(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),fu.delete(this)}cancel(){this.state==="scheduled"&&(fu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Uge=t=>t.startsWith("--");function Bge(t,e,n){Uge(e)?t.style.setProperty(e,n):t.style[e]=n}const Hge=ON(()=>window.ScrollTimeline!==void 0),qge={};function Vge(t,e){const n=ON(t);return()=>qge[e]??n()}const TV=Vge(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),sm=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,u5={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:sm([0,.65,.55,1]),circOut:sm([.55,0,1,.45]),backIn:sm([.31,.01,.66,-.59]),backOut:sm([.33,1.53,.69,.99])};function CV(t,e){if(t)return typeof t=="function"?TV()?_V(t,e):"ease-out":dV(t)?sm(t):Array.isArray(t)?t.map(n=>CV(n,e)||u5.easeOut):u5[t]}function Gge(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:l="easeOut",times:c}={},d=void 0){const p={[e]:n};c&&(p.offset=c);const h=CV(l,s);Array.isArray(h)&&(p.easing=h);const g={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"};return d&&(g.pseudoElement=d),t.animate(p,g)}function AV(t){return typeof t=="function"&&"applyToOptions"in t}function Wge({type:t,...e}){return AV(t)&&TV()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Yge extends qN{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,MN(typeof e.type!="string");const d=Wge(e);this.animation=Gge(n,r,s,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const p=HN(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(p):Bge(n,r,p),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Ci(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ci(e)}get time(){return Ci(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=Va(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Hge()?(this.animation.timeline=e,Pi):n(this)}}const RV={anticipate:oV,backInOut:aV,circInOut:cV};function Kge(t){return t in RV}function Xge(t){typeof t.ease=="string"&&Kge(t.ease)&&(t.ease=RV[t.ease])}const d5=10;class Qge extends Yge{constructor(e){Xge(e),SV(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...a}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const l=new VN({...a,autoplay:!1}),c=Va(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-d5).value,l.sample(c).value,d5),l.stop()}}const f5=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(rc.test(t)||t==="0")&&!t.startsWith("url("));function Jge(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Zge(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],a=f5(s,e),l=f5(i,e);return!a||!l?!1:Jge(t)||(n==="spring"||AV(n))&&r}function xC(t){t.duration=0,t.type="keyframes"}const eve=new Set(["opacity","clipPath","filter","transform"]),tve=ON(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function nve(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:a}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=e.owner.getProps();return tve()&&n&&eve.has(n)&&(n!=="transform"||!d)&&!c&&!r&&s!=="mirror"&&i!==0&&a!=="inertia"}const rve=40;class sve extends qN{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",keyframes:l,name:c,motionValue:d,element:p,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Ds.now();const g={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,name:c,motionValue:d,element:p,...h},v=p?.KeyframeResolver||GN;this.keyframeResolver=new v(l,(b,x,E)=>this.onKeyframesResolved(b,x,g,!E),c,d,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,s){this.keyframeResolver=void 0;const{name:i,type:a,velocity:l,delay:c,isHandoff:d,onUpdate:p}=r;this.resolvedAt=Ds.now(),Zge(e,i,a,l)||((Go.instantAnimations||!c)&&p?.(HN(e,r,n)),e[0]=e[e.length-1],xC(r),r.repeat=0);const g={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>rve?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},v=!d&&nve(g)?new Qge({...g,element:g.motionValue.owner.current}):new VN(g);v.finished.then(()=>this.notifyFinished()).catch(Pi),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Fge()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const ive=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ave(t){const e=ive.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function NV(t,e,n=1){const[r,s]=ave(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const a=i.trim();return Jq(a)?parseFloat(a):a}return $N(s)?NV(s,e,n+1):s}function WN(t,e){return t?.[e]??t?.default??t}const jV=new Set(["width","height","top","left","right","bottom",...ph]),ove={test:t=>t==="auto",parse:t=>t},MV=t=>e=>e.test(t),OV=[hh,wt,Ga,Dl,Jme,Qme,ove],h5=t=>OV.find(MV(t));function lve(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||eV(t):!0}const cve=new Set(["brightness","contrast","saturate","opacity"]);function uve(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(zN)||[];if(!r)return t;const s=n.replace(r,"");let i=cve.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const dve=/\b([a-z-]*)\(.*?\)/gu,_C={...rc,getAnimatableNone:t=>{const e=t.match(dve);return e?e.map(uve).join(" "):t}},p5={...hh,transform:Math.round},fve={rotate:Dl,rotateX:Dl,rotateY:Dl,rotateZ:Dl,scale:Ey,scaleX:Ey,scaleY:Ey,scaleZ:Ey,skew:Dl,skewX:Dl,skewY:Dl,distance:wt,translateX:wt,translateY:wt,translateZ:wt,x:wt,y:wt,z:wt,perspective:wt,transformPerspective:wt,opacity:Qm,originX:t5,originY:t5,originZ:wt},YN={borderWidth:wt,borderTopWidth:wt,borderRightWidth:wt,borderBottomWidth:wt,borderLeftWidth:wt,borderRadius:wt,radius:wt,borderTopLeftRadius:wt,borderTopRightRadius:wt,borderBottomRightRadius:wt,borderBottomLeftRadius:wt,width:wt,maxWidth:wt,height:wt,maxHeight:wt,top:wt,right:wt,bottom:wt,left:wt,padding:wt,paddingTop:wt,paddingRight:wt,paddingBottom:wt,paddingLeft:wt,margin:wt,marginTop:wt,marginRight:wt,marginBottom:wt,marginLeft:wt,backgroundPositionX:wt,backgroundPositionY:wt,...fve,zIndex:p5,fillOpacity:Qm,strokeOpacity:Qm,numOctaves:p5},hve={...YN,color:vr,backgroundColor:vr,outlineColor:vr,fill:vr,stroke:vr,borderColor:vr,borderTopColor:vr,borderRightColor:vr,borderBottomColor:vr,borderLeftColor:vr,filter:_C,WebkitFilter:_C},IV=t=>hve[t];function PV(t,e){let n=IV(t);return n!==_C&&(n=rc),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const pve=new Set(["auto","none","0"]);function mve(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!pve.has(i)&&Jm(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=PV(n,s)}class gve extends GN{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let d=e[c];if(typeof d=="string"&&(d=d.trim(),$N(d))){const p=NV(d,n.current);p!==void 0&&(e[c]=p),c===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!jV.has(r)||e.length!==2)return;const[s,i]=e,a=h5(s),l=h5(i);if(a!==l)if(c5(a)&&c5(l))for(let c=0;c<e.length;c++){const d=e[c];typeof d=="string"&&(e[c]=parseFloat(d))}else du[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||lve(e[s]))&&r.push(s);r.length&&mve(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=du[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=du[n](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function vve(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const s=n?.[t]??r.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const DV=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function LV(t){return Zq(t)&&"offsetHeight"in t}const m5=30,yve=t=>!isNaN(parseFloat(t));class bve{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const s=Ds.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Ds.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yve(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new IN);const r=this.events[e].add(n);return e==="change"?()=>{r(),Dn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ds.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>m5)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,m5);return tV(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Uf(t,e){return new bve(t,e)}const{schedule:KN}=fV(queueMicrotask,!1),Qi={x:!1,y:!1};function $V(){return Qi.x||Qi.y}function xve(t){return t==="x"||t==="y"?Qi[t]?null:(Qi[t]=!0,()=>{Qi[t]=!1}):Qi.x||Qi.y?null:(Qi.x=Qi.y=!0,()=>{Qi.x=Qi.y=!1})}function zV(t,e){const n=vve(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function g5(t){return!(t.pointerType==="touch"||$V())}function _ve(t,e,n={}){const[r,s,i]=zV(t,n),a=l=>{if(!g5(l))return;const{target:c}=l,d=e(c,l);if(typeof d!="function"||!c)return;const p=h=>{g5(h)&&(d(h),c.removeEventListener("pointerleave",p))};c.addEventListener("pointerleave",p,s)};return r.forEach(l=>{l.addEventListener("pointerenter",a,s)}),i}const FV=(t,e)=>e?t===e?!0:FV(t,e.parentElement):!1,XN=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,wve=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Sve(t){return wve.has(t.tagName)||t.tabIndex!==-1}const db=new WeakSet;function v5(t){return e=>{e.key==="Enter"&&t(e)}}function g1(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Eve=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=v5(()=>{if(db.has(n))return;g1(n,"down");const s=v5(()=>{g1(n,"up")}),i=()=>g1(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function y5(t){return XN(t)&&!$V()}function kve(t,e,n={}){const[r,s,i]=zV(t,n),a=l=>{const c=l.currentTarget;if(!y5(l))return;db.add(c);const d=e(c,l),p=(v,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",g),db.has(c)&&db.delete(c),y5(v)&&typeof d=="function"&&d(v,{success:b})},h=v=>{p(v,c===window||c===document||n.useGlobalTarget||FV(c,v.target))},g=v=>{p(v,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",g,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,s),LV(l)&&(l.addEventListener("focus",d=>Eve(d,s)),!Sve(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function UV(t){return Zq(t)&&"ownerSVGElement"in t}function Tve(t){return UV(t)&&t.tagName==="svg"}const is=t=>!!(t&&t.getVelocity),Cve=[...OV,vr,rc],Ave=t=>Cve.find(MV(t)),QN=w.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function b5(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Rve(...t){return e=>{let n=!1;const r=t.map(s=>{const i=b5(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():b5(t[s],null)}}}}function Nve(...t){return w.useCallback(Rve(...t),t)}class jve extends w.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=n.offsetParent,s=LV(r)&&r.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=s-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Mve({children:t,isPresent:e,anchorX:n,root:r}){const s=w.useId(),i=w.useRef(null),a=w.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:l}=w.useContext(QN),c=Nve(i,t?.ref);return w.useInsertionEffect(()=>{const{width:d,height:p,top:h,left:g,right:v}=a.current;if(e||!i.current||!d||!p)return;const b=n==="left"?`left: ${g}`:`right: ${v}`;i.current.dataset.motionPopId=s;const x=document.createElement("style");l&&(x.nonce=l);const E=r??document.head;return E.appendChild(x),x.sheet&&x.sheet.insertRule(`
|
|
1782
1782
|
[data-motion-pop-id="${s}"] {
|
|
1783
1783
|
position: absolute !important;
|
|
1784
1784
|
width: ${d}px !important;
|
|
@@ -1786,22 +1786,22 @@ An authorization_code was supplied for a login which did not originate at the ap
|
|
|
1786
1786
|
${b}px !important;
|
|
1787
1787
|
top: ${h}px !important;
|
|
1788
1788
|
}
|
|
1789
|
-
`),()=>{E.contains(x)&&E.removeChild(x)}},[e]),f.jsx(jve,{isPresent:e,childRef:i,sizeRef:a,children:w.cloneElement(t,{ref:c})})}const Ove=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a,anchorX:l,root:c})=>{const d=AN(Ive),p=w.useId();let h=!0,g=w.useMemo(()=>(h=!1,{id:p,initial:e,isPresent:n,custom:s,onExitComplete:v=>{d.set(v,!0);for(const b of d.values())if(!b)return;r&&r()},register:v=>(d.set(v,!1),()=>d.delete(v))}),[n,d,r]);return i&&h&&(g={...g}),w.useMemo(()=>{d.forEach((v,b)=>d.set(b,!1))},[n]),w.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),a==="popLayout"&&(t=f.jsx(Mve,{isPresent:n,anchorX:l,root:c,children:t})),f.jsx(Q0.Provider,{value:g,children:t})};function Ive(){return new Map}function BV(t=!0){const e=w.useContext(Q0);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=w.useId();w.useEffect(()=>{if(t)return s(i)},[t]);const a=w.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,a]:[!0]}const ky=t=>t.key||"";function x4(t){const e=[];return w.Children.forEach(t,n=>{w.isValidElement(n)&&e.push(n)}),e}const Ex=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1,anchorX:l="left",root:c})=>{const[d,p]=BV(a),h=w.useMemo(()=>x4(t),[t]),g=a&&!d?[]:h.map(ky),v=w.useRef(!0),b=w.useRef(h),x=AN(()=>new Map),[E,S]=w.useState(h),[k,T]=w.useState(h);Qq(()=>{v.current=!1,b.current=h;for(let A=0;A<k.length;A++){const R=ky(k[A]);g.includes(R)?x.delete(R):x.get(R)!==!0&&x.set(R,!1)}},[k,g.length,g.join("-")]);const N=[];if(h!==E){let A=[...h];for(let R=0;R<k.length;R++){const M=k[R],P=ky(M);g.includes(P)||(A.splice(R,0,M),N.push(M))}return i==="wait"&&N.length&&(A=N),T(x4(A)),S(h),null}const{forceRender:j}=w.useContext(CN);return f.jsx(f.Fragment,{children:k.map(A=>{const R=ky(A),M=a&&!d?!1:h===k||g.includes(R),P=()=>{if(x.has(R))x.set(R,!0);else return;let O=!0;x.forEach(L=>{L||(O=!1)}),O&&(j?.(),T(b.current),a&&p?.(),r&&r())};return f.jsx(Ove,{isPresent:M,initial:!v.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:c,onExitComplete:M?void 0:P,anchorX:l,children:A},R)})})},HV=w.createContext({strict:!1}),_4={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Bf={};for(const t in _4)Bf[t]={isEnabled:e=>_4[t].some(n=>!!e[n])};function Pve(t){for(const e in t)Bf[e]={...Bf[e],...t[e]}}const Dve=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function kx(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Dve.has(t)}let qV=t=>!kx(t);function Lve(t){typeof t=="function"&&(qV=e=>e.startsWith("on")?!kx(e):t(e))}try{Lve(require("@emotion/is-prop-valid").default)}catch{}function $ve(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(qV(s)||n===!0&&kx(s)||!e&&!kx(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const J0=w.createContext({});function Z0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Zm(t){return typeof t=="string"||Array.isArray(t)}const JN=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ZN=["initial",...JN];function e_(t){return Z0(t.animate)||ZN.some(e=>Zm(t[e]))}function VV(t){return!!(e_(t)||t.variants)}function zve(t,e){if(e_(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Zm(n)?n:void 0,animate:Zm(r)?r:void 0}}return t.inherit!==!1?e:{}}function Fve(t){const{initial:e,animate:n}=zve(t,w.useContext(J0));return w.useMemo(()=>({initial:e,animate:n}),[w4(e),w4(n)])}function w4(t){return Array.isArray(t)?t.join(" "):t}const eg={};function Uve(t){for(const e in t)eg[e]=t[e],LN(e)&&(eg[e].isCSSVariable=!0)}function GV(t,{layout:e,layoutId:n}){return mh.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!eg[t]||t==="opacity")}const Bve={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Hve=ph.length;function qve(t,e,n){let r="",s=!0;for(let i=0;i<Hve;i++){const a=ph[i],l=t[a];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(a.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=DV(l,YN[a]);if(!c){s=!1;const p=Bve[a]||a;r+=`${p}(${d}) `}n&&(e[a]=d)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function ej(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let a=!1,l=!1;for(const c in e){const d=e[c];if(mh.has(c)){a=!0;continue}else if(LN(c)){s[c]=d;continue}else{const p=DV(d,YN[c]);c.startsWith("origin")?(l=!0,i[c]=p):r[c]=p}}if(e.transform||(a||n?r.transform=qve(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:p=0}=i;r.transformOrigin=`${c} ${d} ${p}`}}const tj=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function WV(t,e,n){for(const r in e)!is(e[r])&&!GV(r,n)&&(t[r]=e[r])}function Vve({transformTemplate:t},e){return w.useMemo(()=>{const n=tj();return ej(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Gve(t,e){const n=t.style||{},r={};return WV(r,n,t),Object.assign(r,Vve(t,e)),r}function Wve(t,e){const n={},r=Gve(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Yve={offset:"stroke-dashoffset",array:"stroke-dasharray"},Kve={offset:"strokeDashoffset",array:"strokeDasharray"};function Xve(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?Yve:Kve;t[i.offset]=wt.transform(-r);const a=wt.transform(e),l=wt.transform(n);t[i.array]=`${a} ${l}`}function YV(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:a=0,...l},c,d,p){if(ej(t,l,d),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:g}=t;h.transform&&(g.transform=h.transform,delete h.transform),(g.transform||h.transformOrigin)&&(g.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),g.transform&&(g.transformBox=p?.transformBox??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&Xve(h,s,i,a,!1)}const KV=()=>({...tj(),attrs:{}}),XV=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Qve(t,e,n,r){const s=w.useMemo(()=>{const i=KV();return YV(i,e,XV(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};WV(i,t.style,t),s.style={...i,...s.style}}return s}const Jve=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nj(t){return typeof t!="string"||t.includes("-")?!1:!!(Jve.indexOf(t)>-1||/[A-Z]/u.test(t))}function Zve(t,e,n,{latestValues:r},s,i=!1){const l=(nj(t)?Qve:Wve)(e,r,s,t),c=$ve(e,typeof t=="string",i),d=t!==w.Fragment?{...c,...l,ref:n}:{},{children:p}=e,h=w.useMemo(()=>is(p)?p.get():p,[p]);return w.createElement(t,{...d,children:h})}function S4(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function rj(t,e,n,r){if(typeof e=="function"){const[s,i]=S4(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=S4(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function fb(t){return is(t)?t.get():t}function eye({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:tye(n,r,s,t),renderState:e()}}function tye(t,e,n,r){const s={},i=r(t,{});for(const g in i)s[g]=fb(i[g]);let{initial:a,animate:l}=t;const c=e_(t),d=VV(t);e&&d&&!c&&t.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let p=n?n.initial===!1:!1;p=p||a===!1;const h=p?l:a;if(h&&typeof h!="boolean"&&!Z0(h)){const g=Array.isArray(h)?h:[h];for(let v=0;v<g.length;v++){const b=rj(t,g[v]);if(b){const{transitionEnd:x,transition:E,...S}=b;for(const k in S){let T=S[k];if(Array.isArray(T)){const N=p?T.length-1:0;T=T[N]}T!==null&&(s[k]=T)}for(const k in x)s[k]=x[k]}}}return s}const QV=t=>(e,n)=>{const r=w.useContext(J0),s=w.useContext(Q0),i=()=>eye(t,e,r,s);return n?i():AN(i)};function sj(t,e,n){const{style:r}=t,s={};for(const i in r)(is(r[i])||e.style&&is(e.style[i])||GV(i,t)||n?.getValue(i)?.liveStyle!==void 0)&&(s[i]=r[i]);return s}const nye=QV({scrapeMotionValuesFromProps:sj,createRenderState:tj});function JV(t,e,n){const r=sj(t,e,n);for(const s in t)if(is(t[s])||is(e[s])){const i=ph.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}const rye=QV({scrapeMotionValuesFromProps:JV,createRenderState:KV}),sye=Symbol.for("motionComponentSymbol");function nf(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function iye(t,e,n){return w.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):nf(n)&&(n.current=r))},[e])}const ij=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),aye="framerAppearId",ZV="data-"+ij(aye),e8=w.createContext({});function oye(t,e,n,r,s){const{visualElement:i}=w.useContext(J0),a=w.useContext(HV),l=w.useContext(Q0),c=w.useContext(QN).reducedMotion,d=w.useRef(null);r=r||a.renderer,!d.current&&r&&(d.current=r(t,{visualState:e,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const p=d.current,h=w.useContext(e8);p&&!p.projection&&s&&(p.type==="html"||p.type==="svg")&&lye(d.current,n,s,h);const g=w.useRef(!1);w.useInsertionEffect(()=>{p&&g.current&&p.update(n,l)});const v=n[ZV],b=w.useRef(!!v&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Qq(()=>{p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),b.current&&p.animationState&&p.animationState.animateChanges())}),w.useEffect(()=>{p&&(!b.current&&p.animationState&&p.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),b.current=!1),p.enteringChildren=void 0)}),p}function lye(t,e,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:t8(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||l&&nf(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:p,layoutScroll:c,layoutRoot:d})}function t8(t){if(t)return t.options.allowProjection!==!1?t.projection:t8(t.parent)}function v1(t,{forwardMotionProps:e=!1}={},n,r){n&&Pve(n);const s=nj(t)?rye:nye;function i(l,c){let d;const p={...w.useContext(QN),...l,layoutId:cye(l)},{isStatic:h}=p,g=Fve(l),v=s(l,h);if(!h&&RN){uye();const b=dye(p);d=b.MeasureLayout,g.visualElement=oye(t,v,p,r,b.ProjectionNode)}return f.jsxs(J0.Provider,{value:g,children:[d&&g.visualElement?f.jsx(d,{visualElement:g.visualElement,...p}):null,Zve(t,l,iye(v,g.visualElement,c),v,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const a=w.forwardRef(i);return a[sye]=t,a}function cye({layoutId:t}){const e=w.useContext(CN).id;return e&&t!==void 0?e+"-"+t:t}function uye(t,e){w.useContext(HV).strict}function dye(t){const{drag:e,layout:n}=Bf;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function fye(t,e){if(typeof Proxy>"u")return v1;const n=new Map,r=(i,a)=>v1(i,a,t,e),s=(i,a)=>r(i,a);return new Proxy(s,{get:(i,a)=>a==="create"?r:(n.has(a)||n.set(a,v1(a,void 0,t,e)),n.get(a))})}function n8({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function hye({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function pye(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function y1(t){return t===void 0||t===1}function wC({scale:t,scaleX:e,scaleY:n}){return!y1(t)||!y1(e)||!y1(n)}function Xc(t){return wC(t)||r8(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function r8(t){return E4(t.x)||E4(t.y)}function E4(t){return t&&t!=="0%"}function Tx(t,e,n){const r=t-n,s=e*r;return n+s}function k4(t,e,n,r,s){return s!==void 0&&(t=Tx(t,s,r)),Tx(t,n,r)+e}function SC(t,e=0,n=1,r,s){t.min=k4(t.min,e,n,r,s),t.max=k4(t.max,e,n,r,s)}function s8(t,{x:e,y:n}){SC(t.x,e.translate,e.scale,e.originPoint),SC(t.y,n.translate,n.scale,n.originPoint)}const T4=.999999999999,C4=1.0000000000001;function mye(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,a;for(let l=0;l<s;l++){i=n[l],a=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&sf(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,s8(t,a)),r&&Xc(i.latestValues)&&sf(t,i.latestValues))}e.x<C4&&e.x>T4&&(e.x=1),e.y<C4&&e.y>T4&&(e.y=1)}function rf(t,e){t.min=t.min+e,t.max=t.max+e}function A4(t,e,n,r,s=.5){const i=Hn(t.min,t.max,s);SC(t,e,n,i,r)}function sf(t,e){A4(t.x,e.x,e.scaleX,e.scale,e.originX),A4(t.y,e.y,e.scaleY,e.scale,e.originY)}function i8(t,e){return n8(pye(t.getBoundingClientRect(),e))}function gye(t,e,n){const r=i8(t,n),{scroll:s}=e;return s&&(rf(r.x,s.offset.x),rf(r.y,s.offset.y)),r}const R4=()=>({translate:0,scale:1,origin:0,originPoint:0}),af=()=>({x:R4(),y:R4()}),N4=()=>({min:0,max:0}),ir=()=>({x:N4(),y:N4()}),EC={current:null},a8={current:!1};function vye(){if(a8.current=!0,!!RN)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>EC.current=t.matches;t.addEventListener("change",e),e()}else EC.current=!1}const yye=new WeakMap;function bye(t,e,n){for(const r in e){const s=e[r],i=n[r];if(is(s))t.addValue(r,s);else if(is(i))t.addValue(r,Uf(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const a=t.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=t.getStaticValue(r);t.addValue(r,Uf(a!==void 0?a:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const j4=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class xye{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=GN,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=Ds.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Dn.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=e_(n),this.isVariantNode=VV(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:p,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const g in h){const v=h[g];c[g]!==void 0&&is(v)&&v.set(c[g])}}mount(e){this.current=e,yye.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),a8.current||vye(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:EC.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),nc(this.notifyUpdate),nc(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=mh.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Dn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Bf){const n=Bf[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ir()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<j4.length;r++){const s=j4[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=e[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=bye(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Uf(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(Jq(r)||eV(r))?r=parseFloat(r):!Ave(r)&&rc.test(n)&&(r=PV(e,n)),this.setBaseTarget(e,is(r)?r.get():r)),is(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=rj(this.props,n,this.presenceContext?.custom);i&&(r=i[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!is(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new IN),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){KN.render(this.render)}}class o8 extends xye{constructor(){super(...arguments),this.KeyframeResolver=gve}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;is(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function l8(t,{style:e,vars:n},r,s){const i=t.style;let a;for(a in e)i[a]=e[a];s?.applyProjectionStyles(i,r);for(a in n)i.setProperty(a,n[a])}function _ye(t){return window.getComputedStyle(t)}class wye extends o8{constructor(){super(...arguments),this.type="html",this.renderInstance=l8}readValueFromInstance(e,n){if(mh.has(n))return this.projection?.isProjecting?mC(n):Pge(e,n);{const r=_ye(e),s=(LN(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return i8(e,n)}build(e,n,r){ej(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return sj(e,n,r)}}const c8=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Sye(t,e,n,r){l8(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(c8.has(s)?s:ij(s),e.attrs[s])}class Eye extends o8{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ir}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(mh.has(n)){const r=IV(n);return r&&r.default||0}return n=c8.has(n)?n:ij(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return JV(e,n,r)}build(e,n,r){YV(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){Sye(e,n,r,s)}mount(e){this.isSVGTag=XV(e.tagName),super.mount(e)}}const kye=(t,e)=>nj(t)?new Eye(e):new wye(e,{allowProjection:t!==w.Fragment});function wf(t,e,n){const r=t.getProps();return rj(r,e,n!==void 0?n:r.custom,t)}const kC=t=>Array.isArray(t);function Tye(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Uf(n))}function Cye(t){return kC(t)?t[t.length-1]||0:t}function Aye(t,e){const n=wf(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const l=Cye(i[a]);Tye(t,a,l)}}function Rye(t){return!!(is(t)&&t.add)}function TC(t,e){const n=t.getValue("willChange");if(Rye(n))return n.add(e);if(!n&&Go.WillChange){const r=new Go.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function u8(t){return t.props[ZV]}const Nye=t=>t!==null;function jye(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Nye),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[i]}const Mye={type:"spring",stiffness:500,damping:25,restSpeed:10},Oye=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Iye={type:"keyframes",duration:.8},Pye={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Dye=(t,{keyframes:e})=>e.length>2?Iye:mh.has(t)?t.startsWith("scale")?Oye(e[1]):Mye:Pye;function Lye({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:l,from:c,elapsed:d,...p}){return!!Object.keys(p).length}const aj=(t,e,n,r={},s,i)=>a=>{const l=WN(r,t)||{},c=l.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Va(c);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:g=>{e.set(g),l.onUpdate&&l.onUpdate(g)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};Lye(l)||Object.assign(p,Dye(t,p)),p.duration&&(p.duration=Va(p.duration)),p.repeatDelay&&(p.repeatDelay=Va(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let h=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(xC(p),p.delay===0&&(h=!0)),(Go.instantAnimations||Go.skipAnimations)&&(h=!0,xC(p),p.delay=0),p.allowFlatten=!l.type&&!l.ease,h&&!i&&e.get()!==void 0){const g=jye(p.keyframes,l);if(g!==void 0){Dn.update(()=>{p.onUpdate(g),p.onComplete()});return}}return l.isSync?new VN(p):new sve(p)};function $ye({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function d8(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:a,...l}=e;r&&(i=r);const c=[],d=s&&t.animationState&&t.animationState.getState()[s];for(const p in l){const h=t.getValue(p,t.latestValues[p]??null),g=l[p];if(g===void 0||d&&$ye(d,p))continue;const v={delay:n,...WN(i||{},p)},b=h.get();if(b!==void 0&&!h.isAnimating&&!Array.isArray(g)&&g===b&&!v.velocity)continue;let x=!1;if(window.MotionHandoffAnimation){const S=u8(t);if(S){const k=window.MotionHandoffAnimation(S,p,Dn);k!==null&&(v.startTime=k,x=!0)}}TC(t,p),h.start(aj(p,h,g,t.shouldReduceMotion&&jV.has(p)?{type:!1}:v,t,x));const E=h.animation;E&&c.push(E)}return a&&Promise.all(c).then(()=>{Dn.update(()=>{a&&Aye(t,a)})}),c}function f8(t,e,n,r=0,s=1){const i=Array.from(t).sort((d,p)=>d.sortNodePosition(p)).indexOf(e),a=t.size,l=(a-1)*r;return typeof n=="function"?n(i,a):s===1?i*r:l-i*r}function CC(t,e,n={}){const r=wf(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(d8(t,r,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:h}=s;return zye(t,e,c,d,p,h,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,d]=l==="beforeChildren"?[i,a]:[a,i];return c().then(()=>d())}else return Promise.all([i(),a(n.delay)])}function zye(t,e,n=0,r=0,s=0,i=1,a){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(CC(c,e,{...a,delay:n+(typeof r=="function"?0:r)+f8(t.variantChildren,c,r,s,i)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function Fye(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>CC(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=CC(t,e,n);else{const s=typeof e=="function"?wf(t,e,n.custom):e;r=Promise.all(d8(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function h8(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const Uye=ZN.length;function p8(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?p8(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Uye;n++){const r=ZN[n],s=t.props[r];(Zm(s)||s===!1)&&(e[r]=s)}return e}const Bye=[...JN].reverse(),Hye=JN.length;function qye(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Fye(t,n,r)))}function Vye(t){let e=qye(t),n=M4(),r=!0;const s=c=>(d,p)=>{const h=wf(t,p,c==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:g,transitionEnd:v,...b}=h;d={...d,...b,...v}}return d};function i(c){e=c(t)}function a(c){const{props:d}=t,p=p8(t.parent)||{},h=[],g=new Set;let v={},b=1/0;for(let E=0;E<Hye;E++){const S=Bye[E],k=n[S],T=d[S]!==void 0?d[S]:p[S],N=Zm(T),j=S===c?k.isActive:null;j===!1&&(b=E);let A=T===p[S]&&T!==d[S]&&N;if(A&&r&&t.manuallyAnimateOnMount&&(A=!1),k.protectedKeys={...v},!k.isActive&&j===null||!T&&!k.prevProp||Z0(T)||typeof T=="boolean")continue;const R=Gye(k.prevProp,T);let M=R||S===c&&k.isActive&&!A&&N||E>b&&N,P=!1;const O=Array.isArray(T)?T:[T];let L=O.reduce(s(S),{});j===!1&&(L={});const{prevResolvedValues:z={}}=k,G={...z,...L},W=Y=>{M=!0,g.has(Y)&&(P=!0,g.delete(Y)),k.needsAnimating[Y]=!0;const V=t.getValue(Y);V&&(V.liveStyle=!1)};for(const Y in G){const V=L[Y],te=z[Y];if(v.hasOwnProperty(Y))continue;let I=!1;kC(V)&&kC(te)?I=!h8(V,te):I=V!==te,I?V!=null?W(Y):g.add(Y):V!==void 0&&g.has(Y)?W(Y):k.protectedKeys[Y]=!0}k.prevProp=T,k.prevResolvedValues=L,k.isActive&&(v={...v,...L}),r&&t.blockInitialAnimation&&(M=!1);const X=A&&R;M&&(!X||P)&&h.push(...O.map(Y=>{const V={type:S};if(typeof Y=="string"&&r&&!X&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,I=wf(te,Y);if(te.enteringChildren&&I){const{delayChildren:re}=I.transition||{};V.delay=f8(te.enteringChildren,t,re)}}return{animation:Y,options:V}}))}if(g.size){const E={};if(typeof d.initial!="boolean"){const S=wf(t,Array.isArray(d.initial)?d.initial[0]:d.initial);S&&S.transition&&(E.transition=S.transition)}g.forEach(S=>{const k=t.getBaseTarget(S),T=t.getValue(S);T&&(T.liveStyle=!0),E[S]=k??null}),h.push({animation:E})}let x=!!h.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(x=!1),r=!1,x?e(h):Promise.resolve()}function l(c,d){if(n[c].isActive===d)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(c,d)),n[c].isActive=d;const p=a(c);for(const h in n)n[h].protectedKeys={};return p}return{animateChanges:a,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=M4(),r=!0}}}function Gye(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!h8(e,t):!1}function Gc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function M4(){return{animate:Gc(!0),whileInView:Gc(),whileHover:Gc(),whileTap:Gc(),whileDrag:Gc(),whileFocus:Gc(),exit:Gc()}}class mc{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Wye extends mc{constructor(e){super(e),e.animationState||(e.animationState=Vye(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Z0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Yye=0;class Kye extends mc{constructor(){super(...arguments),this.id=Yye++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Xye={animation:{Feature:Wye},exit:{Feature:Kye}};function tg(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Og(t){return{point:{x:t.pageX,y:t.pageY}}}const Qye=t=>e=>XN(e)&&t(e,Og(e));function vm(t,e,n,r){return tg(t,e,Qye(n),r)}const m8=1e-4,Jye=1-m8,Zye=1+m8,g8=.01,ebe=0-g8,tbe=0+g8;function vs(t){return t.max-t.min}function nbe(t,e,n){return Math.abs(t-e)<=n}function O4(t,e,n,r=.5){t.origin=r,t.originPoint=Hn(e.min,e.max,t.origin),t.scale=vs(n)/vs(e),t.translate=Hn(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Jye&&t.scale<=Zye||isNaN(t.scale))&&(t.scale=1),(t.translate>=ebe&&t.translate<=tbe||isNaN(t.translate))&&(t.translate=0)}function ym(t,e,n,r){O4(t.x,e.x,n.x,r?r.originX:void 0),O4(t.y,e.y,n.y,r?r.originY:void 0)}function I4(t,e,n){t.min=n.min+e.min,t.max=t.min+vs(e)}function rbe(t,e,n){I4(t.x,e.x,n.x),I4(t.y,e.y,n.y)}function P4(t,e,n){t.min=e.min-n.min,t.max=t.min+vs(e)}function bm(t,e,n){P4(t.x,e.x,n.x),P4(t.y,e.y,n.y)}function wi(t){return[t("x"),t("y")]}const v8=({current:t})=>t?t.ownerDocument.defaultView:null,D4=(t,e)=>Math.abs(t-e);function sbe(t,e){const n=D4(t.x,e.x),r=D4(t.y,e.y);return Math.sqrt(n**2+r**2)}class y8{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=x1(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,b=sbe(g.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!b)return;const{point:x}=g,{timestamp:E}=Gr;this.history.push({...x,timestamp:E});const{onStart:S,onMove:k}=this.handlers;v||(S&&S(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,v)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=b1(v,this.transformPagePoint),Dn.update(this.updatePoint,!0)},this.handlePointerUp=(g,v)=>{this.end();const{onEnd:b,onSessionEnd:x,resumeAnimation:E}=this.handlers;if(this.dragSnapToOrigin&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=x1(g.type==="pointercancel"?this.lastMoveEventInfo:b1(v,this.transformPagePoint),this.history);this.startEvent&&b&&b(g,S),x&&x(g,S)},!XN(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=s||window;const l=Og(e),c=b1(l,this.transformPagePoint),{point:d}=c,{timestamp:p}=Gr;this.history=[{...d,timestamp:p}];const{onSessionStart:h}=n;h&&h(e,x1(c,this.history)),this.removeListeners=Ng(vm(this.contextWindow,"pointermove",this.handlePointerMove),vm(this.contextWindow,"pointerup",this.handlePointerUp),vm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),nc(this.updatePoint)}}function b1(t,e){return e?{point:e(t.point)}:t}function L4(t,e){return{x:t.x-e.x,y:t.y-e.y}}function x1({point:t},e){return{point:t,delta:L4(t,b8(e)),offset:L4(t,ibe(e)),velocity:abe(e,.1)}}function ibe(t){return t[0]}function b8(t){return t[t.length-1]}function abe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=b8(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Va(e)));)n--;if(!r)return{x:0,y:0};const i=Ci(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function obe(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Hn(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Hn(n,t,r.max):Math.min(t,n)),t}function $4(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function lbe(t,{top:e,left:n,bottom:r,right:s}){return{x:$4(t.x,n,s),y:$4(t.y,e,r)}}function z4(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function cbe(t,e){return{x:z4(t.x,e.x),y:z4(t.y,e.y)}}function ube(t,e){let n=.5;const r=vs(t),s=vs(e);return s>r?n=Xm(e.min,e.max-r,t.min):r>s&&(n=Xm(t.min,t.max-s,e.min)),Vo(0,1,n)}function dbe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const AC=.35;function fbe(t=AC){return t===!1?t=0:t===!0&&(t=AC),{x:F4(t,"left","right"),y:F4(t,"top","bottom")}}function F4(t,e,n){return{min:U4(t,e),max:U4(t,n)}}function U4(t,e){return typeof t=="number"?t:t[e]||0}const hbe=new WeakMap;class pbe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ir(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Og(h).point)},a=(h,g)=>{const{drag:v,dragPropagation:b,onDragStart:x}=this.getProps();if(v&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xve(v),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wi(S=>{let k=this.getAxisMotionValue(S).get()||0;if(Ga.test(k)){const{projection:T}=this.visualElement;if(T&&T.layout){const N=T.layout.layoutBox[S];N&&(k=vs(N)*(parseFloat(k)/100))}}this.originPoint[S]=k}),x&&Dn.postRender(()=>x(h,g)),TC(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},l=(h,g)=>{this.latestPointerEvent=h,this.latestPanInfo=g;const{dragPropagation:v,dragDirectionLock:b,onDirectionLock:x,onDrag:E}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:S}=g;if(b&&this.currentDirection===null){this.currentDirection=mbe(S),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",g.point,S),this.updateAxis("y",g.point,S),this.visualElement.render(),E&&E(h,g)},c=(h,g)=>{this.latestPointerEvent=h,this.latestPanInfo=g,this.stop(h,g),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>wi(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:p}=this.getProps();this.panSession=new y8(e,{onSessionStart:i,onStart:a,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:r,contextWindow:v8(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:a}=s;this.startAnimation(a);const{onDragEnd:l}=this.getProps();l&&Dn.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!Ty(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=obe(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&nf(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=lbe(r.layoutBox,e):this.constraints=!1,this.elastic=fbe(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&wi(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=dbe(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!nf(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=gye(r,s.root,this.visualElement.getTransformPagePoint());let a=cbe(s.layout.layoutBox,i);if(n){const l=n(hye(a));this.hasMutatedConstraints=!!l,l&&(a=n8(l))}return a}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=wi(p=>{if(!Ty(p,n,this.currentDirection))return;let h=c&&c[p]||{};a&&(h={min:0,max:0});const g=s?200:1e6,v=s?40:1e7,b={type:"inertia",velocity:r?e[p]:0,bounceStiffness:g,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(p,b)});return Promise.all(d).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return TC(this.visualElement,e),r.start(aj(e,r,0,n,this.visualElement,!1))}stopAnimation(){wi(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){wi(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){wi(n=>{const{drag:r}=this.getProps();if(!Ty(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:l}=s.layout.layoutBox[n];i.set(e[n]-Hn(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!nf(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};wi(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();s[a]=ube({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),wi(a=>{if(!Ty(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:d}=this.constraints[a];l.set(Hn(c,d,s[a]))})}addListeners(){if(!this.visualElement.current)return;hbe.set(this.visualElement,this);const e=this.visualElement.current,n=vm(e,"pointerdown",c=>{const{drag:d,dragListener:p=!0}=this.getProps();d&&p&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();nf(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Dn.read(r);const a=tg(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(wi(p=>{const h=this.getAxisMotionValue(p);h&&(this.originPoint[p]+=c[p].translate,h.set(h.get()+c[p].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=AC,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:l}}}function Ty(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function mbe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class gbe extends mc{constructor(e){super(e),this.removeGroupControls=Pi,this.removeListeners=Pi,this.controls=new pbe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pi}unmount(){this.removeGroupControls(),this.removeListeners()}}const B4=t=>(e,n)=>{t&&Dn.postRender(()=>t(e,n))};class vbe extends mc{constructor(){super(...arguments),this.removePointerDownListener=Pi}onPointerDown(e){this.session=new y8(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:v8(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:B4(e),onStart:B4(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&Dn.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=vm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const hb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function H4(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Rp={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(wt.test(t))t=parseFloat(t);else return t;const n=H4(t,e.target.x),r=H4(t,e.target.y);return`${n}% ${r}%`}},ybe={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=rc.parse(t);if(s.length>5)return r;const i=rc.createTransformer(t),a=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+a]/=l,s[1+a]/=c;const d=Hn(l,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=d),typeof s[3+a]=="number"&&(s[3+a]/=d),i(s)}};let _1=!1;class bbe extends w.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Uve(xbe),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),_1&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),hb.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:a}=r;return a&&(a.isPresent=i,_1=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Dn.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),KN.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;_1=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function x8(t){const[e,n]=BV(),r=w.useContext(CN);return f.jsx(bbe,{...t,layoutGroup:r,switchLayoutGroup:w.useContext(e8),isPresent:e,safeToRemove:n})}const xbe={borderRadius:{...Rp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Rp,borderTopRightRadius:Rp,borderBottomLeftRadius:Rp,borderBottomRightRadius:Rp,boxShadow:ybe};function _be(t,e,n){const r=is(t)?t:Uf(t);return r.start(aj("",r,e,n)),r.animation}const wbe=(t,e)=>t.depth-e.depth;class Sbe{constructor(){this.children=[],this.isDirty=!1}add(e){NN(this.children,e),this.isDirty=!0}remove(e){jN(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(wbe),this.isDirty=!1,this.children.forEach(e)}}function Ebe(t,e){const n=Ds.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(nc(r),t(i-e))};return Dn.setup(r,!0),()=>nc(r)}const _8=["TopLeft","TopRight","BottomLeft","BottomRight"],kbe=_8.length,q4=t=>typeof t=="string"?parseFloat(t):t,V4=t=>typeof t=="number"||wt.test(t);function Tbe(t,e,n,r,s,i){s?(t.opacity=Hn(0,n.opacity??1,Cbe(r)),t.opacityExit=Hn(e.opacity??1,0,Abe(r))):i&&(t.opacity=Hn(e.opacity??1,n.opacity??1,r));for(let a=0;a<kbe;a++){const l=`border${_8[a]}Radius`;let c=G4(e,l),d=G4(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||V4(c)===V4(d)?(t[l]=Math.max(Hn(q4(c),q4(d),r),0),(Ga.test(d)||Ga.test(c))&&(t[l]+="%")):t[l]=d}(e.rotate||n.rotate)&&(t.rotate=Hn(e.rotate||0,n.rotate||0,r))}function G4(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Cbe=w8(0,.5,lV),Abe=w8(.5,.95,Pi);function w8(t,e,n){return r=>r<t?0:r>e?1:n(Xm(t,e,r))}function W4(t,e){t.min=e.min,t.max=e.max}function xi(t,e){W4(t.x,e.x),W4(t.y,e.y)}function Y4(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function K4(t,e,n,r,s){return t-=e,t=Tx(t,1/n,r),s!==void 0&&(t=Tx(t,1/s,r)),t}function Rbe(t,e=0,n=1,r=.5,s,i=t,a=t){if(Ga.test(e)&&(e=parseFloat(e),e=Hn(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=Hn(i.min,i.max,r);t===i&&(l-=e),t.min=K4(t.min,e,n,l,s),t.max=K4(t.max,e,n,l,s)}function X4(t,e,[n,r,s],i,a){Rbe(t,e[n],e[r],e[s],e.scale,i,a)}const Nbe=["x","scaleX","originX"],jbe=["y","scaleY","originY"];function Q4(t,e,n,r){X4(t.x,e,Nbe,n?n.x:void 0,r?r.x:void 0),X4(t.y,e,jbe,n?n.y:void 0,r?r.y:void 0)}function J4(t){return t.translate===0&&t.scale===1}function S8(t){return J4(t.x)&&J4(t.y)}function Z4(t,e){return t.min===e.min&&t.max===e.max}function Mbe(t,e){return Z4(t.x,e.x)&&Z4(t.y,e.y)}function e5(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function E8(t,e){return e5(t.x,e.x)&&e5(t.y,e.y)}function t5(t){return vs(t.x)/vs(t.y)}function n5(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Obe{constructor(){this.members=[]}add(e){NN(this.members,e),e.scheduleRender()}remove(e){if(jN(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Ibe(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,a=n?.z||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:d,rotate:p,rotateX:h,rotateY:g,skewX:v,skewY:b}=n;d&&(r=`perspective(${d}px) ${r}`),p&&(r+=`rotate(${p}deg) `),h&&(r+=`rotateX(${h}deg) `),g&&(r+=`rotateY(${g}deg) `),v&&(r+=`skewX(${v}deg) `),b&&(r+=`skewY(${b}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const w1=["","X","Y","Z"],Pbe=1e3;let Dbe=0;function S1(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function k8(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=u8(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Dn,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&k8(r)}function T8({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},l=e?.()){this.id=Dbe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(zbe),this.nodes.forEach(Hbe),this.nodes.forEach(qbe),this.nodes.forEach(Fbe)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Sbe)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new IN),this.eventHandlers.get(a).add(l)}notifyListeners(a,...l){const c=this.eventHandlers.get(a);c&&c.notify(...l)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=UV(a)&&!Tve(a),this.instance=a;const{layoutId:l,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let p,h=0;const g=()=>this.root.updateBlockedByResize=!1;Dn.read(()=>{h=window.innerWidth}),t(a,()=>{const v=window.innerWidth;v!==h&&(h=v,this.root.updateBlockedByResize=!0,p&&p(),p=Ebe(g,250),hb.hasAnimatedSinceResize&&(hb.hasAnimatedSinceResize=!1,this.nodes.forEach(i5)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:h,hasRelativeLayoutChanged:g,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||Kbe,{onLayoutAnimationStart:x,onLayoutAnimationComplete:E}=d.getProps(),S=!this.targetLayout||!E8(this.targetLayout,v),k=!h&&g;if(this.options.layoutRoot||this.resumeFrom||k||h&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...WN(b,"layout"),onPlay:x,onComplete:E};(d.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(p,k)}else h||i5(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),nc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Vbe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&k8(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const h=this.path[p];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(r5);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(s5);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Bbe),this.nodes.forEach(Lbe),this.nodes.forEach($be)):this.nodes.forEach(s5),this.clearAllSnapshots();const l=Ds.now();Gr.delta=Vo(0,1e3/60,l-Gr.timestamp),Gr.timestamp=l,Gr.isProcessing=!0,d1.update.process(Gr),d1.preRender.process(Gr),d1.render.process(Gr),Gr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,KN.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ube),this.sharedNodes.forEach(Gbe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Dn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Dn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!vs(this.snapshot.measuredBox.x)&&!vs(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ir(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!S8(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;a&&this.instance&&(l||Xc(this.latestValues)||p)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return a&&(c=this.removeTransform(c)),Xbe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:a}=this.options;if(!a)return ir();const l=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Qbe))){const{scroll:d}=this.root;d&&(rf(l.x,d.offset.x),rf(l.y,d.offset.y))}return l}removeElementScroll(a){const l=ir();if(xi(l,a),this.scroll?.wasRoot)return l;for(let c=0;c<this.path.length;c++){const d=this.path[c],{scroll:p,options:h}=d;d!==this.root&&p&&h.layoutScroll&&(p.wasRoot&&xi(l,a),rf(l.x,p.offset.x),rf(l.y,p.offset.y))}return l}applyTransform(a,l=!1){const c=ir();xi(c,a);for(let d=0;d<this.path.length;d++){const p=this.path[d];!l&&p.options.layoutScroll&&p.scroll&&p!==p.root&&sf(c,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Xc(p.latestValues)&&sf(c,p.latestValues)}return Xc(this.latestValues)&&sf(c,this.latestValues),c}removeTransform(a){const l=ir();xi(l,a);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!Xc(d.latestValues))continue;wC(d.latestValues)&&d.updateSnapshot();const p=ir(),h=d.measurePageBox();xi(p,h),Q4(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,p)}return Xc(this.latestValues)&&Q4(l,this.latestValues),l}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Gr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:h}=this.options;if(!(!this.layout||!(p||h))){if(this.resolvedRelativeTargetAt=Gr.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ir(),this.relativeTargetOrigin=ir(),bm(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),xi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ir(),this.targetWithTransforms=ir()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rbe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xi(this.target,this.layout.layoutBox),s8(this.target,this.targetDelta)):xi(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ir(),this.relativeTargetOrigin=ir(),bm(this.relativeTargetOrigin,this.target,g.target),xi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||wC(this.parent.latestValues)||r8(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Gr.timestamp&&(c=!1),c)return;const{layout:d,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||p))return;xi(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,g=this.treeScale.y;mye(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=ir());const{target:v}=a;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Y4(this.prevProjectionDelta.x,this.projectionDelta.x),Y4(this.prevProjectionDelta.y,this.projectionDelta.y)),ym(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==g||!n5(this.projectionDelta.x,this.prevProjectionDelta.x)||!n5(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=af(),this.projectionDelta=af(),this.projectionDeltaWithTransform=af()}setAnimationOrigin(a,l=!1){const c=this.snapshot,d=c?c.latestValues:{},p={...this.latestValues},h=af();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const g=ir(),v=c?c.source:void 0,b=this.layout?this.layout.source:void 0,x=v!==b,E=this.getStack(),S=!E||E.members.length<=1,k=!!(x&&!S&&this.options.crossfade===!0&&!this.path.some(Ybe));this.animationProgress=0;let T;this.mixTargetDelta=N=>{const j=N/1e3;a5(h.x,a.x,j),a5(h.y,a.y,j),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(bm(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Wbe(this.relativeTarget,this.relativeTargetOrigin,g,j),T&&Mbe(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=ir()),xi(T,this.relativeTarget)),x&&(this.animationValues=p,Tbe(p,d,this.latestValues,j,k,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(nc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Dn.update(()=>{hb.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Uf(0)),this.currentAnimation=_be(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Pbe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:p}=a;if(!(!l||!c||!d)){if(this!==a&&this.layout&&d&&C8(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||ir();const h=vs(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+h;const g=vs(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+g}xi(l,c),sf(l,p),ym(this.projectionDeltaWithTransform,this.layoutCorrected,l,p)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new Obe),this.sharedNodes.get(a).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){const{layoutId:a}=this.options;return a?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&S1("z",a,d,this.animationValues);for(let p=0;p<w1.length;p++)S1(`rotate${w1[p]}`,a,d,this.animationValues),S1(`skew${w1[p]}`,a,d,this.animationValues);a.render();for(const p in d)a.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);a.scheduleRender()}applyProjectionStyles(a,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=fb(l?.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=fb(l?.pointerEvents)||""),this.hasProjected&&!Xc(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=Ibe(this.projectionDeltaWithTransform,this.treeScale,p);c&&(h=c(p,h)),a.transform=h;const{x:g,y:v}=this.projectionDelta;a.transformOrigin=`${g.origin*100}% ${v.origin*100}% 0`,d.animationValues?a.opacity=d===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:a.opacity=d===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const b in eg){if(p[b]===void 0)continue;const{correct:x,applyTo:E,isCSSVariable:S}=eg[b],k=h==="none"?p[b]:x(p[b],d);if(E){const T=E.length;for(let N=0;N<T;N++)a[E[N]]=k}else S?this.options.visualElement.renderState.vars[b]=k:a[b]=k}this.options.layoutId&&(a.pointerEvents=d===this?fb(l?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(r5),this.root.sharedNodes.clear()}}}function Lbe(t){t.updateLayout()}function $be(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:s}=t.options,i=e.source!==t.layout.source;s==="size"?wi(p=>{const h=i?e.measuredBox[p]:e.layoutBox[p],g=vs(h);h.min=n[p].min,h.max=h.min+g}):C8(s,e.layoutBox,n)&&wi(p=>{const h=i?e.measuredBox[p]:e.layoutBox[p],g=vs(n[p]);h.max=h.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+g)});const a=af();ym(a,n,e.layoutBox);const l=af();i?ym(l,t.applyTransform(r,!0),e.measuredBox):ym(l,n,e.layoutBox);const c=!S8(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:h,layout:g}=p;if(h&&g){const v=ir();bm(v,e.layoutBox,h.layoutBox);const b=ir();bm(b,n,g.layoutBox),E8(v,b)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=b,t.relativeTargetOrigin=v,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function zbe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Fbe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ube(t){t.clearSnapshot()}function r5(t){t.clearMeasurements()}function s5(t){t.isLayoutDirty=!1}function Bbe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function i5(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Hbe(t){t.resolveTargetDelta()}function qbe(t){t.calcProjection()}function Vbe(t){t.resetSkewAndRotation()}function Gbe(t){t.removeLeadSnapshot()}function a5(t,e,n){t.translate=Hn(e.translate,0,n),t.scale=Hn(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function o5(t,e,n,r){t.min=Hn(e.min,n.min,r),t.max=Hn(e.max,n.max,r)}function Wbe(t,e,n,r){o5(t.x,e.x,n.x,r),o5(t.y,e.y,n.y,r)}function Ybe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Kbe={duration:.45,ease:[.4,0,.1,1]},l5=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),c5=l5("applewebkit/")&&!l5("chrome/")?Math.round:Pi;function u5(t){t.min=c5(t.min),t.max=c5(t.max)}function Xbe(t){u5(t.x),u5(t.y)}function C8(t,e,n){return t==="position"||t==="preserve-aspect"&&!nbe(t5(e),t5(n),.2)}function Qbe(t){return t!==t.root&&t.scroll?.wasRoot}const Jbe=T8({attachResizeListener:(t,e)=>tg(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),E1={current:void 0},A8=T8({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!E1.current){const t=new Jbe({});t.mount(window),t.setOptions({layoutScroll:!0}),E1.current=t}return E1.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Zbe={pan:{Feature:vbe},drag:{Feature:gbe,ProjectionNode:A8,MeasureLayout:x8}};function d5(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Dn.postRender(()=>i(e,Og(e)))}class exe extends mc{mount(){const{current:e}=this.node;e&&(this.unmount=_ve(e,(n,r)=>(d5(this.node,r,"Start"),s=>d5(this.node,s,"End"))))}unmount(){}}class txe extends mc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ng(tg(this.node.current,"focus",()=>this.onFocus()),tg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function f5(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Dn.postRender(()=>i(e,Og(e)))}class nxe extends mc{mount(){const{current:e}=this.node;e&&(this.unmount=kve(e,(n,r)=>(f5(this.node,r,"Start"),(s,{success:i})=>f5(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const RC=new WeakMap,k1=new WeakMap,rxe=t=>{const e=RC.get(t.target);e&&e(t)},sxe=t=>{t.forEach(rxe)};function ixe({root:t,...e}){const n=t||document;k1.has(n)||k1.set(n,{});const r=k1.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(sxe,{root:t,...e})),r[s]}function axe(t,e,n){const r=ixe(e);return RC.set(t,n),r.observe(t),()=>{RC.delete(t),r.unobserve(t)}}const oxe={some:0,all:1};class lxe extends mc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:oxe[s]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:h}=this.node.getProps(),g=d?p:h;g&&g(c)};return axe(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(cxe(e,n))&&this.startObserver()}unmount(){}}function cxe({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const uxe={inView:{Feature:lxe},tap:{Feature:nxe},focus:{Feature:txe},hover:{Feature:exe}},dxe={layout:{ProjectionNode:A8,MeasureLayout:x8}},fxe={...Xye,...uxe,...Zbe,...dxe},ri=fye(fxe,kye);function hxe(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const pxe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mxe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gxe={};function h5(t,e){return(gxe.jsx?mxe:pxe).test(t)}const vxe=/[ \t\n\f\r]/g;function yxe(t){return typeof t=="object"?t.type==="text"?p5(t.value):!1:p5(t)}function p5(t){return t.replace(vxe,"")===""}class Ig{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ig.prototype.normal={};Ig.prototype.property={};Ig.prototype.space=void 0;function R8(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ig(n,r,e)}function NC(t){return t.toLowerCase()}class Us{constructor(e,n){this.attribute=n,this.property=e}}Us.prototype.attribute="";Us.prototype.booleanish=!1;Us.prototype.boolean=!1;Us.prototype.commaOrSpaceSeparated=!1;Us.prototype.commaSeparated=!1;Us.prototype.defined=!1;Us.prototype.mustUseProperty=!1;Us.prototype.number=!1;Us.prototype.overloadedBoolean=!1;Us.prototype.property="";Us.prototype.spaceSeparated=!1;Us.prototype.space=void 0;let bxe=0;const It=zu(),mr=zu(),jC=zu(),je=zu(),Tn=zu(),Sf=zu(),Qs=zu();function zu(){return 2**++bxe}const MC=Object.freeze(Object.defineProperty({__proto__:null,boolean:It,booleanish:mr,commaOrSpaceSeparated:Qs,commaSeparated:Sf,number:je,overloadedBoolean:jC,spaceSeparated:Tn},Symbol.toStringTag,{value:"Module"})),T1=Object.keys(MC);class oj extends Us{constructor(e,n,r,s){let i=-1;if(super(e,n),m5(this,"space",s),typeof r=="number")for(;++i<T1.length;){const a=T1[i];m5(this,T1[i],(r&MC[a])===MC[a])}}}oj.prototype.defined=!0;function m5(t,e,n){n&&(t[e]=n)}function gh(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const i=new oj(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[NC(r)]=r,n[NC(i.attribute)]=r}return new Ig(e,n,t.space)}const N8=gh({properties:{ariaActiveDescendant:null,ariaAtomic:mr,ariaAutoComplete:null,ariaBusy:mr,ariaChecked:mr,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:Tn,ariaCurrent:null,ariaDescribedBy:Tn,ariaDetails:null,ariaDisabled:mr,ariaDropEffect:Tn,ariaErrorMessage:null,ariaExpanded:mr,ariaFlowTo:Tn,ariaGrabbed:mr,ariaHasPopup:null,ariaHidden:mr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tn,ariaLevel:je,ariaLive:null,ariaModal:mr,ariaMultiLine:mr,ariaMultiSelectable:mr,ariaOrientation:null,ariaOwns:Tn,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:mr,ariaReadOnly:mr,ariaRelevant:null,ariaRequired:mr,ariaRoleDescription:Tn,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:mr,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function j8(t,e){return e in t?t[e]:e}function M8(t,e){return j8(t,e.toLowerCase())}const xxe=gh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Sf,acceptCharset:Tn,accessKey:Tn,action:null,allow:null,allowFullScreen:It,allowPaymentRequest:It,allowUserMedia:It,alt:null,as:null,async:It,autoCapitalize:null,autoComplete:Tn,autoFocus:It,autoPlay:It,blocking:Tn,capture:null,charSet:null,checked:It,cite:null,className:Tn,cols:je,colSpan:null,content:null,contentEditable:mr,controls:It,controlsList:Tn,coords:je|Sf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:It,defer:It,dir:null,dirName:null,disabled:It,download:jC,draggable:mr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:It,formTarget:null,headers:Tn,height:je,hidden:jC,high:je,href:null,hrefLang:null,htmlFor:Tn,httpEquiv:Tn,id:null,imageSizes:null,imageSrcSet:null,inert:It,inputMode:null,integrity:null,is:null,isMap:It,itemId:null,itemProp:Tn,itemRef:Tn,itemScope:It,itemType:Tn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:It,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:It,muted:It,name:null,nonce:null,noModule:It,noValidate:It,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:It,optimum:je,pattern:null,ping:Tn,placeholder:null,playsInline:It,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:It,referrerPolicy:null,rel:Tn,required:It,reversed:It,rows:je,rowSpan:je,sandbox:Tn,scope:null,scoped:It,seamless:It,selected:It,shadowRootClonable:It,shadowRootDelegatesFocus:It,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:mr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:It,useMap:null,value:mr,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tn,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:It,declare:It,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:It,noHref:It,noShade:It,noWrap:It,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:mr,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:It,disableRemotePlayback:It,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:M8}),_xe=gh({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qs,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:Tn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:It,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sf,g2:Sf,glyphName:Sf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:Qs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:je,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qs,rev:Qs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qs,requiredFeatures:Qs,requiredFonts:Qs,requiredFormats:Qs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:Qs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qs,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:j8}),O8=gh({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),I8=gh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:M8}),P8=gh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),wxe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Sxe=/[A-Z]/g,g5=/-[a-z]/g,Exe=/^data[-\w.:]+$/i;function kxe(t,e){const n=NC(e);let r=e,s=Us;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Exe.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(g5,Cxe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!g5.test(i)){let a=i.replace(Sxe,Txe);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=oj}return new s(r,e)}function Txe(t){return"-"+t.toLowerCase()}function Cxe(t){return t.charAt(1).toUpperCase()}const Axe=R8([N8,xxe,O8,I8,P8],"html"),lj=R8([N8,_xe,O8,I8,P8],"svg");function Rxe(t){return t.join(" ").trim()}var Id={},C1,v5;function Nxe(){if(v5)return C1;v5=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
1790
|
-
`,d="/",p="*",h="",g="comment",v="declaration";C1=function(x,E){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];E=E||{};var S=1,k=1;function T(G){var W=G.match(e);W&&(S+=W.length);var X=G.lastIndexOf(c);k=~X?G.length-X:k+G.length}function N(){var G={line:S,column:k};return function(W){return W.position=new j(G),M(),W}}function j(G){this.start=G,this.end={line:S,column:k},this.source=E.source}j.prototype.content=x;function A(G){var W=new Error(E.source+":"+S+":"+k+": "+G);if(W.reason=G,W.filename=E.source,W.line=S,W.column=k,W.source=x,!E.silent)throw W}function R(G){var W=G.exec(x);if(W){var X=W[0];return T(X),x=x.slice(X.length),W}}function M(){R(n)}function P(G){var W;for(G=G||[];W=O();)W!==!1&&G.push(W);return G}function O(){var G=N();if(!(d!=x.charAt(0)||p!=x.charAt(1))){for(var W=2;h!=x.charAt(W)&&(p!=x.charAt(W)||d!=x.charAt(W+1));)++W;if(W+=2,h===x.charAt(W-1))return A("End of comment missing");var X=x.slice(2,W-2);return k+=2,T(X),x=x.slice(W),k+=2,G({type:g,comment:X})}}function L(){var G=N(),W=R(r);if(W){if(O(),!R(s))return A("property missing ':'");var X=R(i),F=G({type:v,property:b(W[0].replace(t,h)),value:X?b(X[0].replace(t,h)):h});return R(a),F}}function z(){var G=[];P(G);for(var W;W=L();)W!==!1&&(G.push(W),P(G));return G}return M(),z()};function b(x){return x?x.replace(l,h):h}return C1}var y5;function jxe(){if(y5)return Id;y5=1;var t=Id&&Id.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Id,"__esModule",{value:!0}),Id.default=n;var e=t(Nxe());function n(r,s){var i=null;if(!r||typeof r!="string")return i;var a=(0,e.default)(r),l=typeof s=="function";return a.forEach(function(c){if(c.type==="declaration"){var d=c.property,p=c.value;l?s(d,p,c):p&&(i=i||{},i[d]=p)}}),i}return Id}var Np={},b5;function Mxe(){if(b5)return Np;b5=1,Object.defineProperty(Np,"__esModule",{value:!0}),Np.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||n.test(d)||t.test(d)},a=function(d,p){return p.toUpperCase()},l=function(d,p){return"".concat(p,"-")},c=function(d,p){return p===void 0&&(p={}),i(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(s,l):d=d.replace(r,l),d.replace(e,a))};return Np.camelCase=c,Np}var jp,x5;function Oxe(){if(x5)return jp;x5=1;var t=jp&&jp.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(jxe()),n=Mxe();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,jp=r,jp}var Ixe=Oxe();const Pxe=nh(Ixe),D8=L8("end"),cj=L8("start");function L8(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Dxe(t){const e=cj(t),n=D8(t);if(e&&n)return{start:e,end:n}}function xm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?_5(t.position):"start"in t||"end"in t?_5(t):"line"in t||"column"in t?OC(t):""}function OC(t){return w5(t&&t.line)+":"+w5(t&&t.column)}function _5(t){return OC(t&&t.start)+"-"+OC(t&&t.end)}function w5(t){return t&&typeof t=="number"?t:1}class cs extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=xm(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}cs.prototype.file="";cs.prototype.name="";cs.prototype.reason="";cs.prototype.message="";cs.prototype.stack="";cs.prototype.column=void 0;cs.prototype.line=void 0;cs.prototype.ancestors=void 0;cs.prototype.cause=void 0;cs.prototype.fatal=void 0;cs.prototype.place=void 0;cs.prototype.ruleId=void 0;cs.prototype.source=void 0;const uj={}.hasOwnProperty,Lxe=new Map,$xe=/[A-Z]/g,zxe=new Set(["table","tbody","thead","tfoot","tr"]),Fxe=new Set(["td","th"]),$8="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Uxe(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Kxe(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Yxe(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?lj:Axe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=z8(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function z8(t,e,n){if(e.type==="element")return Bxe(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Hxe(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Vxe(t,e,n);if(e.type==="mdxjsEsm")return qxe(t,e);if(e.type==="root")return Gxe(t,e,n);if(e.type==="text")return Wxe(t,e)}function Bxe(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=lj,t.schema=s),t.ancestors.push(e);const i=U8(t,e.tagName,!1),a=Xxe(t,e);let l=fj(t,e);return zxe.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!yxe(c):!0})),F8(t,a,i,e),dj(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Hxe(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}ng(t,e.position)}function qxe(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ng(t,e.position)}function Vxe(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=lj,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:U8(t,e.name,!0),a=Qxe(t,e),l=fj(t,e);return F8(t,a,i,e),dj(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Gxe(t,e,n){const r={};return dj(r,fj(t,e)),t.create(e,t.Fragment,r,n)}function Wxe(t,e){return e.value}function F8(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function dj(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Yxe(t,e,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:e;return l?d(i,a,l):d(i,a)}}function Kxe(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=cj(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function Xxe(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&uj.call(e.properties,s)){const i=Jxe(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Fxe.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Qxe(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else ng(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else ng(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function fj(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:Lxe;for(;++r<e.children.length;){const i=e.children[r];let a;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=z8(t,i,a);l!==void 0&&n.push(l)}return n}function Jxe(t,e,n){const r=kxe(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?hxe(n):Rxe(n)),r.property==="style"){let s=typeof n=="object"?n:Zxe(t,String(n));return t.stylePropertyNameCase==="css"&&(s=e0e(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?wxe[r.property]||r.property:r.attribute,n]}}function Zxe(t,e){try{return Pxe(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new cs("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=$8+"#cannot-parse-style-attribute",s}}function U8(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,a;for(;++i<s.length;){const l=h5(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=h5(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return uj.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);ng(t)}function ng(t,e){const n=new cs("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=$8+"#cannot-handle-mdx-estrees-without-createevaluater",n}function e0e(t){const e={};let n;for(n in t)uj.call(t,n)&&(e[t0e(n)]=t[n]);return e}function t0e(t){let e=t.replace($xe,n0e);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function n0e(t){return"-"+t.toLowerCase()}const A1={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},r0e={};function hj(t,e){const n=r0e,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return B8(t,r,s)}function B8(t,e,n){if(s0e(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return S5(t.children,e,n)}return Array.isArray(t)?S5(t,e,n):""}function S5(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=B8(t[s],e,n);return r.join("")}function s0e(t){return!!(t&&typeof t=="object")}const E5=document.createElement("i");function pj(t){const e="&"+t+";";E5.innerHTML=e;const n=E5.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function li(t,e,n,r){const s=t.length;let i=0,a;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function ki(t,e){return t.length>0?(li(t,t.length,0,e),t):e}const k5={}.hasOwnProperty;function H8(t){const e={};let n=-1;for(;++n<t.length;)i0e(e,t[n]);return e}function i0e(t,e){let n;for(n in e){const s=(k5.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let a;if(i)for(a in i){k5.call(s,a)||(s[a]=[]);const l=i[a];a0e(s[a],Array.isArray(l)?l:l?[l]:[])}}}function a0e(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);li(t,0,0,r)}function q8(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function la(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ms=gc(/[A-Za-z]/),as=gc(/[\dA-Za-z]/),o0e=gc(/[#-'*+\--9=?A-Z^-~]/);function Cx(t){return t!==null&&(t<32||t===127)}const IC=gc(/\d/),l0e=gc(/[\dA-Fa-f]/),c0e=gc(/[!-/:-@[-`{-~]/);function ct(t){return t!==null&&t<-2}function Sn(t){return t!==null&&(t<0||t===32)}function Gt(t){return t===-2||t===-1||t===32}const t_=gc(new RegExp("\\p{P}|\\p{S}","u")),Mu=gc(/\s/);function gc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function vh(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const i=t.charCodeAt(n);let a="";if(i===37&&as(t.charCodeAt(n+1))&&as(t.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function tn(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Gt(c)?(t.enter(n),l(c)):e(c)}function l(c){return Gt(c)&&i++<s?(t.consume(c),l):(t.exit(n),e(c))}}const u0e={tokenize:d0e};function d0e(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),tn(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return ct(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),a)}}const f0e={tokenize:h0e},T5={tokenize:p0e};function h0e(t){const e=this,n=[];let r=0,s,i,a;return l;function l(T){if(r<n.length){const N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,c,d)(T)}return d(T)}function c(T){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&k();const N=e.events.length;let j=N,A;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){A=e.events[j][1].end;break}S(r);let R=N;for(;R<e.events.length;)e.events[R][1].end={...A},R++;return li(e.events,j+1,0,e.events.slice(N)),e.events.length=R,d(T)}return l(T)}function d(T){if(r===n.length){if(!s)return g(T);if(s.currentConstruct&&s.currentConstruct.concrete)return b(T);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(T5,p,h)(T)}function p(T){return s&&k(),S(r),g(T)}function h(T){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,b(T)}function g(T){return e.containerState={},t.attempt(T5,v,b)(T)}function v(T){return r++,n.push([e.currentConstruct,e.containerState]),g(T)}function b(T){if(T===null){s&&k(),S(0),t.consume(T);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),x(T)}function x(T){if(T===null){E(t.exit("chunkFlow"),!0),S(0),t.consume(T);return}return ct(T)?(t.consume(T),E(t.exit("chunkFlow")),r=0,e.interrupt=void 0,l):(t.consume(T),x)}function E(T,N){const j=e.sliceStream(T);if(N&&j.push(null),T.previous=i,i&&(i.next=T),i=T,s.defineSkip(T.start),s.write(j),e.parser.lazy[T.start.line]){let A=s.events.length;for(;A--;)if(s.events[A][1].start.offset<a&&(!s.events[A][1].end||s.events[A][1].end.offset>a))return;const R=e.events.length;let M=R,P,O;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){if(P){O=e.events[M][1].end;break}P=!0}for(S(r),A=R;A<e.events.length;)e.events[A][1].end={...O},A++;li(e.events,M+1,0,e.events.slice(R)),e.events.length=A}}function S(T){let N=n.length;for(;N-- >T;){const j=n[N];e.containerState=j[1],j[0].exit.call(e,t)}n.length=T}function k(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function p0e(t,e,n){return tn(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hf(t){if(t===null||Sn(t)||Mu(t))return 1;if(t_(t))return 2}function n_(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const PC={name:"attention",resolveAll:m0e,tokenize:g0e};function m0e(t,e){let n=-1,r,s,i,a,l,c,d,p;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},g={...t[n][1].start};C5(h,-c),C5(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=ki(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=ki(d,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),d=ki(d,n_(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=ki(d,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(p=2,d=ki(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):p=0,li(t,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function g0e(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Hf(r);let i;return a;function a(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const d=t.exit("attentionSequence"),p=Hf(c),h=!p||p===2&&s||n.includes(c),g=!s||s===2&&p||n.includes(r);return d._open=!!(i===42?h:h&&(s||!g)),d._close=!!(i===42?g:g&&(p||!h)),e(c)}}function C5(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const v0e={name:"autolink",tokenize:y0e};function y0e(t,e,n){let r=0;return s;function s(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(v){return ms(v)?(t.consume(v),a):v===64?n(v):d(v)}function a(v){return v===43||v===45||v===46||as(v)?(r=1,l(v)):d(v)}function l(v){return v===58?(t.consume(v),r=0,c):(v===43||v===45||v===46||as(v))&&r++<32?(t.consume(v),l):(r=0,d(v))}function c(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):v===null||v===32||v===60||Cx(v)?n(v):(t.consume(v),c)}function d(v){return v===64?(t.consume(v),p):o0e(v)?(t.consume(v),d):n(v)}function p(v){return as(v)?h(v):n(v)}function h(v){return v===46?(t.consume(v),r=0,p):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):g(v)}function g(v){if((v===45||as(v))&&r++<63){const b=v===45?g:h;return t.consume(v),b}return n(v)}}const Pg={partial:!0,tokenize:b0e};function b0e(t,e,n){return r;function r(i){return Gt(i)?tn(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||ct(i)?e(i):n(i)}}const V8={continuation:{tokenize:_0e},exit:w0e,name:"blockQuote",tokenize:x0e};function x0e(t,e,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Gt(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function _0e(t,e,n){const r=this;return s;function s(a){return Gt(a)?tn(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(V8,e,n)(a)}}function w0e(t){t.exit("blockQuote")}const G8={name:"characterEscape",tokenize:S0e};function S0e(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return c0e(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const W8={name:"characterReference",tokenize:E0e};function E0e(t,e,n){const r=this;let s=0,i,a;return l;function l(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),c}function c(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),i=31,a=as,p(h))}function d(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=l0e,p):(t.enter("characterReferenceValue"),i=7,a=IC,p(h))}function p(h){if(h===59&&s){const g=t.exit("characterReferenceValue");return a===as&&!pj(r.sliceSerialize(g))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(h)&&s++<i?(t.consume(h),p):n(h)}}const A5={partial:!0,tokenize:T0e},R5={concrete:!0,name:"codeFenced",tokenize:k0e};function k0e(t,e,n){const r=this,s={partial:!0,tokenize:j};let i=0,a=0,l;return c;function c(A){return d(A)}function d(A){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=A,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),p(A)}function p(A){return A===l?(a++,t.consume(A),p):a<3?n(A):(t.exit("codeFencedFenceSequence"),Gt(A)?tn(t,h,"whitespace")(A):h(A))}function h(A){return A===null||ct(A)?(t.exit("codeFencedFence"),r.interrupt?e(A):t.check(A5,x,N)(A)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||ct(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(A)):Gt(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),tn(t,v,"whitespace")(A)):A===96&&A===l?n(A):(t.consume(A),g)}function v(A){return A===null||ct(A)?h(A):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(A))}function b(A){return A===null||ct(A)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(A)):A===96&&A===l?n(A):(t.consume(A),b)}function x(A){return t.attempt(s,N,E)(A)}function E(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),S}function S(A){return i>0&&Gt(A)?tn(t,k,"linePrefix",i+1)(A):k(A)}function k(A){return A===null||ct(A)?t.check(A5,x,N)(A):(t.enter("codeFlowValue"),T(A))}function T(A){return A===null||ct(A)?(t.exit("codeFlowValue"),k(A)):(t.consume(A),T)}function N(A){return t.exit("codeFenced"),e(A)}function j(A,R,M){let P=0;return O;function O(X){return A.enter("lineEnding"),A.consume(X),A.exit("lineEnding"),L}function L(X){return A.enter("codeFencedFence"),Gt(X)?tn(A,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):z(X)}function z(X){return X===l?(A.enter("codeFencedFenceSequence"),G(X)):M(X)}function G(X){return X===l?(P++,A.consume(X),G):P>=a?(A.exit("codeFencedFenceSequence"),Gt(X)?tn(A,W,"whitespace")(X):W(X)):M(X)}function W(X){return X===null||ct(X)?(A.exit("codeFencedFence"),R(X)):M(X)}}}function T0e(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const R1={name:"codeIndented",tokenize:A0e},C0e={partial:!0,tokenize:R0e};function A0e(t,e,n){const r=this;return s;function s(d){return t.enter("codeIndented"),tn(t,i,"linePrefix",5)(d)}function i(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):ct(d)?t.attempt(C0e,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||ct(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function R0e(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ct(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):tn(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):ct(a)?s(a):n(a)}}const N0e={name:"codeText",previous:M0e,resolve:j0e,tokenize:O0e};function j0e(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function M0e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function O0e(t,e,n){let r=0,s,i;return a;function a(h){return t.enter("codeText"),t.enter("codeTextSequence"),l(h)}function l(h){return h===96?(t.consume(h),r++,l):(t.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),c):h===96?(i=t.enter("codeTextSequence"),s=0,p(h)):ct(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("codeTextData"),d(h))}function d(h){return h===null||h===32||h===96||ct(h)?(t.exit("codeTextData"),c(h)):(t.consume(h),d)}function p(h){return h===96?(t.consume(h),s++,p):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(i.type="codeTextData",d(h))}}class I0e{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Mp(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Mp(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Mp(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Mp(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Mp(this.left,n.reverse())}}}function Mp(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Y8(t){const e={};let n=-1,r,s,i,a,l,c,d;const p=new I0e(t);for(;++n<p.length;){for(;n in e;)n=e[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,P0e(p,n)),n=e[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return li(t,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function P0e(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let p,h,g=-1,v=n,b=0,x=0;const E=[x];for(;v;){for(;t.get(++s)[1]!==v;);i.push(s),v._tokenizer||(p=r.sliceStream(v),v.next||p.push(null),h&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(x=g+1,E.push(x),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),g=E.length;g--;){const S=l.slice(E[g],E[g+1]),k=i.pop();c.push([k,k+S.length-1]),t.splice(k,2,S)}for(c.reverse(),g=-1;++g<c.length;)d[b+c[g][0]]=b+c[g][1],b+=c[g][1]-c[g][0]-1;return d}const D0e={resolve:$0e,tokenize:z0e},L0e={partial:!0,tokenize:F0e};function $0e(t){return Y8(t),t}function z0e(t,e){let n;return r;function r(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ct(l)?t.check(L0e,a,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function F0e(t,e,n){const r=this;return s;function s(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),tn(t,i,"linePrefix")}function i(a){if(a===null||ct(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function K8(t,e,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let p=0;return h;function h(S){return S===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(S),t.exit(i),g):S===null||S===32||S===41||Cx(S)?n(S):(t.enter(r),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),x(S))}function g(S){return S===62?(t.enter(i),t.consume(S),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(t.exit("chunkString"),t.exit(l),g(S)):S===null||S===60||ct(S)?n(S):(t.consume(S),S===92?b:v)}function b(S){return S===60||S===62||S===92?(t.consume(S),v):v(S)}function x(S){return!p&&(S===null||S===41||Sn(S))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(S)):p<d&&S===40?(t.consume(S),p++,x):S===41?(t.consume(S),p--,x):S===null||S===32||S===40||Cx(S)?n(S):(t.consume(S),S===92?E:x)}function E(S){return S===40||S===41||S===92?(t.consume(S),x):x(S)}}function X8(t,e,n,r,s,i){const a=this;let l=0,c;return d;function d(v){return t.enter(r),t.enter(s),t.consume(v),t.exit(s),t.enter(i),p}function p(v){return l>999||v===null||v===91||v===93&&!c||v===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):ct(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),p):(t.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||v===91||v===93||ct(v)||l++>999?(t.exit("chunkString"),p(v)):(t.consume(v),c||(c=!Gt(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(t.consume(v),l++,h):h(v)}}function Q8(t,e,n,r,s,i){let a;return l;function l(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),d(g))}function d(g){return g===a?(t.exit(i),c(a)):g===null?n(g):ct(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),tn(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||ct(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?h:p)}function h(g){return g===a||g===92?(t.consume(g),p):p(g)}}function _m(t,e){let n;return r;function r(s){return ct(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Gt(s)?tn(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const U0e={name:"definition",tokenize:H0e},B0e={partial:!0,tokenize:q0e};function H0e(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),a(v)}function a(v){return X8.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function l(v){return s=la(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),c):n(v)}function c(v){return Sn(v)?_m(t,d)(v):d(v)}function d(v){return K8(t,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return t.attempt(B0e,h,h)(v)}function h(v){return Gt(v)?tn(t,g,"whitespace")(v):g(v)}function g(v){return v===null||ct(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function q0e(t,e,n){return r;function r(l){return Sn(l)?_m(t,s)(l):n(l)}function s(l){return Q8(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Gt(l)?tn(t,a,"whitespace")(l):a(l)}function a(l){return l===null||ct(l)?e(l):n(l)}}const V0e={name:"hardBreakEscape",tokenize:G0e};function G0e(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ct(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const W0e={name:"headingAtx",resolve:Y0e,tokenize:K0e};function Y0e(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},li(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function K0e(t,e,n){let r=0;return s;function s(p){return t.enter("atxHeading"),i(p)}function i(p){return t.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(t.consume(p),a):p===null||Sn(p)?(t.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(t.enter("atxHeadingSequence"),c(p)):p===null||ct(p)?(t.exit("atxHeading"),e(p)):Gt(p)?tn(t,l,"whitespace")(p):(t.enter("atxHeadingText"),d(p))}function c(p){return p===35?(t.consume(p),c):(t.exit("atxHeadingSequence"),l(p))}function d(p){return p===null||p===35||Sn(p)?(t.exit("atxHeadingText"),l(p)):(t.consume(p),d)}}const X0e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],N5=["pre","script","style","textarea"],Q0e={concrete:!0,name:"htmlFlow",resolveTo:e_e,tokenize:t_e},J0e={partial:!0,tokenize:r_e},Z0e={partial:!0,tokenize:n_e};function e_e(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function t_e(t,e,n){const r=this;let s,i,a,l,c;return d;function d(D){return p(D)}function p(D){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(D),h}function h(D){return D===33?(t.consume(D),g):D===47?(t.consume(D),i=!0,x):D===63?(t.consume(D),s=3,r.interrupt?e:I):ms(D)?(t.consume(D),a=String.fromCharCode(D),E):n(D)}function g(D){return D===45?(t.consume(D),s=2,v):D===91?(t.consume(D),s=5,l=0,b):ms(D)?(t.consume(D),s=4,r.interrupt?e:I):n(D)}function v(D){return D===45?(t.consume(D),r.interrupt?e:I):n(D)}function b(D){const Z="CDATA[";return D===Z.charCodeAt(l++)?(t.consume(D),l===Z.length?r.interrupt?e:z:b):n(D)}function x(D){return ms(D)?(t.consume(D),a=String.fromCharCode(D),E):n(D)}function E(D){if(D===null||D===47||D===62||Sn(D)){const Z=D===47,he=a.toLowerCase();return!Z&&!i&&N5.includes(he)?(s=1,r.interrupt?e(D):z(D)):X0e.includes(a.toLowerCase())?(s=6,Z?(t.consume(D),S):r.interrupt?e(D):z(D)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):i?k(D):T(D))}return D===45||as(D)?(t.consume(D),a+=String.fromCharCode(D),E):n(D)}function S(D){return D===62?(t.consume(D),r.interrupt?e:z):n(D)}function k(D){return Gt(D)?(t.consume(D),k):O(D)}function T(D){return D===47?(t.consume(D),O):D===58||D===95||ms(D)?(t.consume(D),N):Gt(D)?(t.consume(D),T):O(D)}function N(D){return D===45||D===46||D===58||D===95||as(D)?(t.consume(D),N):j(D)}function j(D){return D===61?(t.consume(D),A):Gt(D)?(t.consume(D),j):T(D)}function A(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(t.consume(D),c=D,R):Gt(D)?(t.consume(D),A):M(D)}function R(D){return D===c?(t.consume(D),c=null,P):D===null||ct(D)?n(D):(t.consume(D),R)}function M(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Sn(D)?j(D):(t.consume(D),M)}function P(D){return D===47||D===62||Gt(D)?T(D):n(D)}function O(D){return D===62?(t.consume(D),L):n(D)}function L(D){return D===null||ct(D)?z(D):Gt(D)?(t.consume(D),L):n(D)}function z(D){return D===45&&s===2?(t.consume(D),F):D===60&&s===1?(t.consume(D),Y):D===62&&s===4?(t.consume(D),re):D===63&&s===3?(t.consume(D),I):D===93&&s===5?(t.consume(D),te):ct(D)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(J0e,ue,G)(D)):D===null||ct(D)?(t.exit("htmlFlowData"),G(D)):(t.consume(D),z)}function G(D){return t.check(Z0e,W,ue)(D)}function W(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),X}function X(D){return D===null||ct(D)?G(D):(t.enter("htmlFlowData"),z(D))}function F(D){return D===45?(t.consume(D),I):z(D)}function Y(D){return D===47?(t.consume(D),a="",V):z(D)}function V(D){if(D===62){const Z=a.toLowerCase();return N5.includes(Z)?(t.consume(D),re):z(D)}return ms(D)&&a.length<8?(t.consume(D),a+=String.fromCharCode(D),V):z(D)}function te(D){return D===93?(t.consume(D),I):z(D)}function I(D){return D===62?(t.consume(D),re):D===45&&s===2?(t.consume(D),I):z(D)}function re(D){return D===null||ct(D)?(t.exit("htmlFlowData"),ue(D)):(t.consume(D),re)}function ue(D){return t.exit("htmlFlow"),e(D)}}function n_e(t,e,n){const r=this;return s;function s(a){return ct(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function r_e(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(Pg,e,n)}}const s_e={name:"htmlText",tokenize:i_e};function i_e(t,e,n){const r=this;let s,i,a;return l;function l(I){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(I),c}function c(I){return I===33?(t.consume(I),d):I===47?(t.consume(I),j):I===63?(t.consume(I),T):ms(I)?(t.consume(I),M):n(I)}function d(I){return I===45?(t.consume(I),p):I===91?(t.consume(I),i=0,b):ms(I)?(t.consume(I),k):n(I)}function p(I){return I===45?(t.consume(I),v):n(I)}function h(I){return I===null?n(I):I===45?(t.consume(I),g):ct(I)?(a=h,Y(I)):(t.consume(I),h)}function g(I){return I===45?(t.consume(I),v):h(I)}function v(I){return I===62?F(I):I===45?g(I):h(I)}function b(I){const re="CDATA[";return I===re.charCodeAt(i++)?(t.consume(I),i===re.length?x:b):n(I)}function x(I){return I===null?n(I):I===93?(t.consume(I),E):ct(I)?(a=x,Y(I)):(t.consume(I),x)}function E(I){return I===93?(t.consume(I),S):x(I)}function S(I){return I===62?F(I):I===93?(t.consume(I),S):x(I)}function k(I){return I===null||I===62?F(I):ct(I)?(a=k,Y(I)):(t.consume(I),k)}function T(I){return I===null?n(I):I===63?(t.consume(I),N):ct(I)?(a=T,Y(I)):(t.consume(I),T)}function N(I){return I===62?F(I):T(I)}function j(I){return ms(I)?(t.consume(I),A):n(I)}function A(I){return I===45||as(I)?(t.consume(I),A):R(I)}function R(I){return ct(I)?(a=R,Y(I)):Gt(I)?(t.consume(I),R):F(I)}function M(I){return I===45||as(I)?(t.consume(I),M):I===47||I===62||Sn(I)?P(I):n(I)}function P(I){return I===47?(t.consume(I),F):I===58||I===95||ms(I)?(t.consume(I),O):ct(I)?(a=P,Y(I)):Gt(I)?(t.consume(I),P):F(I)}function O(I){return I===45||I===46||I===58||I===95||as(I)?(t.consume(I),O):L(I)}function L(I){return I===61?(t.consume(I),z):ct(I)?(a=L,Y(I)):Gt(I)?(t.consume(I),L):P(I)}function z(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),s=I,G):ct(I)?(a=z,Y(I)):Gt(I)?(t.consume(I),z):(t.consume(I),W)}function G(I){return I===s?(t.consume(I),s=void 0,X):I===null?n(I):ct(I)?(a=G,Y(I)):(t.consume(I),G)}function W(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Sn(I)?P(I):(t.consume(I),W)}function X(I){return I===47||I===62||Sn(I)?P(I):n(I)}function F(I){return I===62?(t.consume(I),t.exit("htmlTextData"),t.exit("htmlText"),e):n(I)}function Y(I){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),V}function V(I){return Gt(I)?tn(t,te,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):te(I)}function te(I){return t.enter("htmlTextData"),a(I)}}const mj={name:"labelEnd",resolveAll:c_e,resolveTo:u_e,tokenize:d_e},a_e={tokenize:f_e},o_e={tokenize:h_e},l_e={tokenize:p_e};function c_e(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&li(t,0,t.length,n),t}function u_e(t,e){let n=t.length,r=0,s,i,a,l;for(;n--;)if(s=t[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[i][1].start},end:{...t[a][1].end}},p={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",d,e]],l=ki(l,t.slice(i+1,i+r+3)),l=ki(l,[["enter",p,e]]),l=ki(l,n_(e.parser.constructs.insideSpan.null,t.slice(i+r+4,a-3),e)),l=ki(l,[["exit",p,e],t[a-2],t[a-1],["exit",d,e]]),l=ki(l,t.slice(a+1)),l=ki(l,[["exit",c,e]]),li(t,i,t.length,l),t}function d_e(t,e,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(g){return i?i._inactive?h(g):(a=r.parser.defined.includes(la(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),c):n(g)}function c(g){return g===40?t.attempt(a_e,p,a?p:h)(g):g===91?t.attempt(o_e,p,a?d:h)(g):a?p(g):h(g)}function d(g){return t.attempt(l_e,p,h)(g)}function p(g){return e(g)}function h(g){return i._balanced=!0,n(g)}}function f_e(t,e,n){return r;function r(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),s}function s(h){return Sn(h)?_m(t,i)(h):i(h)}function i(h){return h===41?p(h):K8(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Sn(h)?_m(t,c)(h):p(h)}function l(h){return n(h)}function c(h){return h===34||h===39||h===40?Q8(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function d(h){return Sn(h)?_m(t,p)(h):p(h)}function p(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function h_e(t,e,n){const r=this;return s;function s(l){return X8.call(r,t,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(la(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function a(l){return n(l)}}function p_e(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const m_e={name:"labelStartImage",resolveAll:mj.resolveAll,tokenize:g_e};function g_e(t,e,n){const r=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const v_e={name:"labelStartLink",resolveAll:mj.resolveAll,tokenize:y_e};function y_e(t,e,n){const r=this;return s;function s(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const N1={name:"lineEnding",tokenize:b_e};function b_e(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),tn(t,e,"linePrefix")}}const pb={name:"thematicBreak",tokenize:x_e};function x_e(t,e,n){let r=0,s;return i;function i(d){return t.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(t.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||ct(d))?(t.exit("thematicBreak"),e(d)):n(d)}function c(d){return d===s?(t.consume(d),r++,c):(t.exit("thematicBreakSequence"),Gt(d)?tn(t,l,"whitespace")(d):l(d))}}const Cs={continuation:{tokenize:E_e},exit:T_e,name:"list",tokenize:S_e},__e={partial:!0,tokenize:C_e},w_e={partial:!0,tokenize:k_e};function S_e(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:IC(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(pb,n,d)(v):d(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(v)}return n(v)}function c(v){return IC(v)&&++a<10?(t.consume(v),c):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):n(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(Pg,r.interrupt?n:p,t.attempt(__e,g,h))}function p(v){return r.containerState.initialBlankLine=!0,i++,g(v)}function h(v){return Gt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function E_e(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Pg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tn(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Gt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(w_e,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,tn(t,t.attempt(Cs,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function k_e(t,e,n){const r=this;return tn(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function T_e(t){t.exit(this.containerState.type)}function C_e(t,e,n){const r=this;return tn(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Gt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const j5={name:"setextUnderline",resolveTo:A_e,tokenize:R_e};function A_e(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function R_e(t,e,n){const r=this;let s;return i;function i(d){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),Gt(d)?tn(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||ct(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const N_e={tokenize:j_e};function j_e(t){const e=this,n=t.attempt(Pg,r,t.attempt(this.parser.constructs.flowInitial,s,tn(t,t.attempt(this.parser.constructs.flow,s,t.attempt(D0e,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const M_e={resolveAll:Z8()},O_e=J8("string"),I_e=J8("text");function J8(t){return{resolveAll:Z8(t==="text"?P_e:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(p){return d(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return d(p)?(n.exit("data"),i(p)):(n.consume(p),c)}function d(p){if(p===null)return!0;const h=s[p];let g=-1;if(h)for(;++g<h.length;){const v=h[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function Z8(t){return e;function e(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(n,r):n}}function P_e(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],s=e.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const d={type:n===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const D_e={42:Cs,43:Cs,45:Cs,48:Cs,49:Cs,50:Cs,51:Cs,52:Cs,53:Cs,54:Cs,55:Cs,56:Cs,57:Cs,62:V8},L_e={91:U0e},$_e={[-2]:R1,[-1]:R1,32:R1},z_e={35:W0e,42:pb,45:[j5,pb],60:Q0e,61:j5,95:pb,96:R5,126:R5},F_e={38:W8,92:G8},U_e={[-5]:N1,[-4]:N1,[-3]:N1,33:m_e,38:W8,42:PC,60:[v0e,s_e],91:v_e,92:[V0e,G8],93:mj,95:PC,96:N0e},B_e={null:[PC,M_e]},H_e={null:[42,95]},q_e={null:[]},V_e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:H_e,contentInitial:L_e,disable:q_e,document:D_e,flow:z_e,flowInitial:$_e,insideSpan:B_e,string:F_e,text:U_e},Symbol.toStringTag,{value:"Module"}));function G_e(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:R(j),check:R(A),consume:k,enter:T,exit:N,interrupt:R(A,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:b,parser:t,previous:null,sliceSerialize:g,sliceStream:v,write:h};let p=e.tokenize.call(d,c);return e.resolveAll&&i.push(e),d;function h(L){return a=ki(a,L),E(),a[a.length-1]!==null?[]:(M(e,0),d.events=n_(i,d.events,d),d.events)}function g(L,z){return Y_e(v(L),z)}function v(L){return W_e(a,L)}function b(){const{_bufferIndex:L,_index:z,line:G,column:W,offset:X}=r;return{_bufferIndex:L,_index:z,line:G,column:W,offset:X}}function x(L){s[L.line]=L.column,O()}function E(){let L;for(;r._index<a.length;){const z=a[r._index];if(typeof z=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<z.length;)S(z.charCodeAt(r._bufferIndex));else S(z)}}function S(L){p=p(L)}function k(L){ct(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,O()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=L}function T(L,z){const G=z||{};return G.type=L,G.start=b(),d.events.push(["enter",G,d]),l.push(G),G}function N(L){const z=l.pop();return z.end=b(),d.events.push(["exit",z,d]),z}function j(L,z){M(L,z.from)}function A(L,z){z.restore()}function R(L,z){return G;function G(W,X,F){let Y,V,te,I;return Array.isArray(W)?ue(W):"tokenize"in W?ue([W]):re(W);function re(q){return U;function U(K){const ae=K!==null&&q[K],B=K!==null&&q.null,J=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(B)?B:B?[B]:[]];return ue(J)(K)}}function ue(q){return Y=q,V=0,q.length===0?F:D(q[V])}function D(q){return U;function U(K){return I=P(),te=q,q.partial||(d.currentConstruct=q),q.name&&d.parser.constructs.disable.null.includes(q.name)?he():q.tokenize.call(z?Object.assign(Object.create(d),z):d,c,Z,he)(K)}}function Z(q){return L(te,I),X}function he(q){return I.restore(),++V<Y.length?D(Y[V]):F}}}function M(L,z){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&li(d.events,z,d.events.length-z,L.resolve(d.events.slice(z),d)),L.resolveTo&&(d.events=L.resolveTo(d.events,d))}function P(){const L=b(),z=d.previous,G=d.currentConstruct,W=d.events.length,X=Array.from(l);return{from:W,restore:F};function F(){r=L,d.previous=z,d.currentConstruct=G,d.events.length=W,l=X,O()}}function O(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function W_e(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let a;if(n===s)a=[t[n].slice(r,i)];else{if(a=t.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function Y_e(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const i=t[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
1789
|
+
`),()=>{E.contains(x)&&E.removeChild(x)}},[e]),f.jsx(jve,{isPresent:e,childRef:i,sizeRef:a,children:w.cloneElement(t,{ref:c})})}const Ove=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a,anchorX:l,root:c})=>{const d=AN(Ive),p=w.useId();let h=!0,g=w.useMemo(()=>(h=!1,{id:p,initial:e,isPresent:n,custom:s,onExitComplete:v=>{d.set(v,!0);for(const b of d.values())if(!b)return;r&&r()},register:v=>(d.set(v,!1),()=>d.delete(v))}),[n,d,r]);return i&&h&&(g={...g}),w.useMemo(()=>{d.forEach((v,b)=>d.set(b,!1))},[n]),w.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),a==="popLayout"&&(t=f.jsx(Mve,{isPresent:n,anchorX:l,root:c,children:t})),f.jsx(Q0.Provider,{value:g,children:t})};function Ive(){return new Map}function BV(t=!0){const e=w.useContext(Q0);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=w.useId();w.useEffect(()=>{if(t)return s(i)},[t]);const a=w.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,a]:[!0]}const ky=t=>t.key||"";function x5(t){const e=[];return w.Children.forEach(t,n=>{w.isValidElement(n)&&e.push(n)}),e}const Ex=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1,anchorX:l="left",root:c})=>{const[d,p]=BV(a),h=w.useMemo(()=>x5(t),[t]),g=a&&!d?[]:h.map(ky),v=w.useRef(!0),b=w.useRef(h),x=AN(()=>new Map),[E,S]=w.useState(h),[k,T]=w.useState(h);Qq(()=>{v.current=!1,b.current=h;for(let A=0;A<k.length;A++){const R=ky(k[A]);g.includes(R)?x.delete(R):x.get(R)!==!0&&x.set(R,!1)}},[k,g.length,g.join("-")]);const N=[];if(h!==E){let A=[...h];for(let R=0;R<k.length;R++){const M=k[R],P=ky(M);g.includes(P)||(A.splice(R,0,M),N.push(M))}return i==="wait"&&N.length&&(A=N),T(x5(A)),S(h),null}const{forceRender:j}=w.useContext(CN);return f.jsx(f.Fragment,{children:k.map(A=>{const R=ky(A),M=a&&!d?!1:h===k||g.includes(R),P=()=>{if(x.has(R))x.set(R,!0);else return;let O=!0;x.forEach(L=>{L||(O=!1)}),O&&(j?.(),T(b.current),a&&p?.(),r&&r())};return f.jsx(Ove,{isPresent:M,initial:!v.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:c,onExitComplete:M?void 0:P,anchorX:l,children:A},R)})})},HV=w.createContext({strict:!1}),_5={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Bf={};for(const t in _5)Bf[t]={isEnabled:e=>_5[t].some(n=>!!e[n])};function Pve(t){for(const e in t)Bf[e]={...Bf[e],...t[e]}}const Dve=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function kx(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Dve.has(t)}let qV=t=>!kx(t);function Lve(t){typeof t=="function"&&(qV=e=>e.startsWith("on")?!kx(e):t(e))}try{Lve(require("@emotion/is-prop-valid").default)}catch{}function $ve(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(qV(s)||n===!0&&kx(s)||!e&&!kx(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const J0=w.createContext({});function Z0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Zm(t){return typeof t=="string"||Array.isArray(t)}const JN=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ZN=["initial",...JN];function e_(t){return Z0(t.animate)||ZN.some(e=>Zm(t[e]))}function VV(t){return!!(e_(t)||t.variants)}function zve(t,e){if(e_(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Zm(n)?n:void 0,animate:Zm(r)?r:void 0}}return t.inherit!==!1?e:{}}function Fve(t){const{initial:e,animate:n}=zve(t,w.useContext(J0));return w.useMemo(()=>({initial:e,animate:n}),[w5(e),w5(n)])}function w5(t){return Array.isArray(t)?t.join(" "):t}const eg={};function Uve(t){for(const e in t)eg[e]=t[e],LN(e)&&(eg[e].isCSSVariable=!0)}function GV(t,{layout:e,layoutId:n}){return mh.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!eg[t]||t==="opacity")}const Bve={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Hve=ph.length;function qve(t,e,n){let r="",s=!0;for(let i=0;i<Hve;i++){const a=ph[i],l=t[a];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(a.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const d=DV(l,YN[a]);if(!c){s=!1;const p=Bve[a]||a;r+=`${p}(${d}) `}n&&(e[a]=d)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function ej(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let a=!1,l=!1;for(const c in e){const d=e[c];if(mh.has(c)){a=!0;continue}else if(LN(c)){s[c]=d;continue}else{const p=DV(d,YN[c]);c.startsWith("origin")?(l=!0,i[c]=p):r[c]=p}}if(e.transform||(a||n?r.transform=qve(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:p=0}=i;r.transformOrigin=`${c} ${d} ${p}`}}const tj=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function WV(t,e,n){for(const r in e)!is(e[r])&&!GV(r,n)&&(t[r]=e[r])}function Vve({transformTemplate:t},e){return w.useMemo(()=>{const n=tj();return ej(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Gve(t,e){const n=t.style||{},r={};return WV(r,n,t),Object.assign(r,Vve(t,e)),r}function Wve(t,e){const n={},r=Gve(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Yve={offset:"stroke-dashoffset",array:"stroke-dasharray"},Kve={offset:"strokeDashoffset",array:"strokeDasharray"};function Xve(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?Yve:Kve;t[i.offset]=wt.transform(-r);const a=wt.transform(e),l=wt.transform(n);t[i.array]=`${a} ${l}`}function YV(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:a=0,...l},c,d,p){if(ej(t,l,d),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:g}=t;h.transform&&(g.transform=h.transform,delete h.transform),(g.transform||h.transformOrigin)&&(g.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),g.transform&&(g.transformBox=p?.transformBox??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&Xve(h,s,i,a,!1)}const KV=()=>({...tj(),attrs:{}}),XV=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Qve(t,e,n,r){const s=w.useMemo(()=>{const i=KV();return YV(i,e,XV(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};WV(i,t.style,t),s.style={...i,...s.style}}return s}const Jve=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nj(t){return typeof t!="string"||t.includes("-")?!1:!!(Jve.indexOf(t)>-1||/[A-Z]/u.test(t))}function Zve(t,e,n,{latestValues:r},s,i=!1){const l=(nj(t)?Qve:Wve)(e,r,s,t),c=$ve(e,typeof t=="string",i),d=t!==w.Fragment?{...c,...l,ref:n}:{},{children:p}=e,h=w.useMemo(()=>is(p)?p.get():p,[p]);return w.createElement(t,{...d,children:h})}function S5(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function rj(t,e,n,r){if(typeof e=="function"){const[s,i]=S5(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=S5(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function fb(t){return is(t)?t.get():t}function eye({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:tye(n,r,s,t),renderState:e()}}function tye(t,e,n,r){const s={},i=r(t,{});for(const g in i)s[g]=fb(i[g]);let{initial:a,animate:l}=t;const c=e_(t),d=VV(t);e&&d&&!c&&t.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let p=n?n.initial===!1:!1;p=p||a===!1;const h=p?l:a;if(h&&typeof h!="boolean"&&!Z0(h)){const g=Array.isArray(h)?h:[h];for(let v=0;v<g.length;v++){const b=rj(t,g[v]);if(b){const{transitionEnd:x,transition:E,...S}=b;for(const k in S){let T=S[k];if(Array.isArray(T)){const N=p?T.length-1:0;T=T[N]}T!==null&&(s[k]=T)}for(const k in x)s[k]=x[k]}}}return s}const QV=t=>(e,n)=>{const r=w.useContext(J0),s=w.useContext(Q0),i=()=>eye(t,e,r,s);return n?i():AN(i)};function sj(t,e,n){const{style:r}=t,s={};for(const i in r)(is(r[i])||e.style&&is(e.style[i])||GV(i,t)||n?.getValue(i)?.liveStyle!==void 0)&&(s[i]=r[i]);return s}const nye=QV({scrapeMotionValuesFromProps:sj,createRenderState:tj});function JV(t,e,n){const r=sj(t,e,n);for(const s in t)if(is(t[s])||is(e[s])){const i=ph.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}const rye=QV({scrapeMotionValuesFromProps:JV,createRenderState:KV}),sye=Symbol.for("motionComponentSymbol");function nf(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function iye(t,e,n){return w.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):nf(n)&&(n.current=r))},[e])}const ij=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),aye="framerAppearId",ZV="data-"+ij(aye),e8=w.createContext({});function oye(t,e,n,r,s){const{visualElement:i}=w.useContext(J0),a=w.useContext(HV),l=w.useContext(Q0),c=w.useContext(QN).reducedMotion,d=w.useRef(null);r=r||a.renderer,!d.current&&r&&(d.current=r(t,{visualState:e,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const p=d.current,h=w.useContext(e8);p&&!p.projection&&s&&(p.type==="html"||p.type==="svg")&&lye(d.current,n,s,h);const g=w.useRef(!1);w.useInsertionEffect(()=>{p&&g.current&&p.update(n,l)});const v=n[ZV],b=w.useRef(!!v&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Qq(()=>{p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),b.current&&p.animationState&&p.animationState.animateChanges())}),w.useEffect(()=>{p&&(!b.current&&p.animationState&&p.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),b.current=!1),p.enteringChildren=void 0)}),p}function lye(t,e,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:t8(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||l&&nf(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:p,layoutScroll:c,layoutRoot:d})}function t8(t){if(t)return t.options.allowProjection!==!1?t.projection:t8(t.parent)}function v1(t,{forwardMotionProps:e=!1}={},n,r){n&&Pve(n);const s=nj(t)?rye:nye;function i(l,c){let d;const p={...w.useContext(QN),...l,layoutId:cye(l)},{isStatic:h}=p,g=Fve(l),v=s(l,h);if(!h&&RN){uye();const b=dye(p);d=b.MeasureLayout,g.visualElement=oye(t,v,p,r,b.ProjectionNode)}return f.jsxs(J0.Provider,{value:g,children:[d&&g.visualElement?f.jsx(d,{visualElement:g.visualElement,...p}):null,Zve(t,l,iye(v,g.visualElement,c),v,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const a=w.forwardRef(i);return a[sye]=t,a}function cye({layoutId:t}){const e=w.useContext(CN).id;return e&&t!==void 0?e+"-"+t:t}function uye(t,e){w.useContext(HV).strict}function dye(t){const{drag:e,layout:n}=Bf;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function fye(t,e){if(typeof Proxy>"u")return v1;const n=new Map,r=(i,a)=>v1(i,a,t,e),s=(i,a)=>r(i,a);return new Proxy(s,{get:(i,a)=>a==="create"?r:(n.has(a)||n.set(a,v1(a,void 0,t,e)),n.get(a))})}function n8({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function hye({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function pye(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function y1(t){return t===void 0||t===1}function wC({scale:t,scaleX:e,scaleY:n}){return!y1(t)||!y1(e)||!y1(n)}function Xc(t){return wC(t)||r8(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function r8(t){return E5(t.x)||E5(t.y)}function E5(t){return t&&t!=="0%"}function Tx(t,e,n){const r=t-n,s=e*r;return n+s}function k5(t,e,n,r,s){return s!==void 0&&(t=Tx(t,s,r)),Tx(t,n,r)+e}function SC(t,e=0,n=1,r,s){t.min=k5(t.min,e,n,r,s),t.max=k5(t.max,e,n,r,s)}function s8(t,{x:e,y:n}){SC(t.x,e.translate,e.scale,e.originPoint),SC(t.y,n.translate,n.scale,n.originPoint)}const T5=.999999999999,C5=1.0000000000001;function mye(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,a;for(let l=0;l<s;l++){i=n[l],a=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&sf(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,s8(t,a)),r&&Xc(i.latestValues)&&sf(t,i.latestValues))}e.x<C5&&e.x>T5&&(e.x=1),e.y<C5&&e.y>T5&&(e.y=1)}function rf(t,e){t.min=t.min+e,t.max=t.max+e}function A5(t,e,n,r,s=.5){const i=Hn(t.min,t.max,s);SC(t,e,n,i,r)}function sf(t,e){A5(t.x,e.x,e.scaleX,e.scale,e.originX),A5(t.y,e.y,e.scaleY,e.scale,e.originY)}function i8(t,e){return n8(pye(t.getBoundingClientRect(),e))}function gye(t,e,n){const r=i8(t,n),{scroll:s}=e;return s&&(rf(r.x,s.offset.x),rf(r.y,s.offset.y)),r}const R5=()=>({translate:0,scale:1,origin:0,originPoint:0}),af=()=>({x:R5(),y:R5()}),N5=()=>({min:0,max:0}),ir=()=>({x:N5(),y:N5()}),EC={current:null},a8={current:!1};function vye(){if(a8.current=!0,!!RN)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>EC.current=t.matches;t.addEventListener("change",e),e()}else EC.current=!1}const yye=new WeakMap;function bye(t,e,n){for(const r in e){const s=e[r],i=n[r];if(is(s))t.addValue(r,s);else if(is(i))t.addValue(r,Uf(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const a=t.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=t.getStaticValue(r);t.addValue(r,Uf(a!==void 0?a:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const j5=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class xye{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=GN,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=Ds.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Dn.render(this.render,!1,!0))};const{latestValues:c,renderState:d}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=l,this.blockInitialAnimation=!!i,this.isControllingVariants=e_(n),this.isVariantNode=VV(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:p,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const g in h){const v=h[g];c[g]!==void 0&&is(v)&&v.set(c[g])}}mount(e){this.current=e,yye.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),a8.current||vye(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:EC.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),nc(this.notifyUpdate),nc(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=mh.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Dn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Bf){const n=Bf[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ir()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<j5.length;r++){const s=j5[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,a=e[i];a&&(this.propEventSubscriptions[s]=this.on(s,a))}this.prevMotionValues=bye(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Uf(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(Jq(r)||eV(r))?r=parseFloat(r):!Ave(r)&&rc.test(n)&&(r=PV(e,n)),this.setBaseTarget(e,is(r)?r.get():r)),is(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=rj(this.props,n,this.presenceContext?.custom);i&&(r=i[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!is(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new IN),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){KN.render(this.render)}}class o8 extends xye{constructor(){super(...arguments),this.KeyframeResolver=gve}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;is(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function l8(t,{style:e,vars:n},r,s){const i=t.style;let a;for(a in e)i[a]=e[a];s?.applyProjectionStyles(i,r);for(a in n)i.setProperty(a,n[a])}function _ye(t){return window.getComputedStyle(t)}class wye extends o8{constructor(){super(...arguments),this.type="html",this.renderInstance=l8}readValueFromInstance(e,n){if(mh.has(n))return this.projection?.isProjecting?mC(n):Pge(e,n);{const r=_ye(e),s=(LN(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return i8(e,n)}build(e,n,r){ej(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return sj(e,n,r)}}const c8=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Sye(t,e,n,r){l8(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(c8.has(s)?s:ij(s),e.attrs[s])}class Eye extends o8{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ir}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(mh.has(n)){const r=IV(n);return r&&r.default||0}return n=c8.has(n)?n:ij(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return JV(e,n,r)}build(e,n,r){YV(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){Sye(e,n,r,s)}mount(e){this.isSVGTag=XV(e.tagName),super.mount(e)}}const kye=(t,e)=>nj(t)?new Eye(e):new wye(e,{allowProjection:t!==w.Fragment});function wf(t,e,n){const r=t.getProps();return rj(r,e,n!==void 0?n:r.custom,t)}const kC=t=>Array.isArray(t);function Tye(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Uf(n))}function Cye(t){return kC(t)?t[t.length-1]||0:t}function Aye(t,e){const n=wf(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const l=Cye(i[a]);Tye(t,a,l)}}function Rye(t){return!!(is(t)&&t.add)}function TC(t,e){const n=t.getValue("willChange");if(Rye(n))return n.add(e);if(!n&&Go.WillChange){const r=new Go.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function u8(t){return t.props[ZV]}const Nye=t=>t!==null;function jye(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Nye),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[i]}const Mye={type:"spring",stiffness:500,damping:25,restSpeed:10},Oye=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Iye={type:"keyframes",duration:.8},Pye={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Dye=(t,{keyframes:e})=>e.length>2?Iye:mh.has(t)?t.startsWith("scale")?Oye(e[1]):Mye:Pye;function Lye({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:l,from:c,elapsed:d,...p}){return!!Object.keys(p).length}const aj=(t,e,n,r={},s,i)=>a=>{const l=WN(r,t)||{},c=l.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Va(c);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:g=>{e.set(g),l.onUpdate&&l.onUpdate(g)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};Lye(l)||Object.assign(p,Dye(t,p)),p.duration&&(p.duration=Va(p.duration)),p.repeatDelay&&(p.repeatDelay=Va(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let h=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(xC(p),p.delay===0&&(h=!0)),(Go.instantAnimations||Go.skipAnimations)&&(h=!0,xC(p),p.delay=0),p.allowFlatten=!l.type&&!l.ease,h&&!i&&e.get()!==void 0){const g=jye(p.keyframes,l);if(g!==void 0){Dn.update(()=>{p.onUpdate(g),p.onComplete()});return}}return l.isSync?new VN(p):new sve(p)};function $ye({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function d8(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:a,...l}=e;r&&(i=r);const c=[],d=s&&t.animationState&&t.animationState.getState()[s];for(const p in l){const h=t.getValue(p,t.latestValues[p]??null),g=l[p];if(g===void 0||d&&$ye(d,p))continue;const v={delay:n,...WN(i||{},p)},b=h.get();if(b!==void 0&&!h.isAnimating&&!Array.isArray(g)&&g===b&&!v.velocity)continue;let x=!1;if(window.MotionHandoffAnimation){const S=u8(t);if(S){const k=window.MotionHandoffAnimation(S,p,Dn);k!==null&&(v.startTime=k,x=!0)}}TC(t,p),h.start(aj(p,h,g,t.shouldReduceMotion&&jV.has(p)?{type:!1}:v,t,x));const E=h.animation;E&&c.push(E)}return a&&Promise.all(c).then(()=>{Dn.update(()=>{a&&Aye(t,a)})}),c}function f8(t,e,n,r=0,s=1){const i=Array.from(t).sort((d,p)=>d.sortNodePosition(p)).indexOf(e),a=t.size,l=(a-1)*r;return typeof n=="function"?n(i,a):s===1?i*r:l-i*r}function CC(t,e,n={}){const r=wf(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(d8(t,r,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:p,staggerDirection:h}=s;return zye(t,e,c,d,p,h,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,d]=l==="beforeChildren"?[i,a]:[a,i];return c().then(()=>d())}else return Promise.all([i(),a(n.delay)])}function zye(t,e,n=0,r=0,s=0,i=1,a){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(CC(c,e,{...a,delay:n+(typeof r=="function"?0:r)+f8(t.variantChildren,c,r,s,i)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function Fye(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>CC(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=CC(t,e,n);else{const s=typeof e=="function"?wf(t,e,n.custom):e;r=Promise.all(d8(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function h8(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const Uye=ZN.length;function p8(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?p8(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Uye;n++){const r=ZN[n],s=t.props[r];(Zm(s)||s===!1)&&(e[r]=s)}return e}const Bye=[...JN].reverse(),Hye=JN.length;function qye(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Fye(t,n,r)))}function Vye(t){let e=qye(t),n=M5(),r=!0;const s=c=>(d,p)=>{const h=wf(t,p,c==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:g,transitionEnd:v,...b}=h;d={...d,...b,...v}}return d};function i(c){e=c(t)}function a(c){const{props:d}=t,p=p8(t.parent)||{},h=[],g=new Set;let v={},b=1/0;for(let E=0;E<Hye;E++){const S=Bye[E],k=n[S],T=d[S]!==void 0?d[S]:p[S],N=Zm(T),j=S===c?k.isActive:null;j===!1&&(b=E);let A=T===p[S]&&T!==d[S]&&N;if(A&&r&&t.manuallyAnimateOnMount&&(A=!1),k.protectedKeys={...v},!k.isActive&&j===null||!T&&!k.prevProp||Z0(T)||typeof T=="boolean")continue;const R=Gye(k.prevProp,T);let M=R||S===c&&k.isActive&&!A&&N||E>b&&N,P=!1;const O=Array.isArray(T)?T:[T];let L=O.reduce(s(S),{});j===!1&&(L={});const{prevResolvedValues:z={}}=k,G={...z,...L},W=Y=>{M=!0,g.has(Y)&&(P=!0,g.delete(Y)),k.needsAnimating[Y]=!0;const V=t.getValue(Y);V&&(V.liveStyle=!1)};for(const Y in G){const V=L[Y],te=z[Y];if(v.hasOwnProperty(Y))continue;let I=!1;kC(V)&&kC(te)?I=!h8(V,te):I=V!==te,I?V!=null?W(Y):g.add(Y):V!==void 0&&g.has(Y)?W(Y):k.protectedKeys[Y]=!0}k.prevProp=T,k.prevResolvedValues=L,k.isActive&&(v={...v,...L}),r&&t.blockInitialAnimation&&(M=!1);const X=A&&R;M&&(!X||P)&&h.push(...O.map(Y=>{const V={type:S};if(typeof Y=="string"&&r&&!X&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,I=wf(te,Y);if(te.enteringChildren&&I){const{delayChildren:re}=I.transition||{};V.delay=f8(te.enteringChildren,t,re)}}return{animation:Y,options:V}}))}if(g.size){const E={};if(typeof d.initial!="boolean"){const S=wf(t,Array.isArray(d.initial)?d.initial[0]:d.initial);S&&S.transition&&(E.transition=S.transition)}g.forEach(S=>{const k=t.getBaseTarget(S),T=t.getValue(S);T&&(T.liveStyle=!0),E[S]=k??null}),h.push({animation:E})}let x=!!h.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(x=!1),r=!1,x?e(h):Promise.resolve()}function l(c,d){if(n[c].isActive===d)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(c,d)),n[c].isActive=d;const p=a(c);for(const h in n)n[h].protectedKeys={};return p}return{animateChanges:a,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=M5(),r=!0}}}function Gye(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!h8(e,t):!1}function Gc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function M5(){return{animate:Gc(!0),whileInView:Gc(),whileHover:Gc(),whileTap:Gc(),whileDrag:Gc(),whileFocus:Gc(),exit:Gc()}}class mc{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Wye extends mc{constructor(e){super(e),e.animationState||(e.animationState=Vye(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Z0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Yye=0;class Kye extends mc{constructor(){super(...arguments),this.id=Yye++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Xye={animation:{Feature:Wye},exit:{Feature:Kye}};function tg(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Og(t){return{point:{x:t.pageX,y:t.pageY}}}const Qye=t=>e=>XN(e)&&t(e,Og(e));function vm(t,e,n,r){return tg(t,e,Qye(n),r)}const m8=1e-4,Jye=1-m8,Zye=1+m8,g8=.01,ebe=0-g8,tbe=0+g8;function vs(t){return t.max-t.min}function nbe(t,e,n){return Math.abs(t-e)<=n}function O5(t,e,n,r=.5){t.origin=r,t.originPoint=Hn(e.min,e.max,t.origin),t.scale=vs(n)/vs(e),t.translate=Hn(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Jye&&t.scale<=Zye||isNaN(t.scale))&&(t.scale=1),(t.translate>=ebe&&t.translate<=tbe||isNaN(t.translate))&&(t.translate=0)}function ym(t,e,n,r){O5(t.x,e.x,n.x,r?r.originX:void 0),O5(t.y,e.y,n.y,r?r.originY:void 0)}function I5(t,e,n){t.min=n.min+e.min,t.max=t.min+vs(e)}function rbe(t,e,n){I5(t.x,e.x,n.x),I5(t.y,e.y,n.y)}function P5(t,e,n){t.min=e.min-n.min,t.max=t.min+vs(e)}function bm(t,e,n){P5(t.x,e.x,n.x),P5(t.y,e.y,n.y)}function wi(t){return[t("x"),t("y")]}const v8=({current:t})=>t?t.ownerDocument.defaultView:null,D5=(t,e)=>Math.abs(t-e);function sbe(t,e){const n=D5(t.x,e.x),r=D5(t.y,e.y);return Math.sqrt(n**2+r**2)}class y8{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=x1(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,b=sbe(g.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!b)return;const{point:x}=g,{timestamp:E}=Gr;this.history.push({...x,timestamp:E});const{onStart:S,onMove:k}=this.handlers;v||(S&&S(this.lastMoveEvent,g),this.startEvent=this.lastMoveEvent),k&&k(this.lastMoveEvent,g)},this.handlePointerMove=(g,v)=>{this.lastMoveEvent=g,this.lastMoveEventInfo=b1(v,this.transformPagePoint),Dn.update(this.updatePoint,!0)},this.handlePointerUp=(g,v)=>{this.end();const{onEnd:b,onSessionEnd:x,resumeAnimation:E}=this.handlers;if(this.dragSnapToOrigin&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=x1(g.type==="pointercancel"?this.lastMoveEventInfo:b1(v,this.transformPagePoint),this.history);this.startEvent&&b&&b(g,S),x&&x(g,S)},!XN(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=a,this.contextWindow=s||window;const l=Og(e),c=b1(l,this.transformPagePoint),{point:d}=c,{timestamp:p}=Gr;this.history=[{...d,timestamp:p}];const{onSessionStart:h}=n;h&&h(e,x1(c,this.history)),this.removeListeners=Ng(vm(this.contextWindow,"pointermove",this.handlePointerMove),vm(this.contextWindow,"pointerup",this.handlePointerUp),vm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),nc(this.updatePoint)}}function b1(t,e){return e?{point:e(t.point)}:t}function L5(t,e){return{x:t.x-e.x,y:t.y-e.y}}function x1({point:t},e){return{point:t,delta:L5(t,b8(e)),offset:L5(t,ibe(e)),velocity:abe(e,.1)}}function ibe(t){return t[0]}function b8(t){return t[t.length-1]}function abe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=b8(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Va(e)));)n--;if(!r)return{x:0,y:0};const i=Ci(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function obe(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Hn(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Hn(n,t,r.max):Math.min(t,n)),t}function $5(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function lbe(t,{top:e,left:n,bottom:r,right:s}){return{x:$5(t.x,n,s),y:$5(t.y,e,r)}}function z5(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function cbe(t,e){return{x:z5(t.x,e.x),y:z5(t.y,e.y)}}function ube(t,e){let n=.5;const r=vs(t),s=vs(e);return s>r?n=Xm(e.min,e.max-r,t.min):r>s&&(n=Xm(t.min,t.max-s,e.min)),Vo(0,1,n)}function dbe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const AC=.35;function fbe(t=AC){return t===!1?t=0:t===!0&&(t=AC),{x:F5(t,"left","right"),y:F5(t,"top","bottom")}}function F5(t,e,n){return{min:U5(t,e),max:U5(t,n)}}function U5(t,e){return typeof t=="number"?t:t[e]||0}const hbe=new WeakMap;class pbe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ir(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:g}=this.getProps();g?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Og(h).point)},a=(h,g)=>{const{drag:v,dragPropagation:b,onDragStart:x}=this.getProps();if(v&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xve(v),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wi(S=>{let k=this.getAxisMotionValue(S).get()||0;if(Ga.test(k)){const{projection:T}=this.visualElement;if(T&&T.layout){const N=T.layout.layoutBox[S];N&&(k=vs(N)*(parseFloat(k)/100))}}this.originPoint[S]=k}),x&&Dn.postRender(()=>x(h,g)),TC(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},l=(h,g)=>{this.latestPointerEvent=h,this.latestPanInfo=g;const{dragPropagation:v,dragDirectionLock:b,onDirectionLock:x,onDrag:E}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:S}=g;if(b&&this.currentDirection===null){this.currentDirection=mbe(S),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",g.point,S),this.updateAxis("y",g.point,S),this.visualElement.render(),E&&E(h,g)},c=(h,g)=>{this.latestPointerEvent=h,this.latestPanInfo=g,this.stop(h,g),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>wi(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:p}=this.getProps();this.panSession=new y8(e,{onSessionStart:i,onStart:a,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:r,contextWindow:v8(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:a}=s;this.startAnimation(a);const{onDragEnd:l}=this.getProps();l&&Dn.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!Ty(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let a=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(a=obe(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&nf(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=lbe(r.layoutBox,e):this.constraints=!1,this.elastic=fbe(n),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&wi(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=dbe(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!nf(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=gye(r,s.root,this.visualElement.getTransformPagePoint());let a=cbe(s.layout.layoutBox,i);if(n){const l=n(hye(a));this.hasMutatedConstraints=!!l,l&&(a=n8(l))}return a}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=wi(p=>{if(!Ty(p,n,this.currentDirection))return;let h=c&&c[p]||{};a&&(h={min:0,max:0});const g=s?200:1e6,v=s?40:1e7,b={type:"inertia",velocity:r?e[p]:0,bounceStiffness:g,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(p,b)});return Promise.all(d).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return TC(this.visualElement,e),r.start(aj(e,r,0,n,this.visualElement,!1))}stopAnimation(){wi(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){wi(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){wi(n=>{const{drag:r}=this.getProps();if(!Ty(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:l}=s.layout.layoutBox[n];i.set(e[n]-Hn(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!nf(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};wi(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();s[a]=ube({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),wi(a=>{if(!Ty(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:d}=this.constraints[a];l.set(Hn(c,d,s[a]))})}addListeners(){if(!this.visualElement.current)return;hbe.set(this.visualElement,this);const e=this.visualElement.current,n=vm(e,"pointerdown",c=>{const{drag:d,dragListener:p=!0}=this.getProps();d&&p&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();nf(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Dn.read(r);const a=tg(window,"resize",()=>this.scalePositionWithinConstraints()),l=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(wi(p=>{const h=this.getAxisMotionValue(p);h&&(this.originPoint[p]+=c[p].translate,h.set(h.get()+c[p].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),l&&l()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=AC,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:l}}}function Ty(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function mbe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class gbe extends mc{constructor(e){super(e),this.removeGroupControls=Pi,this.removeListeners=Pi,this.controls=new pbe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pi}unmount(){this.removeGroupControls(),this.removeListeners()}}const B5=t=>(e,n)=>{t&&Dn.postRender(()=>t(e,n))};class vbe extends mc{constructor(){super(...arguments),this.removePointerDownListener=Pi}onPointerDown(e){this.session=new y8(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:v8(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:B5(e),onStart:B5(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&Dn.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=vm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const hb={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function H5(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Rp={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(wt.test(t))t=parseFloat(t);else return t;const n=H5(t,e.target.x),r=H5(t,e.target.y);return`${n}% ${r}%`}},ybe={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=rc.parse(t);if(s.length>5)return r;const i=rc.createTransformer(t),a=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+a]/=l,s[1+a]/=c;const d=Hn(l,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=d),typeof s[3+a]=="number"&&(s[3+a]/=d),i(s)}};let _1=!1;class bbe extends w.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Uve(xbe),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),_1&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),hb.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:a}=r;return a&&(a.isPresent=i,_1=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Dn.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),KN.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;_1=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function x8(t){const[e,n]=BV(),r=w.useContext(CN);return f.jsx(bbe,{...t,layoutGroup:r,switchLayoutGroup:w.useContext(e8),isPresent:e,safeToRemove:n})}const xbe={borderRadius:{...Rp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Rp,borderTopRightRadius:Rp,borderBottomLeftRadius:Rp,borderBottomRightRadius:Rp,boxShadow:ybe};function _be(t,e,n){const r=is(t)?t:Uf(t);return r.start(aj("",r,e,n)),r.animation}const wbe=(t,e)=>t.depth-e.depth;class Sbe{constructor(){this.children=[],this.isDirty=!1}add(e){NN(this.children,e),this.isDirty=!0}remove(e){jN(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(wbe),this.isDirty=!1,this.children.forEach(e)}}function Ebe(t,e){const n=Ds.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(nc(r),t(i-e))};return Dn.setup(r,!0),()=>nc(r)}const _8=["TopLeft","TopRight","BottomLeft","BottomRight"],kbe=_8.length,q5=t=>typeof t=="string"?parseFloat(t):t,V5=t=>typeof t=="number"||wt.test(t);function Tbe(t,e,n,r,s,i){s?(t.opacity=Hn(0,n.opacity??1,Cbe(r)),t.opacityExit=Hn(e.opacity??1,0,Abe(r))):i&&(t.opacity=Hn(e.opacity??1,n.opacity??1,r));for(let a=0;a<kbe;a++){const l=`border${_8[a]}Radius`;let c=G5(e,l),d=G5(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||V5(c)===V5(d)?(t[l]=Math.max(Hn(q5(c),q5(d),r),0),(Ga.test(d)||Ga.test(c))&&(t[l]+="%")):t[l]=d}(e.rotate||n.rotate)&&(t.rotate=Hn(e.rotate||0,n.rotate||0,r))}function G5(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Cbe=w8(0,.5,lV),Abe=w8(.5,.95,Pi);function w8(t,e,n){return r=>r<t?0:r>e?1:n(Xm(t,e,r))}function W5(t,e){t.min=e.min,t.max=e.max}function xi(t,e){W5(t.x,e.x),W5(t.y,e.y)}function Y5(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function K5(t,e,n,r,s){return t-=e,t=Tx(t,1/n,r),s!==void 0&&(t=Tx(t,1/s,r)),t}function Rbe(t,e=0,n=1,r=.5,s,i=t,a=t){if(Ga.test(e)&&(e=parseFloat(e),e=Hn(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=Hn(i.min,i.max,r);t===i&&(l-=e),t.min=K5(t.min,e,n,l,s),t.max=K5(t.max,e,n,l,s)}function X5(t,e,[n,r,s],i,a){Rbe(t,e[n],e[r],e[s],e.scale,i,a)}const Nbe=["x","scaleX","originX"],jbe=["y","scaleY","originY"];function Q5(t,e,n,r){X5(t.x,e,Nbe,n?n.x:void 0,r?r.x:void 0),X5(t.y,e,jbe,n?n.y:void 0,r?r.y:void 0)}function J5(t){return t.translate===0&&t.scale===1}function S8(t){return J5(t.x)&&J5(t.y)}function Z5(t,e){return t.min===e.min&&t.max===e.max}function Mbe(t,e){return Z5(t.x,e.x)&&Z5(t.y,e.y)}function e4(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function E8(t,e){return e4(t.x,e.x)&&e4(t.y,e.y)}function t4(t){return vs(t.x)/vs(t.y)}function n4(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Obe{constructor(){this.members=[]}add(e){NN(this.members,e),e.scheduleRender()}remove(e){if(jN(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Ibe(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,a=n?.z||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:d,rotate:p,rotateX:h,rotateY:g,skewX:v,skewY:b}=n;d&&(r=`perspective(${d}px) ${r}`),p&&(r+=`rotate(${p}deg) `),h&&(r+=`rotateX(${h}deg) `),g&&(r+=`rotateY(${g}deg) `),v&&(r+=`skewX(${v}deg) `),b&&(r+=`skewY(${b}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const w1=["","X","Y","Z"],Pbe=1e3;let Dbe=0;function S1(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function k8(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=u8(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Dn,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&k8(r)}function T8({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},l=e?.()){this.id=Dbe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(zbe),this.nodes.forEach(Hbe),this.nodes.forEach(qbe),this.nodes.forEach(Fbe)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Sbe)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new IN),this.eventHandlers.get(a).add(l)}notifyListeners(a,...l){const c=this.eventHandlers.get(a);c&&c.notify(...l)}hasListeners(a){return this.eventHandlers.has(a)}mount(a){if(this.instance)return;this.isSVG=UV(a)&&!Tve(a),this.instance=a;const{layoutId:l,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(a),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let p,h=0;const g=()=>this.root.updateBlockedByResize=!1;Dn.read(()=>{h=window.innerWidth}),t(a,()=>{const v=window.innerWidth;v!==h&&(h=v,this.root.updateBlockedByResize=!0,p&&p(),p=Ebe(g,250),hb.hasAnimatedSinceResize&&(hb.hasAnimatedSinceResize=!1,this.nodes.forEach(i4)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:h,hasRelativeLayoutChanged:g,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||Kbe,{onLayoutAnimationStart:x,onLayoutAnimationComplete:E}=d.getProps(),S=!this.targetLayout||!E8(this.targetLayout,v),k=!h&&g;if(this.options.layoutRoot||this.resumeFrom||k||h&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...WN(b,"layout"),onPlay:x,onComplete:E};(d.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(p,k)}else h||i4(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),nc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Vbe),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&k8(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const h=this.path[p];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(r4);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(s4);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Bbe),this.nodes.forEach(Lbe),this.nodes.forEach($be)):this.nodes.forEach(s4),this.clearAllSnapshots();const l=Ds.now();Gr.delta=Vo(0,1e3/60,l-Gr.timestamp),Gr.timestamp=l,Gr.isProcessing=!0,d1.update.process(Gr),d1.preRender.process(Gr),d1.render.process(Gr),Gr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,KN.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ube),this.sharedNodes.forEach(Gbe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Dn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Dn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!vs(this.snapshot.measuredBox.x)&&!vs(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const a=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ir(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!S8(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,p=d!==this.prevTransformTemplateValue;a&&this.instance&&(l||Xc(this.latestValues)||p)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return a&&(c=this.removeTransform(c)),Xbe(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:a}=this.options;if(!a)return ir();const l=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Qbe))){const{scroll:d}=this.root;d&&(rf(l.x,d.offset.x),rf(l.y,d.offset.y))}return l}removeElementScroll(a){const l=ir();if(xi(l,a),this.scroll?.wasRoot)return l;for(let c=0;c<this.path.length;c++){const d=this.path[c],{scroll:p,options:h}=d;d!==this.root&&p&&h.layoutScroll&&(p.wasRoot&&xi(l,a),rf(l.x,p.offset.x),rf(l.y,p.offset.y))}return l}applyTransform(a,l=!1){const c=ir();xi(c,a);for(let d=0;d<this.path.length;d++){const p=this.path[d];!l&&p.options.layoutScroll&&p.scroll&&p!==p.root&&sf(c,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Xc(p.latestValues)&&sf(c,p.latestValues)}return Xc(this.latestValues)&&sf(c,this.latestValues),c}removeTransform(a){const l=ir();xi(l,a);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!Xc(d.latestValues))continue;wC(d.latestValues)&&d.updateSnapshot();const p=ir(),h=d.measurePageBox();xi(p,h),Q5(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,p)}return Xc(this.latestValues)&&Q5(l,this.latestValues),l}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:a.crossfade!==void 0?a.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Gr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:h}=this.options;if(!(!this.layout||!(p||h))){if(this.resolvedRelativeTargetAt=Gr.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ir(),this.relativeTargetOrigin=ir(),bm(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),xi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ir(),this.targetWithTransforms=ir()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rbe(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xi(this.target,this.layout.layoutBox),s8(this.target,this.targetDelta)):xi(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ir(),this.relativeTargetOrigin=ir(),bm(this.relativeTargetOrigin,this.target,g.target),xi(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||wC(this.parent.latestValues)||r8(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Gr.timestamp&&(c=!1),c)return;const{layout:d,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||p))return;xi(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,g=this.treeScale.y;mye(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=ir());const{target:v}=a;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Y5(this.prevProjectionDelta.x,this.projectionDelta.x),Y5(this.prevProjectionDelta.y,this.projectionDelta.y)),ym(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==g||!n4(this.projectionDelta.x,this.prevProjectionDelta.x)||!n4(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=af(),this.projectionDelta=af(),this.projectionDeltaWithTransform=af()}setAnimationOrigin(a,l=!1){const c=this.snapshot,d=c?c.latestValues:{},p={...this.latestValues},h=af();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const g=ir(),v=c?c.source:void 0,b=this.layout?this.layout.source:void 0,x=v!==b,E=this.getStack(),S=!E||E.members.length<=1,k=!!(x&&!S&&this.options.crossfade===!0&&!this.path.some(Ybe));this.animationProgress=0;let T;this.mixTargetDelta=N=>{const j=N/1e3;a4(h.x,a.x,j),a4(h.y,a.y,j),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(bm(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Wbe(this.relativeTarget,this.relativeTargetOrigin,g,j),T&&Mbe(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=ir()),xi(T,this.relativeTarget)),x&&(this.animationValues=p,Tbe(p,d,this.latestValues,j,k,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=j},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(nc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Dn.update(()=>{hb.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Uf(0)),this.currentAnimation=_be(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Pbe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:p}=a;if(!(!l||!c||!d)){if(this!==a&&this.layout&&d&&C8(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||ir();const h=vs(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+h;const g=vs(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+g}xi(l,c),sf(l,p),ym(this.projectionDeltaWithTransform,this.layoutCorrected,l,p)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new Obe),this.sharedNodes.get(a).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){const{layoutId:a}=this.options;return a?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&S1("z",a,d,this.animationValues);for(let p=0;p<w1.length;p++)S1(`rotate${w1[p]}`,a,d,this.animationValues),S1(`skew${w1[p]}`,a,d,this.animationValues);a.render();for(const p in d)a.setStaticValue(p,d[p]),this.animationValues&&(this.animationValues[p]=d[p]);a.scheduleRender()}applyProjectionStyles(a,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=fb(l?.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=fb(l?.pointerEvents)||""),this.hasProjected&&!Xc(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";const p=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=Ibe(this.projectionDeltaWithTransform,this.treeScale,p);c&&(h=c(p,h)),a.transform=h;const{x:g,y:v}=this.projectionDelta;a.transformOrigin=`${g.origin*100}% ${v.origin*100}% 0`,d.animationValues?a.opacity=d===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:a.opacity=d===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const b in eg){if(p[b]===void 0)continue;const{correct:x,applyTo:E,isCSSVariable:S}=eg[b],k=h==="none"?p[b]:x(p[b],d);if(E){const T=E.length;for(let N=0;N<T;N++)a[E[N]]=k}else S?this.options.visualElement.renderState.vars[b]=k:a[b]=k}this.options.layoutId&&(a.pointerEvents=d===this?fb(l?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(r4),this.root.sharedNodes.clear()}}}function Lbe(t){t.updateLayout()}function $be(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:s}=t.options,i=e.source!==t.layout.source;s==="size"?wi(p=>{const h=i?e.measuredBox[p]:e.layoutBox[p],g=vs(h);h.min=n[p].min,h.max=h.min+g}):C8(s,e.layoutBox,n)&&wi(p=>{const h=i?e.measuredBox[p]:e.layoutBox[p],g=vs(n[p]);h.max=h.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+g)});const a=af();ym(a,n,e.layoutBox);const l=af();i?ym(l,t.applyTransform(r,!0),e.measuredBox):ym(l,n,e.layoutBox);const c=!S8(a);let d=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:h,layout:g}=p;if(h&&g){const v=ir();bm(v,e.layoutBox,h.layoutBox);const b=ir();bm(b,n,g.layoutBox),E8(v,b)||(d=!0),p.options.layoutRoot&&(t.relativeTarget=b,t.relativeTargetOrigin=v,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function zbe(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Fbe(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ube(t){t.clearSnapshot()}function r4(t){t.clearMeasurements()}function s4(t){t.isLayoutDirty=!1}function Bbe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function i4(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Hbe(t){t.resolveTargetDelta()}function qbe(t){t.calcProjection()}function Vbe(t){t.resetSkewAndRotation()}function Gbe(t){t.removeLeadSnapshot()}function a4(t,e,n){t.translate=Hn(e.translate,0,n),t.scale=Hn(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function o4(t,e,n,r){t.min=Hn(e.min,n.min,r),t.max=Hn(e.max,n.max,r)}function Wbe(t,e,n,r){o4(t.x,e.x,n.x,r),o4(t.y,e.y,n.y,r)}function Ybe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Kbe={duration:.45,ease:[.4,0,.1,1]},l4=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),c4=l4("applewebkit/")&&!l4("chrome/")?Math.round:Pi;function u4(t){t.min=c4(t.min),t.max=c4(t.max)}function Xbe(t){u4(t.x),u4(t.y)}function C8(t,e,n){return t==="position"||t==="preserve-aspect"&&!nbe(t4(e),t4(n),.2)}function Qbe(t){return t!==t.root&&t.scroll?.wasRoot}const Jbe=T8({attachResizeListener:(t,e)=>tg(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),E1={current:void 0},A8=T8({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!E1.current){const t=new Jbe({});t.mount(window),t.setOptions({layoutScroll:!0}),E1.current=t}return E1.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Zbe={pan:{Feature:vbe},drag:{Feature:gbe,ProjectionNode:A8,MeasureLayout:x8}};function d4(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Dn.postRender(()=>i(e,Og(e)))}class exe extends mc{mount(){const{current:e}=this.node;e&&(this.unmount=_ve(e,(n,r)=>(d4(this.node,r,"Start"),s=>d4(this.node,s,"End"))))}unmount(){}}class txe extends mc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ng(tg(this.node.current,"focus",()=>this.onFocus()),tg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function f4(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Dn.postRender(()=>i(e,Og(e)))}class nxe extends mc{mount(){const{current:e}=this.node;e&&(this.unmount=kve(e,(n,r)=>(f4(this.node,r,"Start"),(s,{success:i})=>f4(this.node,s,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const RC=new WeakMap,k1=new WeakMap,rxe=t=>{const e=RC.get(t.target);e&&e(t)},sxe=t=>{t.forEach(rxe)};function ixe({root:t,...e}){const n=t||document;k1.has(n)||k1.set(n,{});const r=k1.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(sxe,{root:t,...e})),r[s]}function axe(t,e,n){const r=ixe(e);return RC.set(t,n),r.observe(t),()=>{RC.delete(t),r.unobserve(t)}}const oxe={some:0,all:1};class lxe extends mc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:oxe[s]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:h}=this.node.getProps(),g=d?p:h;g&&g(c)};return axe(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(cxe(e,n))&&this.startObserver()}unmount(){}}function cxe({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const uxe={inView:{Feature:lxe},tap:{Feature:nxe},focus:{Feature:txe},hover:{Feature:exe}},dxe={layout:{ProjectionNode:A8,MeasureLayout:x8}},fxe={...Xye,...uxe,...Zbe,...dxe},ri=fye(fxe,kye);function hxe(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const pxe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mxe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gxe={};function h4(t,e){return(gxe.jsx?mxe:pxe).test(t)}const vxe=/[ \t\n\f\r]/g;function yxe(t){return typeof t=="object"?t.type==="text"?p4(t.value):!1:p4(t)}function p4(t){return t.replace(vxe,"")===""}class Ig{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ig.prototype.normal={};Ig.prototype.property={};Ig.prototype.space=void 0;function R8(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ig(n,r,e)}function NC(t){return t.toLowerCase()}class Us{constructor(e,n){this.attribute=n,this.property=e}}Us.prototype.attribute="";Us.prototype.booleanish=!1;Us.prototype.boolean=!1;Us.prototype.commaOrSpaceSeparated=!1;Us.prototype.commaSeparated=!1;Us.prototype.defined=!1;Us.prototype.mustUseProperty=!1;Us.prototype.number=!1;Us.prototype.overloadedBoolean=!1;Us.prototype.property="";Us.prototype.spaceSeparated=!1;Us.prototype.space=void 0;let bxe=0;const It=zu(),mr=zu(),jC=zu(),je=zu(),Tn=zu(),Sf=zu(),Qs=zu();function zu(){return 2**++bxe}const MC=Object.freeze(Object.defineProperty({__proto__:null,boolean:It,booleanish:mr,commaOrSpaceSeparated:Qs,commaSeparated:Sf,number:je,overloadedBoolean:jC,spaceSeparated:Tn},Symbol.toStringTag,{value:"Module"})),T1=Object.keys(MC);class oj extends Us{constructor(e,n,r,s){let i=-1;if(super(e,n),m4(this,"space",s),typeof r=="number")for(;++i<T1.length;){const a=T1[i];m4(this,T1[i],(r&MC[a])===MC[a])}}}oj.prototype.defined=!0;function m4(t,e,n){n&&(t[e]=n)}function gh(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const i=new oj(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[NC(r)]=r,n[NC(i.attribute)]=r}return new Ig(e,n,t.space)}const N8=gh({properties:{ariaActiveDescendant:null,ariaAtomic:mr,ariaAutoComplete:null,ariaBusy:mr,ariaChecked:mr,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:Tn,ariaCurrent:null,ariaDescribedBy:Tn,ariaDetails:null,ariaDisabled:mr,ariaDropEffect:Tn,ariaErrorMessage:null,ariaExpanded:mr,ariaFlowTo:Tn,ariaGrabbed:mr,ariaHasPopup:null,ariaHidden:mr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tn,ariaLevel:je,ariaLive:null,ariaModal:mr,ariaMultiLine:mr,ariaMultiSelectable:mr,ariaOrientation:null,ariaOwns:Tn,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:mr,ariaReadOnly:mr,ariaRelevant:null,ariaRequired:mr,ariaRoleDescription:Tn,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:mr,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function j8(t,e){return e in t?t[e]:e}function M8(t,e){return j8(t,e.toLowerCase())}const xxe=gh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Sf,acceptCharset:Tn,accessKey:Tn,action:null,allow:null,allowFullScreen:It,allowPaymentRequest:It,allowUserMedia:It,alt:null,as:null,async:It,autoCapitalize:null,autoComplete:Tn,autoFocus:It,autoPlay:It,blocking:Tn,capture:null,charSet:null,checked:It,cite:null,className:Tn,cols:je,colSpan:null,content:null,contentEditable:mr,controls:It,controlsList:Tn,coords:je|Sf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:It,defer:It,dir:null,dirName:null,disabled:It,download:jC,draggable:mr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:It,formTarget:null,headers:Tn,height:je,hidden:jC,high:je,href:null,hrefLang:null,htmlFor:Tn,httpEquiv:Tn,id:null,imageSizes:null,imageSrcSet:null,inert:It,inputMode:null,integrity:null,is:null,isMap:It,itemId:null,itemProp:Tn,itemRef:Tn,itemScope:It,itemType:Tn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:It,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:It,muted:It,name:null,nonce:null,noModule:It,noValidate:It,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:It,optimum:je,pattern:null,ping:Tn,placeholder:null,playsInline:It,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:It,referrerPolicy:null,rel:Tn,required:It,reversed:It,rows:je,rowSpan:je,sandbox:Tn,scope:null,scoped:It,seamless:It,selected:It,shadowRootClonable:It,shadowRootDelegatesFocus:It,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:mr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:It,useMap:null,value:mr,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tn,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:It,declare:It,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:It,noHref:It,noShade:It,noWrap:It,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:mr,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:It,disableRemotePlayback:It,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:M8}),_xe=gh({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qs,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:Tn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:It,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sf,g2:Sf,glyphName:Sf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:Qs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:je,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qs,rev:Qs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qs,requiredFeatures:Qs,requiredFonts:Qs,requiredFormats:Qs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:Qs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qs,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:j8}),O8=gh({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),I8=gh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:M8}),P8=gh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),wxe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Sxe=/[A-Z]/g,g4=/-[a-z]/g,Exe=/^data[-\w.:]+$/i;function kxe(t,e){const n=NC(e);let r=e,s=Us;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Exe.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(g4,Cxe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!g4.test(i)){let a=i.replace(Sxe,Txe);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=oj}return new s(r,e)}function Txe(t){return"-"+t.toLowerCase()}function Cxe(t){return t.charAt(1).toUpperCase()}const Axe=R8([N8,xxe,O8,I8,P8],"html"),lj=R8([N8,_xe,O8,I8,P8],"svg");function Rxe(t){return t.join(" ").trim()}var Id={},C1,v4;function Nxe(){if(v4)return C1;v4=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
1790
|
+
`,d="/",p="*",h="",g="comment",v="declaration";C1=function(x,E){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];E=E||{};var S=1,k=1;function T(G){var W=G.match(e);W&&(S+=W.length);var X=G.lastIndexOf(c);k=~X?G.length-X:k+G.length}function N(){var G={line:S,column:k};return function(W){return W.position=new j(G),M(),W}}function j(G){this.start=G,this.end={line:S,column:k},this.source=E.source}j.prototype.content=x;function A(G){var W=new Error(E.source+":"+S+":"+k+": "+G);if(W.reason=G,W.filename=E.source,W.line=S,W.column=k,W.source=x,!E.silent)throw W}function R(G){var W=G.exec(x);if(W){var X=W[0];return T(X),x=x.slice(X.length),W}}function M(){R(n)}function P(G){var W;for(G=G||[];W=O();)W!==!1&&G.push(W);return G}function O(){var G=N();if(!(d!=x.charAt(0)||p!=x.charAt(1))){for(var W=2;h!=x.charAt(W)&&(p!=x.charAt(W)||d!=x.charAt(W+1));)++W;if(W+=2,h===x.charAt(W-1))return A("End of comment missing");var X=x.slice(2,W-2);return k+=2,T(X),x=x.slice(W),k+=2,G({type:g,comment:X})}}function L(){var G=N(),W=R(r);if(W){if(O(),!R(s))return A("property missing ':'");var X=R(i),F=G({type:v,property:b(W[0].replace(t,h)),value:X?b(X[0].replace(t,h)):h});return R(a),F}}function z(){var G=[];P(G);for(var W;W=L();)W!==!1&&(G.push(W),P(G));return G}return M(),z()};function b(x){return x?x.replace(l,h):h}return C1}var y4;function jxe(){if(y4)return Id;y4=1;var t=Id&&Id.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Id,"__esModule",{value:!0}),Id.default=n;var e=t(Nxe());function n(r,s){var i=null;if(!r||typeof r!="string")return i;var a=(0,e.default)(r),l=typeof s=="function";return a.forEach(function(c){if(c.type==="declaration"){var d=c.property,p=c.value;l?s(d,p,c):p&&(i=i||{},i[d]=p)}}),i}return Id}var Np={},b4;function Mxe(){if(b4)return Np;b4=1,Object.defineProperty(Np,"__esModule",{value:!0}),Np.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(d){return!d||n.test(d)||t.test(d)},a=function(d,p){return p.toUpperCase()},l=function(d,p){return"".concat(p,"-")},c=function(d,p){return p===void 0&&(p={}),i(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(s,l):d=d.replace(r,l),d.replace(e,a))};return Np.camelCase=c,Np}var jp,x4;function Oxe(){if(x4)return jp;x4=1;var t=jp&&jp.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(jxe()),n=Mxe();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,jp=r,jp}var Ixe=Oxe();const Pxe=nh(Ixe),D8=L8("end"),cj=L8("start");function L8(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Dxe(t){const e=cj(t),n=D8(t);if(e&&n)return{start:e,end:n}}function xm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?_4(t.position):"start"in t||"end"in t?_4(t):"line"in t||"column"in t?OC(t):""}function OC(t){return w4(t&&t.line)+":"+w4(t&&t.column)}function _4(t){return OC(t&&t.start)+"-"+OC(t&&t.end)}function w4(t){return t&&typeof t=="number"?t:1}class cs extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=xm(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}cs.prototype.file="";cs.prototype.name="";cs.prototype.reason="";cs.prototype.message="";cs.prototype.stack="";cs.prototype.column=void 0;cs.prototype.line=void 0;cs.prototype.ancestors=void 0;cs.prototype.cause=void 0;cs.prototype.fatal=void 0;cs.prototype.place=void 0;cs.prototype.ruleId=void 0;cs.prototype.source=void 0;const uj={}.hasOwnProperty,Lxe=new Map,$xe=/[A-Z]/g,zxe=new Set(["table","tbody","thead","tfoot","tr"]),Fxe=new Set(["td","th"]),$8="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Uxe(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Kxe(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Yxe(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?lj:Axe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=z8(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function z8(t,e,n){if(e.type==="element")return Bxe(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Hxe(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Vxe(t,e,n);if(e.type==="mdxjsEsm")return qxe(t,e);if(e.type==="root")return Gxe(t,e,n);if(e.type==="text")return Wxe(t,e)}function Bxe(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=lj,t.schema=s),t.ancestors.push(e);const i=U8(t,e.tagName,!1),a=Xxe(t,e);let l=fj(t,e);return zxe.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!yxe(c):!0})),F8(t,a,i,e),dj(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Hxe(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}ng(t,e.position)}function qxe(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ng(t,e.position)}function Vxe(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=lj,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:U8(t,e.name,!0),a=Qxe(t,e),l=fj(t,e);return F8(t,a,i,e),dj(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function Gxe(t,e,n){const r={};return dj(r,fj(t,e)),t.create(e,t.Fragment,r,n)}function Wxe(t,e){return e.value}function F8(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function dj(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Yxe(t,e,n){return r;function r(s,i,a,l){const d=Array.isArray(a.children)?n:e;return l?d(i,a,l):d(i,a)}}function Kxe(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=cj(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function Xxe(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&uj.call(e.properties,s)){const i=Jxe(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Fxe.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Qxe(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else ng(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else ng(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function fj(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:Lxe;for(;++r<e.children.length;){const i=e.children[r];let a;if(t.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=z8(t,i,a);l!==void 0&&n.push(l)}return n}function Jxe(t,e,n){const r=kxe(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?hxe(n):Rxe(n)),r.property==="style"){let s=typeof n=="object"?n:Zxe(t,String(n));return t.stylePropertyNameCase==="css"&&(s=e0e(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?wxe[r.property]||r.property:r.attribute,n]}}function Zxe(t,e){try{return Pxe(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new cs("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=$8+"#cannot-parse-style-attribute",s}}function U8(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,a;for(;++i<s.length;){const l=h4(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=h4(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return uj.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);ng(t)}function ng(t,e){const n=new cs("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=$8+"#cannot-handle-mdx-estrees-without-createevaluater",n}function e0e(t){const e={};let n;for(n in t)uj.call(t,n)&&(e[t0e(n)]=t[n]);return e}function t0e(t){let e=t.replace($xe,n0e);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function n0e(t){return"-"+t.toLowerCase()}const A1={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},r0e={};function hj(t,e){const n=r0e,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return B8(t,r,s)}function B8(t,e,n){if(s0e(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return S4(t.children,e,n)}return Array.isArray(t)?S4(t,e,n):""}function S4(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=B8(t[s],e,n);return r.join("")}function s0e(t){return!!(t&&typeof t=="object")}const E4=document.createElement("i");function pj(t){const e="&"+t+";";E4.innerHTML=e;const n=E4.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function li(t,e,n,r){const s=t.length;let i=0,a;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(e,0),t.splice(...a),i+=1e4,e+=1e4}function ki(t,e){return t.length>0?(li(t,t.length,0,e),t):e}const k4={}.hasOwnProperty;function H8(t){const e={};let n=-1;for(;++n<t.length;)i0e(e,t[n]);return e}function i0e(t,e){let n;for(n in e){const s=(k4.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let a;if(i)for(a in i){k4.call(s,a)||(s[a]=[]);const l=i[a];a0e(s[a],Array.isArray(l)?l:l?[l]:[])}}}function a0e(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);li(t,0,0,r)}function q8(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function la(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ms=gc(/[A-Za-z]/),as=gc(/[\dA-Za-z]/),o0e=gc(/[#-'*+\--9=?A-Z^-~]/);function Cx(t){return t!==null&&(t<32||t===127)}const IC=gc(/\d/),l0e=gc(/[\dA-Fa-f]/),c0e=gc(/[!-/:-@[-`{-~]/);function ct(t){return t!==null&&t<-2}function Sn(t){return t!==null&&(t<0||t===32)}function Gt(t){return t===-2||t===-1||t===32}const t_=gc(new RegExp("\\p{P}|\\p{S}","u")),Mu=gc(/\s/);function gc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function vh(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const i=t.charCodeAt(n);let a="";if(i===37&&as(t.charCodeAt(n+1))&&as(t.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function tn(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Gt(c)?(t.enter(n),l(c)):e(c)}function l(c){return Gt(c)&&i++<s?(t.consume(c),l):(t.exit(n),e(c))}}const u0e={tokenize:d0e};function d0e(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),tn(t,e,"linePrefix")}function s(l){return t.enter("paragraph"),i(l)}function i(l){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return ct(l)?(t.consume(l),t.exit("chunkText"),i):(t.consume(l),a)}}const f0e={tokenize:h0e},T4={tokenize:p0e};function h0e(t){const e=this,n=[];let r=0,s,i,a;return l;function l(T){if(r<n.length){const N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,c,d)(T)}return d(T)}function c(T){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&k();const N=e.events.length;let j=N,A;for(;j--;)if(e.events[j][0]==="exit"&&e.events[j][1].type==="chunkFlow"){A=e.events[j][1].end;break}S(r);let R=N;for(;R<e.events.length;)e.events[R][1].end={...A},R++;return li(e.events,j+1,0,e.events.slice(N)),e.events.length=R,d(T)}return l(T)}function d(T){if(r===n.length){if(!s)return g(T);if(s.currentConstruct&&s.currentConstruct.concrete)return b(T);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(T4,p,h)(T)}function p(T){return s&&k(),S(r),g(T)}function h(T){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,b(T)}function g(T){return e.containerState={},t.attempt(T4,v,b)(T)}function v(T){return r++,n.push([e.currentConstruct,e.containerState]),g(T)}function b(T){if(T===null){s&&k(),S(0),t.consume(T);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),x(T)}function x(T){if(T===null){E(t.exit("chunkFlow"),!0),S(0),t.consume(T);return}return ct(T)?(t.consume(T),E(t.exit("chunkFlow")),r=0,e.interrupt=void 0,l):(t.consume(T),x)}function E(T,N){const j=e.sliceStream(T);if(N&&j.push(null),T.previous=i,i&&(i.next=T),i=T,s.defineSkip(T.start),s.write(j),e.parser.lazy[T.start.line]){let A=s.events.length;for(;A--;)if(s.events[A][1].start.offset<a&&(!s.events[A][1].end||s.events[A][1].end.offset>a))return;const R=e.events.length;let M=R,P,O;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){if(P){O=e.events[M][1].end;break}P=!0}for(S(r),A=R;A<e.events.length;)e.events[A][1].end={...O},A++;li(e.events,M+1,0,e.events.slice(R)),e.events.length=A}}function S(T){let N=n.length;for(;N-- >T;){const j=n[N];e.containerState=j[1],j[0].exit.call(e,t)}n.length=T}function k(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function p0e(t,e,n){return tn(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hf(t){if(t===null||Sn(t)||Mu(t))return 1;if(t_(t))return 2}function n_(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const PC={name:"attention",resolveAll:m0e,tokenize:g0e};function m0e(t,e){let n=-1,r,s,i,a,l,c,d,p;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},g={...t[n][1].start};C4(h,-c),C4(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},d=[],t[r][1].end.offset-t[r][1].start.offset&&(d=ki(d,[["enter",t[r][1],e],["exit",t[r][1],e]])),d=ki(d,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),d=ki(d,n_(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),d=ki(d,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(p=2,d=ki(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):p=0,li(t,r-1,n-r+3,d),n=r+d.length-p-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function g0e(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Hf(r);let i;return a;function a(c){return i=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===i)return t.consume(c),l;const d=t.exit("attentionSequence"),p=Hf(c),h=!p||p===2&&s||n.includes(c),g=!s||s===2&&p||n.includes(r);return d._open=!!(i===42?h:h&&(s||!g)),d._close=!!(i===42?g:g&&(p||!h)),e(c)}}function C4(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const v0e={name:"autolink",tokenize:y0e};function y0e(t,e,n){let r=0;return s;function s(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(v){return ms(v)?(t.consume(v),a):v===64?n(v):d(v)}function a(v){return v===43||v===45||v===46||as(v)?(r=1,l(v)):d(v)}function l(v){return v===58?(t.consume(v),r=0,c):(v===43||v===45||v===46||as(v))&&r++<32?(t.consume(v),l):(r=0,d(v))}function c(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):v===null||v===32||v===60||Cx(v)?n(v):(t.consume(v),c)}function d(v){return v===64?(t.consume(v),p):o0e(v)?(t.consume(v),d):n(v)}function p(v){return as(v)?h(v):n(v)}function h(v){return v===46?(t.consume(v),r=0,p):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):g(v)}function g(v){if((v===45||as(v))&&r++<63){const b=v===45?g:h;return t.consume(v),b}return n(v)}}const Pg={partial:!0,tokenize:b0e};function b0e(t,e,n){return r;function r(i){return Gt(i)?tn(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||ct(i)?e(i):n(i)}}const V8={continuation:{tokenize:_0e},exit:w0e,name:"blockQuote",tokenize:x0e};function x0e(t,e,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Gt(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function _0e(t,e,n){const r=this;return s;function s(a){return Gt(a)?tn(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return t.attempt(V8,e,n)(a)}}function w0e(t){t.exit("blockQuote")}const G8={name:"characterEscape",tokenize:S0e};function S0e(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return c0e(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const W8={name:"characterReference",tokenize:E0e};function E0e(t,e,n){const r=this;let s=0,i,a;return l;function l(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),c}function c(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),i=31,a=as,p(h))}function d(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,a=l0e,p):(t.enter("characterReferenceValue"),i=7,a=IC,p(h))}function p(h){if(h===59&&s){const g=t.exit("characterReferenceValue");return a===as&&!pj(r.sliceSerialize(g))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(h)&&s++<i?(t.consume(h),p):n(h)}}const A4={partial:!0,tokenize:T0e},R4={concrete:!0,name:"codeFenced",tokenize:k0e};function k0e(t,e,n){const r=this,s={partial:!0,tokenize:j};let i=0,a=0,l;return c;function c(A){return d(A)}function d(A){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=A,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),p(A)}function p(A){return A===l?(a++,t.consume(A),p):a<3?n(A):(t.exit("codeFencedFenceSequence"),Gt(A)?tn(t,h,"whitespace")(A):h(A))}function h(A){return A===null||ct(A)?(t.exit("codeFencedFence"),r.interrupt?e(A):t.check(A4,x,N)(A)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||ct(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(A)):Gt(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),tn(t,v,"whitespace")(A)):A===96&&A===l?n(A):(t.consume(A),g)}function v(A){return A===null||ct(A)?h(A):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(A))}function b(A){return A===null||ct(A)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(A)):A===96&&A===l?n(A):(t.consume(A),b)}function x(A){return t.attempt(s,N,E)(A)}function E(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),S}function S(A){return i>0&&Gt(A)?tn(t,k,"linePrefix",i+1)(A):k(A)}function k(A){return A===null||ct(A)?t.check(A4,x,N)(A):(t.enter("codeFlowValue"),T(A))}function T(A){return A===null||ct(A)?(t.exit("codeFlowValue"),k(A)):(t.consume(A),T)}function N(A){return t.exit("codeFenced"),e(A)}function j(A,R,M){let P=0;return O;function O(X){return A.enter("lineEnding"),A.consume(X),A.exit("lineEnding"),L}function L(X){return A.enter("codeFencedFence"),Gt(X)?tn(A,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):z(X)}function z(X){return X===l?(A.enter("codeFencedFenceSequence"),G(X)):M(X)}function G(X){return X===l?(P++,A.consume(X),G):P>=a?(A.exit("codeFencedFenceSequence"),Gt(X)?tn(A,W,"whitespace")(X):W(X)):M(X)}function W(X){return X===null||ct(X)?(A.exit("codeFencedFence"),R(X)):M(X)}}}function T0e(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const R1={name:"codeIndented",tokenize:A0e},C0e={partial:!0,tokenize:R0e};function A0e(t,e,n){const r=this;return s;function s(d){return t.enter("codeIndented"),tn(t,i,"linePrefix",5)(d)}function i(d){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):ct(d)?t.attempt(C0e,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||ct(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function R0e(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ct(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):tn(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):ct(a)?s(a):n(a)}}const N0e={name:"codeText",previous:M0e,resolve:j0e,tokenize:O0e};function j0e(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function M0e(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function O0e(t,e,n){let r=0,s,i;return a;function a(h){return t.enter("codeText"),t.enter("codeTextSequence"),l(h)}function l(h){return h===96?(t.consume(h),r++,l):(t.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),c):h===96?(i=t.enter("codeTextSequence"),s=0,p(h)):ct(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("codeTextData"),d(h))}function d(h){return h===null||h===32||h===96||ct(h)?(t.exit("codeTextData"),c(h)):(t.consume(h),d)}function p(h){return h===96?(t.consume(h),s++,p):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(i.type="codeTextData",d(h))}}class I0e{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Mp(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Mp(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Mp(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Mp(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Mp(this.left,n.reverse())}}}function Mp(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Y8(t){const e={};let n=-1,r,s,i,a,l,c,d;const p=new I0e(t);for(;++n<p.length;){for(;n in e;)n=e[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,P0e(p,n)),n=e[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return li(t,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function P0e(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let p,h,g=-1,v=n,b=0,x=0;const E=[x];for(;v;){for(;t.get(++s)[1]!==v;);i.push(s),v._tokenizer||(p=r.sliceStream(v),v.next||p.push(null),h&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(x=g+1,E.push(x),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):E.pop(),g=E.length;g--;){const S=l.slice(E[g],E[g+1]),k=i.pop();c.push([k,k+S.length-1]),t.splice(k,2,S)}for(c.reverse(),g=-1;++g<c.length;)d[b+c[g][0]]=b+c[g][1],b+=c[g][1]-c[g][0]-1;return d}const D0e={resolve:$0e,tokenize:z0e},L0e={partial:!0,tokenize:F0e};function $0e(t){return Y8(t),t}function z0e(t,e){let n;return r;function r(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ct(l)?t.check(L0e,a,i)(l):(t.consume(l),s)}function i(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function F0e(t,e,n){const r=this;return s;function s(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),tn(t,i,"linePrefix")}function i(a){if(a===null||ct(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function K8(t,e,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let p=0;return h;function h(S){return S===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(S),t.exit(i),g):S===null||S===32||S===41||Cx(S)?n(S):(t.enter(r),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),x(S))}function g(S){return S===62?(t.enter(i),t.consume(S),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(t.exit("chunkString"),t.exit(l),g(S)):S===null||S===60||ct(S)?n(S):(t.consume(S),S===92?b:v)}function b(S){return S===60||S===62||S===92?(t.consume(S),v):v(S)}function x(S){return!p&&(S===null||S===41||Sn(S))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(S)):p<d&&S===40?(t.consume(S),p++,x):S===41?(t.consume(S),p--,x):S===null||S===32||S===40||Cx(S)?n(S):(t.consume(S),S===92?E:x)}function E(S){return S===40||S===41||S===92?(t.consume(S),x):x(S)}}function X8(t,e,n,r,s,i){const a=this;let l=0,c;return d;function d(v){return t.enter(r),t.enter(s),t.consume(v),t.exit(s),t.enter(i),p}function p(v){return l>999||v===null||v===91||v===93&&!c||v===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(t.exit(i),t.enter(s),t.consume(v),t.exit(s),t.exit(r),e):ct(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),p):(t.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||v===91||v===93||ct(v)||l++>999?(t.exit("chunkString"),p(v)):(t.consume(v),c||(c=!Gt(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(t.consume(v),l++,h):h(v)}}function Q8(t,e,n,r,s,i){let a;return l;function l(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),d(g))}function d(g){return g===a?(t.exit(i),c(a)):g===null?n(g):ct(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),tn(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||ct(g)?(t.exit("chunkString"),d(g)):(t.consume(g),g===92?h:p)}function h(g){return g===a||g===92?(t.consume(g),p):p(g)}}function _m(t,e){let n;return r;function r(s){return ct(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Gt(s)?tn(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const U0e={name:"definition",tokenize:H0e},B0e={partial:!0,tokenize:q0e};function H0e(t,e,n){const r=this;let s;return i;function i(v){return t.enter("definition"),a(v)}function a(v){return X8.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function l(v){return s=la(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),c):n(v)}function c(v){return Sn(v)?_m(t,d)(v):d(v)}function d(v){return K8(t,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function p(v){return t.attempt(B0e,h,h)(v)}function h(v){return Gt(v)?tn(t,g,"whitespace")(v):g(v)}function g(v){return v===null||ct(v)?(t.exit("definition"),r.parser.defined.push(s),e(v)):n(v)}}function q0e(t,e,n){return r;function r(l){return Sn(l)?_m(t,s)(l):n(l)}function s(l){return Q8(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Gt(l)?tn(t,a,"whitespace")(l):a(l)}function a(l){return l===null||ct(l)?e(l):n(l)}}const V0e={name:"hardBreakEscape",tokenize:G0e};function G0e(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ct(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const W0e={name:"headingAtx",resolve:Y0e,tokenize:K0e};function Y0e(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},li(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function K0e(t,e,n){let r=0;return s;function s(p){return t.enter("atxHeading"),i(p)}function i(p){return t.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(t.consume(p),a):p===null||Sn(p)?(t.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(t.enter("atxHeadingSequence"),c(p)):p===null||ct(p)?(t.exit("atxHeading"),e(p)):Gt(p)?tn(t,l,"whitespace")(p):(t.enter("atxHeadingText"),d(p))}function c(p){return p===35?(t.consume(p),c):(t.exit("atxHeadingSequence"),l(p))}function d(p){return p===null||p===35||Sn(p)?(t.exit("atxHeadingText"),l(p)):(t.consume(p),d)}}const X0e=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],N4=["pre","script","style","textarea"],Q0e={concrete:!0,name:"htmlFlow",resolveTo:e_e,tokenize:t_e},J0e={partial:!0,tokenize:r_e},Z0e={partial:!0,tokenize:n_e};function e_e(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function t_e(t,e,n){const r=this;let s,i,a,l,c;return d;function d(D){return p(D)}function p(D){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(D),h}function h(D){return D===33?(t.consume(D),g):D===47?(t.consume(D),i=!0,x):D===63?(t.consume(D),s=3,r.interrupt?e:I):ms(D)?(t.consume(D),a=String.fromCharCode(D),E):n(D)}function g(D){return D===45?(t.consume(D),s=2,v):D===91?(t.consume(D),s=5,l=0,b):ms(D)?(t.consume(D),s=4,r.interrupt?e:I):n(D)}function v(D){return D===45?(t.consume(D),r.interrupt?e:I):n(D)}function b(D){const Z="CDATA[";return D===Z.charCodeAt(l++)?(t.consume(D),l===Z.length?r.interrupt?e:z:b):n(D)}function x(D){return ms(D)?(t.consume(D),a=String.fromCharCode(D),E):n(D)}function E(D){if(D===null||D===47||D===62||Sn(D)){const Z=D===47,he=a.toLowerCase();return!Z&&!i&&N4.includes(he)?(s=1,r.interrupt?e(D):z(D)):X0e.includes(a.toLowerCase())?(s=6,Z?(t.consume(D),S):r.interrupt?e(D):z(D)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):i?k(D):T(D))}return D===45||as(D)?(t.consume(D),a+=String.fromCharCode(D),E):n(D)}function S(D){return D===62?(t.consume(D),r.interrupt?e:z):n(D)}function k(D){return Gt(D)?(t.consume(D),k):O(D)}function T(D){return D===47?(t.consume(D),O):D===58||D===95||ms(D)?(t.consume(D),N):Gt(D)?(t.consume(D),T):O(D)}function N(D){return D===45||D===46||D===58||D===95||as(D)?(t.consume(D),N):j(D)}function j(D){return D===61?(t.consume(D),A):Gt(D)?(t.consume(D),j):T(D)}function A(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(t.consume(D),c=D,R):Gt(D)?(t.consume(D),A):M(D)}function R(D){return D===c?(t.consume(D),c=null,P):D===null||ct(D)?n(D):(t.consume(D),R)}function M(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Sn(D)?j(D):(t.consume(D),M)}function P(D){return D===47||D===62||Gt(D)?T(D):n(D)}function O(D){return D===62?(t.consume(D),L):n(D)}function L(D){return D===null||ct(D)?z(D):Gt(D)?(t.consume(D),L):n(D)}function z(D){return D===45&&s===2?(t.consume(D),F):D===60&&s===1?(t.consume(D),Y):D===62&&s===4?(t.consume(D),re):D===63&&s===3?(t.consume(D),I):D===93&&s===5?(t.consume(D),te):ct(D)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(J0e,ue,G)(D)):D===null||ct(D)?(t.exit("htmlFlowData"),G(D)):(t.consume(D),z)}function G(D){return t.check(Z0e,W,ue)(D)}function W(D){return t.enter("lineEnding"),t.consume(D),t.exit("lineEnding"),X}function X(D){return D===null||ct(D)?G(D):(t.enter("htmlFlowData"),z(D))}function F(D){return D===45?(t.consume(D),I):z(D)}function Y(D){return D===47?(t.consume(D),a="",V):z(D)}function V(D){if(D===62){const Z=a.toLowerCase();return N4.includes(Z)?(t.consume(D),re):z(D)}return ms(D)&&a.length<8?(t.consume(D),a+=String.fromCharCode(D),V):z(D)}function te(D){return D===93?(t.consume(D),I):z(D)}function I(D){return D===62?(t.consume(D),re):D===45&&s===2?(t.consume(D),I):z(D)}function re(D){return D===null||ct(D)?(t.exit("htmlFlowData"),ue(D)):(t.consume(D),re)}function ue(D){return t.exit("htmlFlow"),e(D)}}function n_e(t,e,n){const r=this;return s;function s(a){return ct(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function r_e(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(Pg,e,n)}}const s_e={name:"htmlText",tokenize:i_e};function i_e(t,e,n){const r=this;let s,i,a;return l;function l(I){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(I),c}function c(I){return I===33?(t.consume(I),d):I===47?(t.consume(I),j):I===63?(t.consume(I),T):ms(I)?(t.consume(I),M):n(I)}function d(I){return I===45?(t.consume(I),p):I===91?(t.consume(I),i=0,b):ms(I)?(t.consume(I),k):n(I)}function p(I){return I===45?(t.consume(I),v):n(I)}function h(I){return I===null?n(I):I===45?(t.consume(I),g):ct(I)?(a=h,Y(I)):(t.consume(I),h)}function g(I){return I===45?(t.consume(I),v):h(I)}function v(I){return I===62?F(I):I===45?g(I):h(I)}function b(I){const re="CDATA[";return I===re.charCodeAt(i++)?(t.consume(I),i===re.length?x:b):n(I)}function x(I){return I===null?n(I):I===93?(t.consume(I),E):ct(I)?(a=x,Y(I)):(t.consume(I),x)}function E(I){return I===93?(t.consume(I),S):x(I)}function S(I){return I===62?F(I):I===93?(t.consume(I),S):x(I)}function k(I){return I===null||I===62?F(I):ct(I)?(a=k,Y(I)):(t.consume(I),k)}function T(I){return I===null?n(I):I===63?(t.consume(I),N):ct(I)?(a=T,Y(I)):(t.consume(I),T)}function N(I){return I===62?F(I):T(I)}function j(I){return ms(I)?(t.consume(I),A):n(I)}function A(I){return I===45||as(I)?(t.consume(I),A):R(I)}function R(I){return ct(I)?(a=R,Y(I)):Gt(I)?(t.consume(I),R):F(I)}function M(I){return I===45||as(I)?(t.consume(I),M):I===47||I===62||Sn(I)?P(I):n(I)}function P(I){return I===47?(t.consume(I),F):I===58||I===95||ms(I)?(t.consume(I),O):ct(I)?(a=P,Y(I)):Gt(I)?(t.consume(I),P):F(I)}function O(I){return I===45||I===46||I===58||I===95||as(I)?(t.consume(I),O):L(I)}function L(I){return I===61?(t.consume(I),z):ct(I)?(a=L,Y(I)):Gt(I)?(t.consume(I),L):P(I)}function z(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),s=I,G):ct(I)?(a=z,Y(I)):Gt(I)?(t.consume(I),z):(t.consume(I),W)}function G(I){return I===s?(t.consume(I),s=void 0,X):I===null?n(I):ct(I)?(a=G,Y(I)):(t.consume(I),G)}function W(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Sn(I)?P(I):(t.consume(I),W)}function X(I){return I===47||I===62||Sn(I)?P(I):n(I)}function F(I){return I===62?(t.consume(I),t.exit("htmlTextData"),t.exit("htmlText"),e):n(I)}function Y(I){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),V}function V(I){return Gt(I)?tn(t,te,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):te(I)}function te(I){return t.enter("htmlTextData"),a(I)}}const mj={name:"labelEnd",resolveAll:c_e,resolveTo:u_e,tokenize:d_e},a_e={tokenize:f_e},o_e={tokenize:h_e},l_e={tokenize:p_e};function c_e(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&li(t,0,t.length,n),t}function u_e(t,e){let n=t.length,r=0,s,i,a,l;for(;n--;)if(s=t[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[i][1].start},end:{...t[a][1].end}},p={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",d,e]],l=ki(l,t.slice(i+1,i+r+3)),l=ki(l,[["enter",p,e]]),l=ki(l,n_(e.parser.constructs.insideSpan.null,t.slice(i+r+4,a-3),e)),l=ki(l,[["exit",p,e],t[a-2],t[a-1],["exit",d,e]]),l=ki(l,t.slice(a+1)),l=ki(l,[["exit",c,e]]),li(t,i,t.length,l),t}function d_e(t,e,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(g){return i?i._inactive?h(g):(a=r.parser.defined.includes(la(r.sliceSerialize({start:i.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),c):n(g)}function c(g){return g===40?t.attempt(a_e,p,a?p:h)(g):g===91?t.attempt(o_e,p,a?d:h)(g):a?p(g):h(g)}function d(g){return t.attempt(l_e,p,h)(g)}function p(g){return e(g)}function h(g){return i._balanced=!0,n(g)}}function f_e(t,e,n){return r;function r(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),s}function s(h){return Sn(h)?_m(t,i)(h):i(h)}function i(h){return h===41?p(h):K8(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Sn(h)?_m(t,c)(h):p(h)}function l(h){return n(h)}function c(h){return h===34||h===39||h===40?Q8(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function d(h){return Sn(h)?_m(t,p)(h):p(h)}function p(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function h_e(t,e,n){const r=this;return s;function s(l){return X8.call(r,t,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(la(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function a(l){return n(l)}}function p_e(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const m_e={name:"labelStartImage",resolveAll:mj.resolveAll,tokenize:g_e};function g_e(t,e,n){const r=this;return s;function s(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),i}function i(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const v_e={name:"labelStartLink",resolveAll:mj.resolveAll,tokenize:y_e};function y_e(t,e,n){const r=this;return s;function s(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const N1={name:"lineEnding",tokenize:b_e};function b_e(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),tn(t,e,"linePrefix")}}const pb={name:"thematicBreak",tokenize:x_e};function x_e(t,e,n){let r=0,s;return i;function i(d){return t.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(t.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||ct(d))?(t.exit("thematicBreak"),e(d)):n(d)}function c(d){return d===s?(t.consume(d),r++,c):(t.exit("thematicBreakSequence"),Gt(d)?tn(t,l,"whitespace")(d):l(d))}}const Cs={continuation:{tokenize:E_e},exit:T_e,name:"list",tokenize:S_e},__e={partial:!0,tokenize:C_e},w_e={partial:!0,tokenize:k_e};function S_e(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:IC(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(pb,n,d)(v):d(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(v)}return n(v)}function c(v){return IC(v)&&++a<10?(t.consume(v),c):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):n(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(Pg,r.interrupt?n:p,t.attempt(__e,g,h))}function p(v){return r.containerState.initialBlankLine=!0,i++,g(v)}function h(v){return Gt(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function E_e(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Pg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tn(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Gt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(w_e,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,tn(t,t.attempt(Cs,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function k_e(t,e,n){const r=this;return tn(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function T_e(t){t.exit(this.containerState.type)}function C_e(t,e,n){const r=this;return tn(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Gt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const j4={name:"setextUnderline",resolveTo:A_e,tokenize:R_e};function A_e(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function R_e(t,e,n){const r=this;let s;return i;function i(d){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),Gt(d)?tn(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||ct(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const N_e={tokenize:j_e};function j_e(t){const e=this,n=t.attempt(Pg,r,t.attempt(this.parser.constructs.flowInitial,s,tn(t,t.attempt(this.parser.constructs.flow,s,t.attempt(D0e,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const M_e={resolveAll:Z8()},O_e=J8("string"),I_e=J8("text");function J8(t){return{resolveAll:Z8(t==="text"?P_e:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(p){return d(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return d(p)?(n.exit("data"),i(p)):(n.consume(p),c)}function d(p){if(p===null)return!0;const h=s[p];let g=-1;if(h)for(;++g<h.length;){const v=h[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function Z8(t){return e;function e(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(n,r):n}}function P_e(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],s=e.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const d={type:n===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const D_e={42:Cs,43:Cs,45:Cs,48:Cs,49:Cs,50:Cs,51:Cs,52:Cs,53:Cs,54:Cs,55:Cs,56:Cs,57:Cs,62:V8},L_e={91:U0e},$_e={[-2]:R1,[-1]:R1,32:R1},z_e={35:W0e,42:pb,45:[j4,pb],60:Q0e,61:j4,95:pb,96:R4,126:R4},F_e={38:W8,92:G8},U_e={[-5]:N1,[-4]:N1,[-3]:N1,33:m_e,38:W8,42:PC,60:[v0e,s_e],91:v_e,92:[V0e,G8],93:mj,95:PC,96:N0e},B_e={null:[PC,M_e]},H_e={null:[42,95]},q_e={null:[]},V_e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:H_e,contentInitial:L_e,disable:q_e,document:D_e,flow:z_e,flowInitial:$_e,insideSpan:B_e,string:F_e,text:U_e},Symbol.toStringTag,{value:"Module"}));function G_e(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:R(j),check:R(A),consume:k,enter:T,exit:N,interrupt:R(A,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:b,parser:t,previous:null,sliceSerialize:g,sliceStream:v,write:h};let p=e.tokenize.call(d,c);return e.resolveAll&&i.push(e),d;function h(L){return a=ki(a,L),E(),a[a.length-1]!==null?[]:(M(e,0),d.events=n_(i,d.events,d),d.events)}function g(L,z){return Y_e(v(L),z)}function v(L){return W_e(a,L)}function b(){const{_bufferIndex:L,_index:z,line:G,column:W,offset:X}=r;return{_bufferIndex:L,_index:z,line:G,column:W,offset:X}}function x(L){s[L.line]=L.column,O()}function E(){let L;for(;r._index<a.length;){const z=a[r._index];if(typeof z=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<z.length;)S(z.charCodeAt(r._bufferIndex));else S(z)}}function S(L){p=p(L)}function k(L){ct(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,O()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=L}function T(L,z){const G=z||{};return G.type=L,G.start=b(),d.events.push(["enter",G,d]),l.push(G),G}function N(L){const z=l.pop();return z.end=b(),d.events.push(["exit",z,d]),z}function j(L,z){M(L,z.from)}function A(L,z){z.restore()}function R(L,z){return G;function G(W,X,F){let Y,V,te,I;return Array.isArray(W)?ue(W):"tokenize"in W?ue([W]):re(W);function re(q){return U;function U(K){const ae=K!==null&&q[K],B=K!==null&&q.null,J=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(B)?B:B?[B]:[]];return ue(J)(K)}}function ue(q){return Y=q,V=0,q.length===0?F:D(q[V])}function D(q){return U;function U(K){return I=P(),te=q,q.partial||(d.currentConstruct=q),q.name&&d.parser.constructs.disable.null.includes(q.name)?he():q.tokenize.call(z?Object.assign(Object.create(d),z):d,c,Z,he)(K)}}function Z(q){return L(te,I),X}function he(q){return I.restore(),++V<Y.length?D(Y[V]):F}}}function M(L,z){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&li(d.events,z,d.events.length-z,L.resolve(d.events.slice(z),d)),L.resolveTo&&(d.events=L.resolveTo(d.events,d))}function P(){const L=b(),z=d.previous,G=d.currentConstruct,W=d.events.length,X=Array.from(l);return{from:W,restore:F};function F(){r=L,d.previous=z,d.currentConstruct=G,d.events.length=W,l=X,O()}}function O(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function W_e(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let a;if(n===s)a=[t[n].slice(r,i)];else{if(a=t.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function Y_e(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const i=t[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
1791
1791
|
`;break}case-3:{a=`\r
|
|
1792
|
-
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function K_e(t){const r={constructs:H8([V_e,...(t||{}).extensions||[]]),content:s(u0e),defined:[],document:s(f0e),flow:s(N_e),lazy:{},string:s(O_e),text:s(I_e)};return r;function s(i){return a;function a(l){return G_e(r,i,l)}}}function X_e(t){for(;!Y8(t););return t}const M5=/[\0\t\n\r]/g;function Q_e(){let t=1,e="",n=!0,r;return s;function s(i,a,l){const c=[];let d,p,h,g,v;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,e="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(M5.lastIndex=h,d=M5.exec(i),g=d&&d.index!==void 0?d.index:i.length,v=i.charCodeAt(g),!d){e=i.slice(h);break}if(v===10&&h===g&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<g&&(c.push(i.slice(h,g)),t+=g-h),v){case 0:{c.push(65533),t++;break}case 9:{for(p=Math.ceil(t/4)*4,c.push(-2);t++<p;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}h=g+1}return l&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const J_e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Z_e(t){return t.replace(J_e,ewe)}function ewe(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return q8(n.slice(i?2:1),i?16:10)}return pj(n)||t}const e7={}.hasOwnProperty;function twe(t,e,n){return typeof e!="string"&&(n=e,e=void 0),nwe(n)(X_e(K_e(n).document().write(Q_e()(t,e,!0))))}function nwe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ft),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(Ae),blockQuote:i(B),characterEscape:P,characterReference:P,codeFenced:i(J),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(J,a),codeText:i(oe,a),codeTextData:P,data:P,codeFlowValue:P,definition:i(fe),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(xe),hardBreakEscape:i(Oe),hardBreakTrailing:i(Oe),htmlFlow:i(Re,a),htmlFlowData:P,htmlText:i(Re,a),htmlTextData:P,image:i(Je),label:a,link:i(ft),listItem:i(mt),listItemValue:g,listOrdered:i(He,h),listUnordered:i(He),paragraph:i(De),reference:D,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Ae),strong:i(et),thematicBreak:i(ur)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:ae,autolinkProtocol:K,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:q,characterReference:U,codeFenced:c(E),codeFencedFence:x,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:O,codeIndented:c(S),codeText:c(X),codeTextData:O,data:O,definition:c(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:T,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(G),htmlFlowData:O,htmlText:c(W),htmlTextData:O,image:c(Y),label:te,labelText:V,lineEnding:L,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:I,resourceTitleString:re,resource:ue,setextHeading:c(M),setextHeadingLineSequence:R,setextHeadingText:A,strong:c(),thematicBreak:c()}};t7(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(_e){let Ce={type:"root",children:[]};const st={stack:[Ce],tokenStack:[],config:e,enter:l,exit:d,buffer:a,resume:p,data:n},Ge=[];let At=-1;for(;++At<_e.length;)if(_e[At][1].type==="listOrdered"||_e[At][1].type==="listUnordered")if(_e[At][0]==="enter")Ge.push(At);else{const er=Ge.pop();At=s(_e,er,At)}for(At=-1;++At<_e.length;){const er=e[_e[At][0]];e7.call(er,_e[At][1].type)&&er[_e[At][1].type].call(Object.assign({sliceSerialize:_e[At][2].sliceSerialize},st),_e[At][1])}if(st.tokenStack.length>0){const er=st.tokenStack[st.tokenStack.length-1];(er[1]||O5).call(st,void 0,er[0])}for(Ce.position={start:Al(_e.length>0?_e[0][1].start:{line:1,column:1,offset:0}),end:Al(_e.length>0?_e[_e.length-2][1].end:{line:1,column:1,offset:0})},At=-1;++At<e.transforms.length;)Ce=e.transforms[At](Ce)||Ce;return Ce}function s(_e,Ce,st){let Ge=Ce-1,At=-1,er=!1,tr,Ie,xt,Xt;for(;++Ge<=st;){const yt=_e[Ge];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?At++:At--,Xt=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&(tr&&!Xt&&!At&&!xt&&(xt=Ge),Xt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xt=void 0}if(!At&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||At===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if(tr){let Qt=Ge;for(Ie=void 0;Qt--;){const dr=_e[Qt];if(dr[1].type==="lineEnding"||dr[1].type==="lineEndingBlank"){if(dr[0]==="exit")continue;Ie&&(_e[Ie][1].type="lineEndingBlank",er=!0),dr[1].type="lineEnding",Ie=Qt}else if(!(dr[1].type==="linePrefix"||dr[1].type==="blockQuotePrefix"||dr[1].type==="blockQuotePrefixWhitespace"||dr[1].type==="blockQuoteMarker"||dr[1].type==="listItemIndent"))break}xt&&(!Ie||xt<Ie)&&(tr._spread=!0),tr.end=Object.assign({},Ie?_e[Ie][1].start:yt[1].end),_e.splice(Ie||Ge,0,["exit",tr,yt[2]]),Ge++,st++}if(yt[1].type==="listItemPrefix"){const Qt={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};tr=Qt,_e.splice(Ge,0,["enter",Qt,yt[2]]),Ge++,st++,xt=void 0,Xt=!0}}}return _e[Ce][1]._spread=er,st}function i(_e,Ce){return st;function st(Ge){l.call(this,_e(Ge),Ge),Ce&&Ce.call(this,Ge)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(_e,Ce,st){this.stack[this.stack.length-1].children.push(_e),this.stack.push(_e),this.tokenStack.push([Ce,st||void 0]),_e.position={start:Al(Ce.start),end:void 0}}function c(_e){return Ce;function Ce(st){_e&&_e.call(this,st),d.call(this,st)}}function d(_e,Ce){const st=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==_e.type&&(Ce?Ce.call(this,_e,Ge[0]):(Ge[1]||O5).call(this,_e,Ge[0]));else throw new Error("Cannot close `"+_e.type+"` ("+xm({start:_e.start,end:_e.end})+"): it’s not open");st.position.end=Al(_e.end)}function p(){return hj(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(_e){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(_e),10),this.data.expectingFirstListItemValue=void 0}}function v(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=_e}function b(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=_e}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e.replace(/(\r?\n|\r)$/g,"")}function k(_e){const Ce=this.resume(),st=this.stack[this.stack.length-1];st.label=Ce,st.identifier=la(this.sliceSerialize(_e)).toLowerCase()}function T(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=_e}function N(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=_e}function j(_e){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const st=this.sliceSerialize(_e).length;Ce.depth=st}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function R(_e){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(_e).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function P(_e){const st=this.stack[this.stack.length-1].children;let Ge=st[st.length-1];(!Ge||Ge.type!=="text")&&(Ge=ot(),Ge.position={start:Al(_e.start),end:void 0},st.push(Ge)),this.stack.push(Ge)}function O(_e){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(_e),Ce.position.end=Al(_e.end)}function L(_e){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const st=Ce.children[Ce.children.length-1];st.position.end=Al(_e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ce.type)&&(P.call(this,_e),O.call(this,_e))}function z(){this.data.atHardBreak=!0}function G(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e}function W(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e}function X(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e}function F(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=Ce,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function Y(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=Ce,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function V(_e){const Ce=this.sliceSerialize(_e),st=this.stack[this.stack.length-2];st.label=Z_e(Ce),st.identifier=la(Ce).toLowerCase()}function te(){const _e=this.stack[this.stack.length-1],Ce=this.resume(),st=this.stack[this.stack.length-1];if(this.data.inReference=!0,st.type==="link"){const Ge=_e.children;st.children=Ge}else st.alt=Ce}function I(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=_e}function re(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=_e}function ue(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function Z(_e){const Ce=this.resume(),st=this.stack[this.stack.length-1];st.label=Ce,st.identifier=la(this.sliceSerialize(_e)).toLowerCase(),this.data.referenceType="full"}function he(_e){this.data.characterReferenceType=_e.type}function q(_e){const Ce=this.sliceSerialize(_e),st=this.data.characterReferenceType;let Ge;st?(Ge=q8(Ce,st==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=pj(Ce);const At=this.stack[this.stack.length-1];At.value+=Ge}function U(_e){const Ce=this.stack.pop();Ce.position.end=Al(_e.end)}function K(_e){O.call(this,_e);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(_e)}function ae(_e){O.call(this,_e);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(_e)}function B(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function oe(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function Ae(){return{type:"heading",depth:0,children:[]}}function Oe(){return{type:"break"}}function Re(){return{type:"html",value:""}}function Je(){return{type:"image",title:null,url:"",alt:null}}function ft(){return{type:"link",title:null,url:"",children:[]}}function He(_e){return{type:"list",ordered:_e.type==="listOrdered",start:null,spread:_e._spread,children:[]}}function mt(_e){return{type:"listItem",spread:_e._spread,checked:null,children:[]}}function De(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function ot(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function Al(t){return{line:t.line,column:t.column,offset:t.offset}}function t7(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?t7(t,r):rwe(t,r)}}function rwe(t,e){let n;for(n in e)if(e7.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function O5(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+xm({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+xm({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+xm({start:e.start,end:e.end})+") is still open")}function swe(t){const e=this;e.parser=n;function n(r){return twe(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function iwe(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function awe(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
1792
|
+
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function K_e(t){const r={constructs:H8([V_e,...(t||{}).extensions||[]]),content:s(u0e),defined:[],document:s(f0e),flow:s(N_e),lazy:{},string:s(O_e),text:s(I_e)};return r;function s(i){return a;function a(l){return G_e(r,i,l)}}}function X_e(t){for(;!Y8(t););return t}const M4=/[\0\t\n\r]/g;function Q_e(){let t=1,e="",n=!0,r;return s;function s(i,a,l){const c=[];let d,p,h,g,v;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,e="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(M4.lastIndex=h,d=M4.exec(i),g=d&&d.index!==void 0?d.index:i.length,v=i.charCodeAt(g),!d){e=i.slice(h);break}if(v===10&&h===g&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<g&&(c.push(i.slice(h,g)),t+=g-h),v){case 0:{c.push(65533),t++;break}case 9:{for(p=Math.ceil(t/4)*4,c.push(-2);t++<p;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:r=!0,t=1}h=g+1}return l&&(r&&c.push(-5),e&&c.push(e),c.push(null)),c}}const J_e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Z_e(t){return t.replace(J_e,ewe)}function ewe(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return q8(n.slice(i?2:1),i?16:10)}return pj(n)||t}const e7={}.hasOwnProperty;function twe(t,e,n){return typeof e!="string"&&(n=e,e=void 0),nwe(n)(X_e(K_e(n).document().write(Q_e()(t,e,!0))))}function nwe(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ft),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(Ae),blockQuote:i(B),characterEscape:P,characterReference:P,codeFenced:i(J),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(J,a),codeText:i(oe,a),codeTextData:P,data:P,codeFlowValue:P,definition:i(fe),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(xe),hardBreakEscape:i(Oe),hardBreakTrailing:i(Oe),htmlFlow:i(Re,a),htmlFlowData:P,htmlText:i(Re,a),htmlTextData:P,image:i(Je),label:a,link:i(ft),listItem:i(mt),listItemValue:g,listOrdered:i(He,h),listUnordered:i(He),paragraph:i(De),reference:D,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Ae),strong:i(et),thematicBreak:i(ur)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:ae,autolinkProtocol:K,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:q,characterReference:U,codeFenced:c(E),codeFencedFence:x,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:O,codeIndented:c(S),codeText:c(X),codeTextData:O,data:O,definition:c(),definitionDestinationString:N,definitionLabelString:k,definitionTitleString:T,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(G),htmlFlowData:O,htmlText:c(W),htmlTextData:O,image:c(Y),label:te,labelText:V,lineEnding:L,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Z,resourceDestinationString:I,resourceTitleString:re,resource:ue,setextHeading:c(M),setextHeadingLineSequence:R,setextHeadingText:A,strong:c(),thematicBreak:c()}};t7(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(_e){let Ce={type:"root",children:[]};const st={stack:[Ce],tokenStack:[],config:e,enter:l,exit:d,buffer:a,resume:p,data:n},Ge=[];let At=-1;for(;++At<_e.length;)if(_e[At][1].type==="listOrdered"||_e[At][1].type==="listUnordered")if(_e[At][0]==="enter")Ge.push(At);else{const er=Ge.pop();At=s(_e,er,At)}for(At=-1;++At<_e.length;){const er=e[_e[At][0]];e7.call(er,_e[At][1].type)&&er[_e[At][1].type].call(Object.assign({sliceSerialize:_e[At][2].sliceSerialize},st),_e[At][1])}if(st.tokenStack.length>0){const er=st.tokenStack[st.tokenStack.length-1];(er[1]||O4).call(st,void 0,er[0])}for(Ce.position={start:Al(_e.length>0?_e[0][1].start:{line:1,column:1,offset:0}),end:Al(_e.length>0?_e[_e.length-2][1].end:{line:1,column:1,offset:0})},At=-1;++At<e.transforms.length;)Ce=e.transforms[At](Ce)||Ce;return Ce}function s(_e,Ce,st){let Ge=Ce-1,At=-1,er=!1,tr,Ie,xt,Xt;for(;++Ge<=st;){const yt=_e[Ge];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?At++:At--,Xt=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&(tr&&!Xt&&!At&&!xt&&(xt=Ge),Xt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xt=void 0}if(!At&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||At===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if(tr){let Qt=Ge;for(Ie=void 0;Qt--;){const dr=_e[Qt];if(dr[1].type==="lineEnding"||dr[1].type==="lineEndingBlank"){if(dr[0]==="exit")continue;Ie&&(_e[Ie][1].type="lineEndingBlank",er=!0),dr[1].type="lineEnding",Ie=Qt}else if(!(dr[1].type==="linePrefix"||dr[1].type==="blockQuotePrefix"||dr[1].type==="blockQuotePrefixWhitespace"||dr[1].type==="blockQuoteMarker"||dr[1].type==="listItemIndent"))break}xt&&(!Ie||xt<Ie)&&(tr._spread=!0),tr.end=Object.assign({},Ie?_e[Ie][1].start:yt[1].end),_e.splice(Ie||Ge,0,["exit",tr,yt[2]]),Ge++,st++}if(yt[1].type==="listItemPrefix"){const Qt={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};tr=Qt,_e.splice(Ge,0,["enter",Qt,yt[2]]),Ge++,st++,xt=void 0,Xt=!0}}}return _e[Ce][1]._spread=er,st}function i(_e,Ce){return st;function st(Ge){l.call(this,_e(Ge),Ge),Ce&&Ce.call(this,Ge)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(_e,Ce,st){this.stack[this.stack.length-1].children.push(_e),this.stack.push(_e),this.tokenStack.push([Ce,st||void 0]),_e.position={start:Al(Ce.start),end:void 0}}function c(_e){return Ce;function Ce(st){_e&&_e.call(this,st),d.call(this,st)}}function d(_e,Ce){const st=this.stack.pop(),Ge=this.tokenStack.pop();if(Ge)Ge[0].type!==_e.type&&(Ce?Ce.call(this,_e,Ge[0]):(Ge[1]||O4).call(this,_e,Ge[0]));else throw new Error("Cannot close `"+_e.type+"` ("+xm({start:_e.start,end:_e.end})+"): it’s not open");st.position.end=Al(_e.end)}function p(){return hj(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(_e){if(this.data.expectingFirstListItemValue){const Ce=this.stack[this.stack.length-2];Ce.start=Number.parseInt(this.sliceSerialize(_e),10),this.data.expectingFirstListItemValue=void 0}}function v(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.lang=_e}function b(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.meta=_e}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e.replace(/(\r?\n|\r)$/g,"")}function k(_e){const Ce=this.resume(),st=this.stack[this.stack.length-1];st.label=Ce,st.identifier=la(this.sliceSerialize(_e)).toLowerCase()}function T(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=_e}function N(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=_e}function j(_e){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const st=this.sliceSerialize(_e).length;Ce.depth=st}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function R(_e){const Ce=this.stack[this.stack.length-1];Ce.depth=this.sliceSerialize(_e).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function P(_e){const st=this.stack[this.stack.length-1].children;let Ge=st[st.length-1];(!Ge||Ge.type!=="text")&&(Ge=ot(),Ge.position={start:Al(_e.start),end:void 0},st.push(Ge)),this.stack.push(Ge)}function O(_e){const Ce=this.stack.pop();Ce.value+=this.sliceSerialize(_e),Ce.position.end=Al(_e.end)}function L(_e){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const st=Ce.children[Ce.children.length-1];st.position.end=Al(_e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Ce.type)&&(P.call(this,_e),O.call(this,_e))}function z(){this.data.atHardBreak=!0}function G(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e}function W(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e}function X(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.value=_e}function F(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=Ce,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function Y(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=Ce,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function V(_e){const Ce=this.sliceSerialize(_e),st=this.stack[this.stack.length-2];st.label=Z_e(Ce),st.identifier=la(Ce).toLowerCase()}function te(){const _e=this.stack[this.stack.length-1],Ce=this.resume(),st=this.stack[this.stack.length-1];if(this.data.inReference=!0,st.type==="link"){const Ge=_e.children;st.children=Ge}else st.alt=Ce}function I(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.url=_e}function re(){const _e=this.resume(),Ce=this.stack[this.stack.length-1];Ce.title=_e}function ue(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function Z(_e){const Ce=this.resume(),st=this.stack[this.stack.length-1];st.label=Ce,st.identifier=la(this.sliceSerialize(_e)).toLowerCase(),this.data.referenceType="full"}function he(_e){this.data.characterReferenceType=_e.type}function q(_e){const Ce=this.sliceSerialize(_e),st=this.data.characterReferenceType;let Ge;st?(Ge=q8(Ce,st==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ge=pj(Ce);const At=this.stack[this.stack.length-1];At.value+=Ge}function U(_e){const Ce=this.stack.pop();Ce.position.end=Al(_e.end)}function K(_e){O.call(this,_e);const Ce=this.stack[this.stack.length-1];Ce.url=this.sliceSerialize(_e)}function ae(_e){O.call(this,_e);const Ce=this.stack[this.stack.length-1];Ce.url="mailto:"+this.sliceSerialize(_e)}function B(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function oe(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function Ae(){return{type:"heading",depth:0,children:[]}}function Oe(){return{type:"break"}}function Re(){return{type:"html",value:""}}function Je(){return{type:"image",title:null,url:"",alt:null}}function ft(){return{type:"link",title:null,url:"",children:[]}}function He(_e){return{type:"list",ordered:_e.type==="listOrdered",start:null,spread:_e._spread,children:[]}}function mt(_e){return{type:"listItem",spread:_e._spread,checked:null,children:[]}}function De(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function ot(){return{type:"text",value:""}}function ur(){return{type:"thematicBreak"}}}function Al(t){return{line:t.line,column:t.column,offset:t.offset}}function t7(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?t7(t,r):rwe(t,r)}}function rwe(t,e){let n;for(n in e)if(e7.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function O4(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+xm({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+xm({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+xm({start:e.start,end:e.end})+") is still open")}function swe(t){const e=this;e.parser=n;function n(r){return twe(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function iwe(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function awe(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
1793
1793
|
`}]}function owe(t,e){const n=e.value?e.value+`
|
|
1794
1794
|
`:"",r={};e.lang&&(r.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function lwe(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function cwe(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function uwe(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=vh(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let a,l=t.footnoteCounts.get(r);l===void 0?(l=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=i+1,l+=1,t.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,d),t.applyData(e,d)}function dwe(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function fwe(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function n7(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function hwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return n7(t,e);const s={src:vh(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function pwe(t,e){const n={src:vh(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function mwe(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function gwe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return n7(t,e);const s={href:vh(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function vwe(t,e){const n={href:vh(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ywe(t,e,n){const r=t.all(e),s=n?bwe(n):r7(e),i={},a=[];if(typeof e.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
1795
1795
|
`}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
1796
|
-
`});const d={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,d),t.applyData(e,d)}function bwe(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=r7(n[r])}return e}function r7(t){const e=t.spread;return e??t.children.length>1}function xwe(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function _we(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function wwe(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Swe(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Ewe(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=cj(e.children[1]),c=D8(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function kwe(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c<l;){const h=e.children[c],g={},v=a?a[c]:void 0;v&&(g.align=v);let b={type:"element",tagName:i,properties:g,children:[]};h&&(b.children=t.all(h),t.patch(h,b),b=t.applyData(h,b)),d.push(b)}const p={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,p),t.applyData(e,p)}function Twe(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const
|
|
1796
|
+
`});const d={type:"element",tagName:"li",properties:i,children:a};return t.patch(e,d),t.applyData(e,d)}function bwe(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=r7(n[r])}return e}function r7(t){const e=t.spread;return e??t.children.length>1}function xwe(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function _we(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function wwe(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Swe(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Ewe(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),s.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=cj(e.children[1]),c=D8(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function kwe(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c<l;){const h=e.children[c],g={},v=a?a[c]:void 0;v&&(g.align=v);let b={type:"element",tagName:i,properties:g,children:[]};h&&(b.children=t.all(h),t.patch(h,b),b=t.applyData(h,b)),d.push(b)}const p={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,p),t.applyData(e,p)}function Twe(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const I4=9,P4=32;function Cwe(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),s=0;const i=[];for(;r;)i.push(D4(e.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(D4(e.slice(s),s>0,!1)),i.join("")}function D4(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===I4||i===P4;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===I4||i===P4;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function Awe(t,e){const n={type:"text",value:Cwe(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Rwe(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Nwe={blockquote:iwe,break:awe,code:owe,delete:lwe,emphasis:cwe,footnoteReference:uwe,heading:dwe,html:fwe,imageReference:hwe,image:pwe,inlineCode:mwe,linkReference:gwe,link:vwe,listItem:ywe,list:xwe,paragraph:_we,root:wwe,strong:Swe,table:Ewe,tableCell:Twe,tableRow:kwe,text:Awe,thematicBreak:Rwe,toml:Cy,yaml:Cy,definition:Cy,footnoteDefinition:Cy};function Cy(){}const s7=-1,r_=0,wm=1,Ax=2,gj=3,vj=4,yj=5,bj=6,i7=7,a7=8,L4=typeof self=="object"?self:globalThis,jwe=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case r_:case s7:return n(a,s);case wm:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Ax:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case gj:return n(new Date(a),s);case vj:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case yj:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case bj:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case i7:{const{name:l,message:c}=a;return n(new L4[l](c),s)}case a7:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new L4[i](a),s)};return r},$4=t=>jwe(new Map,t)(0),Pd="",{toString:Mwe}={},{keys:Owe}=Object,Op=t=>{const e=typeof t;if(e!=="object"||!t)return[r_,e];const n=Mwe.call(t).slice(8,-1);switch(n){case"Array":return[wm,Pd];case"Object":return[Ax,Pd];case"Date":return[gj,Pd];case"RegExp":return[vj,Pd];case"Map":return[yj,Pd];case"Set":return[bj,Pd];case"DataView":return[wm,n]}return n.includes("Array")?[wm,n]:n.includes("Error")?[i7,n]:[Ax,n]},Ay=([t,e])=>t===r_&&(e==="function"||e==="symbol"),Iwe=(t,e,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=Op(a);switch(l){case r_:{let p=a;switch(c){case"bigint":l=a7,p=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return s([s7],a)}return s([l,p],a)}case wm:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const p=[],h=s([l,p],a);for(const g of a)p.push(i(g));return h}case Ax:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const p=[],h=s([l,p],a);for(const g of Owe(a))(t||!Ay(Op(a[g])))&&p.push([i(g),i(a[g])]);return h}case gj:return s([l,a.toISOString()],a);case vj:{const{source:p,flags:h}=a;return s([l,{source:p,flags:h}],a)}case yj:{const p=[],h=s([l,p],a);for(const[g,v]of a)(t||!(Ay(Op(g))||Ay(Op(v))))&&p.push([i(g),i(v)]);return h}case bj:{const p=[],h=s([l,p],a);for(const g of a)(t||!Ay(Op(g)))&&p.push(i(g));return h}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},z4=(t,{json:e,lossy:n}={})=>{const r=[];return Iwe(!(e||n),!!e,new Map,r)(t),r},Rx=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?$4(z4(t,e)):structuredClone(t):(t,e)=>$4(z4(t,e));function Pwe(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Dwe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Lwe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Pwe,r=t.options.footnoteBackLabel||Dwe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[c]);if(!d)continue;const p=t.all(d),h=String(d.identifier).toUpperCase(),g=vh(h.toLowerCase());let v=0;const b=[],x=t.footnoteCounts.get(h);for(;x!==void 0&&++v<=x;){b.length>0&&b.push({type:"text",value:" "});let k=typeof n=="string"?n:n(c,v);typeof k=="string"&&(k={type:"text",value:k}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,v),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const E=p[p.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const k=E.children[E.children.length-1];k&&k.type==="text"?k.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...b)}else p.push(...b);const S={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(p,!0)};t.patch(d,S),l.push(S)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Rx(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
1797
1797
|
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
|
|
1798
|
-
`}]}}const s_=function(t){if(t==null)return Uwe;if(typeof t=="function")return i_(t);if(typeof t=="object")return Array.isArray(t)?$we(t):zwe(t);if(typeof t=="string")return Fwe(t);throw new Error("Expected function, string, or object as test")};function $we(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=s_(t[n]);return i_(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function zwe(t){const e=t;return i_(n);function n(r){const s=r;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function Fwe(t){return i_(e);function e(n){return n&&n.type===t}}function i_(t){return e;function e(n,r,s){return!!(Bwe(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function Uwe(){return!0}function Bwe(t){return t!==null&&typeof t=="object"&&"type"in t}const o7=[],Hwe=!0,DC=!1,qwe="skip";function l7(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const i=s_(s),a=r?-1:1;l(t,void 0,[])();function l(c,d,p){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const v=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(c.type+(v?"<"+v+">":""))+")"})}return g;function g(){let v=o7,b,x,E;if((!e||i(c,d,p[p.length-1]||void 0))&&(v=Vwe(n(c,p)),v[0]===DC))return v;if("children"in c&&c.children){const S=c;if(S.children&&v[0]!==qwe)for(x=(r?S.children.length:-1)+a,E=p.concat(S);x>-1&&x<S.children.length;){const k=S.children[x];if(b=l(k,x,E)(),b[0]===DC)return b;x=typeof b[1]=="number"?b[1]:x+a}}return v}}}function Vwe(t){return Array.isArray(t)?t:typeof t=="number"?[Hwe,t]:t==null?o7:[t]}function xj(t,e,n,r){let s,i,a;typeof e=="function"&&typeof n!="function"?(i=void 0,a=e,s=n):(i=e,a=n,s=r),l7(t,i,l,s);function l(c,d){const p=d[d.length-1],h=p?p.children.indexOf(c):void 0;return a(c,h,p)}}const LC={}.hasOwnProperty,Gwe={};function Wwe(t,e){const n=e||Gwe,r=new Map,s=new Map,i=new Map,a={...Nwe,...n.handlers},l={all:d,applyData:Kwe,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:Ywe,wrap:Qwe};return xj(t,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:s,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),l;function c(p,h){const g=p.type,v=l.handlers[g];if(LC.call(l.handlers,g)&&v)return v(l,p,h);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in p){const{children:x,...E}=p,S=Rx(E);return S.children=l.all(p),S}return Rx(p)}return(l.options.unknownHandler||Xwe)(l,p,h)}function d(p){const h=[];if("children"in p){const g=p.children;let v=-1;for(;++v<g.length;){const b=l.one(g[v],p);if(b){if(v&&g[v-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=
|
|
1798
|
+
`}]}}const s_=function(t){if(t==null)return Uwe;if(typeof t=="function")return i_(t);if(typeof t=="object")return Array.isArray(t)?$we(t):zwe(t);if(typeof t=="string")return Fwe(t);throw new Error("Expected function, string, or object as test")};function $we(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=s_(t[n]);return i_(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function zwe(t){const e=t;return i_(n);function n(r){const s=r;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function Fwe(t){return i_(e);function e(n){return n&&n.type===t}}function i_(t){return e;function e(n,r,s){return!!(Bwe(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function Uwe(){return!0}function Bwe(t){return t!==null&&typeof t=="object"&&"type"in t}const o7=[],Hwe=!0,DC=!1,qwe="skip";function l7(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const i=s_(s),a=r?-1:1;l(t,void 0,[])();function l(c,d,p){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const v=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(c.type+(v?"<"+v+">":""))+")"})}return g;function g(){let v=o7,b,x,E;if((!e||i(c,d,p[p.length-1]||void 0))&&(v=Vwe(n(c,p)),v[0]===DC))return v;if("children"in c&&c.children){const S=c;if(S.children&&v[0]!==qwe)for(x=(r?S.children.length:-1)+a,E=p.concat(S);x>-1&&x<S.children.length;){const k=S.children[x];if(b=l(k,x,E)(),b[0]===DC)return b;x=typeof b[1]=="number"?b[1]:x+a}}return v}}}function Vwe(t){return Array.isArray(t)?t:typeof t=="number"?[Hwe,t]:t==null?o7:[t]}function xj(t,e,n,r){let s,i,a;typeof e=="function"&&typeof n!="function"?(i=void 0,a=e,s=n):(i=e,a=n,s=r),l7(t,i,l,s);function l(c,d){const p=d[d.length-1],h=p?p.children.indexOf(c):void 0;return a(c,h,p)}}const LC={}.hasOwnProperty,Gwe={};function Wwe(t,e){const n=e||Gwe,r=new Map,s=new Map,i=new Map,a={...Nwe,...n.handlers},l={all:d,applyData:Kwe,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:Ywe,wrap:Qwe};return xj(t,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:s,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),l;function c(p,h){const g=p.type,v=l.handlers[g];if(LC.call(l.handlers,g)&&v)return v(l,p,h);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in p){const{children:x,...E}=p,S=Rx(E);return S.children=l.all(p),S}return Rx(p)}return(l.options.unknownHandler||Xwe)(l,p,h)}function d(p){const h=[];if("children"in p){const g=p.children;let v=-1;for(;++v<g.length;){const b=l.one(g[v],p);if(b){if(v&&g[v-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=F4(b.value)),!Array.isArray(b)&&b.type==="element")){const x=b.children[0];x&&x.type==="text"&&(x.value=F4(x.value))}Array.isArray(b)?h.push(...b):h.push(b)}}}return h}}function Ywe(t,e){t.position&&(e.position=Dxe(t))}function Kwe(t,e){let n=e;if(t&&t.data){const r=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,Rx(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Xwe(t,e){const n=e.data||{},r="value"in e&&!(LC.call(n,"hProperties")||LC.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Qwe(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
1799
1799
|
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
1800
1800
|
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
1801
|
-
`}),n}function
|
|
1802
|
-
`},s),i}function Jwe(t,e){return t&&"run"in t?async function(n,r){const s=U5(n,{file:r,...e});await t.run(s,r)}:function(n,r){return U5(n,{file:r,...t||e})}}function B5(t){if(t)throw t}var j1,H5;function Zwe(){if(H5)return j1;H5=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},i=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var p=t.call(d,"constructor"),h=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!h)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},a=function(d,p){n&&p.name==="__proto__"?n(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},l=function(d,p){if(p==="__proto__")if(t.call(d,p)){if(r)return r(d,p).value}else return;return d[p]};return j1=function c(){var d,p,h,g,v,b,x=arguments[0],E=1,S=arguments.length,k=!1;for(typeof x=="boolean"&&(k=x,x=arguments[1]||{},E=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});E<S;++E)if(d=arguments[E],d!=null)for(p in d)h=l(x,p),g=l(d,p),x!==g&&(k&&g&&(i(g)||(v=s(g)))?(v?(v=!1,b=h&&s(h)?h:[]):b=h&&i(h)?h:{},a(x,{name:p,newValue:c(k,b,g)})):typeof g<"u"&&a(x,{name:p,newValue:g}));return x},j1}var eSe=Zwe();const M1=nh(eSe);function $C(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function tSe(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const p=t[++i];let h=-1;if(c){a(c);return}for(;++h<s.length;)(d[h]===null||d[h]===void 0)&&(d[h]=s[h]);s=d,p?nSe(p,l)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function nSe(t,e){let n;return r;function r(...a){const l=t.length>a.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(d){const p=d;if(l&&n)throw p;return s(p)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const Ra={basename:rSe,dirname:sSe,extname:iSe,join:aSe,sep:"/"};function rSe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Dg(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function sSe(t){if(Dg(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function iSe(t){Dg(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function aSe(...t){let e=-1,n;for(;++e<t.length;)Dg(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":oSe(n)}function oSe(t){Dg(t);const e=t.codePointAt(0)===47;let n=lSe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function lSe(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a<t.length)l=t.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function Dg(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const cSe={cwd:uSe};function uSe(){return"/"}function zC(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function dSe(t){if(typeof t=="string")t=new URL(t);else if(!zC(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return fSe(t)}function fSe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const O1=["history","path","basename","stem","extname","dirname"];class c7{constructor(e){let n;e?zC(e)?n={path:e}:typeof e=="string"||hSe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":cSe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<O1.length;){const i=O1[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)O1.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ra.basename(this.path):void 0}set basename(e){P1(e,"basename"),I1(e,"basename"),this.path=Ra.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ra.dirname(this.path):void 0}set dirname(e){q5(this.basename,"dirname"),this.path=Ra.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ra.extname(this.path):void 0}set extname(e){if(I1(e,"extname"),q5(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ra.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){zC(e)&&(e=dSe(e)),P1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ra.basename(this.path,this.extname):void 0}set stem(e){P1(e,"stem"),I1(e,"stem"),this.path=Ra.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new cs(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function I1(t,e){if(t&&t.includes(Ra.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ra.sep+"`")}function P1(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function q5(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function hSe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const pSe=function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},mSe={}.hasOwnProperty;class _j extends pSe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=tSe()}copy(){const e=new _j;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(M1(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?($1("data",this.frozen),this.namespace[e]=n,this):mSe.call(this.namespace,e)&&this.namespace[e]||void 0:e?($1("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Ry(e),r=this.parser||this.Parser;return D1("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),D1("process",this.parser||this.Parser),L1("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Ry(e),c=r.parse(l);r.run(c,l,function(p,h,g){if(p||!h||!g)return d(p);const v=h,b=r.stringify(v,g);ySe(b)?g.value=b:g.result=b,d(p,g)});function d(p,h){p||!h?a(p):i?i(h):n(void 0,h)}}}processSync(e){let n=!1,r;return this.freeze(),D1("processSync",this.parser||this.Parser),L1("processSync",this.compiler||this.Compiler),this.process(e,s),G5("processSync","process",n),r;function s(i,a){n=!0,B5(i),r=a}}run(e,n,r){V5(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=Ry(n);s.run(e,c,d);function d(p,h,g){const v=h||e;p?l(p):a?a(v):r(void 0,v,g)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),G5("runSync","run",r),s;function i(a,l){B5(a),s=l,r=!0}}stringify(e,n){this.freeze();const r=Ry(n),s=this.compiler||this.Compiler;return L1("stringify",s),V5(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if($1("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...h]=d;c(p,h)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=M1(!0,s.settings,d.settings))}function l(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const h=d[p];i(h)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,p){let h=-1,g=-1;for(;++h<r.length;)if(r[h][0]===d){g=h;break}if(g===-1)r.push([d,...p]);else if(p.length>0){let[v,...b]=p;const x=r[g][1];$C(x)&&$C(v)&&(v=M1(!0,x,v)),r[g]=[d,v,...b]}}}}const gSe=new _j().freeze();function D1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function L1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function $1(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function V5(t){if(!$C(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function G5(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ry(t){return vSe(t)?t:new c7(t)}function vSe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ySe(t){return typeof t=="string"||bSe(t)}function bSe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const xSe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",W5=[],Y5={allowDangerousHtml:!0},_Se=/^(https?|ircs?|mailto|xmpp)$/i,wSe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function SSe(t){const e=ESe(t),n=kSe(t);return TSe(e.runSync(e.parse(n),n),t)}function ESe(t){const e=t.rehypePlugins||W5,n=t.remarkPlugins||W5,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Y5}:Y5;return gSe().use(swe).use(n).use(Jwe,r).use(e)}function kSe(t){const e=t.children||"",n=new c7;return typeof e=="string"&&(n.value=e),n}function TSe(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||CSe;for(const p of wSe)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+xSe+p.id,void 0);return xj(t,d),Uxe(t,{Fragment:f.Fragment,components:s,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function d(p,h,g){if(p.type==="raw"&&g&&typeof h=="number")return a?g.children.splice(h,1):g.children[h]={type:"text",value:p.value},h;if(p.type==="element"){let v;for(v in A1)if(Object.hasOwn(A1,v)&&Object.hasOwn(p.properties,v)){const b=p.properties[v],x=A1[v];(x===null||x.includes(p.tagName))&&(p.properties[v]=c(String(b||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!v&&r&&typeof h=="number"&&(v=!r(p,h,g)),v&&g&&typeof h=="number")return l&&p.children?g.children.splice(h,1,...p.children):g.children.splice(h,1),h}}}function CSe(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||_Se.test(t.slice(0,e))?t:""}function K5(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function ASe(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RSe(t,e,n){const s=s_((n||{}).ignore||[]),i=NSe(e);let a=-1;for(;++a<i.length;)l7(t,"text",l);function l(d,p){let h=-1,g;for(;++h<p.length;){const v=p[h],b=g?g.children:void 0;if(s(v,b?b.indexOf(v):void 0,g))return;g=v}if(g)return c(d,p)}function c(d,p){const h=p[p.length-1],g=i[a][0],v=i[a][1];let b=0;const E=h.children.indexOf(d);let S=!1,k=[];g.lastIndex=0;let T=g.exec(d.value);for(;T;){const N=T.index,j={index:T.index,input:T.input,stack:[...p,d]};let A=v(...T,j);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?g.lastIndex=N+1:(b!==N&&k.push({type:"text",value:d.value.slice(b,N)}),Array.isArray(A)?k.push(...A):A&&k.push(A),b=N+T[0].length,S=!0),!g.global)break;T=g.exec(d.value)}return S?(b<d.value.length&&k.push({type:"text",value:d.value.slice(b)}),h.children.splice(E,1,...k)):k=[d],E+k.length}}function NSe(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([jSe(s[0]),MSe(s[1])])}return e}function jSe(t){return typeof t=="string"?new RegExp(ASe(t),"g"):t}function MSe(t){return typeof t=="function"?t:function(){return t}}const z1="phrasing",F1=["autolink","link","image","label"];function OSe(){return{transforms:[FSe],enter:{literalAutolink:PSe,literalAutolinkEmail:U1,literalAutolinkHttp:U1,literalAutolinkWww:U1},exit:{literalAutolink:zSe,literalAutolinkEmail:$Se,literalAutolinkHttp:DSe,literalAutolinkWww:LSe}}}function ISe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:z1,notInConstruct:F1},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:z1,notInConstruct:F1},{character:":",before:"[ps]",after:"\\/",inConstruct:z1,notInConstruct:F1}]}}function PSe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function U1(t){this.config.enter.autolinkProtocol.call(this,t)}function DSe(t){this.config.exit.autolinkProtocol.call(this,t)}function LSe(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function $Se(t){this.config.exit.autolinkEmail.call(this,t)}function zSe(t){this.exit(t)}function FSe(t){RSe(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,USe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),BSe]],{ignore:["link","linkReference"]})}function USe(t,e,n,r,s){let i="";if(!u7(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!HSe(n)))return!1;const a=qSe(n+r);if(!a[0])return!1;const l={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function BSe(t,e,n,r){return!u7(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function HSe(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function qSe(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=K5(t,"(");let i=K5(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function u7(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Mu(n)||t_(n))&&(!e||n!==47)}d7.peek=ZSe;function VSe(){this.buffer()}function GSe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function WSe(){this.buffer()}function YSe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function KSe(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=la(this.sliceSerialize(t)).toLowerCase(),n.label=e}function XSe(t){this.exit(t)}function QSe(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=la(this.sliceSerialize(t)).toLowerCase(),n.label=e}function JSe(t){this.exit(t)}function ZSe(){return"["}function d7(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function eEe(){return{enter:{gfmFootnoteCallString:VSe,gfmFootnoteCall:GSe,gfmFootnoteDefinitionLabelString:WSe,gfmFootnoteDefinition:YSe},exit:{gfmFootnoteCallString:KSe,gfmFootnoteCall:XSe,gfmFootnoteDefinitionLabelString:QSe,gfmFootnoteDefinition:JSe}}}function tEe(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:d7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const d=i.enter("footnoteDefinition"),p=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),p(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?`
|
|
1803
|
-
`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?f7:nEe))),d(),c}}function nEe(t,e,n){return e===0?t:f7(t,e,n)}function f7(t,e,n){return(n?"":" ")+t}const rEe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];h7.peek=lEe;function sEe(){return{canContainEols:["delete"],enter:{strikethrough:aEe},exit:{strikethrough:oEe}}}function iEe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rEe}],handlers:{delete:h7}}}function aEe(t){this.enter({type:"delete",children:[]},t)}function oEe(t){this.exit(t)}function h7(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function lEe(){return"~"}function cEe(t){return t.length}function uEe(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||cEe,i=[],a=[],l=[],c=[];let d=0,p=-1;for(;++p<t.length;){const x=[],E=[];let S=-1;for(t[p].length>d&&(d=t[p].length);++S<t[p].length;){const k=dEe(t[p][S]);if(n.alignDelimiters!==!1){const T=s(k);E[S]=T,(c[S]===void 0||T>c[S])&&(c[S]=T)}x.push(k)}a[p]=x,l[p]=E}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<d;)i[h]=
|
|
1804
|
-
`)}function dEe(t){return t==null?"":String(t)}function
|
|
1801
|
+
`}),n}function F4(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function U4(t,e){const n=Wwe(t,e),r=n.one(t,void 0),s=Lwe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
1802
|
+
`},s),i}function Jwe(t,e){return t&&"run"in t?async function(n,r){const s=U4(n,{file:r,...e});await t.run(s,r)}:function(n,r){return U4(n,{file:r,...t||e})}}function B4(t){if(t)throw t}var j1,H4;function Zwe(){if(H4)return j1;H4=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},i=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var p=t.call(d,"constructor"),h=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!h)return!1;var g;for(g in d);return typeof g>"u"||t.call(d,g)},a=function(d,p){n&&p.name==="__proto__"?n(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},l=function(d,p){if(p==="__proto__")if(t.call(d,p)){if(r)return r(d,p).value}else return;return d[p]};return j1=function c(){var d,p,h,g,v,b,x=arguments[0],E=1,S=arguments.length,k=!1;for(typeof x=="boolean"&&(k=x,x=arguments[1]||{},E=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});E<S;++E)if(d=arguments[E],d!=null)for(p in d)h=l(x,p),g=l(d,p),x!==g&&(k&&g&&(i(g)||(v=s(g)))?(v?(v=!1,b=h&&s(h)?h:[]):b=h&&i(h)?h:{},a(x,{name:p,newValue:c(k,b,g)})):typeof g<"u"&&a(x,{name:p,newValue:g}));return x},j1}var eSe=Zwe();const M1=nh(eSe);function $C(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function tSe(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const p=t[++i];let h=-1;if(c){a(c);return}for(;++h<s.length;)(d[h]===null||d[h]===void 0)&&(d[h]=s[h]);s=d,p?nSe(p,l)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function nSe(t,e){let n;return r;function r(...a){const l=t.length>a.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(d){const p=d;if(l&&n)throw p;return s(p)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const Ra={basename:rSe,dirname:sSe,extname:iSe,join:aSe,sep:"/"};function rSe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Dg(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function sSe(t){if(Dg(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function iSe(t){Dg(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function aSe(...t){let e=-1,n;for(;++e<t.length;)Dg(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":oSe(n)}function oSe(t){Dg(t);const e=t.codePointAt(0)===47;let n=lSe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function lSe(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a<t.length)l=t.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function Dg(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const cSe={cwd:uSe};function uSe(){return"/"}function zC(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function dSe(t){if(typeof t=="string")t=new URL(t);else if(!zC(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return fSe(t)}function fSe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const O1=["history","path","basename","stem","extname","dirname"];class c7{constructor(e){let n;e?zC(e)?n={path:e}:typeof e=="string"||hSe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":cSe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<O1.length;){const i=O1[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)O1.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ra.basename(this.path):void 0}set basename(e){P1(e,"basename"),I1(e,"basename"),this.path=Ra.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ra.dirname(this.path):void 0}set dirname(e){q4(this.basename,"dirname"),this.path=Ra.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ra.extname(this.path):void 0}set extname(e){if(I1(e,"extname"),q4(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ra.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){zC(e)&&(e=dSe(e)),P1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ra.basename(this.path,this.extname):void 0}set stem(e){P1(e,"stem"),I1(e,"stem"),this.path=Ra.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new cs(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function I1(t,e){if(t&&t.includes(Ra.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ra.sep+"`")}function P1(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function q4(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function hSe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const pSe=function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},mSe={}.hasOwnProperty;class _j extends pSe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=tSe()}copy(){const e=new _j;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(M1(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?($1("data",this.frozen),this.namespace[e]=n,this):mSe.call(this.namespace,e)&&this.namespace[e]||void 0:e?($1("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Ry(e),r=this.parser||this.Parser;return D1("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),D1("process",this.parser||this.Parser),L1("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=Ry(e),c=r.parse(l);r.run(c,l,function(p,h,g){if(p||!h||!g)return d(p);const v=h,b=r.stringify(v,g);ySe(b)?g.value=b:g.result=b,d(p,g)});function d(p,h){p||!h?a(p):i?i(h):n(void 0,h)}}}processSync(e){let n=!1,r;return this.freeze(),D1("processSync",this.parser||this.Parser),L1("processSync",this.compiler||this.Compiler),this.process(e,s),G4("processSync","process",n),r;function s(i,a){n=!0,B4(i),r=a}}run(e,n,r){V4(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=Ry(n);s.run(e,c,d);function d(p,h,g){const v=h||e;p?l(p):a?a(v):r(void 0,v,g)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),G4("runSync","run",r),s;function i(a,l){B4(a),s=l,r=!0}}stringify(e,n){this.freeze();const r=Ry(n),s=this.compiler||this.Compiler;return L1("stringify",s),V4(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if($1("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...h]=d;c(p,h)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=M1(!0,s.settings,d.settings))}function l(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const h=d[p];i(h)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,p){let h=-1,g=-1;for(;++h<r.length;)if(r[h][0]===d){g=h;break}if(g===-1)r.push([d,...p]);else if(p.length>0){let[v,...b]=p;const x=r[g][1];$C(x)&&$C(v)&&(v=M1(!0,x,v)),r[g]=[d,v,...b]}}}}const gSe=new _j().freeze();function D1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function L1(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function $1(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function V4(t){if(!$C(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function G4(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Ry(t){return vSe(t)?t:new c7(t)}function vSe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ySe(t){return typeof t=="string"||bSe(t)}function bSe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const xSe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",W4=[],Y4={allowDangerousHtml:!0},_Se=/^(https?|ircs?|mailto|xmpp)$/i,wSe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function SSe(t){const e=ESe(t),n=kSe(t);return TSe(e.runSync(e.parse(n),n),t)}function ESe(t){const e=t.rehypePlugins||W4,n=t.remarkPlugins||W4,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Y4}:Y4;return gSe().use(swe).use(n).use(Jwe,r).use(e)}function kSe(t){const e=t.children||"",n=new c7;return typeof e=="string"&&(n.value=e),n}function TSe(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||CSe;for(const p of wSe)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+xSe+p.id,void 0);return xj(t,d),Uxe(t,{Fragment:f.Fragment,components:s,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function d(p,h,g){if(p.type==="raw"&&g&&typeof h=="number")return a?g.children.splice(h,1):g.children[h]={type:"text",value:p.value},h;if(p.type==="element"){let v;for(v in A1)if(Object.hasOwn(A1,v)&&Object.hasOwn(p.properties,v)){const b=p.properties[v],x=A1[v];(x===null||x.includes(p.tagName))&&(p.properties[v]=c(String(b||""),v,p))}}if(p.type==="element"){let v=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!v&&r&&typeof h=="number"&&(v=!r(p,h,g)),v&&g&&typeof h=="number")return l&&p.children?g.children.splice(h,1,...p.children):g.children.splice(h,1),h}}}function CSe(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||_Se.test(t.slice(0,e))?t:""}function K4(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function ASe(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RSe(t,e,n){const s=s_((n||{}).ignore||[]),i=NSe(e);let a=-1;for(;++a<i.length;)l7(t,"text",l);function l(d,p){let h=-1,g;for(;++h<p.length;){const v=p[h],b=g?g.children:void 0;if(s(v,b?b.indexOf(v):void 0,g))return;g=v}if(g)return c(d,p)}function c(d,p){const h=p[p.length-1],g=i[a][0],v=i[a][1];let b=0;const E=h.children.indexOf(d);let S=!1,k=[];g.lastIndex=0;let T=g.exec(d.value);for(;T;){const N=T.index,j={index:T.index,input:T.input,stack:[...p,d]};let A=v(...T,j);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?g.lastIndex=N+1:(b!==N&&k.push({type:"text",value:d.value.slice(b,N)}),Array.isArray(A)?k.push(...A):A&&k.push(A),b=N+T[0].length,S=!0),!g.global)break;T=g.exec(d.value)}return S?(b<d.value.length&&k.push({type:"text",value:d.value.slice(b)}),h.children.splice(E,1,...k)):k=[d],E+k.length}}function NSe(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const s=n[r];e.push([jSe(s[0]),MSe(s[1])])}return e}function jSe(t){return typeof t=="string"?new RegExp(ASe(t),"g"):t}function MSe(t){return typeof t=="function"?t:function(){return t}}const z1="phrasing",F1=["autolink","link","image","label"];function OSe(){return{transforms:[FSe],enter:{literalAutolink:PSe,literalAutolinkEmail:U1,literalAutolinkHttp:U1,literalAutolinkWww:U1},exit:{literalAutolink:zSe,literalAutolinkEmail:$Se,literalAutolinkHttp:DSe,literalAutolinkWww:LSe}}}function ISe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:z1,notInConstruct:F1},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:z1,notInConstruct:F1},{character:":",before:"[ps]",after:"\\/",inConstruct:z1,notInConstruct:F1}]}}function PSe(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function U1(t){this.config.enter.autolinkProtocol.call(this,t)}function DSe(t){this.config.exit.autolinkProtocol.call(this,t)}function LSe(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function $Se(t){this.config.exit.autolinkEmail.call(this,t)}function zSe(t){this.exit(t)}function FSe(t){RSe(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,USe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),BSe]],{ignore:["link","linkReference"]})}function USe(t,e,n,r,s){let i="";if(!u7(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!HSe(n)))return!1;const a=qSe(n+r);if(!a[0])return!1;const l={type:"link",title:null,url:i+e+a[0],children:[{type:"text",value:e+a[0]}]};return a[1]?[l,{type:"text",value:a[1]}]:l}function BSe(t,e,n,r){return!u7(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function HSe(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function qSe(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=K4(t,"(");let i=K4(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function u7(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Mu(n)||t_(n))&&(!e||n!==47)}d7.peek=ZSe;function VSe(){this.buffer()}function GSe(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function WSe(){this.buffer()}function YSe(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function KSe(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=la(this.sliceSerialize(t)).toLowerCase(),n.label=e}function XSe(t){this.exit(t)}function QSe(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=la(this.sliceSerialize(t)).toLowerCase(),n.label=e}function JSe(t){this.exit(t)}function ZSe(){return"["}function d7(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function eEe(){return{enter:{gfmFootnoteCallString:VSe,gfmFootnoteCall:GSe,gfmFootnoteDefinitionLabelString:WSe,gfmFootnoteDefinition:YSe},exit:{gfmFootnoteCallString:KSe,gfmFootnoteCall:XSe,gfmFootnoteDefinitionLabelString:QSe,gfmFootnoteDefinition:JSe}}}function tEe(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:d7},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const d=i.enter("footnoteDefinition"),p=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),p(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?`
|
|
1803
|
+
`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?f7:nEe))),d(),c}}function nEe(t,e,n){return e===0?t:f7(t,e,n)}function f7(t,e,n){return(n?"":" ")+t}const rEe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];h7.peek=lEe;function sEe(){return{canContainEols:["delete"],enter:{strikethrough:aEe},exit:{strikethrough:oEe}}}function iEe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:rEe}],handlers:{delete:h7}}}function aEe(t){this.enter({type:"delete",children:[]},t)}function oEe(t){this.exit(t)}function h7(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function lEe(){return"~"}function cEe(t){return t.length}function uEe(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||cEe,i=[],a=[],l=[],c=[];let d=0,p=-1;for(;++p<t.length;){const x=[],E=[];let S=-1;for(t[p].length>d&&(d=t[p].length);++S<t[p].length;){const k=dEe(t[p][S]);if(n.alignDelimiters!==!1){const T=s(k);E[S]=T,(c[S]===void 0||T>c[S])&&(c[S]=T)}x.push(k)}a[p]=x,l[p]=E}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<d;)i[h]=X4(r[h]);else{const x=X4(r);for(;++h<d;)i[h]=x}h=-1;const g=[],v=[];for(;++h<d;){const x=i[h];let E="",S="";x===99?(E=":",S=":"):x===108?E=":":x===114&&(S=":");let k=n.alignDelimiters===!1?1:Math.max(1,c[h]-E.length-S.length);const T=E+"-".repeat(k)+S;n.alignDelimiters!==!1&&(k=E.length+k+S.length,k>c[h]&&(c[h]=k),v[h]=k),g[h]=T}a.splice(1,0,g),l.splice(1,0,v),p=-1;const b=[];for(;++p<a.length;){const x=a[p],E=l[p];h=-1;const S=[];for(;++h<d;){const k=x[h]||"";let T="",N="";if(n.alignDelimiters!==!1){const j=c[h]-(E[h]||0),A=i[h];A===114?T=" ".repeat(j):A===99?j%2?(T=" ".repeat(j/2+.5),N=" ".repeat(j/2-.5)):(T=" ".repeat(j/2),N=T):N=" ".repeat(j)}n.delimiterStart!==!1&&!h&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&k==="")&&(n.delimiterStart!==!1||h)&&S.push(" "),n.alignDelimiters!==!1&&S.push(T),S.push(k),n.alignDelimiters!==!1&&S.push(N),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||h!==d-1)&&S.push("|")}b.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return b.join(`
|
|
1804
|
+
`)}function dEe(t){return t==null?"":String(t)}function X4(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function fEe(t,e,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),hEe);return s(),a}function hEe(t,e,n){return">"+(n?"":" ")+t}function pEe(t,e){return Q4(t,e.inConstruct,!0)&&!Q4(t,e.notInConstruct,!1)}function Q4(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function J4(t,e,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
1805
1805
|
`&&pEe(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
1806
1806
|
`}function mEe(t,e){const n=String(t);let r=n.indexOf(e),s=r,i=0,a=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>a&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function gEe(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function vEe(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function yEe(t,e,n,r){const s=vEe(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(gEe(t,n)){const h=n.enter("codeIndented"),g=n.indentLines(i,bEe);return h(),g}const l=n.createTracker(r),c=s.repeat(Math.max(mEe(i,s)+1,3)),d=n.enter("codeFenced");let p=l.move(c);if(t.lang){const h=n.enter(`codeFencedLang${a}`);p+=l.move(n.safe(t.lang,{before:p,after:" ",encode:["`"],...l.current()})),h()}if(t.lang&&t.meta){const h=n.enter(`codeFencedMeta${a}`);p+=l.move(" "),p+=l.move(n.safe(t.meta,{before:p,after:`
|
|
1807
1807
|
`,encode:["`"],...l.current()})),h()}return p+=l.move(`
|
|
@@ -1812,7 +1812,7 @@ An authorization_code was supplied for a login which did not originate at the ap
|
|
|
1812
1812
|
`});return h(),p(),g+`
|
|
1813
1813
|
`+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
|
|
1814
1814
|
`))+1))}const a="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let d=n.containerPhrasing(t,{before:"# ",after:`
|
|
1815
|
-
`,...i.current()});return/^[\t ]/.test(d)&&(d=rg(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),l(),d}m7.peek=kEe;function m7(t){return t.value||""}function kEe(){return"<"}g7.peek=TEe;function g7(t,e,n,r){const s=wj(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(t.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),a(),d}function TEe(){return"!"}v7.peek=CEe;function v7(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const d=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=p,i(),s==="full"||!d||d!==h?c+=l.move(h+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function CEe(){return"!"}y7.peek=AEe;function y7(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return s+r+s}function AEe(){return"`"}function b7(t,e){const n=hj(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}x7.peek=REe;function x7(t,e,n,r){const s=wj(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(b7(t,n)){const p=n.stack;n.stack=[],l=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(t,{before:h,after:">",...a.current()})),h+=a.move(">"),l(),n.stack=p,h}l=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(t,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(t.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(t.url,{before:d,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),d+=a.move(" "+s),d+=a.move(n.safe(t.title,{before:d,after:s,...a.current()})),d+=a.move(s),c()),d+=a.move(")"),l(),d}function REe(t,e,n){return b7(t,n)?"<":"["}_7.peek=NEe;function _7(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const d=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=p,i(),s==="full"||!d||d!==h?c+=l.move(h+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function NEe(){return"["}function Sj(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function jEe(t){const e=Sj(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function MEe(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function w7(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function OEe(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?MEe(n):Sj(n);const l=t.ordered?a==="."?")":".":jEe(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const p=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),w7(n)===a&&p){let h=-1;for(;++h<t.children.length;){const g=t.children[h];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const d=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=i,s(),d}function IEe(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function PEe(t,e,n,r){const s=IEe(n);let i=n.bulletCurrent||Sj(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(t,l.current()),p);return c(),d;function p(h,g,v){return g?(v?"":" ".repeat(a))+h:(v?i:i+" ".repeat(a-i.length))+h}}function DEe(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const LEe=s_(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $Ee(t,e,n,r){return(t.children.some(function(a){return LEe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function zEe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}S7.peek=FEe;function S7(t,e,n,r){const s=zEe(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),p=Nx(r.before.charCodeAt(r.before.length-1),d,s);p.inside&&(c=rg(d)+c.slice(1));const h=c.charCodeAt(c.length-1),g=Nx(r.after.charCodeAt(0),h,s);g.inside&&(c=c.slice(0,-1)+rg(h));const v=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},l+c+v}function FEe(t,e,n){return n.options.strong||"*"}function UEe(t,e,n,r){return n.safe(t.value,r)}function BEe(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function HEe(t,e,n){const r=(w7(n)+(n.options.ruleSpaces?" ":"")).repeat(BEe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const E7={blockquote:fEe,break:
|
|
1815
|
+
`,...i.current()});return/^[\t ]/.test(d)&&(d=rg(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),l(),d}m7.peek=kEe;function m7(t){return t.value||""}function kEe(){return"<"}g7.peek=TEe;function g7(t,e,n,r){const s=wj(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(t.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(l=n.enter("destinationRaw"),d+=c.move(n.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),d+=c.move(" "+s),d+=c.move(n.safe(t.title,{before:d,after:s,...c.current()})),d+=c.move(s),l()),d+=c.move(")"),a(),d}function TEe(){return"!"}v7.peek=CEe;function v7(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const d=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=p,i(),s==="full"||!d||d!==h?c+=l.move(h+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function CEe(){return"!"}y7.peek=AEe;function y7(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],l=n.compilePattern(a);let c;if(a.atBreak)for(;c=l.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return s+r+s}function AEe(){return"`"}function b7(t,e){const n=hj(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}x7.peek=REe;function x7(t,e,n,r){const s=wj(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(b7(t,n)){const p=n.stack;n.stack=[],l=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(t,{before:h,after:">",...a.current()})),h+=a.move(">"),l(),n.stack=p,h}l=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(t,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(t.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(t.url,{before:d,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),d+=a.move(" "+s),d+=a.move(n.safe(t.title,{before:d,after:s,...a.current()})),d+=a.move(s),c()),d+=a.move(")"),l(),d}function REe(t,e,n){return b7(t,n)?"<":"["}_7.peek=NEe;function _7(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const d=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(d+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=p,i(),s==="full"||!d||d!==h?c+=l.move(h+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function NEe(){return"["}function Sj(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function jEe(t){const e=Sj(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function MEe(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function w7(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function OEe(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?MEe(n):Sj(n);const l=t.ordered?a==="."?")":".":jEe(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const p=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),w7(n)===a&&p){let h=-1;for(;++h<t.children.length;){const g=t.children[h];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=l),n.bulletCurrent=a;const d=n.containerFlow(t,r);return n.bulletLastUsed=a,n.bulletCurrent=i,s(),d}function IEe(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function PEe(t,e,n,r){const s=IEe(n);let i=n.bulletCurrent||Sj(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(t,l.current()),p);return c(),d;function p(h,g,v){return g?(v?"":" ".repeat(a))+h:(v?i:i+" ".repeat(a-i.length))+h}}function DEe(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const LEe=s_(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $Ee(t,e,n,r){return(t.children.some(function(a){return LEe(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function zEe(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}S7.peek=FEe;function S7(t,e,n,r){const s=zEe(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const d=c.charCodeAt(0),p=Nx(r.before.charCodeAt(r.before.length-1),d,s);p.inside&&(c=rg(d)+c.slice(1));const h=c.charCodeAt(c.length-1),g=Nx(r.after.charCodeAt(0),h,s);g.inside&&(c=c.slice(0,-1)+rg(h));const v=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},l+c+v}function FEe(t,e,n){return n.options.strong||"*"}function UEe(t,e,n,r){return n.safe(t.value,r)}function BEe(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function HEe(t,e,n){const r=(w7(n)+(n.options.ruleSpaces?" ":"")).repeat(BEe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const E7={blockquote:fEe,break:J4,code:yEe,definition:xEe,emphasis:p7,hardBreak:J4,heading:EEe,html:m7,image:g7,imageReference:v7,inlineCode:y7,link:x7,linkReference:_7,list:OEe,listItem:PEe,paragraph:DEe,root:$Ee,strong:S7,text:UEe,thematicBreak:HEe};function qEe(){return{enter:{table:VEe,tableData:Z4,tableHeader:Z4,tableRow:WEe},exit:{codeText:YEe,table:GEe,tableData:B1,tableHeader:B1,tableRow:B1}}}function VEe(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function GEe(t){this.exit(t),this.data.inTable=void 0}function WEe(t){this.enter({type:"tableRow",children:[]},t)}function B1(t){this.exit(t)}function Z4(t){this.enter({type:"tableCell",children:[]},t)}function YEe(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,KEe));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function KEe(t,e){return e==="|"?e:t}function XEe(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
1816
1816
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:l}};function a(v,b,x,E){return d(p(v,x,E),v.align)}function l(v,b,x,E){const S=h(v,x,E),k=d([S]);return k.slice(0,k.indexOf(`
|
|
1817
1817
|
`))}function c(v,b,x,E){const S=x.enter("tableCell"),k=x.enter("phrasing"),T=x.containerPhrasing(v,{...E,before:i,after:i});return k(),S(),T}function d(v,b){return uEe(v,{align:b,alignDelimiters:r,padding:n,stringLength:s})}function p(v,b,x){const E=v.children;let S=-1;const k=[],T=b.enter("table");for(;++S<E.length;)k[S]=h(E[S],b,x);return T(),k}function h(v,b,x){const E=v.children;let S=-1;const k=[],T=b.enter("tableRow");for(;++S<E.length;)k[S]=c(E[S],v,b,x);return T(),k}function g(v,b,x){let E=E7.inlineCode(v,b,x);return x.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function QEe(){return{exit:{taskListCheckValueChecked:e$,taskListCheckValueUnchecked:e$,paragraph:ZEe}}}function JEe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:e1e}}}function e$(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function ZEe(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=e.children;let i=-1,a;for(;++i<s.length;){const l=s[i];if(l.type==="paragraph"){a=l;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function e1e(t,e,n,r){const s=t.children[0],i=typeof t.checked=="boolean"&&s&&s.type==="paragraph",a="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);i&&l.move(a);let c=E7.listItem(t,e,n,{...r,...l.current()});return i&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function t1e(){return[OSe(),eEe(),sEe(),qEe(),QEe()]}function n1e(t){return{extensions:[ISe(),tEe(t),iEe(),XEe(t),JEe()]}}const r1e={tokenize:c1e,partial:!0},k7={tokenize:u1e,partial:!0},T7={tokenize:d1e,partial:!0},C7={tokenize:f1e,partial:!0},s1e={tokenize:h1e,partial:!0},A7={name:"wwwAutolink",tokenize:o1e,previous:N7},R7={name:"protocolAutolink",tokenize:l1e,previous:j7},tl={name:"emailAutolink",tokenize:a1e,previous:M7},no={};function i1e(){return{text:no}}let Wc=48;for(;Wc<123;)no[Wc]=tl,Wc++,Wc===58?Wc=65:Wc===91&&(Wc=97);no[43]=tl;no[45]=tl;no[46]=tl;no[95]=tl;no[72]=[tl,R7];no[104]=[tl,R7];no[87]=[tl,A7];no[119]=[tl,A7];function a1e(t,e,n){const r=this;let s,i;return a;function a(h){return!FC(h)||!M7.call(r,r.previous)||Ej(r.events)?n(h):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),l(h))}function l(h){return FC(h)?(t.consume(h),l):h===64?(t.consume(h),c):n(h)}function c(h){return h===46?t.check(s1e,p,d)(h):h===45||h===95||as(h)?(i=!0,t.consume(h),c):p(h)}function d(h){return t.consume(h),s=!0,c}function p(h){return i&&s&&ms(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(h)):n(h)}}function o1e(t,e,n){const r=this;return s;function s(a){return a!==87&&a!==119||!N7.call(r,r.previous)||Ej(r.events)?n(a):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(r1e,t.attempt(k7,t.attempt(T7,i),n),n)(a))}function i(a){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(a)}}function l1e(t,e,n){const r=this;let s="",i=!1;return a;function a(h){return(h===72||h===104)&&j7.call(r,r.previous)&&!Ej(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(h),t.consume(h),l):n(h)}function l(h){if(ms(h)&&s.length<5)return s+=String.fromCodePoint(h),t.consume(h),l;if(h===58){const g=s.toLowerCase();if(g==="http"||g==="https")return t.consume(h),c}return n(h)}function c(h){return h===47?(t.consume(h),i?d:(i=!0,c)):n(h)}function d(h){return h===null||Cx(h)||Sn(h)||Mu(h)||t_(h)?n(h):t.attempt(k7,t.attempt(T7,p),n)(h)}function p(h){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(h)}}function c1e(t,e,n){let r=0;return s;function s(a){return(a===87||a===119)&&r<3?(r++,t.consume(a),s):a===46&&r===3?(t.consume(a),i):n(a)}function i(a){return a===null?n(a):e(a)}}function u1e(t,e,n){let r,s,i;return a;function a(d){return d===46||d===95?t.check(C7,c,l)(d):d===null||Sn(d)||Mu(d)||d!==45&&t_(d)?c(d):(i=!0,t.consume(d),a)}function l(d){return d===95?r=!0:(s=r,r=void 0),t.consume(d),a}function c(d){return s||r||!i?n(d):e(d)}}function d1e(t,e){let n=0,r=0;return s;function s(a){return a===40?(n++,t.consume(a),s):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?t.check(C7,e,i)(a):a===null||Sn(a)||Mu(a)?e(a):(t.consume(a),s)}function i(a){return a===41&&r++,t.consume(a),s}}function f1e(t,e,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(t.consume(l),r):l===38?(t.consume(l),i):l===93?(t.consume(l),s):l===60||l===null||Sn(l)||Mu(l)?e(l):n(l)}function s(l){return l===null||l===40||l===91||Sn(l)||Mu(l)?e(l):r(l)}function i(l){return ms(l)?a(l):n(l)}function a(l){return l===59?(t.consume(l),r):ms(l)?(t.consume(l),a):n(l)}}function h1e(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return as(i)?n(i):e(i)}}function N7(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sn(t)}function j7(t){return!ms(t)}function M7(t){return!(t===47||FC(t))}function FC(t){return t===43||t===45||t===46||t===95||as(t)}function Ej(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const p1e={tokenize:w1e,partial:!0};function m1e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:b1e,continuation:{tokenize:x1e},exit:_1e}},text:{91:{name:"gfmFootnoteCall",tokenize:y1e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:g1e,resolveTo:v1e}}}}function g1e(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!a||!a._balanced)return n(c);const d=la(r.sliceSerialize({start:a.end,end:r.now()}));return d.codePointAt(0)!==94||!i.includes(d.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function v1e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...l),t}function y1e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return l;function l(h){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(t.enter("gfmFootnoteCallMarker"),t.consume(h),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(h){if(i>999||h===93&&!a||h===null||h===91||Sn(h))return n(h);if(h===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(la(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(h)}return Sn(h)||(a=!0),i++,t.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(t.consume(h),i++,d):d(h)}}function b1e(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(b){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(b){return b===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",p):n(b)}function p(b){if(a>999||b===93&&!l||b===null||b===91||Sn(b))return n(b);if(b===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return i=la(r.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(b),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Sn(b)||(l=!0),a++,t.consume(b),b===92?h:p}function h(b){return b===91||b===92||b===93?(t.consume(b),a++,p):p(b)}function g(b){return b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),s.includes(i)||s.push(i),tn(t,v,"gfmFootnoteDefinitionWhitespace")):n(b)}function v(b){return e(b)}}function x1e(t,e,n){return t.check(Pg,e,t.attempt(p1e,e,n))}function _1e(t){t.exit("gfmFootnoteDefinition")}function w1e(t,e,n){const r=this;return tn(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function S1e(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,l){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",p,l],["enter",a[d][1],l],["exit",a[d][1],l],["enter",h,l]],v=l.parser.constructs.insideSpan.null;v&&li(g,g.length,0,n_(v,a.slice(d+1,c),l)),li(g,g.length,0,[["exit",h,l],["enter",a[c][1],l],["exit",a[c][1],l],["exit",p,l]]),li(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function i(a,l,c){const d=this.previous,p=this.events;let h=0;return g;function g(b){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(b):(a.enter("strikethroughSequenceTemporary"),v(b))}function v(b){const x=Hf(d);if(b===126)return h>1?c(b):(a.consume(b),h++,v);if(h<2&&!n)return c(b);const E=a.exit("strikethroughSequenceTemporary"),S=Hf(b);return E._open=!S||S===2&&!!x,E._close=!x||x===2&&!!S,l(b)}}}class E1e{constructor(){this.map=[]}add(e,n,r){k1e(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function k1e(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=n,t.map[s][2].push(...r);return}s+=1}t.map.push([e,n,r])}}function T1e(t,e){let n=!1;const r=[];for(;e<t.length;){const s=t[e];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function C1e(){return{flow:{null:{name:"table",tokenize:A1e,resolveAll:R1e}}}}function A1e(t,e,n){const r=this;let s=0,i=0,a;return l;function l(O){let L=r.events.length-1;for(;L>-1;){const W=r.events[L][1].type;if(W==="lineEnding"||W==="linePrefix")L--;else break}const z=L>-1?r.events[L][1].type:null,G=z==="tableHead"||z==="tableRow"?A:c;return G===A&&r.parser.lazy[r.now().line]?n(O):G(O)}function c(O){return t.enter("tableHead"),t.enter("tableRow"),d(O)}function d(O){return O===124||(a=!0,i+=1),p(O)}function p(O){return O===null?n(O):ct(O)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),v):n(O):Gt(O)?tn(t,p,"whitespace")(O):(i+=1,a&&(a=!1,s+=1),O===124?(t.enter("tableCellDivider"),t.consume(O),t.exit("tableCellDivider"),a=!0,p):(t.enter("data"),h(O)))}function h(O){return O===null||O===124||Sn(O)?(t.exit("data"),p(O)):(t.consume(O),O===92?g:h)}function g(O){return O===92||O===124?(t.consume(O),h):h(O)}function v(O){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(O):(t.enter("tableDelimiterRow"),a=!1,Gt(O)?tn(t,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):b(O))}function b(O){return O===45||O===58?E(O):O===124?(a=!0,t.enter("tableCellDivider"),t.consume(O),t.exit("tableCellDivider"),x):j(O)}function x(O){return Gt(O)?tn(t,E,"whitespace")(O):E(O)}function E(O){return O===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(O),t.exit("tableDelimiterMarker"),S):O===45?(i+=1,S(O)):O===null||ct(O)?N(O):j(O)}function S(O){return O===45?(t.enter("tableDelimiterFiller"),k(O)):j(O)}function k(O){return O===45?(t.consume(O),k):O===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(O),t.exit("tableDelimiterMarker"),T):(t.exit("tableDelimiterFiller"),T(O))}function T(O){return Gt(O)?tn(t,N,"whitespace")(O):N(O)}function N(O){return O===124?b(O):O===null||ct(O)?!a||s!==i?j(O):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(O)):j(O)}function j(O){return n(O)}function A(O){return t.enter("tableRow"),R(O)}function R(O){return O===124?(t.enter("tableCellDivider"),t.consume(O),t.exit("tableCellDivider"),R):O===null||ct(O)?(t.exit("tableRow"),e(O)):Gt(O)?tn(t,R,"whitespace")(O):(t.enter("data"),M(O))}function M(O){return O===null||O===124||Sn(O)?(t.exit("data"),R(O)):(t.consume(O),O===92?P:M)}function P(O){return O===92||O===124?(t.consume(O),M):M(O)}}function R1e(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,d,p,h;const g=new E1e;for(;++n<t.length;){const v=t[n],b=v[1];v[0]==="enter"?b.type==="tableHead"?(l=!1,c!==0&&(t$(g,e,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",d,e]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],a=[0,n+1,0,0],l&&(l=!1,p={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",p,e]])),s=b.type==="tableDelimiterRow"?2:p?3:1):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],h=Ny(g,e,i,s,void 0,h),i=[0,0,0,0]),a[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],h=Ny(g,e,i,s,void 0,h)),i=a,a=[i[1],n,0,0])):b.type==="tableHead"?(l=!0,c=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(c=n,i[1]!==0?(a[0]=a[1],h=Ny(g,e,i,s,n,h)):a[1]!==0&&(h=Ny(g,e,a,s,n,h)),s=0):s&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&t$(g,e,c,d,p),g.consume(e.events),n=-1;++n<e.events.length;){const v=e.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=T1e(e.events,n))}return t}function Ny(t,e,n,r,s,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(i.end=Object.assign({},Yd(e.events,n[0])),t.add(n[0],0,[["exit",i,e]]));const c=Yd(e.events,n[1]);if(i={type:a,start:Object.assign({},c),end:Object.assign({},c)},t.add(n[1],0,[["enter",i,e]]),n[2]!==0){const d=Yd(e.events,n[2]),p=Yd(e.events,n[3]),h={type:l,start:Object.assign({},d),end:Object.assign({},p)};if(t.add(n[2],0,[["enter",h,e]]),r!==2){const g=e.events[n[2]],v=e.events[n[3]];if(g[1].end=Object.assign({},v[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,x=n[3]-n[2]-1;t.add(b,x,[])}}t.add(n[3]+1,0,[["exit",h,e]])}return s!==void 0&&(i.end=Object.assign({},Yd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function t$(t,e,n,r,s){const i=[],a=Yd(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function Yd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const N1e={name:"tasklistCheck",tokenize:M1e};function j1e(){return{text:{91:N1e}}}function M1e(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return Sn(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(c)}function l(c){return ct(c)?e(c):Gt(c)?t.check({tokenize:O1e},e,n)(c):n(c)}}function O1e(t,e,n){return tn(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function I1e(t){return H8([i1e(),m1e(),S1e(t),C1e(),j1e()])}const P1e={};function D1e(t){const e=this,n=t||P1e,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(I1e(n)),i.push(t1e()),a.push(n1e(n))}function L1e({node:t,inline:e,className:n,children:r,...s}){return e?f.jsx("code",{className:`${n} text-sm bg-zinc-100 dark:bg-zinc-800 py-0.5 px-1 rounded-md`,...s,children:r}):f.jsx("div",{className:"not-prose flex flex-col",children:f.jsx("div",{...s,className:"text-sm w-full overflow-x-auto dark:bg-zinc-900 p-4 border border-zinc-200 dark:border-zinc-700 rounded-xl dark:text-zinc-50 text-zinc-900 font-mono whitespace-pre-wrap break-words",children:r})})}const $1e={code:L1e,pre:({children:t})=>f.jsx(f.Fragment,{children:t}),img:({src:t,alt:e,...n})=>{if(!t)return null;const[r,s]=w.useState(!1),[i,a]=w.useState(!1);return i?f.jsxs("div",{className:"my-4 p-4 bg-muted/50 rounded-lg border border-border/30 text-center text-muted-foreground",children:["Failed to load image: ",e||"Image"]}):f.jsx("div",{className:"my-4 flex justify-center",children:f.jsx("img",{src:t,alt:e||"Image",className:`max-w-full h-auto rounded-lg border border-border/30 shadow-sm cursor-pointer transition-all hover:shadow-md ${r?"max-h-none":"max-h-96"}`,loading:"lazy",onClick:()=>s(!r),onError:()=>a(!0),title:r?"Click to collapse":"Click to expand",...n})})},ol:({children:t,...e})=>f.jsx("ol",{className:"list-decimal list-outside ml-4",...e,children:t}),li:({children:t,...e})=>f.jsx("li",{className:"py-1",...e,children:t}),ul:({children:t,...e})=>f.jsx("ul",{className:"list-decimal list-outside ml-4",...e,children:t}),strong:({children:t,...e})=>f.jsx("span",{className:"font-semibold",...e,children:t}),a:({children:t,...e})=>f.jsx("a",{className:"text-blue-500 hover:underline",target:"_blank",rel:"noreferrer",...e,children:t}),h1:({children:t,...e})=>f.jsx("h1",{className:"text-3xl font-semibold mt-6 mb-2",...e,children:t}),h2:({children:t,...e})=>f.jsx("h2",{className:"text-2xl font-semibold mt-6 mb-2",...e,children:t}),h3:({children:t,...e})=>f.jsx("h3",{className:"text-xl font-semibold mt-6 mb-2",...e,children:t}),h4:({children:t,...e})=>f.jsx("h4",{className:"text-lg font-semibold mt-6 mb-2",...e,children:t}),h5:({children:t,...e})=>f.jsx("h5",{className:"text-base font-semibold mt-6 mb-2",...e,children:t}),h6:({children:t,...e})=>f.jsx("h6",{className:"text-sm font-semibold mt-6 mb-2",...e,children:t})},z1e=[D1e],F1e=({children:t})=>f.jsx(SSe,{remarkPlugins:z1e,components:$1e,children:t}),n$=F1e;function r$({message:t,onSave:e,onCancel:n}){const[r,s]=w.useState(t.content),i=w.useRef(null);w.useEffect(()=>{i.current&&(i.current.focus(),i.current.select(),a())},[]);const a=()=>{i.current&&(i.current.style.height="auto",i.current.style.height=`${i.current.scrollHeight}px`)},l=()=>{r.trim()!==t.content.trim()?e(r.trim()):n()},c=d=>{d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),l()),d.key==="Escape"&&(d.preventDefault(),n())};return f.jsxs("div",{className:"w-full space-y-3",children:[f.jsx(Zo,{ref:i,value:r,onChange:d=>{s(d.target.value),a()},onKeyDown:c,className:"min-h-[100px] resize-none",placeholder:"Edit your message..."}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Pe,{variant:"outline",size:"sm",onClick:n,children:"Cancel"}),f.jsx(Pe,{size:"sm",onClick:l,disabled:!r.trim(),children:"Save"})]})]})}function s$({data:t,className:e}){const[n,r]=w.useState(!1),s=JSON.stringify(t,null,2),i=async()=>{try{await navigator.clipboard.writeText(s),r(!0),setTimeout(()=>r(!1),2e3)}catch(l){console.error("Failed to copy:",l)}},a=l=>l.replace(/"([^"]+)":/g,'<span class="text-blue-600/70 dark:text-blue-400/70">"$1"</span>:').replace(/: "([^"]*)"/g,': <span class="text-foreground">"$1"</span>').replace(/: (true|false)/g,': <span class="text-purple-600/70 dark:text-purple-400/70">$1</span>').replace(/: (null)/g,': <span class="text-muted-foreground/60">$1</span>').replace(/: (-?\d+(?:\.\d+)?)/g,': <span class="text-orange-600/70 dark:text-orange-400/70">$1</span>');return f.jsxs("div",{className:Me("relative group",e),children:[f.jsx("button",{onClick:i,className:"absolute top-2 right-2 p-1.5 rounded-md bg-background/80 backdrop-blur-sm border opacity-0 group-hover:opacity-100 transition-opacity hover:bg-muted",title:"Copy JSON",children:n?f.jsx(Ni,{className:"h-3 w-3 text-green-600/70 dark:text-green-400/70"}):f.jsx(Bo,{className:"h-3 w-3"})}),f.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto p-3 bg-muted/20 rounded-md border",children:f.jsx("code",{dangerouslySetInnerHTML:{__html:a(s)}})})]})}function O7({data:t,depth:e=0}){const[n,r]=w.useState(e<2);if(typeof t!="object"||t===null)return f.jsx("span",{className:Me("text-sm",typeof t=="string"&&"text-foreground",typeof t=="number"&&"text-orange-600/70 dark:text-orange-400/70",typeof t=="boolean"&&"text-purple-600/70 dark:text-purple-400/70",t===null&&"text-muted-foreground/60"),children:typeof t=="string"?`"${t}"`:String(t)});const s=Array.isArray(t),i=s?t.map((c,d)=>[d,c]):Object.entries(t),a=s?"[":"{",l=s?"]":"}";return i.length===0?f.jsxs("span",{className:"text-sm text-muted-foreground",children:[a,l]}):f.jsxs("div",{className:"text-sm",children:[f.jsxs("button",{onClick:()=>r(!n),className:"flex items-center gap-1 hover:bg-muted/50 rounded px-1 transition-colors",children:[n?f.jsx(Lu,{className:"h-3 w-3"}):f.jsx(Ka,{className:"h-3 w-3"}),f.jsxs("span",{className:"text-muted-foreground",children:[a," ",!n&&`${i.length} items`]})]}),n&&f.jsx("div",{className:"ml-4 border-l border-border pl-2 space-y-1",children:i.map(([c,d])=>f.jsxs("div",{className:"flex gap-2",children:[f.jsxs("span",{className:"text-blue-600/70 dark:text-blue-400/70 font-medium min-w-0 flex-shrink-0",children:[s?`[${c}]`:`"${c}"`,":"]}),f.jsx("div",{className:"min-w-0 flex-1",children:f.jsx(O7,{data:d,depth:e+1})})]},c))}),n&&f.jsx("span",{className:"text-muted-foreground ml-4",children:l})]})}function i$({toolCall:t,toolResult:e,className:n,serverConfigs:r,onCallTool:s,onSendFollowup:i,toolMeta:a,serverId:l}){const[c,d]=w.useState(!1),[p,h]=w.useState(!1),v=e?e.error?"error":"completed":t.status,b=()=>{switch(v){case"completed":return f.jsxs("div",{className:"relative",children:[f.jsx(mf,{className:"h-4 w-4 text-green-600/70 dark:text-green-400/70"}),f.jsx("div",{className:"absolute inset-0 animate-ping",children:f.jsx(mf,{className:"h-4 w-4 text-green-600/70 dark:text-green-400/70 opacity-20"})})]});case"error":return f.jsxs("div",{className:"relative",children:[f.jsx(gf,{className:"h-4 w-4 text-red-600/70 dark:text-red-400/70"}),f.jsx("div",{className:"absolute inset-0 animate-pulse",children:f.jsx(gf,{className:"h-4 w-4 text-red-600/70 dark:text-red-400/70 opacity-30"})})]});case"executing":return f.jsxs("div",{className:"relative",children:[f.jsx(NP,{className:"h-4 w-4 text-blue-600/70 dark:text-blue-400/70 animate-spin"}),f.jsx("div",{className:"absolute inset-0 animate-ping",children:f.jsx("div",{className:"h-4 w-4 bg-blue-600/30 dark:bg-blue-400/30 rounded-full"})})]});default:return f.jsx(NP,{className:"h-4 w-4 text-muted-foreground/60"})}};return f.jsxs("div",{className:Me("border rounded-lg bg-gradient-to-br from-muted/20 to-muted/40 backdrop-blur-sm shadow-sm hover:shadow-md transition-all duration-200",v==="completed"&&"border-green-200/50 dark:border-green-800/50",v==="error"&&"border-red-200/50 dark:border-red-800/50",v==="executing"&&"border-blue-200/50 dark:border-blue-800/50 shadow-md animate-pulse",n),children:[f.jsxs("button",{onClick:()=>d(!c),className:"w-full flex items-center justify-between p-4 hover:bg-muted/30 transition-all duration-200 rounded-t-lg",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:"p-2 rounded-md bg-background/50 border",children:f.jsx(B0,{className:"h-4 w-4 text-muted-foreground"})}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"font-semibold text-sm",children:t.name}),v==="executing"&&f.jsx("span",{className:"text-xs text-blue-600/70 dark:text-blue-400/70 font-medium",children:"Running..."}),b()]})]}),f.jsx("div",{className:"flex items-center gap-2",children:c?f.jsx(Lu,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Ka,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&f.jsxs("div",{className:"border-t bg-background/30 backdrop-blur-sm",children:[Object.keys(t.parameters).length>0&&f.jsxs("div",{className:"p-4 border-b border-border/50",children:[f.jsxs("div",{className:"flex items-center justify-between mb-3",children:[f.jsxs("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2",children:[f.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-600/70 dark:bg-blue-400/70"}),"Parameters"]}),f.jsx("button",{onClick:()=>h(!p),className:"text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded bg-muted/50 hover:bg-muted",children:p?"Raw JSON":"Tree View"})]}),p?f.jsx(O7,{data:t.parameters}):f.jsx(s$,{data:t.parameters})]}),e&&f.jsxs("div",{className:"p-4",children:[f.jsxs("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-3 flex items-center gap-2",children:[f.jsx("div",{className:Me("w-2 h-2 rounded-full",e.error?"bg-red-600/70 dark:bg-red-400/70":"bg-green-600/70 dark:bg-green-400/70")}),e.error?"Error":"Result"]}),f.jsx("div",{children:e.error?f.jsx("div",{className:"bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg p-4",children:f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx(gf,{className:"h-5 w-5 text-red-600/70 dark:text-red-400/70 flex-shrink-0 mt-0.5"}),f.jsxs("div",{children:[f.jsx("p",{className:"font-medium text-foreground mb-1",children:"Tool execution failed"}),f.jsx("p",{className:"text-muted-foreground text-sm",children:e.error})]})]})}):f.jsxs("div",{className:"bg-green-50/30 dark:bg-green-950/20 border border-green-200/50 dark:border-green-800/50 rounded-lg",children:[f.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-green-100/30 dark:bg-green-900/20 border-b border-green-200/50 dark:border-green-800/50",children:[f.jsx(mf,{className:"h-4 w-4 text-green-600/70 dark:text-green-400/70"}),f.jsx("span",{className:"text-sm font-medium text-foreground",children:"Tool executed successfully"})]}),f.jsx("div",{className:"p-4",children:(()=>{const x=N=>{if(!N)return null;const j=Array.isArray(N)?N[0]:N;if(!j)return null;const A=j?.resource;if(A&&typeof A=="object"&&typeof A.uri=="string"&&A.uri.startsWith("ui://"))return A;const R=j?.content;if(Array.isArray(R)){for(const M of R)if(M?.type==="resource"&&M?.resource?.uri&&typeof M.resource.uri=="string"&&M.resource.uri.startsWith("ui://"))return M.resource}return null},E=e?.result,S=a?.["openai/outputTemplate"];if(S&&typeof S=="string"){const N=l||e.serverId;return f.jsx(Aq,{componentUrl:S,toolCall:t,toolResult:e,onCallTool:s,onSendFollowup:i,serverId:N,toolMeta:a})}const k=x(E);if(k)return f.jsx(iN,{resource:k,htmlProps:{autoResizeIframe:!0,style:{width:"100%",overflow:"visible"}},onUIAction:async N=>{if(N.type==="tool"&&N.payload?.toolName){const j=(()=>{if(r&&typeof r=="object"&&Object.keys(r).length===1)return Object.keys(r)[0]})();fetch("/api/mcp/tools/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolName:N.payload.toolName,parameters:N.payload.params||{},...j?{serverId:j}:{}})}).catch(()=>{})}else N.type==="link"&&N.payload?.url&&window.open(N.payload.url,"_blank","noopener,noreferrer");return{status:"handled"}}});const T=E?.result||E;return typeof T=="object"?f.jsx(s$,{data:T}):f.jsx("div",{className:"text-sm text-foreground bg-muted/30 p-3 rounded border",children:String(T)})})()})]})})]})]})]})}const U1e="/claude_logo.png",B1e="/openai_logo.png",H1e="/deepseek_logo.svg",q1e="/google_logo.png",V1e="/meta_logo.svg",a$="/ollama_logo.svg",o$="/ollama_dark.png",l$="/grok_light.svg",c$="/grok_dark.png",I7=(t,e)=>{switch(t){case"anthropic":return U1e;case"openai":return B1e;case"deepseek":return H1e;case"google":return q1e;case"ollama":return e==="dark"||e==="system"&&typeof document<"u"&&document.documentElement.classList.contains("dark")?o$:a$;case"meta":return V1e;case"x-ai":return e==="dark"||e==="system"&&typeof document<"u"&&document.documentElement.classList.contains("dark")?c$:l$;default:return null}},G1e=(t,e)=>I7(t.provider,e),W1e=t=>{switch(t){case"anthropic":return"text-orange-600 dark:text-orange-400";case"openai":return"text-green-600 dark:text-green-400";case"deepseek":return"text-blue-600 dark:text-blue-400";case"google":return"text-red-600 dark:text-red-400";case"ollama":return"text-gray-600 dark:text-gray-400";case"x-ai":return"text-purple-600 dark:text-purple-400";default:return"text-blue-600 dark:text-blue-400"}},u$=t=>{let e;const n=new Set,r=(d,p)=>{const h=typeof d=="function"?d(e):d;if(!Object.is(h,e)){const g=e;e=p??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(v=>v(e,g))}},s=()=>e,l={setState:r,getState:s,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d))},c=e=t(r,s,l);return l},Y1e=t=>t?u$(t):u$,K1e=t=>t;function X1e(t,e=K1e){const n=Ee.useSyncExternalStore(t.subscribe,Ee.useCallback(()=>e(t.getState()),[t,e]),Ee.useCallback(()=>e(t.getInitialState()),[t,e]));return Ee.useDebugValue(n),n}const Q1e=t=>Y1e()(e=>({themeMode:t?.themeMode??"light",themePreset:t?.themePreset??"default",setThemeMode:n=>e({themeMode:n}),setThemePreset:n=>e({themePreset:n})})),P7=w.createContext(null),J1e=({children:t,themeMode:e,themePreset:n})=>{const r=w.useRef(null);return r.current??=Q1e({themeMode:e,themePreset:n}),f.jsx(P7.Provider,{value:r.current,children:t})},sg=t=>{const e=w.useContext(P7);if(!e)throw new Error("Missing PreferencesStoreProvider");return X1e(e,t)},d$=({attachment:t,align:e="left"})=>{const[n,r]=w.useState(!1),[s,i]=w.useState(!1);return n?f.jsxs("div",{className:`px-3 py-2 bg-muted rounded-lg text-sm text-muted-foreground ${e==="right"?"text-right":""}`,children:["Failed to load image: ",t.name]}):f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsx("div",{className:`text-xs text-muted-foreground font-medium ${e==="right"?"text-right":""}`,children:t.name}),f.jsx("div",{className:"flex justify-center",children:f.jsx("img",{src:t.url,alt:t.name,className:`max-w-full h-auto rounded-lg border border-border/30 shadow-sm cursor-pointer transition-all hover:shadow-md ${s?"max-h-none":"max-h-96"}`,loading:"lazy",onClick:()=>i(!s),onError:()=>r(!0),title:s?"Click to collapse":"Click to expand"})})]})},f$=()=>f.jsxs("div",{className:"flex items-center gap-2 py-2",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"Thinking"}),f.jsxs("div",{className:"flex space-x-1",children:[f.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce"}),f.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce [animation-delay:-0.2s]"}),f.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce [animation-delay:-0.4s]"})]})]}),Z1e=({message:t,isLoading:e=!1,onEdit:n,onRegenerate:r,onCopy:s,isReadonly:i=!1,showActions:a=!0,model:l,serverConfigs:c,onCallTool:d,onSendFollowup:p,toolsMetadata:h,serverId:g})=>{const[v,b]=w.useState("view"),[x,E]=w.useState(!1),[S,k]=w.useState(!1),T=sg(P=>P.themeMode),N=()=>{s?s(t.content):navigator.clipboard.writeText(t.content),k(!0),setTimeout(()=>k(!1),2e3)},j=P=>{n&&n(t.id,P),b("view")},A=()=>{b("view")},R=()=>{r&&r(t.id)},M=t.role==="assistant"&&e&&(!t.content||t.content.trim()==="");return f.jsx(Ex,{children:f.jsxs(ri.div,{"data-testid":`message-${t.role}`,className:"w-full mx-auto max-w-4xl px-4 group/message",initial:{y:5,opacity:0},animate:{y:0,opacity:1},"data-role":t.role,onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!1),children:[t.role==="assistant"&&f.jsxs("div",{className:"flex gap-4 w-full",children:[f.jsx("div",{className:"size-8 flex items-center rounded-full justify-center shrink-0 bg-muted/50",children:f.jsx("img",{src:G1e(l,T),alt:`${l?.id} logo`,className:"h-4 w-4 object-contain"})}),f.jsxs("div",{className:"flex flex-col gap-4 w-full min-w-0",children:[t.attachments&&t.attachments.length>0&&f.jsx("div",{className:"flex flex-col gap-3",children:t.attachments.map(P=>mL({type:P.contentType})?f.jsx(d$,{attachment:P},P.id):f.jsxs("div",{className:"px-3 py-2 bg-muted rounded-lg text-sm flex items-center gap-2",children:[f.jsx("span",{children:"📎"}),f.jsx("span",{children:P.name}),P.size&&f.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(P.size/1024).toFixed(1)," KB)"]})]},P.id))}),t.contentBlocks&&t.contentBlocks.length>0?f.jsx("div",{className:"space-y-4",children:t.contentBlocks.map((P,O)=>P.type==="text"&&P.content?f.jsx(ri.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:O*.05},className:"prose prose-sm max-w-none dark:prose-invert prose-p:leading-relaxed prose-pre:bg-muted/50 prose-pre:border prose-pre:border-border/30 flex-1 min-w-0",children:f.jsx(n$,{children:gE(P.content)})},P.id):P.type==="tool_call"&&P.toolCall?f.jsx(ri.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:O*.05},children:f.jsx(i$,{toolCall:P.toolCall,toolResult:P.toolResult,serverConfigs:c,onCallTool:d,onSendFollowup:p,toolMeta:h?.[P.toolCall.name],serverId:g})},P.id):null)}):f.jsxs(f.Fragment,{children:[t.toolCalls&&t.toolCalls.length>0&&f.jsx("div",{className:"space-y-2",children:t.toolCalls.map((P,O)=>{const L=t.toolResults?.find(z=>z.toolCallId===P.id);return f.jsx(ri.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:O*.1},children:f.jsx(i$,{toolCall:P,toolResult:L,serverConfigs:c,onCallTool:d,onSendFollowup:p,toolMeta:h?.[P.name],serverId:g})},P.id)})}),M?f.jsx(ri.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},children:f.jsx(f$,{})}):v==="view"&&t.content?f.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert prose-p:leading-relaxed prose-pre:bg-muted/50 prose-pre:border prose-pre:border-border/30 flex-1 min-w-0",children:f.jsx(n$,{children:gE(t.content)})}):null]}),M&&t.contentBlocks&&f.jsx(ri.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},children:f.jsx(f$,{})}),v==="view"&&x&&f.jsxs("div",{className:"flex items-center justify-between mt-4",children:[f.jsx("div",{className:"text-xs text-muted-foreground/60",children:hL(t.timestamp)}),a&&!i&&f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{variant:"ghost",size:"sm",className:"px-2 h-7 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-all",onClick:N,children:S?f.jsx(Ni,{size:14}):f.jsx(Bo,{size:14})})}),f.jsx(Fa,{children:"Copy"})]}),r&&f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{variant:"ghost",size:"sm",className:"px-2 h-7 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-all",onClick:R,children:f.jsx(Fie,{size:14})})}),f.jsx(Fa,{children:"Regenerate"})]})]})]}),v==="edit"&&f.jsx("div",{className:"flex flex-row gap-2 items-start",children:f.jsx(r$,{message:t,onSave:j,onCancel:A})})]})]}),t.role==="user"&&f.jsx("div",{className:"flex justify-end w-full",children:f.jsxs("div",{className:"flex flex-col gap-2 max-w-2xl",children:[t.attachments&&t.attachments.length>0&&f.jsx("div",{className:"flex flex-col gap-3",children:t.attachments.map(P=>mL({type:P.contentType})?f.jsx(d$,{attachment:P,align:"right"},P.id):f.jsxs("div",{className:"px-3 py-2 bg-muted rounded-lg text-sm flex items-center gap-2 justify-end",children:[f.jsx("span",{children:P.name}),f.jsx("span",{children:"📎"}),P.size&&f.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(P.size/1024).toFixed(1)," KB)"]})]},P.id))}),v==="view"?f.jsxs("div",{className:"flex items-start gap-2 justify-end",children:[a&&!i&&x&&f.jsx("div",{className:"flex items-center gap-1 mt-1",children:f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{variant:"ghost",size:"sm",className:"px-2 h-7 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-all",onClick:N,children:f.jsx(Bo,{size:14})})}),f.jsx(Fa,{children:"Copy"})]})}),f.jsxs("div",{className:"relative",children:[f.jsx("div",{"data-testid":"message-content",className:"bg-primary text-primary-foreground px-4 py-3 rounded-2xl max-w-fit",children:f.jsx("div",{className:"whitespace-pre-wrap break-words font-medium",children:gE(t.content)})}),x&&f.jsx("div",{className:"absolute -bottom-6 right-0 text-xs text-muted-foreground/60",children:hL(t.timestamp)})]})]}):f.jsx("div",{className:"w-full",children:f.jsx(r$,{message:t,onSave:j,onCancel:A})})]})})]})})},eke=w.memo(Z1e,(t,e)=>t.message.id===e.message.id&&t.message.content===e.message.content&&t.isLoading===e.isLoading&&JSON.stringify(t.message.toolCalls)===JSON.stringify(e.message.toolCalls)&&JSON.stringify(t.message.toolResults)===JSON.stringify(e.message.toolResults));function H1({provider:t}){const e=sg(r=>r.themeMode),n=I7(t,e);return n?f.jsx("img",{src:n,width:12,height:12,alt:`${t} logo`,className:"h-3 w-3 object-contain"}):f.jsx("div",{className:HT("h-3 w-3 rounded-sm",W1e(t))})}var ja=[],Ei=[],tke=Uint8Array,q1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Dd=0,nke=q1.length;Dd<nke;++Dd)ja[Dd]=q1[Dd],Ei[q1.charCodeAt(Dd)]=Dd;Ei[45]=62;Ei[95]=63;function rke(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function ske(t,e,n){return(e+n)*3/4-n}function ig(t){var e,n=rke(t),r=n[0],s=n[1],i=new tke(ske(t,r,s)),a=0,l=s>0?r-4:r,c;for(c=0;c<l;c+=4)e=Ei[t.charCodeAt(c)]<<18|Ei[t.charCodeAt(c+1)]<<12|Ei[t.charCodeAt(c+2)]<<6|Ei[t.charCodeAt(c+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return s===2&&(e=Ei[t.charCodeAt(c)]<<2|Ei[t.charCodeAt(c+1)]>>4,i[a++]=e&255),s===1&&(e=Ei[t.charCodeAt(c)]<<10|Ei[t.charCodeAt(c+1)]<<4|Ei[t.charCodeAt(c+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function ike(t){return ja[t>>18&63]+ja[t>>12&63]+ja[t>>6&63]+ja[t&63]}function ake(t,e,n){for(var r,s=[],i=e;i<n;i+=3)r=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),s.push(ike(r));return s.join("")}function ag(t){for(var e,n=t.length,r=n%3,s=[],i=16383,a=0,l=n-r;a<l;a+=i)s.push(ake(t,a,a+i>l?l:a+i));return r===1?(e=t[n-1],s.push(ja[e>>2]+ja[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],s.push(ja[e>>10]+ja[e>>4&63]+ja[e<<2&63]+"=")),s.join("")}function jo(t){if(t===void 0)return{};if(!D7(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function oke(t){if(typeof t>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof t!="string")throw new Error(`Invalid deployment address: found ${t}".`);if(!(t.startsWith("http:")||t.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${t}".`);try{new URL(t)}catch{throw new Error(`Invalid deployment address: "${t}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(t.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${t}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function D7(t){const e=typeof t=="object",n=Object.getPrototypeOf(t),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return e&&r}const L7=!0,qf=BigInt("-9223372036854775808"),kj=BigInt("9223372036854775807"),UC=BigInt("0"),lke=BigInt("8"),cke=BigInt("256");function $7(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function uke(t){t<UC&&(t-=qf+qf);let e=t.toString(16);e.length%2===1&&(e="0"+e);const n=new Uint8Array(new ArrayBuffer(8));let r=0;for(const s of e.match(/.{2}/g).reverse())n.set([parseInt(s,16)],r++),t>>=lke;return ag(n)}function dke(t){const e=ig(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);let n=UC,r=UC;for(const s of e)n+=BigInt(s)*cke**r,r++;return n>kj&&(n+=qf+qf),n}function fke(t){if(t<qf||kj<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);const e=new ArrayBuffer(8);return new DataView(e).setBigInt64(0,t,!0),ag(new Uint8Array(e))}function hke(t){const e=ig(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);return new DataView(e.buffer).getBigInt64(0,!0)}const pke=DataView.prototype.setBigInt64?fke:uke,mke=DataView.prototype.getBigInt64?hke:dke,h$=1024;function z7(t){if(t.length>h$)throw new Error(`Field name ${t} exceeds maximum field name length ${h$}.`);if(t.startsWith("$"))throw new Error(`Field name ${t} starts with a '$', which is reserved.`);for(let e=0;e<t.length;e+=1){const n=t.charCodeAt(e);if(n<32||n>=127)throw new Error(`Field name ${t} has invalid character '${t[e]}': Field names can only contain non-control ASCII characters`)}}function Vf(t){if(t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>Vf(r));if(typeof t!="object")throw new Error(`Unexpected type of ${t}`);const e=Object.entries(t);if(e.length===1){const r=e[0][0];if(r==="$bytes"){if(typeof t.$bytes!="string")throw new Error(`Malformed $bytes field on ${t}`);return ig(t.$bytes).buffer}if(r==="$integer"){if(typeof t.$integer!="string")throw new Error(`Malformed $integer field on ${t}`);return mke(t.$integer)}if(r==="$float"){if(typeof t.$float!="string")throw new Error(`Malformed $float field on ${t}`);const s=ig(t.$float);if(s.byteLength!==8)throw new Error(`Received ${s.byteLength} bytes, expected 8 for $float`);const a=new DataView(s.buffer).getFloat64(0,L7);if(!$7(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[r,s]of Object.entries(t))z7(r),n[r]=Vf(s);return n}function Sm(t){return JSON.stringify(t,(e,n)=>n===void 0?"undefined":typeof n=="bigint"?`${n.toString()}n`:n)}function BC(t,e,n,r){if(t===void 0){const a=n&&` (present at path ${n} in original object ${Sm(e)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(t===null)return t;if(typeof t=="bigint"){if(t<qf||kj<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);return{$integer:pke(t)}}if(typeof t=="number")if($7(t)){const a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,t,L7),{$float:ag(new Uint8Array(a))}}else return t;if(typeof t=="boolean"||typeof t=="string")return t;if(t instanceof ArrayBuffer)return{$bytes:ag(new Uint8Array(t))};if(Array.isArray(t))return t.map((a,l)=>BC(a,e,n+`[${l}]`));if(t instanceof Set)throw new Error(V1(n,"Set",[...t],e));if(t instanceof Map)throw new Error(V1(n,"Map",[...t],e));if(!D7(t)){const a=t?.constructor?.name,l=a?`${a} `:"";throw new Error(V1(n,l,t,e))}const s={},i=Object.entries(t);i.sort(([a,l],[c,d])=>a===c?0:a<c?-1:1);for(const[a,l]of i)l!==void 0&&(z7(a),s[a]=BC(l,e,n+`.${a}`));return s}function V1(t,e,n,r){return t?`${e}${Sm(n)} is not a supported Convex type (present at path ${t} in original object ${Sm(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${e}${Sm(n)} is not a supported Convex type.`}function sc(t){return BC(t,t,"")}var gke=Object.defineProperty,vke=(t,e,n)=>e in t?gke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,G1=(t,e,n)=>vke(t,typeof e!="symbol"?e+"":e,n),p$,m$;const yke=Symbol.for("ConvexError");class HC extends(m$=Error,p$=yke,m$){constructor(e){super(typeof e=="string"?e:Sm(e)),G1(this,"name","ConvexError"),G1(this,"data"),G1(this,p$,!0),this.data=e}}const F7=()=>Array.from({length:4},()=>0);F7();F7();const g$="1.27.3";var bke=Object.defineProperty,xke=(t,e,n)=>e in t?bke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v$=(t,e,n)=>xke(t,typeof e!="symbol"?e+"":e,n);const _ke="color:rgb(0, 145, 255)";function U7(t){switch(t){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class B7{constructor(e){v$(this,"_onLogLineFuncs"),v$(this,"_verbose"),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let n=Math.random().toString(36).substring(2,15);for(let r=0;r<10&&this._onLogLineFuncs[n]!==void 0;r++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=e,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...e){if(this._verbose)for(const n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...e)}log(...e){for(const n of Object.values(this._onLogLineFuncs))n("info",...e)}warn(...e){for(const n of Object.values(this._onLogLineFuncs))n("warn",...e)}error(...e){for(const n of Object.values(this._onLogLineFuncs))n("error",...e)}}function H7(t){const e=new B7(t);return e.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),e}function q7(t){return new B7(t)}function jx(t,e,n,r,s){const i=U7(n);if(typeof s=="object"&&(s=`ConvexError ${JSON.stringify(s.errorData,null,2)}`),e==="info"){const a=s.match(/^\[.*?\] /);if(a===null){t.error(`[CONVEX ${i}(${r})] Could not parse console.log`);return}const l=s.slice(1,a[0].length-2),c=s.slice(a[0].length);t.log(`%c[CONVEX ${i}(${r})] [${l}]`,_ke,c)}else t.error(`[CONVEX ${i}(${r})] ${s}`)}function wke(t,e){const n=`[CONVEX FATAL ERROR] ${e}`;return t.error(n),new Error(n)}function of(t,e,n){return`[CONVEX ${U7(t)}(${e})] ${n.errorMessage}
|
|
1818
1818
|
Called by client`}function qC(t,e){return e.data=t.errorData,e}function Mx(t){const e=t.split(":");let n,r;return e.length===1?(n=e[0],r="default"):(n=e.slice(0,e.length-1).join(":"),r=e[e.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${r}`}function hu(t,e){return JSON.stringify({udfPath:Mx(t),args:sc(e)})}var Ske=Object.defineProperty,Eke=(t,e,n)=>e in t?Ske(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ta=(t,e,n)=>Eke(t,typeof e!="symbol"?e+"":e,n);class kke{constructor(){Ta(this,"nextQueryId"),Ta(this,"querySetVersion"),Ta(this,"querySet"),Ta(this,"queryIdToToken"),Ta(this,"identityVersion"),Ta(this,"auth"),Ta(this,"outstandingQueriesOlderThanRestart"),Ta(this,"outstandingAuthOlderThanRestart"),Ta(this,"paused"),Ta(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,n,r,s){const i=Mx(e),a=hu(i,n),l=this.querySet.get(a);if(l!==void 0)return l.numSubscribers+=1,{queryToken:a,modification:null,unsubscribe:()=>this.removeSubscriber(a)};{const c=this.nextQueryId++,d={id:c,canonicalizedUdfPath:i,args:n,numSubscribers:1,journal:r,componentPath:s};this.querySet.set(a,d),this.queryIdToToken.set(c,a);const p=this.querySetVersion,h=this.querySetVersion+1,g={type:"Add",queryId:c,udfPath:i,args:[sc(n)],journal:r,componentPath:s};return this.paused?this.pendingQuerySetModifications.set(c,g):this.querySetVersion=h,{queryToken:a,modification:{type:"ModifyQuerySet",baseVersion:p,newVersion:h,modifications:[g]},unsubscribe:()=>this.removeSubscriber(a)}}}transition(e){for(const n of e.modifications)switch(n.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);const r=n.journal;if(r!==void 0){const s=this.queryIdToToken.get(n.queryId);s!==void 0&&(this.querySet.get(s).journal=r)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(e,n){const r=Mx(e),s=hu(r,n),i=this.querySet.get(s);return i!==void 0?i.id:null}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}setAuth(e){this.auth={tokenType:"User",value:e};const n=this.identityVersion;return this.paused||(this.identityVersion=n+1),{type:"Authenticate",baseVersion:n,...this.auth}}setAdminAuth(e,n){const r={tokenType:"Admin",value:e,impersonating:n};this.auth=r;const s=this.identityVersion;return this.paused||(this.identityVersion=s+1),{type:"Authenticate",baseVersion:s,...r}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:"Authenticate",tokenType:"None",baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){const n=this.queryIdToToken.get(e);return n?this.querySet.get(n).canonicalizedUdfPath:null}queryArgs(e){const n=this.queryIdToToken.get(e);return n?this.querySet.get(n).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(e){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const n=[];for(const i of this.querySet.values()){const a={type:"Add",queryId:i.id,udfPath:i.canonicalizedUdfPath,args:[sc(i.args)],journal:i.journal,componentPath:i.componentPath};n.push(a),e.has(i.id)||this.outstandingQueriesOlderThanRestart.add(i.id)}this.querySetVersion=1;const r={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:n};if(!this.auth)return this.identityVersion=0,[r,void 0];this.outstandingAuthOlderThanRestart=!0;const s={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[r,s]}pause(){this.paused=!0}resume(){const e=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,n=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[e,n]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){const n=this.querySet.get(e);if(n.numSubscribers>1)return n.numSubscribers-=1,null;{this.querySet.delete(e),this.queryIdToToken.delete(n.id),this.outstandingQueriesOlderThanRestart.delete(n.id);const r=this.querySetVersion,s=this.querySetVersion+1,i={type:"Remove",queryId:n.id};return this.paused?this.pendingQuerySetModifications.has(n.id)?this.pendingQuerySetModifications.delete(n.id):this.pendingQuerySetModifications.set(n.id,i):this.querySetVersion=s,{type:"ModifyQuerySet",baseVersion:r,newVersion:s,modifications:[i]}}}}var Tke=Object.defineProperty,Cke=(t,e,n)=>e in t?Tke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jy=(t,e,n)=>Cke(t,typeof e!="symbol"?e+"":e,n);class Ake{constructor(e,n){this.logger=e,this.markConnectionStateDirty=n,jy(this,"inflightRequests"),jy(this,"requestsOlderThanRestart"),jy(this,"inflightMutationsCount",0),jy(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,n){const r=new Promise(s=>{const i=n?"Requested":"NotSent";this.inflightRequests.set(e.requestId,{message:e,status:{status:i,requestedAt:new Date,onResult:s}}),e.type==="Mutation"?this.inflightMutationsCount++:e.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),r}onResponse(e){const n=this.inflightRequests.get(e.requestId);if(n===void 0||n.status.status==="Completed")return null;const r=n.message.type==="Mutation"?"mutation":"action",s=n.message.udfPath;for(const c of e.logLines)jx(this.logger,"info",r,s,c);const i=n.status;let a,l;if(e.success)a={success:!0,logLines:e.logLines,value:Vf(e.result)},l=()=>i.onResult(a);else{const c=e.result,{errorData:d}=e;jx(this.logger,"error",r,s,c),a={success:!1,errorMessage:c,errorData:d!==void 0?Vf(d):void 0,logLines:e.logLines},l=()=>i.onResult(a)}return e.type==="ActionResponse"||!e.success?(l(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),n.message.type==="Action"?this.inflightActionsCount--:n.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:a}):(n.status={status:"Completed",result:a,ts:e.ts,onResolve:l},null)}removeCompleted(e){const n=new Map;for(const[r,s]of this.inflightRequests.entries()){const i=s.status;i.status==="Completed"&&i.ts.lessThanOrEqual(e)&&(i.onResolve(),n.set(r,i.result),s.message.type==="Mutation"?this.inflightMutationsCount--:s.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const e=[];for(const[n,r]of this.inflightRequests){if(r.status.status==="NotSent"){r.status.status="Requested",e.push(r.message);continue}if(r.message.type==="Mutation")e.push(r.message);else if(r.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,r.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");r.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){const e=[];for(const[,n]of this.inflightRequests)if(n.status.status==="NotSent"){n.status.status="Requested",e.push(n.message);continue}return e}hasIncompleteRequests(){for(const e of this.inflightRequests.values())if(e.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(const n of this.inflightRequests.values())n.status.status!=="Completed"&&n.status.requestedAt.getTime()<e&&(e=n.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const og=Symbol.for("functionName"),Rke=Symbol.for("toReferencePath");function Nke(t){return t[Rke]??null}function jke(t){return t.startsWith("function://")}function Mke(t){let e;if(typeof t=="string")jke(t)?e={functionHandle:t}:e={name:t};else if(t[og])e={name:t[og]};else{const n=Nke(t);if(!n)throw new Error(`${t} is not a functionReference`);e={reference:n}}return e}function Ls(t){const e=Mke(t);if(e.name===void 0)throw e.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${e.functionHandle}`):e.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${e.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(e)}`);if(typeof t=="string")return t;const n=t[og];if(!n)throw new Error(`${t} is not a functionReference`);return n}function Tj(t){return{[og]:t}}function V7(t=[]){const e={get(n,r){if(typeof r=="string"){const s=[...t,r];return V7(s)}else if(r===og){if(t.length<2){const a=["api",...t].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}const s=t.slice(0,-1).join("/"),i=t[t.length-1];return i==="default"?s:s+":"+i}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},e)}V7();var Oke=Object.defineProperty,Ike=(t,e,n)=>e in t?Oke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ox=(t,e,n)=>Ike(t,typeof e!="symbol"?e+"":e,n);class lg{constructor(e){Ox(this,"queryResults"),Ox(this,"modifiedQueries"),this.queryResults=e,this.modifiedQueries=[]}getQuery(e,...n){const r=jo(n[0]),s=Ls(e),i=this.queryResults.get(hu(s,r));if(i!==void 0)return lg.queryValue(i.result)}getAllQueries(e){const n=[],r=Ls(e);for(const s of this.queryResults.values())s.udfPath===Mx(r)&&n.push({args:s.args,value:lg.queryValue(s.result)});return n}setQuery(e,n,r){const s=jo(n),i=Ls(e),a=hu(i,s);let l;r===void 0?l=void 0:l={success:!0,value:r,logLines:[]};const c={udfPath:i,args:s,result:l};this.queryResults.set(a,c),this.modifiedQueries.push(a)}static queryValue(e){if(e!==void 0)return e.success?e.value:void 0}}class Pke{constructor(){Ox(this,"queryResults"),Ox(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,n){this.optimisticUpdates=this.optimisticUpdates.filter(a=>!n.has(a.mutationId));const r=this.queryResults;this.queryResults=new Map(e);const s=new lg(this.queryResults);for(const a of this.optimisticUpdates)a.update(s);const i=[];for(const[a,l]of this.queryResults){const c=r.get(a);(c===void 0||c.result!==l.result)&&i.push(a)}return i}applyOptimisticUpdate(e,n){this.optimisticUpdates.push({update:e,mutationId:n});const r=new lg(this.queryResults);return e(r),r.modifiedQueries}rawQueryResult(e){return this.queryResults.get(e)}queryResult(e){const n=this.queryResults.get(e);if(n===void 0)return;const r=n.result;if(r!==void 0){if(r.success)return r.value;throw r.errorData!==void 0?qC(r,new HC(of("query",n.udfPath,r))):new Error(of("query",n.udfPath,r))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}var Dke=Object.defineProperty,Lke=(t,e,n)=>e in t?Dke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,W1=(t,e,n)=>Lke(t,typeof e!="symbol"?e+"":e,n);class Zs{constructor(e,n){W1(this,"low"),W1(this,"high"),W1(this,"__isUnsignedLong__"),this.low=e|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(e){return(e&&e.__isUnsignedLong__)===!0}static fromBytesLE(e){return new Zs(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24)}toBytesLE(){const e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}static fromNumber(e){return isNaN(e)||e<0?y$:e>=$ke?zke:new Zs(e%Em|0,e/Em|0)}toString(){return(BigInt(this.high)*BigInt(Em)+BigInt(this.low)).toString()}equals(e){return Zs.isLong(e)||(e=Zs.fromValue(e)),this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low}notEquals(e){return!this.equals(e)}comp(e){return Zs.isLong(e)||(e=Zs.fromValue(e)),this.equals(e)?0:e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(e){return this.comp(e)<=0}static fromValue(e){return typeof e=="number"?Zs.fromNumber(e):new Zs(e.low,e.high)}}const y$=new Zs(0,0),b$=65536,Em=b$*b$,$ke=Em*Em,zke=new Zs(-1,-1);var Fke=Object.defineProperty,Uke=(t,e,n)=>e in t?Fke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,My=(t,e,n)=>Uke(t,typeof e!="symbol"?e+"":e,n);class x${constructor(e,n){My(this,"version"),My(this,"remoteQuerySet"),My(this,"queryPath"),My(this,"logger"),this.version={querySet:0,ts:Zs.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=n}transition(e){const n=e.startVersion;if(this.version.querySet!==n.querySet||this.version.ts.notEquals(n.ts)||this.version.identity!==n.identity)throw new Error(`Invalid start version: ${n.ts.toString()}:${n.querySet}`);for(const r of e.modifications)switch(r.type){case"QueryUpdated":{const s=this.queryPath(r.queryId);if(s)for(const a of r.logLines)jx(this.logger,"info","query",s,a);const i=Vf(r.value??null);this.remoteQuerySet.set(r.queryId,{success:!0,value:i,logLines:r.logLines});break}case"QueryFailed":{const s=this.queryPath(r.queryId);if(s)for(const a of r.logLines)jx(this.logger,"info","query",s,a);const{errorData:i}=r;this.remoteQuerySet.set(r.queryId,{success:!1,errorMessage:r.errorMessage,errorData:i!==void 0?Vf(i):void 0,logLines:r.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Y1(t){const e=ig(t);return Zs.fromBytesLE(Array.from(e))}function Bke(t){const e=new Uint8Array(t.toBytesLE());return ag(e)}function Hke(t){switch(t.type){case"FatalError":case"AuthError":case"ActionResponse":case"Ping":return{...t};case"MutationResponse":return t.success?{...t,ts:Y1(t.ts)}:{...t};case"Transition":return{...t,startVersion:{...t.startVersion,ts:Y1(t.startVersion.ts)},endVersion:{...t.endVersion,ts:Y1(t.endVersion.ts)}}}}function qke(t){switch(t.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...t};case"Connect":return t.maxObservedTimestamp!==void 0?{...t,maxObservedTimestamp:Bke(t.maxObservedTimestamp)}:{...t,maxObservedTimestamp:void 0}}}var Vke=Object.defineProperty,Gke=(t,e,n)=>e in t?Vke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ts=(t,e,n)=>Gke(t,typeof e!="symbol"?e+"":e,n);const Wke=1e3,Yke=1001,Kke=1005,Xke=4040;let mb;function gb(){return mb===void 0&&(mb=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(mb+performance.now())}function _$(){return`t=${Math.round((gb()-mb)/100)/10}s`}const G7={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function Qke(t){if(t===void 0)return"Unknown";for(const e of Object.keys(G7))if(t.startsWith(e))return e;return"Unknown"}class Jke{constructor(e,n,r,s,i,a){this.markConnectionStateDirty=i,this.debug=a,ts(this,"socket"),ts(this,"connectionCount"),ts(this,"_hasEverConnected",!1),ts(this,"lastCloseReason"),ts(this,"defaultInitialBackoff"),ts(this,"maxBackoff"),ts(this,"retries"),ts(this,"serverInactivityThreshold"),ts(this,"reconnectDueToServerInactivityTimeout"),ts(this,"uri"),ts(this,"onOpen"),ts(this,"onResume"),ts(this,"onMessage"),ts(this,"webSocketConstructor"),ts(this,"logger"),ts(this,"onServerDisconnectError"),this.webSocketConstructor=r,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=n.onOpen,this.onResume=n.onResume,this.onMessage=n.onMessage,this.onServerDisconnectError=n.onServerDisconnectError,this.logger=s,this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const e=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:e,paused:"no"}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");this.setSocketState({state:"ready",ws:e,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:gb()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",_$(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",_$())),this.connectionCount+=1,this.lastCloseReason=null},e.onerror=n=>{const r=n.message;r&&this.logger.log(`WebSocket error message: ${r}`)},e.onmessage=n=>{this.resetServerInactivityTimeout();const r=n.data.length,s=Hke(JSON.parse(n.data));this._logVerbose(`received ws message with type ${s.type}`),s.type==="Transition"&&this.reportLargeTransition({messageLength:r,transition:s}),this.onMessage(s).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},e.onclose=n=>{if(this._logVerbose("begin ws.onclose"),this.lastCloseReason===null&&(this.lastCloseReason=n.reason||`closed with code ${n.code}`),n.code!==Wke&&n.code!==Yke&&n.code!==Kke&&n.code!==Xke){let s=`WebSocket closed with code ${n.code}`;n.reason&&(s+=`: ${n.reason}`),this.logger.log(s),this.onServerDisconnectError&&n.reason&&this.onServerDisconnectError(s)}const r=Qke(n.reason);this.scheduleReconnect(r)}}socketState(){return this.socket.state}sendMessage(e){const n={type:e.type,...e.type==="Authenticate"&&e.tokenType==="User"?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const r=qke(e),s=JSON.stringify(r);let i=!1;try{this.socket.ws.send(s),i=!0}catch(a){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${a}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${i?"sent":"failed to send"} message with type ${e.type}: ${JSON.stringify(n)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(n)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(e){this.socket={state:"disconnected"};const n=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(n)}ms`),setTimeout(()=>this.connect(),n)}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=e,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const e=this.socket.ws;return new Promise(n=>{e.onclose=()=>{this._logVerbose("Closed after connecting"),n()},e.onopen=()=>{this._logVerbose("Opened after connecting"),e.close()}})}case"ready":{this._logVerbose("ws.close called");const e=this.socket.ws,n=new Promise(r=>{e.onclose=()=>{r()}});return e.close(),n}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const e=this.close();return this.setSocketState({state:"terminated"}),e}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{const e=this.close();return this.socket={state:"stopped"},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:gb()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){const r=(e==="client"?100:e==="Unknown"?this.defaultInitialBackoff:G7[e].timeout)*Math.pow(2,this.retries);this.retries+=1;const s=Math.min(r,this.maxBackoff),i=s*(Math.random()-.5);return s+i}reportLargeTransition({transition:e,messageLength:n}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;const r=gb()-e.clientClockSkew-e.serverTs/1e6,s=`${Math.round(r)}ms`,i=`${Math.round(n/1e4)/100}MB`,a=n/(r/1e3),l=`${Math.round(a/1e4)/100}MB per second`;this._logVerbose(`received ${i} transition in ${s} at ${l}`),n>2e7?this.logger.log(`received query results totaling more that 20MB (${i}) which will take a long time to download on slower connections`):r>2e4&&this.logger.log(`received query results totaling ${i} which took more than 20s to arrive (${s})`),this.debug&&r>2e3&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:r,messageLength:n}})}}function Zke(){return eTe()}function eTe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}class im extends Error{}im.prototype.name="InvalidTokenError";function tTe(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function nTe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return tTe(e)}catch{return atob(e)}}function rTe(t,e){if(typeof t!="string")throw new im("Invalid token specified: must be a string");e||(e={});const n=e.header===!0?0:1,r=t.split(".")[n];if(typeof r!="string")throw new im(`Invalid token specified: missing part #${n+1}`);let s;try{s=nTe(r)}catch(i){throw new im(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(s)}catch(i){throw new im(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var sTe=Object.defineProperty,iTe=(t,e,n)=>e in t?sTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_i=(t,e,n)=>iTe(t,typeof e!="symbol"?e+"":e,n);const aTe=20*24*60*60*1e3,w$=2;class oTe{constructor(e,n,r){_i(this,"authState",{state:"noAuth"}),_i(this,"configVersion",0),_i(this,"syncState"),_i(this,"authenticate"),_i(this,"stopSocket"),_i(this,"tryRestartSocket"),_i(this,"pauseSocket"),_i(this,"resumeSocket"),_i(this,"clearAuth"),_i(this,"logger"),_i(this,"refreshTokenLeewaySeconds"),_i(this,"tokenConfirmationAttempts",0),this.syncState=e,this.authenticate=n.authenticate,this.stopSocket=n.stopSocket,this.tryRestartSocket=n.tryRestartSocket,this.pauseSocket=n.pauseSocket,this.resumeSocket=n.resumeSocket,this.clearAuth=n.clearAuth,this.logger=r.logger,this.refreshTokenLeewaySeconds=r.refreshTokenLeewaySeconds}async setConfig(e,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const r=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});r.isFromOutdatedConfig||(r.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:e,onAuthChange:n},hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:e,onAuthChange:n}}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket())}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid"),this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:n}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(n+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=w$){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${w$-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const n=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});n.isFromOutdatedConfig||(n.value&&this.syncState.isNewAuth(n.value)?(this.authenticate(n.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:n.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(e){if(this.authState.state==="noAuth")return;const n=this.decodeToken(e);if(!n){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:r,exp:s}=n;if(!r||!s){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const i=s-r;if(i<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let a=Math.min(aTe,(i-this.refreshTokenLeewaySeconds)*1e3);a<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${i}s`),a=0);const l=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},a);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:l,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${a}ms`)}async fetchTokenAndGuardAgainstRace(e,n){const r=++this.configVersion;this._logVerbose(`fetching token with config version ${r}`);const s=await e(n);return this.configVersion!==r?(this._logVerbose(`stale config version, expected ${r}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:s}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.setAuthState({state:"noAuth"})}setAuthState(e){const n=e.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(n)}`),e.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&(clearTimeout(this.authState.refetchTokenTimeoutId),this.syncState.markAuthCompletion()),this.authState=e}decodeToken(e){try{return rTe(e)}catch(n){return this._logVerbose(`Error decoding token: ${n instanceof Error?n.message:"Unknown error"}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}}const lTe=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function cTe(t,e){const n={sessionId:e};typeof performance>"u"||!performance.mark||performance.mark(t,{detail:n})}function uTe(t){let e=t.name.slice(6);return e=e.charAt(0).toLowerCase()+e.slice(1),{name:e,startTime:t.startTime}}function dTe(t){if(typeof performance>"u"||!performance.getEntriesByName)return[];const e=[];for(const n of lTe){const r=performance.getEntriesByName(n).filter(s=>s.entryType==="mark").filter(s=>s.detail.sessionId===t);e.push(...r)}return e.map(uTe)}var fTe=Object.defineProperty,hTe=(t,e,n)=>e in t?fTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pr=(t,e,n)=>hTe(t,typeof e!="symbol"?e+"":e,n);class pTe{constructor(e,n,r){if(pr(this,"address"),pr(this,"state"),pr(this,"requestManager"),pr(this,"webSocketManager"),pr(this,"authenticationManager"),pr(this,"remoteQuerySet"),pr(this,"optimisticQueryResults"),pr(this,"_transitionHandlerCounter",0),pr(this,"_nextRequestId"),pr(this,"_onTransitionFns",new Map),pr(this,"_sessionId"),pr(this,"firstMessageReceived",!1),pr(this,"debug"),pr(this,"logger"),pr(this,"maxObservedTimestamp"),pr(this,"connectionStateSubscribers",new Map),pr(this,"nextConnectionStateSubscriberId",0),pr(this,"_lastPublishedConnectionState"),pr(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const v=this.connectionState();if(JSON.stringify(v)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=v;for(const b of this.connectionStateSubscribers.values())b(v)}})}),pr(this,"mark",v=>{this.debug&&cTe(v,this.sessionId)}),typeof e=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");r?.skipConvexDeploymentUrlCheck!==!0&&oke(e),r={...r};const s=r.authRefreshTokenLeewaySeconds??2;let i=r.webSocketConstructor;if(!i&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");i=i||WebSocket,this.debug=r.reportDebugInfoToConvex??!1,this.address=e,this.logger=r.logger===!1?q7({verbose:r.verbose??!1}):r.logger!==!0&&r.logger?r.logger:H7({verbose:r.verbose??!1});const a=e.search("://");if(a===-1)throw new Error("Provided address was not an absolute URL.");const l=e.substring(a+3),c=e.substring(0,a);let d;if(c==="http")d="ws";else if(c==="https")d="wss";else throw new Error(`Unknown parent protocol ${c}`);const p=`${d}://${l}/api/${g$}/sync`;this.state=new kke,this.remoteQuerySet=new x$(v=>this.state.queryPath(v),this.logger),this.requestManager=new Ake(this.logger,this.markConnectionStateDirty);const h=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new oTe(this.state,{authenticate:v=>{const b=this.state.setAuth(v);return this.webSocketManager.sendMessage(b),b.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:h,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:s}),this.optimisticQueryResults=new Pke,this.addOnTransitionHandler(v=>{n(v.queries.map(b=>b.token))}),this._nextRequestId=0,this._sessionId=Zke();const{unsavedChangesWarning:g}=r;if(typeof window>"u"||typeof window.addEventListener>"u"){if(g===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else g!==!1&&window.addEventListener("beforeunload",v=>{if(this.requestManager.hasIncompleteRequests()){v.preventDefault();const b="Are you sure you want to leave? Your changes may not be saved.";return(v||window.event).returnValue=b,b}});this.webSocketManager=new Jke(p,{onOpen:v=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...v,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const b=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new x$(S=>this.state.queryPath(S),this.logger);const[x,E]=this.state.restart(b);E&&this.webSocketManager.sendMessage(E),this.webSocketManager.sendMessage(x);for(const S of this.requestManager.restart())this.webSocketManager.sendMessage(S)},onResume:()=>{const[v,b]=this.state.resume();b&&this.webSocketManager.sendMessage(b),v&&this.webSocketManager.sendMessage(v);for(const x of this.requestManager.resume())this.webSocketManager.sendMessage(x)},onMessage:v=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),v.type){case"Transition":{this.observedTimestamp(v.endVersion.ts),this.authenticationManager.onTransition(v),this.remoteQuerySet.transition(v),this.state.transition(v);const b=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(b);break}case"MutationResponse":{v.success&&this.observedTimestamp(v.ts);const b=this.requestManager.onResponse(v);b!==null&&this.notifyOnQueryResultChanges(new Map([[b.requestId,b.result]]));break}case"ActionResponse":{this.requestManager.onResponse(v);break}case"AuthError":{this.authenticationManager.onAuthError(v);break}case"FatalError":{const b=wke(this.logger,v.error);throw this.webSocketManager.terminate(),b}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:r.onServerDisconnectError},i,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),r.expectAuth&&h()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()||this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){const n=this.remoteQuerySet.remoteQueryResults(),r=new Map;for(const[i,a]of n){const l=this.state.queryToken(i);if(l!==null){const c={result:a,udfPath:this.state.queryPath(i),args:this.state.queryArgs(i)};r.set(l,c)}}const s=this.optimisticQueryResults.ingestQueryResultsFromServer(r,new Set(e.keys()));this.handleTransition({queries:s.map(i=>{const a=this.optimisticQueryResults.rawQueryResult(i);return{token:i,modification:{kind:"Updated",result:a.result}}}),reflectedMutations:Array.from(e).map(([i,a])=>({requestId:i,result:a})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(const n of this._onTransitionFns.values())n(e)}addOnTransitionHandler(e){const n=this._transitionHandlerCounter++;return this._onTransitionFns.set(n,e),()=>this._onTransitionFns.delete(n)}setAuth(e,n){this.authenticationManager.setConfig(e,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,n){const r=this.state.setAdminAuth(e,n);this.webSocketManager.sendMessage(r)}clearAuth(){const e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,n,r){const s=jo(n),{modification:i,queryToken:a,unsubscribe:l}=this.state.subscribe(e,s,r?.journal,r?.componentPath);return i!==null&&this.webSocketManager.sendMessage(i),{queryToken:a,unsubscribe:()=>{const c=l();c&&this.webSocketManager.sendMessage(c)}}}localQueryResult(e,n){const r=jo(n),s=hu(e,r);return this.optimisticQueryResults.queryResult(s)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,n){const r=jo(n),s=hu(e,r);return this.optimisticQueryResults.queryLogs(s)}queryJournal(e,n){const r=jo(n),s=hu(e,r);return this.state.queryJournal(s)}connectionState(){const e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){const n=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(n,e),()=>{this.connectionStateSubscribers.delete(n)}}async mutation(e,n,r){const s=await this.mutationInternal(e,n,r);if(!s.success)throw s.errorData!==void 0?qC(s,new HC(of("mutation",e,s))):new Error(of("mutation",e,s));return s.value}async mutationInternal(e,n,r,s){const{mutationPromise:i}=this.enqueueMutation(e,n,r,s);return i}enqueueMutation(e,n,r,s){const i=jo(n);this.tryReportLongDisconnect();const a=this.nextRequestId;if(this._nextRequestId++,r!==void 0){const p=r.optimisticUpdate;if(p!==void 0){const h=b=>{p(b,i)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},v=this.optimisticQueryResults.applyOptimisticUpdate(h,a).map(b=>{const x=this.localQueryResultByToken(b);return{token:b,modification:{kind:"Updated",result:x===void 0?void 0:{success:!0,value:x,logLines:[]}}}});this.handleTransition({queries:v,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const l={type:"Mutation",requestId:a,udfPath:e,componentPath:s,args:[sc(i)]},c=this.webSocketManager.sendMessage(l),d=this.requestManager.request(l,c);return{requestId:a,mutationPromise:d}}async action(e,n){const r=await this.actionInternal(e,n);if(!r.success)throw r.errorData!==void 0?qC(r,new HC(of("action",e,r))):new Error(of("action",e,r));return r.value}async actionInternal(e,n,r){const s=jo(n),i=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const a={type:"Action",requestId:i,udfPath:e,componentPath:r,args:[sc(s)]},l=this.webSocketManager.sendMessage(a);return this.requestManager.request(a,l)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const e=dTe(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:e})}}tryReportLongDisconnect(){if(!this.debug)return;const e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=60*1e3)return;const n=`${this.address}/api/debug_event`;fetch(n,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${g$}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(r=>{r.ok||this.logger.warn("Analytics request failed with response:",r.body)}).catch(r=>{this.logger.warn("Analytics response failed with error:",r)})}}function mTe({getCurrentValue:t,subscribe:e}){const[n,r]=w.useState(()=>({getCurrentValue:t,subscribe:e,value:t()}));let s=n.value;return(n.getCurrentValue!==t||n.subscribe!==e)&&(s=t(),r({getCurrentValue:t,subscribe:e,value:s})),w.useEffect(()=>{let i=!1;const a=()=>{i||r(c=>{if(c.getCurrentValue!==t||c.subscribe!==e)return c;const d=t();return c.value===d?c:{...c,value:d}})},l=e(a);return a(),()=>{i=!0,l()}},[t,e]),s}var gTe=Object.defineProperty,vTe=(t,e,n)=>e in t?gTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Rl=(t,e,n)=>vTe(t,typeof e!="symbol"?e+"":e,n);const yTe=5e3;if(typeof Ee>"u")throw new Error("Required dependency 'react' not found");function W7(t,e,n){function r(s){return ETe(s),e.mutation(t,s,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(i){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${Ls(t)}`);return W7(t,e,i)},r}function bTe(t,e){return function(n){return e.action(t,n)}}class xTe{constructor(e,n){if(Rl(this,"address"),Rl(this,"cachedSync"),Rl(this,"listeners"),Rl(this,"options"),Rl(this,"closed",!1),Rl(this,"_logger"),Rl(this,"adminAuth"),Rl(this,"fakeUserIdentity"),e===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof e!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=e,this.listeners=new Map,this._logger=n?.logger===!1?q7({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:H7({verbose:n?.verbose??!1}),this.options={...n,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=new pTe(this.address,e=>this.transition(e),this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedSync)}setAuth(e,n){if(typeof e=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(e,n??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,n){if(this.adminAuth=e,this.fakeUserIdentity=n,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(e,n)}watchQuery(e,...n){const[r,s]=n,i=Ls(e);return{onUpdate:a=>{const{queryToken:l,unsubscribe:c}=this.sync.subscribe(i,r,s),d=this.listeners.get(l);return d!==void 0?d.add(a):this.listeners.set(l,new Set([a])),()=>{if(this.closed)return;const p=this.listeners.get(l);p.delete(a),p.size===0&&this.listeners.delete(l),c()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(i,r)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(i,r)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(i,r)}}}prewarmQuery(e){const n=e.extendSubscriptionFor??yTe,s=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(s,n)}mutation(e,...n){const[r,s]=n,i=Ls(e);return this.sync.mutation(i,r,s)}action(e,...n){const r=Ls(e);return this.sync.action(r,...n)}query(e,...n){const r=this.watchQuery(e,...n),s=r.localQueryResult();return s!==void 0?Promise.resolve(s):new Promise((i,a)=>{const l=r.onUpdate(()=>{l();try{i(r.localQueryResult())}catch(c){a(c)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedSync){const e=this.cachedSync;this.cachedSync=void 0,await e.close()}}transition(e){for(const n of e){const r=this.listeners.get(n);if(r)for(const s of r)s()}}}const a_=Ee.createContext(void 0);function _Te(){return w.useContext(a_)}const wTe=({client:t,children:e})=>Ee.createElement(a_.Provider,{value:t},e);function Ix(t,...e){const n=e[0]==="skip",r=e[0]==="skip"?{}:jo(e[0]),s=typeof t=="string"?Tj(t):t,i=Ls(s),a=w.useMemo(()=>n?{}:{query:{query:s,args:r}},[JSON.stringify(sc(r)),i,n]),c=ATe(a).query;if(c instanceof Error)throw c;return c}function Y7(t){const e=typeof t=="string"?Tj(t):t,n=w.useContext(a_);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return w.useMemo(()=>W7(e,n),[n,Ls(e)])}function STe(t){const e=w.useContext(a_),n=Tj(t);if(e===void 0)throw new Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return w.useMemo(()=>bTe(n,e),[e,Ls(n)])}function ETe(t){if(typeof t=="object"&&t!==null&&"bubbles"in t&&"persist"in t&&"isDefaultPrevented"in t)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var kTe=Object.defineProperty,TTe=(t,e,n)=>e in t?kTe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K1=(t,e,n)=>TTe(t,typeof e!="symbol"?e+"":e,n);class CTe{constructor(e){K1(this,"createWatch"),K1(this,"queries"),K1(this,"listeners"),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(const n of Object.keys(e)){const{query:r,args:s}=e[n];if(Ls(r),this.queries[n]===void 0)this.addQuery(n,r,s);else{const i=this.queries[n];(Ls(r)!==Ls(i.query)||JSON.stringify(sc(s))!==JSON.stringify(sc(i.args)))&&(this.removeQuery(n),this.addQuery(n,r,s))}}for(const n of Object.keys(this.queries))e[n]===void 0&&this.removeQuery(n)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){const n={};for(const r of Object.keys(e)){const{query:s,args:i}=e[r];Ls(s);const a=this.createWatch(s,i);let l;try{l=a.localQueryResult()}catch(c){if(c instanceof Error)l=c;else throw c}n[r]=l}return n}setCreateWatch(e){this.createWatch=e;for(const n of Object.keys(this.queries)){const{query:r,args:s,watch:i}=this.queries[n],a=i.journal();this.removeQuery(n),this.addQuery(n,r,s,a)}}destroy(){for(const e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,n,r,s){if(this.queries[e]!==void 0)throw new Error(`Tried to add a new query with identifier ${e} when it already exists.`);const i=this.createWatch(n,r,s),a=i.onUpdate(()=>this.notifyListeners());this.queries[e]={query:n,args:r,watch:i,unsubscribe:a}}removeQuery(e){const n=this.queries[e];if(n===void 0)throw new Error(`No query found with identifier ${e}.`);n.unsubscribe(),delete this.queries[e]}notifyListeners(){for(const e of this.listeners)e()}}function ATe(t){const e=_Te();if(e===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const n=w.useMemo(()=>(r,s,i)=>e.watchQuery(r,s,i?{journal:i}:{}),[e]);return RTe(t,n)}function RTe(t,e){const[n]=w.useState(()=>new CTe(e));n.createWatch!==e&&n.setCreateWatch(e),w.useEffect(()=>()=>n.destroy(),[n]);const r=w.useMemo(()=>({getCurrentValue:()=>n.getLocalResults(t),subscribe:s=>(n.setQueries(t),n.subscribe(s))}),[n,t]);return mTe(r)}const K7=w.createContext(void 0);function ro(){const t=w.useContext(K7);if(t===void 0)throw new Error("Could not find `ConvexProviderWithAuth` (or `ConvexProviderWithClerk` or `ConvexProviderWithAuth0`) as an ancestor component. This component may be missing, or you might have two instances of the `convex/react` module loaded in your project.");return t}function NTe({children:t,client:e,useAuth:n}){const{isLoading:r,isAuthenticated:s,fetchAccessToken:i}=n(),[a,l]=w.useState(null);return r&&a!==null&&l(null),!r&&!s&&a!==!1&&l(!1),Ee.createElement(K7.Provider,{value:{isLoading:a===null,isAuthenticated:s&&(a??!1)}},Ee.createElement(jTe,{authProviderAuthenticated:s,fetchAccessToken:i,authProviderLoading:r,client:e,setIsConvexAuthenticated:l}),Ee.createElement(wTe,{client:e},t),Ee.createElement(MTe,{authProviderAuthenticated:s,fetchAccessToken:i,authProviderLoading:r,client:e,setIsConvexAuthenticated:l}))}function jTe({authProviderAuthenticated:t,fetchAccessToken:e,authProviderLoading:n,client:r,setIsConvexAuthenticated:s}){return w.useEffect(()=>{let i=!0;if(t)return r.setAuth(e,a=>{i&&s(()=>a)}),()=>{i=!1,s(a=>a?!1:null)}},[t,e,n,r,s]),null}function MTe({authProviderAuthenticated:t,fetchAccessToken:e,authProviderLoading:n,client:r,setIsConvexAuthenticated:s}){return w.useEffect(()=>{if(t)return()=>{r.clearAuth(),s(()=>null)}},[t,e,n,r,s]),null}const OTe=t=>{const e=new Map;return t.forEach(n=>{const r=e.get(n.provider)||[];e.set(n.provider,[...r,n])}),e},S$=t=>{switch(t){case"anthropic":return"Anthropic";case"openai":return"OpenAI";case"deepseek":return"DeepSeek";case"google":return"Google AI";case"ollama":return"Ollama";case"meta":return"Meta";case"x-ai":return"xAI";default:return t}};function X7({currentModel:t,availableModels:e,onModelChange:n,disabled:r,isLoading:s,hideProvidedModels:i=!1}){const[a,l]=w.useState(!1),c=t,{isAuthenticated:d}=ro(),p=OTe(e),h=Array.from(p.keys()).sort(),g=i?[]:h.filter(b=>(p.get(b)||[]).some(E=>ia(E.id))),v=h.filter(b=>(p.get(b)||[]).some(E=>!ia(E.id)));return f.jsxs(k0,{open:a,onOpenChange:l,children:[f.jsx(T0,{asChild:!0,children:f.jsx(Pe,{variant:"ghost",size:"sm",disabled:r||s,className:"h-8 px-2 rounded-full hover:bg-muted/80 transition-colors text-xs cursor-pointer",children:f.jsxs(f.Fragment,{children:[f.jsx(H1,{provider:c.provider}),f.jsx("span",{className:"text-[10px] font-medium",children:c.name})]})})}),f.jsxs(C0,{align:"start",className:"min-w-[200px]",children:[g.length>0&&f.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"MCPJam Provided Models"}),g.map(b=>{const E=(p.get(b)||[]).filter(k=>ia(k.id)),S=E.length;return f.jsxs(PP,{children:[f.jsxs(DP,{className:"flex items-center gap-3 text-sm cursor-pointer",children:[f.jsx(H1,{provider:b}),f.jsxs("div",{className:"flex flex-col flex-1",children:[f.jsx("span",{className:"font-medium",children:S$(b)}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:[S," model",S!==1?"s":""]})]})]}),f.jsx(LP,{className:"min-w-[200px] max-h-[180px] overflow-y-auto",avoidCollisions:!0,collisionPadding:8,children:E.map(k=>{const T=ia(k.id),N=!!k.disabled||T&&!d,j=T&&!d?"Sign in to use MCPJam provided models":k.disabledReason,A=f.jsxs(Io,{onSelect:()=>{n(k),l(!1)},className:"flex items-center gap-3 text-sm cursor-pointer",disabled:N,children:[f.jsx("div",{className:"flex flex-col flex-1",children:f.jsx("span",{className:"font-medium",children:k.name})}),k.id===t.id&&f.jsx("div",{className:"ml-auto w-2 h-2 bg-primary rounded-full"})]},k.id);return N?f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx("div",{className:"pointer-events-auto",children:A})}),f.jsx(Fa,{side:"right",children:j})]},k.id):A})})]},b)}),g.length>0&&v.length>0&&f.jsx("div",{className:"my-1 h-px bg-muted/50"}),v.length>0&&f.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"Your providers"}),v.map(b=>{const E=(p.get(b)||[]).filter(k=>!ia(k.id)),S=E.length;return f.jsxs(PP,{children:[f.jsxs(DP,{className:"flex items-center gap-3 text-sm cursor-pointer",children:[f.jsx(H1,{provider:b}),f.jsxs("div",{className:"flex flex-col flex-1",children:[f.jsx("span",{className:"font-medium",children:S$(b)}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:[S," model",S!==1?"s":""]})]})]}),f.jsx(LP,{className:"min-w-[200px] max-h-[180px] overflow-y-auto",avoidCollisions:!0,collisionPadding:8,children:E.map(k=>{const T=!!k.disabled,N=f.jsxs(Io,{onSelect:()=>{n(k),l(!1)},className:"flex items-center gap-3 text-sm cursor-pointer",disabled:T,children:[f.jsx("div",{className:"flex flex-col flex-1",children:f.jsx("span",{className:"font-medium",children:k.name})}),k.id===t.id&&f.jsx("div",{className:"ml-auto w-2 h-2 bg-primary rounded-full"})]},k.id);return T?f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx("div",{className:"pointer-events-auto",children:N})}),f.jsx(Fa,{side:"right",children:k.disabledReason})]},k.id):N})})]},b)})]})]})}function ITe({className:t,defaultValue:e,value:n,min:r=0,max:s=100,...i}){const a=w.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,s],[n,e,r,s]);return f.jsxs(Fre,{"data-slot":"slider",defaultValue:e,value:n,min:r,max:s,className:Me("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",t),...i,children:[f.jsx(Ure,{"data-slot":"slider-track",className:Me("bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:f.jsx(Bre,{"data-slot":"slider-range",className:Me("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:a.length},(l,c)=>f.jsx(Hre,{"data-slot":"slider-thumb",className:"border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},c))]})}function PTe({systemPrompt:t,onSystemPromptChange:e,temperature:n,onTemperatureChange:r,disabled:s,isLoading:i}){const[a,l]=w.useState(!1),[c,d]=w.useState(t),[p,h]=w.useState(n),g=x=>{l(x),x&&(d(t),h(n))},v=()=>{e(c),r(p),l(!1),Pt.success("System prompt and temperature updated")},b=()=>{d(t),h(n),l(!1)};return f.jsxs(fa,{open:a,onOpenChange:g,children:[f.jsx(yR,{asChild:!0,children:f.jsxs(Pe,{variant:"ghost",size:"sm",disabled:s||i,className:"h-8 px-2 rounded-full hover:bg-muted/80 transition-colors text-xs cursor-pointer",children:[f.jsx(Vie,{className:"h-2 w-2 mr-1"}),f.jsx("span",{className:"text-[10px] font-medium",children:"System Prompt & Temperature"})]})}),f.jsxs(ha,{className:"sm:max-w-md",children:[f.jsx(pa,{children:f.jsx(ma,{children:"System Prompt & Temperature"})}),f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx("label",{className:"text-sm font-medium",children:"System Prompt"}),f.jsx(Zo,{value:c,onChange:x=>d(x.target.value),placeholder:"You are a helpful assistant with access to MCP tools.",className:"h-[140px] resize-none"})]}),f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("label",{className:"text-sm font-medium",children:"Temperature"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:p.toFixed(1)})]}),f.jsx(ITe,{value:[p],onValueChange:x=>h(x[0]),min:0,max:2,step:.1,className:"w-full"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Lower values (0-0.3) for focused tasks, higher values (0.7-2.0) for creative tasks"})]}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx(Pe,{variant:"ghost",onClick:b,className:"cursor-pointer",children:"Cancel"}),f.jsx(Pe,{onClick:v,className:"cursor-pointer",children:"Save"})]})]})]})]})}function E$({value:t,onChange:e,onSubmit:n,onStop:r,disabled:s=!1,isLoading:i=!1,placeholder:a="Type your message...",className:l,showScrollToBottom:c=!1,onScrollToBottom:d,currentModel:p,availableModels:h,onModelChange:g,systemPrompt:v,onSystemPromptChange:b,temperature:x,onTemperatureChange:E,isSendBlocked:S=!1}){const k=w.useRef(null),T=w.useRef(null),[N,j]=w.useState([]),[A,R]=w.useState([]),M=p;w.useEffect(()=>{P()},[t]);const P=()=>{k.current&&(k.current.style.height="auto",k.current.style.height=`${Math.min(k.current.scrollHeight,120)}px`)},O=()=>{k.current&&(k.current.style.height="auto")},L=w.useCallback(()=>{!t.trim()||s||i||A.length>0||S||(n(t.trim(),N.length>0?N:void 0),e(""),j([]),O(),setTimeout(()=>{k.current?.focus()},0))},[t,s,i,A.length,n,N,e,S]),z=X=>{X.key==="Enter"&&!X.shiftKey&&!X.nativeEvent.isComposing&&(X.preventDefault(),L())},G=w.useCallback(async X=>{const F=Array.from(X.target.files||[]);if(F.length!==0){R(F.map(Y=>Y.name));try{const Y=await Promise.all(F.map(async V=>(await new Promise(te=>setTimeout(te,1e3)),{id:Math.random().toString(36).substr(2,9),name:V.name,url:URL.createObjectURL(V),contentType:V.type,size:V.size})));j(V=>[...V,...Y])}catch(Y){console.error("Error uploading files:",Y)}finally{R([]),T.current&&(T.current.value="")}}},[]),W=X=>{j(F=>F.filter(Y=>Y.id!==X))};return f.jsxs("div",{className:"relative w-full",children:[f.jsx(Ex,{children:c&&f.jsx(ri.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:"absolute left-1/2 bottom-full mb-4 -translate-x-1/2 z-50",children:f.jsx(Pe,{size:"sm",variant:"outline",className:"rounded-full shadow-lg cursor-pointer",onClick:d,children:f.jsx(kse,{className:"h-4 w-4"})})})}),f.jsx("input",{ref:T,type:"file",multiple:!0,className:"hidden",onChange:G,accept:"image/*,.pdf,.txt,.json,.csv"}),(N.length>0||A.length>0)&&f.jsxs("div",{className:"mb-3 flex flex-wrap gap-2",children:[N.map(X=>f.jsxs("div",{className:"flex items-center gap-2 bg-muted px-3 py-2 rounded-lg text-sm",children:[f.jsx("span",{className:"truncate max-w-[200px]",children:X.name}),f.jsx("button",{onClick:()=>W(X.id),className:"text-muted-foreground hover:text-foreground cursor-pointer",children:"×"})]},X.id)),A.map(X=>f.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 px-3 py-2 rounded-lg text-sm animate-pulse",children:[f.jsx("span",{className:"truncate max-w-[200px]",children:X}),f.jsx("div",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"})]},X))]}),f.jsxs("div",{className:"relative",children:[f.jsx(Zo,{ref:k,value:t,onChange:X=>{S||e(X.target.value)},onKeyDown:z,placeholder:a,disabled:s,readOnly:s||S,className:HT("min-h-[56px] max-h-[120px] resize-none pl-16 pr-14 py-4 rounded-3xl","border-border/30 bg-background/50 focus-visible:border-border/50","focus-visible:ring-0 focus-visible:ring-offset-0","transition-all duration-200 ease-in-out overflow-y-auto","text-base placeholder:text-muted-foreground/60",S?"cursor-not-allowed bg-muted/30 text-muted-foreground":"",l),rows:1,autoFocus:!S}),f.jsx("div",{className:"absolute bottom-3 left-4 flex items-center gap-1",children:f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-full hover:bg-muted/80 transition-colors cursor-pointer",onClick:()=>T.current?.click(),disabled:s||i||S,children:f.jsx(Oie,{size:16})})}),f.jsx(Fa,{children:"Add files"})]})}),f.jsx("div",{className:"absolute bottom-3 right-4 flex items-center gap-1",children:i?f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{type:"button",size:"sm",variant:"outline",className:"h-8 w-8 p-0 rounded-full border-border/30 hover:border-border/50 transition-colors cursor-pointer",onClick:r,children:f.jsx(tae,{size:16})})}),f.jsx(Fa,{children:"Stop generating"})]}):f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{type:"button",size:"sm",className:HT("h-8 w-8 p-0 rounded-full transition-all duration-200 cursor-pointer",t.trim()&&!s&&A.length===0&&!S?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm":"bg-muted text-muted-foreground cursor-not-allowed"),onClick:L,disabled:!t.trim()||s||A.length>0||S,children:f.jsx(WB,{size:16})})}),f.jsx(Fa,{children:"Send message"})]})})]}),f.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[h.length>0&&M&&f.jsx(X7,{currentModel:M,availableModels:h,onModelChange:g,disabled:!1,isLoading:i}),b&&E&&f.jsx(PTe,{systemPrompt:v||"You are a helpful assistant with access to MCP tools.",onSystemPromptChange:b,temperature:x||0,onTemperatureChange:E,disabled:s,isLoading:i})]})]})}function DTe({serverConfigs:t,connectedServerConfigs:e,systemPrompt:n=""}){const r=w.useRef(null),[s,i]=w.useState(!0),{isAuthenticated:a}=ro(),{signUp:l}=va(),c=ga(),[d,p]=w.useState(n||"You are a helpful assistant with access to MCP tools."),[h,g]=w.useState(1),[v,b]=w.useState({}),E=Object.keys(t||{}).filter(ae=>e?.[ae]?.connectionStatus==="connected"),S=E.length===0,{messages:k,isLoading:T,error:N,input:j,setInput:A,sendMessage:R,stopGeneration:M,regenerateMessage:P,clearChat:O,model:L,availableModels:z,setModel:G,elicitationRequest:W,elicitationLoading:X,handleElicitationResponse:F}=Xq({systemPrompt:d,temperature:h,selectedServers:E,onError:ae=>{Pt.error(ae)}}),V=(L?ia(L.id):!1)&&!a,te="Sign in to use MCPJam provided models";w.useEffect(()=>{V&&A("")},[V,A]),w.useEffect(()=>{const ae=localStorage.getItem("chat-selected-model");if(ae&&z.length>0){const B=z.find(J=>J.id===ae);B&&(!L||L.id!==ae)&&G(B)}},[z]),w.useEffect(()=>{L&&localStorage.setItem("chat-selected-model",L.id)},[L]),w.useEffect(()=>{L&&g(Sfe(L))},[L]),w.useEffect(()=>{const ae=async()=>{const B={};for(const J of E)try{const oe=await QR(J);oe.toolsMetadata&&Object.assign(B,oe.toolsMetadata)}catch(oe){console.error(`Failed to fetch tools for server ${J}:`,oe)}b(B)};E&&E.length>0?ae():b({})},[JSON.stringify(E)]);const I=k.length>0,re=V||S,ue=V?"Sign in to use free chat":"Connect an MCP server to send your first message",D=[{label:"Available tools",value:"What tools are available?",icon:JB}];w.useEffect(()=>{s&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[k,s]);const Z=()=>{if(!r.current)return;const{scrollTop:ae,scrollHeight:B,clientHeight:J}=r.current,fe=B-ae-J<100;i(fe)},he=ae=>{navigator.clipboard.writeText(ae)},q=async(ae,B)=>{try{const oe=await(await fetch("/api/mcp/tools/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolName:ae,parameters:B,...E.length===1?{serverId:E[0]}:{}})})).json();return console.log("handleCallTool",oe),oe.result}catch(J){throw console.error("handleCallTool",J),J}},U=ae=>{A(ae),R(ae)},K=(ae,B)=>f.jsxs("div",{className:"flex flex-col h-screen",children:[f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-4",children:[f.jsx(ri.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.35},className:"w-full max-w-xl space-y-6 text-center",children:ae}),f.jsxs(ri.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.35,delay:.05},className:"w-full max-w-2xl pt-10",children:[f.jsx(E$,{value:j,onChange:A,onSubmit:()=>{c.capture("send_message",{location:"chat_tab",platform:Ii(),environment:void 0,model_id:L?.id??null,model_name:L?.name??null,model_provider:L?.provider??null}),R(j)},onStop:M,disabled:z.length===0||B.disabled,isLoading:T,placeholder:B.placeholder,className:"border shadow-sm",currentModel:L||null,availableModels:z,onModelChange:G,onClearChat:O,hasMessages:!1,systemPrompt:d,onSystemPromptChange:p,temperature:h,onTemperatureChange:g,isSendBlocked:V}),z.length===0&&f.jsx(ri.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.25},className:"mt-3 text-center text-xs text-muted-foreground",children:"Configure API keys in Settings or start Ollama to enable chat"})]})]}),f.jsx(UT,{elicitationRequest:W,onResponse:F,loading:X})]});if(!I&&re)return K(V?f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx("h2",{className:"text-base font-medium",children:"Create an account to use free models"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"or bring your own API key in the settings tab"})]}),f.jsx("div",{className:"flex justify-center gap-2",children:f.jsx(Pe,{onClick:()=>{c.capture("create_account",{location:"chat_tab",platform:Ii(),environment:void 0}),l()},style:{backgroundColor:"#E55A3A"},className:"hover:opacity-90 cursor-pointer",children:"Create account"})})]}):f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"space-y-1",children:f.jsx("h2",{className:"text-base font-medium",children:"You must connect to an MCP server"})}),f.jsxs("div",{className:"flex justify-center gap-2 text-xs text-muted-foreground",children:[f.jsxs("a",{href:"#servers",className:"inline-flex items-center gap-1 rounded-full border px-3 py-1 transition hover:bg-muted/30",children:[f.jsx(Bse,{className:"h-3 w-3"})," Add server"]}),f.jsxs("a",{href:"#settings",className:"inline-flex items-center gap-1 rounded-full border px-3 py-1 transition hover:bg-muted/30",children:[f.jsx(vR,{className:"h-3 w-3"})," Settings"]})]})]}),{placeholder:ue,disabled:!0});if(!I){const ae=f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-1",children:[f.jsx("h2",{className:"text-base font-medium",children:"Test your servers"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Start typing or choose a quick suggestion to begin."})]}),f.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:D.map(({label:B,value:J,icon:oe})=>f.jsxs("button",{type:"button",onClick:()=>A(J),className:"inline-flex items-center gap-2 rounded-full border border-border/60 px-3 py-1.5 text-xs transition hover:border-border hover:bg-muted/40 cursor-pointer",children:[f.jsx(oe,{className:"h-3.5 w-3.5 text-muted-foreground"}),B]},B))})]});return K(ae,{placeholder:"Send a message...",disabled:!1})}return f.jsx(E0,{children:f.jsxs("div",{className:"relative bg-background h-screen overflow-hidden",children:[f.jsx("div",{ref:r,onScroll:Z,className:"h-full overflow-y-auto pb-40",children:f.jsx("div",{className:"max-w-4xl mx-auto px-4 pt-8 pb-8",children:f.jsxs(Ex,{mode:"popLayout",children:[k.map((ae,B)=>f.jsx(ri.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,delay:B*.05},className:"mb-8",children:f.jsx(eke,{message:ae,model:L||null,isLoading:T&&B===k.length-1,onEdit:()=>{},onRegenerate:P,onCopy:he,showActions:!0,serverConfigs:t,onCallTool:q,onSendFollowup:U,toolsMetadata:v,serverId:E.length===1?E[0]:void 0})},ae.id)),T&&k.length>0&&k[k.length-1].role==="user"&&f.jsx(ri.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mb-8",children:f.jsxs("div",{className:"flex gap-4 items-start",children:[f.jsx("div",{className:"w-8 h-8 flex items-center rounded-full justify-center bg-muted/50 shrink-0",children:f.jsx(XB,{className:"h-4 w-4 text-muted-foreground"})}),f.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"Thinking"}),f.jsxs("div",{className:"flex space-x-1",children:[f.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce"}),f.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce delay-100"}),f.jsx("div",{className:"w-1.5 h-1.5 bg-muted-foreground/60 rounded-full animate-bounce delay-200"})]})]})]})})]})})}),f.jsx(Ex,{children:N&&f.jsx(ri.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},className:"absolute bottom-40 left-0 right-0 px-4 py-3 bg-destructive/5 border-t border-destructive/10 z-10",children:f.jsx("div",{className:"max-w-4xl mx-auto",children:f.jsx("p",{className:"text-sm text-destructive",children:N})})})}),f.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border/50 bg-background/80 backdrop-blur-sm",children:f.jsx("div",{className:"max-w-4xl mx-auto p-4",children:f.jsx("div",{children:f.jsx(E$,{value:j,onChange:A,onSubmit:(ae,B)=>{c.capture("send_message",{location:"chat_tab",platform:Ii(),environment:void 0,model_id:L?.id??null,model_name:L?.name??null,model_provider:L?.provider??null}),R(ae,B)},onStop:M,disabled:z.length===0||S||V,isLoading:T,placeholder:V?te:"Send a message...",className:"border-2 shadow-sm",currentModel:L,availableModels:z,onModelChange:G,onClearChat:O,hasMessages:I,systemPrompt:d,onSystemPromptChange:p,temperature:h,onTemperatureChange:g,isSendBlocked:V})})})}),f.jsx(UT,{elicitationRequest:W,onResponse:F,loading:X})]})})}function Q7(t,e,n){const r=n.reduce((i,a)=>(a.status==="pending"||a.status==="running"||a.result==="pending"?i.pending+=1:a.result==="passed"?i.passed+=1:a.result==="failed"?i.failed+=1:a.result==="cancelled"&&(i.cancelled+=1),i.tokens+=a.tokensUsed||0,i),{passed:0,failed:0,cancelled:0,pending:0,tokens:0}),s=new Map;for(const i of n){const a=i.testCaseId;if(!a)continue;if(!s.has(a)){const c=e.find(p=>p._id===a),d=n.filter(p=>p.testCaseId===a).length;s.set(a,{testCaseId:a,title:c?.title||"Untitled",provider:c?.provider||"",model:c?.model||"",runs:d,passed:0,failed:0,cancelled:0,tokens:0})}const l=s.get(a);i.status==="pending"||i.status==="running"||i.result==="pending"||(i.result==="passed"?l.passed+=1:i.result==="failed"?l.failed+=1:i.result==="cancelled"&&(l.cancelled+=1)),l.tokens+=i.tokensUsed||0}return{filteredIterations:n,totals:r,byCase:Array.from(s.values())}}function LTe(t,e,n,r){const s=[];return t>0&&s.push(`${t} passed`),e>0&&s.push(`${e} failed`),n>0&&s.push(`${n} cancelled`),r>0&&s.push(`${r} pending`),s.join(" · ")||"No results"}function $Te({suite:t,onSelectSuite:e}){const{isAuthenticated:n}=ro(),{user:r}=va(),s=t.config?.environment.servers,a=Ix("evals:getAllTestCasesAndIterationsBySuite",n&&!!r?{suiteId:t._id}:"skip"),l=w.useMemo(()=>a?Q7(t,a.testCases,a.iterations):null,[t,a]),c=Array.isArray(t.config?.tests)?t.config.tests.length:0,d=w.useMemo(()=>{if(!Array.isArray(s))return[];const g=s.filter(b=>typeof b=="string").map(b=>b.trim()).filter(Boolean);if(g.length<=2)return g;const v=g.length-2;return[...g.slice(0,2),`+${v} more`]},[s]),p=l?.filteredIterations.length??0,h=()=>{if(!l)return"bg-zinc-300/50";const{passed:g,failed:v,cancelled:b,pending:x}=l.totals;if(g+v+b+x===0)return"bg-zinc-300/50";const S=g+v;if(S===0)return"bg-zinc-300/50";const k=v/S*100;return k===0?"bg-emerald-500/50":k<=30?"bg-amber-500/50":"bg-red-500/50"};return f.jsxs("button",{onClick:()=>e(t._id),className:"group relative flex w-full items-center gap-4 py-3 pl-4 pr-4 text-left transition-colors hover:bg-muted/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 cursor-pointer",children:[f.jsx("div",{className:`absolute left-0 top-0 h-full w-1 ${h()}`}),f.jsxs("div",{className:"grid min-w-0 flex-1 grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] items-center gap-4",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-foreground",children:new Date(t._creationTime||0).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0})}),f.jsx("div",{className:"text-xs text-muted-foreground",children:d.length>0?d.join(", "):"No servers"})]}),f.jsxs("div",{className:"text-sm text-muted-foreground",children:[c," test",c!==1?"s":""," · ",p," ","iteration",p!==1?"s":""]}),f.jsx("div",{className:"text-sm text-muted-foreground",children:l?LTe(l.totals.passed,l.totals.failed,l.totals.cancelled,l.totals.pending):"Loading..."})]})]})}function zTe({suites:t,onSelectSuite:e}){if(t.length===0)return f.jsx("div",{className:"h-[calc(100vh-220px)] flex items-center justify-center rounded-xl border border-dashed",children:f.jsxs("div",{className:"text-center space-y-2",children:[f.jsx("div",{className:"text-lg font-semibold",children:"No evaluation suites yet"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Trigger a test run to see your evaluation history here."})]})});const n=[...t].sort((r,s)=>(s._creationTime||0)-(r._creationTime||0));return f.jsx("div",{className:"space-y-4",children:f.jsxs("div",{className:"overflow-hidden rounded-xl border",children:[f.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] items-center gap-4 border-b bg-muted/50 px-4 py-2 text-xs font-semibold text-muted-foreground",children:[f.jsx("div",{children:"Created"}),f.jsx("div",{children:"Tests"}),f.jsx("div",{children:"Results"})]}),f.jsx("div",{className:"divide-y",children:n.map(r=>f.jsx($Te,{suite:r,onSelectSuite:e},r._id))})]})})}function FTe({iteration:t,testCase:e}){const n=STe("evals:getEvalTestBlob"),[r,s]=w.useState(null),[i,a]=w.useState(!1),[l,c]=w.useState(null);return w.useEffect(()=>{let d=!1;async function p(){if(!t.blob){s(null),a(!1),c(null);return}a(!0),c(null);try{const h=await n({blobId:t.blob});d||s(h)}catch(h){d||(c(h?.message||"Failed to load blob"),console.error("Blob load error:",h))}finally{d||a(!1)}}return p(),()=>{d=!0}},[t.blob,n]),f.jsxs("div",{className:"space-y-3 py-2",children:[(e?.expectedToolCalls.length||0)>0&&f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("div",{className:"text-xs font-semibold",children:"Expected tools"}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:e?.expectedToolCalls.map((d,p)=>f.jsx(br,{variant:"outline",className:"font-mono text-xs",children:d},p))})]}),t.actualToolCalls.length>0&&f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("div",{className:"text-xs font-semibold",children:"Actual tools called"}),f.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actualToolCalls.map((d,p)=>f.jsx(br,{variant:"outline",className:"font-mono text-xs",children:d},p))})]}),t.blob&&f.jsxs("div",{className:"space-y-1.5",children:[f.jsx("div",{className:"text-xs font-semibold",children:"Trace"}),f.jsx("div",{className:"rounded-md bg-muted/20 p-3",children:i?f.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading trace"}):l?f.jsx("div",{className:"text-xs text-red-600",children:l}):f.jsx("pre",{className:"max-h-[360px] overflow-auto whitespace-pre-wrap break-words text-xs",children:JSON.stringify(r,null,2)})})]})]})}function UTe({suite:t,cases:e,iterations:n,aggregate:r,onBack:s}){const[i,a]=w.useState(null),[l,c]=w.useState(new Set),d=w.useMemo(()=>{const h=new Map,g=x=>{const E={runs:x.length,passed:0,failed:0,cancelled:0,pending:0,tokens:0,avgDuration:null};let S=0,k=0;return x.forEach(T=>{T.result==="passed"?E.passed+=1:T.result==="failed"?E.failed+=1:T.result==="cancelled"?E.cancelled+=1:E.pending+=1,E.tokens+=T.tokensUsed||0;const N=T.startedAt??T.createdAt,j=T.updatedAt??T.createdAt;if(N&&j){const A=Math.max(j-N,0);S+=A,k+=1}}),k>0&&(E.avgDuration=S/k),E};e.forEach(x=>{h.set(x._id,{testCase:x,iterations:[],summary:{runs:0,passed:0,failed:0,cancelled:0,pending:0,tokens:0,avgDuration:null}})});const v={testCase:null,iterations:[],summary:{runs:0,passed:0,failed:0,cancelled:0,pending:0,tokens:0,avgDuration:null}};n.forEach(x=>{const E=x.testCaseId?h.get(x.testCaseId):void 0;E?E.iterations.push(x):v.iterations.push(x)});const b=e.map(x=>{const E=h.get(x._id),S=[...E.iterations].sort((k,T)=>k.iterationNumber!=null&&T.iterationNumber!=null?k.iterationNumber-T.iterationNumber:(k.createdAt??0)-(T.createdAt??0));return{...E,iterations:S,summary:g(S)}});if(v.iterations.length>0){const x=[...v.iterations].sort((E,S)=>E.iterationNumber!=null&&S.iterationNumber!=null?E.iterationNumber-S.iterationNumber:(E.createdAt??0)-(S.createdAt??0));b.push({...v,iterations:x,summary:g(x)})}return b},[e,n]),p=h=>h==="passed"?"bg-emerald-500/50":h==="failed"?"bg-red-500/50":h==="cancelled"?"bg-zinc-300/50":"bg-amber-500/50";return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{children:f.jsx(Pe,{variant:"ghost",size:"sm",onClick:s,children:"← Back to suites"})}),f.jsx("div",{className:"space-y-4",children:d.map((h,g)=>{const{testCase:v,iterations:b}=h,x=b.length>0,E=v?._id??`unassigned-${g}`,S=l.has(E),k=100,T=v?.query&&v.query.length>k,N=T&&!S?v.query.slice(0,k)+"...":v?.query,j=()=>{c(A=>{const R=new Set(A);return R.has(E)?R.delete(E):R.add(E),R})};return f.jsxs("div",{className:"overflow-hidden rounded-xl border",children:[f.jsx("div",{className:"border-b bg-muted/50 px-4 py-2.5",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-semibold pr-2",children:v?v.title:"Unassigned iterations"}),v?.provider?f.jsx(f.Fragment,{children:f.jsx("span",{className:"text-xs text-muted-foreground",children:v.provider})}):null,v?.model?f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-muted-foreground",children:"•"}),f.jsx("span",{className:"text-xs text-muted-foreground",children:v.model})]}):null]}),v?.query?f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsxs("p",{className:"text-xs text-muted-foreground italic flex-1",children:['"',N,'"']}),T?f.jsx("button",{onClick:j,className:"text-xs text-primary hover:underline focus:outline-none whitespace-nowrap",children:S?"Show less":"Show more"}):null]}):null]})}),x?f.jsx("div",{className:"divide-y",children:b.map(A=>{const R=i===A._id,M=A.startedAt??A.createdAt,P=A.updatedAt??A.createdAt,O=M&&P?Math.max(P-M,0):null,L=A.result==="pending";return f.jsxs("div",{className:`relative ${L?"opacity-60":""}`,children:[f.jsx("div",{className:`absolute left-0 top-0 h-full w-1 ${p(A.result)}`}),f.jsx("button",{onClick:()=>{L||a(z=>z===A._id?null:A._id)},disabled:L,className:`flex w-full items-center gap-4 px-4 py-3 text-left transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 ${L?"cursor-not-allowed":"cursor-pointer hover:bg-muted/50"}`,children:f.jsxs("div",{className:"grid min-w-0 flex-1 grid-cols-[auto_1fr_auto_auto] items-center gap-4 pl-3",children:[f.jsx("div",{className:"text-muted-foreground",children:L?f.jsx(Ka,{className:"h-4 w-4"}):R?f.jsx(Lu,{className:"h-4 w-4"}):f.jsx(Ka,{className:"h-4 w-4"})}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("span",{className:"text-sm font-medium",children:["Iteration #",A.iterationNumber]}),L?f.jsx(Su,{className:"h-4 w-4 animate-spin text-amber-600"}):null]}),f.jsx("div",{className:"text-sm text-muted-foreground",children:L?"—":`${Number(A.tokensUsed||0).toLocaleString()} tokens`}),f.jsx("div",{className:"text-sm text-muted-foreground",children:L?"—":O!==null?BTe(O):"—"})]})}),R&&!L?f.jsx("div",{className:"border-t bg-muted/20 px-4 pb-4 pt-3 pl-8",children:f.jsx(FTe,{iteration:A,testCase:v})}):null]},A._id)})}):f.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No iterations recorded for this test case yet."})]},E)})})]})}function BTe(t){if(t<1e3)return`${t}ms`;const e=Math.round(t/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/60),r=e%60;if(n<60)return r?`${n}m ${r}s`:`${n}m`;const s=Math.floor(n/60),i=n%60;return i?`${s}h ${i}m`:`${s}h`}function HTe(){const{isAuthenticated:t,isLoading:e}=ro(),{user:n}=va(),[r,s]=w.useState(null),i=t&&!!n,a=Ix("evals:getCurrentUserEvalTestSuitesWithMetadata",i?{}:"skip"),l=t&&!!n&&!!r,c=Ix("evals:getAllTestCasesAndIterationsBySuite",l?{suiteId:r}:"skip"),d=a?.testSuites,p=a===void 0,h=l&&c===void 0,g=w.useMemo(()=>!r||!d?null:d.find(x=>x._id===r)??null,[r,d]),v=w.useMemo(()=>c?[...c.iterations].sort((x,E)=>(E.startedAt||E.createdAt)-(x.startedAt||x.createdAt)):[],[c]),b=w.useMemo(()=>!g||!c?null:Q7(g,c.testCases,c.iterations),[g,c]);return e?f.jsx("div",{className:"p-6",children:f.jsx("div",{className:"flex h-64 items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto h-8 w-8 animate-spin rounded-full border-b-2 border-primary"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Loading..."})]})})}):!t||!n?f.jsx("div",{className:"p-6",children:f.jsx(dh,{icon:KB,title:"Sign in to view your evals",description:"Create an account or sign in to see previous runs and metrics.",className:"h-[calc(100vh-200px)]"})}):p&&i?f.jsx("div",{className:"p-6",children:f.jsx("div",{className:"flex h-64 items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto h-8 w-8 animate-spin rounded-full border-b-2 border-primary"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Loading your eval data..."})]})})}):f.jsxs("div",{className:"space-y-6 p-6",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsx("h1",{className:"text-2xl font-semibold",children:"Evaluation results"})}),g?h?f.jsx("div",{className:"flex h-64 items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto h-8 w-8 animate-spin rounded-full border-b-2 border-primary"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Loading suite details..."})]})}):f.jsx(UTe,{suite:g,cases:c?.testCases||[],iterations:v,aggregate:b,onBack:()=>s(null)}):f.jsx(zTe,{suites:d||[],onSelectSuite:s})]})}const qTe="modulepreload",VTe=function(t){return"/"+t},k$={},GTe=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let d=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};var a=d;document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=l?.nonce||l?.getAttribute("nonce");s=d(n.map(p=>{if(p=VTe(p),p in k$)return;k$[p]=!0;const h=p.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":qTe,h||(v.as="script"),v.crossOrigin="",v.href=p,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((b,x)=>{v.addEventListener("load",b),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${p}`)))})}))}function i(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&i(c.reason);return e().catch(i)})},VC={servers:{},selectedServer:"none",selectedMultipleServers:[],isMultiSelectMode:!1},Ip=(t,e,n={})=>({...t,connectionStatus:e,...n});function WTe(t,e){switch(e.type){case"HYDRATE_STATE":return e.payload;case"UPSERT_SERVER":return{...t,servers:{...t.servers,[e.name]:e.server}};case"CONNECT_REQUEST":{const n=t.servers[e.name],r=n?Ip(n,"connecting",{enabled:!0}):{name:e.name,config:e.config,lastConnectionTime:new Date,connectionStatus:"connecting",retryCount:0,enabled:!0};return{...t,servers:{...t.servers,[e.name]:{...r,config:e.config}},selectedServer:e.select?e.name:t.selectedServer}}case"CONNECT_SUCCESS":{const n=t.servers[e.name];return n?{...t,servers:{...t.servers,[e.name]:Ip(n,"connected",{config:e.config,lastConnectionTime:new Date,retryCount:0,lastError:void 0,oauthTokens:e.tokens??n.oauthTokens,enabled:!0})}}:t}case"CONNECT_FAILURE":{const n=t.servers[e.name];return n?{...t,servers:{...t.servers,[e.name]:Ip(n,"failed",{retryCount:n.retryCount,lastError:e.error})}}:t}case"RECONNECT_REQUEST":{const n=t.servers[e.name];return n?{...t,servers:{...t.servers,[e.name]:Ip(n,"connecting",{enabled:!0})}}:t}case"DISCONNECT":{const n=t.servers[e.name];if(!n)return t;const r=t.selectedServer===e.name?"none":t.selectedServer;return{...t,servers:{...t.servers,[e.name]:Ip(n,"disconnected",{enabled:!1,lastError:e.error??n.lastError})},selectedServer:r,selectedMultipleServers:t.selectedMultipleServers.filter(s=>s!==e.name)}}case"REMOVE_SERVER":{const{[e.name]:n,...r}=t.servers;return{...t,servers:r,selectedServer:t.selectedServer===e.name?"none":t.selectedServer,selectedMultipleServers:t.selectedMultipleServers.filter(s=>s!==e.name)}}case"SYNC_AGENT_STATUS":{const n=new Map(e.servers.map(s=>[s.id,s.status])),r={};for(const[s,i]of Object.entries(t.servers)){if(i.connectionStatus==="connecting"||i.connectionStatus==="oauth-flow"){r[s]=i;continue}const l=n.get(s);l?r[s]={...i,connectionStatus:l}:r[s]={...i,connectionStatus:"disconnected"}}return{...t,servers:r}}case"SELECT_SERVER":return{...t,selectedServer:e.name};case"SET_MULTI_SELECTED":return{...t,selectedMultipleServers:e.names};case"SET_MULTI_MODE":return{...t,isMultiSelectMode:e.enabled,selectedMultipleServers:e.enabled?[]:t.selectedMultipleServers};default:return t}}const J7="mcp-inspector-state";function YTe(t){const e=t.config;let n=e;if(e&&typeof e.url=="string")try{n={...e,url:new URL(e.url)}}catch{}return{...t,config:n,connectionStatus:t.connectionStatus||"disconnected",retryCount:t.retryCount||0,lastConnectionTime:t.lastConnectionTime?new Date(t.lastConnectionTime):new Date,enabled:t.enabled!==!1}}function KTe(){try{const t=localStorage.getItem(J7);if(!t)return VC;const e=JSON.parse(t);return{servers:Object.fromEntries(Object.entries(e.servers||{}).map(([r,s])=>[r,YTe(s)])),selectedServer:e.selectedServer||"none",selectedMultipleServers:e.selectedMultipleServers||[],isMultiSelectMode:e.isMultiSelectMode||!1}}catch{return VC}}function XTe(t){const e={...t,servers:Object.fromEntries(Object.entries(t.servers).map(([n,r])=>{const s=r.config,i=s&&s.url instanceof URL?{...s,url:s.url.toString()}:s;return[n,{...r,config:i}]}))};localStorage.setItem(J7,JSON.stringify(e))}async function Oy(t,e){return(await fetch("/api/mcp/connect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverConfig:t,serverId:e})})).json()}async function QTe(t){return(await fetch(`/api/mcp/servers/${encodeURIComponent(t)}`,{method:"DELETE"})).json()}async function JTe(){return(await fetch("/api/mcp/servers")).json()}async function ZTe(t,e){return(await fetch("/api/mcp/servers/reconnect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverId:t,serverConfig:e})})).json()}async function eCe(t){if(!t.oauthTokens)return{kind:"ready",serverConfig:t.config,tokens:void 0};const e=await MR(t.name);if(e.success&&e.serverConfig)return{kind:"ready",serverConfig:e.serverConfig,tokens:ra(t.name)};const n=t.config?.url?.toString?.();if(n){Fm(t.name);const r={serverName:t.name,serverUrl:n,clientId:t.oauthTokens?.client_id,clientSecret:t.oauthTokens?.client_secret},s=await Qb(r);return s.success&&s.serverConfig?{kind:"ready",serverConfig:s.serverConfig,tokens:ra(t.name)}:s.success&&!s.serverConfig?{kind:"redirect"}:{kind:"error",error:s.error||"OAuth init failed"}}return{kind:"error",error:"OAuth refresh failed and no URL present"}}function X1(t){return t.type==="stdio"?{command:t.command,args:t.args,env:t.env}:{url:new URL(t.url),requestInit:{headers:t.headers||{}}}}function Z7(){const t=mN("Connections"),[e,n]=w.useReducer(WTe,VC),[r,s]=w.useState(!0),i=w.useRef(new Map),a=A=>{const M=(i.current.get(A)??0)+1;return i.current.set(A,M),M},l=(A,R)=>(i.current.get(A)??0)!==R;w.useEffect(()=>{try{const A=KTe();n({type:"HYDRATE_STATE",payload:A})}catch(A){t.error("Failed to load saved state",{error:A instanceof Error?A.message:"Unknown error"})}finally{s(!1)}},[t]),w.useEffect(()=>{r||XTe(e)},[e,r]);const c=A=>{if(A.type==="stdio")return!A.command||A.command.trim()===""?"Command is required for STDIO connections":null;if(!A.url||A.url.trim()==="")return"URL is required for HTTP connections";try{new URL(A.url)}catch(R){return`Invalid URL format: ${A.url} ${R}`}return null},d=w.useCallback(()=>{const A=Object.entries(e.servers).filter(([,R])=>R.connectionStatus==="connected").map(([R])=>R);n({type:"SET_MULTI_SELECTED",names:A})},[e.servers]),p=w.useCallback(async A=>{window.history.replaceState({},document.title,window.location.pathname);try{const R=await RH(A);if(R.success&&R.serverConfig&&R.serverName){const M=R.serverName;n({type:"CONNECT_REQUEST",name:M,config:R.serverConfig,select:!0});try{const P=await Oy(R.serverConfig,M);P.success?(n({type:"CONNECT_SUCCESS",name:M,config:R.serverConfig,tokens:ra(M)}),t.info("OAuth connection successful",{serverName:M}),Pt.success(`OAuth connection successful! Connected to ${M}.`)):(n({type:"CONNECT_FAILURE",name:M,error:P.error||"Connection test failed after OAuth"}),t.error("OAuth connection test failed",{serverName:M,error:P.error}),Pt.error(`OAuth succeeded but connection test failed: ${P.error}`))}catch(P){const O=P instanceof Error?P.message:"Unknown connection error";n({type:"CONNECT_FAILURE",name:M,error:O}),t.error("OAuth connection test error",{serverName:M,error:O}),Pt.error(`OAuth succeeded but connection test failed: ${O}`)}}else throw new Error(R.error||"OAuth callback failed")}catch(R){const M=R instanceof Error?R.message:"Unknown error";Pt.error(`Error completing OAuth flow: ${M}`),t.error("OAuth callback failed",{error:M})}},[t]);w.useEffect(()=>{if(!r){const A=new URLSearchParams(window.location.search),R=A.get("code"),M=A.get("error");R?p(R):M&&(Pt.error(`OAuth authorization failed: ${M}`),localStorage.removeItem("mcp-oauth-pending"),window.history.replaceState({},document.title,window.location.pathname))}},[r,p]);const h=w.useCallback(async A=>{const R=c(A);if(R){Pt.error(R);return}const M=X1(A);n({type:"CONNECT_REQUEST",name:A.name,config:M,select:!0});const P=a(A.name);try{if(A.type==="http"&&A.useOAuth&&A.url){n({type:"UPSERT_SERVER",name:A.name,server:{name:A.name,config:M,lastConnectionTime:new Date,connectionStatus:"oauth-flow",retryCount:0,enabled:!0}});const{initiateOAuth:L}=await GTe(async()=>{const{initiateOAuth:W}=await Promise.resolve().then(()=>Qle);return{initiateOAuth:W}},void 0),z={serverName:A.name,serverUrl:A.url,clientId:A.clientId,clientSecret:A.clientSecret};A.oauthScopes&&A.oauthScopes.length>0&&(z.scopes=A.oauthScopes);const G=await L(z);if(G.success){if(G.serverConfig){const W=await Oy(G.serverConfig,A.name);if(l(A.name,P))return;W.success?(n({type:"CONNECT_SUCCESS",name:A.name,config:G.serverConfig,tokens:ra(A.name)}),Pt.success("Connected successfully with OAuth!")):(n({type:"CONNECT_FAILURE",name:A.name,error:W.error||"OAuth connection test failed"}),Pt.error(`OAuth succeeded but connection failed: ${W.error}`))}else Pt.success("OAuth flow initiated. You will be redirected to authorize access.");return}else{if(l(A.name,P))return;n({type:"CONNECT_FAILURE",name:A.name,error:G.error||"OAuth initialization failed"}),Pt.error(`OAuth initialization failed: ${G.error}`);return}}const O=await Oy(M,A.name);if(l(A.name,P))return;O.success?(n({type:"CONNECT_SUCCESS",name:A.name,config:M}),t.info("Connection successful",{serverName:A.name}),Pt.success("Connected successfully!")):(n({type:"CONNECT_FAILURE",name:A.name,error:O.error||"Connection test failed"}),t.error("Connection failed",{serverName:A.name,error:O.error}),Pt.error(`Failed to connect to ${A.name}`))}catch(O){const L=O instanceof Error?O.message:"Unknown error";if(l(A.name,P))return;n({type:"CONNECT_FAILURE",name:A.name,error:L}),t.error("Connection failed",{serverName:A.name,error:L}),Pt.error(`Network error: ${L}`)}},[e.servers,t]),g=w.useRef(!1);w.useEffect(()=>{!r&&!g.current&&(g.current=!0,fetch("/api/mcp-cli-config").then(A=>A.json()).then(A=>{const R=A.config;if(R){if(R.servers&&Array.isArray(R.servers)){const M=R.autoConnectServer;t.info("Processing CLI-provided MCP servers (from config file)",{serverCount:R.servers.length,autoConnectServer:M||"all",cliConfig:R}),R.servers.forEach(P=>{const O={name:P.name||"CLI Server",type:P.type==="sse"?"http":P.type||"stdio",command:P.command,args:P.args||[],url:P.url,env:P.env||{}},L=X1(O);n({type:"UPSERT_SERVER",name:O.name,server:{name:O.name,config:L,lastConnectionTime:new Date,connectionStatus:"disconnected",retryCount:0,enabled:!1}}),!M||P.name===M?(t.info("Auto-connecting to server",{serverName:P.name}),h(O)):t.info("Skipping auto-connect for server",{serverName:P.name,reason:"filtered out"})});return}if(R.command){t.info("Auto-connecting to CLI-provided MCP server",{cliConfig:R});const M={name:R.name||"CLI Server",type:"stdio",command:R.command,args:R.args||[],env:R.env||{}};h(M)}}}).catch(A=>{t.debug("Could not fetch CLI config from API",{error:A})}))},[r,h,t,e.servers]);const v=w.useCallback(async A=>{const R=e.servers[A];return R?.oauthTokens&&R.oauthTokens.access_token||null},[e.servers]),b=w.useCallback(async A=>{t.info("Disconnecting from server",{serverName:A}),n({type:"DISCONNECT",name:A});try{const R=await QTe(A);R.success||n({type:"DISCONNECT",name:A,error:R.error})}catch(R){n({type:"DISCONNECT",name:A,error:R instanceof Error?R.message:"Unknown error"})}},[]),x=w.useCallback(async A=>{t.info("Removing server",{serverName:A}),Fm(A),n({type:"REMOVE_SERVER",name:A})},[]),E=w.useCallback(async A=>{t.info("Reconnecting to server",{serverName:A});const R=e.servers[A];if(!R)throw new Error(`Server ${A} not found`);n({type:"RECONNECT_REQUEST",name:A});const M=a(A);try{const P=await eCe(R);if(P.kind==="redirect")return;if(P.kind==="error"){if(l(A,M))return;n({type:"CONNECT_FAILURE",name:A,error:P.error}),Pt.error(`Failed to connect: ${A}`);return}const O=await ZTe(A,P.serverConfig);if(l(A,M))return;if(O.success)return n({type:"CONNECT_SUCCESS",name:A,config:P.serverConfig,tokens:P.tokens}),t.info("Reconnection successful",{serverName:A,result:O}),{success:!0};{n({type:"CONNECT_FAILURE",name:A,error:O.error||"Reconnection failed"}),t.error("Reconnection failed",{serverName:A,result:O});const L=O.error||`Failed to reconnect: ${A}`;Pt.error(L)}}catch(P){const O=P instanceof Error?P.message:"Unknown error";if(l(A,M))return;throw n({type:"CONNECT_FAILURE",name:A,error:O}),t.error("Reconnection failed",{serverName:A,error:O}),P}},[e.servers]);w.useEffect(()=>{if(r)return;(async()=>{try{const R=await JTe();R?.success&&R.servers&&n({type:"SYNC_AGENT_STATUS",servers:R.servers})}catch(R){t.debug("Failed to sync server status on startup",{error:R instanceof Error?R.message:"Unknown error"})}})()},[r,t]);const S=w.useCallback(A=>{n({type:"SELECT_SERVER",name:A})},[]),k=w.useCallback(A=>{n({type:"SET_MULTI_SELECTED",names:A})},[]),T=w.useCallback(A=>{n({type:"SET_MULTI_MODE",enabled:A})},[]),N=w.useCallback(A=>{const R=e.selectedMultipleServers,M=R.includes(A)?R.filter(P=>P!==A):[...R,A];n({type:"SET_MULTI_SELECTED",names:M})},[e.selectedMultipleServers]),j=w.useCallback(async(A,R)=>{const M=e.servers[A];if(M?.oauthTokens!=null&&R.useOAuth&&R.name===A&&R.type==="http"&&R.url===(M?.config).url?.toString()&&M){const L=X1(R);n({type:"CONNECT_REQUEST",name:A,config:L});try{if((await Oy(M.config,A)).success){n({type:"CONNECT_SUCCESS",name:A,config:L}),Pt.success("Server configuration updated successfully!");return}else console.warn("OAuth connection test failed, falling back to full reconnect")}catch(z){console.warn("OAuth connection test error, falling back to full reconnect",z)}}await b(A),await h(R),e.selectedServer===A&&R.name!==A&&S(R.name)},[e.servers,e.selectedServer,b,h]);return{appState:e,isLoading:r,connectedServerConfigs:e.servers,selectedServerEntry:e.servers[e.selectedServer],selectedMCPConfig:e.servers[e.selectedServer]?.config,selectedMCPConfigs:e.selectedMultipleServers.map(A=>e.servers[A]).filter(Boolean),selectedMCPConfigsMap:e.selectedMultipleServers.reduce((A,R)=>(e.servers[R]&&(A[R]=e.servers[R].config),A),{}),isMultiSelectMode:e.isMultiSelectMode,handleConnect:h,handleDisconnect:b,handleReconnect:E,handleUpdate:j,handleRemoveServer:x,setSelectedServer:S,setSelectedMCPConfigs:k,toggleMultiSelectMode:T,toggleServerSelection:N,getValidAccessToken:v,setSelectedMultipleServersToAllServers:d}}function tCe({server:t,selected:e,onToggle:n}){const[r,s]=w.useState(null),[i,a]=w.useState(!1),{label:l,Icon:c,iconClassName:d,indicatorColor:p}=ZB(t.connectionStatus),h=tH(t.config),g=eH(t.config),v=JSON.stringify(t.config,null,2),b=()=>{n(t.name)},x=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),b())},E=async(k,T,N)=>{k.stopPropagation();try{await navigator.clipboard.writeText(T),s(N),setTimeout(()=>s(null),2e3)}catch(j){console.error("Failed to copy text:",j)}},S=t.connectionStatus==="failed"?`${l} (${t.retryCount} retries)`:l;return f.jsxs(Wa,{role:"button",tabIndex:0,onClick:b,onKeyDown:x,className:Me("relative gap-3 p-3 border border-border/40 bg-card/40 transition-colors","hover:border-border cursor-pointer",e&&"border-primary/60 ring-2 ring-primary/30"),children:[f.jsxs("div",{className:"flex items-start justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsx("span",{"aria-hidden":!0,className:"h-2 w-2 flex-shrink-0 rounded-full",style:{backgroundColor:p}}),f.jsx("div",{className:"min-w-0",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[f.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:t.name}),f.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[f.jsx(c,{className:d}),f.jsx("span",{children:S})]})]})})]}),e&&f.jsxs(br,{variant:"secondary",className:"h-5 px-1 text-[11px]",children:[f.jsx(Ni,{className:"mr-1 h-3 w-3"}),"Selected"]})]}),f.jsx("p",{className:"mt-0.5 text-[11px] uppercase tracking-wide text-muted-foreground",children:h}),f.jsxs("div",{className:"relative break-all rounded border border-border/30 bg-muted/30 p-1.5 font-mono text-[11px] text-muted-foreground",children:[f.jsx("div",{className:"pr-6",children:g}),f.jsx("button",{type:"button",onClick:k=>E(k,g,"command"),className:"absolute right-1 top-1 cursor-pointer p-1 text-muted-foreground/60 transition-colors hover:text-foreground",children:r==="command"?f.jsx(Ni,{className:"h-3 w-3 text-green-500"}):f.jsx(Bo,{className:"h-3 w-3"})})]}),i&&f.jsxs("div",{className:"relative rounded border border-border/20 bg-muted/20 p-1.5 font-mono text-[11px] text-muted-foreground",children:[f.jsx("pre",{className:"max-h-40 overflow-auto pr-6 whitespace-pre-wrap",children:v}),f.jsx("button",{type:"button",onClick:k=>E(k,v,"config"),className:"absolute right-1 top-1 cursor-pointer p-1 text-muted-foreground/60 transition-colors hover:text-foreground",children:r==="config"?f.jsx(Ni,{className:"h-3 w-3 text-green-500"}):f.jsx(Bo,{className:"h-3 w-3"})})]}),f.jsx("div",{className:"flex justify-end pt-0.5",children:f.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),a(T=>!T)},"aria-label":i?"Hide config":"Show config",className:"rounded-full border border-border/50 bg-background/70 p-1 text-muted-foreground transition-colors hover:text-foreground",children:i?f.jsx(YB,{className:"h-3 w-3"}):f.jsx(Lu,{className:"h-3 w-3"})})})]})}const T$="mcp-inspector-eval-runner-preferences",Nl=[{key:"servers",title:"Select Servers",description:"Choose the MCP servers to evaluate."},{key:"model",title:"Choose Model",description:"Pick the model and ensure credentials are ready."},{key:"tests",title:"Define Tests",description:"Author the scenarios you want to run or generate them with AI."},{key:"review",title:"Review & Run",description:"Confirm the configuration before launching the run."}],Q1=(t,e)=>({title:"",query:"",runs:1,model:e?.id??"",provider:e?.provider??"",expectedToolCalls:[]});function nCe({availableModels:t,inline:e=!1}){const[n,r]=w.useState(!1),[s,i]=w.useState(!1),[a,l]=w.useState(!1),[c,d]=w.useState(0),[p,h]=w.useState(null),{isAuthenticated:g}=ro(),{getAccessToken:v}=va(),{appState:b}=Z7(),{getToken:x,hasToken:E}=TN(),[S,k]=w.useState([]),[T,N]=w.useState(null),[j,A]=w.useState([Q1(1,null)]),R=w.useMemo(()=>Object.entries(b.servers).filter(([,B])=>B.connectionStatus==="connected"),[b.servers]),M=w.useMemo(()=>new Set(R.map(([B])=>B)),[R]);w.useEffect(()=>{if(!(typeof window>"u"))try{const B=localStorage.getItem(T$);if(!B)return;const J=JSON.parse(B);h({servers:J.servers??[],modelId:J.modelId??null})}catch(B){console.warn("Failed to load eval runner preferences",B)}},[]),w.useEffect(()=>{if(p&&p.servers?.length){const B=p.servers.filter(J=>M.has(J));B.length&&k(B)}},[p,M]),w.useEffect(()=>{if(t.length===0){N(null);return}if(p?.modelId){const B=t.find(J=>J.id===p.modelId);if(B){N(B);return}}N(B=>B&&t.some(oe=>oe.id===B.id)?B:t[0])},[t,p]),w.useEffect(()=>{if(!(typeof window>"u"))try{const B={servers:S,modelId:T?.id??null};localStorage.setItem(T$,JSON.stringify(B))}catch(B){console.warn("Failed to persist eval runner preferences",B)}},[S,T]),w.useEffect(()=>{A(B=>T?B.map((J,oe)=>J.model===T.id&&J.provider===T.provider?J:{...J,model:T.id,provider:T.provider}):B)},[T]),w.useEffect(()=>{!e&&!n&&d(0)},[e,n]);const P=T?ia(T.id):!1,O=T?.provider,L=O?E(O):!1,z=w.useMemo(()=>j.filter(B=>B.query.trim().length>0),[j]),G=w.useMemo(()=>({servers:S.length>0,model:!!T&&(P||O&&L),tests:z.length>0}),[z.length,T,P,O,L,S.length]),W=w.useMemo(()=>G.servers?G.model?G.tests?3:2:1:0,[G]),X=w.useMemo(()=>{switch(c){case 0:return G.servers;case 1:return G.model;case 2:return G.tests;case 3:return G.tests&&G.servers&&G.model;default:return!1}},[c,G]),F=B=>{k(J=>J.includes(B)?J.filter(oe=>oe!==B):[...J,B])},Y=B=>{A(J=>{const oe=J.length,fe=Array.from({length:B},(xe,Ae)=>Q1(oe+Ae+1,T));return[...J,...fe]})},V=()=>{Y(1)},te=B=>{A(J=>J.filter((oe,fe)=>fe!==B))},I=(B,J,oe)=>{A(fe=>{const xe=[...fe];return xe[B]={...xe[B],[J]:oe},xe})},re=async()=>{if(!g){Pt.error("Please sign in to generate tests");return}if(S.length===0){Pt.error("Please select at least one server");return}l(!0);try{const B=await v(),J=await fetch("/api/mcp/evals/generate-tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverIds:S,convexAuthToken:B})}),oe=await J.json();if(!J.ok)throw new Error(oe.error||"Failed to generate tests");if(oe.tests&&oe.tests.length>0){const fe=oe.tests.map((xe,Ae)=>({title:xe.title||`Generated test ${Ae+1}`,query:xe.query||"",runs:Number(xe.runs)>0?Number(xe.runs):1,model:T?.id||"",provider:T?.provider||"",expectedToolCalls:Array.isArray(xe.expectedToolCalls)?xe.expectedToolCalls:[]}));A(fe),d(2),Pt.success(`Generated ${fe.length} test case(s).`)}}catch(B){console.error("Failed to generate tests:",B),Pt.error(B instanceof Error?B.message:"Failed to generate test cases")}finally{l(!1)}},ue=()=>{c>=Nl.length-1||X&&d(B=>Math.min(B+1,Nl.length-1))},D=()=>{c!==0&&d(B=>Math.max(B-1,0))},Z=async()=>{if(!g){Pt.error("Please sign in to run evals");return}if(S.length===0){Pt.error("Please select at least one server"),d(0);return}if(!T){Pt.error("Please select a model"),d(1);return}const B=ia(T.id),J=!B&&O?x(O):"";if(!B&&(!O||!J)){Pt.error(`Please configure your ${T.provider} API key in Settings`),d(1);return}if(z.length===0){Pt.error("Please add at least one test case with a query"),d(2);return}i(!0);try{const oe=await v(),fe=z.map(Oe=>({...Oe,model:T.id,provider:T.provider})),xe=await fetch("/api/mcp/evals/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tests:fe,serverIds:S,llmConfig:{provider:T.provider,apiKey:B?"router":J||"router"},convexAuthToken:oe})}),Ae=await xe.json();if(!xe.ok)throw new Error(Ae.error||"Failed to start evals");Pt.success(Ae.message||"Evals started successfully!"),A([Q1(1,T)]),d(3),e||r(!1),window.location.hash="eval-results"}catch(oe){Pt.error(oe instanceof Error?oe.message:"Failed to start evals")}finally{i(!1)}},he=()=>{switch(Nl[c].key){case"servers":return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg pb-2",children:"Select servers to test"}),f.jsx("p",{className:"text-sm text-muted-foreground pb-2",children:"Choose at least one connected MCP server. You can evaluate multiple servers in the same run."})]})}),R.length>0?f.jsx("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2 xl:grid-cols-3",children:R.map(([B,J])=>{const oe=S.includes(B);return f.jsx(tCe,{server:J,selected:oe,onToggle:F},B)})}):f.jsxs("div",{className:"rounded-lg border border-dashed p-6 text-sm text-muted-foreground",children:[f.jsx("p",{className:"font-medium text-foreground",children:"No connected servers yet"}),f.jsx("p",{className:"mt-2",children:"Launch a server from the Servers tab to make it available here. Once connected, it will appear instantly."})]})]});case"model":return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg pb-2",children:"Choose your evaluation model"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"For example, if you want to simulate using your server with Claude Desktop, select an Anthropic model."})]})}),t.length===0?f.jsxs("div",{className:"rounded-lg border border-dashed p-6 text-sm text-muted-foreground",children:[f.jsx("p",{className:"font-medium text-foreground",children:"No models available"}),f.jsx("p",{className:"mt-2",children:"Connect a provider or enable MCPJam provided models in Settings to unlock model selection."})]}):T?f.jsxs("div",{className:"space-y-3",children:[f.jsx("div",{className:"flex items-center gap-3",children:f.jsx(X7,{currentModel:T,availableModels:t,onModelChange:N})}),!P&&!L&&O&&f.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm",children:[f.jsx(Lm,{className:"mt-0.5 h-4 w-4 text-destructive"}),f.jsxs("div",{children:[f.jsxs("p",{className:"font-medium text-destructive",children:["Add your ",T.provider," API key"]}),f.jsx("p",{className:"text-muted-foreground",children:"Configure credentials in Settings to run this model. Keys are stored locally and never sent to our servers."})]})]})]}):null]});case"tests":return f.jsxs("div",{className:"space-y-6",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{children:[f.jsx("h3",{className:"text-lg pb-2",children:"Define your test cases"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Create testing scenarios that simulate how real users would use your server."})]})}),!G.servers||!G.model?f.jsxs("div",{className:"rounded-lg border border-dashed p-6 text-sm text-muted-foreground",children:[f.jsx("p",{className:"font-medium text-foreground",children:"Finish previous steps first"}),f.jsx("p",{className:"mt-2",children:"Select at least one server and choose a model to unlock test authoring. That ensures generated tests know which stack to target."})]}):f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2",children:f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Pe,{type:"button",variant:"outline",size:"lg",onClick:re,disabled:a,children:[f.jsx("span",{className:"bg-gradient-to-r from-purple-600 via-violet-600 to-indigo-600 bg-clip-text text-transparent",children:a?"Generating...":"Generate tests"}),f.jsx(JB,{className:"h-4 w-4 ml-2 fill-purple-600"})]})})}),a&&f.jsx("div",{className:"flex items-center justify-center rounded-lg border p-6",children:f.jsx("div",{className:"text-center text-sm text-muted-foreground",children:"Generating test cases..."})}),!a&&f.jsxs("div",{className:"space-y-12",children:[j.map((B,J)=>f.jsxs("div",{className:"space-y-3 rounded-lg border bg-background p-4",children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[f.jsx(Zc,{className:"text-xs uppercase text-muted-foreground",children:"Title"}),f.jsx(Un,{className:"w-full",value:B.title,onChange:oe=>I(J,"title",oe.target.value),placeholder:"(Paypal) List transactions"})]}),j.length>1&&f.jsx(Pe,{type:"button",variant:"ghost",size:"sm",onClick:()=>te(J),children:f.jsx($u,{className:"h-4 w-4"})})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zc,{className:"text-xs uppercase text-muted-foreground",children:"Query"}),f.jsx(Zo,{value:B.query,onChange:oe=>I(J,"query",oe.target.value),placeholder:"Can you find the most recent Paypal transactions, then create an invoice?",rows:3})]}),f.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zc,{className:"text-xs uppercase text-muted-foreground",children:"Runs"}),f.jsx(Un,{type:"number",min:1,value:B.runs,onChange:oe=>I(J,"runs",Number(oe.target.value)>0?Number(oe.target.value):1)})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zc,{className:"text-xs uppercase text-muted-foreground",children:"Expected tools (comma separated)"}),f.jsx(Un,{value:B.expectedToolCalls.join(", "),onChange:oe=>I(J,"expectedToolCalls",oe.target.value.split(",").map(fe=>fe.trim()).filter(Boolean)),placeholder:"paypal_list_transactions, paypal_create_invoice"})]})]})]},J)),f.jsxs(Pe,{type:"button",variant:"outline",onClick:V,"aria-label":"Add test",className:"w-full",children:[f.jsx(Lb,{className:"h-4 w-4 mr-2"}),"Add test case"]})]})]})]});case"review":return f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx("h3",{className:"text-lg",children:"Review your tests"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"After confirming the run, you will see your run begin in the eval results tab."})]}),f.jsxs("div",{className:"space-y-4 rounded-lg border bg-background p-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Servers"}),f.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:S.map(B=>f.jsx(br,{variant:"outline",children:B},B))})]}),f.jsx(Pe,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(0),children:"Edit"})]}),f.jsx($k,{}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Model"}),T?f.jsx("div",{className:"mt-2 flex items-center gap-2",children:f.jsx(br,{variant:"outline",children:T.name})}):f.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"No model selected"})]}),f.jsx(Pe,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(1),children:"Edit"})]}),f.jsx($k,{}),f.jsxs("div",{className:"flex items-start justify-between gap-6",children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Tests"}),f.jsx("div",{className:"mt-3 space-y-3",children:z.map((B,J)=>f.jsxs("div",{className:"rounded-md border bg-muted/30 p-3",children:[f.jsx("p",{className:"text-sm font-semibold text-foreground",children:B.title}),f.jsx("p",{className:"mt-1 line-clamp-2 text-sm text-muted-foreground",children:B.query}),f.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[f.jsxs("span",{children:[B.runs," run",B.runs===1?"":"s"]}),B.expectedToolCalls.length>0&&f.jsxs("span",{children:["Tools: ",B.expectedToolCalls.join(", ")]})]})]},J))})]}),f.jsx(Pe,{type:"button",variant:"ghost",size:"sm",onClick:()=>d(2),children:"Edit"})]})]})]});default:return null}},q=f.jsx("ol",{className:"flex flex-col items-center gap-4 text-center md:flex-row md:gap-6",children:Nl.map((B,J)=>{const oe=c===J,fe=J<c&&J<=W,xe=J<=Math.max(W,c);return f.jsx("li",{className:"flex flex-col items-center gap-2",children:f.jsxs("button",{type:"button",onClick:()=>xe?d(J):void 0,disabled:!xe,className:Me("flex flex-col items-center gap-2 transition",!xe&&"cursor-not-allowed opacity-60"),children:[f.jsx("span",{className:Me("flex h-8 w-8 items-center justify-center rounded-full border text-sm font-medium",fe&&"border-primary bg-primary text-primary-foreground",oe&&!fe&&"border-primary bg-primary/10 text-primary",!oe&&!fe&&"border-border text-muted-foreground"),children:J+1}),f.jsx("span",{className:Me("text-xs leading-tight",oe?"text-foreground":"text-muted-foreground"),children:B.title})]})},B.key)})}),U=c<Nl.length-1?!X:s||!X,K=U?"secondary":"default",ae=f.jsxs("div",{className:Me("mx-auto flex w-full flex-col gap-8 pb-10 pt-4",e?"max-w-none px-4 sm:px-6 md:px-12 lg:px-32":"max-w-3xl px-4"),children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[f.jsxs(Pe,{type:"button",variant:"outline",onClick:D,disabled:c===0,"aria-label":"Back",className:"justify-center gap-2",children:[f.jsx(Mse,{className:"h-4 w-4"}),"Back"]}),f.jsx("div",{className:"flex flex-1 justify-center",children:f.jsx("div",{className:"max-w-xl",children:q})}),f.jsxs(Pe,{type:"button",variant:K,onClick:()=>{c<Nl.length-1?ue():Z()},disabled:U,"aria-label":c===Nl.length-1?"Start":"Next",className:Me("justify-center gap-2",!U&&"shadow-sm"),children:[c===Nl.length-1?"Start":"Next",f.jsx(Ka,{className:"h-4 w-4"})]})]}),f.jsx("div",{className:"space-y-6",children:he()})]});return e?ae:f.jsxs(fa,{open:n,onOpenChange:r,children:[f.jsx(yR,{asChild:!0,children:f.jsxs(Pe,{children:[f.jsx(Lb,{className:"mr-2 h-4 w-4"}),"New eval run"]})}),f.jsxs(ha,{className:"max-h-[80vh] w-full max-w-4xl overflow-y-auto sm:max-w-4xl",children:[f.jsxs(pa,{className:"mx-auto w-full max-w-3xl gap-1 text-left",children:[f.jsx(ma,{children:"Create eval run"}),f.jsx(uh,{children:"Follow the guided steps to configure your evaluation and run it with confidence."})]}),ae]})]})}function rCe(){const{isAuthenticated:t,isLoading:e}=ro(),{user:n}=va(),{availableModels:r}=Xq({systemPrompt:"",temperature:1,selectedServers:[]});return e?f.jsx("div",{className:"p-6",children:f.jsx("div",{className:"flex h-64 items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto h-8 w-8 animate-spin rounded-full border-b-2 border-primary"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Loading..."})]})})}):!t||!n?f.jsx("div",{className:"p-6",children:f.jsx(dh,{icon:KB,title:"Sign in to run evals",description:"Create an account or sign in to generate and launch evaluation runs.",className:"h-[calc(100vh-200px)]"})}):f.jsxs("div",{className:"space-y-6 p-6",children:[f.jsx("div",{className:"space-y-2",children:f.jsx("h1",{className:"text-2xl font-semibold",children:"Evaluation runner"})}),f.jsx("div",{className:"w-full",children:f.jsx(nCe,{availableModels:r,inline:!0})})]})}function sCe({config:t,isConfigured:e,onEdit:n,onDelete:r}){const s=t.description?.trim();return f.jsxs(Wa,{className:Me("group h-full gap-4 border bg-card px-6 py-6 transition-all hover:border-primary/40 hover:shadow-md dark:hover:shadow-xl",e?"border-green-200/80 dark:border-green-400/30":"border-border/60"),children:[f.jsxs("div",{className:"flex items-start justify-between gap-6",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("img",{src:t.logo,alt:t.logoAlt,className:"size-6 object-contain"}),f.jsxs("div",{className:"",children:[f.jsxs("h3",{className:"text-md font-semibold text-foreground pb-1",children:[t.name," ",e&&f.jsx("span",{className:"text-md",children:"✔️"})]}),s?f.jsx("p",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:s}):null]})]}),e?f.jsxs(k0,{children:[f.jsx(T0,{asChild:!0,children:f.jsx(Pe,{size:"icon",variant:"ghost",className:"size-8 rounded-md border border-transparent hover:bg-muted/50",children:f.jsx(nie,{className:"size-4"})})}),f.jsx(C0,{align:"end",className:"w-44",children:f.jsx(Io,{variant:"destructive",onClick:()=>r(t.id),children:"Remove provider"})})]}):null]}),f.jsx("div",{className:"space-y-4",children:f.jsx(Pe,{size:"sm",variant:e?"outline":"secondary",className:"w-full",onClick:()=>n(t.id),children:e?"Manage":"Configure"})})]})}function iCe({baseUrl:t,onEdit:e}){const n=!!t;return f.jsxs(Wa,{className:Me("group h-full gap-4 border bg-card px-6 py-6 transition-all hover:border-primary/40 hover:shadow-md dark:hover:shadow-xl",n?"border-green-200/80 dark:border-green-400/30":"border-border/60"),children:[f.jsx("div",{className:"flex items-start justify-between gap-6",children:f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("img",{src:"/ollama_logo.svg",alt:"Ollama",className:"size-6 object-contain"}),f.jsxs("div",{className:"",children:[f.jsxs("h3",{className:"text-md font-semibold text-foreground pb-1",children:["Ollama ",n&&f.jsx("span",{className:"text-md",children:"✔️"})]}),f.jsx("p",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:n?"Local models available":"Install and connect Ollama locally"})]})]})}),f.jsx("div",{className:"space-y-4",children:f.jsx(Pe,{size:"sm",variant:n?"outline":"secondary",className:"w-full",onClick:e,children:n?"Manage":"Configure"})})]})}function aCe({providerConfigs:t,hasToken:e,onEditProvider:n,onDeleteProvider:r,ollamaBaseUrl:s,onEditOllama:i}){return f.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[t.map(a=>{const l=e(a.id);return f.jsx(sCe,{config:a,isConfigured:l,onEdit:n,onDelete:r},a.id)}),f.jsx(iCe,{baseUrl:s,onEdit:i})]})}function oCe({open:t,onOpenChange:e,provider:n,value:r,onValueChange:s,onSave:i,onCancel:a}){const l=ga();return f.jsx(fa,{open:t,onOpenChange:e,children:f.jsxs(ha,{className:"max-w-md",children:[f.jsx(pa,{children:f.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[n&&f.jsx("div",{className:"w-12 h-12 rounded-lg bg-white p-2 border",children:f.jsx("img",{src:n.logo,alt:n.logoAlt,className:"w-full h-full object-contain"})}),f.jsxs("div",{children:[f.jsxs(ma,{className:"text-left",children:["Configure ",n?.name]}),f.jsx(uh,{className:"text-left",children:n?.description})]})]})}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{htmlFor:"api-key",className:"text-sm font-medium",children:"API Key"}),f.jsx(Un,{id:"api-key",type:"password",value:r,onChange:c=>s(c.target.value),placeholder:n?.placeholder,className:"mt-1"})]}),f.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-950/20 rounded-lg",children:[f.jsx(gR,{className:"w-4 h-4 text-blue-600"}),f.jsxs("span",{className:"text-sm text-blue-600",children:["Need an API key?"," ",f.jsx("button",{onClick:()=>n&&window.open(n.getApiKeyUrl,"_blank"),className:"underline hover:no-underline",children:"Get one here"})]})]})]}),f.jsxs(A0,{children:[f.jsx(Pe,{variant:"outline",onClick:a,children:"Cancel"}),f.jsx(Pe,{onClick:()=>{l.capture("save_api_key",{location:"provider_config_dialog",platform:Ii(),environment:void 0}),i()},disabled:!r.trim(),children:"Save API Key"})]})]})})}function lCe({open:t,onOpenChange:e,value:n,onValueChange:r,onSave:s,onCancel:i}){return f.jsx(fa,{open:t,onOpenChange:e,children:f.jsxs(ha,{className:"max-w-md",children:[f.jsx(pa,{children:f.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[f.jsx("div",{className:"w-12 h-12 rounded-lg bg-white p-2 border",children:f.jsx("img",{src:"/ollama_logo.svg",alt:"Ollama",className:"w-full h-full object-contain"})}),f.jsxs("div",{children:[f.jsx(ma,{className:"text-left pb-2",children:"Configure Ollama URL"}),f.jsx(uh,{className:"text-left",children:"Set the base URL for your Ollama instance"})]})]})}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{children:[f.jsx("label",{htmlFor:"ollama-url",className:"text-sm font-medium",children:"Base URL"}),f.jsx(Un,{id:"ollama-url",type:"url",value:n,onChange:a=>r(a.target.value),placeholder:"http://localhost:11434/api",className:"mt-1"})]}),f.jsxs("div",{className:"flex items-center gap-2 p-3 bg-blue-50 dark:bg-blue-950/20 rounded-lg",children:[f.jsx(gR,{className:"w-4 h-4 text-blue-600"}),f.jsxs("span",{className:"text-sm text-blue-600",children:["Need help?"," ",f.jsx("button",{onClick:()=>window.open("https://ollama.ai/download","_blank"),className:"underline hover:no-underline",children:"Download Ollama"})]})]})]}),f.jsxs(A0,{children:[f.jsx(Pe,{variant:"outline",onClick:i,children:"Cancel"}),f.jsx(Pe,{onClick:s,disabled:!n.trim(),children:"Save URL"})]})]})})}function cCe({...t}){return f.jsx(lZ,{"data-slot":"alert-dialog",...t})}function uCe({...t}){return f.jsx(cZ,{"data-slot":"alert-dialog-trigger",...t})}function dCe({...t}){return f.jsx(uZ,{"data-slot":"alert-dialog-portal",...t})}function fCe({className:t,...e}){return f.jsx(dZ,{"data-slot":"alert-dialog-overlay",className:Me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function hCe({className:t,...e}){return f.jsxs(dCe,{children:[f.jsx(fCe,{}),f.jsx(fZ,{"data-slot":"alert-dialog-content",className:Me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...e})]})}function pCe({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-header",className:Me("flex flex-col gap-2 text-center sm:text-left",t),...e})}function mCe({className:t,...e}){return f.jsx("div",{"data-slot":"alert-dialog-footer",className:Me("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function gCe({className:t,...e}){return f.jsx(mZ,{"data-slot":"alert-dialog-title",className:Me("text-lg font-semibold",t),...e})}function vCe({className:t,...e}){return f.jsx(gZ,{"data-slot":"alert-dialog-description",className:Me("text-muted-foreground text-sm",t),...e})}function yCe({className:t,...e}){return f.jsx(hZ,{className:Me(mR(),t),...e})}function bCe({className:t,...e}){return f.jsx(pZ,{className:Me(mR({variant:"outline"}),t),...e})}function wn(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function ic(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const eG=6048e5,xCe=864e5,tG=6e4,nG=36e5,Iy=43200,C$=1440;let _Ce={};function Lg(){return _Ce}function cg(t,e){const n=Lg(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=wn(t),i=s.getDay(),a=(i<r?7:0)+i-r;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Px(t){return cg(t,{weekStartsOn:1})}function rG(t){const e=wn(t),n=e.getFullYear(),r=ic(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=Px(r),i=ic(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const a=Px(i);return e.getTime()>=s.getTime()?n+1:e.getTime()>=a.getTime()?n:n-1}function A$(t){const e=wn(t);return e.setHours(0,0,0,0),e}function Dx(t){const e=wn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function wCe(t,e){const n=A$(t),r=A$(e),s=+n-Dx(n),i=+r-Dx(r);return Math.round((s-i)/xCe)}function SCe(t){const e=rG(t),n=ic(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Px(n)}function vb(t,e){const n=wn(t),r=wn(e),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function ECe(t){return ic(t,Date.now())}function kCe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function TCe(t){if(!kCe(t)&&typeof t!="number")return!1;const e=wn(t);return!isNaN(Number(e))}function CCe(t,e){const n=wn(t),r=wn(e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function ACe(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function RCe(t,e){return+wn(t)-+wn(e)}function NCe(t){const e=wn(t);return e.setHours(23,59,59,999),e}function jCe(t){const e=wn(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function MCe(t){const e=wn(t);return+NCe(e)==+jCe(e)}function OCe(t,e){const n=wn(t),r=wn(e),s=vb(n,r),i=Math.abs(CCe(n,r));let a;if(i<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let l=vb(n,r)===-s;MCe(wn(t))&&i===1&&vb(t,r)===1&&(l=!1),a=s*(i-Number(l))}return a===0?0:a}function ICe(t,e,n){const r=RCe(t,e)/1e3;return ACe(n?.roundingMethod)(r)}function PCe(t){const e=wn(t),n=ic(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const DCe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},LCe=(t,e,n)=>{let r;const s=DCe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function J1(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const $Ce={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},zCe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},FCe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},UCe={date:J1({formats:$Ce,defaultWidth:"full"}),time:J1({formats:zCe,defaultWidth:"full"}),dateTime:J1({formats:FCe,defaultWidth:"full"})},BCe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},HCe=(t,e,n,r)=>BCe[t];function Pp(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=n?.width?String(n.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const qCe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},VCe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},GCe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},WCe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},YCe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},KCe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},XCe=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},QCe={ordinalNumber:XCe,era:Pp({values:qCe,defaultWidth:"wide"}),quarter:Pp({values:VCe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Pp({values:GCe,defaultWidth:"wide"}),day:Pp({values:WCe,defaultWidth:"wide"}),dayPeriod:Pp({values:YCe,defaultWidth:"wide",formattingValues:KCe,defaultFormattingWidth:"wide"})};function Dp(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?ZCe(l,h=>h.test(a)):JCe(l,h=>h.test(a));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const p=e.slice(a.length);return{value:d,rest:p}}}function JCe(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function ZCe(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function eAe(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const tAe=/^(\d+)(th|st|nd|rd)?/i,nAe=/\d+/i,rAe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},sAe={any:[/^b/i,/^(a|c)/i]},iAe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aAe={any:[/1/i,/2/i,/3/i,/4/i]},oAe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},lAe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},cAe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uAe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},dAe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},fAe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},hAe={ordinalNumber:eAe({matchPattern:tAe,parsePattern:nAe,valueCallback:t=>parseInt(t,10)}),era:Dp({matchPatterns:rAe,defaultMatchWidth:"wide",parsePatterns:sAe,defaultParseWidth:"any"}),quarter:Dp({matchPatterns:iAe,defaultMatchWidth:"wide",parsePatterns:aAe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Dp({matchPatterns:oAe,defaultMatchWidth:"wide",parsePatterns:lAe,defaultParseWidth:"any"}),day:Dp({matchPatterns:cAe,defaultMatchWidth:"wide",parsePatterns:uAe,defaultParseWidth:"any"}),dayPeriod:Dp({matchPatterns:dAe,defaultMatchWidth:"any",parsePatterns:fAe,defaultParseWidth:"any"})},sG={code:"en-US",formatDistance:LCe,formatLong:UCe,formatRelative:HCe,localize:QCe,match:hAe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function pAe(t){const e=wn(t);return wCe(e,PCe(e))+1}function mAe(t){const e=wn(t),n=+Px(e)-+SCe(e);return Math.round(n/eG)+1}function iG(t,e){const n=wn(t),r=n.getFullYear(),s=Lg(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=ic(t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const l=cg(a,e),c=ic(t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=cg(c,e);return n.getTime()>=l.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function gAe(t,e){const n=Lg(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=iG(t,e),i=ic(t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),cg(i,e)}function vAe(t,e){const n=wn(t),r=+cg(n,e)-+gAe(n,e);return Math.round(r/eG)+1}function fn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const jl={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return fn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):fn(n+1,2)},d(t,e){return fn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return fn(t.getHours()%12||12,e.length)},H(t,e){return fn(t.getHours(),e.length)},m(t,e){return fn(t.getMinutes(),e.length)},s(t,e){return fn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return fn(s,e.length)}},Ld={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},R$={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return jl.y(t,e)},Y:function(t,e,n,r){const s=iG(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return fn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):fn(i,e.length)},R:function(t,e){const n=rG(t);return fn(n,e.length)},u:function(t,e){const n=t.getFullYear();return fn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return fn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return fn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return jl.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return fn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=vAe(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):fn(s,e.length)},I:function(t,e,n){const r=mAe(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):fn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):jl.d(t,e)},D:function(t,e,n){const r=pAe(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):fn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return fn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return fn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return fn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Ld.noon:r===0?s=Ld.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Ld.evening:r>=12?s=Ld.afternoon:r>=4?s=Ld.morning:s=Ld.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return jl.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):jl.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):fn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):fn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):jl.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):jl.s(t,e)},S:function(t,e){return jl.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return j$(r);case"XXXX":case"XX":return Qc(r);case"XXXXX":case"XXX":default:return Qc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return j$(r);case"xxxx":case"xx":return Qc(r);case"xxxxx":case"xxx":default:return Qc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+N$(r,":");case"OOOO":default:return"GMT"+Qc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+N$(r,":");case"zzzz":default:return"GMT"+Qc(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return fn(r,e.length)},T:function(t,e,n){const r=t.getTime();return fn(r,e.length)}};function N$(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+fn(i,2)}function j$(t,e){return t%60===0?(t>0?"-":"+")+fn(Math.abs(t)/60,2):Qc(t,e)}function Qc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=fn(Math.trunc(r/60),2),i=fn(r%60,2);return n+s+e+i}const M$=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},aG=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},yAe=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return M$(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",M$(r,e)).replace("{{time}}",aG(s,e))},bAe={p:aG,P:yAe},xAe=/^D+$/,_Ae=/^Y+$/,wAe=["D","DD","YY","YYYY"];function SAe(t){return xAe.test(t)}function EAe(t){return _Ae.test(t)}function kAe(t,e,n){const r=TAe(t,e,n);if(console.warn(r),wAe.includes(t))throw new RangeError(r)}function TAe(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const CAe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AAe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,RAe=/^'([^]*?)'?$/,NAe=/''/g,jAe=/[a-zA-Z]/;function oG(t,e,n){const r=Lg(),s=r.locale??sG,i=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=wn(t);if(!TCe(l))throw new RangeError("Invalid time value");let c=e.match(AAe).map(p=>{const h=p[0];if(h==="p"||h==="P"){const g=bAe[h];return g(p,s.formatLong)}return p}).join("").match(CAe).map(p=>{if(p==="''")return{isToken:!1,value:"'"};const h=p[0];if(h==="'")return{isToken:!1,value:MAe(p)};if(R$[h])return{isToken:!0,value:p};if(h.match(jAe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:p}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(p=>{if(!p.isToken)return p.value;const h=p.value;(EAe(h)||SAe(h))&&kAe(h,e,String(t));const g=R$[h[0]];return g(l,h,s.localize,d)}).join("")}function MAe(t){const e=t.match(RAe);return e?e[1].replace(NAe,"'"):t}function OAe(t,e,n){const r=Lg(),s=n?.locale??r.locale??sG,i=2520,a=vb(t,e);if(isNaN(a))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a});let c,d;a>0?(c=wn(e),d=wn(t)):(c=wn(t),d=wn(e));const p=ICe(d,c),h=(Dx(d)-Dx(c))/1e3,g=Math.round((p-h)/60);let v;if(g<2)return n?.includeSeconds?p<5?s.formatDistance("lessThanXSeconds",5,l):p<10?s.formatDistance("lessThanXSeconds",10,l):p<20?s.formatDistance("lessThanXSeconds",20,l):p<40?s.formatDistance("halfAMinute",0,l):p<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):g===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",g,l);if(g<45)return s.formatDistance("xMinutes",g,l);if(g<90)return s.formatDistance("aboutXHours",1,l);if(g<C$){const b=Math.round(g/60);return s.formatDistance("aboutXHours",b,l)}else{if(g<i)return s.formatDistance("xDays",1,l);if(g<Iy){const b=Math.round(g/C$);return s.formatDistance("xDays",b,l)}else if(g<Iy*2)return v=Math.round(g/Iy),s.formatDistance("aboutXMonths",v,l)}if(v=OCe(d,c),v<12){const b=Math.round(g/Iy);return s.formatDistance("xMonths",b,l)}else{const b=v%12,x=Math.trunc(v/12);return b<3?s.formatDistance("aboutXYears",x,l):b<9?s.formatDistance("overXYears",x,l):s.formatDistance("almostXYears",x+1,l)}}function IAe(t,e){return OAe(t,ECe(t),e)}function PAe(t,e){const r=zAe(t);let s;if(r.date){const c=FAe(r.date,2);s=UAe(c.restDateString,c.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);const i=s.getTime();let a=0,l;if(r.time&&(a=BAe(r.time),isNaN(a)))return new Date(NaN);if(r.timezone){if(l=HAe(r.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+a),d=new Date(0);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return new Date(i+a+l)}const Py={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},DAe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,LAe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,$Ae=/^([+-])(\d{2})(?::?(\d{2}))?$/;function zAe(t){const e={},n=t.split(Py.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],Py.timeZoneDelimiter.test(e.date)&&(e.date=t.split(Py.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const s=Py.timezone.exec(r);s?(e.time=r.replace(s[1],""),e.timezone=s[1]):e.time=r}return e}function FAe(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const s=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?s:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function UAe(t,e){if(e===null)return new Date(NaN);const n=t.match(DAe);if(!n)return new Date(NaN);const r=!!n[4],s=Lp(n[1]),i=Lp(n[2])-1,a=Lp(n[3]),l=Lp(n[4]),c=Lp(n[5])-1;if(r)return YAe(e,l,c)?qAe(e,l,c):new Date(NaN);{const d=new Date(0);return!GAe(e,i,a)||!WAe(e,s)?new Date(NaN):(d.setUTCFullYear(e,i,Math.max(s,a)),d)}}function Lp(t){return t?parseInt(t):1}function BAe(t){const e=t.match(LAe);if(!e)return NaN;const n=Z1(e[1]),r=Z1(e[2]),s=Z1(e[3]);return KAe(n,r,s)?n*nG+r*tG+s*1e3:NaN}function Z1(t){return t&&parseFloat(t.replace(",","."))||0}function HAe(t){if(t==="Z")return 0;const e=t.match($Ae);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),s=e[3]&&parseInt(e[3])||0;return XAe(r,s)?n*(r*nG+s*tG):NaN}function qAe(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const s=r.getUTCDay()||7,i=(e-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+i),r}const VAe=[31,null,31,30,31,30,31,31,30,31,30,31];function lG(t){return t%400===0||t%4===0&&t%100!==0}function GAe(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(VAe[e]||(lG(t)?29:28))}function WAe(t,e){return e>=1&&e<=(lG(t)?366:365)}function YAe(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function KAe(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function XAe(t,e){return e>=0&&e<=59}function O$({value:t,isCopied:e,onCopy:n,copyLabel:r,tooltip:s="Copy to clipboard"}){return f.jsxs("div",{className:"relative w-full",children:[f.jsx(Un,{readOnly:!0,value:t,className:"h-12 w-full rounded-lg border border-border/40 bg-background/50 font-mono text-sm tracking-wide text-foreground pr-16 shadow-sm focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-primary/20",style:{fontFamily:'ui-monospace, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace'}}),f.jsxs($a,{children:[f.jsx(za,{asChild:!0,children:f.jsx(Pe,{type:"button",variant:"ghost",onClick:n,className:"absolute right-3 top-3 h-6 w-6 p-0 rounded-md border-0 bg-transparent text-foreground/60 hover:text-foreground hover:bg-foreground/10 transition-all duration-200",children:e?f.jsx(Ni,{className:"h-4 w-4"}):f.jsx(Bo,{className:"h-4 w-4"})})}),f.jsx(Fa,{side:"bottom",children:s})]})]})}function QAe(){const[t,e]=w.useState(null),[n,r]=w.useState(!1),[s,i]=w.useState(!1),[a,l]=w.useState(!1),[c,d]=w.useState(!1),{isAuthenticated:p,isLoading:h}=ro(),{signIn:g}=va(),v=ga(),b=Ix("apiKeys:list"),x=Y7("apiKeys:regenerateAndGet"),E=async()=>{if(t)try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)}catch(N){console.error("Clipboard error",N)}},S=async()=>{if(!p)return!1;try{r(!0),i(!1);const N=await x();return e(N.apiKey),d(!0),!0}catch(N){return console.error("Failed to generate key",N),!1}finally{r(!1)}};if(h)return f.jsx("div",{className:"rounded-md border p-3 text-sm text-muted-foreground",children:"Checking authentication…"});if(!p)return f.jsxs("div",{className:"space-y-3 rounded-md border p-4",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("h3",{className:"text-lg font-semibold",children:"MCPJam API Key"})}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign in to view and manage your API key."}),f.jsx(Pe,{type:"button",onClick:()=>{v.capture("sign_in",{location:"account_api_key_section",platform:Ii(),environment:void 0}),g()},size:"sm",children:"Sign in"})]});const k=b&&b.length>0?b[0]:null,T=(N,j="Never")=>{if(!N)return j;const A=new Date(N),R=IAe(A,{addSuffix:!0});return`${oG(A,"PP p")} · ${R}`};return f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("h3",{className:"text-lg font-semibold",children:"MCPJam API Key"})}),b===void 0?f.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading API key status…"}):t?f.jsxs("div",{className:"space-y-4",children:[f.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"Copy and save this key now. You won't be able to view it again later."}),f.jsx(O$,{value:t,isCopied:s,onCopy:E,copyLabel:"Copy key"})]}):(b?.length??0)===0?f.jsx("div",{className:"space-y-4",children:f.jsx(Pe,{type:"button",onClick:()=>{S()},disabled:n,children:n?"Generating…":"Generate API key"})}):f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs(cCe,{open:a,onOpenChange:l,children:[f.jsx(uCe,{asChild:!0,children:f.jsxs(Pe,{type:"button",variant:"outline",disabled:n,className:"inline-flex items-center gap-2.5 rounded-lg border border-border/50 bg-background px-4 py-2.5 text-sm font-medium text-foreground/80 hover:border-border hover:bg-background/80 hover:text-foreground transition-all duration-200",children:[f.jsx(or,{className:`h-4 w-4 ${n?"animate-spin":""} text-foreground/60`}),f.jsx("span",{children:n?"Regenerating…":"Regenerate"})]})}),f.jsxs(hCe,{children:[f.jsxs(pCe,{children:[f.jsx(gCe,{className:"text-lg font-semibold",children:"Confirm"}),f.jsx(vCe,{className:"text-sm text-muted-foreground leading-relaxed",children:"Regenerating an API key will replace your previous API key."})]}),f.jsxs(mCe,{className:"gap-3",children:[f.jsx(bCe,{disabled:n,className:"font-medium",children:"Cancel"}),f.jsx(yCe,{onClick:async N=>{N.preventDefault(),await S()&&l(!1)},disabled:n,className:"font-medium",children:n?"Regenerating…":"Regenerate"})]})]})]})}),k?f.jsx("div",{className:"rounded-lg border border-border/30 bg-background/50 p-4",children:f.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[f.jsxs("div",{className:"flex flex-col gap-0.5",children:[f.jsx("span",{className:"text-xs font-medium text-foreground/50 uppercase tracking-wide",children:"Created"}),f.jsx("span",{className:"text-xs text-foreground/70",children:T(k.createdAt)})]}),f.jsxs("div",{className:"flex flex-col gap-0.5",children:[f.jsx("span",{className:"text-xs font-medium text-foreground/50 uppercase tracking-wide",children:"Last Used"}),f.jsx("span",{className:"text-xs text-foreground/70",children:T(k.lastUsedAt,"Never used")})]})]})}):null]}),f.jsx(fa,{open:!!t&&c,onOpenChange:N=>{N||i(!1),d(N)},children:f.jsxs(ha,{children:[f.jsxs(pa,{children:[f.jsx(ma,{children:"API Key"}),f.jsx(uh,{children:"Copy and store this key securely. You will not be able to view it again."})]}),f.jsx(O$,{value:t??"",isCopied:s,onCopy:E,copyLabel:"Copy"})]})})]})}function JAe(){const{tokens:t,setToken:e,clearToken:n,hasToken:r,getOllamaBaseUrl:s,setOllamaBaseUrl:i}=TN(),[a,l]=w.useState(""),[c,d]=w.useState(!1),[p,h]=w.useState(null),[g,v]=w.useState(!1),[b,x]=w.useState(""),E=[{id:"openai",name:"OpenAI",logo:"/openai_logo.png",logoAlt:"OpenAI",description:"GPT-4, GPT-4o, GPT-4o-mini, GPT-4.1, GPT-5, etc.",placeholder:"sk-...",getApiKeyUrl:"https://platform.openai.com/api-keys"},{id:"anthropic",name:"Anthropic",logo:"/claude_logo.png",logoAlt:"Claude",description:"Claude 3.5, Claude 3.7, Claude Opus 4, etc.",placeholder:"sk-ant-...",getApiKeyUrl:"https://console.anthropic.com/"},{id:"deepseek",name:"DeepSeek",logo:"/deepseek_logo.svg",logoAlt:"DeepSeek",description:"DeepSeek Chat, DeepSeek Reasoner, etc.",placeholder:"sk-...",getApiKeyUrl:"https://platform.deepseek.com/api_keys"},{id:"google",name:"Google AI",logo:"/google_logo.png",logoAlt:"Google AI",description:"Gemini 2.5, Gemini 2.5 Flash, Gemini 2.5 Flash Lite",placeholder:"AI...",getApiKeyUrl:"https://aistudio.google.com/app/apikey"}],S=M=>{const P=E.find(O=>O.id===M);P&&(h(P),l(t[M]||""),d(!0))},k=()=>{p&&(e(p.id,a),d(!1),h(null),l(""))},T=()=>{d(!1),h(null),l("")},N=M=>{n(M)},j=()=>{x(s()),v(!0)},A=()=>{i(b),v(!1),x("")},R=()=>{v(!1),x("")};return f.jsxs("div",{className:"container mx-auto p-6 max-w-6xl space-y-8",children:[f.jsx("div",{className:"flex items-center gap-3 mb-6",children:f.jsx("h1",{className:"text-2xl font-bold",children:"Settings"})}),f.jsx(QAe,{}),f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{children:f.jsx("h3",{className:"text-lg font-semibold",children:"LLM Provider API Keys"})}),f.jsx(aCe,{providerConfigs:E,hasToken:M=>r(M),onEditProvider:S,onDeleteProvider:N,ollamaBaseUrl:s(),onEditOllama:j})]}),f.jsx(oCe,{open:c,onOpenChange:d,provider:p,value:a,onValueChange:l,onSave:k,onCancel:T}),f.jsx(lCe,{open:g,onOpenChange:v,value:b,onValueChange:x,onSave:A,onCancel:R})]})}const ZAe=(t,e="HH:mm:ss.SSS")=>{const n=typeof t=="string"?PAe(t):t;return oG(n,e)},eRe={error:"bg-red-500/10 text-red-700 border-red-200 dark:text-red-400 dark:border-red-800",warn:"bg-yellow-500/10 text-yellow-700 border-yellow-200 dark:text-yellow-400 dark:border-yellow-800",info:"bg-blue-500/10 text-blue-700 border-blue-200 dark:text-blue-400 dark:border-blue-800",debug:"bg-purple-500/10 text-purple-700 border-purple-200 dark:text-purple-400 dark:border-purple-800",trace:"bg-gray-500/10 text-gray-700 border-gray-200 dark:text-gray-400 dark:border-gray-800"};function cG({level:t}){return f.jsx(br,{variant:"outline",className:Me("font-mono",eRe[t]),children:t.toUpperCase()})}function tRe({entry:t,isExpanded:e,onToggleExpand:n}){const r=t.data!==void 0||t.error!==void 0;return f.jsxs("div",{className:"border rounded-lg font-mono",children:[f.jsx("div",{className:`p-3 cursor-pointer hover:bg-muted/50 ${r?"":"cursor-default"}`,onClick:r?n:void 0,children:f.jsxs("div",{className:"flex items-start gap-3",children:[r&&f.jsx("div",{className:"mt-0.5",children:e?f.jsx(Lu,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Ka,{className:"h-4 w-4 text-muted-foreground"})}),f.jsx("div",{className:"flex-1 min-w-0",children:f.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[f.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:`[${ZAe(t.timestamp)}]`}),f.jsx(cG,{level:t.level}),f.jsx(br,{variant:"secondary",children:t.context}),f.jsx("span",{className:"flex-1 break-words",children:t.message})]})})]})}),e&&r&&f.jsxs("div",{className:"border-t bg-muted/20 p-3 space-y-3",children:[t.data!==void 0&&f.jsxs("div",{children:[f.jsx("div",{className:"text-xs font-semibold text-muted-foreground mb-1",children:"DATA:"}),f.jsx("div",{className:"text-xs bg-background border rounded overflow-auto max-h-60",children:f.jsx(Wl,{src:t.data,dark:!0,theme:"atom",enableClipboard:!0,displaySize:!1,collapseStringsAfterLength:100,style:{fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', monospace",backgroundColor:"hsl(var(--background))",padding:"0",borderRadius:"0",border:"none"}})})]}),t.error&&f.jsxs("div",{children:[f.jsx("div",{className:"text-xs font-semibold text-muted-foreground mb-1",children:"ERROR:"}),f.jsxs("pre",{className:"text-xs bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-800 rounded p-2 overflow-auto max-h-40 text-red-700 dark:text-red-400",children:[t.error.message,t.error.stack&&`
|
|
@@ -1872,4 +1872,4 @@ now you can use replayer.getMirror() to access the mirror instance of a replayer
|
|
|
1872
1872
|
or you can use record.mirror to access the mirror instance during recording.`;let Lz={map:{},getId(){return console.error(Kd),-1},getNode(){return console.error(Kd),null},removeNodeFromMap(){console.error(Kd)},has(){return console.error(Kd),!1},reset(){console.error(Kd)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Lz=new Proxy(Lz,{get(t,e,n){return e==="map"&&console.error(Kd),Reflect.get(t,e,n)}}));function pg(t,e,n={}){let r=null,s=0;return function(...i){const a=Date.now();!s&&n.leading===!1&&(s=a);const l=e-(a-s),c=this;l<=0||l>e?(r&&(bPe(r),r=null),s=a,t.apply(c,i)):!r&&n.trailing!==!1&&(r=y_(()=>{s=n.leading===!1?0:Date.now(),r=null,t.apply(c,i)},l))}}function VW(t,e,n,r,s=window){const i=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,r?n:{set(a){y_(()=>{n.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>VW(t,e,i||{},!0)}function Qj(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],s=n(r);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=s,()=>{t[e]=r}}catch{return()=>{}}}let Wx=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Wx=()=>new Date().getTime());function GW(t){const e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:zl([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollLeft])||zl([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollLeft])||zl([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollLeft])||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:zl([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollTop])||zl([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollTop])||zl([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollTop])||0}}function WW(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function YW(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function KW(t){return t?t.nodeType===t.ELEMENT_NODE?t:t.parentElement:null}function ti(t,e,n,r,s){if(!t)return!1;const i=KW(t);if(!i)return!1;const a=cf(e,n);if(!s){const d=r&&i.matches(r);return a(i)&&!d}const l=su(i,a);let c=-1;return l<0?!1:(r&&(c=su(i,cf(null,r))),l>-1&&c<0?!0:l<c)}function hPe(t,e){return e.getId(t)!==-1}function dk(t,e){return e.getId(t)===hg}function XW(t,e){if(Am(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?XW(t.parentNode,e):!0:!0}function yA(t){return!!t.changedTouches}function pPe(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function QW(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function JW(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function bA(t){return!!zl([t,"optionalAccess",e=>e.shadowRoot])}class mPe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return ZMe(this.styleIDMap.get(e),()=>-1)}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function ZW(t){let e=null;return zl([t,"access",n=>n.getRootNode,"optionalCall",n=>n(),"optionalAccess",n=>n.nodeType])===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function gPe(t){let e=t,n;for(;n=ZW(e);)e=n;return e}function vPe(t){const e=t.ownerDocument;if(!e)return!1;const n=gPe(t);return e.contains(n)}function eY(t){const e=t.ownerDocument;return e?e.contains(t)||vPe(t):!1}const $z={};function Jj(t){const e=$z[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const s=n.createElement("iframe");s.hidden=!0,n.head.appendChild(s);const i=s.contentWindow;i&&i[t]&&(r=i[t]),n.head.removeChild(s)}catch{}return $z[t]=r.bind(window)}function yPe(...t){return Jj("requestAnimationFrame")(...t)}function y_(...t){return Jj("setTimeout")(...t)}function bPe(...t){return Jj("clearTimeout")(...t)}var Ft=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(Ft||{}),Tt=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(Tt||{}),ps=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(ps||{}),Eo=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Eo||{}),zz;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(zz||(zz={}));var Fz;(function(t){t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(Fz||(Fz={}));function Zj(t){try{return t.contentDocument}catch{}}function xPe(t){try{return t.contentWindow}catch{}}function _Pe(t){let e,n=t[0],r=1;for(;r<t.length;){const s=t[r],i=t[r+1];if(r+=2,(s==="optionalAccess"||s==="optionalCall")&&n==null)return;s==="access"||s==="optionalAccess"?(e=n,n=i(n)):(s==="call"||s==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}function Uz(t){return"__ln"in t}class wPe{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=_Pe([n,"optionalAccess",s=>s.next])||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&Uz(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&Uz(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){const n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Bz=(t,e)=>`${t}@${e}`;class SPe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Set,r=new wPe,s=c=>{let d=c,p=hg;for(;p===hg;)d=d&&d.nextSibling,p=d&&this.mirror.getId(d);return p},i=c=>{if(!c.parentNode||!eY(c))return;const d=Am(c.parentNode)?this.mirror.getId(ZW(c)):this.mirror.getId(c.parentNode),p=s(c);if(d===-1||p===-1)return r.addNode(c);const h=uf(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:g=>{QW(g,this.mirror)&&!ti(g,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(g),JW(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),bA(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(g,v)=>{ti(g,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(g,v),g.contentWindow&&this.canvasManager.addWindow(g.contentWindow),this.shadowDomManager.observeAttachShadow(g))},onStylesheetLoad:(g,v)=>{this.stylesheetManager.attachLinkElement(g,v)}});h&&(e.push({parentId:d,nextId:p,node:h}),n.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)Hz(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||i(c);for(const c of this.addedSet)!qz(this.droppedSet,c)&&!Hz(this.removes,c,this.mirror)||qz(this.movedSet,c)?i(c):this.droppedSet.add(c);let a=null;for(;r.length;){let c=null;if(a){const d=this.mirror.getId(a.value.parentNode),p=s(a.value);d!==-1&&p!==-1&&(c=a)}if(!c){let d=r.tail;for(;d;){const p=d;if(d=d.previous,p){const h=this.mirror.getId(p.value.parentNode);if(s(p.value)===-1)continue;if(h!==-1){c=p;break}else{const v=p.value;if(v.parentNode&&v.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const b=v.parentNode.host;if(this.mirror.getId(b)!==-1){c=p;break}}}}}}if(!c){for(;r.head;)r.removeNode(r.head.value);break}a=c.previous,r.removeNode(c.value),i(c.value)}const l={texts:this.texts.map(c=>({id:this.mirror.getId(c.node),value:c.value})).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:d}=c;if(typeof d.style=="string"){const p=JSON.stringify(c.styleDiff),h=JSON.stringify(c._unchangedStyles);p.length<d.style.length&&(p+h).split("var(").length===d.style.split("var(").length&&(d.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:d}}).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.processMutation=e=>{if(!dk(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!ti(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:eh(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,KW(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,s=e.target.getAttribute(r);if(r==="value"){const a=Kj(n),l=n.tagName;s=Vx(n,l,a);const c=g_({maskInputOptions:this.maskInputOptions,tagName:l,type:a}),d=eh(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);s=fg({isMasked:d,element:n,value:s,maskInputFn:this.maskInputFn})}if(ti(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||s===e.oldValue)return;let i=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(s))if(!Zj(n))r="rr_src";else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),r==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!qW(n.tagName,r)&&(i.attributes[r]=HW(this.doc,Zf(n.tagName),Zf(r),s,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(n.style)){const c=n.style.getPropertyValue(l),d=n.style.getPropertyPriority(l);c!==a.style.getPropertyValue(l)||d!==a.style.getPropertyPriority(l)?d===""?i.styleDiff[l]=c:i.styleDiff[l]=[c,d]:i._unchangedStyles[l]=[c,d]}for(const l of Array.from(a.style))n.style.getPropertyValue(l)===""&&(i.styleDiff[l]=!1)}break}case"childList":{if(ti(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),s=Am(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ti(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||dk(n,this.mirror)||!hPe(n,this.mirror)||(this.addedSet.has(n)?(xA(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||XW(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Bz(r,s)]?xA(this.movedSet,n):this.removes.push({parentId:s,id:r,isShadow:Am(e.target)&&Rm(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(dk(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Bz(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ti(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes.forEach(r=>this.genAdds(r)),bA(e)&&e.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function xA(t,e){t.delete(e),e.childNodes.forEach(n=>xA(t,n))}function Hz(t,e,n){return t.length===0?!1:EPe(t,e,n)}function EPe(t,e,n){let r=e.parentNode;for(;r;){const s=n.getId(r);if(t.some(i=>i.id===s))return!0;r=r.parentNode}return!1}function qz(t,e){return t.size===0?!1:tY(t,e)}function tY(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:tY(t,n):!1}let Nm;function kPe(t){Nm=t}function TPe(){Nm=void 0}const en=t=>Nm?(...n)=>{try{return t(...n)}catch(r){if(Nm&&Nm(r)===!0)return()=>{};throw r}}:t;function na(t){let e,n=t[0],r=1;for(;r<t.length;){const s=t[r],i=t[r+1];if(r+=2,(s==="optionalAccess"||s==="optionalCall")&&n==null)return;s==="access"||s==="optionalAccess"?(e=n,n=i(n)):(s==="call"||s==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}const df=[];function Vg(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function nY(t,e){const n=new SPe;df.push(n),n.init(t);let r=window.MutationObserver||window.__rrMutationObserver;const s=na([window,"optionalAccess",a=>a.Zone,"optionalAccess",a=>a.__symbol__,"optionalCall",a=>a("MutationObserver")]);s&&window[s]&&(r=window[s]);const i=new r(en(a=>{t.onMutation&&t.onMutation(a)===!1||n.processMutations.bind(n)(a)}));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function CPe({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};const s=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const c=pg(en(h=>{const g=Date.now()-l;t(a.map(v=>(v.timeOffset-=g,v)),h),a=[],l=null}),i),d=en(pg(en(h=>{const g=Vg(h),{clientX:v,clientY:b}=yA(h)?h.changedTouches[0]:h;l||(l=Wx()),a.push({x:v,y:b,id:r.getId(g),timeOffset:Wx()-l}),c(typeof DragEvent<"u"&&h instanceof DragEvent?Tt.Drag:h instanceof MouseEvent?Tt.MouseMove:Tt.TouchMove)}),s,{trailing:!1})),p=[gs("mousemove",d,n),gs("touchmove",d,n),gs("drag",d,n)];return en(()=>{p.forEach(h=>h())})}function APe({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const l=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,c=[];let d=null;const p=h=>g=>{const v=Vg(g);if(ti(v,r,s,i,!0))return;let b=null,x=h;if("pointerType"in g){switch(g.pointerType){case"mouse":b=Eo.Mouse;break;case"touch":b=Eo.Touch;break;case"pen":b=Eo.Pen;break}b===Eo.Touch?ps[h]===ps.MouseDown?x="TouchStart":ps[h]===ps.MouseUp&&(x="TouchEnd"):Eo.Pen}else yA(g)&&(b=Eo.Touch);b!==null?(d=b,(x.startsWith("Touch")&&b===Eo.Touch||x.startsWith("Mouse")&&b===Eo.Mouse)&&(b=null)):ps[h]===ps.Click&&(b=d,d=null);const E=yA(g)?g.changedTouches[0]:g;if(!E)return;const S=n.getId(v),{clientX:k,clientY:T}=E;en(t)({type:ps[x],id:S,x:k,y:T,...b!==null&&{pointerType:b}})};return Object.keys(ps).filter(h=>Number.isNaN(Number(h))&&!h.endsWith("_Departed")&&l[h]!==!1).forEach(h=>{let g=Zf(h);const v=p(h);if(window.PointerEvent)switch(ps[h]){case ps.MouseDown:case ps.MouseUp:g=g.replace("mouse","pointer");break;case ps.TouchStart:case ps.TouchEnd:return}c.push(gs(g,v,e))}),en(()=>{c.forEach(h=>h())})}function rY({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,sampling:a}){const l=en(pg(en(c=>{const d=Vg(c);if(!d||ti(d,r,s,i,!0))return;const p=n.getId(d);if(d===e&&e.defaultView){const h=GW(e.defaultView);t({id:p,x:h.left,y:h.top})}else t({id:p,x:d.scrollLeft,y:d.scrollTop})}),a.scroll||100));return gs("scroll",l,e)}function RPe({viewportResizeCb:t},{win:e}){let n=-1,r=-1;const s=en(pg(en(()=>{const i=WW(),a=YW();(n!==i||r!==a)&&(t({width:Number(a),height:Number(i)}),n=i,r=a)}),200));return gs("resize",s,e)}const NPe=["INPUT","TEXTAREA","SELECT"],Vz=new WeakMap;function jPe({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,ignoreClass:a,ignoreSelector:l,maskInputOptions:c,maskInputFn:d,sampling:p,userTriggeredOnInput:h,maskTextClass:g,unmaskTextClass:v,maskTextSelector:b,unmaskTextSelector:x}){function E(R){let M=Vg(R);const P=R.isTrusted,O=M&&gA(M.tagName);if(O==="OPTION"&&(M=M.parentElement),!M||!O||NPe.indexOf(O)<0||ti(M,r,s,i,!0))return;const L=M;if(L.classList.contains(a)||l&&L.matches(l))return;const z=Kj(M);let G=Vx(L,O,z),W=!1;const X=g_({maskInputOptions:c,tagName:O,type:z}),F=eh(M,g,b,v,x,X);(z==="radio"||z==="checkbox")&&(W=M.checked),G=fg({isMasked:F,element:M,value:G,maskInputFn:d}),S(M,h?{text:G,isChecked:W,userTriggered:P}:{text:G,isChecked:W});const Y=M.name;z==="radio"&&Y&&W&&e.querySelectorAll(`input[type="radio"][name="${Y}"]`).forEach(V=>{if(V!==M){const te=fg({isMasked:F,element:V,value:Vx(V,O,z),maskInputFn:d});S(V,h?{text:te,isChecked:!W,userTriggered:!1}:{text:te,isChecked:!W})}})}function S(R,M){const P=Vz.get(R);if(!P||P.text!==M.text||P.isChecked!==M.isChecked){Vz.set(R,M);const O=n.getId(R);en(t)({...M,id:O})}}const T=(p.input==="last"?["change"]:["input","change"]).map(R=>gs(R,en(E),e)),N=e.defaultView;if(!N)return()=>{T.forEach(R=>R())};const j=N.Object.getOwnPropertyDescriptor(N.HTMLInputElement.prototype,"value"),A=[[N.HTMLInputElement.prototype,"value"],[N.HTMLInputElement.prototype,"checked"],[N.HTMLSelectElement.prototype,"value"],[N.HTMLTextAreaElement.prototype,"value"],[N.HTMLSelectElement.prototype,"selectedIndex"],[N.HTMLOptionElement.prototype,"selected"]];return j&&j.set&&T.push(...A.map(R=>VW(R[0],R[1],{set(){en(E)({target:this,isTrusted:!1})}},!1,N))),en(()=>{T.forEach(R=>R())})}function Yx(t){const e=[];function n(r,s){if(Ky("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ky("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ky("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ky("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);s.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);s.unshift(a)}return s}return n(t,e)}function Fl(t,e,n){let r,s;return t?(t.ownerNode?r=e.getId(t.ownerNode):s=n.getId(t),{styleId:s,id:r}):{}}function MPe({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const s=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:en((p,h,g)=>{const[v,b]=g,{id:x,styleId:E}=Fl(h,e,n.styleMirror);return(x&&x!==-1||E&&E!==-1)&&t({id:x,styleId:E,adds:[{rule:v,index:b}]}),p.apply(h,g)})});const i=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:en((p,h,g)=>{const[v]=g,{id:b,styleId:x}=Fl(h,e,n.styleMirror);return(b&&b!==-1||x&&x!==-1)&&t({id:b,styleId:x,removes:[{index:v}]}),p.apply(h,g)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:en((p,h,g)=>{const[v]=g,{id:b,styleId:x}=Fl(h,e,n.styleMirror);return(b&&b!==-1||x&&x!==-1)&&t({id:b,styleId:x,replace:v}),p.apply(h,g)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:en((p,h,g)=>{const[v]=g,{id:b,styleId:x}=Fl(h,e,n.styleMirror);return(b&&b!==-1||x&&x!==-1)&&t({id:b,styleId:x,replaceSync:v}),p.apply(h,g)})}));const c={};Xy("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(Xy("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),Xy("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),Xy("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const d={};return Object.entries(c).forEach(([p,h])=>{d[p]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(d[p].insertRule,{apply:en((g,v,b)=>{const[x,E]=b,{id:S,styleId:k}=Fl(v.parentStyleSheet,e,n.styleMirror);return(S&&S!==-1||k&&k!==-1)&&t({id:S,styleId:k,adds:[{rule:x,index:[...Yx(v),E||0]}]}),g.apply(v,b)})}),h.prototype.deleteRule=new Proxy(d[p].deleteRule,{apply:en((g,v,b)=>{const[x]=b,{id:E,styleId:S}=Fl(v.parentStyleSheet,e,n.styleMirror);return(E&&E!==-1||S&&S!==-1)&&t({id:E,styleId:S,removes:[{index:[...Yx(v),x]}]}),g.apply(v,b)})})}),en(()=>{r.CSSStyleSheet.prototype.insertRule=s,r.CSSStyleSheet.prototype.deleteRule=i,a&&(r.CSSStyleSheet.prototype.replace=a),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([p,h])=>{h.prototype.insertRule=d[p].insertRule,h.prototype.deleteRule=d[p].deleteRule})})}function sY({mirror:t,stylesheetManager:e},n){let r=null;n.nodeName==="#document"?r=t.getId(n):r=t.getId(n.host);const s=n.nodeName==="#document"?na([n,"access",a=>a.defaultView,"optionalAccess",a=>a.Document]):na([n,"access",a=>a.ownerDocument,"optionalAccess",a=>a.defaultView,"optionalAccess",a=>a.ShadowRoot]),i=na([s,"optionalAccess",a=>a.prototype])?Object.getOwnPropertyDescriptor(na([s,"optionalAccess",a=>a.prototype]),"adoptedStyleSheets"):void 0;return r===null||r===-1||!s||!i?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return na([i,"access",a=>a.get,"optionalAccess",a=>a.call,"call",a=>a(this)])},set(a){const l=na([i,"access",c=>c.set,"optionalAccess",c=>c.call,"call",c=>c(this,a)]);if(r!==null&&r!==-1)try{e.adoptStyleSheets(a,r)}catch{}return l}}),en(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function OPe({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:s}){const i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:en((l,c,d)=>{const[p,h,g]=d;if(n.has(p))return i.apply(c,[p,h,g]);const{id:v,styleId:b}=Fl(na([c,"access",x=>x.parentRule,"optionalAccess",x=>x.parentStyleSheet]),e,r.styleMirror);return(v&&v!==-1||b&&b!==-1)&&t({id:v,styleId:b,set:{property:p,value:h,priority:g},index:Yx(c.parentRule)}),l.apply(c,d)})});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:en((l,c,d)=>{const[p]=d;if(n.has(p))return a.apply(c,[p]);const{id:h,styleId:g}=Fl(na([c,"access",v=>v.parentRule,"optionalAccess",v=>v.parentStyleSheet]),e,r.styleMirror);return(h&&h!==-1||g&&g!==-1)&&t({id:h,styleId:g,remove:{property:p},index:Yx(c.parentRule)}),l.apply(c,d)})}),en(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=a})}function IPe({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:r,mirror:s,sampling:i,doc:a}){const l=en(d=>pg(en(p=>{const h=Vg(p);if(!h||ti(h,e,n,r,!0))return;const{currentTime:g,volume:v,muted:b,playbackRate:x}=h;t({type:d,id:s.getId(h),currentTime:g,volume:v,muted:b,playbackRate:x})}),i.media||500)),c=[gs("play",l(0),a),gs("pause",l(1),a),gs("seeked",l(2),a),gs("volumechange",l(3),a),gs("ratechange",l(4),a)];return en(()=>{c.forEach(d=>d())})}function PPe({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],s=new WeakMap,i=n.FontFace;n.FontFace=function(c,d,p){const h=new i(c,d,p);return s.set(h,{family:c,buffer:typeof d!="string",descriptors:p,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),h};const a=Qj(e.fonts,"add",function(l){return function(c){return y_(en(()=>{const d=s.get(c);d&&(t(d),s.delete(c))}),0),l.apply(this,[c])}});return r.push(()=>{n.FontFace=i}),r.push(a),en(()=>{r.forEach(l=>l())})}function DPe(t){const{doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,selectionCb:a}=t;let l=!0;const c=en(()=>{const d=e.getSelection();if(!d||l&&na([d,"optionalAccess",g=>g.isCollapsed]))return;l=d.isCollapsed||!1;const p=[],h=d.rangeCount||0;for(let g=0;g<h;g++){const v=d.getRangeAt(g),{startContainer:b,startOffset:x,endContainer:E,endOffset:S}=v;ti(b,r,s,i,!0)||ti(E,r,s,i,!0)||p.push({start:n.getId(b),startOffset:x,end:n.getId(E),endOffset:S})}a({ranges:p})});return c(),gs("selectionchange",c)}function LPe({doc:t,customElementCb:e}){const n=t.defaultView;return!n||!n.customElements?()=>{}:Qj(n.customElements,"define",function(s){return function(i,a,l){try{e({define:{name:i}})}catch{}return s.apply(this,[i,a,l])}})}function $Pe(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let r;t.recordDOM&&(r=nY(t,t.doc));const s=CPe(t),i=APe(t),a=rY(t),l=RPe(t,{win:n}),c=jPe(t),d=IPe(t);let p=()=>{},h=()=>{},g=()=>{},v=()=>{};t.recordDOM&&(p=MPe(t,{win:n}),h=sY(t,t.doc),g=OPe(t,{win:n}),t.collectFonts&&(v=PPe(t)));const b=DPe(t),x=LPe(t),E=[];for(const S of t.plugins)E.push(S.observer(S.callback,n,S.options));return en(()=>{df.forEach(S=>S.reset()),na([r,"optionalAccess",S=>S.disconnect,"call",S=>S()]),s(),i(),a(),l(),c(),d(),p(),h(),g(),v(),b(),x(),E.forEach(S=>S())})}function Ky(t){return typeof window[t]<"u"}function Xy(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class _A{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,r,s){const i=r||this.getIdToRemoteIdMap(e),a=s||this.getRemoteIdToIdMap(e);let l=i.get(n);return l||(l=this.generateIdFn(),i.set(n,l),a.set(l,n)),l}getIds(e,n){const r=this.getIdToRemoteIdMap(e),s=this.getRemoteIdToIdMap(e);return n.map(i=>this.getId(e,i,r,s))}getRemoteId(e,n,r){const s=r||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;const i=s.get(n);return i||-1}getRemoteIds(e,n){const r=this.getRemoteIdToIdMap(e);return n.map(s=>this.getRemoteId(e,s,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}function Gz(t){let e,n=t[0],r=1;for(;r<t.length;){const s=t[r],i=t[r+1];if(r+=2,(s==="optionalAccess"||s==="optionalCall")&&n==null)return;s==="access"||s==="optionalAccess"?(e=n,n=i(n)):(s==="call"||s==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}class zPe{constructor(){this.crossOriginIframeMirror=new _A(Xj),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class FPe{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new _A(Xj),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new _A(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),Gz([this,"access",s=>s.loadListener,"optionalCall",s=>s(e)]);const r=Zj(e);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(e){const n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;const s=this.crossOriginIframeMap.get(e.source);if(!s)return;const i=this.transformCrossOriginEvent(s,n.data.event);i&&this.wrappedEmit(i,n.data.isCheckout)}transformCrossOriginEvent(e,n){switch(n.type){case Ft.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);const r=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(n.data.node,r),{timestamp:n.timestamp,type:Ft.IncrementalSnapshot,data:{source:Tt.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ft.Meta:case Ft.Load:case Ft.DomContentLoaded:return!1;case Ft.Plugin:return n;case Ft.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case Ft.IncrementalSnapshot:switch(n.data.source){case Tt.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(r.node,s)}),n.data.removes.forEach(r=>{this.replaceIds(r,e,["parentId","id"])}),n.data.attributes.forEach(r=>{this.replaceIds(r,e,["id"])}),n.data.texts.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case Tt.Drag:case Tt.TouchMove:case Tt.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case Tt.ViewportResize:return!1;case Tt.MediaInteraction:case Tt.MouseInteraction:case Tt.Scroll:case Tt.CanvasMutation:case Tt.Input:return this.replaceIds(n.data,e,["id"]),n;case Tt.StyleSheetRule:case Tt.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case Tt.Font:return n;case Tt.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,e,["start","end"])}),n;case Tt.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),Gz([n,"access",r=>r.data,"access",r=>r.styles,"optionalAccess",r=>r.forEach,"call",r=>r(s=>{this.replaceStyleIds(s,e,["styleId"])})]),n}}return!1}replace(e,n,r,s){for(const i of s)!Array.isArray(n[i])&&typeof n[i]!="number"||(Array.isArray(n[i])?n[i]=e.getIds(r,n[i]):n[i]=e.getId(r,n[i]));return n}replaceIds(e,n,r){return this.replace(this.crossOriginIframeMirror,e,n,r)}replaceStyleIds(e,n,r){return this.replace(this.crossOriginIframeStyleMirror,e,n,r)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(e,n){e.type!==Cr.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class UPe{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class BPe{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(!Rm(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const r=nY({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(rY({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),y_(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(sY({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const n=Zj(e),r=xPe(e);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(e,n){const r=this;this.restoreHandlers.push(Qj(e.prototype,"attachShadow",function(s){return function(i){const a=s.call(this,i);return this.shadowRoot&&eY(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}class Wz{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class HPe{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new mPe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;const r={id:n,styleIds:[]},s=[];for(const i of e){let a;this.styleMirror.has(i)?a=this.styleMirror.getId(i):(a=this.styleMirror.add(i),s.push({styleId:a,rules:Array.from(i.rules||CSSRule,(l,c)=>({rule:LW(l),index:c}))})),r.styleIds.push(a)}s.length>0&&(r.styles=s),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class qPe{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,n){const r=this.nodeMap.get(e);return r&&Array.from(r).some(s=>s!==n)}add(e,n){this.active||(this.active=!0,yPe(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}destroy(){}}let Yn,Kx;try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=_b([t,"access",e=>e.contentWindow,"optionalAccess",e=>e.Array,"access",e=>e.from])||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}const Ki=HIe();function $o(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:s="rr-block",blockSelector:i=null,unblockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:c=null,maskAllText:d=!1,maskTextClass:p="rr-mask",unmaskTextClass:h=null,maskTextSelector:g=null,unmaskTextSelector:v=null,inlineStylesheet:b=!0,maskAllInputs:x,maskInputOptions:E,slimDOMOptions:S,maskAttributeFn:k,maskInputFn:T,maskTextFn:N,maxCanvasSize:j=null,packFn:A,sampling:R={},dataURLOptions:M={},mousemoveWait:P,recordDOM:O=!0,recordCanvas:L=!1,recordCrossOriginIframes:z=!1,recordAfter:G=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:X=!1,inlineImages:F=!1,plugins:Y,keepIframeSrcFn:V=()=>!1,ignoreCSSAttributes:te=new Set([]),errorHandler:I,onMutation:re,getCanvasManager:ue}=t;kPe(I);const D=z?window.parent===window:!0;let Z=!1;if(!D)try{window.parent.document&&(Z=!1)}catch{Z=!0}if(D&&!e)throw new Error("emit function is required");if(!D&&!Z)return()=>{};P!==void 0&&R.mousemove===void 0&&(R.mousemove=P),Ki.reset();const he=x===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:E!==void 0?E:{},q=S===!0||S==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:S==="all",headMetaDescKeywords:S==="all"}:S||{};pPe();let U,K=0;const ae=He=>{for(const mt of Y||[])mt.eventProcessor&&(He=mt.eventProcessor(He));return A&&!Z&&(He=A(He)),He};Yn=(He,mt)=>{const De=He;if(De.timestamp=Wx(),_b([df,"access",et=>et[0],"optionalAccess",et=>et.isFrozen,"call",et=>et()])&&De.type!==Ft.FullSnapshot&&!(De.type===Ft.IncrementalSnapshot&&De.data.source===Tt.Mutation)&&df.forEach(et=>et.unfreeze()),D)_b([e,"optionalCall",et=>et(ae(De),mt)]);else if(Z){const et={type:"rrweb",event:ae(De),origin:window.location.origin,isCheckout:mt};window.parent.postMessage(et,"*")}if(De.type===Ft.FullSnapshot)U=De,K=0;else if(De.type===Ft.IncrementalSnapshot){if(De.data.source===Tt.Mutation&&De.data.isAttachIframe)return;K++;const et=r&&K>=r,ot=n&&U&&De.timestamp-U.timestamp>n;(et||ot)&&ft(!0)}};const B=He=>{Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.Mutation,...He}})},J=He=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.Scroll,...He}}),oe=He=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.CanvasMutation,...He}}),fe=He=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.AdoptedStyleSheet,...He}}),xe=new HPe({mutationCb:B,adoptedStyleSheetCb:fe}),Ae=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new zPe:new FPe({mirror:Ki,mutationCb:B,stylesheetManager:xe,recordCrossOriginIframes:z,wrappedEmit:Yn});for(const He of Y||[])He.getMirror&&He.getMirror({nodeMirror:Ki,crossOriginIframeMirror:Ae.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ae.crossOriginIframeStyleMirror});const Oe=new qPe,Re=GPe(ue,{mirror:Ki,win:window,mutationCb:He=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.CanvasMutation,...He}}),recordCanvas:L,blockClass:s,blockSelector:i,unblockSelector:a,maxCanvasSize:j,sampling:R.canvas,dataURLOptions:M,errorHandler:I}),Je=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new UPe:new BPe({mutationCb:B,scrollCb:J,bypassOptions:{onMutation:re,blockClass:s,blockSelector:i,unblockSelector:a,maskAllText:d,maskTextClass:p,unmaskTextClass:h,maskTextSelector:g,unmaskTextSelector:v,inlineStylesheet:b,maskInputOptions:he,dataURLOptions:M,maskAttributeFn:k,maskTextFn:N,maskInputFn:T,recordCanvas:L,inlineImages:F,sampling:R,slimDOMOptions:q,iframeManager:Ae,stylesheetManager:xe,canvasManager:Re,keepIframeSrcFn:V,processedNodeManager:Oe},mirror:Ki}),ft=(He=!1)=>{if(!O)return;Yn({type:Ft.Meta,data:{href:window.location.href,width:YW(),height:WW()}},He),xe.reset(),Je.init(),df.forEach(De=>De.lock());const mt=fPe(document,{mirror:Ki,blockClass:s,blockSelector:i,unblockSelector:a,maskAllText:d,maskTextClass:p,unmaskTextClass:h,maskTextSelector:g,unmaskTextSelector:v,inlineStylesheet:b,maskAllInputs:he,maskAttributeFn:k,maskInputFn:T,maskTextFn:N,slimDOM:q,dataURLOptions:M,recordCanvas:L,inlineImages:F,onSerialize:De=>{QW(De,Ki)&&Ae.addIframe(De),JW(De,Ki)&&xe.trackLinkElement(De),bA(De)&&Je.addShadowRoot(De.shadowRoot,document)},onIframeLoad:(De,et)=>{Ae.attachIframe(De,et),De.contentWindow&&Re.addWindow(De.contentWindow),Je.observeAttachShadow(De)},onStylesheetLoad:(De,et)=>{xe.attachLinkElement(De,et)},keepIframeSrcFn:V});if(!mt)return console.warn("Failed to snapshot the document");Yn({type:Ft.FullSnapshot,data:{node:mt,initialOffset:GW(window)}}),df.forEach(De=>De.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&xe.adoptStyleSheets(document.adoptedStyleSheets,Ki.getId(document))};Kx=ft;try{const He=[],mt=et=>en($Pe)({onMutation:re,mutationCb:B,mousemoveCb:(ot,ur)=>Yn({type:Ft.IncrementalSnapshot,data:{source:ur,positions:ot}}),mouseInteractionCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.MouseInteraction,...ot}}),scrollCb:J,viewportResizeCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.ViewportResize,...ot}}),inputCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.Input,...ot}}),mediaInteractionCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.MediaInteraction,...ot}}),styleSheetRuleCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.StyleSheetRule,...ot}}),styleDeclarationCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.StyleDeclaration,...ot}}),canvasMutationCb:oe,fontCb:ot=>Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.Font,...ot}}),selectionCb:ot=>{Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.Selection,...ot}})},customElementCb:ot=>{Yn({type:Ft.IncrementalSnapshot,data:{source:Tt.CustomElement,...ot}})},blockClass:s,ignoreClass:l,ignoreSelector:c,maskAllText:d,maskTextClass:p,unmaskTextClass:h,maskTextSelector:g,unmaskTextSelector:v,maskInputOptions:he,inlineStylesheet:b,sampling:R,recordDOM:O,recordCanvas:L,inlineImages:F,userTriggeredOnInput:W,collectFonts:X,doc:et,maskAttributeFn:k,maskInputFn:T,maskTextFn:N,keepIframeSrcFn:V,blockSelector:i,unblockSelector:a,slimDOMOptions:q,dataURLOptions:M,mirror:Ki,iframeManager:Ae,stylesheetManager:xe,shadowDomManager:Je,processedNodeManager:Oe,canvasManager:Re,ignoreCSSAttributes:te,plugins:_b([Y,"optionalAccess",ot=>ot.filter,"call",ot=>ot(ur=>ur.observer),"optionalAccess",ot=>ot.map,"call",ot=>ot(ur=>({observer:ur.observer,options:ur.options,callback:_e=>Yn({type:Ft.Plugin,data:{plugin:ur.name,payload:_e}})}))])||[]},{});Ae.addLoadListener(et=>{try{He.push(mt(et.contentDocument))}catch(ot){console.warn(ot)}});const De=()=>{ft(),He.push(mt(document))};return document.readyState==="interactive"||document.readyState==="complete"?De():(He.push(gs("DOMContentLoaded",()=>{Yn({type:Ft.DomContentLoaded,data:{}}),G==="DOMContentLoaded"&&De()})),He.push(gs("load",()=>{Yn({type:Ft.Load,data:{}}),G==="load"&&De()},window))),()=>{He.forEach(et=>et()),Oe.destroy(),Kx=void 0,TPe()}}catch(He){console.warn(He)}}function VPe(t){if(!Kx)throw new Error("please take full snapshot after start recording");Kx(t)}$o.mirror=Ki;$o.takeFullSnapshot=VPe;function GPe(t,e){try{return t?t(e):new Wz}catch{return console.warn("Unable to initialize CanvasManager"),new Wz}}const WPe=3,YPe=5;function eM(t){return t>9999999999?t:t*1e3}function fk(t){return t>9999999999?t/1e3:t}function Gg(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:Ft.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:ea(e,10,1e3)}}),e.category==="console")))}const KPe="button,a";function iY(t){return t.closest(KPe)||t}function aY(t){const e=oY(t);return!e||!(e instanceof Element)?e:iY(e)}function oY(t){return XPe(t)?t.target:t}function XPe(t){return typeof t=="object"&&!!t&&"target"in t}let Ul;function QPe(t){return Ul||(Ul=[],JPe()),Ul.push(t),()=>{const e=Ul?Ul.indexOf(t):-1;e>-1&&Ul.splice(e,1)}}function JPe(){$s(Cn,"open",function(t){return function(...e){if(Ul)try{Ul.forEach(n=>n())}catch{}return t.apply(Cn,e)}})}const ZPe=new Set([Tt.Mutation,Tt.StyleSheetRule,Tt.StyleDeclaration,Tt.AdoptedStyleSheet,Tt.CanvasMutation,Tt.Selection,Tt.MediaInteraction]);function eDe(t,e,n){t.handleClick(e,n)}class tDe{constructor(e,n,r=Gg){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const e=QPe(()=>{this._lastMutation=Yz()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(rDe(n,this._ignoreSelector)||!sDe(e))return;const r={timestamp:fk(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};this._clicks.some(s=>s.node===r.node&&Math.abs(s.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=fk(e)}registerScroll(e=Date.now()){this._lastScroll=fk(e)}registerClick(e){const n=iY(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){const e=[],n=Yz();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=n&&e.push(r)});for(const r of e){const s=this._clicks.indexOf(r);s>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(s,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const n=this._replay,r=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,s=e.mutationAfter&&e.mutationAfter<=this._threshold,i=!r&&!s,{clickCount:a,clickBreadcrumb:l}=e;if(i){const c=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,d=c<this._timeout*1e3?"mutation":"timeout",p={type:"default",message:l.message,timestamp:l.timestamp,category:"ui.slowClickDetected",data:{...l.data,url:Cn.location.href,route:n.getCurrentRoute(),timeAfterClickMs:c,endReason:d,clickCount:a||1}};this._addBreadcrumbEvent(n,p);return}if(a>1){const c={type:"default",message:l.message,timestamp:l.timestamp,category:"ui.multiClick",data:{...l.data,url:Cn.location.href,route:n.getCurrentRoute(),clickCount:a,metric:!0}};this._addBreadcrumbEvent(n,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Jf(()=>this._checkClicks(),1e3)}}const nDe=["A","BUTTON","INPUT"];function rDe(t,e){return!!(!nDe.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function sDe(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function Yz(){return Date.now()/1e3}function iDe(t,e){try{if(!aDe(e))return;const{source:n}=e.data;if(ZPe.has(n)&&t.registerMutation(e.timestamp),n===Tt.Scroll&&t.registerScroll(e.timestamp),oDe(e)){const{type:r,id:s}=e.data,i=$o.mirror.getNode(s);i instanceof HTMLElement&&r===ps.Click&&t.registerClick(i)}}catch{}}function aDe(t){return t.type===WPe}function oDe(t){return t.data.source===Tt.MouseInteraction}function Da(t){return{timestamp:Date.now()/1e3,type:"default",...t}}var Xx;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(Xx||(Xx={}));const lDe=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function cDe(t){const e={};!t["data-sentry-component"]&&t["data-sentry-element"]&&(t["data-sentry-component"]=t["data-sentry-element"]);for(const n in t)if(lDe.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),e[r]=t[n]}return e}const uDe=t=>e=>{if(!t.isEnabled())return;const n=dDe(e);if(!n)return;const r=e.name==="click",s=r?e.event:void 0;r&&t.clickDetector&&s&&s.target&&!s.altKey&&!s.metaKey&&!s.ctrlKey&&!s.shiftKey&&eDe(t.clickDetector,n,aY(e.event)),Gg(t,n)};function lY(t,e){const n=$o.mirror.getId(t),r=n&&$o.mirror.getNode(n),s=r&&$o.mirror.getMeta(r),i=s&&hDe(s)?s:null;return{message:e,data:i?{nodeId:n,node:{id:n,tagName:i.tagName,textContent:Array.from(i.childNodes).map(a=>a.type===Xx.Text&&a.textContent).filter(Boolean).map(a=>a.trim()).join(""),attributes:cDe(i.attributes)}}:{}}}function dDe(t){const{target:e,message:n}=fDe(t);return Da({category:`ui.${t.name}`,...lY(e,n)})}function fDe(t){const e=t.name==="click";let n,r=null;try{r=e?aY(t.event):oY(t.event),n=Ko(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function hDe(t){return t.type===Xx.Element}function pDe(t,e){if(!t.isEnabled())return;t.updateUserActivity();const n=mDe(e);n&&Gg(t,n)}function mDe(t){const{metaKey:e,shiftKey:n,ctrlKey:r,altKey:s,key:i,target:a}=t;if(!a||gDe(a)||!i)return null;const l=e||r||s,c=i.length===1;if(!l&&c)return null;const d=Ko(a,{maxStringLength:200})||"<unknown>",p=lY(a,d);return Da({category:"ui.keyDown",message:d,data:{...p.data,metaKey:e,shiftKey:n,ctrlKey:r,altKey:s,key:i}})}function gDe(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}const vDe={resource:wDe,paint:xDe,navigation:_De};function Qy(t,e){return({metric:n})=>void e.replayPerformanceEntries.push(t(n))}function yDe(t){return t.map(bDe).filter(Boolean)}function bDe(t){const e=vDe[t.entryType];return e?e(t):null}function th(t){return((xs||Cn.performance.timeOrigin)+t)/1e3}function xDe(t){const{duration:e,entryType:n,name:r,startTime:s}=t,i=th(s);return{type:n,name:r,start:i,end:i+e,data:void 0}}function _De(t){const{entryType:e,name:n,decodedBodySize:r,duration:s,domComplete:i,encodedBodySize:a,domContentLoadedEventStart:l,domContentLoadedEventEnd:c,domInteractive:d,loadEventStart:p,loadEventEnd:h,redirectCount:g,startTime:v,transferSize:b,type:x}=t;return s===0?null:{type:`${e}.${x}`,start:th(v),end:th(i),name:n,data:{size:b,decodedBodySize:r,encodedBodySize:a,duration:s,domInteractive:d,domContentLoadedEventStart:l,domContentLoadedEventEnd:c,loadEventStart:p,loadEventEnd:h,domComplete:i,redirectCount:g}}}function wDe(t){const{entryType:e,initiatorType:n,name:r,responseEnd:s,startTime:i,decodedBodySize:a,encodedBodySize:l,responseStatus:c,transferSize:d}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${e}.${n}`,start:th(i),end:th(s),name:r,data:{size:d,statusCode:c,decodedBodySize:a,encodedBodySize:l}}}function SDe(t){const e=t.entries[t.entries.length-1],n=e&&e.element?[e.element]:void 0;return b_(t,"largest-contentful-paint",n)}function EDe(t){return t.sources!==void 0}function kDe(t){const e=[],n=[];for(const r of t.entries)if(EDe(r)){const s=[];for(const i of r.sources)if(i.node){n.push(i.node);const a=$o.mirror.getId(i.node);a&&s.push(a)}e.push({value:r.value,nodeIds:s.length?s:void 0})}return b_(t,"cumulative-layout-shift",n,e)}function TDe(t){const e=t.entries[t.entries.length-1],n=e&&e.target?[e.target]:void 0;return b_(t,"first-input-delay",n)}function CDe(t){const e=t.entries[t.entries.length-1],n=e&&e.target?[e.target]:void 0;return b_(t,"interaction-to-next-paint",n)}function b_(t,e,n,r){const s=t.value,i=t.rating,a=th(s);return{type:"web-vital",name:e,start:a,end:a,data:{value:s,size:s,rating:i,nodeIds:n?n.map(l=>$o.mirror.getId(l)):void 0,attributions:r}}}function ADe(t){function e(s){t.performanceEntries.includes(s)||t.performanceEntries.push(s)}function n({entries:s}){s.forEach(e)}const r=[];return["navigation","paint","resource"].forEach(s=>{r.push(Qf(s,n))}),r.push(kW(Qy(SDe,t)),qj(Qy(kDe,t)),TW(Qy(TDe,t)),CW(Qy(CDe,t))),()=>{r.forEach(s=>s())}}const bt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,RDe='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},U=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=x(f,15),M=b.t,E=b.l,A=x(h,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(a[t]^a[t+1]<<A^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=U(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;o<e;++o){if(a+5>i.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function NDe(){const t=new Blob([RDe]);return URL.createObjectURL(t)}const Kz=["info","warn","error","log"],Eb="[Replay] ";function hk(t,e="info"){cc({category:"console",data:{logger:"replay"},level:e,message:`${Eb}${t}`},{level:e})}function jDe(){let t=!1,e=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{t=r.captureExceptions,e=r.traceInternals}};return bt?(Kz.forEach(r=>{n[r]=(...s)=>{Fe[r](Eb,...s),e&&hk(s.join(""),cW(r))}}),n.exception=(r,...s)=>{s.length&&n.error&&n.error(...s),Fe.error(Eb,r),t?QG(r):e&&hk(r,"error")},n.infoTick=(...r)=>{Fe.info(Eb,...r),e&&setTimeout(()=>hk(r[0]),0)}):Kz.forEach(r=>{n[r]=()=>{}}),n}const Et=jDe();class tM extends Error{constructor(){super(`Event buffer exceeded maximum size of ${Yj}.`)}}class cY{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>Yj)throw new tM;this.events.push(e)}finish(){return new Promise(e=>{const n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(n=>n.timestamp).sort()[0];return e?eM(e):null}}class MDe{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?e():n()},{once:!0}),this._worker.addEventListener("error",r=>{n(r)},{once:!0})}),this._ensureReadyPromise)}destroy(){bt&&Et.info("Destroying compression worker"),this._worker.terminate()}postMessage(e,n){const r=this._getAndIncrementId();return new Promise((s,i)=>{const a=({data:l})=>{const c=l;if(c.method===e&&c.id===r){if(this._worker.removeEventListener("message",a),!c.success){bt&&Et.error("Error in compression worker: ",c.response),i(new Error("Error in compression worker"));return}s(c.response)}};this._worker.addEventListener("message",a),this._worker.postMessage({id:r,method:e,arg:n})})}_getAndIncrementId(){return this._id++}}class ODe{constructor(e){this._worker=new MDe(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const n=eM(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const r=JSON.stringify(e);return this._totalSize+=r.length,this._totalSize>Yj?Promise.reject(new tM):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{bt&&Et.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class IDe{constructor(e){this._fallback=new cY,this._compression=new ODe(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(e){bt&&Et.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:n,waitForCheckout:r}=this._fallback,s=[];for(const i of e)s.push(this._compression.addEvent(i));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(s),this._fallback.clear()}catch(i){bt&&Et.exception(i,"Failed to add events when switching buffers.")}}}function PDe({useCompression:t,workerUrl:e}){if(t&&window.Worker){const n=DDe(e);if(n)return n}return bt&&Et.info("Using simple buffer"),new cY}function DDe(t){try{const e=t||LDe();if(!e)return;bt&&Et.info(`Using compression worker${t?` from ${t}`:""}`);const n=new Worker(e);return new IDe(n)}catch(e){bt&&Et.exception(e,"Failed to create compression worker")}}function LDe(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?NDe():""}function nM(){try{return"sessionStorage"in Cn&&!!Cn.sessionStorage}catch{return!1}}function $De(t){zDe(),t.session=void 0}function zDe(){if(nM())try{Cn.sessionStorage.removeItem(Gj)}catch{}}function uY(t){return t===void 0?!1:Math.random()<t}function dY(t){const e=Date.now(),n=t.id||ci(),r=t.started||e,s=t.lastActivity||e,i=t.segmentId||0,a=t.sampled,l=t.previousSessionId;return{id:n,started:r,lastActivity:s,segmentId:i,sampled:a,previousSessionId:l}}function rM(t){if(nM())try{Cn.sessionStorage.setItem(Gj,JSON.stringify(t))}catch{}}function FDe(t,e){return uY(t)?"session":e?"buffer":!1}function Xz({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:r}={}){const s=FDe(t,e),i=dY({sampled:s,previousSessionId:r});return n&&rM(i),i}function UDe(){if(!nM())return null;try{const t=Cn.sessionStorage.getItem(Gj);if(!t)return null;const e=JSON.parse(t);return bt&&Et.infoTick("Loading existing session"),dY(e)}catch{return null}}function wA(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function fY(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:r=Date.now()}){return wA(t.started,e,r)||wA(t.lastActivity,n,r)}function hY(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!fY(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function pk({sessionIdleExpire:t,maxReplayDuration:e,previousSessionId:n},r){const s=r.stickySession&&UDe();return s?hY(s,{sessionIdleExpire:t,maxReplayDuration:e})?(bt&&Et.infoTick("Session in sessionStorage is expired, creating new one..."),Xz(r,{previousSessionId:s.id})):s:(bt&&Et.infoTick("Creating new session"),Xz(r,{previousSessionId:n}))}function BDe(t){return t.type===Ft.Custom}function sM(t,e,n){return mY(t,e)?(pY(t,e,n),!0):!1}function HDe(t,e,n){return mY(t,e)?pY(t,e,n):Promise.resolve(null)}async function pY(t,e,n){const{eventBuffer:r}=t;if(!r||r.waitForCheckout&&!n)return null;const s=t.recordingMode==="buffer";try{n&&s&&r.clear(),n&&(r.hasCheckout=!0,r.waitForCheckout=!1);const i=t.getOptions(),a=qDe(e,i.beforeAddRecordingEvent);return a?await r.addEvent(a):void 0}catch(i){const a=i&&i instanceof tM,l=a?"addEventSizeExceeded":"addEvent";if(a&&s)return r.clear(),r.waitForCheckout=!0,null;t.handleException(i),await t.stop({reason:l});const c=Yt();c&&c.recordDroppedEvent("internal_sdk_error","replay")}}function mY(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;const n=eM(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(bt&&Et.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function qDe(t,e){try{if(typeof e=="function"&&BDe(t))return e(t)}catch(n){return bt&&Et.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return t}function iM(t){return!t.type}function SA(t){return t.type==="transaction"}function VDe(t){return t.type==="replay_event"}function Qz(t){return t.type==="feedback"}function GDe(t){return(e,n)=>{if(!t.isEnabled()||!iM(e)&&!SA(e))return;const r=n&&n.statusCode;if(!(!r||r<200||r>=300)){if(SA(e)){WDe(t,e);return}YDe(t,e)}}}function WDe(t,e){const n=t.getContext();e.contexts&&e.contexts.trace&&e.contexts.trace.trace_id&&n.traceIds.size<100&&n.traceIds.add(e.contexts.trace.trace_id)}function YDe(t,e){const n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!e.tags||!e.tags.replayId)return;const{beforeErrorSampling:r}=t.getOptions();typeof r=="function"&&!r(e)||Jf(async()=>{try{await t.sendBufferedReplayOrFlush()}catch(s){t.handleException(s)}})}function KDe(t){return e=>{!t.isEnabled()||!iM(e)||XDe(t,e)}}function XDe(t,e){const n=e.exception&&e.exception.values&&e.exception.values[0]&&e.exception.values[0].value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const r=Da({category:"replay.hydrate-error",data:{url:_G()}});Gg(t,r)}}function QDe(t){const e=Yt();e&&e.on("beforeAddBreadcrumb",n=>JDe(t,n))}function JDe(t,e){if(!t.isEnabled()||!gY(e))return;const n=ZDe(e);n&&Gg(t,n)}function ZDe(t){return!gY(t)||["fetch","xhr","sentry.event","sentry.transaction"].includes(t.category)||t.category.startsWith("ui.")?null:t.category==="console"?eLe(t):Da(t)}function eLe(t){const e=t.data&&t.data.arguments;if(!Array.isArray(e)||e.length===0)return Da(t);let n=!1;const r=e.map(s=>{if(!s)return s;if(typeof s=="string")return s.length>Yy?(n=!0,`${s.slice(0,Yy)}…`):s;if(typeof s=="object")try{const i=ea(s,7);return JSON.stringify(i).length>Yy?(n=!0,`${JSON.stringify(i,null,2).slice(0,Yy)}…`):i}catch{}return s});return Da({...t,data:{...t.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function gY(t){return!!t.category}function tLe(t,e){return t.type||!t.exception||!t.exception.values||!t.exception.values.length?!1:!!(e.originalException&&e.originalException.__rrweb__)}function vY(){const t=Rn().getPropagationContext().dsc;t&&delete t.replay_id;const e=Fr();if(e){const n=Bu(e);delete n.replay_id}}function nLe(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:Ft.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function rLe(t,e){return t.recordingMode!=="buffer"||e.message===Wj||!e.exception||e.type?!1:uY(t.getOptions().errorSampleRate)}function sLe(t){return Object.assign((e,n)=>!t.isEnabled()||t.isPaused()?e:VDe(e)?(delete e.breadcrumbs,e):!iM(e)&&!SA(e)&&!Qz(e)?e:t.checkAndHandleExpiredSession()?Qz(e)?(t.flush(),e.contexts.feedback.replay_id=t.getSessionId(),nLe(t,e),e):tLe(e,n)&&!t.getOptions()._experiments.captureExceptions?(bt&&Et.log("Ignoring error from rrweb internals",e),null):((rLe(t,e)||t.recordingMode==="session")&&(e.tags={...e.tags,replayId:t.getSessionId()}),e):(vY(),e),{id:"Replay"})}function x_(t,e){return e.map(({type:n,start:r,end:s,name:i,data:a})=>{const l=t.throttledAddEvent({type:Ft.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:i,startTimestamp:r,endTimestamp:s,data:a}}});return typeof l=="string"?Promise.resolve(null):l})}function iLe(t){const{from:e,to:n}=t,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:e}}}function aLe(t){return e=>{if(!t.isEnabled())return;const n=iLe(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(x_(t,[n]),!1)))}}function oLe(t,e){return bt&&t.getOptions()._experiments.traceInternals?!1:iMe(e,Yt())}function yY(t,e){t.isEnabled()&&e!==null&&(oLe(t,e.name)||t.addUpdate(()=>(x_(t,[e]),!0)))}function __(t){if(!t)return;const e=new TextEncoder;try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){const n=wY(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function bY(t){if(!t)return;const e=parseInt(t,10);return isNaN(e)?void 0:e}function xY(t){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[wY(t)];if(!t)return[void 0]}catch(e){return bt&&Et.exception(e,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return bt&&Et.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Qx(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};const n={...t._meta},r=n.warnings||[];return n.warnings=[...r,e],t._meta=n,t}function _Y(t,e){if(!e)return null;const{startTimestamp:n,endTimestamp:r,url:s,method:i,statusCode:a,request:l,response:c}=e;return{type:t,start:n/1e3,end:r/1e3,name:s,data:Nr({method:i,statusCode:a,request:l,response:c})}}function mg(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function Ql(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};const r={headers:t,size:e},{body:s,warnings:i}=lLe(n);return r.body=s,i&&i.length>0&&(r._meta={warnings:i}),r}function EA(t,e){return Object.entries(t).reduce((n,[r,s])=>{const i=r.toLowerCase();return e.includes(i)&&t[r]&&(n[i]=s),n},{})}function wY(t){return new URLSearchParams(t).toString()}function lLe(t){if(!t||typeof t!="string")return{body:t};const e=t.length>jz,n=cLe(t);if(e){const r=t.slice(0,jz);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function cLe(t){const e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function Jx(t,e){const n=uLe(t);return Xl(n,e)}function uLe(t,e=Cn.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(Cn.location.origin))return t;const n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;const r=n.href;return!t.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function dLe(t,e,n){try{const r=await hLe(t,e,n),s=_Y("resource.fetch",r);yY(n.replay,s)}catch(r){bt&&Et.exception(r,"Failed to capture fetch breadcrumb")}}function fLe(t,e){const{input:n,response:r}=e,s=n?SY(n):void 0,i=__(s),a=r?bY(r.headers.get("content-length")):void 0;i!==void 0&&(t.data.request_body_size=i),a!==void 0&&(t.data.response_body_size=a)}async function hLe(t,e,n){const r=Date.now(),{startTimestamp:s=r,endTimestamp:i=r}=e,{url:a,method:l,status_code:c=0,request_body_size:d,response_body_size:p}=t.data,h=Jx(a,n.networkDetailAllowUrls)&&!Jx(a,n.networkDetailDenyUrls),g=h?pLe(n,e.input,d):mg(d),v=await mLe(h,n,e.response,p);return{startTimestamp:s,endTimestamp:i,url:a,method:l,statusCode:c,request:g,response:v}}function pLe({networkCaptureBodies:t,networkRequestHeaders:e},n,r){const s=n?yLe(n,e):{};if(!t)return Ql(s,r,void 0);const i=SY(n),[a,l]=xY(i),c=Ql(s,r,a);return l?Qx(c,l):c}async function mLe(t,{networkCaptureBodies:e,networkResponseHeaders:n},r,s){if(!t&&s!==void 0)return mg(s);const i=r?EY(r.headers,n):{};if(!r||!e&&s!==void 0)return Ql(i,s,void 0);const[a,l]=await vLe(r),c=gLe(a,{networkCaptureBodies:e,responseBodySize:s,captureDetails:t,headers:i});return l?Qx(c,l):c}function gLe(t,{networkCaptureBodies:e,responseBodySize:n,captureDetails:r,headers:s}){try{const i=t&&t.length&&n===void 0?__(t):n;return r?e?Ql(s,i,t):Ql(s,i,void 0):mg(i)}catch(i){return bt&&Et.exception(i,"Failed to serialize response body"),Ql(s,n,void 0)}}async function vLe(t){const e=bLe(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await xLe(e)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(bt&&Et.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(bt&&Et.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function SY(t=[]){if(!(t.length!==2||typeof t[1]!="object"))return t[1].body}function EY(t,e){const n={};return e.forEach(r=>{t.get(r)&&(n[r]=t.get(r))}),n}function yLe(t,e){return t.length===1&&typeof t[0]!="string"?Jz(t[0],e):t.length===2?Jz(t[1],e):{}}function Jz(t,e){if(!t)return{};const n=t.headers;return n?n instanceof Headers?EY(n,e):Array.isArray(n)?{}:EA(n,e):{}}function bLe(t){try{return t.clone()}catch(e){bt&&Et.exception(e,"Failed to clone response body")}}function xLe(t){return new Promise((e,n)=>{const r=Jf(()=>n(new Error("Timeout while trying to read response body")),500);_Le(t).then(s=>e(s),s=>n(s)).finally(()=>clearTimeout(r))})}async function _Le(t){return await t.text()}async function wLe(t,e,n){try{const r=ELe(t,e,n),s=_Y("resource.xhr",r);yY(n.replay,s)}catch(r){bt&&Et.exception(r,"Failed to capture xhr breadcrumb")}}function SLe(t,e){const{xhr:n,input:r}=e;if(!n)return;const s=__(r),i=n.getResponseHeader("content-length")?bY(n.getResponseHeader("content-length")):ALe(n.response,n.responseType);s!==void 0&&(t.data.request_body_size=s),i!==void 0&&(t.data.response_body_size=i)}function ELe(t,e,n){const r=Date.now(),{startTimestamp:s=r,endTimestamp:i=r,input:a,xhr:l}=e,{url:c,method:d,status_code:p=0,request_body_size:h,response_body_size:g}=t.data;if(!c)return null;if(!l||!Jx(c,n.networkDetailAllowUrls)||Jx(c,n.networkDetailDenyUrls)){const A=mg(h),R=mg(g);return{startTimestamp:s,endTimestamp:i,url:c,method:d,statusCode:p,request:A,response:R}}const v=l[ru],b=v?EA(v.request_headers,n.networkRequestHeaders):{},x=EA(kLe(l),n.networkResponseHeaders),[E,S]=n.networkCaptureBodies?xY(a):[void 0],[k,T]=n.networkCaptureBodies?TLe(l):[void 0],N=Ql(b,h,E),j=Ql(x,g,k);return{startTimestamp:s,endTimestamp:i,url:c,method:d,statusCode:p,request:S?Qx(N,S):N,response:T?Qx(j,T):j}}function kLe(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
|
|
1873
1873
|
`).reduce((n,r)=>{const[s,i]=r.split(": ");return i&&(n[s.toLowerCase()]=i),n},{}):{}}function TLe(t){const e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return CLe(t.response,t.responseType)}catch(n){e.push(n)}return bt&&Et.warn("Failed to get xhr response body",...e),[void 0]}function CLe(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&t&&typeof t=="object")return[JSON.stringify(t)];if(!t)return[void 0]}catch(n){return bt&&Et.exception(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return bt&&Et.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function ALe(t,e){try{const n=e==="json"&&t&&typeof t=="object"?JSON.stringify(t):t;return __(n)}catch{return}}function RLe(t){const e=Yt();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:s,networkRequestHeaders:i,networkResponseHeaders:a}=t.getOptions(),l={replay:t,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:s,networkRequestHeaders:i,networkResponseHeaders:a};e&&e.on("beforeAddBreadcrumb",(c,d)=>NLe(l,c,d))}catch{}}function NLe(t,e,n){if(e.data)try{jLe(e)&&OLe(n)&&(SLe(e,n),wLe(e,n,t)),MLe(e)&&ILe(n)&&(fLe(e,n),dLe(e,n,t))}catch(r){bt&&Et.exception(r,"Error when enriching network breadcrumb")}}function jLe(t){return t.category==="xhr"}function MLe(t){return t.category==="fetch"}function OLe(t){return t&&t.xhr}function ILe(t){return t&&t.response}function PLe(t){const e=Yt();MW(uDe(t)),m_(aLe(t)),QDe(t),RLe(t);const n=sLe(t);$je(n),e&&(e.on("beforeSendEvent",KDe(t)),e.on("afterSendEvent",GDe(t)),e.on("createDsc",r=>{const s=t.getSessionId();s&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(r.replay_id=s)}),e.on("spanStart",r=>{t.lastActiveSpan=r}),e.on("spanEnd",r=>{t.lastActiveSpan=r}),e.on("beforeSendFeedback",(r,s)=>{const i=t.getSessionId();s&&s.includeReplay&&t.isEnabled()&&i&&r.contexts&&r.contexts.feedback&&(r.contexts.feedback.replay_id=i)}))}async function DLe(t){try{return Promise.all(x_(t,[LLe(Cn.performance.memory)]))}catch{return[]}}function LLe(t){const{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}=t,s=Date.now()/1e3;return{type:"memory",name:"memory",start:s,end:s,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}}}}function $Le(t,e,n){let r,s,i;const a=n&&n.maxWait?Math.max(n.maxWait,e):0;function l(){return c(),r=t(),r}function c(){s!==void 0&&clearTimeout(s),i!==void 0&&clearTimeout(i),s=i=void 0}function d(){return s!==void 0||i!==void 0?l():r}function p(){return s&&clearTimeout(s),s=Jf(l,e),a&&i===void 0&&(i=Jf(l,a)),r}return p.cancel=c,p.flush=d,p}const Yc=Kt.navigator;function zLe(){return/iPhone|iPad|iPod/i.test(Yc&&Yc.userAgent||"")||/Macintosh/i.test(Yc&&Yc.userAgent||"")&&Yc&&Yc.maxTouchPoints&&Yc.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function FLe(t){let e=!1;return(n,r)=>{if(!t.checkAndHandleExpiredSession()){bt&&Et.warn("Received replay event after session expired.");return}const s=r||!e;e=!0,t.clickDetector&&iDe(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&s&&t.setInitialState(),!sM(t,n,s))return!0;if(!s)return!1;const i=t.session;if(BLe(t,s),t.recordingMode==="buffer"&&i&&t.eventBuffer){const a=t.eventBuffer.getEarliestTimestamp();a&&(bt&&Et.info(`Updating session start time to earliest event in buffer to ${new Date(a)}`),i.started=a,t.getOptions().stickySession&&rM(i))}return i&&i.previousSessionId||t.recordingMode==="session"&&t.flush(),!0})}}function ULe(t){const e=t.getOptions();return{type:Ft.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function BLe(t,e){!e||!t.session||t.session.segmentId!==0||sM(t,ULe(t),!1)}function HLe(t,e,n,r){return Hu(VG(t,$j(t),r,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function qLe({recordingData:t,headers:e}){let n;const r=`${JSON.stringify(e)}
|
|
1874
1874
|
`;if(typeof t=="string")n=`${r}${t}`;else{const i=new TextEncoder().encode(r);n=new Uint8Array(i.length+t.length),n.set(i),n.set(t,i.length)}return n}async function VLe({client:t,scope:e,replayId:n,event:r}){const s=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,i={event_id:n,integrations:s};t.emit("preprocessEvent",r,i);const a=await XG(t.getOptions(),r,i,e,t,Bi());if(!a)return null;a.platform=a.platform||"javascript";const l=t.getSdkMetadata(),{name:c,version:d}=l&&l.sdk||{};return a.sdk={...a.sdk,name:c||"sentry.javascript.unknown",version:d||"0.0.0"},a}async function GLe({recordingData:t,replayId:e,segmentId:n,eventContext:r,timestamp:s,session:i}){const a=qLe({recordingData:t,headers:{segment_id:n}}),{urls:l,errorIds:c,traceIds:d,initialTimestamp:p}=r,h=Yt(),g=Rn(),v=h&&h.getTransport(),b=h&&h.getDsn();if(!h||!v||!b||!i.sampled)return Xo({});const x={type:EIe,replay_start_timestamp:p/1e3,timestamp:s/1e3,error_ids:c,trace_ids:d,urls:l,replay_id:e,segment_id:n,replay_type:i.sampled},E=await VLe({scope:g,client:h,replayId:e,event:x});if(!E)return h.recordDroppedEvent("event_processor","replay",x),bt&&Et.info("An event processor returned `null`, will not send event."),Xo({});delete E.sdkProcessingMetadata;const S=HLe(E,a,b,h.getOptions().tunnel);let k;try{k=await v.send(S)}catch(N){const j=new Error(Wj);try{j.cause=N}catch{}throw j}if(typeof k.statusCode=="number"&&(k.statusCode<200||k.statusCode>=300))throw new kY(k.statusCode);const T=aW({},k);if(iW(T,"replay"))throw new aM(T);return k}class kY extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class aM extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function TY(t,e={count:0,interval:NIe}){const{recordingData:n,onError:r}=t;if(n.length)try{return await GLe(t),!0}catch(s){if(s instanceof kY||s instanceof aM)throw s;if(ZG("Replays",{_retryCount:e.count}),r&&r(s),e.count>=jIe){const i=new Error(`${Wj} - max retries exceeded`);try{i.cause=s}catch{}throw i}return e.interval*=++e.count,new Promise((i,a)=>{Jf(async()=>{try{await TY(t,e),i(!0)}catch(l){a(l)}},e.interval)})}}const CY="__THROTTLED",WLe="__SKIPPED";function YLe(t,e,n){const r=new Map,s=l=>{const c=l-n;r.forEach((d,p)=>{p<c&&r.delete(p)})},i=()=>[...r.values()].reduce((l,c)=>l+c,0);let a=!1;return(...l)=>{const c=Math.floor(Date.now()/1e3);if(s(c),i()>=e){const p=a;return a=!0,p?WLe:CY}a=!1;const d=r.get(c)||0;return r.set(c,d+1),t(...l)}}class Bl{constructor({options:e,recordingOptions:n}){Bl.prototype.__init.call(this),Bl.prototype.__init2.call(this),Bl.prototype.__init3.call(this),Bl.prototype.__init4.call(this),Bl.prototype.__init5.call(this),Bl.prototype.__init6.call(this),this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:kIe,sessionIdleExpire:TIe},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=$Le(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=YLe((a,l)=>HDe(this,a,l),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:s}=this.getOptions(),i=r?{threshold:Math.min(MIe,r),timeout:r,scrollTimeout:OIe,ignoreSelector:s?s.join(","):""}:void 0;if(i&&(this.clickDetector=new tDe(this,i)),bt){const a=e._experiments;Et.setConfig({captureExceptions:!!a.captureExceptions,traceInternals:!!a.traceInternals})}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){bt&&Et.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:n,sessionSampleRate:r}=this._options,s=n<=0&&r<=0;if(this._requiresManualStart=s,!s){if(this._initializeSessionForSampling(e),!this.session){bt&&Et.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",bt&&Et.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){bt&&Et.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){bt&&Et.info("Buffering is in progress, call `flush()` to save the replay");return}bt&&Et.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=pk({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this._initializeRecording()}startBuffering(){if(this._isEnabled){bt&&Et.info("Buffering is in progress, call `flush()` to save the replay");return}bt&&Et.infoTick("Starting replay in buffer mode");const e=pk({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=$o({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:RIe}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:FLe(this),...zLe(),onMutation:this._onMutationHandler,...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(e){this.handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this.handleException(e),!1}}async stop({forceFlush:e=!1,reason:n}={}){if(this._isEnabled){this._isEnabled=!1;try{bt&&Et.info(`Stopping Replay${n?` triggered by ${n}`:""}`),vY(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),this.eventBuffer&&this.eventBuffer.destroy(),this.eventBuffer=null,$De(this)}catch(r){this.handleException(r)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),bt&&Et.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),bt&&Et.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();bt&&Et.info("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!e||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const n=e();this.recordingMode!=="buffer"&&n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(){return this.session&&this.session.id}checkAndHandleExpiredSession(){if(this._lastActivity&&wA(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${Cn.location.pathname}${Cn.location.hash}${Cn.location.search}`,n=`${Cn.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){const r=this._throttledAddEvent(e,n);if(r===CY){const s=Da({category:"replay.throttled"});this.addUpdate(()=>!sM(this,{type:YPe,timestamp:s.timestamp||0,data:{tag:"breadcrumb",payload:s,metric:!0}}))}return r}getCurrentRoute(){const e=this.lastActiveSpan||Fr(),n=e&&Xr(e),s=(n&&sn(n).data||{})[Pa];if(!(!n||!s||!["route","custom"].includes(s)))return sn(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=PDe({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(e){const n=this._options.errorSampleRate>0,r=pk({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;const e=this.session;return hY(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{Cn.document.addEventListener("visibilitychange",this._handleVisibilityChange),Cn.addEventListener("blur",this._handleWindowBlur),Cn.addEventListener("focus",this._handleWindowFocus),Cn.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(PLe(this),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=ADe(this)}_removeListeners(){try{Cn.document.removeEventListener("visibilitychange",this._handleVisibilityChange),Cn.removeEventListener("blur",this._handleWindowBlur),Cn.removeEventListener("focus",this._handleWindowFocus),Cn.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}__init(){this._handleVisibilityChange=()=>{Cn.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()}}__init2(){this._handleWindowBlur=()=>{const e=Da({category:"ui.blur"});this._doChangeToBackgroundTasks(e)}}__init3(){this._handleWindowFocus=()=>{const e=Da({category:"ui.focus"});this._doChangeToForegroundTasks(e)}}__init4(){this._handleKeyboardEvent=e=>{pDe(this,e)}}_doChangeToBackgroundTasks(e){!this.session||fY(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush())}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){bt&&Et.info("Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:Ft.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=yDe(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const n=this._context.initialTimestamp/1e3;e=e.filter(r=>r.start>=n)}return Promise.all(x_(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:n}=this;if(!e||!n||this._requiresManualStart||e.segmentId)return;const r=n.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){bt&&Et.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!(!this.eventBuffer||!this.eventBuffer.hasEvents)&&(await DLe(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const r=this._popEventContext(),s=this.session.segmentId++;this._maybeSaveSession();const i=await this.eventBuffer.finish();await TY({replayId:e,recordingData:i,segmentId:s,eventContext:r,session:this.session,timestamp:n,onError:a=>this.handleException(a)})}catch(n){this.handleException(n),this.stop({reason:"sendReplay"});const r=Yt();if(r){const s=n instanceof aM?"ratelimit_backoff":"send_error";r.recordDroppedEvent(s,"replay")}}}__init5(){this._flush=async({force:e=!1}={})=>{if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){bt&&Et.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,s=Date.now()-n;this._debouncedFlush.cancel();const i=s<this._options.minReplayDuration,a=s>this._options.maxReplayDuration+5e3;if(i||a){bt&&Et.info(`Session duration (${Math.floor(s/1e3)}s) is too ${i?"short":"long"}, not sending replay.`),i&&this._debouncedFlush();return}const l=this.eventBuffer;l&&this.session.segmentId===0&&!l.hasCheckout&&bt&&Et.info("Flushing initial segment without checkout.");const c=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(d){this.handleException(d)}finally{this._flushLock=void 0,c&&this._debouncedFlush()}}}_maybeSaveSession(){this.session&&this._options.stickySession&&rM(this.session)}__init6(){this._onMutationHandler=e=>{const n=e.length,r=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,i=r&&n>r;if(n>s||i){const a=Da({category:"replay.mutations",data:{count:n,limit:i}});this._createCustomBreadcrumb(a)}return i?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}}function $p(t,e){return[...t,...e].join(",")}function KLe({mask:t,unmask:e,block:n,unblock:r,ignore:s}){const i=["base","iframe[srcdoc]:not([src])"],a=$p(t,[".sentry-mask","[data-sentry-mask]"]),l=$p(e,[]);return{maskTextSelector:a,unmaskTextSelector:l,blockSelector:$p(n,[".sentry-block","[data-sentry-block]",...i]),unblockSelector:$p(r,[]),ignoreSelector:$p(s,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function XLe({el:t,key:e,maskAttributes:n,maskAllText:r,privacyOptions:s,value:i}){return!r||s.unmaskTextSelector&&t.matches(s.unmaskTextSelector)?i:n.includes(e)||e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"")?i.replace(/[\S]/g,"*"):i}const Zz='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',QLe=["content-length","content-type","accept"];let eF=!1;const JLe=t=>new w_(t);class w_{static __initStatic(){this.id="Replay"}constructor({flushMinDelay:e=CIe,flushMaxDelay:n=AIe,minReplayDuration:r=IIe,maxReplayDuration:s=Mz,stickySession:i=!0,useCompression:a=!0,workerUrl:l,_experiments:c={},maskAllText:d=!0,maskAllInputs:p=!0,blockAllMedia:h=!0,mutationBreadcrumbLimit:g=750,mutationLimit:v=1e4,slowClickTimeout:b=7e3,slowClickIgnoreSelectors:x=[],networkDetailAllowUrls:E=[],networkDetailDenyUrls:S=[],networkCaptureBodies:k=!0,networkRequestHeaders:T=[],networkResponseHeaders:N=[],mask:j=[],maskAttributes:A=["title","placeholder"],unmask:R=[],block:M=[],unblock:P=[],ignore:O=[],maskFn:L,beforeAddRecordingEvent:z,beforeErrorSampling:G,onError:W}={}){this.name=w_.id;const X=KLe({mask:j,unmask:R,block:M,unblock:P,ignore:O});if(this._recordingOptions={maskAllInputs:p,maskAllText:d,maskInputOptions:{password:!0},maskTextFn:L,maskInputFn:L,maskAttributeFn:(F,Y,V)=>XLe({maskAttributes:A,maskAllText:d,privacyOptions:X,key:F,value:Y,el:V}),...X,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:F=>{try{F.__rrweb__=!0}catch{}}},this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(r,PIe),maxReplayDuration:Math.min(s,Mz),stickySession:i,useCompression:a,workerUrl:l,blockAllMedia:h,maskAllInputs:p,maskAllText:d,mutationBreadcrumbLimit:g,mutationLimit:v,slowClickTimeout:b,slowClickIgnoreSelectors:x,networkDetailAllowUrls:E,networkDetailDenyUrls:S,networkCaptureBodies:k,networkRequestHeaders:tF(T),networkResponseHeaders:tF(N),beforeAddRecordingEvent:z,beforeErrorSampling:G,onError:W,_experiments:c},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${Zz}`:Zz),this._isInitialized&&wz())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return eF}set _isInitialized(e){eF=e}afterAllSetup(e){!wz()||this._replay||(this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.getSessionId()}getRecordingMode(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.recordingMode}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const n=ZLe(this._initialOptions,e);this._replay=new Bl({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const n=e.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}w_.__initStatic();function ZLe(t,e){const n=e.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...Nr(t)},s=Fx(n.replaysSessionSampleRate),i=Fx(n.replaysOnErrorSampleRate);return s==null&&i==null&&yc(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),s!=null&&(r.sessionSampleRate=s),i!=null&&(r.errorSampleRate=i),r}function tF(t){return[...QLe,...t.map(e=>e.toLowerCase())]}const nF=new WeakMap,mk=new Map,kb={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function e3e(t,e){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:s,shouldCreateSpanForRequest:i,enableHTTPTimings:a,tracePropagationTargets:l}={traceFetch:kb.traceFetch,traceXHR:kb.traceXHR,trackFetchStreamPerformance:kb.trackFetchStreamPerformance,...e},c=typeof i=="function"?i:h=>!0,d=h=>r3e(h,l),p={};n&&(t.addEventProcessor(h=>(h.type==="transaction"&&h.spans&&h.spans.forEach(g=>{if(g.op==="http.client"){const v=mk.get(g.span_id);v&&(g.timestamp=v/1e3,mk.delete(g.span_id))}}),h)),s&&qMe(h=>{if(h.response){const g=nF.get(h.response);g&&h.endTimestamp&&mk.set(g,h.endTimestamp)}}),pW(h=>{const g=LMe(h,c,d,p);if(h.response&&h.fetchData.__span&&nF.set(h.response,h.fetchData.__span),g){const v=AY(h.fetchData.url),b=v?vu(v).host:void 0;g.setAttributes({"http.url":v,"server.address":b})}a&&g&&rF(g)})),r&&IW(h=>{const g=s3e(h,c,d,p);a&&g&&rF(g)})}function t3e(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function rF(t){const{url:e}=sn(t).data||{};if(!e||typeof e!="string")return;const n=Qf("resource",({entries:r})=>{r.forEach(s=>{t3e(s)&&s.name.endsWith(e)&&(n3e(s).forEach(a=>t.setAttribute(...a)),setTimeout(n))})})}function Ca(t=0){return((xs||performance.timeOrigin)+t)/1e3}function n3e(t){const{name:e,version:n}=jW(t.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",e]),xs?[...r,["http.request.redirect_start",Ca(t.redirectStart)],["http.request.fetch_start",Ca(t.fetchStart)],["http.request.domain_lookup_start",Ca(t.domainLookupStart)],["http.request.domain_lookup_end",Ca(t.domainLookupEnd)],["http.request.connect_start",Ca(t.connectStart)],["http.request.secure_connection_start",Ca(t.secureConnectionStart)],["http.request.connection_end",Ca(t.connectEnd)],["http.request.request_start",Ca(t.requestStart)],["http.request.response_start",Ca(t.responseStart)],["http.request.response_end",Ca(t.responseEnd)]]:r}function r3e(t,e){const n=Rt.location&&Rt.location.href;if(n){let r,s;try{r=new URL(t,n),s=new URL(n).origin}catch{return!1}const i=r.origin===s;return e?Xl(r.toString(),e)||i&&Xl(r.pathname,e):i}else{const r=!!t.match(/^\/(?!\/)/);return e?Xl(t,e):r}}function s3e(t,e,n,r){const s=t.xhr,i=s&&s[ru];if(!s||s.__sentry_own_request__||!i)return;const a=lc()&&e(i.url);if(t.endTimestamp&&a){const h=s.__sentry_xhr_span_id__;if(!h)return;const g=r[h];g&&i.status_code!==void 0&&(RG(g,i.status_code),g.end(),delete r[h]);return}const l=AY(i.url),c=l?vu(l).host:void 0,d=!!Fr(),p=a&&d?Fg({name:`${i.method} ${i.url}`,attributes:{type:"xhr","http.method":i.method,"http.url":l,url:i.url,"server.address":c,[zr]:"auto.http.browser",[Pu]:"http.client"}}):new xh;return s.__sentry_xhr_span_id__=p.spanContext().spanId,r[s.__sentry_xhr_span_id__]=p,n(i.url)&&i3e(s,lc()&&d?p:void 0),p}function i3e(t,e){const{"sentry-trace":n,baggage:r}=lW({span:e});n&&a3e(t,n,r)}function a3e(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader("baggage",n)}catch{}}function AY(t){try{return new URL(t,Rt.location.origin).href}catch{return}}function o3e(){Rt&&Rt.document?Rt.document.addEventListener("visibilitychange",()=>{const t=Fr();if(!t)return;const e=Xr(t);if(Rt.document.hidden&&e){const n="cancelled",{op:r,status:s}=sn(e);Ja&&Fe.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),s||e.setStatus({code:Dr,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):Ja&&Fe.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const l3e="BrowserTracing",c3e={...xb,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...kb},u3e=(t={})=>{UNe();const{enableInp:e,enableLongTask:n,enableLongAnimationFrame:r,_experiments:{enableInteractions:s,enableStandaloneClsSpans:i},beforeStartSpan:a,idleTimeout:l,finalTimeout:c,childSpanTimeout:d,markBackgroundSpan:p,traceFetch:h,traceXHR:g,trackFetchStreamPerformance:v,shouldCreateSpanForRequest:b,enableHTTPTimings:x,instrumentPageLoad:E,instrumentNavigation:S}={...c3e,...t},k=ZOe({recordClsStandaloneSpans:i||!1});e&&E2e(),r&&Kt.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?t2e():n&&e2e(),s&&n2e();const T={name:void 0,source:void 0};function N(j,A){const R=A.op==="pageload",M=a?a(A):A,P=M.attributes||{};A.name!==M.name&&(P[Pa]="custom",M.attributes=P),T.name=M.name,T.source=P[Pa];const O=KG(M,{idleTimeout:l,finalTimeout:c,childSpanTimeout:d,disableAutoFinish:R,beforeSpanEnd:z=>{k(),o2e(z,{recordClsOnPageloadSpan:!i})}});function L(){["interactive","complete"].includes(Rt.document.readyState)&&j.emit("idleSpanEnableAutoFinish",O)}return R&&Rt.document&&(Rt.document.addEventListener("readystatechange",()=>{L()}),L()),O}return{name:l3e,afterAllSetup(j){let A,R=Rt.location&&Rt.location.href;function M(){A&&!sn(A).timestamp&&(Ja&&Fe.log(`[Tracing] Finishing current active span with op: ${sn(A).op}`),A.end())}j.on("startNavigationSpan",P=>{Yt()===j&&(M(),A=N(j,{op:"navigation",...P}))}),j.on("startPageLoadSpan",(P,O={})=>{if(Yt()!==j)return;M();const L=O.sentryTrace||sF("sentry-trace"),z=O.baggage||sF("baggage"),G=INe(L,z);Rn().setPropagationContext(G),A=N(j,{op:"pageload",...P})}),j.on("spanEnd",P=>{const O=sn(P).op;if(P!==Xr(P)||O!=="navigation"&&O!=="pageload")return;const L=Rn(),z=L.getPropagationContext();L.setPropagationContext({...z,sampled:z.sampled!==void 0?z.sampled:Uu(P),dsc:z.dsc||Bu(P)})}),Rt.location&&(E&&d3e(j,{name:Rt.location.pathname,startTime:xs?xs/1e3:void 0,attributes:{[Pa]:"url",[zr]:"auto.pageload.browser"}}),S&&m_(({to:P,from:O})=>{if(O===void 0&&R&&R.indexOf(P)!==-1){R=void 0;return}O!==P&&(R=void 0,f3e(j,{name:Rt.location.pathname,attributes:{[Pa]:"url",[zr]:"auto.navigation.browser"}}))})),p&&o3e(),s&&h3e(l,c,d,T),e&&T2e(),e3e(j,{traceFetch:h,traceXHR:g,trackFetchStreamPerformance:v,tracePropagationTargets:j.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:b,enableHTTPTimings:x})}}};function d3e(t,e,n){t.emit("startPageLoadSpan",e,n),Rn().setTransactionName(e.name);const r=Fr();return(r&&sn(r).op)==="pageload"?r:void 0}function f3e(t,e){Bi().setPropagationContext({traceId:ac()}),Rn().setPropagationContext({traceId:ac()}),t.emit("startNavigationSpan",e),Rn().setTransactionName(e.name);const n=Fr();return(n&&sn(n).op)==="navigation"?n:void 0}function sF(t){const e=aNe(`meta[name=${t}]`);return e?e.getAttribute("content"):void 0}function h3e(t,e,n,r){let s;const i=()=>{const a="ui.action.click",l=Fr(),c=l&&Xr(l);if(c){const d=sn(c).op;if(["navigation","pageload"].includes(d)){Ja&&Fe.warn(`[Tracing] Did not create ${a} span because a pageload or navigation span is in progress.`);return}}if(s&&(s.setAttribute(JC,"interactionInterrupted"),s.end(),s=void 0),!r.name){Ja&&Fe.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}s=KG({name:r.name,op:a,attributes:{[Pa]:r.source||"url"}},{idleTimeout:t,finalTimeout:e,childSpanTimeout:n})};Rt.document&&addEventListener("click",i,{once:!1,capture:!0})}function p3e(t){const e={...t};return oW(e,"react"),ZG("react",{version:w.version}),SIe(e)}function m3e(){const{user:t}=va(),{isAuthenticated:e,isLoading:n}=ro(),r=Y7("users:ensureUser"),s=w.useRef(null);w.useEffect(()=>{e||(s.current=null,lz(null))},[e]),w.useEffect(()=>{if(!n){if(!e&&t)throw console.log("useEnsureDbUser: not authenticated"),new Error("Not authenticated");e&&t&&s.current!==t.id&&r().then(i=>{s.current=t.id,lz({id:t.id})}).catch(i=>{console.error("[auth] ensureUser failed",i),s.current=null})}},[e,n,t,r])}function g3e(){const t=ga(),{user:e}=va(),{isAuthenticated:n}=ro();w.useEffect(()=>{t&&(n&&e?(t.identify(e.id,{email:e.email,name:e.firstName&&e.lastName?`${e.firstName} ${e.lastName}`:e.email,first_name:e.firstName,last_name:e.lastName}),t.register({user_id:e.id})):t.reset())},[t,n,e])}function iF({className:t,...e}){return f.jsx(kZ,{"data-slot":"avatar",className:Me("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function aF({className:t,...e}){return f.jsx(TZ,{"data-slot":"avatar-image",className:Me("aspect-square size-full",t),...e})}function oF({className:t,...e}){return f.jsx(CZ,{"data-slot":"avatar-fallback",className:Me("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}function v3e(){const{isLoading:t}=ro(),{user:e,signIn:n,signOut:r,signUp:s}=va(),i=ga();if(t)return f.jsx(Pe,{variant:"outline",size:"sm",disabled:!0,children:f.jsx(or,{className:"h-3 w-3 mr-1.5 animate-spin"})});if(!e)return f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Pe,{variant:"outline",onClick:()=>{i.capture("sign_in",{location:"auth_upper_area",platform:Ii(),environment:void 0}),n()},children:"Sign in"}),f.jsx(Pe,{onClick:()=>{i.capture("create_account",{location:"auth_upper_area",platform:Ii(),environment:void 0}),s()},style:{backgroundColor:"#E55A3A"},children:"Create account"})]});const a=[e.firstName,e.lastName].filter(Boolean).join(" "),l=e.email,c=wQ(a),d=()=>{const h=window.location.origin,v=h.includes("://localhost")?h.replace("://localhost","://127.0.0.1"):h;r({returnTo:v})},p=e.profilePictureUrl||void 0;return f.jsxs(k0,{children:[f.jsx(T0,{asChild:!0,children:f.jsx("button",{className:"flex size-10 items-center justify-center rounded-full border border-border/60 bg-background/80 shadow-sm outline-none transition hover:ring-2 hover:ring-ring/20 focus-visible:ring-2 focus-visible:ring-ring",children:f.jsxs(iF,{className:"size-9 cursor-pointer",children:[f.jsx(aF,{src:p,alt:a}),f.jsx(oF,{className:"bg-muted text-muted-foreground text-sm font-medium",children:c!=="?"?c:f.jsx(RP,{className:"size-4"})})]})})}),f.jsxs(C0,{className:"w-56",align:"end",children:[f.jsx(Fae,{className:"pb-3",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs(iF,{className:"size-10 cursor-pointer",children:[f.jsx(aF,{src:p,alt:a}),f.jsx(oF,{className:"bg-muted text-muted-foreground text-base font-semibold",children:c!=="?"?c:f.jsx(RP,{className:"size-5"})})]}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:"text-sm font-medium leading-none truncate",children:a}),f.jsx("p",{className:"text-xs text-muted-foreground truncate",children:l})]})]})}),f.jsx(IP,{}),f.jsxs(Io,{onClick:()=>window.location.hash="settings",className:"cursor-pointer",children:[f.jsx(vR,{className:"size-4"}),"Settings"]}),f.jsx(IP,{}),f.jsxs(Io,{variant:"destructive",onClick:d,className:"cursor-pointer",children:[f.jsx(Sie,{className:"size-4"}),"Log out"]})]})]})}function y3e(){const[t,e]=w.useState("servers"),n=ga();g3e(),w.useEffect(()=>{n.capture("app_launched",{platform:Ii(),environment:void 0,user_agent:navigator.userAgent})},[]),WRe(),m3e();const r=w.useMemo(()=>window.location.pathname.startsWith("/oauth/callback/debug"),[]),s=w.useMemo(()=>window.location.pathname==="/callback",[]),{appState:i,isLoading:a,connectedServerConfigs:l,selectedMCPConfig:c,handleConnect:d,handleDisconnect:p,handleReconnect:h,handleUpdate:g,handleRemoveServer:v,setSelectedServer:b,toggleServerSelection:x,selectedMCPConfigsMap:E,setSelectedMultipleServersToAllServers:S}=Z7();w.useEffect(()=>{const T=()=>{const N=(window.location.hash||"#servers").replace("#","");e(N),N==="chat"&&S()};return T(),window.addEventListener("hashchange",T),()=>window.removeEventListener("hashchange",T)},[S]);const k=T=>{T==="chat"&&S(),window.location.hash=T,e(T)};return r?f.jsx(uRe,{}):s?(w.useEffect(()=>{const T=setTimeout(()=>{window.location.href="/"},5e3);return()=>clearTimeout(T)},[]),f.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Completing sign in..."}),f.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"If this takes too long, you'll be redirected automatically"})]})})):a?f.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Loading..."})]})}):f.jsxs(J1e,{themeMode:"light",themePreset:"default",children:[f.jsxs(kRe,{defaultOpen:!0,children:[f.jsx($Re,{onNavigate:k,activeTab:t}),f.jsxs(ARe,{className:"flex flex-col",children:[f.jsx("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear drag",children:f.jsxs("div",{className:"flex w-full items-center justify-between px-4 lg:px-6",children:[f.jsx("div",{className:"flex items-center gap-1 lg:gap-2",children:f.jsx(CRe,{className:"-ml-1"})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsx(v3e,{})})]})}),f.jsxs("div",{className:"flex-1",children:[(t==="tools"||t==="resources"||t==="prompts"||t==="auth"||t==="chat"||t==="interceptor")&&f.jsx(URe,{connectedServerConfigs:l,selectedServer:i.selectedServer,onServerChange:b,onConnect:d,isMultiSelectEnabled:t==="chat",onMultiServerToggle:x,selectedMultipleServers:i.selectedMultipleServers}),t==="servers"&&f.jsx(Hde,{connectedServerConfigs:l,onConnect:d,onDisconnect:p,onReconnect:h,onUpdate:g,onRemove:v}),t==="tools"&&f.jsx(Ype,{serverConfig:c,serverName:i.selectedServer}),t==="evals"&&f.jsx(rCe,{}),t==="eval-results"&&f.jsx(HTe,{}),t==="resources"&&f.jsx(Kpe,{serverConfig:c,serverName:i.selectedServer}),t==="prompts"&&f.jsx(Xpe,{serverConfig:c,serverName:i.selectedServer}),t==="auth"&&f.jsx(cRe,{serverConfig:c,serverEntry:i.servers[i.selectedServer],serverName:i.selectedServer}),t==="chat"&&f.jsx(DTe,{serverConfigs:E,connectedServerConfigs:l}),t==="interceptor"&&f.jsx(sRe,{connectedServerConfigs:l,selectedServer:i.selectedServer}),t==="tracing"&&f.jsx(rRe,{}),t==="settings"&&f.jsx(JAe,{})]})]})]}),f.jsx(GRe,{})]})}function b3e({children:t,client:e,useAuth:n}){const r=x3e(n);return f.jsx(NTe,{client:e,useAuth:r,children:t})}function x3e(t){return w.useMemo(()=>function(){const{isLoading:n,user:r,getAccessToken:s}=t(),i=w.useCallback(async()=>{try{return await s()}catch{return null}},[s]);return w.useMemo(()=>({isLoading:n,isAuthenticated:!!r,fetchAccessToken:i}),[n,r,i])},[t])}const _3e={environment:"prod",sendDefaultPii:!1,tracesSampleRate:.1,tracePropagationTargets:["localhost",/^\//,/^https?:\/\/[^/]*\.convex\.(cloud|site)/]},w3e={..._3e,dsn:"https://c9df3785c734acfe9dad2d0c1e963e28@o4510109778378752.ingest.us.sentry.io/4510111435063296",replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1};function S3e(){p3e({...w3e,integrations:[JLe(),u3e()]})}S3e();const E3e="https://outstanding-fennec-304.convex.cloud",k3e="client_01K4C1TVPBE7JTBFQJF9SDW9P9",T3e=(()=>{const t="mcpjam://oauth/callback";return typeof window>"u"?t:window.location.protocol==="http:"||window.location.protocol==="https:"?`${window.location.origin}/callback`:t})(),C3e=new xTe(E3e),A3e=BX.createRoot(document.getElementById("root")),R3e=f.jsx(kme,{clientId:k3e,redirectUri:T3e,children:f.jsx(b3e,{client:C3e,useAuth:va,children:f.jsx(y3e,{})})});A3e.render(f.jsx(w.StrictMode,{children:f.jsx(jde,{apiKey:$de(),options:zde(),children:R3e})}));
|
|
1875
|
-
//# sourceMappingURL=index-
|
|
1875
|
+
//# sourceMappingURL=index-D2JZI6zU.js.map
|