@ensembleapp/client-sdk 0.0.48 → 0.0.49

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.
@@ -68,7 +68,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
68
68
  `)},flush(e){e.enqueue(`data: [DONE]
69
69
 
70
70
  `)}})}};var xB=Qm(()=>Jc(v.union([v.strictObject({type:v.literal("text-start"),id:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("text-delta"),id:v.string(),delta:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("text-end"),id:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("error"),errorText:v.string()}),v.strictObject({type:v.literal("tool-input-start"),toolCallId:v.string(),toolName:v.string(),providerExecuted:v.boolean().optional(),providerMetadata:de.optional(),dynamic:v.boolean().optional(),title:v.string().optional()}),v.strictObject({type:v.literal("tool-input-delta"),toolCallId:v.string(),inputTextDelta:v.string()}),v.strictObject({type:v.literal("tool-input-available"),toolCallId:v.string(),toolName:v.string(),input:v.unknown(),providerExecuted:v.boolean().optional(),providerMetadata:de.optional(),dynamic:v.boolean().optional(),title:v.string().optional()}),v.strictObject({type:v.literal("tool-input-error"),toolCallId:v.string(),toolName:v.string(),input:v.unknown(),providerExecuted:v.boolean().optional(),providerMetadata:de.optional(),dynamic:v.boolean().optional(),errorText:v.string(),title:v.string().optional()}),v.strictObject({type:v.literal("tool-approval-request"),approvalId:v.string(),toolCallId:v.string()}),v.strictObject({type:v.literal("tool-output-available"),toolCallId:v.string(),output:v.unknown(),providerExecuted:v.boolean().optional(),dynamic:v.boolean().optional(),preliminary:v.boolean().optional()}),v.strictObject({type:v.literal("tool-output-error"),toolCallId:v.string(),errorText:v.string(),providerExecuted:v.boolean().optional(),dynamic:v.boolean().optional()}),v.strictObject({type:v.literal("tool-output-denied"),toolCallId:v.string()}),v.strictObject({type:v.literal("reasoning-start"),id:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("reasoning-delta"),id:v.string(),delta:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("reasoning-end"),id:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("source-url"),sourceId:v.string(),url:v.string(),title:v.string().optional(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("source-document"),sourceId:v.string(),mediaType:v.string(),title:v.string(),filename:v.string().optional(),providerMetadata:de.optional()}),v.strictObject({type:v.literal("file"),url:v.string(),mediaType:v.string(),providerMetadata:de.optional()}),v.strictObject({type:v.custom(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:v.string().optional(),data:v.unknown(),transient:v.boolean().optional()}),v.strictObject({type:v.literal("start-step")}),v.strictObject({type:v.literal("finish-step")}),v.strictObject({type:v.literal("start"),messageId:v.string().optional(),messageMetadata:v.unknown().optional()}),v.strictObject({type:v.literal("finish"),finishReason:v.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:v.unknown().optional()}),v.strictObject({type:v.literal("abort"),reason:v.string().optional()}),v.strictObject({type:v.literal("message-metadata"),messageMetadata:v.unknown()})])));function bB(e){return e.type.startsWith("data-")}function Q_(e){return e.type.startsWith("tool-")}function SB(e){return e.type==="dynamic-tool"}function zs(e){return Q_(e)||SB(e)}function s$(e){return e.type.split("-").slice(1).join("-")}function wB({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function _B({stream:e,messageMetadataSchema:t,dataPartSchemas:a,runUpdateMessageJob:n,onError:r,onToolCall:o,onData:i}){return e.pipeThrough(new TransformStream({async transform(l,s){await n(async({state:u,write:c})=>{var d,f,p,h;function w(g){let L=u.message.parts.filter(zs).find(x=>x.toolCallId===g);if(L==null)throw new Ds({chunkType:"tool-invocation",chunkId:g,message:`No tool invocation found for tool call ID "${g}".`});return L}function C(g){var b;let L=u.message.parts.find(S=>Q_(S)&&S.toolCallId===g.toolCallId),x=g,_=L;L!=null?(L.state=g.state,_.input=x.input,_.output=x.output,_.errorText=x.errorText,_.rawInput=x.rawInput,_.preliminary=x.preliminary,g.title!==void 0&&(_.title=g.title),_.providerExecuted=(b=x.providerExecuted)!=null?b:L.providerExecuted,x.providerMetadata!=null&&(L.callProviderMetadata=x.providerMetadata)):u.message.parts.push({type:`tool-${g.toolName}`,toolCallId:g.toolCallId,state:g.state,title:g.title,input:x.input,output:x.output,rawInput:x.rawInput,errorText:x.errorText,providerExecuted:x.providerExecuted,preliminary:x.preliminary,...x.providerMetadata!=null?{callProviderMetadata:x.providerMetadata}:{}})}function m(g){var b,L;let x=u.message.parts.find(T=>T.type==="dynamic-tool"&&T.toolCallId===g.toolCallId),_=g,S=x;x!=null?(x.state=g.state,S.toolName=g.toolName,S.input=_.input,S.output=_.output,S.errorText=_.errorText,S.rawInput=(b=_.rawInput)!=null?b:S.rawInput,S.preliminary=_.preliminary,g.title!==void 0&&(S.title=g.title),S.providerExecuted=(L=_.providerExecuted)!=null?L:x.providerExecuted,_.providerMetadata!=null&&(x.callProviderMetadata=_.providerMetadata)):u.message.parts.push({type:"dynamic-tool",toolName:g.toolName,toolCallId:g.toolCallId,state:g.state,input:_.input,output:_.output,errorText:_.errorText,preliminary:_.preliminary,providerExecuted:_.providerExecuted,title:g.title,..._.providerMetadata!=null?{callProviderMetadata:_.providerMetadata}:{}})}async function y(g){if(g!=null){let b=u.message.metadata!=null?x$(u.message.metadata,g):g;t!=null&&await eh({value:b,schema:t,context:{field:"message.metadata",entityId:u.message.id}}),u.message.metadata=b}}switch(l.type){case"text-start":{let g={type:"text",text:"",providerMetadata:l.providerMetadata,state:"streaming"};u.activeTextParts[l.id]=g,u.message.parts.push(g),c();break}case"text-delta":{let g=u.activeTextParts[l.id];if(g==null)throw new Ds({chunkType:"text-delta",chunkId:l.id,message:`Received text-delta for missing text part with ID "${l.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});g.text+=l.delta,g.providerMetadata=(d=l.providerMetadata)!=null?d:g.providerMetadata,c();break}case"text-end":{let g=u.activeTextParts[l.id];if(g==null)throw new Ds({chunkType:"text-end",chunkId:l.id,message:`Received text-end for missing text part with ID "${l.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});g.state="done",g.providerMetadata=(f=l.providerMetadata)!=null?f:g.providerMetadata,delete u.activeTextParts[l.id],c();break}case"reasoning-start":{let g={type:"reasoning",text:"",providerMetadata:l.providerMetadata,state:"streaming"};u.activeReasoningParts[l.id]=g,u.message.parts.push(g),c();break}case"reasoning-delta":{let g=u.activeReasoningParts[l.id];if(g==null)throw new Ds({chunkType:"reasoning-delta",chunkId:l.id,message:`Received reasoning-delta for missing reasoning part with ID "${l.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});g.text+=l.delta,g.providerMetadata=(p=l.providerMetadata)!=null?p:g.providerMetadata,c();break}case"reasoning-end":{let g=u.activeReasoningParts[l.id];if(g==null)throw new Ds({chunkType:"reasoning-end",chunkId:l.id,message:`Received reasoning-end for missing reasoning part with ID "${l.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});g.providerMetadata=(h=l.providerMetadata)!=null?h:g.providerMetadata,g.state="done",delete u.activeReasoningParts[l.id],c();break}case"file":{u.message.parts.push({type:"file",mediaType:l.mediaType,url:l.url,...l.providerMetadata!=null?{providerMetadata:l.providerMetadata}:{}}),c();break}case"source-url":{u.message.parts.push({type:"source-url",sourceId:l.sourceId,url:l.url,title:l.title,providerMetadata:l.providerMetadata}),c();break}case"source-document":{u.message.parts.push({type:"source-document",sourceId:l.sourceId,mediaType:l.mediaType,title:l.title,filename:l.filename,providerMetadata:l.providerMetadata}),c();break}case"tool-input-start":{let g=u.message.parts.filter(Q_);u.partialToolCalls[l.toolCallId]={text:"",toolName:l.toolName,index:g.length,dynamic:l.dynamic,title:l.title},l.dynamic?m({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-streaming",input:void 0,providerExecuted:l.providerExecuted,title:l.title,providerMetadata:l.providerMetadata}):C({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-streaming",input:void 0,providerExecuted:l.providerExecuted,title:l.title,providerMetadata:l.providerMetadata}),c();break}case"tool-input-delta":{let g=u.partialToolCalls[l.toolCallId];if(g==null)throw new Ds({chunkType:"tool-input-delta",chunkId:l.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${l.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});g.text+=l.inputTextDelta;let{value:b}=await rd(g.text);g.dynamic?m({toolCallId:l.toolCallId,toolName:g.toolName,state:"input-streaming",input:b,title:g.title}):C({toolCallId:l.toolCallId,toolName:g.toolName,state:"input-streaming",input:b,title:g.title}),c();break}case"tool-input-available":{l.dynamic?m({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-available",input:l.input,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:l.title}):C({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-available",input:l.input,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:l.title}),c(),o&&!l.providerExecuted&&await o({toolCall:l});break}case"tool-input-error":{let g=u.message.parts.filter(zs).find(L=>L.toolCallId===l.toolCallId);(g!=null?g.type==="dynamic-tool":!!l.dynamic)?m({toolCallId:l.toolCallId,toolName:l.toolName,state:"output-error",input:l.input,errorText:l.errorText,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata}):C({toolCallId:l.toolCallId,toolName:l.toolName,state:"output-error",input:void 0,rawInput:l.input,errorText:l.errorText,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata}),c();break}case"tool-approval-request":{let g=w(l.toolCallId);g.state="approval-requested",g.approval={id:l.approvalId},c();break}case"tool-output-denied":{let g=w(l.toolCallId);g.state="output-denied",c();break}case"tool-output-available":{let g=w(l.toolCallId);g.type==="dynamic-tool"?m({toolCallId:l.toolCallId,toolName:g.toolName,state:"output-available",input:g.input,output:l.output,preliminary:l.preliminary,providerExecuted:l.providerExecuted,title:g.title}):C({toolCallId:l.toolCallId,toolName:s$(g),state:"output-available",input:g.input,output:l.output,providerExecuted:l.providerExecuted,preliminary:l.preliminary,title:g.title}),c();break}case"tool-output-error":{let g=w(l.toolCallId);g.type==="dynamic-tool"?m({toolCallId:l.toolCallId,toolName:g.toolName,state:"output-error",input:g.input,errorText:l.errorText,providerExecuted:l.providerExecuted,title:g.title}):C({toolCallId:l.toolCallId,toolName:s$(g),state:"output-error",input:g.input,rawInput:g.rawInput,errorText:l.errorText,providerExecuted:l.providerExecuted,title:g.title}),c();break}case"start-step":{u.message.parts.push({type:"step-start"});break}case"finish-step":{u.activeTextParts={},u.activeReasoningParts={};break}case"start":{l.messageId!=null&&(u.message.id=l.messageId),await y(l.messageMetadata),(l.messageId!=null||l.messageMetadata!=null)&&c();break}case"finish":{l.finishReason!=null&&(u.finishReason=l.finishReason),await y(l.messageMetadata),l.messageMetadata!=null&&c();break}case"message-metadata":{await y(l.messageMetadata),l.messageMetadata!=null&&c();break}case"error":{r?.(new Error(l.errorText));break}default:if(bB(l)){if(a?.[l.type]!=null){let L=u.message.parts.findIndex(_=>"id"in _&&"data"in _&&_.id===l.id&&_.type===l.type),x=L>=0?L:u.message.parts.length;await eh({value:l.data,schema:a[l.type],context:{field:`message.parts[${x}].data`,entityName:l.type,entityId:l.id}})}let g=l;if(g.transient){i?.(g);break}let b=g.id!=null?u.message.parts.find(L=>g.type===L.type&&g.id===L.id):void 0;b!=null?b.data=g.data:u.message.parts.push(g),i?.(g),c()}}s.enqueue(l)})}}))}async function IB({stream:e,onError:t}){let a=e.getReader();try{for(;;){let{done:n}=await a.read();if(n)break}}catch(n){t?.(n)}finally{a.releaseLock()}}var cX=On({prefix:"aitxt",size:24});var pX=Qm(()=>Jc(v.array(v.object({id:v.string(),role:v.enum(["system","user","assistant"]),metadata:v.unknown().optional(),parts:v.array(v.union([v.object({type:v.literal("text"),text:v.string(),state:v.enum(["streaming","done"]).optional(),providerMetadata:de.optional()}),v.object({type:v.literal("reasoning"),text:v.string(),state:v.enum(["streaming","done"]).optional(),providerMetadata:de.optional()}),v.object({type:v.literal("source-url"),sourceId:v.string(),url:v.string(),title:v.string().optional(),providerMetadata:de.optional()}),v.object({type:v.literal("source-document"),sourceId:v.string(),mediaType:v.string(),title:v.string(),filename:v.string().optional(),providerMetadata:de.optional()}),v.object({type:v.literal("file"),mediaType:v.string(),filename:v.string().optional(),url:v.string(),providerMetadata:de.optional()}),v.object({type:v.literal("step-start")}),v.object({type:v.string().startsWith("data-"),id:v.string().optional(),data:v.unknown()}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("input-streaming"),input:v.unknown().optional(),providerExecuted:v.boolean().optional(),callProviderMetadata:de.optional(),output:v.never().optional(),errorText:v.never().optional(),approval:v.never().optional()}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("input-available"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.never().optional()}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("approval-requested"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.never().optional(),reason:v.never().optional()})}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("approval-responded"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.boolean(),reason:v.string().optional()})}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("output-available"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.unknown(),errorText:v.never().optional(),callProviderMetadata:de.optional(),preliminary:v.boolean().optional(),approval:v.object({id:v.string(),approved:v.literal(!0),reason:v.string().optional()}).optional()}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("output-error"),input:v.unknown(),rawInput:v.unknown().optional(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.string(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.literal(!0),reason:v.string().optional()}).optional()}),v.object({type:v.literal("dynamic-tool"),toolName:v.string(),toolCallId:v.string(),state:v.literal("output-denied"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.literal(!1),reason:v.string().optional()})}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("input-streaming"),providerExecuted:v.boolean().optional(),callProviderMetadata:de.optional(),input:v.unknown().optional(),output:v.never().optional(),errorText:v.never().optional(),approval:v.never().optional()}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("input-available"),providerExecuted:v.boolean().optional(),input:v.unknown(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.never().optional()}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("approval-requested"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.never().optional(),reason:v.never().optional()})}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("approval-responded"),input:v.unknown(),providerExecuted:v.boolean().optional(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.boolean(),reason:v.string().optional()})}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("output-available"),providerExecuted:v.boolean().optional(),input:v.unknown(),output:v.unknown(),errorText:v.never().optional(),callProviderMetadata:de.optional(),preliminary:v.boolean().optional(),approval:v.object({id:v.string(),approved:v.literal(!0),reason:v.string().optional()}).optional()}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("output-error"),providerExecuted:v.boolean().optional(),input:v.unknown(),rawInput:v.unknown().optional(),output:v.never().optional(),errorText:v.string(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.literal(!0),reason:v.string().optional()}).optional()}),v.object({type:v.string().startsWith("tool-"),toolCallId:v.string(),state:v.literal("output-denied"),providerExecuted:v.boolean().optional(),input:v.unknown(),output:v.never().optional(),errorText:v.never().optional(),callProviderMetadata:de.optional(),approval:v.object({id:v.string(),approved:v.literal(!1),reason:v.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")));var hX=On({prefix:"aiobj",size:24});function b$(e){return({url:t,abortSignal:a})=>tB({url:t,maxBytes:e?.maxBytes,abortSignal:a})}var kB=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,a)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){a(n)}}),this.processQueue()})}};var vX=On({prefix:"aiobj",size:24});var yX=b$();var CB="AI_NoSuchProviderError",TB=`vercel.ai.error.${CB}`,LB=Symbol.for(TB),AB;AB=LB;var xX=b$();async function EB(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{let{name:a,type:n}=t,r=await new Promise((o,i)=>{let l=new FileReader;l.onload=s=>{var u;o((u=s.target)==null?void 0:u.result)},l.onerror=s=>i(s),l.readAsDataURL(t)});return{type:"file",mediaType:n,filename:a,url:r}}))}var MB=class{constructor({api:e="/api/chat",credentials:t,headers:a,body:n,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=a,this.body=n,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var a,n,r,o,i;let l=await tn(this.body),s=await tn(this.headers),u=await tn(this.credentials),c={...Ro(s),...Ro(t.headers)},d=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...l,...t.body},headers:c,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),f=(n=d?.api)!=null?n:this.api,p=d?.headers!==void 0?Ro(d.headers):c,h=d?.body!==void 0?d.body:{...l,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},w=(r=d?.credentials)!=null?r:u,m=await((o=this.fetch)!=null?o:globalThis.fetch)(f,{method:"POST",headers:Ci({"Content-Type":"application/json",...p},`ai-sdk/${Y_}`,Wc()),body:JSON.stringify(h),credentials:w,signal:e});if(!m.ok)throw new Error((i=await m.text())!=null?i:"Failed to fetch the chat response.");if(!m.body)throw new Error("The response body is empty.");return this.processResponseStream(m.body)}async reconnectToStream(e){var t,a,n,r,o;let i=await tn(this.body),l=await tn(this.headers),s=await tn(this.credentials),u={...Ro(l),...Ro(e.headers)},c=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:u,credentials:s,requestMetadata:e.metadata})),d=(a=c?.api)!=null?a:`${this.api}/${e.chatId}/stream`,f=c?.headers!==void 0?Ro(c.headers):u,p=(n=c?.credentials)!=null?n:s,w=await((r=this.fetch)!=null?r:globalThis.fetch)(d,{method:"GET",headers:Ci(f,`ai-sdk/${Y_}`,Wc()),credentials:p});if(w.status===204)return null;if(!w.ok)throw new Error((o=await w.text())!=null?o:"Failed to fetch the chat response.");if(!w.body)throw new Error("The response body is empty.");return this.processResponseStream(w.body)}},eI=class extends MB{constructor(e={}){super(e)}processResponseStream(e){return t$({stream:e,schema:xB}).pipeThrough(new TransformStream({async transform(t,a){if(!t.success)throw t.error;a.enqueue(t.value)}}))}},S$=class{constructor({generateId:e=XM,id:t=e(),transport:a=new eI,messageMetadataSchema:n,dataPartSchemas:r,state:o,onError:i,onToolCall:l,onFinish:s,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new kB,this.sendMessage=async(d,f)=>{var p,h,w,C;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(p=this.lastMessage)==null?void 0:p.id,...f});return}let m;if("text"in d||"files"in d?m={parts:[...Array.isArray(d.files)?d.files:await EB(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:m=d,d.messageId!=null){let y=this.state.messages.findIndex(g=>g.id===d.messageId);if(y===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[y].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,y+1),this.state.replaceMessage(y,{...m,id:d.messageId,role:(h=m.role)!=null?h:"user",metadata:d.metadata})}else this.state.pushMessage({...m,id:(w=m.id)!=null?w:this.generateId(),role:(C=m.role)!=null?C:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...f})},this.regenerate=async({messageId:d,...f}={})=>{let p=d==null?this.state.messages.length-1:this.state.messages.findIndex(h=>h.id===d);if(p===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[p].role==="assistant"?p:p+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...f})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:f,reason:p})=>this.jobExecutor.run(async()=>{let h=this.state.messages,w=h[h.length-1],C=m=>zs(m)&&m.state==="approval-requested"&&m.approval.id===d?{...m,state:"approval-responded",approval:{id:d,approved:f,reason:p}}:m;this.state.replaceMessage(h.length-1,{...w,parts:w.parts.map(C)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(C)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(m=>{var y;m&&this.makeRequest({trigger:"submit-message",messageId:(y=this.lastMessage)==null?void 0:y.id})})}),this.addToolOutput=async({state:d="output-available",tool:f,toolCallId:p,output:h,errorText:w})=>this.jobExecutor.run(async()=>{let C=this.state.messages,m=C[C.length-1],y=g=>zs(g)&&g.toolCallId===p?{...g,state:d,output:h,errorText:w}:g;this.state.replaceMessage(C.length-1,{...m,parts:m.parts.map(y)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(y)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(g=>{var b;g&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.id})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=a,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=r,this.state=o,this.onError=i,this.onToolCall=l,this.onFinish=s,this.onData=u,this.sendAutomaticallyWhen=c}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:a,body:n,messageId:r}){var o,i,l;let s;if(e==="resume-stream")try{let p=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:a,body:n});if(p==null)return;s=p}catch(p){this.onError&&p instanceof Error&&this.onError(p),this.setStatus({status:"error",error:p});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,c=!1,d=!1,f=!1;try{let p={state:wB({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};p.abortController.signal.addEventListener("abort",()=>{c=!0}),this.activeResponse=p;let h;e==="resume-stream"?h=s:h=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:p.abortController.signal,metadata:t,headers:a,body:n,trigger:e,messageId:r});let w=C=>this.jobExecutor.run(()=>C({state:p.state,write:()=>{var m;this.setStatus({status:"streaming"}),p.state.message.id===((m=this.lastMessage)==null?void 0:m.id)?this.state.replaceMessage(this.state.messages.length-1,p.state.message):this.state.pushMessage(p.state.message)}}));await IB({stream:_B({stream:h,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:w,onError:C=>{throw C}}),onError:C=>{throw C}}),this.setStatus({status:"ready"})}catch(p){if(c||p.name==="AbortError")return c=!0,this.setStatus({status:"ready"}),null;f=!0,p instanceof TypeError&&(p.message.toLowerCase().includes("fetch")||p.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&p instanceof Error&&this.onError(p),this.setStatus({status:"error",error:p})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:f,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(p){console.error(p)}this.activeResponse=void 0}!f&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(l=this.lastMessage)==null?void 0:l.id,metadata:t,headers:a,body:n})}};function w$({messages:e}){let t=e[e.length-1];if(!t||t.role!=="assistant")return!1;let a=t.parts.reduce((r,o,i)=>o.type==="step-start"?i:r,-1),n=t.parts.slice(a+1).filter(zs).filter(r=>!r.providerExecuted);return n.filter(r=>r.state==="approval-responded").length>0&&n.every(r=>r.state==="output-available"||r.state==="output-error"||r.state==="approval-responded")}function _$({messages:e}){let t=e[e.length-1];if(!t||t.role!=="assistant")return!1;let a=t.parts.reduce((r,o,i)=>o.type==="step-start"?i:r,-1),n=t.parts.slice(a+1).filter(zs).filter(r=>!r.providerExecuted);return n.length>0&&n.every(r=>r.state==="output-available"||r.state==="output-error")}var L$=oe(k$(),1);var ld=oe(bt(),1);var ih=oe(bt(),1);var T$=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},mt=(e,t,a)=>(T$(e,t,"read from private field"),a?a.call(e):t.get(e)),an=(e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)},No=(e,t,a,n)=>(T$(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a);function DB(e,t){return t!=null?(0,L$.default)(e,t):e}var yr,nh,oh,nd,od,id,Rs,tI,aI,zB=class{constructor(e=[]){an(this,yr,void 0),an(this,nh,"ready"),an(this,oh,void 0),an(this,nd,new Set),an(this,od,new Set),an(this,id,new Set),this.pushMessage=t=>{No(this,yr,mt(this,yr).concat(t)),mt(this,Rs).call(this)},this.popMessage=()=>{No(this,yr,mt(this,yr).slice(0,-1)),mt(this,Rs).call(this)},this.replaceMessage=(t,a)=>{No(this,yr,[...mt(this,yr).slice(0,t),this.snapshot(a),...mt(this,yr).slice(t+1)]),mt(this,Rs).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,a)=>{let n=a?DB(t,a):t;return mt(this,nd).add(n),()=>{mt(this,nd).delete(n)}},this["~registerStatusCallback"]=t=>(mt(this,od).add(t),()=>{mt(this,od).delete(t)}),this["~registerErrorCallback"]=t=>(mt(this,id).add(t),()=>{mt(this,id).delete(t)}),an(this,Rs,()=>{mt(this,nd).forEach(t=>t())}),an(this,tI,()=>{mt(this,od).forEach(t=>t())}),an(this,aI,()=>{mt(this,id).forEach(t=>t())}),No(this,yr,e)}get status(){return mt(this,nh)}set status(e){No(this,nh,e),mt(this,tI).call(this)}get error(){return mt(this,oh)}set error(e){No(this,oh,e),mt(this,aI).call(this)}get messages(){return mt(this,yr)}set messages(e){No(this,yr,[...e]),mt(this,Rs).call(this)}};yr=new WeakMap;nh=new WeakMap;oh=new WeakMap;nd=new WeakMap;od=new WeakMap;id=new WeakMap;Rs=new WeakMap;tI=new WeakMap;aI=new WeakMap;var Os,C$=class extends S${constructor({messages:e,...t}){let a=new zB(e);super({...t,state:a}),an(this,Os,void 0),this["~registerMessagesCallback"]=(n,r)=>mt(this,Os)["~registerMessagesCallback"](n,r),this["~registerStatusCallback"]=n=>mt(this,Os)["~registerStatusCallback"](n),this["~registerErrorCallback"]=n=>mt(this,Os)["~registerErrorCallback"](n),No(this,Os,a)}};Os=new WeakMap;function A$({experimental_throttle:e,resume:t=!1,...a}={}){let n=(0,xr.useRef)("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(n.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});let r={...a,onToolCall:f=>{var p,h;return(h=(p=n.current).onToolCall)==null?void 0:h.call(p,f)},onData:f=>{var p,h;return(h=(p=n.current).onData)==null?void 0:h.call(p,f)},onFinish:f=>{var p,h;return(h=(p=n.current).onFinish)==null?void 0:h.call(p,f)},onError:f=>{var p,h;return(h=(p=n.current).onError)==null?void 0:h.call(p,f)},sendAutomaticallyWhen:f=>{var p,h,w;return(w=(h=(p=n.current).sendAutomaticallyWhen)==null?void 0:h.call(p,f))!=null?w:!1}},o=(0,xr.useRef)("chat"in a?a.chat:new C$(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new C$(r));let l=(0,xr.useCallback)(f=>o.current["~registerMessagesCallback"](f,e),[e,o.current.id]),s=(0,xr.useSyncExternalStore)(l,()=>o.current.messages,()=>o.current.messages),u=(0,xr.useSyncExternalStore)(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),c=(0,xr.useSyncExternalStore)(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),d=(0,xr.useCallback)(f=>{typeof f=="function"&&(f=f(o.current.messages)),o.current.messages=f},[o]);return(0,xr.useEffect)(()=>{t&&o.current.resumeStream()},[t,o]),{id:o.current.id,messages:s,setMessages:d,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:c,resumeStream:o.current.resumeStream,status:u,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}var sa=oe(bt(),1);function E$(e){let t=[],a=[],n=[],r=()=>{a.length>0&&(t.push({type:"step",parts:a}),a=[])};for(e.parts.forEach(o=>{if(o.type==="step-start"){n.length===0&&r();return}if(o.type==="data-tag-start"){n.length===0&&r();let l=o.data?.tagId??"unknown";n.push({groupName:l,parts:[]});return}if(o.type==="data-tag-end"){let i=n.pop();i&&t.push({type:"group",groupName:i.groupName,parts:i.parts});return}o.type==="data-thoughts"||o.type==="data-transfer"||o.type==="data-structured-input"||(n.length>0?n[n.length-1].parts.push(o):a.push(o))});n.length>0;){let o=n.pop();t.push({type:"group",groupName:o.groupName,parts:o.parts})}return r(),{id:e.id,role:e.role,metadata:e.metadata,sections:t}}var RB="collect_user_input";function OB(e,t){return async(a,n)=>{let r=i=>fetch(a,{...n,headers:{...n?.headers,Authorization:`Bearer ${i}`}}),o=await r(e.current);if(o.status===401&&t){let i=await t();if(i)return e.current=i,r(i)}return o}}function M$({api:e,threadId:t,agentId:a,agentVersion:n,agentExecutionId:r,dataContext:o,onError:i,onAuthError:l,onFinish:s,onData:u,onMessage:c}){let{baseUrl:d,token:f,headers:p={}}=e,h=(0,sa.useRef)(o);h.current=o;let w=(0,sa.useRef)(f);w.current=f;let C=(0,sa.useRef)(l);C.current=l;let m=(0,sa.useMemo)(()=>OB(w,async()=>C.current?.()??null),[]),y=(0,sa.useMemo)(()=>new eI({api:`${d}/chat`,fetch:m,headers:{"Content-Type":"application/json","thread-id":t,...a?{"agent-id":a}:{},...n!==void 0?{version:String(n)}:{},...r?{"agent-execution-id":r}:{},...p},prepareSendMessagesRequest({messages:Y,id:K}){return{body:{id:K,message:Y[Y.length-1],dataContext:h.current}}}}),[d,m,t,a,n,r,p]),{messages:g,status:b,sendMessage:L,stop:x,setMessages:_,addToolOutput:S,addToolApprovalResponse:T}=A$({id:t,transport:y,sendAutomaticallyWhen:({messages:Y})=>_$({messages:Y})||w$({messages:Y}),onError:Y=>{console.error("Chat error:",Y),i?.(Y)},onFinish:Y=>{s?.(Y)},onData:Y=>{u?.(Y)}}),I=(0,sa.useCallback)(async(Y,K)=>{let ve=Y.trim();if(ve){if(!K||typeof K!="object"||Array.isArray(K))throw new Error("Structured message payload must be a JSON object");await L({parts:[{type:"text",text:ve},{type:"data-structured-input",data:K}]})}},[L]),[B,R]=(0,sa.useState)(!0);(0,sa.useEffect)(()=>{(async()=>{try{let K=await m(`${d}/chat/messages`,{method:"GET",headers:{"thread-id":t}});if(!K.ok)throw new Error(`Failed to fetch messages: ${K.statusText}`);let M=(await K.json()).messages||[];M.length>0&&_(M)}catch(K){console.error("Error fetching initial messages:",K),i?.(K)}finally{R(!1)}})()},[r,a,m,d,i,_,t]),(0,sa.useEffect)(()=>{if(!c||g.length===0)return;let Y=g[g.length-1];Y&&c(Y)},[g,c]);let O=(0,sa.useMemo)(()=>g.map(Y=>E$(Y)),[g]),P=(0,sa.useMemo)(()=>{let Y=g[g.length-1];if(!Y||Y.role!=="assistant")return null;for(let K of Y.parts??[]){if(!(K.type.startsWith("tool-")||K.type==="dynamic-tool")||("toolName"in K?K.toolName:K.type.replace("tool-",""))!==RB)continue;if(("state"in K?K.state:void 0)==="input-available")return{toolCallId:K.toolCallId,args:K.input}}return null},[g]),te=(0,sa.useMemo)(()=>{let Y=g[g.length-1];if(!Y||Y.role!=="assistant")return null;for(let K of Y.parts??[]){if(!(K.type.startsWith("tool-")||K.type==="dynamic-tool"))continue;if(("state"in K?K.state:void 0)==="approval-requested"){let Ae="toolName"in K?K.toolName:K.type.replace("tool-",""),yt="approval"in K?K.approval:null;if(!yt?.id)continue;return{toolCallId:K.toolCallId,toolName:Ae,args:K.input??{},approvalId:yt.id}}}return null},[g]);return{messages:O,status:b,isLoadingInitial:B,canSendMessage:b==="ready"&&!P&&!te,sendMessage:L,sendStructuredMessage:I,stop:x,setMessages:_,addToolOutput:S,addToolApprovalResponse:T,pendingToolOutput:P,pendingToolApproval:te}}var Uo=oe(bt(),1);function $$({api:e,threadId:t,agentId:a,agentVersion:n}){let{baseUrl:r,token:o}=e,[i,l]=(0,Uo.useState)({}),[s,u]=(0,Uo.useState)(null),[c,d]=(0,Uo.useState)(null),f=(0,Uo.useCallback)(async(w,{rating:C,improvementText:m,notes:y})=>{u(w),d(null);try{let g={agentId:a,agentVersion:n,threadId:t,messageId:w,rating:C,improvementText:m,notes:y},b=await fetch(`${r}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(g)});if(!b.ok){let _=await b.json().catch(()=>({}));throw new Error(_.error||`Failed to submit feedback: ${b.statusText}`)}let{data:L}=await b.json();if(L.deleted||!C)return l(_=>{let S={..._};return delete S[w],S}),null;let x={rating:L.rating,improvementText:L.improvementText,notes:L.notes};return l(_=>({..._,[w]:x})),x}catch(g){let b=g instanceof Error?g:new Error("Unknown error");return d(b),console.error("Failed to submit feedback:",b),null}finally{u(null)}},[r,o,t,a,n]),p=(0,Uo.useCallback)(w=>i[w],[i]),h=(0,Uo.useCallback)(w=>w in i,[i]);return{submitFeedback:f,getFeedbackForMessage:p,hasFeedback:h,isSubmitting:s,error:c}}function D$(e){var t,a,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(a=D$(e[t]))&&(n&&(n+=" "),n+=a)}else for(a in e)e[a]&&(n&&(n+=" "),n+=a);return n}function z$(){for(var e,t,a=0,n="",r=arguments.length;a<r;a++)(e=arguments[a])&&(t=D$(e))&&(n&&(n+=" "),n+=t);return n}var PB=e=>{let t=UB(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{let l=i.split("-");return l[0]===""&&l.length!==1&&l.shift(),P$(l,t)||NB(i)},getConflictingClassGroupIds:(i,l)=>{let s=a[i]||[];return l&&n[i]?[...s,...n[i]]:s}}},P$=(e,t)=>{if(e.length===0)return t.classGroupId;let a=e[0],n=t.nextPart.get(a),r=n?P$(e.slice(1),n):void 0;if(r)return r;if(t.validators.length===0)return;let o=e.join("-");return t.validators.find(({validator:i})=>i(o))?.classGroupId},R$=/^\[(.+)\]$/,NB=e=>{if(R$.test(e)){let t=R$.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},UB=e=>{let{theme:t,prefix:a}=e,n={nextPart:new Map,validators:[]};return jB(Object.entries(e.classGroups),a).forEach(([o,i])=>{nI(i,n,o,t)}),n},nI=(e,t,a,n)=>{e.forEach(r=>{if(typeof r=="string"){let o=r===""?t:O$(t,r);o.classGroupId=a;return}if(typeof r=="function"){if(FB(r)){nI(r(n),t,a,n);return}t.validators.push({validator:r,classGroupId:a});return}Object.entries(r).forEach(([o,i])=>{nI(i,O$(t,o),a,n)})})},O$=(e,t)=>{let a=e;return t.split("-").forEach(n=>{a.nextPart.has(n)||a.nextPart.set(n,{nextPart:new Map,validators:[]}),a=a.nextPart.get(n)}),a},FB=e=>e.isThemeGetter,jB=(e,t)=>t?e.map(([a,n])=>{let r=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[t+i,l])):o);return[a,r]}):e,BB=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,n=new Map,r=(o,i)=>{a.set(o,i),t++,t>e&&(t=0,n=a,a=new Map)};return{get(o){let i=a.get(o);if(i!==void 0)return i;if((i=n.get(o))!==void 0)return r(o,i),i},set(o,i){a.has(o)?a.set(o,i):r(o,i)}}};var qB=e=>{let{separator:t,experimentalParseClassName:a}=e,n=t.length===1,r=t[0],o=t.length,i=l=>{let s=[],u=0,c=0,d;for(let C=0;C<l.length;C++){let m=l[C];if(u===0){if(m===r&&(n||l.slice(C,C+o)===t)){s.push(l.slice(c,C)),c=C+o;continue}if(m==="/"){d=C;continue}}m==="["?u++:m==="]"&&u--}let f=s.length===0?l:l.substring(c),p=f.startsWith("!"),h=p?f.substring(1):f,w=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:w}};return a?l=>a({className:l,parseClassName:i}):i},ZB=e=>{if(e.length<=1)return e;let t=[],a=[];return e.forEach(n=>{n[0]==="["?(t.push(...a.sort(),n),a=[]):a.push(n)}),t.push(...a.sort()),t},HB=e=>({cache:BB(e.cacheSize),parseClassName:qB(e),...PB(e)}),VB=/\s+/,GB=(e,t)=>{let{parseClassName:a,getClassGroupId:n,getConflictingClassGroupIds:r}=t,o=[],i=e.trim().split(VB),l="";for(let s=i.length-1;s>=0;s-=1){let u=i[s],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=a(u),h=!!p,w=n(h?f.substring(0,p):f);if(!w){if(!h){l=u+(l.length>0?" "+l:l);continue}if(w=n(f),!w){l=u+(l.length>0?" "+l:l);continue}h=!1}let C=ZB(c).join(":"),m=d?C+"!":C,y=m+w;if(o.includes(y))continue;o.push(y);let g=r(w,h);for(let b=0;b<g.length;++b){let L=g[b];o.push(m+L)}l=u+(l.length>0?" "+l:l)}return l};function WB(){let e=0,t,a,n="";for(;e<arguments.length;)(t=arguments[e++])&&(a=N$(t))&&(n&&(n+=" "),n+=a);return n}var N$=e=>{if(typeof e=="string")return e;let t,a="";for(let n=0;n<e.length;n++)e[n]&&(t=N$(e[n]))&&(a&&(a+=" "),a+=t);return a};function JB(e,...t){let a,n,r,o=i;function i(s){let u=t.reduce((c,d)=>d(c),e());return a=HB(u),n=a.cache.get,r=a.cache.set,o=l,l(s)}function l(s){let u=n(s);if(u)return u;let c=GB(s,a);return r(s,c),c}return function(){return o(WB.apply(null,arguments))}}var ht=e=>{let t=a=>a[e]||[];return t.isThemeGetter=!0,t},U$=/^\[(?:([a-z-]+):)?(.+)\]$/i,XB=/^\d+\/\d+$/,KB=new Set(["px","full","screen"]),YB=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QB=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,e5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,t5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,a5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>Ps(e)||KB.has(e)||XB.test(e),Fo=e=>Ns(e,"length",c5),Ps=e=>!!e&&!Number.isNaN(Number(e)),rI=e=>Ns(e,"number",Ps),sd=e=>!!e&&Number.isInteger(Number(e)),r5=e=>e.endsWith("%")&&Ps(e.slice(0,-1)),Le=e=>U$.test(e),jo=e=>YB.test(e),n5=new Set(["length","size","percentage"]),o5=e=>Ns(e,n5,F$),i5=e=>Ns(e,"position",F$),l5=new Set(["image","url"]),s5=e=>Ns(e,l5,f5),u5=e=>Ns(e,"",d5),ud=()=>!0,Ns=(e,t,a)=>{let n=U$.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):a(n[2]):!1},c5=e=>QB.test(e)&&!e5.test(e),F$=()=>!1,d5=e=>t5.test(e),f5=e=>a5.test(e);var p5=()=>{let e=ht("colors"),t=ht("spacing"),a=ht("blur"),n=ht("brightness"),r=ht("borderColor"),o=ht("borderRadius"),i=ht("borderSpacing"),l=ht("borderWidth"),s=ht("contrast"),u=ht("grayscale"),c=ht("hueRotate"),d=ht("invert"),f=ht("gap"),p=ht("gradientColorStops"),h=ht("gradientColorStopPositions"),w=ht("inset"),C=ht("margin"),m=ht("opacity"),y=ht("padding"),g=ht("saturate"),b=ht("scale"),L=ht("sepia"),x=ht("skew"),_=ht("space"),S=ht("translate"),T=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",Le,t],R=()=>[Le,t],O=()=>["",Un,Fo],P=()=>["auto",Ps,Le],te=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],ve=()=>["","0",Le],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ae=()=>[Ps,Le];return{cacheSize:500,separator:":",theme:{colors:[ud],spacing:[Un,Fo],blur:["none","",jo,Le],brightness:Ae(),borderColor:[e],borderRadius:["none","","full",jo,Le],borderSpacing:R(),borderWidth:O(),contrast:Ae(),grayscale:ve(),hueRotate:Ae(),invert:ve(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[r5,Fo],inset:B(),margin:B(),opacity:Ae(),padding:R(),saturate:Ae(),scale:Ae(),sepia:ve(),skew:Ae(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",Le]}],container:["container"],columns:[{columns:[jo]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...te(),Le]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",sd,Le]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Le]}],grow:[{grow:ve()}],shrink:[{shrink:ve()}],order:[{order:["first","last","none",sd,Le]}],"grid-cols":[{"grid-cols":[ud]}],"col-start-end":[{col:["auto",{span:["full",sd,Le]},Le]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[ud]}],"row-start-end":[{row:["auto",{span:[sd,Le]},Le]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Le]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[C]}],mx:[{mx:[C]}],my:[{my:[C]}],ms:[{ms:[C]}],me:[{me:[C]}],mt:[{mt:[C]}],mr:[{mr:[C]}],mb:[{mb:[C]}],ml:[{ml:[C]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Le,t]}],"min-w":[{"min-w":[Le,t,"min","max","fit"]}],"max-w":[{"max-w":[Le,t,"none","full","min","max","fit","prose",{screen:[jo]},jo]}],h:[{h:[Le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",jo,Fo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",rI]}],"font-family":[{font:[ud]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Le]}],"line-clamp":[{"line-clamp":["none",Ps,rI]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Un,Le]}],"list-image":[{"list-image":["none",Le]}],"list-style-type":[{list:["none","disc","decimal",Le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Un,Fo]}],"underline-offset":[{"underline-offset":["auto",Un,Le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...te(),i5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",o5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},s5]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:se()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[Un,Le]}],"outline-w":[{outline:[Un,Fo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Un,Fo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",jo,u5]}],"shadow-color":[{shadow:[ud]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[n]}],contrast:[{contrast:[s]}],"drop-shadow":[{"drop-shadow":["","none",jo,Le]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[g]}],sepia:[{sepia:[L]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[s]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[g]}],"backdrop-sepia":[{"backdrop-sepia":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Le]}],duration:[{duration:Ae()}],ease:[{ease:["linear","in","out","in-out",Le]}],delay:[{delay:Ae()}],animate:[{animate:["none","spin","ping","pulse","bounce",Le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[sd,Le]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Un,Fo,rI]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};var j$=JB(p5);function Or(...e){return j$(z$(e))}ta(`.input-field{margin-bottom:1rem}.input-field__label{display:block;font-size:.875rem;font-weight:500;color:var(--chat-assistant-text);margin-bottom:.375rem}.input-field__required{color:var(--chat-error);margin-left:.125rem}.input-field__input,.input-field__textarea{width:100%;padding:.5rem .75rem;font-size:.875rem;line-height:1.5;color:var(--chat-input-text);background-color:var(--chat-input-bg);border:1px solid var(--chat-border);border-radius:calc(var(--chat-radius) * .5);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;font-family:var(--chat-font-family)}.input-field__input:focus,.input-field__textarea:focus{outline:none;border-color:var(--chat-primary);box-shadow:0 0 0 3px var(--chat-primary-subtle)}.input-field__textarea{resize:vertical;min-height:5rem}.input-field__options{display:flex;flex-direction:column;gap:.5rem}.input-field__option{display:flex;align-items:flex-start;gap:.5rem;cursor:pointer;padding:.5rem;border-radius:calc(var(--chat-radius) * .5);transition:background-color .15s ease-in-out}.input-field__option:hover{background-color:var(--chat-border)}.input-field__radio,.input-field__checkbox{flex-shrink:0;margin-top:.125rem;width:1rem;height:1rem;cursor:pointer;accent-color:var(--chat-primary)}.input-field__option-content{display:flex;flex-direction:column;gap:.125rem}.input-field__option-label{font-size:.875rem;font-weight:500;color:var(--chat-assistant-text)}.input-field__option-description{font-size:.75rem;color:var(--chat-input-placeholder)}.input-field--checkbox .input-field__checkbox-wrapper{display:flex;align-items:center;gap:.5rem;cursor:pointer;padding:.5rem 0}.input-field--checkbox .input-field__checkbox-label{font-size:.875rem;color:var(--chat-assistant-text)}.input-field--number .input-field__input{-moz-appearance:textfield}.input-field--number .input-field__input::-webkit-outer-spin-button,.input-field--number .input-field__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.input-field--date .input-field__input{cursor:pointer}
71
- `);ta(`@import .input-form-overlay{position: absolute; bottom: 0; left: 0; right: 0; top: 0; z-index: 10; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none;}@keyframes slideUp{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}.input-form-overlay__content{pointer-events:auto;animation:slideUp .2s ease-out;display:flex;flex-direction:column;background-color:var(--chat-background);border-top:1px solid var(--chat-border);border-radius:var(--chat-radius) var(--chat-radius) 0 0;box-shadow:var(--chat-shadow-sm);max-height:80%;font-family:var(--chat-font-family)}.input-form-overlay__title{font-size:1rem;font-weight:600;color:var(--chat-assistant-text);margin:0 0 .375rem}.input-form-overlay__description{font-size:.8125rem;color:var(--chat-input-placeholder);margin:0 0 1rem;line-height:1.4}.input-form-overlay__form{display:flex;flex-direction:column;flex:1;min-height:0}.input-form-overlay__scrollable{flex:1;overflow-y:auto;min-height:0;padding:1rem 1.25rem}.input-form-overlay__footer{flex-shrink:0;padding:.5rem 1.25rem;border-top:1px solid var(--chat-border)}.input-form-overlay__actions{display:flex;align-items:center;gap:.5rem;justify-content:flex-start}.input-form-overlay__button{padding:.5rem 1rem;font-size:.875rem;font-weight:500;border-radius:calc(var(--chat-radius) * .5);cursor:pointer;transition:all .15s ease-in-out;border:none}.input-form-overlay__button:disabled{opacity:.5;cursor:not-allowed}.input-form-overlay__button--primary{background-color:var(--chat-primary);color:var(--chat-primary-text)}.input-form-overlay__button--primary:hover:not(:disabled){background-color:var(--chat-primary-hover)}.input-form-overlay__button--secondary{background-color:var(--chat-border);color:var(--chat-assistant-text)}.input-form-overlay__button--secondary:hover:not(:disabled){opacity:.8}.input-form-overlay__freeform-toggle{padding:.5rem 0;font-size:.75rem;color:var(--chat-input-placeholder);background:none;border:none;cursor:pointer;transition:color .15s ease-in-out;white-space:nowrap}.input-form-overlay__freeform-toggle:hover{color:var(--chat-primary);text-decoration:underline}.input-form-overlay__freeform{display:flex;flex-direction:column;flex:1;min-height:0}.input-form-overlay__freeform-body{padding:1rem 1.25rem}.input-form-overlay__freeform-input{flex:1;width:100%;padding:.625rem;font-size:var(--chat-font-size);line-height:1.4;color:var(--chat-input-text);background-color:var(--chat-input-bg);border:1px solid var(--chat-border);border-radius:calc(var(--chat-radius) * .5);resize:vertical;min-height:5rem;font-family:var(--chat-font-family)}.input-form-overlay__freeform-input:focus{outline:none;border-color:var(--chat-primary);box-shadow:0 0 0 2px var(--chat-primary-subtle)}
71
+ `);ta(`.input-form-overlay{position:absolute;inset:0;z-index:10;display:flex;flex-direction:column;justify-content:flex-end;pointer-events:none}@keyframes slideUp{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}.input-form-overlay__content{pointer-events:auto;animation:slideUp .2s ease-out;display:flex;flex-direction:column;background-color:var(--chat-background);border-top:1px solid var(--chat-border);border-radius:var(--chat-radius) var(--chat-radius) 0 0;box-shadow:var(--chat-shadow-sm);max-height:80%;font-family:var(--chat-font-family)}.input-form-overlay__title{font-size:1rem;font-weight:600;color:var(--chat-assistant-text);margin:0 0 .375rem}.input-form-overlay__description{font-size:.8125rem;color:var(--chat-input-placeholder);margin:0 0 1rem;line-height:1.4}.input-form-overlay__form{display:flex;flex-direction:column;flex:1;min-height:0}.input-form-overlay__scrollable{flex:1;overflow-y:auto;min-height:0;padding:1rem 1.25rem}.input-form-overlay__footer{flex-shrink:0;padding:.5rem 1.25rem;border-top:1px solid var(--chat-border)}.input-form-overlay__actions{display:flex;align-items:center;gap:.5rem;justify-content:flex-start}.input-form-overlay__button{padding:.5rem 1rem;font-size:.875rem;font-weight:500;border-radius:calc(var(--chat-radius) * .5);cursor:pointer;transition:all .15s ease-in-out;border:none}.input-form-overlay__button:disabled{opacity:.5;cursor:not-allowed}.input-form-overlay__button--primary{background-color:var(--chat-primary);color:var(--chat-primary-text)}.input-form-overlay__button--primary:hover:not(:disabled){background-color:var(--chat-primary-hover)}.input-form-overlay__button--secondary{background-color:var(--chat-border);color:var(--chat-assistant-text)}.input-form-overlay__button--secondary:hover:not(:disabled){opacity:.8}.input-form-overlay__freeform-toggle{padding:.5rem 0;font-size:.75rem;color:var(--chat-input-placeholder);background:none;border:none;cursor:pointer;transition:color .15s ease-in-out;white-space:nowrap}.input-form-overlay__freeform-toggle:hover{color:var(--chat-primary);text-decoration:underline}.input-form-overlay__freeform{display:flex;flex-direction:column;flex:1;min-height:0}.input-form-overlay__freeform-body{padding:1rem 1.25rem}.input-form-overlay__freeform-input{flex:1;width:100%;padding:.625rem;font-size:var(--chat-font-size);line-height:1.4;color:var(--chat-input-text);background-color:var(--chat-input-bg);border:1px solid var(--chat-border);border-radius:calc(var(--chat-radius) * .5);resize:vertical;min-height:5rem;font-family:var(--chat-font-family)}.input-form-overlay__freeform-input:focus{outline:none;border-color:var(--chat-primary);box-shadow:0 0 0 2px var(--chat-primary-subtle)}
72
72
  `);var sh=oe(bt(),1);var Us=oe(xe(),1);function oI({field:e,value:t,onChange:a}){let{name:n,label:r}=e;return(0,Us.jsx)("div",{className:"input-field input-field--checkbox",children:(0,Us.jsxs)("label",{className:"input-field__checkbox-wrapper",children:[(0,Us.jsx)("input",{type:"checkbox",name:n,checked:t??!1,onChange:o=>a(o.target.checked),className:"input-field__checkbox"}),(0,Us.jsx)("span",{className:"input-field__checkbox-label",children:r})]})})}var Bt=oe(xe(),1);function iI({field:e,value:t,onChange:a}){let{name:n,label:r,options:o,multiSelect:i,required:l}=e;if(i){let u=Array.isArray(t)?t:t?[t]:[],c=(d,f)=>{a(f?[...u,d]:u.filter(p=>p!==d))};return(0,Bt.jsxs)("div",{className:"input-field input-field--choices",children:[(0,Bt.jsxs)("label",{className:"input-field__label",children:[r,l&&(0,Bt.jsx)("span",{className:"input-field__required",children:"*"})]}),(0,Bt.jsx)("div",{className:"input-field__options input-field__options--checkbox",children:o.map(d=>(0,Bt.jsxs)("label",{className:"input-field__option",children:[(0,Bt.jsx)("input",{type:"checkbox",name:n,value:d.value,checked:u.includes(d.value),onChange:f=>c(d.value,f.target.checked),className:"input-field__checkbox"}),(0,Bt.jsxs)("span",{className:"input-field__option-content",children:[(0,Bt.jsx)("span",{className:"input-field__option-label",children:d.label}),d.description&&(0,Bt.jsx)("span",{className:"input-field__option-description",children:d.description})]})]},d.value))})]})}let s=Array.isArray(t)?t[0]:t;return(0,Bt.jsxs)("div",{className:"input-field input-field--choices",children:[(0,Bt.jsxs)("label",{className:"input-field__label",children:[r,l&&(0,Bt.jsx)("span",{className:"input-field__required",children:"*"})]}),(0,Bt.jsx)("div",{className:"input-field__options input-field__options--radio",children:o.map(u=>(0,Bt.jsxs)("label",{className:"input-field__option",children:[(0,Bt.jsx)("input",{type:"radio",name:n,value:u.value,checked:s===u.value,onChange:()=>a(u.value),className:"input-field__radio"}),(0,Bt.jsxs)("span",{className:"input-field__option-content",children:[(0,Bt.jsx)("span",{className:"input-field__option-label",children:u.label}),u.description&&(0,Bt.jsx)("span",{className:"input-field__option-description",children:u.description})]})]},u.value))})]})}var Fs=oe(xe(),1);function lI({field:e,value:t,onChange:a}){let{label:n,required:r}=e;return(0,Fs.jsxs)("div",{className:"input-field input-field--date",children:[(0,Fs.jsxs)("label",{className:"input-field__label",children:[n,r&&(0,Fs.jsx)("span",{className:"input-field__required",children:"*"})]}),(0,Fs.jsx)("input",{type:"date",value:t??"",onChange:o=>a(o.target.value),className:"input-field__input"})]})}var js=oe(xe(),1);function sI({field:e,value:t,onChange:a}){let{label:n,min:r,max:o,required:i}=e;return(0,js.jsxs)("div",{className:"input-field input-field--number",children:[(0,js.jsxs)("label",{className:"input-field__label",children:[n,i&&(0,js.jsx)("span",{className:"input-field__required",children:"*"})]}),(0,js.jsx)("input",{type:"number",value:t??"",onChange:s=>{let u=s.target.value;if(u==="")a(void 0);else{let c=parseFloat(u);isNaN(c)||a(c)}},min:r,max:o,className:"input-field__input"})]})}var rn=oe(xe(),1);function uI({field:e,value:t,onChange:a}){let{label:n,placeholder:r,multiline:o,required:i}=e;return o?(0,rn.jsxs)("div",{className:"input-field input-field--text",children:[(0,rn.jsxs)("label",{className:"input-field__label",children:[n,i&&(0,rn.jsx)("span",{className:"input-field__required",children:"*"})]}),(0,rn.jsx)("textarea",{value:t??"",onChange:l=>a(l.target.value),placeholder:r,className:"input-field__textarea",rows:4})]}):(0,rn.jsxs)("div",{className:"input-field input-field--text",children:[(0,rn.jsxs)("label",{className:"input-field__label",children:[n,i&&(0,rn.jsx)("span",{className:"input-field__required",children:"*"})]}),(0,rn.jsx)("input",{type:"text",value:t??"",onChange:l=>a(l.target.value),placeholder:r,className:"input-field__input"})]})}var Bs=oe(xe(),1);function cI({field:e,value:t,onChange:a}){switch(e.type){case"choices":return(0,Bs.jsx)(iI,{field:e,value:t,onChange:a});case"text":return(0,Bs.jsx)(uI,{field:e,value:t,onChange:a});case"number":return(0,Bs.jsx)(sI,{field:e,value:t,onChange:a});case"checkbox":return(0,Bs.jsx)(oI,{field:e,value:t,onChange:a});case"date":return(0,Bs.jsx)(lI,{field:e,value:t,onChange:a});default:let n=e;return null}}var Tt=oe(xe(),1);function H$({args:e,onComplete:t}){let{title:a,description:n,fields:r,submitLabel:o="Submit",cancelLabel:i="Cancel",allowFreeformResponse:l=!0}=e,[s,u]=(0,sh.useState)(()=>{let g={};for(let b of r)b.defaultValue!==void 0&&(g[b.name]=b.defaultValue);return g}),[c,d]=(0,sh.useState)(""),[f,p]=(0,sh.useState)(!1),h=(g,b)=>{u(L=>({...L,[g]:b}))},w=g=>{g.preventDefault(),t({values:s})},C=()=>{t({cancelled:!0})},m=()=>{c.trim()&&t({freeformResponse:c.trim()})},y=r.every(g=>{if(!("required"in g)||!g.required)return!0;let b=s[g.name];return!(b==null||b===""||Array.isArray(b)&&b.length===0)});return(0,Tt.jsx)("div",{className:"input-form-overlay",children:(0,Tt.jsx)("div",{className:"input-form-overlay__content",children:f?(0,Tt.jsxs)("div",{className:"input-form-overlay__freeform",children:[(0,Tt.jsx)("div",{className:"input-form-overlay__freeform-body",children:(0,Tt.jsx)("textarea",{value:c,onChange:g=>d(g.target.value),placeholder:"Type your response...",className:"input-form-overlay__freeform-input",autoFocus:!0,rows:4})}),(0,Tt.jsx)("div",{className:"input-form-overlay__footer",children:(0,Tt.jsxs)("div",{className:"input-form-overlay__actions",children:[(0,Tt.jsx)("button",{type:"button",onClick:m,disabled:!c.trim(),className:"input-form-overlay__button input-form-overlay__button--primary",children:"Send"}),(0,Tt.jsx)("button",{type:"button",onClick:()=>p(!1),className:"input-form-overlay__button input-form-overlay__button--secondary",children:"Back to form"})]})})]}):(0,Tt.jsxs)("form",{onSubmit:w,className:"input-form-overlay__form",children:[(0,Tt.jsxs)("div",{className:"input-form-overlay__scrollable",children:[a&&(0,Tt.jsx)("h3",{className:"input-form-overlay__title",children:a}),n&&(0,Tt.jsx)("p",{className:"input-form-overlay__description",children:n}),(0,Tt.jsx)("div",{className:"input-form-overlay__fields",children:r.map(g=>(0,Tt.jsx)(cI,{field:g,value:s[g.name],onChange:b=>h(g.name,b)},g.name))})]}),(0,Tt.jsx)("div",{className:"input-form-overlay__footer",children:(0,Tt.jsxs)("div",{className:"input-form-overlay__actions",children:[(0,Tt.jsx)("button",{type:"submit",disabled:!y,className:"input-form-overlay__button input-form-overlay__button--primary",children:o}),(0,Tt.jsx)("button",{type:"button",onClick:C,className:"input-form-overlay__button input-form-overlay__button--secondary",children:i}),l&&(0,Tt.jsx)("button",{type:"button",className:"input-form-overlay__freeform-toggle",onClick:()=>p(!0),children:"Or type a response instead..."})]})})]})})})}var je=oe(bt(),1);var Ei=oe(xe(),1),V$=()=>{if(typeof window>"u")return null;let e=window;return e.SpeechRecognition||e.webkitSpeechRecognition||null},G$=e=>Math.max(0,Math.min(1,e)),W$=(...e)=>e.map(t=>t.trim()).filter(Boolean).join(" ");function J$({onInterim:e,onFinal:t,onError:a,onListeningChange:n,silenceTimeout:r=3e3,finalDelay:o=1500,language:i,disabled:l,className:s}){let[u,c]=(0,je.useState)(!1),[d,f]=(0,je.useState)(!1),[p,h]=(0,je.useState)(0),w=(0,je.useRef)(null),[C,m]=(0,je.useState)(!1),y=(0,je.useRef)(null),g=(0,je.useRef)(null),b=(0,je.useRef)(""),L=(0,je.useRef)(null),x=(0,je.useRef)(0),_=i??"en-US",S=(0,je.useCallback)(()=>{y.current&&(clearTimeout(y.current),y.current=null)},[]),T=(0,je.useCallback)(()=>{L.current&&(cancelAnimationFrame(L.current),L.current=null)},[]),I=(0,je.useCallback)(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),B=(0,je.useCallback)(()=>{S(),I(),T(),h(0),m(!1),x.current=0,w.current?.stop()},[S,I,T]),R=(0,je.useCallback)(E=>{console.error("Speech recognition error:",E),a?.(E)},[a]),O=(0,je.useCallback)(()=>{r&&(S(),y.current=setTimeout(B,r))},[r,S,B]),P=(0,je.useCallback)(E=>{E&&e?.(E)},[e]),te=(0,je.useCallback)(E=>{E&&t?.(E)},[t]),se=(0,je.useCallback)(()=>{let E=b.current.trim();E&&te(E),b.current="",I()},[te,I]),Y=(0,je.useCallback)(()=>{if(!x.current||!o){h(0),m(!1),L.current=null;return}let E=x.current-Date.now(),pe=G$(E/o);if(h(pe),E<=0){m(!1),L.current=null;return}L.current=requestAnimationFrame(Y)},[o]),K=(0,je.useCallback)(()=>{if(!o){h(0),m(!1);return}x.current=Date.now()+o,h(1),m(!0),T(),L.current=requestAnimationFrame(Y)},[o,T,Y]),ve=(0,je.useCallback)(()=>{if(I(),!o){se();return}K(),g.current=setTimeout(se,o)},[I,o,se,K]),M=(0,je.useCallback)(E=>{E.continuous=!0,E.interimResults=!0,E.lang=_,E.onresult=pe=>{let Fe="",X="";for(let $=pe.resultIndex;$<pe.results.length;$++){let N=pe.results[$];if(!N)continue;let j=N[0]?.transcript??"";N.isFinal?X+=j:Fe+=j}let k=Fe.trim();if(k){K();let $=W$(b.current,k);P($)}else{let $=b.current.trim();$&&P($)}let A=X.trim();A&&(b.current=W$(b.current,A),P(b.current),ve(),E.stop()),O()},E.onerror=pe=>{if(pe.error==="no-speech"){O();return}R(pe.error)},E.onstart=()=>{c(!0),n?.(!0),O()},E.onend=()=>{c(!1),n?.(!1),S(),g.current||se()}},[_,O,K,P,ve,R,n,S,se,C]),Ae=(0,je.useCallback)(()=>{if(typeof window>"u")return null;let E=V$();return E?(w.current||(w.current=new E),M(w.current),w.current):(R("Speech recognition is not supported in this browser."),null)},[M,R]),yt=(0,je.useCallback)(()=>{if(l)return;if(u){B();return}let E=Ae();if(E)try{E.start()}catch{R("Microphone permission denied or unavailable.")}},[l,u,B,Ae,R]);return(0,je.useEffect)(()=>{l&&u&&B()},[l,u,B]),(0,je.useEffect)(()=>{f(typeof window<"u"&&!!V$())},[]),(0,je.useEffect)(()=>()=>{S(),I(),T(),w.current?.stop(),w.current=null},[S,I,T]),d?(0,Ei.jsxs)("button",{type:"button",className:Or("chat-widget__mic-button",u&&"chat-widget__mic-button--active",s),onClick:yt,disabled:l,"aria-pressed":u,"aria-label":"Toggle microphone",children:[u?(0,Ei.jsx)(Qc,{className:"chat-widget__mic-icon"}):(0,Ei.jsx)(Yc,{className:"chat-widget__mic-icon"}),o>0&&u&&C&&(0,Ei.jsx)("span",{className:"chat-widget__mic-bar","aria-hidden":"true",children:(0,Ei.jsx)("span",{className:"chat-widget__mic-bar-fill",style:{transform:`scaleX(${G$(p)})`}})})]}):null}ta(`.tool-approval-overlay{position:absolute;inset:0;z-index:10;display:flex;flex-direction:column;justify-content:flex-end;background-color:var(--chat-overlay-bg)}@keyframes slideUp{0%{transform:translateY(100%);opacity:0}to{transform:translateY(0);opacity:1}}.tool-approval-overlay__content{animation:slideUp .2s ease-out;display:flex;flex-direction:column;background-color:var(--chat-background);border-top:1px solid var(--chat-border);border-radius:var(--chat-radius) var(--chat-radius) 0 0;box-shadow:var(--chat-shadow-sm);max-height:80%;font-family:var(--chat-font-family);transition:max-height .2s ease-out}.tool-approval-overlay__content--loading{max-height:160px}.tool-approval-overlay__scrollable{flex:1;overflow-y:auto;min-height:0;padding:1rem 1.25rem}.tool-approval-overlay__title{font-size:1rem;font-weight:600;color:var(--chat-assistant-text);margin:0 0 .375rem}.tool-approval-overlay__description{font-size:.8125rem;color:var(--chat-input-placeholder);margin:0 0 1rem;line-height:1.4}.tool-approval-overlay__tool-name{background-color:var(--chat-border);padding:.125rem .375rem;border-radius:.25rem;font-size:.8125rem}.tool-approval-overlay__args{display:flex;flex-direction:column;gap:.75rem}.tool-approval-overlay__arg{display:flex;flex-direction:column;gap:.25rem}.tool-approval-overlay__arg-label{font-size:.6875rem;font-weight:500;color:var(--chat-input-placeholder);text-transform:uppercase;letter-spacing:.05em}.tool-approval-overlay__arg-value{font-size:.875rem;color:var(--chat-assistant-text);white-space:pre-wrap;word-break:break-word}.tool-approval-overlay__no-args{font-size:.8125rem;color:var(--chat-input-placeholder);font-style:italic}.tool-approval-overlay__footer{flex-shrink:0;padding:.5rem 1.25rem;border-top:1px solid var(--chat-border)}.tool-approval-overlay__actions{display:flex;align-items:center;gap:.5rem;justify-content:flex-start}.tool-approval-overlay__button{padding:.5rem 1rem;font-size:.875rem;font-weight:500;border-radius:calc(var(--chat-radius) * .5);cursor:pointer;transition:all .15s ease-in-out;border:none}.tool-approval-overlay__button:disabled{opacity:.5;cursor:not-allowed}.tool-approval-overlay__button--primary{background-color:var(--chat-primary);color:var(--chat-primary-text)}.tool-approval-overlay__button--primary:hover:not(:disabled){background-color:var(--chat-primary-hover)}.tool-approval-overlay__button--secondary{background-color:var(--chat-border);color:var(--chat-assistant-text)}.tool-approval-overlay__button--secondary:hover:not(:disabled){opacity:.8}.tool-approval-overlay__freeform-toggle{padding:.5rem 0;font-size:.75rem;color:var(--chat-input-placeholder);background:none;border:none;cursor:pointer;transition:color .15s ease-in-out;white-space:nowrap}.tool-approval-overlay__freeform-toggle:hover{color:var(--chat-primary);text-decoration:underline}.tool-approval-overlay__freeform{display:flex;flex-direction:column}.tool-approval-overlay__freeform-body{padding:1rem 1.25rem}.tool-approval-overlay__freeform-input{width:100%;padding:.75rem;font-size:.875rem;font-family:var(--chat-font-family);color:var(--chat-input-text);background-color:var(--chat-input-bg);border:1px solid var(--chat-border);border-radius:calc(var(--chat-radius) * .5);resize:vertical;min-height:80px;box-sizing:border-box}.tool-approval-overlay__freeform-input:focus{outline:none;border-color:var(--chat-primary);box-shadow:0 0 0 2px var(--chat-primary-subtle)}.tool-approval-overlay__freeform-input::-moz-placeholder{color:var(--chat-input-placeholder)}.tool-approval-overlay__freeform-input::placeholder{color:var(--chat-input-placeholder)}.tool-approval-overlay__loading{display:flex;justify-content:center;align-items:center;height:160px}.tool-approval-overlay__loading-spinner{width:24px;height:24px;border:2px solid var(--chat-border);border-top-color:var(--chat-primary);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
73
73
  `);var dI=oe(bt(),1),rt=oe(xe(),1);function X$({approval:e,config:t,configLoading:a,onApprove:n,onDeny:r}){let{toolName:o,args:i}=e,[l,s]=(0,dI.useState)(!1),[u,c]=(0,dI.useState)(""),d=()=>{n()},f=()=>{r()},p=()=>{u.trim()&&r(u.trim())},h=Object.entries(i),w=t?.message||`Approve ${o} execution?`,C=t?.approveLabel||"Approve",m=t?.denyLabel||"Deny";return(0,rt.jsx)("div",{className:"tool-approval-overlay",children:(0,rt.jsx)("div",{className:`tool-approval-overlay__content ${a?"tool-approval-overlay__content--loading":""}`,children:a?(0,rt.jsx)("div",{className:"tool-approval-overlay__loading",children:(0,rt.jsx)("div",{className:"tool-approval-overlay__loading-spinner"})}):l?(0,rt.jsxs)("div",{className:"tool-approval-overlay__freeform",children:[(0,rt.jsx)("div",{className:"tool-approval-overlay__freeform-body",children:(0,rt.jsx)("textarea",{value:u,onChange:y=>c(y.target.value),placeholder:"Tell the assistant what's wrong or what you'd like instead...",className:"tool-approval-overlay__freeform-input",autoFocus:!0,rows:4})}),(0,rt.jsx)("div",{className:"tool-approval-overlay__footer",children:(0,rt.jsxs)("div",{className:"tool-approval-overlay__actions",children:[(0,rt.jsx)("button",{type:"button",onClick:p,disabled:!u.trim(),className:"tool-approval-overlay__button tool-approval-overlay__button--primary",children:"Send"}),(0,rt.jsx)("button",{type:"button",onClick:()=>s(!1),className:"tool-approval-overlay__button tool-approval-overlay__button--secondary",children:"Back"})]})})]}):(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsxs)("div",{className:"tool-approval-overlay__scrollable",children:[(0,rt.jsx)("h3",{className:"tool-approval-overlay__title",children:w}),h.length>0?(0,rt.jsx)("div",{className:"tool-approval-overlay__args",children:h.map(([y,g])=>(0,rt.jsxs)("div",{className:"tool-approval-overlay__arg",children:[(0,rt.jsx)("label",{className:"tool-approval-overlay__arg-label",children:y}),(0,rt.jsx)("div",{className:"tool-approval-overlay__arg-value",children:typeof g=="string"?g:JSON.stringify(g,null,2)})]},y))}):(0,rt.jsx)("p",{className:"tool-approval-overlay__no-args",children:"No inputs provided."})]}),(0,rt.jsx)("div",{className:"tool-approval-overlay__footer",children:(0,rt.jsxs)("div",{className:"tool-approval-overlay__actions",children:[(0,rt.jsx)("button",{type:"button",onClick:d,className:"tool-approval-overlay__button tool-approval-overlay__button--primary",children:C}),(0,rt.jsx)("button",{type:"button",onClick:f,className:"tool-approval-overlay__button tool-approval-overlay__button--secondary",children:m}),(0,rt.jsx)("button",{type:"button",onClick:()=>s(!0),className:"tool-approval-overlay__freeform-toggle",children:"Or type a response instead..."})]})})]})})})}var Ra=oe(bt(),1),Ht=oe(xe(),1);function K$({collapsed:e,renderPart:t,itemKey:a}){let[n,r]=(0,Ra.useState)(!1),[o,i]=(0,Ra.useState)(!1),l=(0,Ra.useRef)(null),s=(0,Ra.useRef)(e.parts.length);(0,Ra.useEffect)(()=>{if(e.parts.length>s.current&&!n){i(!0);let d=setTimeout(()=>i(!1),300);return()=>clearTimeout(d)}s.current=e.parts.length},[e.parts.length,n]);let u=(0,Ra.useCallback)(()=>{r(d=>!d)},[]),c=["chat-widget__collapsed",o?"chat-widget__collapsed--animating":""].filter(Boolean).join(" ");return(0,Ht.jsxs)("div",{className:c,children:[(0,Ht.jsx)("div",{className:`chat-widget__collapsed-content ${n?"chat-widget__collapsed-content--expanded":""}`,children:(0,Ht.jsx)("div",{ref:l,className:"chat-widget__collapsed-content-inner",children:e.parts.map((d,f)=>(0,Ht.jsx)("div",{children:t(d,`${a}-expanded-${f}`)},`${a}-expanded-${f}`))})}),(0,Ht.jsxs)("div",{className:`chat-widget__collapsed-preview ${n?"chat-widget__collapsed-preview--hidden":""}`,children:[t(e.lastPart,`${a}-preview`),(0,Ht.jsx)("div",{className:"chat-widget__collapsed-gradient"})]}),(0,Ht.jsx)("button",{type:"button",className:"chat-widget__collapsed-toggle",onClick:u,children:n?"Show less":"Show more"})]})}function g5(e,t){let a=[],n=[];e.forEach((i,l)=>{n.push({type:i.type,index:l})});let r=-1;for(let i=e.length-1;i>=0;i--)if(e[i]?.type==="step"){r=i;break}let o=[];if(e.forEach((i,l)=>{if(i.type==="step")if(l<r)o.push(...i.parts);else{if(o.length>0){let s=o[o.length-1];a.push({type:"collapsed",collapsed:{parts:[...o],lastPart:s},key:`${t}-collapsed-${a.length}`}),o.length=0}a.push({type:"parts",parts:i.parts,key:`${t}-step-${l}`})}else if(i.type==="group"){if(o.length>0){let d=o[o.length-1];a.push({type:"collapsed",collapsed:{parts:[...o],lastPart:d},key:`${t}-collapsed-${a.length}`}),o.length=0}let s=i.parts,u=null,c=[];if(s.length>1){let d=s.slice(0,-1),f=d[d.length-1];u={parts:d,lastPart:f},c=[s[s.length-1]]}else c=s;a.push({type:"group",groupName:i.groupName,collapsedParts:u,currentParts:c,key:`${t}-group-${i.groupName}`})}}),o.length>0){let i=o[o.length-1];a.push({type:"collapsed",collapsed:{parts:[...o],lastPart:i},key:`${t}-collapsed-${a.length}`})}return a}function cd({sections:e,messageId:t,renderPart:a,renderGroup:n}){let r=(0,Ra.useMemo)(()=>g5(e,t),[e,t]);return(0,Ht.jsx)(Ht.Fragment,{children:r.map(o=>{if(o.type==="collapsed")return(0,Ht.jsx)(K$,{collapsed:o.collapsed,renderPart:a,itemKey:o.key},o.key);if(o.type==="parts")return(0,Ht.jsx)(Ra.default.Fragment,{children:o.parts.map((i,l)=>(0,Ht.jsx)("div",{children:a(i,`${o.key}-part-${l}`)},`${o.key}-part-${l}`))},o.key);if(o.type==="group"){let i=(0,Ht.jsxs)(Ht.Fragment,{children:[o.collapsedParts&&(0,Ht.jsx)(K$,{collapsed:o.collapsedParts,renderPart:a,itemKey:`${o.key}-collapsed`}),o.currentParts.map((l,s)=>(0,Ht.jsx)("div",{children:a(l,`${o.key}-current-${s}`)},`${o.key}-current-${s}`))]});return n(o.groupName,o.key,i)}return null})})}var Y$=oe(bt(),1),Fn=oe(xe(),1);function dd({sections:e,messageId:t,renderPart:a,renderGroup:n}){return(0,Fn.jsx)(Fn.Fragment,{children:e.map((r,o)=>{let i=`${t}-section-${o}`;if(r.type==="step")return(0,Fn.jsx)(Y$.default.Fragment,{children:r.parts.map((l,s)=>(0,Fn.jsx)("div",{children:a(l,`${i}-part-${s}`)},`${i}-part-${s}`))},i);if(r.type==="group"){let l=`${t}-group-${r.groupName}`,s=r.parts.map((u,c)=>(0,Fn.jsx)("div",{children:a(u,`${l}-part-${c}`)},`${l}-part-${c}`));return n(r.groupName,l,(0,Fn.jsx)(Fn.Fragment,{children:s}))}return null})})}var Zn=oe(bt(),1);function Q$(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}var v5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,y5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,x5={};function uh(e,t){return((t||x5).jsx?y5:v5).test(e)}var b5=/[ \t\n\f\r]/g;function fI(e){return typeof e=="object"?e.type==="text"?eD(e.value):!1:eD(e)}function eD(e){return e.replace(b5,"")===""}var jn=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};jn.prototype.normal={};jn.prototype.property={};jn.prototype.space=void 0;function pI(e,t){let a={},n={};for(let r of e)Object.assign(a,r.property),Object.assign(n,r.normal);return new jn(a,n,t)}function fd(e){return e.toLowerCase()}var Kt=class{constructor(t,a){this.attribute=a,this.property=t}};Kt.prototype.attribute="";Kt.prototype.booleanish=!1;Kt.prototype.boolean=!1;Kt.prototype.commaOrSpaceSeparated=!1;Kt.prototype.commaSeparated=!1;Kt.prototype.defined=!1;Kt.prototype.mustUseProperty=!1;Kt.prototype.number=!1;Kt.prototype.overloadedBoolean=!1;Kt.prototype.property="";Kt.prototype.spaceSeparated=!1;Kt.prototype.space=void 0;var pd={};Cr(pd,{boolean:()=>_e,booleanish:()=>Lt,commaOrSpaceSeparated:()=>Oa,commaSeparated:()=>Bo,number:()=>G,overloadedBoolean:()=>ch,spaceSeparated:()=>Ke});var S5=0,_e=Mi(),Lt=Mi(),ch=Mi(),G=Mi(),Ke=Mi(),Bo=Mi(),Oa=Mi();function Mi(){return 2**++S5}var mI=Object.keys(pd),$i=class extends Kt{constructor(t,a,n,r){let o=-1;if(super(t,a),tD(this,"space",r),typeof n=="number")for(;++o<mI.length;){let i=mI[o];tD(this,mI[o],(n&pd[i])===pd[i])}}};$i.prototype.defined=!0;function tD(e,t,a){a&&(e[t]=a)}function br(e){let t={},a={};for(let[n,r]of Object.entries(e.properties)){let o=new $i(n,e.transform(e.attributes||{},n),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),t[n]=o,a[fd(n)]=n,a[fd(o.attribute)]=n}return new jn(t,a,e.space)}var hI=br({properties:{ariaActiveDescendant:null,ariaAtomic:Lt,ariaAutoComplete:null,ariaBusy:Lt,ariaChecked:Lt,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Ke,ariaCurrent:null,ariaDescribedBy:Ke,ariaDetails:null,ariaDisabled:Lt,ariaDropEffect:Ke,ariaErrorMessage:null,ariaExpanded:Lt,ariaFlowTo:Ke,ariaGrabbed:Lt,ariaHasPopup:null,ariaHidden:Lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ke,ariaLevel:G,ariaLive:null,ariaModal:Lt,ariaMultiLine:Lt,ariaMultiSelectable:Lt,ariaOrientation:null,ariaOwns:Ke,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:Lt,ariaReadOnly:Lt,ariaRelevant:null,ariaRequired:Lt,ariaRoleDescription:Ke,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:Lt,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function dh(e,t){return t in e?e[t]:t}function fh(e,t){return dh(e,t.toLowerCase())}var aD=br({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Bo,acceptCharset:Ke,accessKey:Ke,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:Ke,autoFocus:_e,autoPlay:_e,blocking:Ke,capture:null,charSet:null,checked:_e,cite:null,className:Ke,cols:G,colSpan:null,content:null,contentEditable:Lt,controls:_e,controlsList:Ke,coords:G|Bo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:ch,draggable:Lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:Ke,height:G,hidden:ch,high:G,href:null,hrefLang:null,htmlFor:Ke,httpEquiv:Ke,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:Ke,itemRef:Ke,itemScope:_e,itemType:Ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,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:_e,optimum:G,pattern:null,ping:Ke,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:Ke,required:_e,reversed:_e,rows:G,rowSpan:G,sandbox:Ke,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:Lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:Lt,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ke,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:Lt,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_e,disableRemotePlayback:_e,prefix:null,property:null,results:G,security:null,unselectable:null},space:"html",transform:fh});var rD=br({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:Oa,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:Ke,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:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,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:Bo,g2:Bo,glyphName:Bo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Oa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,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:G,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:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Oa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Oa,rev:Oa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Oa,requiredFeatures:Oa,requiredFonts:Oa,requiredFormats:Oa,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:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Oa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Oa,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Oa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:dh});var gI=br({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var vI=br({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fh});var yI=br({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var xI={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"};var w5=/[A-Z]/g,nD=/-[a-z]/g,_5=/^data[-\w.:]+$/i;function bI(e,t){let a=fd(t),n=t,r=Kt;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&_5.test(t)){if(t.charAt(4)==="-"){let o=t.slice(5).replace(nD,k5);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=t.slice(4);if(!nD.test(o)){let i=o.replace(w5,I5);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}r=$i}return new r(n,t)}function I5(e){return"-"+e.toLowerCase()}function k5(e){return e.charAt(1).toUpperCase()}var oD=pI([hI,aD,gI,vI,yI],"html"),ph=pI([hI,rD,gI,vI,yI],"svg");function iD(e){return e.join(" ").trim()}var SD=oe(vD(),1);var hh=yD("end"),qs=yD("start");function yD(e){return t;function t(a){let n=a&&a.position&&a.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function _I(e){let t=qs(e),a=hh(e);if(t&&a)return{start:t,end:a}}function qo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xD(e.position):"start"in e||"end"in e?xD(e):"line"in e||"column"in e?II(e):""}function II(e){return bD(e&&e.line)+":"+bD(e&&e.column)}function xD(e){return II(e&&e.start)+"-"+II(e&&e.end)}function bD(e){return e&&typeof e=="number"?e:1}var Dt=class extends Error{constructor(t,a,n){super(),typeof a=="string"&&(n=a,a=void 0);let r="",o={},i=!1;if(a&&("line"in a&&"column"in a?o={place:a}:"start"in a&&"end"in a?o={place:a}:"type"in a?o={ancestors:[a],place:a.position}:o={...a}),typeof t=="string"?r=t:!o.cause&&t&&(i=!0,r=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof n=="string"){let s=n.indexOf(":");s===-1?o.ruleId=n:(o.source=n.slice(0,s),o.ruleId=n.slice(s+1))}if(!o.place&&o.ancestors&&o.ancestors){let s=o.ancestors[o.ancestors.length-1];s&&(o.place=s.position)}let l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=l?l.line:void 0,this.name=qo(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=i&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;var kI={}.hasOwnProperty,K5=new Map,Y5=/[A-Z]/g,Q5=new Set(["table","tbody","thead","tfoot","tr"]),eq=new Set(["td","th"]),wD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function CI(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let a=t.filePath||void 0,n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=sq(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=lq(a,t.jsx,t.jsxs)}let r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ph:oD,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=_D(r,e,void 0);return o&&typeof o!="string"?o:r.create(e,r.Fragment,{children:o||void 0},void 0)}function _D(e,t,a){if(t.type==="element")return tq(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return aq(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return nq(e,t,a);if(t.type==="mdxjsEsm")return rq(e,t);if(t.type==="root")return oq(e,t,a);if(t.type==="text")return iq(e,t)}function tq(e,t,a){let n=e.schema,r=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=ph,e.schema=r),e.ancestors.push(t);let o=kD(e,t.tagName,!1),i=uq(e,t),l=LI(e,t);return Q5.has(t.tagName)&&(l=l.filter(function(s){return typeof s=="string"?!fI(s):!0})),ID(e,i,o,t),TI(i,l),e.ancestors.pop(),e.schema=n,e.create(t,o,i,a)}function aq(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}hd(e,t.position)}function rq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);hd(e,t.position)}function nq(e,t,a){let n=e.schema,r=n;t.name==="svg"&&n.space==="html"&&(r=ph,e.schema=r),e.ancestors.push(t);let o=t.name===null?e.Fragment:kD(e,t.name,!0),i=cq(e,t),l=LI(e,t);return ID(e,i,o,t),TI(i,l),e.ancestors.pop(),e.schema=n,e.create(t,o,i,a)}function oq(e,t,a){let n={};return TI(n,LI(e,t)),e.create(t,e.Fragment,n,a)}function iq(e,t){return t.value}function ID(e,t,a,n){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=n)}function TI(e,t){if(t.length>0){let a=t.length>1?t:t[0];a&&(e.children=a)}}function lq(e,t,a){return n;function n(r,o,i,l){let u=Array.isArray(i.children)?a:t;return l?u(o,i,l):u(o,i)}}function sq(e,t){return a;function a(n,r,o,i){let l=Array.isArray(o.children),s=qs(n);return t(r,o,i,l,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function uq(e,t){let a={},n,r;for(r in t.properties)if(r!=="children"&&kI.call(t.properties,r)){let o=dq(e,r,t.properties[r]);if(o){let[i,l]=o;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&eq.has(t.tagName)?n=l:a[i]=l}}if(n){let o=a.style||(a.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return a}function cq(e,t){let a={};for(let n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){let o=n.data.estree.body[0];o.type;let i=o.expression;i.type;let l=i.properties[0];l.type,Object.assign(a,e.evaluater.evaluateExpression(l.argument))}else hd(e,t.position);else{let r=n.name,o;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){let l=n.value.data.estree.body[0];l.type,o=e.evaluater.evaluateExpression(l.expression)}else hd(e,t.position);else o=n.value===null?!0:n.value;a[r]=o}return a}function LI(e,t){let a=[],n=-1,r=e.passKeys?new Map:K5;for(;++n<t.children.length;){let o=t.children[n],i;if(e.passKeys){let s=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(s){let u=r.get(s)||0;i=s+"-"+u,r.set(s,u+1)}}let l=_D(e,o,i);l!==void 0&&a.push(l)}return a}function dq(e,t,a){let n=bI(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=n.commaSeparated?Q$(a):iD(a)),n.property==="style"){let r=typeof a=="object"?a:fq(e,String(a));return e.stylePropertyNameCase==="css"&&(r=pq(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&n.space?xI[n.property]||n.property:n.attribute,a]}}function fq(e,t){try{return(0,SD.default)(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};let n=a,r=new Dt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=wD+"#cannot-parse-style-attribute",r}}function kD(e,t,a){let n;if(!a)n={type:"Literal",value:t};else if(t.includes(".")){let r=t.split("."),o=-1,i;for(;++o<r.length;){let l=uh(r[o])?{type:"Identifier",name:r[o]}:{type:"Literal",value:r[o]};i=i?{type:"MemberExpression",object:i,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}n=i}else n=uh(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){let r=n.value;return kI.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(n);hd(e)}function hd(e,t){let a=new Dt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=wD+"#cannot-handle-mdx-estrees-without-createevaluater",a}function pq(e){let t={},a;for(a in e)kI.call(e,a)&&(t[mq(a)]=e[a]);return t}function mq(e){let t=e.replace(Y5,hq);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function hq(e){return"-"+e.toLowerCase()}var gd={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"]};var Ws=oe(xe(),1),Kz=oe(bt(),1);var gq={};function zi(e,t){let a=t||gq,n=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,r=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return TD(e,n,r)}function TD(e,t,a){if(vq(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return CD(e.children,t,a)}return Array.isArray(e)?CD(e,t,a):""}function CD(e,t,a){let n=[],r=-1;for(;++r<e.length;)n[r]=TD(e[r],t,a);return n.join("")}function vq(e){return!!(e&&typeof e=="object")}var LD=document.createElement("i");function Zs(e){let t="&"+e+";";LD.innerHTML=t;let a=LD.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===t?!1:a}function zt(e,t,a,n){let r=e.length,o=0,i;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,a=a>0?a:0,n.length<1e4)i=Array.from(n),i.unshift(t,a),e.splice(...i);else for(a&&e.splice(t,a);o<n.length;)i=n.slice(o,o+1e4),i.unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function Ia(e,t){return e.length>0?(zt(e,e.length,0,t),e):t}var AD={}.hasOwnProperty;function gh(e){let t={},a=-1;for(;++a<e.length;)yq(t,e[a]);return t}function yq(e,t){let a;for(a in t){let r=(AD.call(e,a)?e[a]:void 0)||(e[a]={}),o=t[a],i;if(o)for(i in o){AD.call(r,i)||(r[i]=[]);let l=o[i];xq(r[i],Array.isArray(l)?l:l?[l]:[])}}}function xq(e,t){let a=-1,n=[];for(;++a<t.length;)(t[a].add==="after"?e:n).push(t[a]);zt(e,0,0,n)}function vh(e,t){let a=Number.parseInt(e,t);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"\uFFFD":String.fromCodePoint(a)}function ma(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Vt=Zo(/[A-Za-z]/),At=Zo(/[\dA-Za-z]/),ED=Zo(/[#-'*+\--9=?A-Z^-~]/);function Ri(e){return e!==null&&(e<32||e===127)}var vd=Zo(/\d/),MD=Zo(/[\dA-Fa-f]/),$D=Zo(/[!-/:-@[-`{-~]/);function ne(e){return e!==null&&e<-2}function De(e){return e!==null&&(e<0||e===32)}function me(e){return e===-2||e===-1||e===32}var Oi=Zo(/\p{P}|\p{S}/u),nn=Zo(/\s/);function Zo(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Sr(e){let t=[],a=-1,n=0,r=0;for(;++a<e.length;){let o=e.charCodeAt(a),i="";if(o===37&&At(e.charCodeAt(a+1))&&At(e.charCodeAt(a+2)))r=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(i=String.fromCharCode(o));else if(o>55295&&o<57344){let l=e.charCodeAt(a+1);o<56320&&l>56319&&l<57344?(i=String.fromCharCode(o,l),r=1):i="\uFFFD"}else i=String.fromCharCode(o);i&&(t.push(e.slice(n,a),encodeURIComponent(i)),n=a+r+1,i=""),r&&(a+=r,r=0)}return t.join("")+e.slice(n)}function fe(e,t,a,n){let r=n?n-1:Number.POSITIVE_INFINITY,o=0;return i;function i(s){return me(s)?(e.enter(a),l(s)):t(s)}function l(s){return me(s)&&o++<r?(e.consume(s),l):(e.exit(a),t(s))}}var DD={tokenize:bq};function bq(e){let t=e.attempt(this.parser.constructs.contentInitial,n,r),a;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),fe(e,t,"linePrefix")}function r(l){return e.enter("paragraph"),o(l)}function o(l){let s=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=s),a=s,i(l)}function i(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ne(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),i)}}var RD={tokenize:Sq},zD={tokenize:wq};function Sq(e){let t=this,a=[],n=0,r,o,i;return l;function l(g){if(n<a.length){let b=a[n];return t.containerState=b[1],e.attempt(b[0].continuation,s,u)(g)}return u(g)}function s(g){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&y();let b=t.events.length,L=b,x;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){x=t.events[L][1].end;break}m(n);let _=b;for(;_<t.events.length;)t.events[_][1].end={...x},_++;return zt(t.events,L+1,0,t.events.slice(b)),t.events.length=_,u(g)}return l(g)}function u(g){if(n===a.length){if(!r)return f(g);if(r.currentConstruct&&r.currentConstruct.concrete)return h(g);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(zD,c,d)(g)}function c(g){return r&&y(),m(n),f(g)}function d(g){return t.parser.lazy[t.now().line]=n!==a.length,i=t.now().offset,h(g)}function f(g){return t.containerState={},e.attempt(zD,p,h)(g)}function p(g){return n++,a.push([t.currentConstruct,t.containerState]),f(g)}function h(g){if(g===null){r&&y(),m(0),e.consume(g);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:o}),w(g)}function w(g){if(g===null){C(e.exit("chunkFlow"),!0),m(0),e.consume(g);return}return ne(g)?(e.consume(g),C(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(g),w)}function C(g,b){let L=t.sliceStream(g);if(b&&L.push(null),g.previous=o,o&&(o.next=g),o=g,r.defineSkip(g.start),r.write(L),t.parser.lazy[g.start.line]){let x=r.events.length;for(;x--;)if(r.events[x][1].start.offset<i&&(!r.events[x][1].end||r.events[x][1].end.offset>i))return;let _=t.events.length,S=_,T,I;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(T){I=t.events[S][1].end;break}T=!0}for(m(n),x=_;x<t.events.length;)t.events[x][1].end={...I},x++;zt(t.events,S+1,0,t.events.slice(_)),t.events.length=x}}function m(g){let b=a.length;for(;b-- >g;){let L=a[b];t.containerState=L[1],L[0].exit.call(t,e)}a.length=g}function y(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}function wq(e,t,a){return fe(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Bn(e){if(e===null||De(e)||nn(e))return 1;if(Oi(e))return 2}function Ho(e,t,a){let n=[],r=-1;for(;++r<e.length;){let o=e[r].resolveAll;o&&!n.includes(o)&&(t=o(t,a),n.push(o))}return t}var yd={name:"attention",resolveAll:_q,tokenize:Iq};function _q(e,t){let a=-1,n,r,o,i,l,s,u,c;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(n=a;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[n][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;let d={...e[n][1].end},f={...e[a][1].start};OD(d,-s),OD(f,s),i={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},l={type:s>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:f},o={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[a][1].start}},r={type:s>1?"strong":"emphasis",start:{...i.start},end:{...l.end}},e[n][1].end={...i.start},e[a][1].start={...l.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Ia(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Ia(u,[["enter",r,t],["enter",i,t],["exit",i,t],["enter",o,t]]),u=Ia(u,Ho(t.parser.constructs.insideSpan.null,e.slice(n+1,a),t)),u=Ia(u,[["exit",o,t],["enter",l,t],["exit",l,t],["exit",r,t]]),e[a][1].end.offset-e[a][1].start.offset?(c=2,u=Ia(u,[["enter",e[a][1],t],["exit",e[a][1],t]])):c=0,zt(e,n-1,a-n+3,u),a=n+u.length-c-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function Iq(e,t){let a=this.parser.constructs.attentionMarkers.null,n=this.previous,r=Bn(n),o;return i;function i(s){return o=s,e.enter("attentionSequence"),l(s)}function l(s){if(s===o)return e.consume(s),l;let u=e.exit("attentionSequence"),c=Bn(s),d=!c||c===2&&r||a.includes(s),f=!r||r===2&&c||a.includes(n);return u._open=!!(o===42?d:d&&(r||!f)),u._close=!!(o===42?f:f&&(c||!d)),t(s)}}function OD(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var AI={name:"autolink",tokenize:kq};function kq(e,t,a){let n=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return Vt(p)?(e.consume(p),i):p===64?a(p):u(p)}function i(p){return p===43||p===45||p===46||At(p)?(n=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),n=0,s):(p===43||p===45||p===46||At(p))&&n++<32?(e.consume(p),l):(n=0,u(p))}function s(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Ri(p)?a(p):(e.consume(p),s)}function u(p){return p===64?(e.consume(p),c):ED(p)?(e.consume(p),u):a(p)}function c(p){return At(p)?d(p):a(p)}function d(p){return p===46?(e.consume(p),n=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||At(p))&&n++<63){let h=p===45?f:d;return e.consume(p),h}return a(p)}}var on={partial:!0,tokenize:Cq};function Cq(e,t,a){return n;function n(o){return me(o)?fe(e,r,"linePrefix")(o):r(o)}function r(o){return o===null||ne(o)?t(o):a(o)}}var yh={continuation:{tokenize:Lq},exit:Aq,name:"blockQuote",tokenize:Tq};function Tq(e,t,a){let n=this;return r;function r(i){if(i===62){let l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),o}return a(i)}function o(i){return me(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function Lq(e,t,a){let n=this;return r;function r(i){return me(i)?fe(e,o,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):o(i)}function o(i){return e.attempt(yh,t,a)(i)}}function Aq(e){e.exit("blockQuote")}var xh={name:"characterEscape",tokenize:Eq};function Eq(e,t,a){return n;function n(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),r}function r(o){return $D(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):a(o)}}var bh={name:"characterReference",tokenize:Mq};function Mq(e,t,a){let n=this,r=0,o,i;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),s}function s(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,i=At,c(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,i=MD,c):(e.enter("characterReferenceValue"),o=7,i=vd,c(d))}function c(d){if(d===59&&r){let f=e.exit("characterReferenceValue");return i===At&&!Zs(n.sliceSerialize(f))?a(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(d)&&r++<o?(e.consume(d),c):a(d)}}var PD={partial:!0,tokenize:Dq},Sh={concrete:!0,name:"codeFenced",tokenize:$q};function $q(e,t,a){let n=this,r={partial:!0,tokenize:L},o=0,i=0,l;return s;function s(x){return u(x)}function u(x){let _=n.events[n.events.length-1];return o=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,l=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(x)}function c(x){return x===l?(i++,e.consume(x),c):i<3?a(x):(e.exit("codeFencedFenceSequence"),me(x)?fe(e,d,"whitespace")(x):d(x))}function d(x){return x===null||ne(x)?(e.exit("codeFencedFence"),n.interrupt?t(x):e.check(PD,w,b)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(x))}function f(x){return x===null||ne(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(x)):me(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),fe(e,p,"whitespace")(x)):x===96&&x===l?a(x):(e.consume(x),f)}function p(x){return x===null||ne(x)?d(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===null||ne(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(x)):x===96&&x===l?a(x):(e.consume(x),h)}function w(x){return e.attempt(r,b,C)(x)}function C(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),m}function m(x){return o>0&&me(x)?fe(e,y,"linePrefix",o+1)(x):y(x)}function y(x){return x===null||ne(x)?e.check(PD,w,b)(x):(e.enter("codeFlowValue"),g(x))}function g(x){return x===null||ne(x)?(e.exit("codeFlowValue"),y(x)):(e.consume(x),g)}function b(x){return e.exit("codeFenced"),t(x)}function L(x,_,S){let T=0;return I;function I(te){return x.enter("lineEnding"),x.consume(te),x.exit("lineEnding"),B}function B(te){return x.enter("codeFencedFence"),me(te)?fe(x,R,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):R(te)}function R(te){return te===l?(x.enter("codeFencedFenceSequence"),O(te)):S(te)}function O(te){return te===l?(T++,x.consume(te),O):T>=i?(x.exit("codeFencedFenceSequence"),me(te)?fe(x,P,"whitespace")(te):P(te)):S(te)}function P(te){return te===null||ne(te)?(x.exit("codeFencedFence"),_(te)):S(te)}}}function Dq(e,t,a){let n=this;return r;function r(i){return i===null?a(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o)}function o(i){return n.parser.lazy[n.now().line]?a(i):t(i)}}var xd={name:"codeIndented",tokenize:Rq},zq={partial:!0,tokenize:Oq};function Rq(e,t,a){let n=this;return r;function r(u){return e.enter("codeIndented"),fe(e,o,"linePrefix",5)(u)}function o(u){let c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?i(u):a(u)}function i(u){return u===null?s(u):ne(u)?e.attempt(zq,i,s)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ne(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),l)}function s(u){return e.exit("codeIndented"),t(u)}}function Oq(e,t,a){let n=this;return r;function r(i){return n.parser.lazy[n.now().line]?a(i):ne(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r):fe(e,o,"linePrefix",5)(i)}function o(i){let l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):ne(i)?r(i):a(i)}}var EI={name:"codeText",previous:Nq,resolve:Pq,tokenize:Uq};function Pq(e){let t=e.length-4,a=3,n,r;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=a;++n<t;)if(e[n][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[t][1].type="codeTextPadding",a+=2,t-=2;break}}for(n=a-1,t++;++n<=t;)r===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(r=n):(n===t||e[n][1].type==="lineEnding")&&(e[r][1].type="codeTextData",n!==r+2&&(e[r][1].end=e[n-1][1].end,e.splice(r+2,n-r-2),t-=n-r-2,n=r+2),r=void 0);return e}function Nq(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Uq(e,t,a){let n=this,r=0,o,i;return l;function l(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),r++,s):(e.exit("codeTextSequence"),u(f))}function u(f){return f===null?a(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),u):f===96?(i=e.enter("codeTextSequence"),o=0,d(f)):ne(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||ne(f)?(e.exit("codeTextData"),u(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",c(f))}}var wh=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,a){let n=a??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,a,n){let r=a||0;this.setCursor(Math.trunc(t));let o=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&bd(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),bd(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),bd(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let a=this.left.splice(t,Number.POSITIVE_INFINITY);bd(this.right,a.reverse())}else{let a=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);bd(this.left,a.reverse())}}};function bd(e,t){let a=0;if(t.length<1e4)e.push(...t);else for(;a<t.length;)e.push(...t.slice(a,a+1e4)),a+=1e4}function _h(e){let t={},a=-1,n,r,o,i,l,s,u,c=new wh(e);for(;++a<c.length;){for(;a in t;)a=t[a];if(n=c.get(a),a&&n[1].type==="chunkFlow"&&c.get(a-1)[1].type==="listItemPrefix"&&(s=n[1]._tokenizer.events,o=0,o<s.length&&s[o][1].type==="lineEndingBlank"&&(o+=2),o<s.length&&s[o][1].type==="content"))for(;++o<s.length&&s[o][1].type!=="content";)s[o][1].type==="chunkText"&&(s[o][1]._isInFirstContentOfListItem=!0,o++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,Fq(c,a)),a=t[a],u=!0);else if(n[1]._container){for(o=a,r=void 0;o--;)if(i=c.get(o),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(r&&(c.get(r)[1].type="lineEndingBlank"),i[1].type="lineEnding",r=o);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;r&&(n[1].end={...c.get(r)[1].start},l=c.slice(r,a),l.unshift(n),c.splice(r,a-r+1,l))}}return zt(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function Fq(e,t){let a=e.get(t)[1],n=e.get(t)[2],r=t-1,o=[],i=a._tokenizer;i||(i=n.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));let l=i.events,s=[],u={},c,d,f=-1,p=a,h=0,w=0,C=[w];for(;p;){for(;e.get(++r)[1]!==p;);o.push(r),p._tokenizer||(c=n.sliceStream(p),p.next||c.push(null),d&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(c),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=a;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(w=f+1,C.push(w),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),f=C.length;f--;){let m=l.slice(C[f],C[f+1]),y=o.pop();s.push([y,y+m.length-1]),e.splice(y,2,m)}for(s.reverse(),f=-1;++f<s.length;)u[h+s[f][0]]=h+s[f][1],h+=s[f][1]-s[f][0]-1;return u}var MI={resolve:Bq,tokenize:qq},jq={partial:!0,tokenize:Zq};function Bq(e){return _h(e),e}function qq(e,t){let a;return n;function n(l){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),r(l)}function r(l){return l===null?o(l):ne(l)?e.check(jq,i,o)(l):(e.consume(l),r)}function o(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function i(l){return e.consume(l),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,r}}function Zq(e,t,a){let n=this;return r;function r(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),fe(e,o,"linePrefix")}function o(i){if(i===null||ne(i))return a(i);let l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):e.interrupt(n.parser.constructs.flow,a,t)(i)}}function Ih(e,t,a,n,r,o,i,l,s){let u=s||Number.POSITIVE_INFINITY,c=0;return d;function d(m){return m===60?(e.enter(n),e.enter(r),e.enter(o),e.consume(m),e.exit(o),f):m===null||m===32||m===41||Ri(m)?a(m):(e.enter(n),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(m))}function f(m){return m===62?(e.enter(o),e.consume(m),e.exit(o),e.exit(r),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(m))}function p(m){return m===62?(e.exit("chunkString"),e.exit(l),f(m)):m===null||m===60||ne(m)?a(m):(e.consume(m),m===92?h:p)}function h(m){return m===60||m===62||m===92?(e.consume(m),p):p(m)}function w(m){return!c&&(m===null||m===41||De(m))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(n),t(m)):c<u&&m===40?(e.consume(m),c++,w):m===41?(e.consume(m),c--,w):m===null||m===32||m===40||Ri(m)?a(m):(e.consume(m),m===92?C:w)}function C(m){return m===40||m===41||m===92?(e.consume(m),w):w(m)}}function kh(e,t,a,n,r,o){let i=this,l=0,s;return u;function u(p){return e.enter(n),e.enter(r),e.consume(p),e.exit(r),e.enter(o),c}function c(p){return l>999||p===null||p===91||p===93&&!s||p===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?a(p):p===93?(e.exit(o),e.enter(r),e.consume(p),e.exit(r),e.exit(n),t):ne(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||ne(p)||l++>999?(e.exit("chunkString"),c(p)):(e.consume(p),s||(s=!me(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),l++,d):d(p)}}function Ch(e,t,a,n,r,o){let i;return l;function l(f){return f===34||f===39||f===40?(e.enter(n),e.enter(r),e.consume(f),e.exit(r),i=f===40?41:f,s):a(f)}function s(f){return f===i?(e.enter(r),e.consume(f),e.exit(r),e.exit(n),t):(e.enter(o),u(f))}function u(f){return f===i?(e.exit(o),s(i)):f===null?a(f):ne(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),fe(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===i||f===null||ne(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?d:c)}function d(f){return f===i||f===92?(e.consume(f),c):c(f)}}function Pi(e,t){let a;return n;function n(r){return ne(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),a=!0,n):me(r)?fe(e,n,a?"linePrefix":"lineSuffix")(r):t(r)}}var $I={name:"definition",tokenize:Vq},Hq={partial:!0,tokenize:Gq};function Vq(e,t,a){let n=this,r;return o;function o(p){return e.enter("definition"),i(p)}function i(p){return kh.call(n,e,l,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return r=ma(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s):a(p)}function s(p){return De(p)?Pi(e,u)(p):u(p)}function u(p){return Ih(e,c,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Hq,d,d)(p)}function d(p){return me(p)?fe(e,f,"whitespace")(p):f(p)}function f(p){return p===null||ne(p)?(e.exit("definition"),n.parser.defined.push(r),t(p)):a(p)}}function Gq(e,t,a){return n;function n(l){return De(l)?Pi(e,r)(l):a(l)}function r(l){return Ch(e,o,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return me(l)?fe(e,i,"whitespace")(l):i(l)}function i(l){return l===null||ne(l)?t(l):a(l)}}var DI={name:"hardBreakEscape",tokenize:Wq};function Wq(e,t,a){return n;function n(o){return e.enter("hardBreakEscape"),e.consume(o),r}function r(o){return ne(o)?(e.exit("hardBreakEscape"),t(o)):a(o)}}var zI={name:"headingAtx",resolve:Jq,tokenize:Xq};function Jq(e,t){let a=e.length-2,n=3,r,o;return e[n][1].type==="whitespace"&&(n+=2),a-2>n&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(n===a-1||a-4>n&&e[a-2][1].type==="whitespace")&&(a-=n+1===a?2:4),a>n&&(r={type:"atxHeadingText",start:e[n][1].start,end:e[a][1].end},o={type:"chunkText",start:e[n][1].start,end:e[a][1].end,contentType:"text"},zt(e,n,a-n+1,[["enter",r,t],["enter",o,t],["exit",o,t],["exit",r,t]])),e}function Xq(e,t,a){let n=0;return r;function r(c){return e.enter("atxHeading"),o(c)}function o(c){return e.enter("atxHeadingSequence"),i(c)}function i(c){return c===35&&n++<6?(e.consume(c),i):c===null||De(c)?(e.exit("atxHeadingSequence"),l(c)):a(c)}function l(c){return c===35?(e.enter("atxHeadingSequence"),s(c)):c===null||ne(c)?(e.exit("atxHeading"),t(c)):me(c)?fe(e,l,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function s(c){return c===35?(e.consume(c),s):(e.exit("atxHeadingSequence"),l(c))}function u(c){return c===null||c===35||De(c)?(e.exit("atxHeadingText"),l(c)):(e.consume(c),u)}}var ND=["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"],RI=["pre","script","style","textarea"];var OI={concrete:!0,name:"htmlFlow",resolveTo:Qq,tokenize:e9},Kq={partial:!0,tokenize:a9},Yq={partial:!0,tokenize:t9};function Qq(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function e9(e,t,a){let n=this,r,o,i,l,s;return u;function u(E){return c(E)}function c(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),d}function d(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),o=!0,w):E===63?(e.consume(E),r=3,n.interrupt?t:M):Vt(E)?(e.consume(E),i=String.fromCharCode(E),C):a(E)}function f(E){return E===45?(e.consume(E),r=2,p):E===91?(e.consume(E),r=5,l=0,h):Vt(E)?(e.consume(E),r=4,n.interrupt?t:M):a(E)}function p(E){return E===45?(e.consume(E),n.interrupt?t:M):a(E)}function h(E){let pe="CDATA[";return E===pe.charCodeAt(l++)?(e.consume(E),l===pe.length?n.interrupt?t:R:h):a(E)}function w(E){return Vt(E)?(e.consume(E),i=String.fromCharCode(E),C):a(E)}function C(E){if(E===null||E===47||E===62||De(E)){let pe=E===47,Fe=i.toLowerCase();return!pe&&!o&&RI.includes(Fe)?(r=1,n.interrupt?t(E):R(E)):ND.includes(i.toLowerCase())?(r=6,pe?(e.consume(E),m):n.interrupt?t(E):R(E)):(r=7,n.interrupt&&!n.parser.lazy[n.now().line]?a(E):o?y(E):g(E))}return E===45||At(E)?(e.consume(E),i+=String.fromCharCode(E),C):a(E)}function m(E){return E===62?(e.consume(E),n.interrupt?t:R):a(E)}function y(E){return me(E)?(e.consume(E),y):I(E)}function g(E){return E===47?(e.consume(E),I):E===58||E===95||Vt(E)?(e.consume(E),b):me(E)?(e.consume(E),g):I(E)}function b(E){return E===45||E===46||E===58||E===95||At(E)?(e.consume(E),b):L(E)}function L(E){return E===61?(e.consume(E),x):me(E)?(e.consume(E),L):g(E)}function x(E){return E===null||E===60||E===61||E===62||E===96?a(E):E===34||E===39?(e.consume(E),s=E,_):me(E)?(e.consume(E),x):S(E)}function _(E){return E===s?(e.consume(E),s=null,T):E===null||ne(E)?a(E):(e.consume(E),_)}function S(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||De(E)?L(E):(e.consume(E),S)}function T(E){return E===47||E===62||me(E)?g(E):a(E)}function I(E){return E===62?(e.consume(E),B):a(E)}function B(E){return E===null||ne(E)?R(E):me(E)?(e.consume(E),B):a(E)}function R(E){return E===45&&r===2?(e.consume(E),se):E===60&&r===1?(e.consume(E),Y):E===62&&r===4?(e.consume(E),Ae):E===63&&r===3?(e.consume(E),M):E===93&&r===5?(e.consume(E),ve):ne(E)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(Kq,yt,O)(E)):E===null||ne(E)?(e.exit("htmlFlowData"),O(E)):(e.consume(E),R)}function O(E){return e.check(Yq,P,yt)(E)}function P(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),te}function te(E){return E===null||ne(E)?O(E):(e.enter("htmlFlowData"),R(E))}function se(E){return E===45?(e.consume(E),M):R(E)}function Y(E){return E===47?(e.consume(E),i="",K):R(E)}function K(E){if(E===62){let pe=i.toLowerCase();return RI.includes(pe)?(e.consume(E),Ae):R(E)}return Vt(E)&&i.length<8?(e.consume(E),i+=String.fromCharCode(E),K):R(E)}function ve(E){return E===93?(e.consume(E),M):R(E)}function M(E){return E===62?(e.consume(E),Ae):E===45&&r===2?(e.consume(E),M):R(E)}function Ae(E){return E===null||ne(E)?(e.exit("htmlFlowData"),yt(E)):(e.consume(E),Ae)}function yt(E){return e.exit("htmlFlow"),t(E)}}function t9(e,t,a){let n=this;return r;function r(i){return ne(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):a(i)}function o(i){return n.parser.lazy[n.now().line]?a(i):t(i)}}function a9(e,t,a){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(on,t,a)}}var PI={name:"htmlText",tokenize:r9};function r9(e,t,a){let n=this,r,o,i;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),s}function s(M){return M===33?(e.consume(M),u):M===47?(e.consume(M),L):M===63?(e.consume(M),g):Vt(M)?(e.consume(M),S):a(M)}function u(M){return M===45?(e.consume(M),c):M===91?(e.consume(M),o=0,h):Vt(M)?(e.consume(M),y):a(M)}function c(M){return M===45?(e.consume(M),p):a(M)}function d(M){return M===null?a(M):M===45?(e.consume(M),f):ne(M)?(i=d,Y(M)):(e.consume(M),d)}function f(M){return M===45?(e.consume(M),p):d(M)}function p(M){return M===62?se(M):M===45?f(M):d(M)}function h(M){let Ae="CDATA[";return M===Ae.charCodeAt(o++)?(e.consume(M),o===Ae.length?w:h):a(M)}function w(M){return M===null?a(M):M===93?(e.consume(M),C):ne(M)?(i=w,Y(M)):(e.consume(M),w)}function C(M){return M===93?(e.consume(M),m):w(M)}function m(M){return M===62?se(M):M===93?(e.consume(M),m):w(M)}function y(M){return M===null||M===62?se(M):ne(M)?(i=y,Y(M)):(e.consume(M),y)}function g(M){return M===null?a(M):M===63?(e.consume(M),b):ne(M)?(i=g,Y(M)):(e.consume(M),g)}function b(M){return M===62?se(M):g(M)}function L(M){return Vt(M)?(e.consume(M),x):a(M)}function x(M){return M===45||At(M)?(e.consume(M),x):_(M)}function _(M){return ne(M)?(i=_,Y(M)):me(M)?(e.consume(M),_):se(M)}function S(M){return M===45||At(M)?(e.consume(M),S):M===47||M===62||De(M)?T(M):a(M)}function T(M){return M===47?(e.consume(M),se):M===58||M===95||Vt(M)?(e.consume(M),I):ne(M)?(i=T,Y(M)):me(M)?(e.consume(M),T):se(M)}function I(M){return M===45||M===46||M===58||M===95||At(M)?(e.consume(M),I):B(M)}function B(M){return M===61?(e.consume(M),R):ne(M)?(i=B,Y(M)):me(M)?(e.consume(M),B):T(M)}function R(M){return M===null||M===60||M===61||M===62||M===96?a(M):M===34||M===39?(e.consume(M),r=M,O):ne(M)?(i=R,Y(M)):me(M)?(e.consume(M),R):(e.consume(M),P)}function O(M){return M===r?(e.consume(M),r=void 0,te):M===null?a(M):ne(M)?(i=O,Y(M)):(e.consume(M),O)}function P(M){return M===null||M===34||M===39||M===60||M===61||M===96?a(M):M===47||M===62||De(M)?T(M):(e.consume(M),P)}function te(M){return M===47||M===62||De(M)?T(M):a(M)}function se(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):a(M)}function Y(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),K}function K(M){return me(M)?fe(e,ve,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ve(M)}function ve(M){return e.enter("htmlTextData"),i(M)}}var Ni={name:"labelEnd",resolveAll:l9,resolveTo:s9,tokenize:u9},n9={tokenize:c9},o9={tokenize:d9},i9={tokenize:f9};function l9(e){let t=-1,a=[];for(;++t<e.length;){let n=e[t][1];if(a.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){let r=n.type==="labelImage"?4:2;n.type="data",t+=r}}return e.length!==a.length&&zt(e,0,e.length,a),e}function s9(e,t){let a=e.length,n=0,r,o,i,l;for(;a--;)if(r=e[a][1],o){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[a][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(i){if(e[a][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(o=a,r.type!=="labelLink")){n=2;break}}else r.type==="labelEnd"&&(i=a);let s={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[i][1].end}},c={type:"labelText",start:{...e[o+n+2][1].end},end:{...e[i-2][1].start}};return l=[["enter",s,t],["enter",u,t]],l=Ia(l,e.slice(o+1,o+n+3)),l=Ia(l,[["enter",c,t]]),l=Ia(l,Ho(t.parser.constructs.insideSpan.null,e.slice(o+n+4,i-3),t)),l=Ia(l,[["exit",c,t],e[i-2],e[i-1],["exit",u,t]]),l=Ia(l,e.slice(i+1)),l=Ia(l,[["exit",s,t]]),zt(e,o,e.length,l),e}function u9(e,t,a){let n=this,r=n.events.length,o,i;for(;r--;)if((n.events[r][1].type==="labelImage"||n.events[r][1].type==="labelLink")&&!n.events[r][1]._balanced){o=n.events[r][1];break}return l;function l(f){return o?o._inactive?d(f):(i=n.parser.defined.includes(ma(n.sliceSerialize({start:o.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),s):a(f)}function s(f){return f===40?e.attempt(n9,c,i?c:d)(f):f===91?e.attempt(o9,c,i?u:d)(f):i?c(f):d(f)}function u(f){return e.attempt(i9,c,d)(f)}function c(f){return t(f)}function d(f){return o._balanced=!0,a(f)}}function c9(e,t,a){return n;function n(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return De(d)?Pi(e,o)(d):o(d)}function o(d){return d===41?c(d):Ih(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function i(d){return De(d)?Pi(e,s)(d):c(d)}function l(d){return a(d)}function s(d){return d===34||d===39||d===40?Ch(e,u,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return De(d)?Pi(e,c)(d):c(d)}function c(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):a(d)}}function d9(e,t,a){let n=this;return r;function r(l){return kh.call(n,e,o,i,"reference","referenceMarker","referenceString")(l)}function o(l){return n.parser.defined.includes(ma(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):a(l)}function i(l){return a(l)}}function f9(e,t,a){return n;function n(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),r}function r(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):a(o)}}var NI={name:"labelStartImage",resolveAll:Ni.resolveAll,tokenize:p9};function p9(e,t,a){let n=this;return r;function r(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),o}function o(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),i):a(l)}function i(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?a(l):t(l)}}var UI={name:"labelStartLink",resolveAll:Ni.resolveAll,tokenize:m9};function m9(e,t,a){let n=this;return r;function r(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),o}function o(i){return i===94&&"_hiddenFootnoteSupport"in n.parser.constructs?a(i):t(i)}}var Sd={name:"lineEnding",tokenize:h9};function h9(e,t){return a;function a(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),fe(e,t,"linePrefix")}}var Ui={name:"thematicBreak",tokenize:g9};function g9(e,t,a){let n=0,r;return o;function o(u){return e.enter("thematicBreak"),i(u)}function i(u){return r=u,l(u)}function l(u){return u===r?(e.enter("thematicBreakSequence"),s(u)):n>=3&&(u===null||ne(u))?(e.exit("thematicBreak"),t(u)):a(u)}function s(u){return u===r?(e.consume(u),n++,s):(e.exit("thematicBreakSequence"),me(u)?fe(e,l,"whitespace")(u):l(u))}}var ha={continuation:{tokenize:b9},exit:w9,name:"list",tokenize:x9},v9={partial:!0,tokenize:_9},y9={partial:!0,tokenize:S9};function x9(e,t,a){let n=this,r=n.events[n.events.length-1],o=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,i=0;return l;function l(p){let h=n.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!n.containerState.marker||p===n.containerState.marker:vd(p)){if(n.containerState.type||(n.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ui,a,u)(p):u(p);if(!n.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(p)}return a(p)}function s(p){return vd(p)&&++i<10?(e.consume(p),s):(!n.interrupt||i<2)&&(n.containerState.marker?p===n.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):a(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||p,e.check(on,n.interrupt?a:c,e.attempt(v9,f,d))}function c(p){return n.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return me(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):a(p)}function f(p){return n.containerState.size=o+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function b9(e,t,a){let n=this;return n.containerState._closeFlow=void 0,e.check(on,r,o);function r(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,fe(e,t,"listItemIndent",n.containerState.size+1)(l)}function o(l){return n.containerState.furtherBlankLines||!me(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,i(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(y9,t,i)(l))}function i(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,fe(e,e.attempt(ha,t,a),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function S9(e,t,a){let n=this;return fe(e,r,"listItemIndent",n.containerState.size+1);function r(o){let i=n.events[n.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===n.containerState.size?t(o):a(o)}}function w9(e){e.exit(this.containerState.type)}function _9(e,t,a){let n=this;return fe(e,r,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(o){let i=n.events[n.events.length-1];return!me(o)&&i&&i[1].type==="listItemPrefixWhitespace"?t(o):a(o)}}var Th={name:"setextUnderline",resolveTo:I9,tokenize:k9};function I9(e,t){let a=e.length,n,r,o;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){n=a;break}e[a][1].type==="paragraph"&&(r=a)}else e[a][1].type==="content"&&e.splice(a,1),!o&&e[a][1].type==="definition"&&(o=a);let i={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",o?(e.splice(r,0,["enter",i,t]),e.splice(o+1,0,["exit",e[n][1],t]),e[n][1].end={...e[o][1].end}):e[n][1]=i,e.push(["exit",i,t]),e}function k9(e,t,a){let n=this,r;return o;function o(u){let c=n.events.length,d;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){d=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||d)?(e.enter("setextHeadingLine"),r=u,i(u)):a(u)}function i(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===r?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),me(u)?fe(e,s,"lineSuffix")(u):s(u))}function s(u){return u===null||ne(u)?(e.exit("setextHeadingLine"),t(u)):a(u)}}var UD={tokenize:C9};function C9(e){let t=this,a=e.attempt(on,n,e.attempt(this.parser.constructs.flowInitial,r,fe(e,e.attempt(this.parser.constructs.flow,r,e.attempt(MI,r)),"linePrefix")));return a;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,a}}var FD={resolveAll:ZD()},jD=qD("string"),BD=qD("text");function qD(e){return{resolveAll:ZD(e==="text"?T9:void 0),tokenize:t};function t(a){let n=this,r=this.parser.constructs[e],o=a.attempt(r,i,l);return i;function i(c){return u(c)?o(c):l(c)}function l(c){if(c===null){a.consume(c);return}return a.enter("data"),a.consume(c),s}function s(c){return u(c)?(a.exit("data"),o(c)):(a.consume(c),s)}function u(c){if(c===null)return!0;let d=r[c],f=-1;if(d)for(;++f<d.length;){let p=d[f];if(!p.previous||p.previous.call(n,n.previous))return!0}return!1}}}function ZD(e){return t;function t(a,n){let r=-1,o;for(;++r<=a.length;)o===void 0?a[r]&&a[r][1].type==="data"&&(o=r,r++):(!a[r]||a[r][1].type!=="data")&&(r!==o+2&&(a[o][1].end=a[r-1][1].end,a.splice(o+2,r-o-2),r=o+2),o=void 0);return e?e(a,n):a}}function T9(e,t){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){let n=e[a-1][1],r=t.sliceStream(n),o=r.length,i=-1,l=0,s;for(;o--;){let u=r[o];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(u===-2)s=!0,l++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(l=0),l){let u={type:a===e.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?i:n.start._bufferIndex+i,_index:n.start._index+o,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(e.splice(a,0,["enter",u,t],["exit",u,t]),a+=2)}a++}return e}var FI={};Cr(FI,{attentionMarkers:()=>R9,contentInitial:()=>A9,disable:()=>O9,document:()=>L9,flow:()=>M9,flowInitial:()=>E9,insideSpan:()=>z9,string:()=>$9,text:()=>D9});var L9={42:ha,43:ha,45:ha,48:ha,49:ha,50:ha,51:ha,52:ha,53:ha,54:ha,55:ha,56:ha,57:ha,62:yh},A9={91:$I},E9={[-2]:xd,[-1]:xd,32:xd},M9={35:zI,42:Ui,45:[Th,Ui],60:OI,61:Th,95:Ui,96:Sh,126:Sh},$9={38:bh,92:xh},D9={[-5]:Sd,[-4]:Sd,[-3]:Sd,33:NI,38:bh,42:yd,60:[AI,PI],91:UI,92:[DI,xh],93:Ni,95:yd,96:EI},z9={null:[yd,FD]},R9={null:[42,95]},O9={null:[]};function HD(e,t,a){let n={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0},r={},o=[],i=[],l=[],s=!0,u={attempt:T(_),check:T(S),consume:b,enter:L,exit:x,interrupt:T(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:C,parser:e,previous:null,sliceSerialize:h,sliceStream:w,write:p},d=t.tokenize.call(c,u),f;return t.resolveAll&&o.push(t),c;function p(O){return i=Ia(i,O),y(),i[i.length-1]!==null?[]:(I(t,0),c.events=Ho(o,c.events,c),c.events)}function h(O,P){return N9(w(O),P)}function w(O){return P9(i,O)}function C(){let{_bufferIndex:O,_index:P,line:te,column:se,offset:Y}=n;return{_bufferIndex:O,_index:P,line:te,column:se,offset:Y}}function m(O){r[O.line]=O.column,R()}function y(){let O;for(;n._index<i.length;){let P=i[n._index];if(typeof P=="string")for(O=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===O&&n._bufferIndex<P.length;)g(P.charCodeAt(n._bufferIndex));else g(P)}}function g(O){s=void 0,f=O,d=d(O)}function b(O){ne(O)?(n.line++,n.column=1,n.offset+=O===-3?2:1,R()):O!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===i[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=O,s=!0}function L(O,P){let te=P||{};return te.type=O,te.start=C(),c.events.push(["enter",te,c]),l.push(te),te}function x(O){let P=l.pop();return P.end=C(),c.events.push(["exit",P,c]),P}function _(O,P){I(O,P.from)}function S(O,P){P.restore()}function T(O,P){return te;function te(se,Y,K){let ve,M,Ae,yt;return Array.isArray(se)?pe(se):"tokenize"in se?pe([se]):E(se);function E(A){return $;function $(N){let j=N!==null&&A[N],ee=N!==null&&A.null,Ie=[...Array.isArray(j)?j:j?[j]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return pe(Ie)(N)}}function pe(A){return ve=A,M=0,A.length===0?K:Fe(A[M])}function Fe(A){return $;function $(N){return yt=B(),Ae=A,A.partial||(c.currentConstruct=A),A.name&&c.parser.constructs.disable.null.includes(A.name)?k(N):A.tokenize.call(P?Object.assign(Object.create(c),P):c,u,X,k)(N)}}function X(A){return s=!0,O(Ae,yt),Y}function k(A){return s=!0,yt.restore(),++M<ve.length?Fe(ve[M]):K}}}function I(O,P){O.resolveAll&&!o.includes(O)&&o.push(O),O.resolve&&zt(c.events,P,c.events.length-P,O.resolve(c.events.slice(P),c)),O.resolveTo&&(c.events=O.resolveTo(c.events,c))}function B(){let O=C(),P=c.previous,te=c.currentConstruct,se=c.events.length,Y=Array.from(l);return{from:se,restore:K};function K(){n=O,c.previous=P,c.currentConstruct=te,c.events.length=se,l=Y,R()}}function R(){n.line in r&&n.column<2&&(n.column=r[n.line],n.offset+=r[n.line]-1)}}function P9(e,t){let a=t.start._index,n=t.start._bufferIndex,r=t.end._index,o=t.end._bufferIndex,i;if(a===r)i=[e[a].slice(n,o)];else{if(i=e.slice(a,r),n>-1){let l=i[0];typeof l=="string"?i[0]=l.slice(n):i.shift()}o>0&&i.push(e[r].slice(0,o))}return i}function N9(e,t){let a=-1,n=[],r;for(;++a<e.length;){let o=e[a],i;if(typeof o=="string")i=o;else switch(o){case-5:{i="\r";break}case-4:{i=`
74
74
  `;break}case-3:{i=`\r