@useago/sdk 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { r as d } from "./createFormCollector-Cujr7hW4.js";
1
+ import { r as d } from "./createFormCollector-DON4vdJV.js";
2
2
  var f = "ago_widget_id", g = "ago_last_thread", y = 7200 * 1e3;
3
3
  function v() {
4
4
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
@@ -1 +1 @@
1
- const d=require("./createFormCollector-BMTdfhHg.cjs");var f="ago_widget_id",g="ago_last_thread",y=7200*1e3;function v(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.floor(Math.random()*16);return(e==="x"?r:r&3|8).toString(16)})}function _(e={}){const r=e.key??f,i=e.threadKey??g,u=e.ttlMs??y,l=e.storage??(typeof localStorage<"u"?localStorage:void 0);let n=e.widgetId??"";if(!n&&l)try{n=l.getItem(r)??""}catch{}if(n||(n=v()),l)try{l.setItem(r,n)}catch{}const o=d.createStore({value:null,lastMessageAt:null},{key:i,storage:l}),c=o.get();c.value!==null&&s(c.lastMessageAt)&&o.set({value:null,lastMessageAt:null});function s(t){return t===null?!0:Number.isFinite(u)?Date.now()-t>u:!1}return{widgetId:n,key:r,getLastActiveThread(){const{value:t,lastMessageAt:a}=o.get();return t===null||s(a)?null:t},setActiveThread(t,a){const x=a==null?null:a instanceof Date?a.getTime():a;o.set({value:t,lastMessageAt:x})},clear(){o.set({value:null,lastMessageAt:null})}}}Object.defineProperty(exports,"createConversationSession",{enumerable:!0,get:function(){return _}});
1
+ const d=require("./createFormCollector-IO6bfPQx.cjs");var f="ago_widget_id",g="ago_last_thread",y=7200*1e3;function v(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.floor(Math.random()*16);return(e==="x"?r:r&3|8).toString(16)})}function _(e={}){const r=e.key??f,i=e.threadKey??g,u=e.ttlMs??y,l=e.storage??(typeof localStorage<"u"?localStorage:void 0);let n=e.widgetId??"";if(!n&&l)try{n=l.getItem(r)??""}catch{}if(n||(n=v()),l)try{l.setItem(r,n)}catch{}const o=d.createStore({value:null,lastMessageAt:null},{key:i,storage:l}),c=o.get();c.value!==null&&s(c.lastMessageAt)&&o.set({value:null,lastMessageAt:null});function s(t){return t===null?!0:Number.isFinite(u)?Date.now()-t>u:!1}return{widgetId:n,key:r,getLastActiveThread(){const{value:t,lastMessageAt:a}=o.get();return t===null||s(a)?null:t},setActiveThread(t,a){const x=a==null?null:a instanceof Date?a.getTime():a;o.set({value:t,lastMessageAt:x})},clear(){o.set({value:null,lastMessageAt:null})}}}Object.defineProperty(exports,"createConversationSession",{enumerable:!0,get:function(){return _}});
@@ -0,0 +1,244 @@
1
+ import { s as _ } from "./AgoClient-rvTz2thR.js";
2
+ function E(n, e) {
3
+ const l = e ? e.storage ?? (typeof localStorage < "u" ? localStorage : void 0) : void 0;
4
+ let t = n;
5
+ if (e && l) try {
6
+ const c = l.getItem(e.key);
7
+ c != null && (t = JSON.parse(c));
8
+ } catch {
9
+ }
10
+ const i = /* @__PURE__ */ new Set(), f = () => i.forEach((c) => c(t));
11
+ function m() {
12
+ if (e && l) try {
13
+ l.setItem(e.key, JSON.stringify(t));
14
+ } catch {
15
+ }
16
+ }
17
+ return {
18
+ get: () => t,
19
+ set: (c) => {
20
+ t = c, m(), f();
21
+ },
22
+ subscribe: (c) => (i.add(c), () => {
23
+ i.delete(c);
24
+ })
25
+ };
26
+ }
27
+ var q = /^[a-zA-Z0-9_-]{1,40}$/, O = (n) => n == null || n === "";
28
+ function F(n, e) {
29
+ const l = e[n.property];
30
+ if (O(l)) return !1;
31
+ if (Array.isArray(n.value)) return n.value.some((f) => String(l) === String(f));
32
+ if (!n.op) return String(l) === String(n.value);
33
+ const t = Number(l), i = Number(n.value);
34
+ if (Number.isNaN(t) || Number.isNaN(i)) return !1;
35
+ switch (n.op) {
36
+ case ">=":
37
+ return t >= i;
38
+ case "<=":
39
+ return t <= i;
40
+ case ">":
41
+ return t > i;
42
+ case "<":
43
+ return t < i;
44
+ default:
45
+ return _.warn(`Unknown requiredWhen op "${n.op}"; treating as not required.`), !1;
46
+ }
47
+ }
48
+ function y(n, e) {
49
+ const l = n.properties ?? {}, t = /* @__PURE__ */ new Set();
50
+ for (const f of n.required ?? []) {
51
+ const m = l[f]?.requiredWhen;
52
+ (!m || F(m, e)) && t.add(f);
53
+ }
54
+ for (const [f, m] of Object.entries(l)) m.requiredWhen && F(m.requiredWhen, e) && t.add(f);
55
+ const i = [...t].filter((f) => O(e[f]));
56
+ return {
57
+ missing: i,
58
+ complete: i.length === 0
59
+ };
60
+ }
61
+ function P(n) {
62
+ const e = {};
63
+ for (const [l, t] of Object.entries(n.properties ?? {})) e[l] = {
64
+ type: t.type,
65
+ ...t.description != null && { description: t.description },
66
+ ...t.enum && { enum: t.enum },
67
+ ...t.default !== void 0 && { default: t.default }
68
+ };
69
+ return {
70
+ type: "object",
71
+ properties: e,
72
+ required: []
73
+ };
74
+ }
75
+ function I(n) {
76
+ const { name: e, description: l, schema: t } = n;
77
+ if (!q.test(e)) throw new Error(`Invalid form collector name "${e}": must match ${q} (it becomes the update_/submit_ function names).`);
78
+ const i = typeof n.submit == "string" ? n.submit ? {
79
+ via: "client",
80
+ url: n.submit
81
+ } : !1 : n.submit ?? !1, f = t.properties ?? {}, m = (r) => {
82
+ const s = {};
83
+ for (const [a, o] of Object.entries(r)) {
84
+ const u = f[a];
85
+ if (u)
86
+ if (o == null) s[a] = o;
87
+ else if (u.type === "number" || u.type === "integer") {
88
+ const p = typeof o == "number" ? o : Number(o);
89
+ s[a] = Number.isNaN(p) ? o : p;
90
+ } else u.type === "boolean" ? s[a] = typeof o == "boolean" ? o : o === "true" ? !0 : o === "false" ? !1 : !!o : s[a] = o;
91
+ }
92
+ return s;
93
+ }, c = n.initialValues ?? {}, d = E({
94
+ values: c,
95
+ submitted: !1
96
+ }), v = (r) => {
97
+ const s = d.get(), a = {
98
+ ...s,
99
+ values: {
100
+ ...s.values,
101
+ ...r
102
+ }
103
+ };
104
+ return d.set(a), a;
105
+ };
106
+ let h = null;
107
+ const N = async () => {
108
+ const { values: r } = d.get(), { complete: s, missing: a } = y(t, r);
109
+ if (!s) return {
110
+ ok: !1,
111
+ missing: a
112
+ };
113
+ if (!i) return {
114
+ ok: !1,
115
+ error: "No submit target configured for this form collector."
116
+ };
117
+ const o = r;
118
+ try {
119
+ let u;
120
+ if (i.via === "client") if ("handler" in i) u = await i.handler(o);
121
+ else {
122
+ const p = await fetch(i.url, {
123
+ method: "POST",
124
+ headers: { "Content-Type": "application/json" },
125
+ credentials: "include",
126
+ body: JSON.stringify(o)
127
+ });
128
+ if (!p.ok) return {
129
+ ok: !1,
130
+ error: `Submit failed: HTTP ${p.status}`
131
+ };
132
+ u = await p.json().catch(() => {
133
+ });
134
+ }
135
+ else {
136
+ if (!h) return {
137
+ ok: !1,
138
+ error: "Backend submit requires install(client) (or useFormCollector) first."
139
+ };
140
+ u = await h.submitFormCollector(i.destination, o);
141
+ }
142
+ return d.set({
143
+ ...d.get(),
144
+ submitted: !0
145
+ }), {
146
+ ok: !0,
147
+ result: u
148
+ };
149
+ } catch (u) {
150
+ const p = u instanceof Error ? u.message : "Submit failed";
151
+ return _.error(`FormCollector "${e}" submit failed:`, u), {
152
+ ok: !1,
153
+ error: p
154
+ };
155
+ }
156
+ }, $ = {
157
+ name: `update_${e}`,
158
+ description: `Fill or update fields of the "${e}" form. ${l} Pass any subset of fields; call it repeatedly to fill the form as the user provides information. Returns the current values and which required fields are still missing.`,
159
+ parameters: P(t),
160
+ handler: (r) => {
161
+ const s = v(m(r)), { missing: a } = y(t, s.values);
162
+ return {
163
+ ok: !0,
164
+ values: s.values,
165
+ missing: a
166
+ };
167
+ }
168
+ }, b = [$];
169
+ i && b.push({
170
+ name: `submit_${e}`,
171
+ description: `Submit the completed "${e}" form. Only call this once every required field is collected and the user has confirmed. If fields are missing it returns them instead of submitting.`,
172
+ parameters: {
173
+ type: "object",
174
+ properties: {}
175
+ },
176
+ handler: () => N()
177
+ });
178
+ const T = "client__", S = i ? `submit_${e}` : null, x = (r) => {
179
+ const s = r.functionName ?? r.toolName;
180
+ if (s)
181
+ return s.startsWith(T) ? s.slice(8) : s;
182
+ }, w = (r) => {
183
+ let s = { ...c }, a = !1;
184
+ for (const o of r) {
185
+ const u = x(o);
186
+ u === $.name ? o.arguments && (s = {
187
+ ...s,
188
+ ...m(o.arguments)
189
+ }) : S && u === S && o.status?.toLowerCase() === "done" && (a = !0);
190
+ }
191
+ d.set({
192
+ values: s,
193
+ submitted: a
194
+ });
195
+ }, g = `form:${e}`, C = () => {
196
+ const { values: r, submitted: s } = d.get(), { missing: a, complete: o } = y(t, r), u = i ? ` When nothing is missing and the user confirms, call submit_${e}.` : "", p = s ? `The "${e}" form has been submitted.` : `You are currently collecting information from the user to fill the "${e}" form.`;
197
+ return {
198
+ name: `Form: ${e}`,
199
+ description: `${p} ${l} There are conditionnals questions/values to collected, you can find this information with the requiredWhen field in the form. The form schema is the following: ${JSON.stringify(t)}. Data collected so far: ${JSON.stringify(r)}. Call update_${e} with any fields the user provides; ask only for what is still missing.${u}`,
200
+ data: {
201
+ missing: a,
202
+ complete: o,
203
+ submitted: s
204
+ }
205
+ };
206
+ }, k = (r) => {
207
+ w((r.messages ?? []).flatMap((s) => s.toolCalls ?? []));
208
+ };
209
+ return {
210
+ name: e,
211
+ store: d,
212
+ functions: b,
213
+ contextKey: g,
214
+ contextProvider: C,
215
+ install: (r) => {
216
+ h = r;
217
+ for (const a of b) r.register(a);
218
+ r.addDynamicContext(g, C);
219
+ const s = d.subscribe(() => r.notifyContextChanged());
220
+ return r.on("conversation:loaded", k), () => {
221
+ s();
222
+ for (const a of b) r.unregisterFunction(a.name);
223
+ r.removeDynamicContext(g), r.off("conversation:loaded", k), h === r && (h = null);
224
+ };
225
+ },
226
+ hydrate: w,
227
+ submit: N,
228
+ getValues: () => d.get().values,
229
+ setValues: (r) => {
230
+ v(m(r));
231
+ },
232
+ reset: () => {
233
+ d.set({
234
+ values: c,
235
+ submitted: !1
236
+ });
237
+ }
238
+ };
239
+ }
240
+ export {
241
+ y as n,
242
+ E as r,
243
+ I as t
244
+ };
@@ -0,0 +1 @@
1
+ const O=require("./AgoClient-D4EL6nva.cjs");function _(o,e){const l=e?e.storage??(typeof localStorage<"u"?localStorage:void 0):void 0;let t=o;if(e&&l)try{const c=l.getItem(e.key);c!=null&&(t=JSON.parse(c))}catch{}const i=new Set,f=()=>i.forEach(c=>c(t));function m(){if(e&&l)try{l.setItem(e.key,JSON.stringify(t))}catch{}}return{get:()=>t,set:c=>{t=c,m(),f()},subscribe:c=>(i.add(c),()=>{i.delete(c)})}}var q=/^[a-zA-Z0-9_-]{1,40}$/,P=o=>o==null||o==="";function F(o,e){const l=e[o.property];if(P(l))return!1;if(Array.isArray(o.value))return o.value.some(f=>String(l)===String(f));if(!o.op)return String(l)===String(o.value);const t=Number(l),i=Number(o.value);if(Number.isNaN(t)||Number.isNaN(i))return!1;switch(o.op){case">=":return t>=i;case"<=":return t<=i;case">":return t>i;case"<":return t<i;default:return O.logger.warn(`Unknown requiredWhen op "${o.op}"; treating as not required.`),!1}}function g(o,e){const l=o.properties??{},t=new Set;for(const f of o.required??[]){const m=l[f]?.requiredWhen;(!m||F(m,e))&&t.add(f)}for(const[f,m]of Object.entries(l))m.requiredWhen&&F(m.requiredWhen,e)&&t.add(f);const i=[...t].filter(f=>P(e[f]));return{missing:i,complete:i.length===0}}function E(o){const e={};for(const[l,t]of Object.entries(o.properties??{}))e[l]={type:t.type,...t.description!=null&&{description:t.description},...t.enum&&{enum:t.enum},...t.default!==void 0&&{default:t.default}};return{type:"object",properties:e,required:[]}}function W(o){const{name:e,description:l,schema:t}=o;if(!q.test(e))throw new Error(`Invalid form collector name "${e}": must match ${q} (it becomes the update_/submit_ function names).`);const i=typeof o.submit=="string"?o.submit?{via:"client",url:o.submit}:!1:o.submit??!1,f=t.properties??{},m=r=>{const n={};for(const[a,s]of Object.entries(r)){const u=f[a];if(u)if(s==null)n[a]=s;else if(u.type==="number"||u.type==="integer"){const b=typeof s=="number"?s:Number(s);n[a]=Number.isNaN(b)?s:b}else u.type==="boolean"?n[a]=typeof s=="boolean"?s:s==="true"?!0:s==="false"?!1:!!s:n[a]=s}return n},c=o.initialValues??{},d=_({values:c,submitted:!1}),v=r=>{const n=d.get(),a={...n,values:{...n.values,...r}};return d.set(a),a};let p=null;const N=async()=>{const{values:r}=d.get(),{complete:n,missing:a}=g(t,r);if(!n)return{ok:!1,missing:a};if(!i)return{ok:!1,error:"No submit target configured for this form collector."};const s=r;try{let u;if(i.via==="client")if("handler"in i)u=await i.handler(s);else{const b=await fetch(i.url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(s)});if(!b.ok)return{ok:!1,error:`Submit failed: HTTP ${b.status}`};u=await b.json().catch(()=>{})}else{if(!p)return{ok:!1,error:"Backend submit requires install(client) (or useFormCollector) first."};u=await p.submitFormCollector(i.destination,s)}return d.set({...d.get(),submitted:!0}),{ok:!0,result:u}}catch(u){const b=u instanceof Error?u.message:"Submit failed";return O.logger.error(`FormCollector "${e}" submit failed:`,u),{ok:!1,error:b}}},S={name:`update_${e}`,description:`Fill or update fields of the "${e}" form. ${l} Pass any subset of fields; call it repeatedly to fill the form as the user provides information. Returns the current values and which required fields are still missing.`,parameters:E(t),handler:r=>{const n=v(m(r)),{missing:a}=g(t,n.values);return{ok:!0,values:n.values,missing:a}}},h=[S];i&&h.push({name:`submit_${e}`,description:`Submit the completed "${e}" form. Only call this once every required field is collected and the user has confirmed. If fields are missing it returns them instead of submitting.`,parameters:{type:"object",properties:{}},handler:()=>N()});const T="client__",$=i?`submit_${e}`:null,j=r=>{const n=r.functionName??r.toolName;if(n)return n.startsWith(T)?n.slice(8):n},w=r=>{let n={...c},a=!1;for(const s of r){const u=j(s);u===S.name?s.arguments&&(n={...n,...m(s.arguments)}):$&&u===$&&s.status?.toLowerCase()==="done"&&(a=!0)}d.set({values:n,submitted:a})},y=`form:${e}`,C=()=>{const{values:r,submitted:n}=d.get(),{missing:a,complete:s}=g(t,r),u=i?` When nothing is missing and the user confirms, call submit_${e}.`:"",b=n?`The "${e}" form has been submitted.`:`You are currently collecting information from the user to fill the "${e}" form.`;return{name:`Form: ${e}`,description:`${b} ${l} There are conditionnals questions/values to collected, you can find this information with the requiredWhen field in the form. The form schema is the following: ${JSON.stringify(t)}. Data collected so far: ${JSON.stringify(r)}. Call update_${e} with any fields the user provides; ask only for what is still missing.${u}`,data:{missing:a,complete:s,submitted:n}}},k=r=>{w((r.messages??[]).flatMap(n=>n.toolCalls??[]))};return{name:e,store:d,functions:h,contextKey:y,contextProvider:C,install:r=>{p=r;for(const a of h)r.register(a);r.addDynamicContext(y,C);const n=d.subscribe(()=>r.notifyContextChanged());return r.on("conversation:loaded",k),()=>{n();for(const a of h)r.unregisterFunction(a.name);r.removeDynamicContext(y),r.off("conversation:loaded",k),p===r&&(p=null)}},hydrate:w,submit:N,getValues:()=>d.get().values,setValues:r=>{v(m(r))},reset:()=>{d.set({values:c,submitted:!1})}}}Object.defineProperty(exports,"createFormCollector",{enumerable:!0,get:function(){return W}});Object.defineProperty(exports,"createStore",{enumerable:!0,get:function(){return _}});Object.defineProperty(exports,"deriveFormStatus",{enumerable:!0,get:function(){return g}});
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./AgoClient-D4EL6nva.cjs"),m=require("./createFormCollector-BMTdfhHg.cjs"),A=require("./createConversationSession-0F_OXdQB.cjs"),C=require("./createMockClient-zHQ0cjUH.cjs"),g=require("./functions-DsmzgHjC.cjs");function h(e){return e}function E(e,o){return e.on("message:complete",o),()=>e.off("message:complete",o)}function S(e,o){return e.on("message:chunk",o),()=>e.off("message:chunk",o)}function y(e,o){return e.on("message:start",o),()=>e.off("message:start",o)}function b(e,o){return e.on("message:error",o),()=>e.off("message:error",o)}function v(e,o){return e.on("toolCall:received",o),()=>e.off("toolCall:received",o)}function M(e,o){return e.on("function:invoke",o),()=>e.off("function:invoke",o)}async function*k(e,o,l){const n=[];let r=null,a=!1;const c=s=>{n.push(s),r?.()},f=s=>c({type:"start",data:s}),t=s=>c({type:"chunk",data:s}),u=s=>{c({type:"complete",data:s}),a=!0,r?.()},d=s=>{c({type:"error",data:s}),a=!0,r?.()},p=s=>c({type:"toolCall",data:s});e.on("message:start",f),e.on("message:chunk",t),e.on("message:complete",u),e.on("message:error",d),e.on("toolCall:received",p),e.sendMessage(o,l).catch(()=>{a=!0,r?.()});try{for(;!a||n.length>0;)n.length>0?yield n.shift():(await new Promise(s=>{r=s}),r=null)}finally{e.off("message:start",f),e.off("message:chunk",t),e.off("message:complete",u),e.off("message:error",d),e.off("toolCall:received",p)}}function w(e){let o,l,n,r,a,c;if(typeof window<"u"&&window.AGO){const t=window.AGO;o=t.basepath,l=t.widgetId,n=t.agent||t.defaultAgent,r=t.permission,a=t.email,c=t.jwt}if(typeof document<"u"){const t=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;o=o||t("ago-base-url"),l=l||t("ago-widget-id"),n=n||t("ago-agent")||t("ago-agent-id"),r=r||t("ago-permission"),a=a||t("ago-user-email")}if(typeof document<"u"){const t=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of t)u&&(o=o||u.getAttribute("data-ago-base-url")||void 0,l=l||u.getAttribute("data-ago-widget-id")||void 0,n=n||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,r=r||u.getAttribute("data-ago-permission")||void 0,a=a||u.getAttribute("data-ago-user-email")||void 0)}o=e?.baseUrl||o,l=e?.widgetId||l,n=e?.agent||e?.defaultAgentId||n,r=e?.permission||r,a=e?.userEmail||a,c=e?.userJwt||c;const f=e?.debug;return o?{baseUrl:o,widgetId:l,agent:n,permission:r,userEmail:a,userJwt:c,debug:f}:null}function F(e){const o=w(e);if(!o)throw new Error('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.');return new i.AgoClient(o)}function q(e,o){return{...e,handler:o}}exports.AgoApiError=i.AgoApiError;exports.AgoClient=i.AgoClient;exports.AgoError=i.AgoError;exports.AgoFunctionError=i.AgoFunctionError;exports.AgoNetworkError=i.AgoNetworkError;exports.AgoStreamError=i.AgoStreamError;exports.ClientContextRegistry=i.ClientContextRegistry;exports.EventEmitter=i.EventEmitter;exports.FunctionRegistry=i.FunctionRegistry;exports.SSEHandler=i.SSEHandler;exports.autoDetectConfig=w;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=F;exports.createConversationSession=A.createConversationSession;exports.createFormCollector=m.createFormCollector;exports.createMessageStream=k;exports.createMockClient=C.createMockClient;exports.createStore=m.createStore;exports.defineFunction=h;exports.deriveFormStatus=m.deriveFormStatus;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=i.isStreamNetworkError;exports.logger=i.logger;exports.onFunctionInvoke=M;exports.onMessage=E;exports.onMessageChunk=S;exports.onMessageError=b;exports.onMessageStart=y;exports.onToolCall=v;exports.openUrl=g.openUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.withHandler=q;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./AgoClient-D4EL6nva.cjs"),m=require("./createFormCollector-IO6bfPQx.cjs"),A=require("./createConversationSession-DGcM_Z3f.cjs"),C=require("./createMockClient-zHQ0cjUH.cjs"),g=require("./functions-DsmzgHjC.cjs");function h(e){return e}function E(e,o){return e.on("message:complete",o),()=>e.off("message:complete",o)}function S(e,o){return e.on("message:chunk",o),()=>e.off("message:chunk",o)}function y(e,o){return e.on("message:start",o),()=>e.off("message:start",o)}function b(e,o){return e.on("message:error",o),()=>e.off("message:error",o)}function v(e,o){return e.on("toolCall:received",o),()=>e.off("toolCall:received",o)}function M(e,o){return e.on("function:invoke",o),()=>e.off("function:invoke",o)}async function*k(e,o,l){const n=[];let r=null,a=!1;const c=s=>{n.push(s),r?.()},f=s=>c({type:"start",data:s}),t=s=>c({type:"chunk",data:s}),u=s=>{c({type:"complete",data:s}),a=!0,r?.()},d=s=>{c({type:"error",data:s}),a=!0,r?.()},p=s=>c({type:"toolCall",data:s});e.on("message:start",f),e.on("message:chunk",t),e.on("message:complete",u),e.on("message:error",d),e.on("toolCall:received",p),e.sendMessage(o,l).catch(()=>{a=!0,r?.()});try{for(;!a||n.length>0;)n.length>0?yield n.shift():(await new Promise(s=>{r=s}),r=null)}finally{e.off("message:start",f),e.off("message:chunk",t),e.off("message:complete",u),e.off("message:error",d),e.off("toolCall:received",p)}}function w(e){let o,l,n,r,a,c;if(typeof window<"u"&&window.AGO){const t=window.AGO;o=t.basepath,l=t.widgetId,n=t.agent||t.defaultAgent,r=t.permission,a=t.email,c=t.jwt}if(typeof document<"u"){const t=u=>document.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||void 0;o=o||t("ago-base-url"),l=l||t("ago-widget-id"),n=n||t("ago-agent")||t("ago-agent-id"),r=r||t("ago-permission"),a=a||t("ago-user-email")}if(typeof document<"u"){const t=[document.body,...Array.from(document.querySelectorAll("script[data-ago-base-url]"))].filter(Boolean);for(const u of t)u&&(o=o||u.getAttribute("data-ago-base-url")||void 0,l=l||u.getAttribute("data-ago-widget-id")||void 0,n=n||u.getAttribute("data-ago-agent")||u.getAttribute("data-ago-agent-id")||void 0,r=r||u.getAttribute("data-ago-permission")||void 0,a=a||u.getAttribute("data-ago-user-email")||void 0)}o=e?.baseUrl||o,l=e?.widgetId||l,n=e?.agent||e?.defaultAgentId||n,r=e?.permission||r,a=e?.userEmail||a,c=e?.userJwt||c;const f=e?.debug;return o?{baseUrl:o,widgetId:l,agent:n,permission:r,userEmail:a,userJwt:c,debug:f}:null}function F(e){const o=w(e);if(!o)throw new Error('createAgo(): could not detect AGO configuration. Set window.AGO, add <meta name="ago-base-url">, or pass { baseUrl } explicitly.');return new i.AgoClient(o)}function q(e,o){return{...e,handler:o}}exports.AgoApiError=i.AgoApiError;exports.AgoClient=i.AgoClient;exports.AgoError=i.AgoError;exports.AgoFunctionError=i.AgoFunctionError;exports.AgoNetworkError=i.AgoNetworkError;exports.AgoStreamError=i.AgoStreamError;exports.ClientContextRegistry=i.ClientContextRegistry;exports.EventEmitter=i.EventEmitter;exports.FunctionRegistry=i.FunctionRegistry;exports.SSEHandler=i.SSEHandler;exports.autoDetectConfig=w;exports.copyToClipboard=g.copyToClipboard;exports.createAgo=F;exports.createConversationSession=A.createConversationSession;exports.createFormCollector=m.createFormCollector;exports.createMessageStream=k;exports.createMockClient=C.createMockClient;exports.createStore=m.createStore;exports.defineFunction=h;exports.deriveFormStatus=m.deriveFormStatus;exports.getLocalStorage=g.getLocalStorage;exports.getUserLocation=g.getUserLocation;exports.highlightElement=g.highlightElement;exports.isStreamNetworkError=i.isStreamNetworkError;exports.logger=i.logger;exports.onFunctionInvoke=M;exports.onMessage=E;exports.onMessageChunk=S;exports.onMessageError=b;exports.onMessageStart=y;exports.onToolCall=v;exports.openUrl=g.openUrl;exports.scrollToElement=g.scrollToElement;exports.setLocalStorage=g.setLocalStorage;exports.setTheme=g.setTheme;exports.showConfirmDialog=g.showConfirmDialog;exports.showNotification=g.showNotification;exports.showToast=g.showToast;exports.submitForm=g.submitForm;exports.trackEvent=g.trackEvent;exports.withHandler=q;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as w, c as h, d as A, f as y, i as C, l as E, n as S, o as b, r as v, s as k, t as d, u as M } from "./AgoClient-rvTz2thR.js";
2
- import { n as T, r as I, t as U } from "./createFormCollector-Cujr7hW4.js";
3
- import { t as O } from "./createConversationSession-DbuVzvoX.js";
2
+ import { n as T, r as I, t as U } from "./createFormCollector-DON4vdJV.js";
3
+ import { t as O } from "./createConversationSession-D-eq8VIo.js";
4
4
  import { t as x } from "./createMockClient-DwdxNwEn.js";
5
5
  import { a as N, c as D, d as H, f as J, i as R, l as j, m as B, o as P, p as $, r as z, s as K, t as Q, u as V } from "./functions-C1-5vadY.js";
6
6
  function W(e) {
package/dist/react.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("./rolldown-runtime-CaekUdDJ.cjs"),li=require("./AgoClient-D4EL6nva.cjs"),Ve=require("./createFormCollector-BMTdfhHg.cjs"),oi=require("./createMockClient-zHQ0cjUH.cjs");let F=require("react");F=fe.__toESM(F,1);let T=require("react/jsx-runtime");function qn(e){const[n,t]=(0,F.useState)(!1),r=(0,F.useRef)(null),i=(0,F.useMemo)(()=>{r.current&&r.current.destroy();const l=new li.AgoClient(e);return r.current=l,l},[e.baseUrl,e.widgetId]);return(0,F.useEffect)(()=>(t(!0),()=>{r.current?.destroy(),r.current=null}),[i]),(0,F.useEffect)(()=>{r.current&&r.current.updateConfig({agent:e.agent,defaultAgentId:e.defaultAgentId,permission:e.permission,userEmail:e.userEmail,userJwt:e.userJwt,debug:e.debug})},[e.agent,e.defaultAgentId,e.permission,e.userEmail,e.userJwt,e.debug]),{client:i,isReady:n}}var Rt=(0,F.createContext)(null),ai=({children:e,client:n,tools:t,helpers:r,pageContext:i,...l})=>{const{client:o}=qn(n?{baseUrl:""}:l),a=n||o;return(0,F.useEffect)(()=>{if(!(!t||t.length===0)){for(const u of t)a.register(u);return()=>{for(const u of t)a.unregisterFunction(u.name)}}},[a,t]),(0,F.useEffect)(()=>{if(!r)return;const u=[];return Promise.resolve().then(()=>require("./functions-DsmzgHjC.cjs")).then(c=>c.functions_exports).then(c=>{for(const[f,s]of Object.entries(r)){const h=c[f];if(!h){console.warn(`[AGO] Unknown helper: "${f}"`);continue}const p=s===!0?h:{...h,handler:s};a.register(p),u.push(p.name)}}),()=>{for(const c of u)a.unregisterFunction(c)}},[a,r]),(0,F.useEffect)(()=>{i==="auto"&&a.enableAutoPageContext()},[a,i]),(0,T.jsx)(Rt.Provider,{value:a,children:e})};function Ye(){const e=(0,F.useContext)(Rt);if(!e)throw new Error('useAgoClient must be used within an <AgoProvider>. Wrap your component tree with <AgoProvider baseUrl="...">.');return e}function Qe(){return(0,F.useContext)(Rt)}function Ot({client:e,conversationId:n}={}){const t=Qe(),r=e||t;if(!r)throw new Error("useMessages requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");const[i,l]=(0,F.useState)([]),[o,a]=(0,F.useState)(n),[u,c]=(0,F.useState)(!1),[f,s]=(0,F.useState)(null);(0,F.useEffect)(()=>{n&&n!==o&&(a(n),h(n))},[n]);const h=async p=>{try{l(await r.getMessages(p))}catch(x){s(x instanceof Error?x:new Error("Failed to load messages"))}};return(0,F.useEffect)(()=>{const p=d=>{o||a(d.conversationId)},x=d=>{l(v=>{const C=v[v.length-1];return C&&C.id===d.messageId?[...v.slice(0,-1),{...C,content:C.content+d.content}]:v})},k=d=>{l(v=>{const C=v.findIndex(A=>A.id===d.id);return C>=0?[...v.slice(0,C),d,...v.slice(C+1)]:[...v,d]}),c(!1)},S=d=>{s(new Error(d.error)),c(!1)};return r.on("message:start",p),r.on("message:chunk",x),r.on("message:complete",k),r.on("message:error",S),()=>{r.off("message:start",p),r.off("message:chunk",x),r.off("message:complete",k),r.off("message:error",S)}},[r,o]),{messages:i,isLoading:u,error:f,sendMessage:(0,F.useCallback)(async(p,x)=>{c(!0),s(null);const k={id:`temp-${Date.now()}`,conversationId:o||"",content:p,role:"user",status:"DONE",createdAt:new Date},S={id:`temp-assistant-${Date.now()}`,conversationId:o||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};l(d=>[...d,k,S]);try{const d=await r.sendMessage(p,{conversationId:o,files:x});return d.conversationId&&!o&&a(d.conversationId),l(v=>{const C=v.filter(z=>!z.id.startsWith("temp-")),A={...k,id:k.id.replace("temp-","user-"),conversationId:d.conversationId};return C.some(z=>z.id===d.id)?[...C,A].sort((z,w)=>new Date(z.createdAt).getTime()-new Date(w.createdAt).getTime()):[...C,A,d]}),d}catch(d){return s(d instanceof Error?d:new Error("Failed to send message")),c(!1),l(v=>v.filter(C=>!C.id.startsWith("temp-"))),null}},[r,o]),clearMessages:(0,F.useCallback)(()=>{l([]),a(void 0),s(null)},[]),conversationId:o}}var Un=({onSend:e,disabled:n=!1,placeholder:t="Type a message...",allowFiles:r=!1,className:i=""})=>{const[l,o]=(0,F.useState)(""),[a,u]=(0,F.useState)([]),c=(0,F.useRef)(null),f=(0,F.useCallback)(k=>{k.preventDefault(),(l.trim()||a.length>0)&&(e(l.trim(),a.length>0?a:void 0),o(""),u([]))},[l,a,e]),s=(0,F.useCallback)(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),f(k))},[f]),h=(0,F.useCallback)(k=>{const S=Array.from(k.target.files||[]);u(d=>[...d,...S])},[]),p=(0,F.useCallback)(k=>{u(S=>S.filter((d,v)=>v!==k))},[]),x=l.trim()||a.length>0;return(0,T.jsxs)("form",{onSubmit:f,className:`ago-chat-input ${i}`,style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px 16px",borderTop:"1px solid #dee3e8",backgroundColor:"#fff"},children:[a.length>0&&(0,T.jsx)("div",{className:"ago-chat-input__files",style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:a.map((k,S)=>(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",backgroundColor:"#f0f2f5",borderRadius:"6px",fontSize:"12px",color:"#30373e"},children:[(0,T.jsx)("span",{style:{maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.name}),(0,T.jsx)("button",{type:"button",onClick:()=>p(S),style:{border:"none",background:"none",cursor:"pointer",padding:"0",color:"#6b6d6f",fontSize:"14px",lineHeight:1},children:"×"})]},S))}),(0,T.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[r&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("button",{type:"button",onClick:()=>c.current?.click(),disabled:n,style:{padding:"8px",border:"1px solid #dee3e8",borderRadius:"8px",backgroundColor:"#fff",cursor:n?"not-allowed":"pointer",color:"#6b6d6f",fontSize:"16px",lineHeight:1},children:"+"}),(0,T.jsx)("input",{ref:c,type:"file",multiple:!0,onChange:h,style:{display:"none"}})]}),(0,T.jsx)("textarea",{value:l,onChange:k=>o(k.target.value),onKeyDown:s,placeholder:t,disabled:n,rows:1,style:{flex:1,padding:"10px 14px",border:"1px solid #dee3e8",borderRadius:"20px",resize:"none",outline:"none",fontFamily:"inherit",fontSize:"14px",color:"#30373e",backgroundColor:"#f8f8f8",transition:"border-color 0.15s"},onFocus:k=>{k.currentTarget.style.borderColor="#1b5fc4"},onBlur:k=>{k.currentTarget.style.borderColor="#dee3e8"}}),(0,T.jsx)("button",{type:"submit",disabled:n||!x,style:{padding:"10px 18px",border:"none",borderRadius:"20px",backgroundColor:n||!x?"#b5bfc8":"#03182f",color:"#fff",cursor:n||!x?"not-allowed":"pointer",fontWeight:500,fontSize:"14px",transition:"background-color 0.15s"},children:"Send"})]})]})};function ui(e,n){const t=n||{};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var si=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ci=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fi={};function rn(e,n){return((n||fi).jsx?ci:si).test(e)}var pi=/[ \t\n\f\r]/g;function hi(e){return typeof e=="object"?e.type==="text"?ln(e.value):!1:ln(e)}function ln(e){return e.replace(pi,"")===""}var Je=class{constructor(e,n,t){this.normal=n,this.property=e,t&&(this.space=t)}};Je.prototype.normal={};Je.prototype.property={};Je.prototype.space=void 0;function $n(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Je(t,r,n)}function It(e){return e.toLowerCase()}var re=class{constructor(e,n){this.attribute=n,this.property=e}};re.prototype.attribute="";re.prototype.booleanish=!1;re.prototype.boolean=!1;re.prototype.commaOrSpaceSeparated=!1;re.prototype.commaSeparated=!1;re.prototype.defined=!1;re.prototype.mustUseProperty=!1;re.prototype.number=!1;re.prototype.overloadedBoolean=!1;re.prototype.property="";re.prototype.spaceSeparated=!1;re.prototype.space=void 0;var At=fe.__exportAll({boolean:()=>N,booleanish:()=>K,commaOrSpaceSeparated:()=>le,commaSeparated:()=>Me,number:()=>E,overloadedBoolean:()=>Tt,spaceSeparated:()=>W}),mi=0,N=Ie(),K=Ie(),Tt=Ie(),E=Ie(),W=Ie(),Me=Ie(),le=Ie();function Ie(){return 2**++mi}var ft=Object.keys(At),Nt=class extends re{constructor(e,n,t,r){let i=-1;if(super(e,n),on(this,"space",r),typeof t=="number")for(;++i<ft.length;){const l=ft[i];on(this,ft[i],(t&At[l])===At[l])}}};Nt.prototype.defined=!0;function on(e,n,t){t&&(e[n]=t)}function Re(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const l=new Nt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[It(r)]=r,t[It(l.attribute)]=r}return new Je(n,t,e.space)}var Vn=Re({properties:{ariaActiveDescendant:null,ariaAtomic:K,ariaAutoComplete:null,ariaBusy:K,ariaChecked:K,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:W,ariaCurrent:null,ariaDescribedBy:W,ariaDetails:null,ariaDisabled:K,ariaDropEffect:W,ariaErrorMessage:null,ariaExpanded:K,ariaFlowTo:W,ariaGrabbed:K,ariaHasPopup:null,ariaHidden:K,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W,ariaLevel:E,ariaLive:null,ariaModal:K,ariaMultiLine:K,ariaMultiSelectable:K,ariaOrientation:null,ariaOwns:W,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:K,ariaReadOnly:K,ariaRelevant:null,ariaRequired:K,ariaRoleDescription:W,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:K,ariaSetSize:E,ariaSort:null,ariaValueMax:E,ariaValueMin:E,ariaValueNow:E,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Wn(e,n){return n in e?e[n]:n}function Xn(e,n){return Wn(e,n.toLowerCase())}var gi=Re({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Me,acceptCharset:W,accessKey:W,action:null,allow:null,allowFullScreen:N,allowPaymentRequest:N,allowUserMedia:N,alt:null,as:null,async:N,autoCapitalize:null,autoComplete:W,autoFocus:N,autoPlay:N,blocking:W,capture:null,charSet:null,checked:N,cite:null,className:W,cols:E,colSpan:null,content:null,contentEditable:K,controls:N,controlsList:W,coords:E|Me,crossOrigin:null,data:null,dateTime:null,decoding:null,default:N,defer:N,dir:null,dirName:null,disabled:N,download:Tt,draggable:K,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:N,formTarget:null,headers:W,height:E,hidden:Tt,high:E,href:null,hrefLang:null,htmlFor:W,httpEquiv:W,id:null,imageSizes:null,imageSrcSet:null,inert:N,inputMode:null,integrity:null,is:null,isMap:N,itemId:null,itemProp:W,itemRef:W,itemScope:N,itemType:W,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:N,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:N,muted:N,name:null,nonce:null,noModule:N,noValidate:N,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:N,optimum:E,pattern:null,ping:W,placeholder:null,playsInline:N,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:N,referrerPolicy:null,rel:W,required:N,reversed:N,rows:E,rowSpan:E,sandbox:W,scope:null,scoped:N,seamless:N,selected:N,shadowRootClonable:N,shadowRootDelegatesFocus:N,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:K,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E,step:null,style:null,tabIndex:E,target:null,title:null,translate:null,type:null,typeMustMatch:N,useMap:null,value:K,width:E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W,axis:null,background:null,bgColor:null,border:E,borderColor:null,bottomMargin:E,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:N,declare:N,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:N,noHref:N,noShade:N,noWrap:N,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:K,standby:null,summary:null,text:null,topMargin:E,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:N,disableRemotePlayback:N,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:Xn}),di=Re({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:le,accentHeight:E,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E,amplitude:E,arabicForm:null,ascent:E,attributeName:null,attributeType:null,azimuth:E,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E,by:null,calcMode:null,capHeight:E,className:W,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:E,diffuseConstant:E,direction:null,display:null,dur:null,divisor:E,dominantBaseline:null,download:N,dx:null,dy:null,edgeMode:null,editable:null,elevation:E,enableBackground:null,end:null,event:null,exponent:E,externalResourcesRequired:null,fill:null,fillOpacity:E,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:Me,g2:Me,glyphName:Me,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E,horizOriginX:E,horizOriginY:E,id:null,ideographic:E,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E,k:E,k1:E,k2:E,k3:E,k4:E,kernelMatrix:le,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E,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:E,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:E,overlineThickness:E,paintOrder:null,panose1:null,path:null,pathLength:E,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E,pointsAtY:E,pointsAtZ:E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:le,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:le,rev:le,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:le,requiredFeatures:le,requiredFonts:le,requiredFormats:le,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:E,specularExponent:E,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E,strikethroughThickness:E,string:null,stroke:null,strokeDashArray:le,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E,strokeOpacity:E,strokeWidth:null,style:null,surfaceScale:E,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:le,tabIndex:E,tableValues:null,target:null,targetX:E,targetY:E,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:le,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E,underlineThickness:E,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E,values:null,vAlphabetic:E,vMathematical:E,vectorEffect:null,vHanging:E,vIdeographic:E,version:null,vertAdvY:E,vertOriginX:E,vertOriginY:E,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Wn}),Yn=Re({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),Qn=Re({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xn}),Jn=Re({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),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"},yi=/[A-Z]/g,an=/-[a-z]/g,ki=/^data[-\w.:]+$/i;function bi(e,n){const t=It(n);let r=n,i=re;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&ki.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(an,vi);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!an.test(l)){let o=l.replace(yi,wi);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=Nt}return new i(r,n)}function wi(e){return"-"+e.toLowerCase()}function vi(e){return e.charAt(1).toUpperCase()}var Ci=$n([Vn,gi,Yn,Qn,Jn],"html"),Bt=$n([Vn,di,Yn,Qn,Jn],"svg");function Si(e){return e.join(" ").trim()}var Ei=fe.__commonJSMin(((e,n)=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const fe=require("./rolldown-runtime-CaekUdDJ.cjs"),li=require("./AgoClient-D4EL6nva.cjs"),Ve=require("./createFormCollector-IO6bfPQx.cjs"),oi=require("./createMockClient-zHQ0cjUH.cjs");let F=require("react");F=fe.__toESM(F,1);let T=require("react/jsx-runtime");function qn(e){const[n,t]=(0,F.useState)(!1),r=(0,F.useRef)(null),i=(0,F.useMemo)(()=>{r.current&&r.current.destroy();const l=new li.AgoClient(e);return r.current=l,l},[e.baseUrl,e.widgetId]);return(0,F.useEffect)(()=>(t(!0),()=>{r.current?.destroy(),r.current=null}),[i]),(0,F.useEffect)(()=>{r.current&&r.current.updateConfig({agent:e.agent,defaultAgentId:e.defaultAgentId,permission:e.permission,userEmail:e.userEmail,userJwt:e.userJwt,debug:e.debug})},[e.agent,e.defaultAgentId,e.permission,e.userEmail,e.userJwt,e.debug]),{client:i,isReady:n}}var Rt=(0,F.createContext)(null),ai=({children:e,client:n,tools:t,helpers:r,pageContext:i,...l})=>{const{client:o}=qn(n?{baseUrl:""}:l),a=n||o;return(0,F.useEffect)(()=>{if(!(!t||t.length===0)){for(const u of t)a.register(u);return()=>{for(const u of t)a.unregisterFunction(u.name)}}},[a,t]),(0,F.useEffect)(()=>{if(!r)return;const u=[];return Promise.resolve().then(()=>require("./functions-DsmzgHjC.cjs")).then(c=>c.functions_exports).then(c=>{for(const[f,s]of Object.entries(r)){const h=c[f];if(!h){console.warn(`[AGO] Unknown helper: "${f}"`);continue}const p=s===!0?h:{...h,handler:s};a.register(p),u.push(p.name)}}),()=>{for(const c of u)a.unregisterFunction(c)}},[a,r]),(0,F.useEffect)(()=>{i==="auto"&&a.enableAutoPageContext()},[a,i]),(0,T.jsx)(Rt.Provider,{value:a,children:e})};function Ye(){const e=(0,F.useContext)(Rt);if(!e)throw new Error('useAgoClient must be used within an <AgoProvider>. Wrap your component tree with <AgoProvider baseUrl="...">.');return e}function Qe(){return(0,F.useContext)(Rt)}function Ot({client:e,conversationId:n}={}){const t=Qe(),r=e||t;if(!r)throw new Error("useMessages requires an AgoClient. Either pass it as options.client or wrap your app in <AgoProvider>.");const[i,l]=(0,F.useState)([]),[o,a]=(0,F.useState)(n),[u,c]=(0,F.useState)(!1),[f,s]=(0,F.useState)(null);(0,F.useEffect)(()=>{n&&n!==o&&(a(n),h(n))},[n]);const h=async p=>{try{l(await r.getMessages(p))}catch(x){s(x instanceof Error?x:new Error("Failed to load messages"))}};return(0,F.useEffect)(()=>{const p=d=>{o||a(d.conversationId)},x=d=>{l(v=>{const C=v[v.length-1];return C&&C.id===d.messageId?[...v.slice(0,-1),{...C,content:C.content+d.content}]:v})},k=d=>{l(v=>{const C=v.findIndex(A=>A.id===d.id);return C>=0?[...v.slice(0,C),d,...v.slice(C+1)]:[...v,d]}),c(!1)},S=d=>{s(new Error(d.error)),c(!1)};return r.on("message:start",p),r.on("message:chunk",x),r.on("message:complete",k),r.on("message:error",S),()=>{r.off("message:start",p),r.off("message:chunk",x),r.off("message:complete",k),r.off("message:error",S)}},[r,o]),{messages:i,isLoading:u,error:f,sendMessage:(0,F.useCallback)(async(p,x)=>{c(!0),s(null);const k={id:`temp-${Date.now()}`,conversationId:o||"",content:p,role:"user",status:"DONE",createdAt:new Date},S={id:`temp-assistant-${Date.now()}`,conversationId:o||"",content:"",role:"assistant",status:"IN_PROGRESS",createdAt:new Date};l(d=>[...d,k,S]);try{const d=await r.sendMessage(p,{conversationId:o,files:x});return d.conversationId&&!o&&a(d.conversationId),l(v=>{const C=v.filter(z=>!z.id.startsWith("temp-")),A={...k,id:k.id.replace("temp-","user-"),conversationId:d.conversationId};return C.some(z=>z.id===d.id)?[...C,A].sort((z,w)=>new Date(z.createdAt).getTime()-new Date(w.createdAt).getTime()):[...C,A,d]}),d}catch(d){return s(d instanceof Error?d:new Error("Failed to send message")),c(!1),l(v=>v.filter(C=>!C.id.startsWith("temp-"))),null}},[r,o]),clearMessages:(0,F.useCallback)(()=>{l([]),a(void 0),s(null)},[]),conversationId:o}}var Un=({onSend:e,disabled:n=!1,placeholder:t="Type a message...",allowFiles:r=!1,className:i=""})=>{const[l,o]=(0,F.useState)(""),[a,u]=(0,F.useState)([]),c=(0,F.useRef)(null),f=(0,F.useCallback)(k=>{k.preventDefault(),(l.trim()||a.length>0)&&(e(l.trim(),a.length>0?a:void 0),o(""),u([]))},[l,a,e]),s=(0,F.useCallback)(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),f(k))},[f]),h=(0,F.useCallback)(k=>{const S=Array.from(k.target.files||[]);u(d=>[...d,...S])},[]),p=(0,F.useCallback)(k=>{u(S=>S.filter((d,v)=>v!==k))},[]),x=l.trim()||a.length>0;return(0,T.jsxs)("form",{onSubmit:f,className:`ago-chat-input ${i}`,style:{display:"flex",flexDirection:"column",gap:"8px",padding:"12px 16px",borderTop:"1px solid #dee3e8",backgroundColor:"#fff"},children:[a.length>0&&(0,T.jsx)("div",{className:"ago-chat-input__files",style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:a.map((k,S)=>(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",backgroundColor:"#f0f2f5",borderRadius:"6px",fontSize:"12px",color:"#30373e"},children:[(0,T.jsx)("span",{style:{maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.name}),(0,T.jsx)("button",{type:"button",onClick:()=>p(S),style:{border:"none",background:"none",cursor:"pointer",padding:"0",color:"#6b6d6f",fontSize:"14px",lineHeight:1},children:"×"})]},S))}),(0,T.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[r&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("button",{type:"button",onClick:()=>c.current?.click(),disabled:n,style:{padding:"8px",border:"1px solid #dee3e8",borderRadius:"8px",backgroundColor:"#fff",cursor:n?"not-allowed":"pointer",color:"#6b6d6f",fontSize:"16px",lineHeight:1},children:"+"}),(0,T.jsx)("input",{ref:c,type:"file",multiple:!0,onChange:h,style:{display:"none"}})]}),(0,T.jsx)("textarea",{value:l,onChange:k=>o(k.target.value),onKeyDown:s,placeholder:t,disabled:n,rows:1,style:{flex:1,padding:"10px 14px",border:"1px solid #dee3e8",borderRadius:"20px",resize:"none",outline:"none",fontFamily:"inherit",fontSize:"14px",color:"#30373e",backgroundColor:"#f8f8f8",transition:"border-color 0.15s"},onFocus:k=>{k.currentTarget.style.borderColor="#1b5fc4"},onBlur:k=>{k.currentTarget.style.borderColor="#dee3e8"}}),(0,T.jsx)("button",{type:"submit",disabled:n||!x,style:{padding:"10px 18px",border:"none",borderRadius:"20px",backgroundColor:n||!x?"#b5bfc8":"#03182f",color:"#fff",cursor:n||!x?"not-allowed":"pointer",fontWeight:500,fontSize:"14px",transition:"background-color 0.15s"},children:"Send"})]})]})};function ui(e,n){const t=n||{};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var si=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ci=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fi={};function rn(e,n){return((n||fi).jsx?ci:si).test(e)}var pi=/[ \t\n\f\r]/g;function hi(e){return typeof e=="object"?e.type==="text"?ln(e.value):!1:ln(e)}function ln(e){return e.replace(pi,"")===""}var Je=class{constructor(e,n,t){this.normal=n,this.property=e,t&&(this.space=t)}};Je.prototype.normal={};Je.prototype.property={};Je.prototype.space=void 0;function $n(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Je(t,r,n)}function It(e){return e.toLowerCase()}var re=class{constructor(e,n){this.attribute=n,this.property=e}};re.prototype.attribute="";re.prototype.booleanish=!1;re.prototype.boolean=!1;re.prototype.commaOrSpaceSeparated=!1;re.prototype.commaSeparated=!1;re.prototype.defined=!1;re.prototype.mustUseProperty=!1;re.prototype.number=!1;re.prototype.overloadedBoolean=!1;re.prototype.property="";re.prototype.spaceSeparated=!1;re.prototype.space=void 0;var At=fe.__exportAll({boolean:()=>N,booleanish:()=>K,commaOrSpaceSeparated:()=>le,commaSeparated:()=>Me,number:()=>E,overloadedBoolean:()=>Tt,spaceSeparated:()=>W}),mi=0,N=Ie(),K=Ie(),Tt=Ie(),E=Ie(),W=Ie(),Me=Ie(),le=Ie();function Ie(){return 2**++mi}var ft=Object.keys(At),Nt=class extends re{constructor(e,n,t,r){let i=-1;if(super(e,n),on(this,"space",r),typeof t=="number")for(;++i<ft.length;){const l=ft[i];on(this,ft[i],(t&At[l])===At[l])}}};Nt.prototype.defined=!0;function on(e,n,t){t&&(e[n]=t)}function Re(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const l=new Nt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[It(r)]=r,t[It(l.attribute)]=r}return new Je(n,t,e.space)}var Vn=Re({properties:{ariaActiveDescendant:null,ariaAtomic:K,ariaAutoComplete:null,ariaBusy:K,ariaChecked:K,ariaColCount:E,ariaColIndex:E,ariaColSpan:E,ariaControls:W,ariaCurrent:null,ariaDescribedBy:W,ariaDetails:null,ariaDisabled:K,ariaDropEffect:W,ariaErrorMessage:null,ariaExpanded:K,ariaFlowTo:W,ariaGrabbed:K,ariaHasPopup:null,ariaHidden:K,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W,ariaLevel:E,ariaLive:null,ariaModal:K,ariaMultiLine:K,ariaMultiSelectable:K,ariaOrientation:null,ariaOwns:W,ariaPlaceholder:null,ariaPosInSet:E,ariaPressed:K,ariaReadOnly:K,ariaRelevant:null,ariaRequired:K,ariaRoleDescription:W,ariaRowCount:E,ariaRowIndex:E,ariaRowSpan:E,ariaSelected:K,ariaSetSize:E,ariaSort:null,ariaValueMax:E,ariaValueMin:E,ariaValueNow:E,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Wn(e,n){return n in e?e[n]:n}function Xn(e,n){return Wn(e,n.toLowerCase())}var gi=Re({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Me,acceptCharset:W,accessKey:W,action:null,allow:null,allowFullScreen:N,allowPaymentRequest:N,allowUserMedia:N,alt:null,as:null,async:N,autoCapitalize:null,autoComplete:W,autoFocus:N,autoPlay:N,blocking:W,capture:null,charSet:null,checked:N,cite:null,className:W,cols:E,colSpan:null,content:null,contentEditable:K,controls:N,controlsList:W,coords:E|Me,crossOrigin:null,data:null,dateTime:null,decoding:null,default:N,defer:N,dir:null,dirName:null,disabled:N,download:Tt,draggable:K,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:N,formTarget:null,headers:W,height:E,hidden:Tt,high:E,href:null,hrefLang:null,htmlFor:W,httpEquiv:W,id:null,imageSizes:null,imageSrcSet:null,inert:N,inputMode:null,integrity:null,is:null,isMap:N,itemId:null,itemProp:W,itemRef:W,itemScope:N,itemType:W,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:N,low:E,manifest:null,max:null,maxLength:E,media:null,method:null,min:null,minLength:E,multiple:N,muted:N,name:null,nonce:null,noModule:N,noValidate:N,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:N,optimum:E,pattern:null,ping:W,placeholder:null,playsInline:N,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:N,referrerPolicy:null,rel:W,required:N,reversed:N,rows:E,rowSpan:E,sandbox:W,scope:null,scoped:N,seamless:N,selected:N,shadowRootClonable:N,shadowRootDelegatesFocus:N,shadowRootMode:null,shape:null,size:E,sizes:null,slot:null,span:E,spellCheck:K,src:null,srcDoc:null,srcLang:null,srcSet:null,start:E,step:null,style:null,tabIndex:E,target:null,title:null,translate:null,type:null,typeMustMatch:N,useMap:null,value:K,width:E,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W,axis:null,background:null,bgColor:null,border:E,borderColor:null,bottomMargin:E,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:N,declare:N,event:null,face:null,frame:null,frameBorder:null,hSpace:E,leftMargin:E,link:null,longDesc:null,lowSrc:null,marginHeight:E,marginWidth:E,noResize:N,noHref:N,noShade:N,noWrap:N,object:null,profile:null,prompt:null,rev:null,rightMargin:E,rules:null,scheme:null,scrolling:K,standby:null,summary:null,text:null,topMargin:E,valueType:null,version:null,vAlign:null,vLink:null,vSpace:E,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:N,disableRemotePlayback:N,prefix:null,property:null,results:E,security:null,unselectable:null},space:"html",transform:Xn}),di=Re({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:le,accentHeight:E,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:E,amplitude:E,arabicForm:null,ascent:E,attributeName:null,attributeType:null,azimuth:E,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:E,by:null,calcMode:null,capHeight:E,className:W,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:E,diffuseConstant:E,direction:null,display:null,dur:null,divisor:E,dominantBaseline:null,download:N,dx:null,dy:null,edgeMode:null,editable:null,elevation:E,enableBackground:null,end:null,event:null,exponent:E,externalResourcesRequired:null,fill:null,fillOpacity:E,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:Me,g2:Me,glyphName:Me,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:E,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:E,horizOriginX:E,horizOriginY:E,id:null,ideographic:E,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:E,k:E,k1:E,k2:E,k3:E,k4:E,kernelMatrix:le,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:E,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:E,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:E,overlineThickness:E,paintOrder:null,panose1:null,path:null,pathLength:E,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:E,pointsAtY:E,pointsAtZ:E,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:le,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:le,rev:le,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:le,requiredFeatures:le,requiredFonts:le,requiredFormats:le,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:E,specularExponent:E,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:E,strikethroughThickness:E,string:null,stroke:null,strokeDashArray:le,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:E,strokeOpacity:E,strokeWidth:null,style:null,surfaceScale:E,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:le,tabIndex:E,tableValues:null,target:null,targetX:E,targetY:E,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:le,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:E,underlineThickness:E,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:E,values:null,vAlphabetic:E,vMathematical:E,vectorEffect:null,vHanging:E,vIdeographic:E,version:null,vertAdvY:E,vertOriginX:E,vertOriginY:E,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:E,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Wn}),Yn=Re({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),Qn=Re({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xn}),Jn=Re({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),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"},yi=/[A-Z]/g,an=/-[a-z]/g,ki=/^data[-\w.:]+$/i;function bi(e,n){const t=It(n);let r=n,i=re;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&ki.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(an,vi);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!an.test(l)){let o=l.replace(yi,wi);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=Nt}return new i(r,n)}function wi(e){return"-"+e.toLowerCase()}function vi(e){return e.charAt(1).toUpperCase()}var Ci=$n([Vn,gi,Yn,Qn,Jn],"html"),Bt=$n([Vn,di,Yn,Qn,Jn],"svg");function Si(e){return e.join(" ").trim()}var Ei=fe.__commonJSMin(((e,n)=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,f=`
2
2
  `,s="/",h="*",p="",x="comment",k="declaration";function S(v,C){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];C=C||{};var A=1,z=1;function w(R){var D=R.match(r);D&&(A+=D.length);var J=R.lastIndexOf(f);z=~J?R.length-J:z+R.length}function B(){var R={line:A,column:z};return function(D){return D.position=new _(R),P(),D}}function _(R){this.start=R,this.end={line:A,column:z},this.source=C.source}_.prototype.content=v;function j(R){var D=new Error(C.source+":"+A+":"+z+": "+R);if(D.reason=R,D.filename=C.source,D.line=A,D.column=z,D.source=v,!C.silent)throw D}function y(R){var D=R.exec(v);if(D){var J=D[0];return w(J),v=v.slice(J.length),D}}function P(){y(i)}function L(R){var D;for(R=R||[];D=$();)D!==!1&&R.push(D);return R}function $(){var R=B();if(!(s!=v.charAt(0)||h!=v.charAt(1))){for(var D=2;p!=v.charAt(D)&&(h!=v.charAt(D)||s!=v.charAt(D+1));)++D;if(D+=2,p===v.charAt(D-1))return j("End of comment missing");var J=v.slice(2,D-2);return z+=2,w(J),v=v.slice(D),z+=2,R({type:x,comment:J})}}function X(){var R=B(),D=y(l);if(D){if($(),!y(o))return j("property missing ':'");var J=y(a),ue=R({type:k,property:d(D[0].replace(t,p)),value:J?d(J[0].replace(t,p)):p});return y(u),ue}}function q(){var R=[];L(R);for(var D;D=X();)D!==!1&&(R.push(D),L(R));return R}return P(),q()}function d(v){return v?v.replace(c,p):p}n.exports=S})),Ii=fe.__commonJSMin((e=>{var n=e&&e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var t=n(Ei());function r(i,l){let o=null;if(!i||typeof i!="string")return o;const a=(0,t.default)(i),u=typeof l=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:f,value:s}=c;u?l(f,s,c):s&&(o=o||{},o[f]=s)}),o}})),Ai=fe.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,o=function(f){return!f||r.test(f)||n.test(f)},a=function(f,s){return s.toUpperCase()},u=function(f,s){return"".concat(s,"-")},c=function(f,s){return s===void 0&&(s={}),o(f)?f:(f=f.toLowerCase(),s.reactCompat?f=f.replace(l,u):f=f.replace(i,u),f.replace(t,a))};e.camelCase=c})),Ti=fe.__commonJSMin(((e,n)=>{var t=(e&&e.__importDefault||function(l){return l&&l.__esModule?l:{default:l}})(Ii()),r=Ai();function i(l,o){var a={};return!l||typeof l!="string"||(0,t.default)(l,function(u,c){u&&c&&(a[(0,r.camelCase)(u,o)]=c)}),a}i.default=i,n.exports=i})),Kn=Gn("end"),jt=Gn("start");function Gn(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Pi(e){const n=jt(e),t=Kn(e);if(n&&t)return{start:n,end:t}}function Ue(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?un(e.position):"start"in e||"end"in e?un(e):"line"in e||"column"in e?Pt(e):""}function Pt(e){return sn(e&&e.line)+":"+sn(e&&e.column)}function un(e){return Pt(e&&e.start)+"-"+Pt(e&&e.end)}function sn(e){return e&&typeof e=="number"?e:1}var ee=class extends Error{constructor(e,n,t){super(),typeof n=="string"&&(t=n,n=void 0);let r="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?r=e:!i.cause&&e&&(l=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof t=="string"){const a=t.indexOf(":");a===-1?i.ruleId=t:(i.source=t.slice(0,a),i.ruleId=t.slice(a+1))}if(!i.place&&i.ancestors&&i.ancestors){const a=i.ancestors[i.ancestors.length-1];a&&(i.place=a.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=Ue(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};ee.prototype.file="";ee.prototype.name="";ee.prototype.reason="";ee.prototype.message="";ee.prototype.stack="";ee.prototype.column=void 0;ee.prototype.line=void 0;ee.prototype.ancestors=void 0;ee.prototype.cause=void 0;ee.prototype.fatal=void 0;ee.prototype.place=void 0;ee.prototype.ruleId=void 0;ee.prototype.source=void 0;var Li=fe.__toESM(Ti(),1),Ht={}.hasOwnProperty,zi=new Map,Di=/[A-Z]/g,Fi=new Set(["table","tbody","thead","tfoot","tr"]),Mi=new Set(["td","th"]),Zn="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _i(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Ui(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=qi(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Bt:Ci,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},l=er(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function er(e,n,t){if(n.type==="element")return Ri(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Oi(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Bi(e,n,t);if(n.type==="mdxjsEsm")return Ni(e,n);if(n.type==="root")return ji(e,n,t);if(n.type==="text")return Hi(e,n)}function Ri(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Bt,e.schema=i),e.ancestors.push(n);const l=nr(e,n.tagName,!1),o=$i(e,n);let a=Ut(e,n);return Fi.has(n.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!hi(u):!0})),tr(e,o,l,n),qt(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Oi(e,n){if(n.data&&n.data.estree&&e.evaluater){const t=n.data.estree.body[0];return t.type,e.evaluater.evaluateExpression(t.expression)}We(e,n.position)}function Ni(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);We(e,n.position)}function Bi(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=Bt,e.schema=i),e.ancestors.push(n);const l=n.name===null?e.Fragment:nr(e,n.name,!0),o=Vi(e,n),a=Ut(e,n);return tr(e,o,l,n),qt(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function ji(e,n,t){const r={};return qt(r,Ut(e,n)),e.create(n,e.Fragment,r,t)}function Hi(e,n){return n.value}function tr(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function qt(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function qi(e,n,t){return r;function r(i,l,o,a){const u=Array.isArray(o.children)?t:n;return a?u(l,o,a):u(l,o)}}function Ui(e,n){return t;function t(r,i,l,o){const a=Array.isArray(l.children),u=jt(r);return n(i,l,o,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function $i(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&Ht.call(n.properties,i)){const l=Wi(e,i,n.properties[i]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Mi.has(n.tagName)?r=a:t[o]=a}}if(r){const l=t.style||(t.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function Vi(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const l=i.expression;l.type;const o=l.properties[0];o.type,Object.assign(t,e.evaluater.evaluateExpression(o.argument))}else We(e,n.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,l=e.evaluater.evaluateExpression(o.expression)}else We(e,n.position);else l=r.value===null?!0:r.value;t[i]=l}return t}function Ut(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:zi;for(;++r<n.children.length;){const l=n.children[r];let o;if(e.passKeys){const u=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(u){const c=i.get(u)||0;o=u+"-"+c,i.set(u,c+1)}}const a=er(e,l,o);a!==void 0&&t.push(a)}return t}function Wi(e,n,t){const r=bi(e.schema,n);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=r.commaSeparated?ui(t):Si(t)),r.property==="style"){let i=typeof t=="object"?t:Xi(e,String(t));return e.stylePropertyNameCase==="css"&&(i=Yi(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?xi[r.property]||r.property:r.attribute,t]}}function Xi(e,n){try{return(0,Li.default)(n,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const r=t,i=new ee("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Zn+"#cannot-parse-style-attribute",i}}function nr(e,n,t){let r;if(!t)r={type:"Literal",value:n};else if(n.includes(".")){const i=n.split(".");let l=-1,o;for(;++l<i.length;){const a=rn(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(l&&a.type==="Literal"),optional:!1}:a}r=o}else r=rn(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const i=r.value;return Ht.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);We(e)}function We(e,n){const t=new ee("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=Zn+"#cannot-handle-mdx-estrees-without-createevaluater",t}function Yi(e){const n={};let t;for(t in e)Ht.call(e,t)&&(n[Qi(t)]=e[t]);return n}function Qi(e){let n=e.replace(Di,Ji);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Ji(e){return"-"+e.toLowerCase()}var pt={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"]},Ki={};function $t(e,n){const t=n||Ki;return rr(e,typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,typeof t.includeHtml=="boolean"?t.includeHtml:!0)}function rr(e,n,t){if(Gi(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return cn(e.children,n,t)}return Array.isArray(e)?cn(e,n,t):""}function cn(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=rr(e[i],n,t);return r.join("")}function Gi(e){return!!(e&&typeof e=="object")}var fn=document.createElement("i");function Vt(e){const n="&"+e+";";fn.innerHTML=n;const t=fn.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function oe(e,n,t,r){const i=e.length;let l=0,o;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);l<r.length;)o=r.slice(l,l+1e4),o.unshift(n,0),e.splice(...o),l+=1e4,n+=1e4}function ae(e,n){return e.length>0?(oe(e,e.length,0,n),e):n}var pn={}.hasOwnProperty;function ir(e){const n={};let t=-1;for(;++t<e.length;)Zi(n,e[t]);return n}function Zi(e,n){let t;for(t in n){const r=(pn.call(e,t)?e[t]:void 0)||(e[t]={}),i=n[t];let l;if(i)for(l in i){pn.call(r,l)||(r[l]=[]);const o=i[l];el(r[l],Array.isArray(o)?o:o?[o]:[])}}}function el(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);oe(e,0,0,r)}function lr(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function se(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var te=ve(/[A-Za-z]/),Z=ve(/[\dA-Za-z]/),tl=ve(/[#-'*+\--9=?A-Z^-~]/);function it(e){return e!==null&&(e<32||e===127)}var Lt=ve(/\d/),nl=ve(/[\dA-Fa-f]/),rl=ve(/[!-/:-@[-`{-~]/);function M(e){return e!==null&&e<-2}function V(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}var at=ve(new RegExp("\\p{P}|\\p{S}","u")),Ee=ve(/\s/);function ve(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Oe(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const l=e.charCodeAt(t);let o="";if(l===37&&Z(e.charCodeAt(t+1))&&Z(e.charCodeAt(t+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(o=String.fromCharCode(l));else if(l>55295&&l<57344){const a=e.charCodeAt(t+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),i=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(r,t),encodeURIComponent(o)),r=t+i+1,o=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function U(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(u){return H(u)?(e.enter(t),a(u)):n(u)}function a(u){return H(u)&&l++<i?(e.consume(u),a):(e.exit(t),n(u))}}var il={tokenize:ll};function ll(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),U(e,n,"linePrefix")}function i(a){return e.enter("paragraph"),l(a)}function l(a){const u=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=u),t=u,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return M(a)?(e.consume(a),e.exit("chunkText"),l):(e.consume(a),o)}}var ol={tokenize:al},hn={tokenize:ul};function al(e){const n=this,t=[];let r=0,i,l,o;return a;function a(C){if(r<t.length){const A=t[r];return n.containerState=A[1],e.attempt(A[0].continuation,u,c)(C)}return c(C)}function u(C){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&v();const A=n.events.length;let z=A,w;for(;z--;)if(n.events[z][0]==="exit"&&n.events[z][1].type==="chunkFlow"){w=n.events[z][1].end;break}d(r);let B=A;for(;B<n.events.length;)n.events[B][1].end={...w},B++;return oe(n.events,z+1,0,n.events.slice(A)),n.events.length=B,c(C)}return a(C)}function c(C){if(r===t.length){if(!i)return h(C);if(i.currentConstruct&&i.currentConstruct.concrete)return x(C);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(hn,f,s)(C)}function f(C){return i&&v(),d(r),h(C)}function s(C){return n.parser.lazy[n.now().line]=r!==t.length,o=n.now().offset,x(C)}function h(C){return n.containerState={},e.attempt(hn,p,x)(C)}function p(C){return r++,t.push([n.currentConstruct,n.containerState]),h(C)}function x(C){if(C===null){i&&v(),d(0),e.consume(C);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),k(C)}function k(C){if(C===null){S(e.exit("chunkFlow"),!0),d(0),e.consume(C);return}return M(C)?(e.consume(C),S(e.exit("chunkFlow")),r=0,n.interrupt=void 0,a):(e.consume(C),k)}function S(C,A){const z=n.sliceStream(C);if(A&&z.push(null),C.previous=l,l&&(l.next=C),l=C,i.defineSkip(C.start),i.write(z),n.parser.lazy[C.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<o&&(!i.events[w][1].end||i.events[w][1].end.offset>o))return;const B=n.events.length;let _=B,j,y;for(;_--;)if(n.events[_][0]==="exit"&&n.events[_][1].type==="chunkFlow"){if(j){y=n.events[_][1].end;break}j=!0}for(d(r),w=B;w<n.events.length;)n.events[w][1].end={...y},w++;oe(n.events,_+1,0,n.events.slice(B)),n.events.length=w}}function d(C){let A=t.length;for(;A-- >C;){const z=t[A];n.containerState=z[1],z[0].exit.call(n,e)}t.length=C}function v(){i.write([null]),l=void 0,i=void 0,n.containerState._closeFlow=void 0}}function ul(e,n,t){return U(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _e(e){if(e===null||V(e)||Ee(e))return 1;if(at(e))return 2}function ut(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!r.includes(l)&&(n=l(n,t),r.push(l))}return n}var zt={name:"attention",resolveAll:sl,tokenize:cl};function sl(e,n){let t=-1,r,i,l,o,a,u,c,f;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const s={...e[r][1].end},h={...e[t][1].start};mn(s,-u),mn(h,u),o={type:u>1?"strongSequence":"emphasisSequence",start:s,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:h},l={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[t][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=ae(c,[["enter",e[r][1],n],["exit",e[r][1],n]])),c=ae(c,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",l,n]]),c=ae(c,ut(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),c=ae(c,[["exit",l,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(f=2,c=ae(c,[["enter",e[t][1],n],["exit",e[t][1],n]])):f=0,oe(e,r-1,t-r+3,c),t=r+c.length-f-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function cl(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=_e(r);let l;return o;function o(u){return l=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===l)return e.consume(u),a;const c=e.exit("attentionSequence"),f=_e(u),s=!f||f===2&&i||t.includes(u),h=!i||i===2&&f||t.includes(r);return c._open=!!(l===42?s:s&&(i||!h)),c._close=!!(l===42?h:h&&(f||!s)),n(u)}}function mn(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}var fl={name:"autolink",tokenize:pl};function pl(e,n,t){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(p){return te(p)?(e.consume(p),o):p===64?t(p):c(p)}function o(p){return p===43||p===45||p===46||Z(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,u):(p===43||p===45||p===46||Z(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):p===null||p===32||p===60||it(p)?t(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),f):tl(p)?(e.consume(p),c):t(p)}function f(p){return Z(p)?s(p):t(p)}function s(p){return p===46?(e.consume(p),r=0,f):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):h(p)}function h(p){if((p===45||Z(p))&&r++<63){const x=p===45?h:s;return e.consume(p),x}return t(p)}}var Ke={partial:!0,tokenize:hl};function hl(e,n,t){return r;function r(l){return H(l)?U(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||M(l)?n(l):t(l)}}var or={continuation:{tokenize:gl},exit:dl,name:"blockQuote",tokenize:ml};function ml(e,n,t){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),l}return t(o)}function l(o){return H(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function gl(e,n,t){const r=this;return i;function i(o){return H(o)?U(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):l(o)}function l(o){return e.attempt(or,n,t)(o)}}function dl(e){e.exit("blockQuote")}var ar={name:"characterEscape",tokenize:xl};function xl(e,n,t){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return rl(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(l)}}var ur={name:"characterReference",tokenize:yl};function yl(e,n,t){const r=this;let i=0,l,o;return a;function a(s){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),u}function u(s){return s===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(s),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),l=31,o=Z,f(s))}function c(s){return s===88||s===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(s),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,o=nl,f):(e.enter("characterReferenceValue"),l=7,o=Lt,f(s))}function f(s){if(s===59&&i){const h=e.exit("characterReferenceValue");return o===Z&&!Vt(r.sliceSerialize(h))?t(s):(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(s)&&i++<l?(e.consume(s),f):t(s)}}var gn={partial:!0,tokenize:bl},dn={concrete:!0,name:"codeFenced",tokenize:kl};function kl(e,n,t){const r=this,i={partial:!0,tokenize:z};let l=0,o=0,a;return u;function u(w){return c(w)}function c(w){const B=r.events[r.events.length-1];return l=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,a=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(w)}function f(w){return w===a?(o++,e.consume(w),f):o<3?t(w):(e.exit("codeFencedFenceSequence"),H(w)?U(e,s,"whitespace")(w):s(w))}function s(w){return w===null||M(w)?(e.exit("codeFencedFence"),r.interrupt?n(w):e.check(gn,k,A)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(w))}function h(w){return w===null||M(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),s(w)):H(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),U(e,p,"whitespace")(w)):w===96&&w===a?t(w):(e.consume(w),h)}function p(w){return w===null||M(w)?s(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(w))}function x(w){return w===null||M(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),s(w)):w===96&&w===a?t(w):(e.consume(w),x)}function k(w){return e.attempt(i,A,S)(w)}function S(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),d}function d(w){return l>0&&H(w)?U(e,v,"linePrefix",l+1)(w):v(w)}function v(w){return w===null||M(w)?e.check(gn,k,A)(w):(e.enter("codeFlowValue"),C(w))}function C(w){return w===null||M(w)?(e.exit("codeFlowValue"),v(w)):(e.consume(w),C)}function A(w){return e.exit("codeFenced"),n(w)}function z(w,B,_){let j=0;return y;function y(q){return w.enter("lineEnding"),w.consume(q),w.exit("lineEnding"),P}function P(q){return w.enter("codeFencedFence"),H(q)?U(w,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):L(q)}function L(q){return q===a?(w.enter("codeFencedFenceSequence"),$(q)):_(q)}function $(q){return q===a?(j++,w.consume(q),$):j>=o?(w.exit("codeFencedFenceSequence"),H(q)?U(w,X,"whitespace")(q):X(q)):_(q)}function X(q){return q===null||M(q)?(w.exit("codeFencedFence"),B(q)):_(q)}}}function bl(e,n,t){const r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}var ht={name:"codeIndented",tokenize:vl},wl={partial:!0,tokenize:Cl};function vl(e,n,t){const r=this;return i;function i(c){return e.enter("codeIndented"),U(e,l,"linePrefix",5)(c)}function l(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?u(c):M(c)?e.attempt(wl,o,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||M(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),n(c)}}function Cl(e,n,t){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):M(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):U(e,l,"linePrefix",5)(o)}function l(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):M(o)?i(o):t(o)}}var Sl={name:"codeText",previous:Il,resolve:El,tokenize:Al};function El(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function Il(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Al(e,n,t){let r=0,i,l;return o;function o(s){return e.enter("codeText"),e.enter("codeTextSequence"),a(s)}function a(s){return s===96?(e.consume(s),r++,a):(e.exit("codeTextSequence"),u(s))}function u(s){return s===null?t(s):s===32?(e.enter("space"),e.consume(s),e.exit("space"),u):s===96?(l=e.enter("codeTextSequence"),i=0,f(s)):M(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),u):(e.enter("codeTextData"),c(s))}function c(s){return s===null||s===32||s===96||M(s)?(e.exit("codeTextData"),u(s)):(e.consume(s),c)}function f(s){return s===96?(e.consume(s),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(s)):(l.type="codeTextData",c(s))}}var Tl=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const t=n??Number.POSITIVE_INFINITY;return t<this.left.length?this.left.slice(e,t):e>this.left.length?this.right.slice(this.right.length-t+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-t+this.left.length).reverse())}splice(e,n,t){const r=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return t&&He(this.left,t),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),He(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),He(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);He(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);He(this.left,n.reverse())}}};function He(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function sr(e){const n={};let t=-1,r,i,l,o,a,u,c;const f=new Tl(e);for(;++t<f.length;){for(;t in n;)t=n[t];if(r=f.get(t),t&&r[1].type==="chunkFlow"&&f.get(t-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,l=0,l<u.length&&u[l][1].type==="lineEndingBlank"&&(l+=2),l<u.length&&u[l][1].type==="content"))for(;++l<u.length&&u[l][1].type!=="content";)u[l][1].type==="chunkText"&&(u[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,Pl(f,t)),t=n[t],c=!0);else if(r[1]._container){for(l=t,i=void 0;l--;)if(o=f.get(l),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=l);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},a=f.slice(i,t),a.unshift(r),f.splice(i,t-i+1,a))}}return oe(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!c}function Pl(e,n){const t=e.get(n)[1],r=e.get(n)[2];let i=n-1;const l=[];let o=t._tokenizer;o||(o=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,u=[],c={};let f,s,h=-1,p=t,x=0,k=0;const S=[k];for(;p;){for(;e.get(++i)[1]!==p;);l.push(i),p._tokenizer||(f=r.sliceStream(p),p.next||f.push(null),s&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(f),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),s=p,p=p.next}for(p=t;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(k=h+1,S.push(k),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):S.pop(),h=S.length;h--;){const d=a.slice(S[h],S[h+1]),v=l.pop();u.push([v,v+d.length-1]),e.splice(v,2,d)}for(u.reverse(),h=-1;++h<u.length;)c[x+u[h][0]]=x+u[h][1],x+=u[h][1]-u[h][0]-1;return c}var Ll={resolve:Dl,tokenize:Fl},zl={partial:!0,tokenize:Ml};function Dl(e){return sr(e),e}function Fl(e,n){let t;return r;function r(a){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?l(a):M(a)?e.check(zl,o,l)(a):(e.consume(a),i)}function l(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function o(a){return e.consume(a),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function Ml(e,n,t){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),U(e,l,"linePrefix")}function l(o){if(o===null||M(o))return t(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}function cr(e,n,t,r,i,l,o,a,u){const c=u||Number.POSITIVE_INFINITY;let f=0;return s;function s(d){return d===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(d),e.exit(l),h):d===null||d===32||d===41||it(d)?t(d):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),k(d))}function h(d){return d===62?(e.enter(l),e.consume(d),e.exit(l),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===62?(e.exit("chunkString"),e.exit(a),h(d)):d===null||d===60||M(d)?t(d):(e.consume(d),d===92?x:p)}function x(d){return d===60||d===62||d===92?(e.consume(d),p):p(d)}function k(d){return!f&&(d===null||d===41||V(d))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),n(d)):f<c&&d===40?(e.consume(d),f++,k):d===41?(e.consume(d),f--,k):d===null||d===32||d===40||it(d)?t(d):(e.consume(d),d===92?S:k)}function S(d){return d===40||d===41||d===92?(e.consume(d),k):k(d)}}function fr(e,n,t,r,i,l){const o=this;let a=0,u;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(l),f}function f(p){return a>999||p===null||p===91||p===93&&!u||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?t(p):p===93?(e.exit(l),e.enter(i),e.consume(p),e.exit(i),e.exit(r),n):M(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),s(p))}function s(p){return p===null||p===91||p===93||M(p)||a++>999?(e.exit("chunkString"),f(p)):(e.consume(p),u||(u=!H(p)),p===92?h:s)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,s):s(p)}}function pr(e,n,t,r,i,l){let o;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),o=h===40?41:h,u):t(h)}function u(h){return h===o?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),n):(e.enter(l),c(h))}function c(h){return h===o?(e.exit(l),u(o)):h===null?t(h):M(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),U(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===o||h===null||M(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?s:f)}function s(h){return h===o||h===92?(e.consume(h),f):f(h)}}function $e(e,n){let t;return r;function r(i){return M(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):H(i)?U(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}var _l={name:"definition",tokenize:Ol},Rl={partial:!0,tokenize:Nl};function Ol(e,n,t){const r=this;let i;return l;function l(p){return e.enter("definition"),o(p)}function o(p){return fr.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=se(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):t(p)}function u(p){return V(p)?$e(e,c)(p):c(p)}function c(p){return cr(e,f,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function f(p){return e.attempt(Rl,s,s)(p)}function s(p){return H(p)?U(e,h,"whitespace")(p):h(p)}function h(p){return p===null||M(p)?(e.exit("definition"),r.parser.defined.push(i),n(p)):t(p)}}function Nl(e,n,t){return r;function r(a){return V(a)?$e(e,i)(a):t(a)}function i(a){return pr(e,l,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return H(a)?U(e,o,"whitespace")(a):o(a)}function o(a){return a===null||M(a)?n(a):t(a)}}var Bl={name:"hardBreakEscape",tokenize:jl};function jl(e,n,t){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return M(l)?(e.exit("hardBreakEscape"),n(l)):t(l)}}var Hl={name:"headingAtx",resolve:ql,tokenize:Ul};function ql(e,n){let t=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},l={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},oe(e,r,t-r+1,[["enter",i,n],["enter",l,n],["exit",l,n],["exit",i,n]])),e}function Ul(e,n,t){let r=0;return i;function i(f){return e.enter("atxHeading"),l(f)}function l(f){return e.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(e.consume(f),o):f===null||V(f)?(e.exit("atxHeadingSequence"),a(f)):t(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),u(f)):f===null||M(f)?(e.exit("atxHeading"),n(f)):H(f)?U(e,a,"whitespace")(f):(e.enter("atxHeadingText"),c(f))}function u(f){return f===35?(e.consume(f),u):(e.exit("atxHeadingSequence"),a(f))}function c(f){return f===null||f===35||V(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),c)}}var $l=["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"],xn=["pre","script","style","textarea"],Vl={concrete:!0,name:"htmlFlow",resolveTo:Yl,tokenize:Ql},Wl={partial:!0,tokenize:Kl},Xl={partial:!0,tokenize:Jl};function Yl(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Ql(e,n,t){const r=this;let i,l,o,a,u;return c;function c(g){return f(g)}function f(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),s}function s(g){return g===33?(e.consume(g),h):g===47?(e.consume(g),l=!0,k):g===63?(e.consume(g),i=3,r.interrupt?n:m):te(g)?(e.consume(g),o=String.fromCharCode(g),S):t(g)}function h(g){return g===45?(e.consume(g),i=2,p):g===91?(e.consume(g),i=5,a=0,x):te(g)?(e.consume(g),i=4,r.interrupt?n:m):t(g)}function p(g){return g===45?(e.consume(g),r.interrupt?n:m):t(g)}function x(g){return g==="CDATA[".charCodeAt(a++)?(e.consume(g),a===6?r.interrupt?n:L:x):t(g)}function k(g){return te(g)?(e.consume(g),o=String.fromCharCode(g),S):t(g)}function S(g){if(g===null||g===47||g===62||V(g)){const ke=g===47,Ce=o.toLowerCase();return!ke&&!l&&xn.includes(Ce)?(i=1,r.interrupt?n(g):L(g)):$l.includes(o.toLowerCase())?(i=6,ke?(e.consume(g),d):r.interrupt?n(g):L(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(g):l?v(g):C(g))}return g===45||Z(g)?(e.consume(g),o+=String.fromCharCode(g),S):t(g)}function d(g){return g===62?(e.consume(g),r.interrupt?n:L):t(g)}function v(g){return H(g)?(e.consume(g),v):y(g)}function C(g){return g===47?(e.consume(g),y):g===58||g===95||te(g)?(e.consume(g),A):H(g)?(e.consume(g),C):y(g)}function A(g){return g===45||g===46||g===58||g===95||Z(g)?(e.consume(g),A):z(g)}function z(g){return g===61?(e.consume(g),w):H(g)?(e.consume(g),z):C(g)}function w(g){return g===null||g===60||g===61||g===62||g===96?t(g):g===34||g===39?(e.consume(g),u=g,B):H(g)?(e.consume(g),w):_(g)}function B(g){return g===u?(e.consume(g),u=null,j):g===null||M(g)?t(g):(e.consume(g),B)}function _(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||V(g)?z(g):(e.consume(g),_)}function j(g){return g===47||g===62||H(g)?C(g):t(g)}function y(g){return g===62?(e.consume(g),P):t(g)}function P(g){return g===null||M(g)?L(g):H(g)?(e.consume(g),P):t(g)}function L(g){return g===45&&i===2?(e.consume(g),R):g===60&&i===1?(e.consume(g),D):g===62&&i===4?(e.consume(g),ye):g===63&&i===3?(e.consume(g),m):g===93&&i===5?(e.consume(g),ue):M(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Wl,he,$)(g)):g===null||M(g)?(e.exit("htmlFlowData"),$(g)):(e.consume(g),L)}function $(g){return e.check(Xl,X,he)(g)}function X(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),q}function q(g){return g===null||M(g)?$(g):(e.enter("htmlFlowData"),L(g))}function R(g){return g===45?(e.consume(g),m):L(g)}function D(g){return g===47?(e.consume(g),o="",J):L(g)}function J(g){if(g===62){const ke=o.toLowerCase();return xn.includes(ke)?(e.consume(g),ye):L(g)}return te(g)&&o.length<8?(e.consume(g),o+=String.fromCharCode(g),J):L(g)}function ue(g){return g===93?(e.consume(g),m):L(g)}function m(g){return g===62?(e.consume(g),ye):g===45&&i===2?(e.consume(g),m):L(g)}function ye(g){return g===null||M(g)?(e.exit("htmlFlowData"),he(g)):(e.consume(g),ye)}function he(g){return e.exit("htmlFlow"),n(g)}}function Jl(e,n,t){const r=this;return i;function i(o){return M(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):t(o)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function Kl(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ke,n,t)}}var Gl={name:"htmlText",tokenize:Zl};function Zl(e,n,t){const r=this;let i,l,o;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),c):m===47?(e.consume(m),z):m===63?(e.consume(m),C):te(m)?(e.consume(m),_):t(m)}function c(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),l=0,x):te(m)?(e.consume(m),v):t(m)}function f(m){return m===45?(e.consume(m),p):t(m)}function s(m){return m===null?t(m):m===45?(e.consume(m),h):M(m)?(o=s,D(m)):(e.consume(m),s)}function h(m){return m===45?(e.consume(m),p):s(m)}function p(m){return m===62?R(m):m===45?h(m):s(m)}function x(m){return m==="CDATA[".charCodeAt(l++)?(e.consume(m),l===6?k:x):t(m)}function k(m){return m===null?t(m):m===93?(e.consume(m),S):M(m)?(o=k,D(m)):(e.consume(m),k)}function S(m){return m===93?(e.consume(m),d):k(m)}function d(m){return m===62?R(m):m===93?(e.consume(m),d):k(m)}function v(m){return m===null||m===62?R(m):M(m)?(o=v,D(m)):(e.consume(m),v)}function C(m){return m===null?t(m):m===63?(e.consume(m),A):M(m)?(o=C,D(m)):(e.consume(m),C)}function A(m){return m===62?R(m):C(m)}function z(m){return te(m)?(e.consume(m),w):t(m)}function w(m){return m===45||Z(m)?(e.consume(m),w):B(m)}function B(m){return M(m)?(o=B,D(m)):H(m)?(e.consume(m),B):R(m)}function _(m){return m===45||Z(m)?(e.consume(m),_):m===47||m===62||V(m)?j(m):t(m)}function j(m){return m===47?(e.consume(m),R):m===58||m===95||te(m)?(e.consume(m),y):M(m)?(o=j,D(m)):H(m)?(e.consume(m),j):R(m)}function y(m){return m===45||m===46||m===58||m===95||Z(m)?(e.consume(m),y):P(m)}function P(m){return m===61?(e.consume(m),L):M(m)?(o=P,D(m)):H(m)?(e.consume(m),P):j(m)}function L(m){return m===null||m===60||m===61||m===62||m===96?t(m):m===34||m===39?(e.consume(m),i=m,$):M(m)?(o=L,D(m)):H(m)?(e.consume(m),L):(e.consume(m),X)}function $(m){return m===i?(e.consume(m),i=void 0,q):m===null?t(m):M(m)?(o=$,D(m)):(e.consume(m),$)}function X(m){return m===null||m===34||m===39||m===60||m===61||m===96?t(m):m===47||m===62||V(m)?j(m):(e.consume(m),X)}function q(m){return m===47||m===62||V(m)?j(m):t(m)}function R(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),n):t(m)}function D(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),J}function J(m){return H(m)?U(e,ue,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):ue(m)}function ue(m){return e.enter("htmlTextData"),o(m)}}var Wt={name:"labelEnd",resolveAll:ro,resolveTo:io,tokenize:lo},eo={tokenize:oo},to={tokenize:ao},no={tokenize:uo};function ro(e){let n=-1;const t=[];for(;++n<e.length;){const r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&oe(e,0,e.length,t),e}function io(e,n){let t=e.length,r=0,i,l,o,a;for(;t--;)if(i=e[t][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=t);const u={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[l][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",u,n],["enter",c,n]],a=ae(a,e.slice(l+1,l+r+3)),a=ae(a,[["enter",f,n]]),a=ae(a,ut(n.parser.constructs.insideSpan.null,e.slice(l+r+4,o-3),n)),a=ae(a,[["exit",f,n],e[o-2],e[o-1],["exit",c,n]]),a=ae(a,e.slice(o+1)),a=ae(a,[["exit",u,n]]),oe(e,l,e.length,a),e}function lo(e,n,t){const r=this;let i=r.events.length,l,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){l=r.events[i][1];break}return a;function a(h){return l?l._inactive?s(h):(o=r.parser.defined.includes(se(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),u):t(h)}function u(h){return h===40?e.attempt(eo,f,o?f:s)(h):h===91?e.attempt(to,f,o?c:s)(h):o?f(h):s(h)}function c(h){return e.attempt(no,f,s)(h)}function f(h){return n(h)}function s(h){return l._balanced=!0,t(h)}}function oo(e,n,t){return r;function r(s){return e.enter("resource"),e.enter("resourceMarker"),e.consume(s),e.exit("resourceMarker"),i}function i(s){return V(s)?$e(e,l)(s):l(s)}function l(s){return s===41?f(s):cr(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(s)}function o(s){return V(s)?$e(e,u)(s):f(s)}function a(s){return t(s)}function u(s){return s===34||s===39||s===40?pr(e,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(s):f(s)}function c(s){return V(s)?$e(e,f)(s):f(s)}function f(s){return s===41?(e.enter("resourceMarker"),e.consume(s),e.exit("resourceMarker"),e.exit("resource"),n):t(s)}}function ao(e,n,t){const r=this;return i;function i(a){return fr.call(r,e,l,o,"reference","referenceMarker","referenceString")(a)}function l(a){return r.parser.defined.includes(se(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(a):t(a)}function o(a){return t(a)}}function uo(e,n,t){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),n):t(l)}}var so={name:"labelStartImage",resolveAll:Wt.resolveAll,tokenize:co};function co(e,n,t){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),l}function l(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):t(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}var fo={name:"labelStartLink",resolveAll:Wt.resolveAll,tokenize:po};function po(e,n,t){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),l}function l(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(o):n(o)}}var mt={name:"lineEnding",tokenize:ho};function ho(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),U(e,n,"linePrefix")}}var rt={name:"thematicBreak",tokenize:mo};function mo(e,n,t){let r=0,i;return l;function l(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||M(c))?(e.exit("thematicBreak"),n(c)):t(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),H(c)?U(e,a,"whitespace")(c):a(c))}}var ne={continuation:{tokenize:ko},exit:wo,name:"list",tokenize:yo},go={partial:!0,tokenize:vo},xo={partial:!0,tokenize:bo};function yo(e,n,t){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Lt(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(rt,t,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return t(p)}function u(p){return Lt(p)&&++o<10?(e.consume(p),u):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):t(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ke,r.interrupt?t:f,e.attempt(go,h,s))}function f(p){return r.containerState.initialBlankLine=!0,l++,h(p)}function s(p){return H(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):t(p)}function h(p){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(p)}}function ko(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(Ke,i,l);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,U(e,n,"listItemIndent",r.containerState.size+1)(a)}function l(a){return r.containerState.furtherBlankLines||!H(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xo,n,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,U(e,e.attempt(ne,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function bo(e,n,t){const r=this;return U(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(l):t(l)}}function wo(e){e.exit(this.containerState.type)}function vo(e,n,t){const r=this;return U(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!H(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):t(l)}}var yn={name:"setextUnderline",resolveTo:Co,tokenize:So};function Co(e,n){let t=e.length,r,i,l;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!l&&e[t][1].type==="definition"&&(l=t);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,n]),e.splice(l+1,0,["exit",e[r][1],n]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,n]),e}function So(e,n,t){const r=this;let i;return l;function l(c){let f=r.events.length,s;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){s=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter("setextHeadingLine"),i=c,o(c)):t(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),H(c)?U(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||M(c)?(e.exit("setextHeadingLine"),n(c)):t(c)}}var Eo={tokenize:Io};function Io(e){const n=this,t=e.attempt(Ke,r,e.attempt(this.parser.constructs.flowInitial,i,U(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Ll,i)),"linePrefix")));return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,t}}var Ao={resolveAll:mr()},To=hr("string"),Po=hr("text");function hr(e){return{resolveAll:mr(e==="text"?Lo:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],l=t.attempt(i,o,a);return o;function o(f){return c(f)?l(f):a(f)}function a(f){if(f===null){t.consume(f);return}return t.enter("data"),t.consume(f),u}function u(f){return c(f)?(t.exit("data"),l(f)):(t.consume(f),u)}function c(f){if(f===null)return!0;const s=i[f];let h=-1;if(s)for(;++h<s.length;){const p=s[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function mr(e){return n;function n(t,r){let i=-1,l;for(;++i<=t.length;)l===void 0?t[i]&&t[i][1].type==="data"&&(l=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==l+2&&(t[l][1].end=t[i-1][1].end,t.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(t,r):t}}function Lo(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let l=i.length,o=-1,a=0,u;for(;l--;){const c=i[l];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)u=!0,a++;else if(c!==-1){l++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(a=0),a){const c={type:t===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?o:r.start._bufferIndex+o,_index:r.start._index+l,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(t,0,["enter",c,n],["exit",c,n]),t+=2)}t++}return e}var zo=fe.__exportAll({attentionMarkers:()=>Bo,contentInitial:()=>Fo,disable:()=>jo,document:()=>Do,flow:()=>_o,flowInitial:()=>Mo,insideSpan:()=>No,string:()=>Ro,text:()=>Oo}),Do={42:ne,43:ne,45:ne,48:ne,49:ne,50:ne,51:ne,52:ne,53:ne,54:ne,55:ne,56:ne,57:ne,62:or},Fo={91:_l},Mo={[-2]:ht,[-1]:ht,32:ht},_o={35:Hl,42:rt,45:[yn,rt],60:Vl,61:yn,95:rt,96:dn,126:dn},Ro={38:ur,92:ar},Oo={[-5]:mt,[-4]:mt,[-3]:mt,33:so,38:ur,42:zt,60:[fl,Gl],91:fo,92:[Bl,ar],93:Wt,95:zt,96:Sl},No={null:[zt,Ao]},Bo={null:[42,95]},jo={null:[]};function Ho(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const i={},l=[];let o=[],a=[];const u={attempt:B(z),check:B(w),consume:v,enter:C,exit:A,interrupt:B(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:k,events:[],now:x,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:s};let f=n.tokenize.call(c,u);return n.resolveAll&&l.push(n),c;function s(P){return o=ae(o,P),S(),o[o.length-1]!==null?[]:(_(n,0),c.events=ut(l,c.events,c),c.events)}function h(P,L){return Uo(p(P),L)}function p(P){return qo(o,P)}function x(){const{_bufferIndex:P,_index:L,line:$,column:X,offset:q}=r;return{_bufferIndex:P,_index:L,line:$,column:X,offset:q}}function k(P){i[P.line]=P.column,y()}function S(){let P;for(;r._index<o.length;){const L=o[r._index];if(typeof L=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<L.length;)d(L.charCodeAt(r._bufferIndex));else d(L)}}function d(P){f=f(P)}function v(P){M(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,y()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=P}function C(P,L){const $=L||{};return $.type=P,$.start=x(),c.events.push(["enter",$,c]),a.push($),$}function A(P){const L=a.pop();return L.end=x(),c.events.push(["exit",L,c]),L}function z(P,L){_(P,L.from)}function w(P,L){L.restore()}function B(P,L){return $;function $(X,q,R){let D,J,ue,m;return Array.isArray(X)?he(X):"tokenize"in X?he([X]):ye(X);function ye(G){return Ne;function Ne(me){const Ae=me!==null&&G[me],Te=me!==null&&G.null;return he([...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(Te)?Te:Te?[Te]:[]])(me)}}function he(G){return D=G,J=0,G.length===0?R:g(G[J])}function g(G){return Ne;function Ne(me){return m=j(),ue=G,G.partial||(c.currentConstruct=G),G.name&&c.parser.constructs.disable.null.includes(G.name)?Ce(me):G.tokenize.call(L?Object.assign(Object.create(c),L):c,u,ke,Ce)(me)}}function ke(G){return P(ue,m),q}function Ce(G){return m.restore(),++J<D.length?g(D[J]):R}}}function _(P,L){P.resolveAll&&!l.includes(P)&&l.push(P),P.resolve&&oe(c.events,L,c.events.length-L,P.resolve(c.events.slice(L),c)),P.resolveTo&&(c.events=P.resolveTo(c.events,c))}function j(){const P=x(),L=c.previous,$=c.currentConstruct,X=c.events.length,q=Array.from(a);return{from:X,restore:R};function R(){r=P,c.previous=L,c.currentConstruct=$,c.events.length=X,a=q,y()}}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function qo(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,l=n.end._bufferIndex;let o;if(t===i)o=[e[t].slice(r,l)];else{if(o=e.slice(t,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function Uo(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const l=e[t];let o;if(typeof l=="string")o=l;else switch(l){case-5:o="\r";break;case-4:o=`
3
3
  `;break;case-3:o=`\r
4
4
  `;break;case-2:o=n?" ":" ";break;case-1:if(!n&&i)continue;o=" ";break;default:o=String.fromCharCode(l)}i=l===-2,r.push(o)}return r.join("")}function $o(e){const n={constructs:ir([zo,...(e||{}).extensions||[]]),content:t(il),defined:[],document:t(ol),flow:t(Eo),lazy:{},string:t(To),text:t(Po)};return n;function t(r){return i;function i(l){return Ho(n,r,l)}}}function Vo(e){for(;!sr(e););return e}var kn=/[\0\t\n\r]/g;function Wo(){let e=1,n="",t=!0,r;return i;function i(l,o,a){const u=[];let c,f,s,h,p;for(l=n+(typeof l=="string"?l.toString():new TextDecoder(o||void 0).decode(l)),s=0,n="",t&&(l.charCodeAt(0)===65279&&s++,t=void 0);s<l.length;){if(kn.lastIndex=s,c=kn.exec(l),h=c&&c.index!==void 0?c.index:l.length,p=l.charCodeAt(h),!c){n=l.slice(s);break}if(p===10&&s===h&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),s<h&&(u.push(l.slice(s,h)),e+=h-s),p){case 0:u.push(65533),e++;break;case 9:for(f=Math.ceil(e/4)*4,u.push(-2);e++<f;)u.push(-1);break;case 10:u.push(-4),e=1;break;default:r=!0,e=1}s=h+1}return a&&(r&&u.push(-5),n&&u.push(n),u.push(null)),u}}var Xo=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Yo(e){return e.replace(Xo,Qo)}function Qo(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const r=t.charCodeAt(1),i=r===120||r===88;return lr(t.slice(i?2:1),i?16:10)}return Vt(t)||e}var gr={}.hasOwnProperty;function Jo(e,n,t){return typeof n!="string"&&(t=n,n=void 0),Ko(t)(Vo($o(t).document().write(Wo()(e,n,!0))))}function Ko(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(tn),autolinkProtocol:j,autolinkEmail:j,atxHeading:l(Gt),blockQuote:l(Te),characterEscape:j,characterReference:j,codeFenced:l(Kt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:l(Kt,o),codeText:l(Jr,o),codeTextData:j,data:j,codeFlowValue:j,definition:l(Kr),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:l(Gr),hardBreakEscape:l(Zt),hardBreakTrailing:l(Zt),htmlFlow:l(en,o),htmlFlowData:j,htmlText:l(en,o),htmlTextData:j,image:l(Zr),label:o,link:l(tn),listItem:l(ei),listItemValue:h,listOrdered:l(nn,s),listUnordered:l(nn),paragraph:l(ti),reference:g,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:l(Gt),strong:l(ni),thematicBreak:l(ii)},exit:{atxHeading:u(),atxHeadingSequence:z,autolink:u(),autolinkEmail:Ae,autolinkProtocol:me,blockQuote:u(),characterEscapeValue:y,characterReferenceMarkerHexadecimal:Ce,characterReferenceMarkerNumeric:Ce,characterReferenceValue:G,characterReference:Ne,codeFenced:u(S),codeFencedFence:k,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:y,codeIndented:u(d),codeText:u(q),codeTextData:y,data:y,definition:u(),definitionDestinationString:A,definitionLabelString:v,definitionTitleString:C,emphasis:u(),hardBreakEscape:u(L),hardBreakTrailing:u(L),htmlFlow:u($),htmlFlowData:y,htmlText:u(X),htmlTextData:y,image:u(D),label:ue,labelText:J,lineEnding:P,link:u(R),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:ke,resourceDestinationString:m,resourceTitleString:ye,resource:he,setextHeading:u(_),setextHeadingLineSequence:B,setextHeadingText:w,strong:u(),thematicBreak:u()}};dr(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(b){let I={type:"root",children:[]};const O={stack:[I],tokenStack:[],config:n,enter:a,exit:c,buffer:o,resume:f,data:t},Y=[];let Q=-1;for(;++Q<b.length;)(b[Q][1].type==="listOrdered"||b[Q][1].type==="listUnordered")&&(b[Q][0]==="enter"?Y.push(Q):Q=i(b,Y.pop(),Q));for(Q=-1;++Q<b.length;){const be=n[b[Q][0]];gr.call(be,b[Q][1].type)&&be[b[Q][1].type].call(Object.assign({sliceSerialize:b[Q][2].sliceSerialize},O),b[Q][1])}if(O.tokenStack.length>0){const be=O.tokenStack[O.tokenStack.length-1];(be[1]||bn).call(O,void 0,be[0])}for(I.position={start:we(b.length>0?b[0][1].start:{line:1,column:1,offset:0}),end:we(b.length>0?b[b.length-2][1].end:{line:1,column:1,offset:0})},Q=-1;++Q<n.transforms.length;)I=n.transforms[Q](I)||I;return I}function i(b,I,O){let Y=I-1,Q=-1,be=!1,Pe,ge,Be,je;for(;++Y<=O;){const ie=b[Y];switch(ie[1].type){case"listUnordered":case"listOrdered":case"blockQuote":ie[0]==="enter"?Q++:Q--,je=void 0;break;case"lineEndingBlank":ie[0]==="enter"&&(Pe&&!je&&!Q&&!Be&&(Be=Y),je=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:je=void 0}if(!Q&&ie[0]==="enter"&&ie[1].type==="listItemPrefix"||Q===-1&&ie[0]==="exit"&&(ie[1].type==="listUnordered"||ie[1].type==="listOrdered")){if(Pe){let Le=Y;for(ge=void 0;Le--;){const de=b[Le];if(de[1].type==="lineEnding"||de[1].type==="lineEndingBlank"){if(de[0]==="exit")continue;ge&&(b[ge][1].type="lineEndingBlank",be=!0),de[1].type="lineEnding",ge=Le}else if(!(de[1].type==="linePrefix"||de[1].type==="blockQuotePrefix"||de[1].type==="blockQuotePrefixWhitespace"||de[1].type==="blockQuoteMarker"||de[1].type==="listItemIndent"))break}Be&&(!ge||Be<ge)&&(Pe._spread=!0),Pe.end=Object.assign({},ge?b[ge][1].start:ie[1].end),b.splice(ge||Y,0,["exit",Pe,ie[2]]),Y++,O++}if(ie[1].type==="listItemPrefix"){const Le={type:"listItem",_spread:!1,start:Object.assign({},ie[1].start),end:void 0};Pe=Le,b.splice(Y,0,["enter",Le,ie[2]]),Y++,O++,Be=void 0,je=!0}}}return b[I][1]._spread=be,O}function l(b,I){return O;function O(Y){a.call(this,b(Y),Y),I&&I.call(this,Y)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(b,I,O){this.stack[this.stack.length-1].children.push(b),this.stack.push(b),this.tokenStack.push([I,O||void 0]),b.position={start:we(I.start),end:void 0}}function u(b){return I;function I(O){b&&b.call(this,O),c.call(this,O)}}function c(b,I){const O=this.stack.pop(),Y=this.tokenStack.pop();if(Y)Y[0].type!==b.type&&(I?I.call(this,b,Y[0]):(Y[1]||bn).call(this,b,Y[0]));else throw new Error("Cannot close `"+b.type+"` ("+Ue({start:b.start,end:b.end})+"): it’s not open");O.position.end=we(b.end)}function f(){return $t(this.stack.pop())}function s(){this.data.expectingFirstListItemValue=!0}function h(b){if(this.data.expectingFirstListItemValue){const I=this.stack[this.stack.length-2];I.start=Number.parseInt(this.sliceSerialize(b),10),this.data.expectingFirstListItemValue=void 0}}function p(){const b=this.resume(),I=this.stack[this.stack.length-1];I.lang=b}function x(){const b=this.resume(),I=this.stack[this.stack.length-1];I.meta=b}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const b=this.resume(),I=this.stack[this.stack.length-1];I.value=b.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function d(){const b=this.resume(),I=this.stack[this.stack.length-1];I.value=b.replace(/(\r?\n|\r)$/g,"")}function v(b){const I=this.resume(),O=this.stack[this.stack.length-1];O.label=I,O.identifier=se(this.sliceSerialize(b)).toLowerCase()}function C(){const b=this.resume(),I=this.stack[this.stack.length-1];I.title=b}function A(){const b=this.resume(),I=this.stack[this.stack.length-1];I.url=b}function z(b){const I=this.stack[this.stack.length-1];I.depth||(I.depth=this.sliceSerialize(b).length)}function w(){this.data.setextHeadingSlurpLineEnding=!0}function B(b){const I=this.stack[this.stack.length-1];I.depth=this.sliceSerialize(b).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function j(b){const I=this.stack[this.stack.length-1].children;let O=I[I.length-1];(!O||O.type!=="text")&&(O=ri(),O.position={start:we(b.start),end:void 0},I.push(O)),this.stack.push(O)}function y(b){const I=this.stack.pop();I.value+=this.sliceSerialize(b),I.position.end=we(b.end)}function P(b){const I=this.stack[this.stack.length-1];if(this.data.atHardBreak){const O=I.children[I.children.length-1];O.position.end=we(b.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(I.type)&&(j.call(this,b),y.call(this,b))}function L(){this.data.atHardBreak=!0}function $(){const b=this.resume(),I=this.stack[this.stack.length-1];I.value=b}function X(){const b=this.resume(),I=this.stack[this.stack.length-1];I.value=b}function q(){const b=this.resume(),I=this.stack[this.stack.length-1];I.value=b}function R(){const b=this.stack[this.stack.length-1];if(this.data.inReference){const I=this.data.referenceType||"shortcut";b.type+="Reference",b.referenceType=I,delete b.url,delete b.title}else delete b.identifier,delete b.label;this.data.referenceType=void 0}function D(){const b=this.stack[this.stack.length-1];if(this.data.inReference){const I=this.data.referenceType||"shortcut";b.type+="Reference",b.referenceType=I,delete b.url,delete b.title}else delete b.identifier,delete b.label;this.data.referenceType=void 0}function J(b){const I=this.sliceSerialize(b),O=this.stack[this.stack.length-2];O.label=Yo(I),O.identifier=se(I).toLowerCase()}function ue(){const b=this.stack[this.stack.length-1],I=this.resume(),O=this.stack[this.stack.length-1];this.data.inReference=!0,O.type==="link"?O.children=b.children:O.alt=I}function m(){const b=this.resume(),I=this.stack[this.stack.length-1];I.url=b}function ye(){const b=this.resume(),I=this.stack[this.stack.length-1];I.title=b}function he(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function ke(b){const I=this.resume(),O=this.stack[this.stack.length-1];O.label=I,O.identifier=se(this.sliceSerialize(b)).toLowerCase(),this.data.referenceType="full"}function Ce(b){this.data.characterReferenceType=b.type}function G(b){const I=this.sliceSerialize(b),O=this.data.characterReferenceType;let Y;O?(Y=lr(I,O==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Y=Vt(I);const Q=this.stack[this.stack.length-1];Q.value+=Y}function Ne(b){const I=this.stack.pop();I.position.end=we(b.end)}function me(b){y.call(this,b);const I=this.stack[this.stack.length-1];I.url=this.sliceSerialize(b)}function Ae(b){y.call(this,b);const I=this.stack[this.stack.length-1];I.url="mailto:"+this.sliceSerialize(b)}function Te(){return{type:"blockquote",children:[]}}function Kt(){return{type:"code",lang:null,meta:null,value:""}}function Jr(){return{type:"inlineCode",value:""}}function Kr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Gr(){return{type:"emphasis",children:[]}}function Gt(){return{type:"heading",depth:0,children:[]}}function Zt(){return{type:"break"}}function en(){return{type:"html",value:""}}function Zr(){return{type:"image",title:null,url:"",alt:null}}function tn(){return{type:"link",title:null,url:"",children:[]}}function nn(b){return{type:"list",ordered:b.type==="listOrdered",start:null,spread:b._spread,children:[]}}function ei(b){return{type:"listItem",spread:b._spread,checked:null,children:[]}}function ti(){return{type:"paragraph",children:[]}}function ni(){return{type:"strong",children:[]}}function ri(){return{type:"text",value:""}}function ii(){return{type:"thematicBreak"}}}function we(e){return{line:e.line,column:e.column,offset:e.offset}}function dr(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?dr(e,r):Go(e,r)}}function Go(e,n){let t;for(t in n)if(gr.call(n,t))switch(t){case"canContainEols":{const r=n[t];r&&e[t].push(...r);break}case"transforms":{const r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{const r=n[t];r&&Object.assign(e[t],r);break}}}function bn(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ue({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ue({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ue({start:n.start,end:n.end})+") is still open")}function Zo(e){const n=this;n.parser=t;function t(r){return Jo(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function ea(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function ta(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`