@rekayasa/erica-bubble 1.0.11 → 1.0.13
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.
- package/dist/erica-bubble.css +1 -1
- package/dist/index.cjs +23 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2392 -454
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
3
3
|
|
|
4
4
|
`);p=a.pop()??``;for(let e of a){let t=e.split(`
|
|
5
5
|
`),a=[],o;for(let e of t)if(e.startsWith(`data:`))a.push(e.replace(/^data:\s*/,``));else if(e.startsWith(`event:`))o=e.replace(/^event:\s*/,``);else if(e.startsWith(`id:`))d=e.replace(/^id:\s*/,``);else if(e.startsWith(`retry:`)){let t=Number.parseInt(e.replace(/^retry:\s*/,``),10);Number.isNaN(t)||(c=t)}let s,l=!1;if(a.length){let e=a.join(`
|
|
6
|
-
`);try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:o,id:d,retry:c}),a.length&&(yield s)}}}finally{m.removeEventListener(`abort`,h),f.releaseLock()}break}catch(e){if(t?.(e),o!==void 0&&p>=o)break;await f(Math.min(c*2**(p-1),s??3e4))}}}()}}var ce=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},le=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},ue=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},de=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(le(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=ce(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):fe({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},fe=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},pe=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=ue(r),s=Object.entries(i).map(([t,i])=>fe({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},me=/\{[^{}]+\}/g,he=({path:e,url:t})=>{let n=t,r=t.match(me);if(r)for(let t of r){let r=!1,i=t.substring(1,t.length-1),a=`simple`;i.endsWith(`*`)&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(`.`)?(i=i.substring(1),a=`label`):i.startsWith(`;`)&&(i=i.substring(1),a=`matrix`);let o=e[i];if(o==null)continue;if(Array.isArray(o)){n=n.replace(t,de({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,pe({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${fe({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},ge=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=he({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function _e(e){let t=e.body!==void 0;if(t&&e.bodySerializer)return`serializedBody`in e?e.serializedBody!==void 0&&e.serializedBody!==``?e.serializedBody:null:e.body===``?null:e.body;if(t)return e.body}var ve=async(e,t)=>{let n=typeof t==`function`?await t(e):t;if(n)return e.scheme===`bearer`?`Bearer ${n}`:e.scheme===`basic`?`Basic ${btoa(n)}`:n},ye=({parameters:e={},...t}={})=>n=>{let r=[];if(n&&typeof n==`object`)for(let i in n){let a=n[i];if(a==null)continue;let o=e[i]||t;if(Array.isArray(a)){let e=de({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=pe({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=fe({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},be=e=>{if(!e)return`stream`;let t=e.split(`;`)[0]?.trim();if(t){if(t.startsWith(`application/json`)||t.endsWith(`+json`))return`json`;if(t===`multipart/form-data`)return`formData`;if([`application/`,`audio/`,`image/`,`video/`].some(e=>t.startsWith(e)))return`blob`;if(t.startsWith(`text/`))return`text`}},xe=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,Se=async({security:e,...t})=>{for(let n of e){if(xe(t,n.name))continue;let e=await ve(n,t.auth);if(!e)continue;let r=n.name??`Authorization`;switch(n.in){case`query`:t.query||={},t.query[r]=e;break;case`cookie`:t.headers.append(`Cookie`,`${r}=${e}`);break;default:t.headers.set(r,e);break}}},Ce=e=>ge({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:ye(e.querySerializer),url:e.url}),we=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=Ee(e.headers,t.headers),n},Te=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},Ee=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?Te(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},De=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e==`number`?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}},Oe=()=>({error:new De,request:new De,response:new De}),ke=ye({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),Ae={"Content-Type":`application/json`},je=(e={})=>({...oe,headers:Ae,parseAs:`auto`,querySerializer:ke,...e}),Me=((e={})=>{let t=we(je(),e),n=()=>({...t}),r=e=>(t=we(t,e),n()),i=Oe(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:Ee(t.headers,e.headers),serializedBody:void 0};n.security&&await Se({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody===``)&&n.headers.delete(`Content-Type`);let r=n;return{opts:r,url:Ce(r)}},o=async e=>{let{opts:t,url:n}=await a(e),r={redirect:`follow`,...t,body:_e(t)},o=new Request(n,r);for(let e of i.request.fns)e&&(o=await e(o,t));let s=t.fetch,c;try{c=await s(o)}catch(e){let n=e;for(let r of i.error.fns)r&&(n=await r(e,void 0,o,t));if(n||={},t.throwOnError)throw n;return t.responseStyle===`data`?void 0:{error:n,request:o,response:void 0}}for(let e of i.response.fns)e&&(c=await e(c,o,t));let l={request:o,response:c};if(c.ok){let e=(t.parseAs===`auto`?be(c.headers.get(`Content-Type`)):t.parseAs)??`json`;if(c.status===204||c.headers.get(`Content-Length`)===`0`){let n;switch(e){case`arrayBuffer`:case`blob`:case`text`:n=await c[e]();break;case`formData`:n=new FormData;break;case`stream`:n=c.body;break;default:n={};break}return t.responseStyle===`data`?n:{data:n,...l}}let n;switch(e){case`arrayBuffer`:case`blob`:case`formData`:case`text`:n=await c[e]();break;case`json`:{let e=await c.text();n=e?JSON.parse(e):{};break}case`stream`:return t.responseStyle===`data`?c.body:{data:c.body,...l}}return e===`json`&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),t.responseStyle===`data`?n:{data:n,...l}}let u=await c.text(),d;try{d=JSON.parse(u)}catch{}let f=d??u,p=f;for(let e of i.error.fns)e&&(p=await e(f,c,o,t));if(p||={},t.throwOnError)throw p;return t.responseStyle===`data`?void 0:{error:p,...l}},s=e=>t=>o({...t,method:e}),c=e=>async t=>{let{opts:n,url:r}=await a(t);return se({...n,body:n.body,headers:n.headers,method:e,onRequest:async(e,t)=>{let r=new Request(e,t);for(let e of i.request.fns)e&&(r=await e(r,n));return r},serializedBody:_e(n),url:r})};return{buildUrl:e=>Ce({...t,...e}),connect:s(`CONNECT`),delete:s(`DELETE`),get:s(`GET`),getConfig:n,head:s(`HEAD`),interceptors:i,options:s(`OPTIONS`),patch:s(`PATCH`),post:s(`POST`),put:s(`PUT`),request:o,setConfig:r,sse:{connect:c(`CONNECT`),delete:c(`DELETE`),get:c(`GET`),head:c(`HEAD`),options:c(`OPTIONS`),patch:c(`PATCH`),post:c(`POST`),put:c(`PUT`),trace:c(`TRACE`)},trace:s(`TRACE`)}})(je({baseUrl:`http://localhost:9000/api/widget`}));function Ne(e,t){Me.setConfig({baseUrl:e,headers:t?{Authorization:`Bearer ${t}`}:void 0})}var Pe=e=>(e?.client??Me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads`,...e}),Fe=e=>(e.client??Me).post({security:[{scheme:`bearer`,type:`http`}],url:`/query-sql`,...e,headers:{"Content-Type":`application/json`,...e.headers}}),Ie=e=>(e.client??Me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/{threadUid}`,...e}),Le=e=>(e.client??Me).post({...ae,security:[{scheme:`bearer`,type:`http`}],url:`/attachments/upload`,...e,headers:{"Content-Type":null,...e.headers}}),Re=e=>(e.client??Me).get({security:[{scheme:`bearer`,type:`http`}],url:`/attachments/{filename}`,...e}),ze={upload:async(e,t,n)=>{let{data:r}=await Le({body:{file:e,prefix:t,ocr:n},throwOnError:!0});return r.data},download:async(e,t)=>{let n=e.split(`/`),r=n[n.length-1],i=n.slice(-3,-1).join(`/`),{data:a}=await Re({path:{filename:r},query:i?{prefix:i}:{},parseAs:`blob`,throwOnError:!0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}};function Be({onSend:e,inProgress:t,threadId:n}){let[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)([]),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(null),f=(0,u.useRef)(null),p=(0,u.useRef)(null),h=(0,u.useRef)(0);(0,u.useEffect)(()=>{let e=f.current;if(e){e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${t}px`}},[r]);async function g(e){let t=`${e.name}-${Date.now()}`;o(n=>[...n,{id:t,name:e.name,mimeType:e.type||`application/octet-stream`,status:`uploading`}]);try{let r=await ze.upload(e,`thread/${n||crypto.randomUUID()}`,!0);o(e=>e.map(e=>e.id===t?{...e,status:`done`,response:r}:e))}catch(e){let n=e instanceof Error?e.message:`Upload failed`;o(e=>e.map(e=>e.id===t?{...e,status:`error`,errorMessage:n}:e))}}function _(e){let t=e.target.files;if(!t||t.length===0)return;let n=new Set(a.map(e=>e.name));Array.from(t).filter(e=>!n.has(e.name)).forEach(g),e.target.value=``}function v(e){o(t=>t.filter(t=>t.id!==e))}async function y(e){if(e.response){d(e.id);try{await ze.download(e.response.file_path,e.response.original_name)}catch(t){console.error(`Download failed:`,t),alert(`Failed to download ${e.name}`)}finally{d(null)}}}function b(e){e.preventDefault(),h.current+=1,e.dataTransfer.types.includes(`Files`)&&c(!0)}function x(e){e.preventDefault(),--h.current,h.current===0&&c(!1)}function S(e){e.preventDefault()}function C(e){e.preventDefault(),h.current=0,c(!1);let t=Array.from(e.dataTransfer.files);if(t.length===0)return;let n=new Set(a.map(e=>e.name));t.filter(e=>!n.has(e.name)).forEach(g)}function w(){if(!r.trim()&&a.length===0)return;let t=a.filter(e=>e.status===`done`).filter(e=>e.response!==null).map(e=>e.response).map(({ocr_result:e,...t})=>({...t,ocr_result:e?.markdown_files})),n=r;t.length>0&&(n+=`\n\n\`\`\`attachments\n${JSON.stringify(t,null,2)}\n\`\`\``),e(n),i(``),o([])}function T(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())}function E(){f.current?.focus()}return(0,m.jsxs)(`div`,{className:`copilotKitInputContainer relative`,onDragEnter:b,onDragLeave:x,onDragOver:S,onDrop:C,children:[s&&(0,m.jsx)(`div`,{className:`erica-drag-overlay`,children:(0,m.jsx)(`p`,{className:`erica-drag-overlay-text`,children:`Drop files to attach`})}),a.length>0&&(0,m.jsx)(`div`,{className:`erica-file-list`,children:a.map(e=>(0,m.jsxs)(`div`,{className:`erica-file-item ${e.status===`error`?`erica-file-item--error`:e.status===`done`?`erica-file-item--done`:`erica-file-item--uploading`}`,children:[(0,m.jsxs)(`div`,{className:`erica-file-content ${e.status===`done`?`erica-file-content--clickable`:``}`,onClick:()=>e.status===`done`&&y(e),role:e.status===`done`?`button`:void 0,tabIndex:e.status===`done`?0:void 0,children:[e.status===`uploading`?(0,m.jsx)(`div`,{className:`erica-spinner erica-spinner--gray`}):l===e.id?(0,m.jsx)(`div`,{className:`erica-spinner erica-spinner--green`}):e.status===`done`?(0,m.jsx)(te,{className:`erica-icon-sm erica-icon-green`}):(0,m.jsx)(te,{className:`erica-icon-sm erica-icon-red`}),(0,m.jsxs)(`div`,{className:`erica-file-info`,children:[(0,m.jsxs)(`div`,{className:`erica-file-name ${e.status===`error`?`erica-file-name--error`:e.status===`done`?`erica-file-name--done`:`erica-file-name--uploading`}`,children:[e.name,l===e.id&&(0,m.jsx)(`span`,{className:`erica-downloading-badge`,children:`Downloading...`})]}),(0,m.jsxs)(`div`,{className:`erica-file-status`,children:[e.status===`uploading`&&`Uploading...`,e.status===`done`&&`Ready · Click to download`,e.status===`error`&&(e.errorMessage||`Upload failed`)]})]}),e.status===`done`&&!l&&(0,m.jsx)(ee,{className:`erica-download-icon`})]}),(0,m.jsx)(`button`,{onClick:t=>{t.stopPropagation(),v(e.id)},disabled:e.status===`uploading`,className:`erica-remove-button`,"aria-label":`Remove ${e.name}`,children:(0,m.jsx)(re,{className:`erica-icon-sm erica-icon-gray`})})]},e.id))}),(0,m.jsxs)(`div`,{className:`copilotKitInput`,onClick:E,children:[(0,m.jsx)(`textarea`,{ref:f,value:r,onChange:e=>i(e.target.value),onKeyDown:T,placeholder:a.length>0?`Ask about ${a.length} file${a.length>1?`s`:``}...`:`Type a message or attach files...`,className:`erica-textarea`,rows:1,disabled:t}),(0,m.jsxs)(`div`,{className:`copilotKitInputControls`,children:[(0,m.jsx)(`input`,{ref:p,type:`file`,onChange:_,className:`erica-file-input`,disabled:t,multiple:!0}),(0,m.jsx)(`button`,{onClick:()=>p.current?.click(),disabled:t,className:`copilotKitInputControlButton erica-attach-button`,"aria-label":`Attach files`,title:`Attach files (drag & drop supported)`,children:(0,m.jsx)(te,{className:`erica-icon-md`})}),(0,m.jsx)(`div`,{className:`erica-spacer`}),(0,m.jsx)(`button`,{onClick:w,disabled:t||!r.trim()&&a.filter(e=>e.status===`done`).length===0,"data-copilotkit-in-progress":t,className:`copilotKitInputControlButton`,children:(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:`1.5`,stroke:`currentColor`,width:`24`,height:`24`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 19V5m0 0l-7 7m7-7l7 7`})})})]})]})]})}var Ve=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},He=new class extends Ve{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ue={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},We=new class{#e=Ue;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!==`production`&&this.#t&&e!==this.#e&&console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!==`production`&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ge(e){setTimeout(e,0)}var Ke=typeof window>`u`||`Deno`in globalThis;function O(){}function qe(e,t){return typeof e==`function`?e(t):e}function Je(e){return typeof e==`number`&&e>=0&&e!==1/0}function Ye(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xe(e,t){return typeof e==`function`?e(t):e}function Ze(e,t){return typeof e==`function`?e(t):e}function Qe(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==et(o,t.options))return!1}else if(!nt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function $e(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(tt(t.options.mutationKey)!==tt(a))return!1}else if(!nt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function et(e,t){return(t?.queryKeyHashFn||tt)(e)}function tt(e){return JSON.stringify(e,(e,t)=>st(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function nt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>nt(e[n],t[n])):!1}var rt=Object.prototype.hasOwnProperty;function it(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ot(e)&&ot(t);if(!r&&!(st(e)&&st(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:rt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=it(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function at(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ot(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function st(e){if(!ct(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ct(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ct(e){return Object.prototype.toString.call(e)===`[object Object]`}function lt(e){return new Promise(t=>{We.setTimeout(t,e)})}function ut(e,t,n){if(typeof n.structuralSharing==`function`)return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!==`production`)try{return it(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return it(e,t)}return t}function dt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ft(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pt=Symbol();function mt(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn===pt&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ht(e,t){return typeof e==`function`?e(...t):!!e}function gt(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var _t=(()=>{let e=()=>Ke;return{isServer(){return e()},setIsServer(t){e=t}}})();function vt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var yt=Ge;function bt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=yt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=bt(),xt=new class extends Ve{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function St(e){return Math.min(1e3*2**e,3e4)}function Ct(e){return(e??`online`)===`online`?xt.isOnline():!0}var wt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Tt(e){let t=!1,n=0,r,i=vt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new wt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>He.isFocused()&&(e.networkMode===`always`||xt.isOnline())&&e.canRun(),u=()=>Ct(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(_t.isServer()?0:3),o=e.retryDelay??St,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),lt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Et=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Je(this.gcTime)&&(this.#e=We.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_t.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(We.clearTimeout(this.#e),this.#e=void 0)}},Dt=class extends Et{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=At(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=At(this.options);e.data!==void 0&&(this.setState(kt(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=ut(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ze(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Xe(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Ye(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}process.env.NODE_ENV!==`production`&&(Array.isArray(this.options.queryKey)||console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`));let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=mt(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Tt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof wt&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw process.env.NODE_ENV!==`production`&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof wt){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ot(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...kt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),k.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Ot(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ct(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function kt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function At(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var jt=class extends Ve{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=vt(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Nt(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ze(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!at(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ft(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ze(this.options.enabled,this.#t)!==Ze(t.enabled,this.#t)||Xe(this.options.staleTime,this.#t)!==Xe(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ze(this.options.enabled,this.#t)!==Ze(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Lt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(O)),t}#g(){this.#b();let e=Xe(this.options.staleTime,this.#t);if(_t.isServer()||this.#r.isStale||!Je(e))return;let t=Ye(this.#r.dataUpdatedAt,e)+1;this.#d=We.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(_t.isServer()||Ze(this.options.enabled,this.#t)===!1||!Je(this.#p)||this.#p===0)&&(this.#f=We.setInterval(()=>{(this.options.refetchIntervalInBackground||He.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(We.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(We.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Nt(e,t),o=i&&Ft(e,n,t,r);(a||o)&&(l={...l,...Ot(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ut(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ut(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:It(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ze(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=vt())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!at(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){k.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Mt(e,t){return Ze(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Nt(e,t){return Mt(e,t)||e.state.data!==void 0&&Pt(e,t,t.refetchOnMount)}function Pt(e,t,n){if(Ze(t.enabled,e)!==!1&&Xe(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&It(e,t)}return!1}function Ft(e,t,n,r){return(e!==t||Ze(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&It(e,n)}function It(e,t){return Ze(t.enabled,e)!==!1&&e.isStaleByTime(Xe(t.staleTime,e))}function Lt(e,t){return!at(e.getCurrentResult(),t)}function Rt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{gt(e,()=>t.signal,()=>n=!0)},u=mt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ft:dt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Bt:zt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:zt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function zt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Bt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Vt=class extends Et{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ht(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Tt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ht(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ut=class extends Ve{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Vt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Wt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Wt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Wt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Wt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){k.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>$e(t,e))}findAll(e={}){return this.getAll().filter(t=>$e(e,t))}notify(e){k.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return k.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function Wt(e){return e.options.scope?.id}var Gt=class extends Ve{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??et(r,t),a=this.get(i);return a||(a=new Dt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){k.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Qe(e,t)):t}notify(e){k.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){k.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){k.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Kt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Gt,this.#t=e.mutationCache||new Ut,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=He.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=qe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return k.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;k.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return k.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=k.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return k.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=k.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e.behavior=Rt(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e.behavior=Rt(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(tt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{nt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(tt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{nt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=et(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===pt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},qt=u.createContext(void 0),Jt=e=>{let t=u.useContext(qt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Yt=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,m.jsx)(qt.Provider,{value:e,children:t})),Xt=u.createContext(!1),Zt=()=>u.useContext(Xt);Xt.Provider;function Qt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $t=u.createContext(Qt()),en=()=>u.useContext($t),tn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ht(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},nn=e=>{u.useEffect(()=>{e.clearReset()},[e])},rn=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ht(n,[e.error,r])),an=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},on=(e,t)=>e.isLoading&&e.isFetching&&!t,sn=(e,t)=>e?.suspense&&t.isPending,cn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ln(e,t,n){if(process.env.NODE_ENV!==`production`&&(typeof e!=`object`||Array.isArray(e)))throw Error(`Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object`);let r=Zt(),i=en(),a=Jt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);process.env.NODE_ENV!==`production`&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=r?`isRestoring`:`optimistic`,an(o),tn(o,i,s),nn(i);let c=!a.getQueryCache().get(o.queryHash),[l]=u.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(u.useSyncExternalStore(u.useCallback(e=>{let t=f?l.subscribe(k.batchCalls(e)):O;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u.useEffect(()=>{l.setOptions(o)},[o,l]),sn(o,d))throw cn(o,l,i);if(rn({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!_t.isServer()&&on(d,r)&&(c?cn(o,l,i):s?.promise)?.catch(O).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}function un(e,t){return ln(e,jt,t)}var dn={list:async(e=15)=>{let{data:t}=await Pe({query:{page:1,page_size:e},throwOnError:!0});return t.data??[]},get:async e=>{let{data:t}=await Ie({path:{threadUid:e},throwOnError:!0});return t.data}},fn={all:()=>[`widget-threads`],detail:e=>[`widget-threads`,e]},pn=(e=15)=>un({queryKey:fn.all(),queryFn:()=>dn.list(e),staleTime:15e3,refetchOnWindowFocus:!0});function mn(e){if(!e)return``;let t=e.split(`:`);return(t.length>1?t.slice(1).join(` `):e).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function hn(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function gn({onNewChat:e,onThreadSelect:t}){let[n,r]=(0,u.useState)(!1),i=(0,u.useRef)(null);(0,f.useCopilotChatConfiguration)();let{data:a=[],isLoading:o}=pn();(0,u.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&r(!1)}if(n)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]);function s(e){r(!1),t?.(e)}return(0,m.jsxs)(`div`,{className:`erica-header`,children:[(0,m.jsx)(`h2`,{className:`erica-header-title`,children:`Erica Assistant`}),(0,m.jsxs)(`div`,{className:`erica-header-controls`,ref:i,children:[(0,m.jsx)(`button`,{onClick:e,className:`erica-new-chat-button`,title:`Start new chat`,children:(0,m.jsx)(ne,{className:`erica-icon-sm`})}),(0,m.jsxs)(`button`,{onClick:()=>r(!n),className:`erica-threads-toggle`,title:`Recent threads`,children:[(0,m.jsxs)(`span`,{className:`erica-threads-toggle-text`,children:[`Threads `,a.length>0&&`(${a.length})`]}),(0,m.jsx)(E,{className:`erica-threads-toggle-icon ${n?`erica-threads-toggle-icon--open`:``}`})]}),n&&(0,m.jsx)(`div`,{className:`erica-threads-dropdown`,children:(0,m.jsxs)(`div`,{className:`erica-threads-dropdown-content`,children:[(0,m.jsx)(`div`,{className:`erica-threads-dropdown-header`,children:`Recent Threads`}),o&&(0,m.jsx)(`div`,{className:`erica-threads-empty`,children:`Loading threads...`}),!o&&a.length===0&&(0,m.jsx)(`div`,{className:`erica-threads-empty`,children:`No conversations yet`}),!o&&a.map(e=>{let t=mn(e.agent),n=hn(e.last_run_at??e.created_at);return(0,m.jsx)(`button`,{onClick:()=>s(e.uid),className:`erica-thread-item`,children:(0,m.jsxs)(`div`,{className:`erica-thread-item-content`,children:[(0,m.jsx)(`span`,{className:`erica-thread-title`,children:typeof e.thread_metadata?.title==`string`?e.thread_metadata.title:e.last_message??`New conversation`}),(0,m.jsxs)(`div`,{className:`erica-thread-meta`,children:[t&&(0,m.jsx)(`span`,{className:`erica-thread-agent`,children:t}),n&&(0,m.jsx)(`span`,{className:`erica-thread-time`,children:n})]})]})},e.uid)})]})})]})]})}Object.freeze({status:`aborted`});function A(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var _n=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},vn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},yn={};function bn(e){return e&&Object.assign(yn,e),yn}function xn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Sn(e,t){return typeof t==`bigint`?t.toString():t}function Cn(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function wn(e){return e==null}function Tn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var En=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==En)return r===void 0&&(r=En,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function On(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function kn(e){return JSON.stringify(e)}function An(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var jn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Mn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Nn=Cn(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Pn(e){if(Mn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Mn(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Fn(e){return Pn(e)?{...e}:Array.isArray(e)?[...e]:e}var In=new Set([`string`,`number`,`symbol`]);function Ln(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Rn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function zn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Bn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Rn(e,On(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Dn(this,`shape`,e),e},checks:[]}))}function Vn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Rn(e,On(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Dn(this,`shape`,r),r},checks:[]}))}function Hn(e,t){if(!Pn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Rn(e,On(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Dn(this,`shape`,n),n}}))}function Un(e,t){if(!Pn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Rn(e,On(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Dn(this,`shape`,n),n}}))}function Wn(e,t){return Rn(e,On(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Dn(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Gn(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Rn(t,On(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Dn(this,`shape`,i),i},checks:[]}))}function Kn(e,t,n){return Rn(t,On(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Dn(this,`shape`,i),i}}))}function qn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Jn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Yn(e){return typeof e==`string`?e:e?.message}function Xn(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Yn(e.inst?._zod.def?.error?.(e))??Yn(t?.error?.(e))??Yn(n.customError?.(e))??Yn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Zn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Qn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var $n=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Sn,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},er=A(`$ZodError`,$n),tr=A(`$ZodError`,$n,{Parent:Error});function nr(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function rr(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var ir=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new _n;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Xn(e,a,bn())));throw jn(t,i?.callee),t}return o.value},ar=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Xn(e,a,bn())));throw jn(t,i?.callee),t}return o.value},or=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new _n;return a.issues.length?{success:!1,error:new(e??er)(a.issues.map(e=>Xn(e,i,bn())))}:{success:!0,data:a.value}},sr=or(tr),cr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Xn(e,i,bn())))}:{success:!0,data:a.value}},lr=cr(tr),ur=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ir(e)(t,n,i)},dr=e=>(t,n,r)=>ir(e)(t,n,r),fr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ar(e)(t,n,i)},pr=e=>async(t,n,r)=>ar(e)(t,n,r),mr=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return or(e)(t,n,i)},hr=e=>(t,n,r)=>or(e)(t,n,r),gr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return cr(e)(t,n,i)},_r=e=>async(t,n,r)=>cr(e)(t,n,r),vr=/^[cC][^\s-]{8,}$/,yr=/^[0-9a-z]+$/,br=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xr=/^[0-9a-vA-V]{20}$/,Sr=/^[A-Za-z0-9]{27}$/,Cr=/^[a-zA-Z0-9_-]{21}$/,wr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Tr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Er=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Dr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Or=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function kr(){return new RegExp(Or,`u`)}var Ar=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Mr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Nr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fr=/^[A-Za-z0-9_-]*$/,Ir=/^\+[1-9]\d{6,14}$/,Lr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Rr=RegExp(`^${Lr}$`);function zr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Br(e){return RegExp(`^${zr(e)}$`)}function Vr(e){let t=zr({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Lr}T(?:${r})$`)}var Hr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ur=/^[^A-Z]*$/,Wr=/^[^a-z]*$/,Gr=A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Kr=A(`$ZodCheckMaxLength`,(e,t)=>{var n;Gr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Zn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qr=A(`$ZodCheckMinLength`,(e,t)=>{var n;Gr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Zn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jr=A(`$ZodCheckLengthEquals`,(e,t)=>{var n;Gr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Zn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yr=A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Gr.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xr=A(`$ZodCheckRegex`,(e,t)=>{Yr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zr=A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ur,Yr.init(e,t)}),Qr=A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Wr,Yr.init(e,t)}),$r=A(`$ZodCheckIncludes`,(e,t)=>{Gr.init(e,t);let n=Ln(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ei=A(`$ZodCheckStartsWith`,(e,t)=>{Gr.init(e,t);let n=RegExp(`^${Ln(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ti=A(`$ZodCheckEndsWith`,(e,t)=>{Gr.init(e,t);let n=RegExp(`.*${Ln(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ni=A(`$ZodCheckOverwrite`,(e,t)=>{Gr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ri=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
6
|
+
`);try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:o,id:d,retry:c}),a.length&&(yield s)}}}finally{m.removeEventListener(`abort`,h),f.releaseLock()}break}catch(e){if(t?.(e),o!==void 0&&p>=o)break;await f(Math.min(c*2**(p-1),s??3e4))}}}()}}var ce=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},le=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},ue=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},de=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(le(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=ce(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):fe({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},fe=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},pe=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=ue(r),s=Object.entries(i).map(([t,i])=>fe({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},me=/\{[^{}]+\}/g,he=({path:e,url:t})=>{let n=t,r=t.match(me);if(r)for(let t of r){let r=!1,i=t.substring(1,t.length-1),a=`simple`;i.endsWith(`*`)&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(`.`)?(i=i.substring(1),a=`label`):i.startsWith(`;`)&&(i=i.substring(1),a=`matrix`);let o=e[i];if(o==null)continue;if(Array.isArray(o)){n=n.replace(t,de({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,pe({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${fe({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},ge=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=he({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function _e(e){let t=e.body!==void 0;if(t&&e.bodySerializer)return`serializedBody`in e?e.serializedBody!==void 0&&e.serializedBody!==``?e.serializedBody:null:e.body===``?null:e.body;if(t)return e.body}var ve=async(e,t)=>{let n=typeof t==`function`?await t(e):t;if(n)return e.scheme===`bearer`?`Bearer ${n}`:e.scheme===`basic`?`Basic ${btoa(n)}`:n},ye=({parameters:e={},...t}={})=>n=>{let r=[];if(n&&typeof n==`object`)for(let i in n){let a=n[i];if(a==null)continue;let o=e[i]||t;if(Array.isArray(a)){let e=de({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=pe({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=fe({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},be=e=>{if(!e)return`stream`;let t=e.split(`;`)[0]?.trim();if(t){if(t.startsWith(`application/json`)||t.endsWith(`+json`))return`json`;if(t===`multipart/form-data`)return`formData`;if([`application/`,`audio/`,`image/`,`video/`].some(e=>t.startsWith(e)))return`blob`;if(t.startsWith(`text/`))return`text`}},xe=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,Se=async({security:e,...t})=>{for(let n of e){if(xe(t,n.name))continue;let e=await ve(n,t.auth);if(!e)continue;let r=n.name??`Authorization`;switch(n.in){case`query`:t.query||={},t.query[r]=e;break;case`cookie`:t.headers.append(`Cookie`,`${r}=${e}`);break;default:t.headers.set(r,e);break}}},Ce=e=>ge({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:ye(e.querySerializer),url:e.url}),we=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=Ee(e.headers,t.headers),n},Te=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},Ee=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?Te(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},De=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e==`number`?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}},Oe=()=>({error:new De,request:new De,response:new De}),ke=ye({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),Ae={"Content-Type":`application/json`},je=(e={})=>({...oe,headers:Ae,parseAs:`auto`,querySerializer:ke,...e}),Me=((e={})=>{let t=we(je(),e),n=()=>({...t}),r=e=>(t=we(t,e),n()),i=Oe(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:Ee(t.headers,e.headers),serializedBody:void 0};n.security&&await Se({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody===``)&&n.headers.delete(`Content-Type`);let r=n;return{opts:r,url:Ce(r)}},o=async e=>{let{opts:t,url:n}=await a(e),r={redirect:`follow`,...t,body:_e(t)},o=new Request(n,r);for(let e of i.request.fns)e&&(o=await e(o,t));let s=t.fetch,c;try{c=await s(o)}catch(e){let n=e;for(let r of i.error.fns)r&&(n=await r(e,void 0,o,t));if(n||={},t.throwOnError)throw n;return t.responseStyle===`data`?void 0:{error:n,request:o,response:void 0}}for(let e of i.response.fns)e&&(c=await e(c,o,t));let l={request:o,response:c};if(c.ok){let e=(t.parseAs===`auto`?be(c.headers.get(`Content-Type`)):t.parseAs)??`json`;if(c.status===204||c.headers.get(`Content-Length`)===`0`){let n;switch(e){case`arrayBuffer`:case`blob`:case`text`:n=await c[e]();break;case`formData`:n=new FormData;break;case`stream`:n=c.body;break;default:n={};break}return t.responseStyle===`data`?n:{data:n,...l}}let n;switch(e){case`arrayBuffer`:case`blob`:case`formData`:case`text`:n=await c[e]();break;case`json`:{let e=await c.text();n=e?JSON.parse(e):{};break}case`stream`:return t.responseStyle===`data`?c.body:{data:c.body,...l}}return e===`json`&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),t.responseStyle===`data`?n:{data:n,...l}}let u=await c.text(),d;try{d=JSON.parse(u)}catch{}let f=d??u,p=f;for(let e of i.error.fns)e&&(p=await e(f,c,o,t));if(p||={},t.throwOnError)throw p;return t.responseStyle===`data`?void 0:{error:p,...l}},s=e=>t=>o({...t,method:e}),c=e=>async t=>{let{opts:n,url:r}=await a(t);return se({...n,body:n.body,headers:n.headers,method:e,onRequest:async(e,t)=>{let r=new Request(e,t);for(let e of i.request.fns)e&&(r=await e(r,n));return r},serializedBody:_e(n),url:r})};return{buildUrl:e=>Ce({...t,...e}),connect:s(`CONNECT`),delete:s(`DELETE`),get:s(`GET`),getConfig:n,head:s(`HEAD`),interceptors:i,options:s(`OPTIONS`),patch:s(`PATCH`),post:s(`POST`),put:s(`PUT`),request:o,setConfig:r,sse:{connect:c(`CONNECT`),delete:c(`DELETE`),get:c(`GET`),head:c(`HEAD`),options:c(`OPTIONS`),patch:c(`PATCH`),post:c(`POST`),put:c(`PUT`),trace:c(`TRACE`)},trace:s(`TRACE`)}})(je({baseUrl:`http://localhost:9000/api/widget`}));function Ne(e,t){Me.setConfig({baseUrl:e,headers:t?{Authorization:`Bearer ${t}`}:void 0})}var Pe=e=>(e?.client??Me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads`,...e}),Fe=e=>(e.client??Me).post({security:[{scheme:`bearer`,type:`http`}],url:`/query-sql`,...e,headers:{"Content-Type":`application/json`,...e.headers}}),Ie=e=>(e.client??Me).get({security:[{scheme:`bearer`,type:`http`}],url:`/threads/{threadUid}`,...e}),Le=e=>(e.client??Me).post({...ae,security:[{scheme:`bearer`,type:`http`}],url:`/attachments/upload`,...e,headers:{"Content-Type":null,...e.headers}}),Re=e=>(e.client??Me).get({security:[{scheme:`bearer`,type:`http`}],url:`/attachments/{filename}`,...e}),ze={upload:async(e,t,n)=>{let{data:r}=await Le({body:{file:e,prefix:t,ocr:n},throwOnError:!0});return r.data},download:async(e,t)=>{let n=e.split(`/`),r=n[n.length-1],i=n.slice(-3,-1).join(`/`),{data:a}=await Re({path:{filename:r},query:i?{prefix:i}:{},parseAs:`blob`,throwOnError:!0}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}};function Be({onSend:e,inProgress:t,threadId:n}){let[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)([]),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(null),f=(0,u.useRef)(null),p=(0,u.useRef)(null),h=(0,u.useRef)(0);(0,u.useEffect)(()=>{let e=f.current;if(e){e.style.height=`auto`;let t=e.scrollHeight;e.style.height=`${t}px`}},[r]);async function g(e){let t=`${e.name}-${Date.now()}`;o(n=>[...n,{id:t,name:e.name,mimeType:e.type||`application/octet-stream`,status:`uploading`}]);try{let r=await ze.upload(e,`thread/${n||crypto.randomUUID()}`,!0);o(e=>e.map(e=>e.id===t?{...e,status:`done`,response:r}:e))}catch(e){let n=e instanceof Error?e.message:`Upload failed`;o(e=>e.map(e=>e.id===t?{...e,status:`error`,errorMessage:n}:e))}}function _(e){let t=e.target.files;if(!t||t.length===0)return;let n=new Set(a.map(e=>e.name));Array.from(t).filter(e=>!n.has(e.name)).forEach(g),e.target.value=``}function v(e){o(t=>t.filter(t=>t.id!==e))}async function y(e){if(e.response){d(e.id);try{await ze.download(e.response.file_path,e.response.original_name)}catch(t){console.error(`Download failed:`,t),alert(`Failed to download ${e.name}`)}finally{d(null)}}}function b(e){e.preventDefault(),h.current+=1,e.dataTransfer.types.includes(`Files`)&&c(!0)}function x(e){e.preventDefault(),--h.current,h.current===0&&c(!1)}function S(e){e.preventDefault()}function C(e){e.preventDefault(),h.current=0,c(!1);let t=Array.from(e.dataTransfer.files);if(t.length===0)return;let n=new Set(a.map(e=>e.name));t.filter(e=>!n.has(e.name)).forEach(g)}function w(){if(!r.trim()&&a.length===0)return;let t=a.filter(e=>e.status===`done`).filter(e=>e.response!==null).map(e=>e.response).map(({ocr_result:e,...t})=>({...t,ocr_result:e?.markdown_files})),n=r;t.length>0&&(n+=`\n\n\`\`\`attachments\n${JSON.stringify(t,null,2)}\n\`\`\``),e(n),i(``),o([])}function T(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())}function E(){f.current?.focus()}return(0,m.jsxs)(`div`,{className:`copilotKitInputContainer relative`,onDragEnter:b,onDragLeave:x,onDragOver:S,onDrop:C,children:[s&&(0,m.jsx)(`div`,{className:`erica-drag-overlay`,children:(0,m.jsx)(`p`,{className:`erica-drag-overlay-text`,children:`Drop files to attach`})}),a.length>0&&(0,m.jsx)(`div`,{className:`erica-file-list`,children:a.map(e=>(0,m.jsxs)(`div`,{className:`erica-file-item ${e.status===`error`?`erica-file-item--error`:e.status===`done`?`erica-file-item--done`:`erica-file-item--uploading`}`,children:[(0,m.jsxs)(`div`,{className:`erica-file-content ${e.status===`done`?`erica-file-content--clickable`:``}`,onClick:()=>e.status===`done`&&y(e),role:e.status===`done`?`button`:void 0,tabIndex:e.status===`done`?0:void 0,children:[e.status===`uploading`?(0,m.jsx)(`div`,{className:`erica-spinner erica-spinner--gray`}):l===e.id?(0,m.jsx)(`div`,{className:`erica-spinner erica-spinner--green`}):e.status===`done`?(0,m.jsx)(te,{className:`erica-icon-sm erica-icon-green`}):(0,m.jsx)(te,{className:`erica-icon-sm erica-icon-red`}),(0,m.jsxs)(`div`,{className:`erica-file-info`,children:[(0,m.jsxs)(`div`,{className:`erica-file-name ${e.status===`error`?`erica-file-name--error`:e.status===`done`?`erica-file-name--done`:`erica-file-name--uploading`}`,children:[e.name,l===e.id&&(0,m.jsx)(`span`,{className:`erica-downloading-badge`,children:`Downloading...`})]}),(0,m.jsxs)(`div`,{className:`erica-file-status`,children:[e.status===`uploading`&&`Uploading...`,e.status===`done`&&`Ready · Click to download`,e.status===`error`&&(e.errorMessage||`Upload failed`)]})]}),e.status===`done`&&!l&&(0,m.jsx)(ee,{className:`erica-download-icon`})]}),(0,m.jsx)(`button`,{onClick:t=>{t.stopPropagation(),v(e.id)},disabled:e.status===`uploading`,className:`erica-remove-button`,"aria-label":`Remove ${e.name}`,children:(0,m.jsx)(re,{className:`erica-icon-sm erica-icon-gray`})})]},e.id))}),(0,m.jsxs)(`div`,{className:`copilotKitInput`,onClick:E,children:[(0,m.jsx)(`textarea`,{ref:f,value:r,onChange:e=>i(e.target.value),onKeyDown:T,placeholder:a.length>0?`Ask about ${a.length} file${a.length>1?`s`:``}...`:`Type a message or attach files...`,className:`erica-textarea`,rows:1,disabled:t}),(0,m.jsxs)(`div`,{className:`copilotKitInputControls`,children:[(0,m.jsx)(`input`,{ref:p,type:`file`,onChange:_,className:`erica-file-input`,disabled:t,multiple:!0}),(0,m.jsx)(`div`,{className:`erica-spacer`}),(0,m.jsx)(`button`,{onClick:w,disabled:t||!r.trim()&&a.filter(e=>e.status===`done`).length===0,"data-copilotkit-in-progress":t,className:`copilotKitInputControlButton`,children:(0,m.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:`1.5`,stroke:`currentColor`,width:`24`,height:`24`,children:(0,m.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 19V5m0 0l-7 7m7-7l7 7`})})})]})]}),(0,m.jsx)(`div`,{className:`erica-input-disclaimer`,children:`AI dapat membuat kesalahan. Harap verifikasi informasi penting.`})]})}var Ve=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},He=new class extends Ve{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ue={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},We=new class{#e=Ue;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!==`production`&&this.#t&&e!==this.#e&&console.error(`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!==`production`&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!==`production`&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ge(e){setTimeout(e,0)}var Ke=typeof window>`u`||`Deno`in globalThis;function O(){}function qe(e,t){return typeof e==`function`?e(t):e}function Je(e){return typeof e==`number`&&e>=0&&e!==1/0}function Ye(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Xe(e,t){return typeof e==`function`?e(t):e}function Ze(e,t){return typeof e==`function`?e(t):e}function Qe(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==et(o,t.options))return!1}else if(!nt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function $e(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(tt(t.options.mutationKey)!==tt(a))return!1}else if(!nt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function et(e,t){return(t?.queryKeyHashFn||tt)(e)}function tt(e){return JSON.stringify(e,(e,t)=>st(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function nt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>nt(e[n],t[n])):!1}var rt=Object.prototype.hasOwnProperty;function it(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ot(e)&&ot(t);if(!r&&!(st(e)&&st(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:rt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=it(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function at(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ot(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function st(e){if(!ct(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ct(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ct(e){return Object.prototype.toString.call(e)===`[object Object]`}function lt(e){return new Promise(t=>{We.setTimeout(t,e)})}function ut(e,t,n){if(typeof n.structuralSharing==`function`)return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!==`production`)try{return it(e,t)}catch(e){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${e}`),e}return it(e,t)}return t}function dt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ft(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pt=Symbol();function mt(e,t){return process.env.NODE_ENV!==`production`&&e.queryFn===pt&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===pt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ht(e,t){return typeof e==`function`?e(...t):!!e}function gt(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var _t=(()=>{let e=()=>Ke;return{isServer(){return e()},setIsServer(t){e=t}}})();function vt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var yt=Ge;function bt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=yt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=bt(),xt=new class extends Ve{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function St(e){return Math.min(1e3*2**e,3e4)}function Ct(e){return(e??`online`)===`online`?xt.isOnline():!0}var wt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Tt(e){let t=!1,n=0,r,i=vt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new wt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>He.isFocused()&&(e.networkMode===`always`||xt.isOnline())&&e.canRun(),u=()=>Ct(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(_t.isServer()?0:3),o=e.retryDelay??St,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),lt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Et=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Je(this.gcTime)&&(this.#e=We.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(_t.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(We.clearTimeout(this.#e),this.#e=void 0)}},Dt=class extends Et{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=At(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=At(this.options);e.data!==void 0&&(this.setState(kt(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=ut(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(O).catch(O):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ze(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Xe(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Ye(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}process.env.NODE_ENV!==`production`&&(Array.isArray(this.options.queryKey)||console.error(`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`));let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=mt(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=Tt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof wt&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw process.env.NODE_ENV!==`production`&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof wt){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ot(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...kt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),k.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Ot(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ct(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function kt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function At(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var jt=class extends Ve{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=vt(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Nt(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ze(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!at(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ft(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ze(this.options.enabled,this.#t)!==Ze(t.enabled,this.#t)||Xe(this.options.staleTime,this.#t)!==Xe(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ze(this.options.enabled,this.#t)!==Ze(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Lt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(O)),t}#g(){this.#b();let e=Xe(this.options.staleTime,this.#t);if(_t.isServer()||this.#r.isStale||!Je(e))return;let t=Ye(this.#r.dataUpdatedAt,e)+1;this.#d=We.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(_t.isServer()||Ze(this.options.enabled,this.#t)===!1||!Je(this.#p)||this.#p===0)&&(this.#f=We.setInterval(()=>{(this.options.refetchIntervalInBackground||He.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(We.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(We.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Nt(e,t),o=i&&Ft(e,n,t,r);(a||o)&&(l={...l,...Ot(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ut(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ut(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:It(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ze(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=vt())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!at(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){k.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Mt(e,t){return Ze(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Nt(e,t){return Mt(e,t)||e.state.data!==void 0&&Pt(e,t,t.refetchOnMount)}function Pt(e,t,n){if(Ze(t.enabled,e)!==!1&&Xe(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&It(e,t)}return!1}function Ft(e,t,n,r){return(e!==t||Ze(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&It(e,n)}function It(e,t){return Ze(t.enabled,e)!==!1&&e.isStaleByTime(Xe(t.staleTime,e))}function Lt(e,t){return!at(e.getCurrentResult(),t)}function Rt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{gt(e,()=>t.signal,()=>n=!0)},u=mt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ft:dt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Bt:zt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:zt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function zt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Bt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Vt=class extends Et{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ht(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Tt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ht(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ut=class extends Ve{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Vt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Wt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Wt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Wt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Wt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){k.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>$e(t,e))}findAll(e={}){return this.getAll().filter(t=>$e(e,t))}notify(e){k.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return k.batch(()=>Promise.all(e.map(e=>e.continue().catch(O))))}};function Wt(e){return e.options.scope?.id}var Gt=class extends Ve{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??et(r,t),a=this.get(i);return a||(a=new Dt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){k.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Qe(e,t)):t}notify(e){k.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){k.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){k.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Kt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Gt,this.#t=e.mutationCache||new Ut,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=He.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Xe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=qe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return k.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;k.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return k.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=k.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(O).catch(O)}invalidateQueries(e,t={}){return k.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=k.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(O)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(O)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Xe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(O).catch(O)}fetchInfiniteQuery(e){return e.behavior=Rt(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(O).catch(O)}ensureInfiniteQueryData(e){return e.behavior=Rt(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(tt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{nt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(tt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{nt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=et(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===pt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},qt=u.createContext(void 0),Jt=e=>{let t=u.useContext(qt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Yt=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,m.jsx)(qt.Provider,{value:e,children:t})),Xt=u.createContext(!1),Zt=()=>u.useContext(Xt);Xt.Provider;function Qt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $t=u.createContext(Qt()),en=()=>u.useContext($t),tn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ht(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},nn=e=>{u.useEffect(()=>{e.clearReset()},[e])},rn=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ht(n,[e.error,r])),an=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},on=(e,t)=>e.isLoading&&e.isFetching&&!t,sn=(e,t)=>e?.suspense&&t.isPending,cn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ln(e,t,n){if(process.env.NODE_ENV!==`production`&&(typeof e!=`object`||Array.isArray(e)))throw Error(`Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object`);let r=Zt(),i=en(),a=Jt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);process.env.NODE_ENV!==`production`&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=r?`isRestoring`:`optimistic`,an(o),tn(o,i,s),nn(i);let c=!a.getQueryCache().get(o.queryHash),[l]=u.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(u.useSyncExternalStore(u.useCallback(e=>{let t=f?l.subscribe(k.batchCalls(e)):O;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u.useEffect(()=>{l.setOptions(o)},[o,l]),sn(o,d))throw cn(o,l,i);if(rn({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!_t.isServer()&&on(d,r)&&(c?cn(o,l,i):s?.promise)?.catch(O).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}function un(e,t){return ln(e,jt,t)}var dn={list:async(e=15)=>{let{data:t}=await Pe({query:{page:1,page_size:e},throwOnError:!0});return t.data??[]},get:async e=>{let{data:t}=await Ie({path:{threadUid:e},throwOnError:!0});return t.data}},fn={all:()=>[`widget-threads`],detail:e=>[`widget-threads`,e]},pn=(e=15)=>un({queryKey:fn.all(),queryFn:()=>dn.list(e),staleTime:15e3,refetchOnWindowFocus:!0});function mn(e){if(!e)return``;let t=e.split(`:`);return(t.length>1?t.slice(1).join(` `):e).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function hn(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4),r=Math.floor(n/60),i=Math.floor(r/24);return n<1?`just now`:n<60?`${n}m ago`:r<24?`${r}h ago`:i<7?`${i}d ago`:new Date(e).toLocaleDateString()}function gn({onNewChat:e,onThreadSelect:t}){let[n,r]=(0,u.useState)(!1),i=(0,u.useRef)(null);(0,f.useCopilotChatConfiguration)();let{data:a=[],isLoading:o}=pn();(0,u.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&r(!1)}if(n)return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[n]);function s(e){r(!1),t?.(e)}return(0,m.jsxs)(`div`,{className:`erica-header`,children:[(0,m.jsx)(`h2`,{className:`erica-header-title`,children:`SPP AI`}),(0,m.jsxs)(`div`,{className:`erica-header-controls`,ref:i,children:[(0,m.jsx)(`button`,{onClick:e,className:`erica-new-chat-button`,title:`Start new chat`,children:(0,m.jsx)(ne,{className:`erica-icon-sm`})}),(0,m.jsxs)(`button`,{onClick:()=>r(!n),className:`erica-threads-toggle`,title:`Recent threads`,children:[(0,m.jsxs)(`span`,{className:`erica-threads-toggle-text`,children:[`Threads `,a.length>0&&`(${a.length})`]}),(0,m.jsx)(E,{className:`erica-threads-toggle-icon ${n?`erica-threads-toggle-icon--open`:``}`})]}),n&&(0,m.jsx)(`div`,{className:`erica-threads-dropdown`,children:(0,m.jsxs)(`div`,{className:`erica-threads-dropdown-content`,children:[(0,m.jsx)(`div`,{className:`erica-threads-dropdown-header`,children:`Recent Threads`}),o&&(0,m.jsx)(`div`,{className:`erica-threads-empty`,children:`Loading threads...`}),!o&&a.length===0&&(0,m.jsx)(`div`,{className:`erica-threads-empty`,children:`No conversations yet`}),!o&&a.map(e=>{let t=mn(e.agent),n=hn(e.last_run_at??e.created_at);return(0,m.jsx)(`button`,{onClick:()=>s(e.uid),className:`erica-thread-item`,children:(0,m.jsxs)(`div`,{className:`erica-thread-item-content`,children:[(0,m.jsx)(`span`,{className:`erica-thread-title`,children:typeof e.thread_metadata?.title==`string`?e.thread_metadata.title:e.last_message??`New conversation`}),(0,m.jsxs)(`div`,{className:`erica-thread-meta`,children:[t&&(0,m.jsx)(`span`,{className:`erica-thread-agent`,children:t}),n&&(0,m.jsx)(`span`,{className:`erica-thread-time`,children:n})]})]})},e.uid)})]})})]})]})}Object.freeze({status:`aborted`});function A(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var _n=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},vn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},yn={};function bn(e){return e&&Object.assign(yn,e),yn}function xn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Sn(e,t){return typeof t==`bigint`?t.toString():t}function Cn(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function wn(e){return e==null}function Tn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}var En=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==En)return r===void 0&&(r=En,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function On(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function kn(e){return JSON.stringify(e)}function An(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var jn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Mn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Nn=Cn(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Pn(e){if(Mn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Mn(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Fn(e){return Pn(e)?{...e}:Array.isArray(e)?[...e]:e}var In=new Set([`string`,`number`,`symbol`]);function Ln(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Rn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function zn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function Bn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Rn(e,On(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Dn(this,`shape`,e),e},checks:[]}))}function Vn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Rn(e,On(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Dn(this,`shape`,r),r},checks:[]}))}function Hn(e,t){if(!Pn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Rn(e,On(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Dn(this,`shape`,n),n}}))}function Un(e,t){if(!Pn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Rn(e,On(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Dn(this,`shape`,n),n}}))}function Wn(e,t){return Rn(e,On(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Dn(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Gn(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Rn(t,On(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Dn(this,`shape`,i),i},checks:[]}))}function Kn(e,t,n){return Rn(t,On(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Dn(this,`shape`,i),i}}))}function qn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Jn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Yn(e){return typeof e==`string`?e:e?.message}function Xn(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Yn(e.inst?._zod.def?.error?.(e))??Yn(t?.error?.(e))??Yn(n.customError?.(e))??Yn(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Zn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Qn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var $n=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,Sn,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},er=A(`$ZodError`,$n),tr=A(`$ZodError`,$n,{Parent:Error});function nr(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function rr(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var ir=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new _n;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Xn(e,a,bn())));throw jn(t,i?.callee),t}return o.value},ar=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Xn(e,a,bn())));throw jn(t,i?.callee),t}return o.value},or=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new _n;return a.issues.length?{success:!1,error:new(e??er)(a.issues.map(e=>Xn(e,i,bn())))}:{success:!0,data:a.value}},sr=or(tr),cr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Xn(e,i,bn())))}:{success:!0,data:a.value}},lr=cr(tr),ur=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ir(e)(t,n,i)},dr=e=>(t,n,r)=>ir(e)(t,n,r),fr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ar(e)(t,n,i)},pr=e=>async(t,n,r)=>ar(e)(t,n,r),mr=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return or(e)(t,n,i)},hr=e=>(t,n,r)=>or(e)(t,n,r),gr=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return cr(e)(t,n,i)},_r=e=>async(t,n,r)=>cr(e)(t,n,r),vr=/^[cC][^\s-]{8,}$/,yr=/^[0-9a-z]+$/,br=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xr=/^[0-9a-vA-V]{20}$/,Sr=/^[A-Za-z0-9]{27}$/,Cr=/^[a-zA-Z0-9_-]{21}$/,wr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Tr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Er=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Dr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Or=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function kr(){return new RegExp(Or,`u`)}var Ar=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Mr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Nr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fr=/^[A-Za-z0-9_-]*$/,Ir=/^\+[1-9]\d{6,14}$/,Lr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Rr=RegExp(`^${Lr}$`);function zr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Br(e){return RegExp(`^${zr(e)}$`)}function Vr(e){let t=zr({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Lr}T(?:${r})$`)}var Hr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ur=/^[^A-Z]*$/,Wr=/^[^a-z]*$/,Gr=A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Kr=A(`$ZodCheckMaxLength`,(e,t)=>{var n;Gr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Zn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qr=A(`$ZodCheckMinLength`,(e,t)=>{var n;Gr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Zn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jr=A(`$ZodCheckLengthEquals`,(e,t)=>{var n;Gr.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Zn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yr=A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Gr.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Xr=A(`$ZodCheckRegex`,(e,t)=>{Yr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Zr=A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ur,Yr.init(e,t)}),Qr=A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Wr,Yr.init(e,t)}),$r=A(`$ZodCheckIncludes`,(e,t)=>{Gr.init(e,t);let n=Ln(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ei=A(`$ZodCheckStartsWith`,(e,t)=>{Gr.init(e,t);let n=RegExp(`^${Ln(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ti=A(`$ZodCheckEndsWith`,(e,t)=>{Gr.init(e,t);let n=RegExp(`.*${Ln(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ni=A(`$ZodCheckOverwrite`,(e,t)=>{Gr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ri=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
7
7
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
8
8
|
`))}},ii={major:4,minor:3,patch:6},N=A(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ii;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=qn(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new _n;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=qn(e,t))});else{if(e.issues.length===t)continue;r||=qn(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(qn(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new _n;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new _n;return o.then(e=>t(e,r,a))}return t(o,r,a)}}j(e,`~standard`,()=>({validate:t=>{try{let n=sr(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return lr(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),ai=A(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Hr(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),P=A(`$ZodStringFormat`,(e,t)=>{Yr.init(e,t),ai.init(e,t)}),oi=A(`$ZodGUID`,(e,t)=>{t.pattern??=Tr,P.init(e,t)}),si=A(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Er(e)}else t.pattern??=Er();P.init(e,t)}),ci=A(`$ZodEmail`,(e,t)=>{t.pattern??=Dr,P.init(e,t)}),li=A(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ui=A(`$ZodEmoji`,(e,t)=>{t.pattern??=kr(),P.init(e,t)}),di=A(`$ZodNanoID`,(e,t)=>{t.pattern??=Cr,P.init(e,t)}),fi=A(`$ZodCUID`,(e,t)=>{t.pattern??=vr,P.init(e,t)}),pi=A(`$ZodCUID2`,(e,t)=>{t.pattern??=yr,P.init(e,t)}),mi=A(`$ZodULID`,(e,t)=>{t.pattern??=br,P.init(e,t)}),hi=A(`$ZodXID`,(e,t)=>{t.pattern??=xr,P.init(e,t)}),gi=A(`$ZodKSUID`,(e,t)=>{t.pattern??=Sr,P.init(e,t)}),_i=A(`$ZodISODateTime`,(e,t)=>{t.pattern??=Vr(t),P.init(e,t)}),vi=A(`$ZodISODate`,(e,t)=>{t.pattern??=Rr,P.init(e,t)}),yi=A(`$ZodISOTime`,(e,t)=>{t.pattern??=Br(t),P.init(e,t)}),bi=A(`$ZodISODuration`,(e,t)=>{t.pattern??=wr,P.init(e,t)}),xi=A(`$ZodIPv4`,(e,t)=>{t.pattern??=Ar,P.init(e,t),e._zod.bag.format=`ipv4`}),Si=A(`$ZodIPv6`,(e,t)=>{t.pattern??=jr,P.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Ci=A(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Mr,P.init(e,t)}),wi=A(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Nr,P.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Ti(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ei=A(`$ZodBase64`,(e,t)=>{t.pattern??=Pr,P.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Ti(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Di(e){if(!Fr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ti(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Oi=A(`$ZodBase64URL`,(e,t)=>{t.pattern??=Fr,P.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Di(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ki=A(`$ZodE164`,(e,t)=>{t.pattern??=Ir,P.init(e,t)});function Ai(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ji=A(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{Ai(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Mi=A(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),Ni=A(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Pi(e,t,n){e.issues.length&&t.issues.push(...Jn(n,e.issues)),t.value[n]=e.value}var Fi=A(`$ZodArray`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Pi(t,n,e))):Pi(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Ii(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...Jn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Li(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=zn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ri(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ii(e,n,i,t,u))):Ii(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var zi=A(`$ZodObject`,(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Cn(()=>Li(t));j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Mn,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Ii(n,t,e,s,r))):Ii(i,t,e,s,r)}return i?Ri(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Bi=A(`$ZodObjectJIT`,(e,t)=>{zi.init(e,t);let n=e._zod.parse,r=Cn(()=>Li(t)),i=e=>{let t=new ri([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=kn(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=kn(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
9
9
|
if (${n}.issues.length) {
|
|
@@ -41,27 +41,37 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
41
41
|
|
|
42
42
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Mn,s=!yn.jitless,c=s&&Nn.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Ri([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Vi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!qn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Xn(e,r,bn())))}),t)}var Hi=A(`$ZodUnion`,(e,t)=>{N.init(e,t),j(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),j(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),j(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),j(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Tn(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Vi(t,i,e,a)):Vi(s,i,e,a)}}),Ui=A(`$ZodIntersection`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Gi(e,t,n)):Gi(e,i,a)}});function Wi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Pn(e)&&Pn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Wi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Wi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Gi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),qn(e))return e;let o=Wi(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ki=A(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=xn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>In.has(typeof e)).map(e=>typeof e==`string`?Ln(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),qi=A(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new vn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new _n;return n.value=i,n}});function Ji(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Yi=A(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Tn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Ji(t,e.value)):Ji(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Xi=A(`$ZodExactOptional`,(e,t)=>{Yi.init(e,t),j(e._zod,`values`,()=>t.innerType._zod.values),j(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zi=A(`$ZodNullable`,(e,t)=>{N.init(e,t),j(e._zod,`optin`,()=>t.innerType._zod.optin),j(e._zod,`optout`,()=>t.innerType._zod.optout),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Tn(e.source)}|null)$`):void 0}),j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Qi=A(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>$i(e,t)):$i(r,t)}});function $i(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ea=A(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ta=A(`$ZodNonOptional`,(e,t)=>{N.init(e,t),j(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>na(t,e)):na(i,e)}});function na(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var ra=A(`$ZodCatch`,(e,t)=>{N.init(e,t),j(e._zod,`optin`,()=>t.innerType._zod.optin),j(e._zod,`optout`,()=>t.innerType._zod.optout),j(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Xn(e,n,bn()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Xn(e,n,bn()))},input:e.value}),e.issues=[]),e)}}),ia=A(`$ZodPipe`,(e,t)=>{N.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),j(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>aa(e,t.in,n)):aa(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>aa(e,t.out,n)):aa(r,t.out,n)}});function aa(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var oa=A(`$ZodReadonly`,(e,t)=>{N.init(e,t),j(e._zod,`propValues`,()=>t.innerType._zod.propValues),j(e._zod,`values`,()=>t.innerType._zod.values),j(e._zod,`optin`,()=>t.innerType?._zod?.optin),j(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(sa):sa(r)}});function sa(e){return e.value=Object.freeze(e.value),e}var ca=A(`$ZodCustom`,(e,t)=>{Gr.init(e,t),N.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>la(t,n,r,e));la(i,n,r,e)}});function la(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Qn(e))}}var ua,da=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fa(){return new da}(ua=globalThis).__zod_globalRegistry??(ua.__zod_globalRegistry=fa());var pa=globalThis.__zod_globalRegistry;function ma(e,t){return new e({type:`string`,...M(t)})}function ha(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function ga(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function _a(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function va(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function ya(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function ba(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function xa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Sa(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Ca(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function wa(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Ta(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function Ea(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Da(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function Oa(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function ka(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function Aa(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function ja(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Ma(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Na(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function Pa(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Fa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Ia(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function La(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function Ra(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function za(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function Ba(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function Va(e){return new e({type:`unknown`})}function Ha(e,t){return new e({type:`never`,...M(t)})}function Ua(e,t){return new Kr({check:`max_length`,...M(t),maximum:e})}function Wa(e,t){return new qr({check:`min_length`,...M(t),minimum:e})}function Ga(e,t){return new Jr({check:`length_equals`,...M(t),length:e})}function Ka(e,t){return new Xr({check:`string_format`,format:`regex`,...M(t),pattern:e})}function qa(e){return new Zr({check:`string_format`,format:`lowercase`,...M(e)})}function Ja(e){return new Qr({check:`string_format`,format:`uppercase`,...M(e)})}function Ya(e,t){return new $r({check:`string_format`,format:`includes`,...M(t),includes:e})}function Xa(e,t){return new ei({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function Za(e,t){return new ti({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function Qa(e){return new ni({check:`overwrite`,tx:e})}function $a(e){return Qa(t=>t.normalize(e))}function eo(){return Qa(e=>e.trim())}function to(){return Qa(e=>e.toLowerCase())}function no(){return Qa(e=>e.toUpperCase())}function ro(){return Qa(e=>An(e))}function io(e,t,n){return new e({type:`array`,element:t,...M(n)})}function ao(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function oo(e){let t=so(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Qn(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Qn(r))}},e(n.value,n)));return t}function so(e,t){let n=new Gr({check:`custom`,...M(t)});return n._zod.check=e,n}function co(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??pa,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function F(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,F(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&I(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function lo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
43
43
|
|
|
44
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function uo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:po(t,`input`,e.processors),output:po(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}var fo=(e,t={})=>n=>{let r=co({...n,processors:t});return F(e,r),lo(r,e),uo(r,e)},po=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=co({...i??{},target:a,io:t,processors:n});return F(e,o),lo(o,e),uo(o,e)},mo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ho=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=mo[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},go=(e,t,n,r)=>{n.not={}},_o=(e,t,n,r)=>{let i=e._zod.def,a=xn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},vo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})},xo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=F(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},So=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Co=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},wo=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},To=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Eo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Do=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Oo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ko=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;F(a,t,r);let o=t.seen.get(e);o.ref=a},Ao=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},jo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mo=A(`ZodISODateTime`,(e,t)=>{_i.init(e,t),z.init(e,t)});function No(e){return La(Mo,e)}var Po=A(`ZodISODate`,(e,t)=>{vi.init(e,t),z.init(e,t)});function Fo(e){return Ra(Po,e)}var Io=A(`ZodISOTime`,(e,t)=>{yi.init(e,t),z.init(e,t)});function Lo(e){return za(Io,e)}var Ro=A(`ZodISODuration`,(e,t)=>{bi.init(e,t),z.init(e,t)});function zo(e){return Ba(Ro,e)}var Bo=(e,t)=>{er.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>rr(e,t)},flatten:{value:t=>nr(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Sn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Sn,2)}},isEmpty:{get(){return e.issues.length===0}}})};A(`ZodError`,Bo);var L=A(`ZodError`,Bo,{Parent:Error}),Vo=ir(L),Ho=ar(L),Uo=or(L),Wo=cr(L),Go=ur(L),Ko=dr(L),qo=fr(L),Jo=pr(L),Yo=mr(L),Xo=hr(L),Zo=gr(L),Qo=_r(L),R=A(`ZodType`,(e,t)=>(N.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:po(e,`input`),output:po(e,`output`)}}),e.toJSONSchema=fo(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(On(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Rn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Vo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Uo(e,t,n),e.parseAsync=async(t,n)=>Ho(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Wo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Go(e,t,n),e.decode=(t,n)=>Ko(e,t,n),e.encodeAsync=async(t,n)=>qo(e,t,n),e.decodeAsync=async(t,n)=>Jo(e,t,n),e.safeEncode=(t,n)=>Yo(e,t,n),e.safeDecode=(t,n)=>Xo(e,t,n),e.safeEncodeAsync=async(t,n)=>Zo(e,t,n),e.safeDecodeAsync=async(t,n)=>Qo(e,t,n),e.refine=(t,n)=>e.check(nc(t,n)),e.superRefine=t=>e.check(rc(t)),e.overwrite=t=>e.check(Qa(t)),e.optional=()=>Rs(e),e.exactOptional=()=>Bs(e),e.nullable=()=>Hs(e),e.nullish=()=>Rs(Hs(e)),e.nonoptional=t=>Js(e,t),e.array=()=>Es(e),e.or=t=>As([e,t]),e.and=t=>Ms(e,t),e.transform=t=>Qs(e,Is(t)),e.default=t=>Ws(e,t),e.prefault=t=>Ks(e,t),e.catch=t=>Xs(e,t),e.pipe=t=>Qs(e,t),e.readonly=()=>ec(e),e.describe=t=>{let n=e.clone();return pa.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return pa.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return pa.get(e);let n=e.clone();return pa.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),$o=A(`_ZodString`,(e,t)=>{ai.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ka(...t)),e.includes=(...t)=>e.check(Ya(...t)),e.startsWith=(...t)=>e.check(Xa(...t)),e.endsWith=(...t)=>e.check(Za(...t)),e.min=(...t)=>e.check(Wa(...t)),e.max=(...t)=>e.check(Ua(...t)),e.length=(...t)=>e.check(Ga(...t)),e.nonempty=(...t)=>e.check(Wa(1,...t)),e.lowercase=t=>e.check(qa(t)),e.uppercase=t=>e.check(Ja(t)),e.trim=()=>e.check(eo()),e.normalize=(...t)=>e.check($a(...t)),e.toLowerCase=()=>e.check(to()),e.toUpperCase=()=>e.check(no()),e.slugify=()=>e.check(ro())}),es=A(`ZodString`,(e,t)=>{ai.init(e,t),$o.init(e,t),e.email=t=>e.check(ha(ns,t)),e.url=t=>e.check(xa(as,t)),e.jwt=t=>e.check(Ia(bs,t)),e.emoji=t=>e.check(Sa(os,t)),e.guid=t=>e.check(ga(rs,t)),e.uuid=t=>e.check(_a(is,t)),e.uuidv4=t=>e.check(va(is,t)),e.uuidv6=t=>e.check(ya(is,t)),e.uuidv7=t=>e.check(ba(is,t)),e.nanoid=t=>e.check(Ca(ss,t)),e.guid=t=>e.check(ga(rs,t)),e.cuid=t=>e.check(wa(cs,t)),e.cuid2=t=>e.check(Ta(ls,t)),e.ulid=t=>e.check(Ea(us,t)),e.base64=t=>e.check(Na(_s,t)),e.base64url=t=>e.check(Pa(vs,t)),e.xid=t=>e.check(Da(ds,t)),e.ksuid=t=>e.check(Oa(fs,t)),e.ipv4=t=>e.check(ka(ps,t)),e.ipv6=t=>e.check(Aa(ms,t)),e.cidrv4=t=>e.check(ja(hs,t)),e.cidrv6=t=>e.check(Ma(gs,t)),e.e164=t=>e.check(Fa(ys,t)),e.datetime=t=>e.check(No(t)),e.date=t=>e.check(Fo(t)),e.time=t=>e.check(Lo(t)),e.duration=t=>e.check(zo(t))});function ts(e){return ma(es,e)}var z=A(`ZodStringFormat`,(e,t)=>{P.init(e,t),$o.init(e,t)}),ns=A(`ZodEmail`,(e,t)=>{ci.init(e,t),z.init(e,t)}),rs=A(`ZodGUID`,(e,t)=>{oi.init(e,t),z.init(e,t)}),is=A(`ZodUUID`,(e,t)=>{si.init(e,t),z.init(e,t)}),as=A(`ZodURL`,(e,t)=>{li.init(e,t),z.init(e,t)}),os=A(`ZodEmoji`,(e,t)=>{ui.init(e,t),z.init(e,t)}),ss=A(`ZodNanoID`,(e,t)=>{di.init(e,t),z.init(e,t)}),cs=A(`ZodCUID`,(e,t)=>{fi.init(e,t),z.init(e,t)}),ls=A(`ZodCUID2`,(e,t)=>{pi.init(e,t),z.init(e,t)}),us=A(`ZodULID`,(e,t)=>{mi.init(e,t),z.init(e,t)}),ds=A(`ZodXID`,(e,t)=>{hi.init(e,t),z.init(e,t)}),fs=A(`ZodKSUID`,(e,t)=>{gi.init(e,t),z.init(e,t)}),ps=A(`ZodIPv4`,(e,t)=>{xi.init(e,t),z.init(e,t)}),ms=A(`ZodIPv6`,(e,t)=>{Si.init(e,t),z.init(e,t)}),hs=A(`ZodCIDRv4`,(e,t)=>{Ci.init(e,t),z.init(e,t)}),gs=A(`ZodCIDRv6`,(e,t)=>{wi.init(e,t),z.init(e,t)}),_s=A(`ZodBase64`,(e,t)=>{Ei.init(e,t),z.init(e,t)}),vs=A(`ZodBase64URL`,(e,t)=>{Oi.init(e,t),z.init(e,t)}),ys=A(`ZodE164`,(e,t)=>{ki.init(e,t),z.init(e,t)}),bs=A(`ZodJWT`,(e,t)=>{ji.init(e,t),z.init(e,t)}),xs=A(`ZodUnknown`,(e,t)=>{Mi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ss(){return Va(xs)}var Cs=A(`ZodNever`,(e,t)=>{Ni.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function ws(e){return Ha(Cs,e)}var Ts=A(`ZodArray`,(e,t)=>{Fi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Wa(t,n)),e.nonempty=t=>e.check(Wa(1,t)),e.max=(t,n)=>e.check(Ua(t,n)),e.length=(t,n)=>e.check(Ga(t,n)),e.unwrap=()=>e.element});function Es(e,t){return io(Ts,e,t)}var Ds=A(`ZodObject`,(e,t)=>{Bi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),j(e,`shape`,()=>t.shape),e.keyof=()=>Ps(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ss()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ss()}),e.strict=()=>e.clone({...e._zod.def,catchall:ws()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Hn(e,t),e.safeExtend=t=>Un(e,t),e.merge=t=>Wn(e,t),e.pick=t=>Bn(e,t),e.omit=t=>Vn(e,t),e.partial=(...t)=>Gn(Ls,e,t[0]),e.required=(...t)=>Kn(qs,e,t[0])});function Os(e,t){return new Ds({type:`object`,shape:e??{},...M(t)})}var ks=A(`ZodUnion`,(e,t)=>{Hi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.options=t.options});function As(e,t){return new ks({type:`union`,options:e,...M(t)})}var js=A(`ZodIntersection`,(e,t)=>{Ui.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function Ms(e,t){return new js({type:`intersection`,left:e,right:t})}var Ns=A(`ZodEnum`,(e,t)=>{Ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ns({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ns({...t,checks:[],...M(r),entries:i})}});function Ps(e,t){return new Ns({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var Fs=A(`ZodTransform`,(e,t)=>{qi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new vn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Qn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Is(e){return new Fs({type:`transform`,transform:e})}var Ls=A(`ZodOptional`,(e,t)=>{Yi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rs(e){return new Ls({type:`optional`,innerType:e})}var zs=A(`ZodExactOptional`,(e,t)=>{Xi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bs(e){return new zs({type:`optional`,innerType:e})}var Vs=A(`ZodNullable`,(e,t)=>{Zi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hs(e){return new Vs({type:`nullable`,innerType:e})}var Us=A(`ZodDefault`,(e,t)=>{Qi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ws(e,t){return new Us({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Fn(t)}})}var Gs=A(`ZodPrefault`,(e,t)=>{ea.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ks(e,t){return new Gs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Fn(t)}})}var qs=A(`ZodNonOptional`,(e,t)=>{ta.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Js(e,t){return new qs({type:`nonoptional`,innerType:e,...M(t)})}var Ys=A(`ZodCatch`,(e,t)=>{ra.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xs(e,t){return new Ys({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Zs=A(`ZodPipe`,(e,t)=>{ia.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.in=t.in,e.out=t.out});function Qs(e,t){return new Zs({type:`pipe`,in:e,out:t})}var $s=A(`ZodReadonly`,(e,t)=>{oa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new $s({type:`readonly`,innerType:e})}var tc=A(`ZodCustom`,(e,t)=>{ca.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function nc(e,t={}){return ao(tc,e,t)}function rc(e){return oo(e)}var ic=[`bar`,`line`,`pie`,`bignumber`,`table`,`scatter`,`funnel`],ac=/(\w+)=(?:"([^"]*)"|'([^']*)'|(true|false|-?(?:\d+\.?\d*|\.\d+)))/g;function oc(e){let t={},n=new RegExp(ac.source,ac.flags),r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2]??r[3]??r[4]??``;return t}function sc(e){if(e!==void 0)return e===`true`}function cc(e){if(e===void 0)return;let t=Number(e);return Number.isNaN(t)?void 0:t}var lc=/\{%\s*(\w+)\s+((?:(?!\/%\})[\s\S])*)\/%\}/g;function uc(e){let t=[],n=0,r=new RegExp(lc.source,lc.flags),i;for(;(i=r.exec(e))!==null;){let[r,a,o]=i,s=i.index;s>n&&t.push({kind:`text`,content:e.slice(n,s)});let c=a.toLowerCase();if(ic.includes(c)){let e={type:c,attrs:oc(o),raw:r};t.push({kind:`chart`,node:e})}else t.push({kind:`text`,content:r});n=s+r.length}return n<e.length&&t.push({kind:`text`,content:e.slice(n)}),t}function dc(e,t){let n=[];switch(e){case`bar`:case`line`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`pie`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`bignumber`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`table`:t.sql||n.push({field:`sql`,message:`sql is required`});break;case`scatter`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`funnel`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break}return n.length>0?{valid:!1,errors:n}:{valid:!0}}function fc({option:e,style:t={height:`400px`,width:`100%`},settings:n={notMerge:!0},theme:r}){let i=(0,u.useRef)(null),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{i.current&&(a.current=h.init(i.current,r));let e=()=>{a.current?.resize()};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e),a.current?.dispose()}},[r]),(0,u.useEffect)(()=>{if(a.current&&e){let t={...e,grid:{left:30,right:30,top:100,bottom:50,containLabel:!0},toolbox:{show:!0,...e.toolbox,feature:{saveAsImage:{show:!0,title:`Download`,pixelRatio:2},restore:{show:!0},...e.toolbox?.feature||{}}}};a.current.setOption(t,n)}},[e,n]),(0,m.jsx)(`div`,{ref:i,style:t})}var pc=(0,u.createContext)(void 0);function mc({accountUid:e,children:t}){return(0,m.jsx)(pc.Provider,{value:{accountUid:e},children:t})}function hc(){let e=(0,u.useContext)(pc);if(!e)throw Error(`useAccount must be used within AccountProvider`);return e}var gc={querySql:async(e,t)=>{let{data:n}=await Fe({body:{sql:t.sql},throwOnError:!0});if(!n?.data)throw Error(`No data returned from SQL query`);let r=n.data;return{rows:r.rows??[],columns:r.columns??[],row_count:r.row_count??0}}},_c=(e,t,n)=>un({queryKey:[`dataset-sql`,e,t],queryFn:()=>gc.querySql(e,t),enabled:(n?.enabled??!0)&&!!e&&!!t.sql,placeholderData:e=>e});function vc({sql:e,x:t,y:n,title:r,horizontal:i=!1,xAxisName:a,yAxisName:o,height:s=`400px`}){let{accountUid:c}=hc(),[l,d]=(0,u.useState)(!1),{data:f,isLoading:p,isError:h,error:g}=_c(c,(0,u.useMemo)(()=>({sql:e}),[e])),_=(0,u.useMemo)(()=>{if(!f?.rows?.length)return null;let e=f.rows.map(e=>String(e[t]??``)),s=f.rows.map(e=>e[n]??null);return{title:r?{text:r}:void 0,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`}},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)}}},grid:{containLabel:!0},...i?{xAxis:{type:`value`,name:a},yAxis:{type:`category`,data:e,name:o}}:{xAxis:{type:`category`,data:e,name:a},yAxis:{type:`value`,name:o}},series:[{type:`bar`,data:s,label:l?{show:!0,position:i?`right`:`top`}:void 0}]}},[f,t,n,r,i,a,o,l]),v={height:typeof s==`number`?`${s}px`:s,width:`100%`};return p?(0,m.jsx)(`div`,{style:v,className:`erica-chart-loading`}):h?(0,m.jsx)(`div`,{style:{...v,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-error-container`,children:(0,m.jsx)(`p`,{className:`erica-chart-error-text`,children:g?.message??`Failed to load chart data`})}):_?(0,m.jsx)(fc,{option:_,style:v}):(0,m.jsx)(`div`,{style:{...v,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{className:`erica-chart-no-data-text`,children:`No data`})})}function yc({sql:e,x:t,y:n,title:r,xAxisName:i,yAxisName:a,height:o=`400px`}){let{accountUid:s}=hc(),[c,l]=(0,u.useState)(!1),{data:d,isLoading:f,isError:p,error:h}=_c(s,(0,u.useMemo)(()=>({sql:e}),[e])),g=(0,u.useMemo)(()=>{if(!d?.rows?.length)return null;let e=d.rows.map(e=>String(e[t]??``)),o=d.rows.map(e=>e[n]??null);return{title:r?{text:r}:void 0,tooltip:{trigger:`axis`},toolbox:{feature:{myToggleLabels:{show:!0,title:c?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>l(e=>!e)}}},grid:{containLabel:!0},xAxis:{type:`category`,data:e,name:i},yAxis:{type:`value`,name:a},series:[{type:`line`,data:o,smooth:!0,label:c?{show:!0,position:`top`}:void 0}]}},[d,t,n,r,i,a,c]),_={height:typeof o==`number`?`${o}px`:o,width:`100%`};return f?(0,m.jsx)(`div`,{style:_,className:`erica-chart-loading`}):p?(0,m.jsx)(`div`,{style:{..._,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-error-container`,children:(0,m.jsx)(`p`,{className:`erica-chart-error-text`,children:h?.message??`Failed to load chart data`})}):g?(0,m.jsx)(fc,{option:g,style:_}):(0,m.jsx)(`div`,{style:{..._,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{className:`erica-chart-no-data-text`,children:`No data`})})}function bc({sql:e,name:t,value:n,title:r,height:i=`400px`,donut:a=!1,showLabels:o=!0,showLegend:s=!0}){let{accountUid:c}=hc(),[l,d]=(0,u.useState)(o),[f,p]=(0,u.useState)(s),{data:h,isLoading:g,isError:_,error:v}=_c(c,(0,u.useMemo)(()=>({sql:e}),[e])),y=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[t]??``),value:Number(e[n]??0)}));return{title:r?{text:r}:void 0,tooltip:{trigger:`item`,formatter:`{a} <br/>{b}: {c} ({d}%)`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:f?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>p(e=>!e)}}},legend:f?{show:!0,orient:`vertical`,left:`left`}:void 0,series:[{name:r??`Data`,type:`pie`,radius:a?[`40%`,`70%`]:`70%`,data:e,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:`rgba(0, 0, 0, 0.5)`}},label:{show:l,formatter:`{b}: {c} ({d}%)`}}]}},[h,t,n,r,a,l,f]),b={height:typeof i==`number`?`${i}px`:i,width:`100%`};return g?(0,m.jsx)(`div`,{style:b,className:`erica-chart-loading`}):_?(0,m.jsx)(`div`,{style:{...b,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-error-container`,children:(0,m.jsx)(`p`,{className:`erica-chart-error-text`,children:v?.message??`Failed to load chart data`})}):y?(0,m.jsx)(fc,{option:y,style:b}):(0,m.jsx)(`div`,{style:{...b,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{className:`erica-chart-no-data-text`,children:`No data`})})}var xc={red:`#dc2626`,green:`#16a34a`,blue:`#2563eb`,yellow:`#ca8a04`,orange:`#ea580c`,purple:`#9333ea`,pink:`#db2777`,gray:`#6b7280`,black:`#111827`,white:`#ffffff`},Sc=e=>{if(!e)return null;let t=e.indexOf(`|`);if(t===-1)return{text:e};let n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();return r?{text:r,color:xc[n]??n}:{text:e}};function Cc({sql:e,value:t,title:n=`Big Number`,subtitle:r,description:i,prefix:a=``,suffix:o=``,decimals:s=0}){let{accountUid:c}=hc(),{data:l,isLoading:d,isError:f,error:p}=_c(c,(0,u.useMemo)(()=>({sql:e}),[e])),h=(0,u.useMemo)(()=>l?.rows?.length?l.rows[0]?.[t]??null:null,[l,t]),g=(0,u.useMemo)(()=>{if(h==null||h===``)return`--`;let e=Number(h);return Number.isNaN(e)?String(h):`${a}${e.toLocaleString(void 0,{minimumFractionDigits:s,maximumFractionDigits:s})}${o}`},[h,a,o,s]),_=(0,u.useMemo)(()=>Sc(n),[n]),v=(0,u.useMemo)(()=>Sc(r),[r]),y=(0,u.useMemo)(()=>Sc(i),[i]),b=(0,u.useMemo)(()=>Sc(g),[g]);return d?(0,m.jsxs)(`div`,{className:`erica-bignumber-chart erica-bignumber-loading`,children:[(0,m.jsx)(`div`,{className:`erica-bignumber-skeleton-title`}),(0,m.jsx)(`div`,{className:`erica-bignumber-skeleton-value`}),(0,m.jsx)(`div`,{className:`erica-bignumber-skeleton-subtitle`})]}):f?(0,m.jsx)(`div`,{className:`erica-bignumber-chart erica-bignumber-error`,children:(0,m.jsx)(`p`,{className:`erica-bignumber-error-text`,children:p?.message??`Failed to load big number data`})}):(0,m.jsxs)(`div`,{className:`erica-bignumber-chart`,children:[(0,m.jsxs)(`div`,{className:`erica-bignumber-header`,children:[(0,m.jsx)(`p`,{className:`erica-bignumber-title`,style:_?.color?{color:_.color}:void 0,children:_?.text??n}),v&&(0,m.jsx)(`p`,{className:`erica-bignumber-subtitle`,style:v.color?{color:v.color}:void 0,children:v.text})]}),(0,m.jsxs)(`div`,{className:`erica-bignumber-content`,children:[(0,m.jsx)(`p`,{className:`erica-bignumber-value`,style:b?.color?{color:b.color}:void 0,children:b?.text??g}),y&&(0,m.jsx)(`p`,{className:`erica-bignumber-description`,style:y.color?{color:y.color}:void 0,children:y.text})]})]})}var wc=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function Tc({sql:e,title:t,height:n=`400px`,columns:r,maxRows:i}){let{accountUid:a}=hc(),{data:o,isLoading:s,isError:c,error:l}=_c(a,(0,u.useMemo)(()=>({sql:e}),[e])),d=(0,u.useMemo)(()=>{let e=o?.columns?.length?o.columns:[];return r?r.split(`,`).map(e=>e.trim()).filter(t=>e.includes(t)):e},[o,r]),f=(0,u.useMemo)(()=>{let e=o?.rows??[];return!i||i<=0?e:e.slice(0,i)},[o,i]),p={height:typeof n==`number`?`${n}px`:n,width:`100%`};return s?(0,m.jsx)(`div`,{style:p,className:`erica-chart-loading`,children:(0,m.jsx)(`div`,{className:`erica-chart-loading-spinner`})}):c?(0,m.jsx)(`div`,{style:p,className:`erica-chart-error`,children:(0,m.jsx)(`p`,{children:l?.message??`Failed to load table data`})}):!d.length||!f.length?(0,m.jsx)(`div`,{style:p,className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{children:`No data`})}):(0,m.jsxs)(`div`,{style:p,className:`erica-table-chart`,children:[t&&(0,m.jsx)(`div`,{className:`erica-table-chart-header`,children:(0,m.jsx)(`p`,{className:`erica-table-chart-title`,children:t})}),(0,m.jsx)(`div`,{className:`erica-table-chart-container`,children:(0,m.jsxs)(`table`,{className:`erica-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsx)(`tr`,{children:d.map(e=>(0,m.jsx)(`th`,{children:e},e))})}),(0,m.jsx)(`tbody`,{children:f.map((e,t)=>(0,m.jsx)(`tr`,{children:d.map(n=>(0,m.jsx)(`td`,{children:(0,m.jsx)(`div`,{className:`erica-table-cell-content`,children:wc(e[n])})},`${t}-${n}`))},String(e._erica_id??t)))})]})})]})}var Ec=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0));function Dc({sql:e,x:t,y:n,seriesBy:r,size:i,color:a,title:o,height:s=`400px`,xAxisName:c,yAxisName:l}){let{accountUid:d}=hc(),[f,p]=(0,u.useState)(!1),h=(0,u.useMemo)(()=>n.includes(`,`)?n.split(`,`).map(e=>e.trim()):[n],[n]),{data:g,isLoading:_,isError:v,error:y}=_c(d,(0,u.useMemo)(()=>({sql:e}),[e])),b=(0,u.useMemo)(()=>{if(!g?.rows?.length)return null;let e=(e,n)=>{let r=[Number(e[t]??0),Number(e[n]??0)];return i&&r.push(Number(e[i]??0)),a&&r.push(String(e[a]??``)),r},n=r?g.rows.reduce((e,t)=>{let n=String(t[r]??`Unknown`);return e[n]||(e[n]=[]),e[n].push(t),e},{}):null,s=(e,t)=>({name:t,type:`scatter`,symbolSize:i?e=>Math.sqrt(e[2])*2:10,data:e,label:f?{show:!0,formatter:e=>{let t=e.value;return`${t[0]}, ${t[1]}`}}:void 0,itemStyle:a?{color:e=>{let t=e.value,n=t[t.length-1],r=[`#5470c6`,`#91cc75`,`#fac858`,`#ee6666`,`#73c0de`,`#3ba272`,`#fc8452`,`#9a60b4`,`#ea7ccc`];return r[n.split(``).reduce((e,t)=>e+t.charCodeAt(0),0)%r.length]}}:void 0}),u=n?Object.entries(n).flatMap(([t,n])=>h.map(r=>{let i=h.length>1?`${t} - ${r}`:t;return s(n.map(t=>e(t,r)),i)})):h.map(t=>s(g.rows.map(n=>e(n,t)),t));return Ec({title:o?{text:o}:void 0,tooltip:{trigger:`item`,formatter:e=>{let n=e.value,r=`${e.seriesName?`${e.seriesName}<br/>`:``}${t}: ${n[0]}<br/>${l??`Value`}: ${n[1]}`,o=2;return i&&(r+=`<br/>${i}: ${n[o++]}`),a&&(r+=`<br/>${a}: ${n[o]}`),r}},toolbox:{feature:{myToggleLabels:{show:!0,title:f?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>p(e=>!e)}}},xAxis:{type:`value`,name:c,scale:!0},yAxis:{type:`value`,name:l,scale:!0},legend:u.length>1?{show:!0}:void 0,series:u})},[g,t,h,r,i,a,o,c,l,f]),x={height:typeof s==`number`?`${s}px`:s,width:`100%`};return _?(0,m.jsxs)(`div`,{style:x,className:`erica-chart-loading`,children:[(0,m.jsx)(`div`,{className:`erica-chart-loading-spinner`}),(0,m.jsx)(`p`,{children:`Loading scatter chart...`})]}):v?(0,m.jsx)(`div`,{style:x,className:`erica-chart-error`,children:(0,m.jsx)(`p`,{children:y?.message??`Failed to load chart data`})}):b?(0,m.jsx)(fc,{option:b,style:x}):(0,m.jsx)(`div`,{style:x,className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{children:`No data`})})}var Oc=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0));function kc({sql:e,name:t,value:n,title:r,height:i=`400px`,showLabels:a=!0,showLegend:o=!1,sort:s=`descending`}){let{accountUid:c}=hc(),[l,d]=(0,u.useState)(a),[f,p]=(0,u.useState)(o),{data:h,isLoading:g,isError:_,error:v}=_c(c,(0,u.useMemo)(()=>({sql:e}),[e])),y=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[t]??``),value:Number(e[n]??0)}));return Oc({title:r?{text:r}:void 0,tooltip:{trigger:`item`,formatter:`{b}: {c}`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:f?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>p(e=>!e)}}},legend:f?{show:!0,top:`bottom`}:void 0,series:[{type:`funnel`,left:`10%`,top:60,bottom:20,width:`80%`,min:0,minSize:`0%`,maxSize:`100%`,sort:s,gap:4,label:{show:l,position:`inside`,formatter:`{b}: {c}`},emphasis:{label:{fontSize:14}},data:e}]})},[h,t,n,r,s,l,f]),b={height:typeof i==`number`?`${i}px`:i,width:`100%`};return g?(0,m.jsxs)(`div`,{style:b,className:`erica-chart-loading`,children:[(0,m.jsx)(`div`,{className:`erica-chart-loading-spinner`}),(0,m.jsx)(`p`,{children:`Loading funnel chart...`})]}):_?(0,m.jsx)(`div`,{style:b,className:`erica-chart-error`,children:(0,m.jsx)(`p`,{children:v?.message??`Failed to load chart data`})}):y?(0,m.jsx)(fc,{option:y,style:b}):(0,m.jsx)(`div`,{style:b,className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{children:`No data`})})}function Ac({type:e,errors:t}){return(0,m.jsxs)(`div`,{className:`erica-chart-error`,children:[(0,m.jsxs)(`p`,{className:`erica-chart-error-title`,children:[`Erica Chart syntax error — `,(0,m.jsx)(`code`,{children:e})]}),(0,m.jsx)(`ul`,{className:`erica-chart-error-list`,children:t.map(e=>(0,m.jsx)(`li`,{className:`erica-chart-error-item`,children:e.message},e.field))})]})}function jc(e){let{type:t,attrs:n}=e,r=dc(t,n);if(!r.valid)return(0,m.jsx)(Ac,{type:t,errors:r.errors});switch(t){case`bar`:return(0,m.jsx)(vc,{sql:n.sql,x:n.x,y:n.y,title:n.title,horizontal:sc(n.horizontal),xAxisName:n.xAxisName,yAxisName:n.yAxisName});case`line`:return(0,m.jsx)(yc,{sql:n.sql,x:n.x,y:n.y,title:n.title,xAxisName:n.xAxisName,yAxisName:n.yAxisName});case`pie`:return(0,m.jsx)(bc,{sql:n.sql,name:n.name,value:n.value,title:n.title});case`bignumber`:return(0,m.jsx)(Cc,{sql:n.sql,value:n.value,title:n.title,subtitle:n.subtitle,description:n.description,prefix:n.prefix,suffix:n.suffix,decimals:cc(n.decimals)});case`table`:return(0,m.jsx)(Tc,{sql:n.sql,title:n.title,height:n.height,columns:n.columns,maxRows:cc(n.maxRows)});case`scatter`:return(0,m.jsx)(Dc,{sql:n.sql,x:n.x,y:n.y,seriesBy:n.seriesBy,size:n.size,color:n.color,title:n.title,height:n.height,xAxisName:n.xAxisName,yAxisName:n.yAxisName});case`funnel`:return(0,m.jsx)(kc,{sql:n.sql,name:n.name,value:n.value,title:n.title,height:n.height,showLabels:sc(n.showLabels),showLegend:sc(n.showLegend),sort:n.sort});default:return null}}function Mc({markdown:e}){return(0,m.jsx)(`div`,{className:`erica-chart-container`,children:(0,u.useMemo)(()=>uc(e),[e]).map((e,t)=>e.kind===`text`?e.content.trim()?(0,m.jsx)(`div`,{className:`erica-chart-text`,children:e.content},t):null:(0,m.jsx)(`div`,{className:`erica-chart-wrapper`,children:jc(e.node)},t))})}var Nc=Os({chartConfig:ts().describe(`Erica chart config syntax.`)});function Pc({chartConfig:e}){return(0,m.jsx)(`div`,{className:`erica-chart-card`,children:(0,m.jsx)(Mc,{markdown:e})})}var Fc=(0,u.createContext)(null);function Ic({children:e}){let[t,n]=(0,u.useState)(!1),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(`Artifacts`);return(0,m.jsx)(Fc.Provider,{value:{isOpen:t,onOpen:()=>n(!0),onClose:()=>n(!1),content:r,setContent:i,title:a,setTitle:o},children:e})}var Lc=()=>(0,u.useContext)(Fc)||{isOpen:!1,onOpen:()=>{},onClose:()=>{},content:null,setContent:()=>{},title:`Artifacts`,setTitle:()=>{}};function Rc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var zc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Bc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vc={};function Hc(e,t){return((t||Vc).jsx?Bc:zc).test(e)}var Uc=/[ \t\n\f\r]/g;function Wc(e){return typeof e==`object`?e.type===`text`?Gc(e.value):!1:Gc(e)}function Gc(e){return e.replace(Uc,``)===``}var Kc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Kc.prototype.normal={},Kc.prototype.property={},Kc.prototype.space=void 0;function qc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Kc(n,r,t)}function Jc(e){return e.toLowerCase()}var B=class{constructor(e,t){this.attribute=t,this.property=e}};B.prototype.attribute=``,B.prototype.booleanish=!1,B.prototype.boolean=!1,B.prototype.commaOrSpaceSeparated=!1,B.prototype.commaSeparated=!1,B.prototype.defined=!1,B.prototype.mustUseProperty=!1,B.prototype.number=!1,B.prototype.overloadedBoolean=!1,B.prototype.property=``,B.prototype.spaceSeparated=!1,B.prototype.space=void 0;var Yc=s({boolean:()=>V,booleanish:()=>H,commaOrSpaceSeparated:()=>G,commaSeparated:()=>Qc,number:()=>U,overloadedBoolean:()=>Zc,spaceSeparated:()=>W}),Xc=0,V=$c(),H=$c(),Zc=$c(),U=$c(),W=$c(),Qc=$c(),G=$c();function $c(){return 2**++Xc}var el=Object.keys(Yc),tl=class extends B{constructor(e,t,n,r){let i=-1;if(super(e,t),nl(this,`space`,r),typeof n==`number`)for(;++i<el.length;){let e=el[i];nl(this,el[i],(n&Yc[e])===Yc[e])}}};tl.prototype.defined=!0;function nl(e,t,n){n&&(e[t]=n)}function rl(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new tl(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Jc(r)]=r,n[Jc(a.attribute)]=r}return new Kc(t,n,e.space)}var il=rl({properties:{ariaActiveDescendant:null,ariaAtomic:H,ariaAutoComplete:null,ariaBusy:H,ariaChecked:H,ariaColCount:U,ariaColIndex:U,ariaColSpan:U,ariaControls:W,ariaCurrent:null,ariaDescribedBy:W,ariaDetails:null,ariaDisabled:H,ariaDropEffect:W,ariaErrorMessage:null,ariaExpanded:H,ariaFlowTo:W,ariaGrabbed:H,ariaHasPopup:null,ariaHidden:H,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W,ariaLevel:U,ariaLive:null,ariaModal:H,ariaMultiLine:H,ariaMultiSelectable:H,ariaOrientation:null,ariaOwns:W,ariaPlaceholder:null,ariaPosInSet:U,ariaPressed:H,ariaReadOnly:H,ariaRelevant:null,ariaRequired:H,ariaRoleDescription:W,ariaRowCount:U,ariaRowIndex:U,ariaRowSpan:U,ariaSelected:H,ariaSetSize:U,ariaSort:null,ariaValueMax:U,ariaValueMin:U,ariaValueNow:U,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function al(e,t){return t in e?e[t]:t}function ol(e,t){return al(e,t.toLowerCase())}var sl=rl({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Qc,acceptCharset:W,accessKey:W,action:null,allow:null,allowFullScreen:V,allowPaymentRequest:V,allowUserMedia:V,alt:null,as:null,async:V,autoCapitalize:null,autoComplete:W,autoFocus:V,autoPlay:V,blocking:W,capture:null,charSet:null,checked:V,cite:null,className:W,cols:U,colSpan:null,content:null,contentEditable:H,controls:V,controlsList:W,coords:U|Qc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:V,defer:V,dir:null,dirName:null,disabled:V,download:Zc,draggable:H,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:V,formTarget:null,headers:W,height:U,hidden:Zc,high:U,href:null,hrefLang:null,htmlFor:W,httpEquiv:W,id:null,imageSizes:null,imageSrcSet:null,inert:V,inputMode:null,integrity:null,is:null,isMap:V,itemId:null,itemProp:W,itemRef:W,itemScope:V,itemType:W,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:V,low:U,manifest:null,max:null,maxLength:U,media:null,method:null,min:null,minLength:U,multiple:V,muted:V,name:null,nonce:null,noModule:V,noValidate:V,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:V,optimum:U,pattern:null,ping:W,placeholder:null,playsInline:V,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:V,referrerPolicy:null,rel:W,required:V,reversed:V,rows:U,rowSpan:U,sandbox:W,scope:null,scoped:V,seamless:V,selected:V,shadowRootClonable:V,shadowRootDelegatesFocus:V,shadowRootMode:null,shape:null,size:U,sizes:null,slot:null,span:U,spellCheck:H,src:null,srcDoc:null,srcLang:null,srcSet:null,start:U,step:null,style:null,tabIndex:U,target:null,title:null,translate:null,type:null,typeMustMatch:V,useMap:null,value:H,width:U,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W,axis:null,background:null,bgColor:null,border:U,borderColor:null,bottomMargin:U,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:V,declare:V,event:null,face:null,frame:null,frameBorder:null,hSpace:U,leftMargin:U,link:null,longDesc:null,lowSrc:null,marginHeight:U,marginWidth:U,noResize:V,noHref:V,noShade:V,noWrap:V,object:null,profile:null,prompt:null,rev:null,rightMargin:U,rules:null,scheme:null,scrolling:H,standby:null,summary:null,text:null,topMargin:U,valueType:null,version:null,vAlign:null,vLink:null,vSpace:U,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:V,disableRemotePlayback:V,prefix:null,property:null,results:U,security:null,unselectable:null},space:`html`,transform:ol}),cl=rl({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:G,accentHeight:U,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:U,amplitude:U,arabicForm:null,ascent:U,attributeName:null,attributeType:null,azimuth:U,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:U,by:null,calcMode:null,capHeight:U,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:U,diffuseConstant:U,direction:null,display:null,dur:null,divisor:U,dominantBaseline:null,download:V,dx:null,dy:null,edgeMode:null,editable:null,elevation:U,enableBackground:null,end:null,event:null,exponent:U,externalResourcesRequired:null,fill:null,fillOpacity:U,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:Qc,g2:Qc,glyphName:Qc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:U,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:U,horizOriginX:U,horizOriginY:U,id:null,ideographic:U,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:U,k:U,k1:U,k2:U,k3:U,k4:U,kernelMatrix:G,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:U,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:U,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:U,overlineThickness:U,paintOrder:null,panose1:null,path:null,pathLength:U,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:U,pointsAtY:U,pointsAtZ:U,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:G,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:G,rev:G,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:G,requiredFeatures:G,requiredFonts:G,requiredFormats:G,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:U,specularExponent:U,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:U,strikethroughThickness:U,string:null,stroke:null,strokeDashArray:G,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:U,strokeOpacity:U,strokeWidth:null,style:null,surfaceScale:U,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:G,tabIndex:U,tableValues:null,target:null,targetX:U,targetY:U,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:G,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:U,underlineThickness:U,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:U,values:null,vAlphabetic:U,vMathematical:U,vectorEffect:null,vHanging:U,vIdeographic:U,version:null,vertAdvY:U,vertOriginX:U,vertOriginY:U,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:U,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:al}),ll=rl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ul=rl({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ol}),dl=rl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),fl={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`},pl=/[A-Z]/g,ml=/-[a-z]/g,hl=/^data[-\w.:]+$/i;function gl(e,t){let n=Jc(t),r=t,i=B;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&hl.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ml,vl);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ml.test(e)){let n=e.replace(pl,_l);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=tl}return new i(r,t)}function _l(e){return`-`+e.toLowerCase()}function vl(e){return e.charAt(1).toUpperCase()}var yl=qc([il,sl,ll,ul,dl],`html`),bl=qc([il,cl,ll,ul,dl],`svg`);function xl(e){return e.join(` `).trim()}var Sl=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
45
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),Cl=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Sl());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),wl=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Tl=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Cl()),r=wl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),El=Ol(`end`),Dl=Ol(`start`);function Ol(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function kl(e){let t=Dl(e),n=El(e);if(t&&n)return{start:t,end:n}}function Al(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ml(e.position):`start`in e||`end`in e?Ml(e):`line`in e||`column`in e?jl(e):``}function jl(e){return Nl(e&&e.line)+`:`+Nl(e&&e.column)}function Ml(e){return jl(e&&e.start)+`-`+jl(e&&e.end)}function Nl(e){return e&&typeof e==`number`?e:1}var K=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let 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=Al(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};K.prototype.file=``,K.prototype.name=``,K.prototype.reason=``,K.prototype.message=``,K.prototype.stack=``,K.prototype.column=void 0,K.prototype.line=void 0,K.prototype.ancestors=void 0,K.prototype.cause=void 0,K.prototype.fatal=void 0,K.prototype.place=void 0,K.prototype.ruleId=void 0,K.prototype.source=void 0;var Pl=l(Tl(),1),Fl={}.hasOwnProperty,Il=new Map,Ll=/[A-Z]/g,Rl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),zl=new Set([`td`,`th`]),Bl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Vl(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ql(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Zl(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?bl:yl,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Hl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Hl(e,t,n){if(t.type===`element`)return Ul(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Wl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Kl(e,t,n);if(t.type===`mdxjsEsm`)return Gl(e,t);if(t.type===`root`)return ql(e,t,n);if(t.type===`text`)return Jl(e,t)}function Ul(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=bl,e.schema=i),e.ancestors.push(t);let a=iu(e,t.tagName,!1),o=$l(e,t),s=tu(e,t);return Rl.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Wc(e):!0})),Yl(e,o,a,t),Xl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Wl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}au(e,t.position)}function Gl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);au(e,t.position)}function Kl(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=bl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:iu(e,t.name,!0),o=eu(e,t),s=tu(e,t);return Yl(e,o,a,t),Xl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ql(e,t,n){let r={};return Xl(r,tu(e,t)),e.create(t,e.Fragment,r,n)}function Jl(e,t){return t.value}function Yl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Xl(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Zl(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ql(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Dl(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function $l(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Fl.call(t.properties,i)){let a=nu(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&zl.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function eu(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else au(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else au(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function tu(e,t){let n=[],r=-1,i=e.passKeys?new Map:Il;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Hl(e,a,o);s!==void 0&&n.push(s)}return n}function nu(e,t,n){let r=gl(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Rc(n):xl(n)),r.property===`style`){let t=typeof n==`object`?n:ru(e,String(n));return e.stylePropertyNameCase===`css`&&(t=ou(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?fl[r.property]||r.property:r.attribute,n]}}function ru(e,t){try{return(0,Pl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new K("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Bl+`#cannot-parse-style-attribute`,r}}function iu(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Hc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Hc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Fl.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);au(e)}function au(e,t){let n=new K("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Bl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function ou(e){let t={},n;for(n in e)Fl.call(e,n)&&(t[su(n)]=e[n]);return t}function su(e){let t=e.replace(Ll,cu);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function cu(e){return`-`+e.toLowerCase()}var lu={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`]},uu={};function du(e,t){let n=t||uu;return fu(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function fu(e,t,n){if(mu(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return pu(e.children,t,n)}return Array.isArray(e)?pu(e,t,n):``}function pu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=fu(e[i],t,n);return r.join(``)}function mu(e){return!!(e&&typeof e==`object`)}var hu=document.createElement(`i`);function gu(e){let t=`&`+e+`;`;hu.innerHTML=t;let n=hu.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function _u(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function q(e,t){return e.length>0?(_u(e,e.length,0,t),e):t}var vu={}.hasOwnProperty;function yu(e){let t={},n=-1;for(;++n<e.length;)bu(t,e[n]);return t}function bu(e,t){let n;for(n in t){let r=(vu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){vu.call(r,a)||(r[a]=[]);let e=i[a];xu(r[a],Array.isArray(e)?e:e?[e]:[])}}}function xu(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);_u(e,0,0,r)}function Su(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Cu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var wu=Mu(/[A-Za-z]/),J=Mu(/[\dA-Za-z]/),Tu=Mu(/[#-'*+\--9=?A-Z^-~]/);function Eu(e){return e!==null&&(e<32||e===127)}var Du=Mu(/\d/),Ou=Mu(/[\dA-Fa-f]/),ku=Mu(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}var Au=Mu(/\p{P}|\p{S}/u),ju=Mu(/\s/);function Mu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Nu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&J(e.charCodeAt(n+1))&&J(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Q(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Pu={tokenize:Fu};function Fu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Y(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Iu={tokenize:Ru},Lu={tokenize:zu};function Ru(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return _u(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Lu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Lu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Y(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;_u(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function zu(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Bu(e){if(e===null||X(e)||ju(e))return 1;if(Au(e))return 2}function Vu(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Hu={name:`attention`,resolveAll:Uu,tokenize:Wu};function Uu(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Gu(d,-c),Gu(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=q(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=q(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=q(l,Vu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=q(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=q(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,_u(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Wu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bu(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Bu(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Gu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ku={name:`autolink`,tokenize:qu};function qu(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return wu(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||J(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||J(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Eu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Tu(t)?(e.consume(t),l):n(t)}function u(e){return J(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||J(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ju={partial:!0,tokenize:Yu};function Yu(e,t,n){return r;function r(t){return Z(t)?Q(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Y(e)?t(e):n(e)}}var Xu={continuation:{tokenize:Qu},exit:$u,name:`blockQuote`,tokenize:Zu};function Zu(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Qu(e,t,n){let r=this;return i;function i(t){return Z(t)?Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Xu,t,n)(r)}}function $u(e){e.exit(`blockQuote`)}var ed={name:`characterEscape`,tokenize:td};function td(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return ku(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var nd={name:`characterReference`,tokenize:rd};function rd(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=J,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Ou,u):(e.enter(`characterReferenceValue`),a=7,o=Du,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===J&&!gu(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var id={partial:!0,tokenize:sd},ad={concrete:!0,name:`codeFenced`,tokenize:od};function od(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Y(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(id,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Q(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Y(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?Q(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Y(t)?e.check(id,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?Q(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Y(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function sd(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var cd={name:`codeIndented`,tokenize:ud},ld={partial:!0,tokenize:dd};function ud(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Q(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Y(t)?e.attempt(ld,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function dd(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Q(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Y(e)?i(e):n(e)}}var fd={name:`codeText`,previous:md,resolve:pd,tokenize:hd};function pd(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||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),t-=r-i-2,r=i+2),i=void 0);return e}function md(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function hd(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Y(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var gd=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw 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,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&_d(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),_d(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_d(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){let t=this.left.splice(e,1/0);_d(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);_d(this.left,t.reverse())}}};function _d(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function vd(e){let t={},n=-1,r,i,a,o,s,c,l,u=new gd(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,yd(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return _u(e,0,1/0,u.slice(0)),!l}function yd(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var bd={resolve:Sd,tokenize:Cd},xd={partial:!0,tokenize:wd};function Sd(e){return vd(e),e}function Cd(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Y(t)?e.check(xd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function wd(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,a,`linePrefix`)}function a(i){if(i===null||Y(i))return n(i);let 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?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Td(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Eu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Y(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||X(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Eu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Ed(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Y(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Y(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Dd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Y(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Od(e,t){let n;return r;function r(i){return Y(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?Q(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var kd={name:`definition`,tokenize:jd},Ad={partial:!0,tokenize:Md};function jd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Ed.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Cu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return X(t)?Od(e,l)(t):l(t)}function l(t){return Td(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ad,d,d)(t)}function d(t){return Z(t)?Q(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Y(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Md(e,t,n){return r;function r(t){return X(t)?Od(e,i)(t):n(t)}function i(t){return Dd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?Q(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Y(e)?t(e):n(e)}}var Nd={name:`hardBreakEscape`,tokenize:Pd};function Pd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Y(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Fd={name:`headingAtx`,resolve:Id,tokenize:Ld};function Id(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},_u(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Ld(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||X(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Y(n)?(e.exit(`atxHeading`),t(n)):Z(n)?Q(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||X(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Rd=`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`.split(`.`),zd=[`pre`,`script`,`style`,`textarea`],Bd={concrete:!0,name:`htmlFlow`,resolveTo:Ud,tokenize:Wd},Vd={partial:!0,tokenize:Kd},Hd={partial:!0,tokenize:Gd};function Ud(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Wd(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):wu(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):wu(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return wu(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||X(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&zd.includes(l)?(i=1,r.interrupt?t(s):D(s)):Rd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||J(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||wu(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Y(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||X(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||Y(t)?D(t):Z(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Vd,ue,te)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(Hd,ne,ue)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||Y(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),ce):D(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):D(t)}function oe(t){if(t===62){let n=o.toLowerCase();return zd.includes(n)?(e.consume(t),le):D(t)}return wu(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):D(t)}function se(t){return t===93?(e.consume(t),ce):D(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):D(t)}function le(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function Gd(e,t,n){let r=this;return i;function i(t){return Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Kd(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ju,t,n)}}var qd={name:`htmlText`,tokenize:Jd};function Jd(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):wu(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):wu(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Y(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Y(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):Y(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return wu(t)?(e.consume(t),S):n(t)}function S(t){return t===45||J(t)?(e.consume(t),S):C(t)}function C(t){return Y(t)?(o=C,ae(t)):Z(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||J(t)?(e.consume(t),w):t===47||t===62||X(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||wu(t)?(e.consume(t),E):Y(t)?(o=T,ae(t)):Z(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):Y(t)?(o=ee,ae(t)):Z(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):Y(t)?(o=D,ae(t)):Z(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):Y(t)?(o=te,ae(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||X(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||X(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return Z(t)?Q(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var Yd={name:`labelEnd`,resolveAll:$d,resolveTo:ef,tokenize:tf},Xd={tokenize:nf},Zd={tokenize:rf},Qd={tokenize:af};function $d(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&_u(e,0,e.length,n),e}function ef(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=q(s,e.slice(a+1,a+r+3)),s=q(s,[[`enter`,u,t]]),s=q(s,Vu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=q(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=q(s,e.slice(o+1)),s=q(s,[[`exit`,c,t]]),_u(e,a,e.length,s),e}function tf(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Cu(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Xd,u,o?u:d)(t):t===91?e.attempt(Zd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Qd,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function nf(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return X(t)?Od(e,a)(t):a(t)}function a(t){return t===41?u(t):Td(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?Od(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Dd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?Od(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function rf(e,t,n){let r=this;return i;function i(t){return Ed.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Cu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function af(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var of={name:`labelStartImage`,resolveAll:Yd.resolveAll,tokenize:sf};function sf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var cf={name:`labelStartLink`,resolveAll:Yd.resolveAll,tokenize:lf};function lf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var uf={name:`lineEnding`,tokenize:df};function df(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var ff={name:`thematicBreak`,tokenize:pf};function pf(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Y(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?Q(e,s,`whitespace`)(t):s(t))}}var $={continuation:{tokenize:_f},exit:yf,name:`list`,tokenize:gf},mf={partial:!0,tokenize:bf},hf={partial:!0,tokenize:vf};function gf(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Du(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ff,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Du(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ju,r.interrupt?n:u,e.attempt(mf,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function _f(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ju,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hf,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt($,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function vf(e,t,n){let r=this;return Q(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function yf(e){e.exit(this.containerState.type)}function bf(e,t,n){let r=this;return Q(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var xf={name:`setextUnderline`,resolveTo:Sf,tokenize:Cf};function Sf(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Cf(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?Q(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Y(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var wf={tokenize:Tf};function Tf(e){let t=this,n=e.attempt(Ju,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bd,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Ef={resolveAll:Af()},Df=kf(`string`),Of=kf(`text`);function kf(e){return{resolveAll:Af(e===`text`?jf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Af(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function jf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Mf=s({attentionMarkers:()=>Bf,contentInitial:()=>Pf,disable:()=>Vf,document:()=>Nf,flow:()=>If,flowInitial:()=>Ff,insideSpan:()=>zf,string:()=>Lf,text:()=>Rf}),Nf={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:Xu},Pf={91:kd},Ff={[-2]:cd,[-1]:cd,32:cd},If={35:Fd,42:ff,45:[xf,ff],60:Bd,61:xf,95:ff,96:ad,126:ad},Lf={38:nd,92:ed},Rf={[-5]:uf,[-4]:uf,[-3]:uf,33:of,38:nd,42:Hu,60:[Ku,qd],91:cf,92:[Nd,ed],93:Yd,95:Hu,96:fd},zf={null:[Hu,Ef]},Bf={null:[42,95]},Vf={null:[]};function Hf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=q(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Vu(a,l.events,l),l.events):[]}function f(e,t){return Wf(p(e),t)}function p(e){return Uf(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Y(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&_u(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Uf(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Wf(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
44
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function uo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:po(t,`input`,e.processors),output:po(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}var fo=(e,t={})=>n=>{let r=co({...n,processors:t});return F(e,r),lo(r,e),uo(r,e)},po=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=co({...i??{},target:a,io:t,processors:n});return F(e,o),lo(o,e),uo(o,e)},mo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ho=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=mo[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},go=(e,t,n,r)=>{n.not={}},_o=(e,t,n,r)=>{let i=e._zod.def,a=xn(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},vo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})},xo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=F(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},So=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Co=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},wo=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},To=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Eo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Do=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Oo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ko=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;F(a,t,r);let o=t.seen.get(e);o.ref=a},Ao=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},jo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mo=A(`ZodISODateTime`,(e,t)=>{_i.init(e,t),R.init(e,t)});function No(e){return La(Mo,e)}var Po=A(`ZodISODate`,(e,t)=>{vi.init(e,t),R.init(e,t)});function Fo(e){return Ra(Po,e)}var Io=A(`ZodISOTime`,(e,t)=>{yi.init(e,t),R.init(e,t)});function Lo(e){return za(Io,e)}var Ro=A(`ZodISODuration`,(e,t)=>{bi.init(e,t),R.init(e,t)});function zo(e){return Ba(Ro,e)}var Bo=(e,t)=>{er.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>rr(e,t)},flatten:{value:t=>nr(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Sn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Sn,2)}},isEmpty:{get(){return e.issues.length===0}}})};A(`ZodError`,Bo);var Vo=A(`ZodError`,Bo,{Parent:Error}),Ho=ir(Vo),Uo=ar(Vo),Wo=or(Vo),Go=cr(Vo),Ko=ur(Vo),qo=dr(Vo),Jo=fr(Vo),Yo=pr(Vo),Xo=mr(Vo),Zo=hr(Vo),Qo=gr(Vo),$o=_r(Vo),L=A(`ZodType`,(e,t)=>(N.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:po(e,`input`),output:po(e,`output`)}}),e.toJSONSchema=fo(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(On(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Rn(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Ho(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Wo(e,t,n),e.parseAsync=async(t,n)=>Uo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Go(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ko(e,t,n),e.decode=(t,n)=>qo(e,t,n),e.encodeAsync=async(t,n)=>Jo(e,t,n),e.decodeAsync=async(t,n)=>Yo(e,t,n),e.safeEncode=(t,n)=>Xo(e,t,n),e.safeDecode=(t,n)=>Zo(e,t,n),e.safeEncodeAsync=async(t,n)=>Qo(e,t,n),e.safeDecodeAsync=async(t,n)=>$o(e,t,n),e.refine=(t,n)=>e.check(rc(t,n)),e.superRefine=t=>e.check(ic(t)),e.overwrite=t=>e.check(Qa(t)),e.optional=()=>zs(e),e.exactOptional=()=>Vs(e),e.nullable=()=>Us(e),e.nullish=()=>zs(Us(e)),e.nonoptional=t=>Ys(e,t),e.array=()=>Ds(e),e.or=t=>js([e,t]),e.and=t=>Ns(e,t),e.transform=t=>$s(e,Ls(t)),e.default=t=>Gs(e,t),e.prefault=t=>qs(e,t),e.catch=t=>Zs(e,t),e.pipe=t=>$s(e,t),e.readonly=()=>tc(e),e.describe=t=>{let n=e.clone();return pa.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return pa.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return pa.get(e);let n=e.clone();return pa.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),es=A(`_ZodString`,(e,t)=>{ai.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Ka(...t)),e.includes=(...t)=>e.check(Ya(...t)),e.startsWith=(...t)=>e.check(Xa(...t)),e.endsWith=(...t)=>e.check(Za(...t)),e.min=(...t)=>e.check(Wa(...t)),e.max=(...t)=>e.check(Ua(...t)),e.length=(...t)=>e.check(Ga(...t)),e.nonempty=(...t)=>e.check(Wa(1,...t)),e.lowercase=t=>e.check(qa(t)),e.uppercase=t=>e.check(Ja(t)),e.trim=()=>e.check(eo()),e.normalize=(...t)=>e.check($a(...t)),e.toLowerCase=()=>e.check(to()),e.toUpperCase=()=>e.check(no()),e.slugify=()=>e.check(ro())}),ts=A(`ZodString`,(e,t)=>{ai.init(e,t),es.init(e,t),e.email=t=>e.check(ha(rs,t)),e.url=t=>e.check(xa(os,t)),e.jwt=t=>e.check(Ia(xs,t)),e.emoji=t=>e.check(Sa(ss,t)),e.guid=t=>e.check(ga(is,t)),e.uuid=t=>e.check(_a(as,t)),e.uuidv4=t=>e.check(va(as,t)),e.uuidv6=t=>e.check(ya(as,t)),e.uuidv7=t=>e.check(ba(as,t)),e.nanoid=t=>e.check(Ca(cs,t)),e.guid=t=>e.check(ga(is,t)),e.cuid=t=>e.check(wa(ls,t)),e.cuid2=t=>e.check(Ta(us,t)),e.ulid=t=>e.check(Ea(ds,t)),e.base64=t=>e.check(Na(vs,t)),e.base64url=t=>e.check(Pa(ys,t)),e.xid=t=>e.check(Da(fs,t)),e.ksuid=t=>e.check(Oa(ps,t)),e.ipv4=t=>e.check(ka(ms,t)),e.ipv6=t=>e.check(Aa(hs,t)),e.cidrv4=t=>e.check(ja(gs,t)),e.cidrv6=t=>e.check(Ma(_s,t)),e.e164=t=>e.check(Fa(bs,t)),e.datetime=t=>e.check(No(t)),e.date=t=>e.check(Fo(t)),e.time=t=>e.check(Lo(t)),e.duration=t=>e.check(zo(t))});function ns(e){return ma(ts,e)}var R=A(`ZodStringFormat`,(e,t)=>{P.init(e,t),es.init(e,t)}),rs=A(`ZodEmail`,(e,t)=>{ci.init(e,t),R.init(e,t)}),is=A(`ZodGUID`,(e,t)=>{oi.init(e,t),R.init(e,t)}),as=A(`ZodUUID`,(e,t)=>{si.init(e,t),R.init(e,t)}),os=A(`ZodURL`,(e,t)=>{li.init(e,t),R.init(e,t)}),ss=A(`ZodEmoji`,(e,t)=>{ui.init(e,t),R.init(e,t)}),cs=A(`ZodNanoID`,(e,t)=>{di.init(e,t),R.init(e,t)}),ls=A(`ZodCUID`,(e,t)=>{fi.init(e,t),R.init(e,t)}),us=A(`ZodCUID2`,(e,t)=>{pi.init(e,t),R.init(e,t)}),ds=A(`ZodULID`,(e,t)=>{mi.init(e,t),R.init(e,t)}),fs=A(`ZodXID`,(e,t)=>{hi.init(e,t),R.init(e,t)}),ps=A(`ZodKSUID`,(e,t)=>{gi.init(e,t),R.init(e,t)}),ms=A(`ZodIPv4`,(e,t)=>{xi.init(e,t),R.init(e,t)}),hs=A(`ZodIPv6`,(e,t)=>{Si.init(e,t),R.init(e,t)}),gs=A(`ZodCIDRv4`,(e,t)=>{Ci.init(e,t),R.init(e,t)}),_s=A(`ZodCIDRv6`,(e,t)=>{wi.init(e,t),R.init(e,t)}),vs=A(`ZodBase64`,(e,t)=>{Ei.init(e,t),R.init(e,t)}),ys=A(`ZodBase64URL`,(e,t)=>{Oi.init(e,t),R.init(e,t)}),bs=A(`ZodE164`,(e,t)=>{ki.init(e,t),R.init(e,t)}),xs=A(`ZodJWT`,(e,t)=>{ji.init(e,t),R.init(e,t)}),Ss=A(`ZodUnknown`,(e,t)=>{Mi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Cs(){return Va(Ss)}var ws=A(`ZodNever`,(e,t)=>{Ni.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function Ts(e){return Ha(ws,e)}var Es=A(`ZodArray`,(e,t)=>{Fi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Wa(t,n)),e.nonempty=t=>e.check(Wa(1,t)),e.max=(t,n)=>e.check(Ua(t,n)),e.length=(t,n)=>e.check(Ga(t,n)),e.unwrap=()=>e.element});function Ds(e,t){return io(Es,e,t)}var Os=A(`ZodObject`,(e,t)=>{Bi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),j(e,`shape`,()=>t.shape),e.keyof=()=>Fs(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Cs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Cs()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ts()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Hn(e,t),e.safeExtend=t=>Un(e,t),e.merge=t=>Wn(e,t),e.pick=t=>Bn(e,t),e.omit=t=>Vn(e,t),e.partial=(...t)=>Gn(Rs,e,t[0]),e.required=(...t)=>Kn(Js,e,t[0])});function ks(e,t){return new Os({type:`object`,shape:e??{},...M(t)})}var As=A(`ZodUnion`,(e,t)=>{Hi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.options=t.options});function js(e,t){return new As({type:`union`,options:e,...M(t)})}var Ms=A(`ZodIntersection`,(e,t)=>{Ui.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function Ns(e,t){return new Ms({type:`intersection`,left:e,right:t})}var Ps=A(`ZodEnum`,(e,t)=>{Ki.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ps({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ps({...t,checks:[],...M(r),entries:i})}});function Fs(e,t){return new Ps({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var Is=A(`ZodTransform`,(e,t)=>{qi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new vn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Qn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ls(e){return new Is({type:`transform`,transform:e})}var Rs=A(`ZodOptional`,(e,t)=>{Yi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zs(e){return new Rs({type:`optional`,innerType:e})}var Bs=A(`ZodExactOptional`,(e,t)=>{Xi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vs(e){return new Bs({type:`optional`,innerType:e})}var Hs=A(`ZodNullable`,(e,t)=>{Zi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Us(e){return new Hs({type:`nullable`,innerType:e})}var Ws=A(`ZodDefault`,(e,t)=>{Qi.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gs(e,t){return new Ws({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Fn(t)}})}var Ks=A(`ZodPrefault`,(e,t)=>{ea.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qs(e,t){return new Ks({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Fn(t)}})}var Js=A(`ZodNonOptional`,(e,t)=>{ta.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ys(e,t){return new Js({type:`nonoptional`,innerType:e,...M(t)})}var Xs=A(`ZodCatch`,(e,t)=>{ra.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Zs(e,t){return new Xs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Qs=A(`ZodPipe`,(e,t)=>{ia.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.in=t.in,e.out=t.out});function $s(e,t){return new Qs({type:`pipe`,in:e,out:t})}var ec=A(`ZodReadonly`,(e,t)=>{oa.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new ec({type:`readonly`,innerType:e})}var nc=A(`ZodCustom`,(e,t)=>{ca.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function rc(e,t={}){return ao(nc,e,t)}function ic(e){return oo(e)}var ac=[`bar`,`line`,`pie`,`bignumber`,`table`,`scatter`,`funnel`],oc=/(\w+)=(?:"([^"]*)"|'([^']*)'|(true|false|-?(?:\d+\.?\d*|\.\d+)))/g;function sc(e){let t={},n=new RegExp(oc.source,oc.flags),r;for(;(r=n.exec(e))!==null;)t[r[1]]=r[2]??r[3]??r[4]??``;return t}function cc(e){if(e!==void 0)return e===`true`}function lc(e){if(e===void 0)return;let t=Number(e);return Number.isNaN(t)?void 0:t}var uc=/\{%\s*(\w+)\s+((?:(?!\/%\})[\s\S])*)\/%\}/g;function dc(e){let t=[],n=0,r=new RegExp(uc.source,uc.flags),i;for(;(i=r.exec(e))!==null;){let[r,a,o]=i,s=i.index;s>n&&t.push({kind:`text`,content:e.slice(n,s)});let c=a.toLowerCase();if(ac.includes(c)){let e={type:c,attrs:sc(o),raw:r};t.push({kind:`chart`,node:e})}else t.push({kind:`text`,content:r});n=s+r.length}return n<e.length&&t.push({kind:`text`,content:e.slice(n)}),t}function fc(e,t){let n=[];switch(e){case`bar`:case`line`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`pie`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`bignumber`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.value||n.push({field:`value`,message:`value is required`});break;case`table`:t.sql||n.push({field:`sql`,message:`sql is required`});break;case`scatter`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.x||n.push({field:`x`,message:`x is required`}),t.y||n.push({field:`y`,message:`y is required`});break;case`funnel`:t.sql||n.push({field:`sql`,message:`sql is required`}),t.name||n.push({field:`name`,message:`name is required`}),t.value||n.push({field:`value`,message:`value is required`});break}return n.length>0?{valid:!1,errors:n}:{valid:!0}}function pc({option:e,style:t={height:`400px`,width:`100%`},settings:n={notMerge:!0},theme:r}){let i=(0,u.useRef)(null),a=(0,u.useRef)(null);return(0,u.useEffect)(()=>{i.current&&(a.current=h.init(i.current,r));let e=()=>{a.current?.resize()};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e),a.current?.dispose()}},[r]),(0,u.useEffect)(()=>{if(a.current&&e){let t={...e,grid:{left:30,right:30,top:100,bottom:50,containLabel:!0},toolbox:{show:!0,...e.toolbox,feature:{saveAsImage:{show:!0,title:`Download`,pixelRatio:2},restore:{show:!0},...e.toolbox?.feature||{}}}};a.current.setOption(t,n)}},[e,n]),(0,m.jsx)(`div`,{ref:i,style:t})}var mc=(0,u.createContext)(void 0);function hc({accountUid:e,children:t}){return(0,m.jsx)(mc.Provider,{value:{accountUid:e},children:t})}function gc(){let e=(0,u.useContext)(mc);if(!e)throw Error(`useAccount must be used within AccountProvider`);return e}var _c={querySql:async(e,t)=>{let{data:n}=await Fe({body:{sql:t.sql},throwOnError:!0});if(!n?.data)throw Error(`No data returned from SQL query`);let r=n.data;return{rows:r.rows??[],columns:r.columns??[],row_count:r.row_count??0}}},vc=(e,t,n)=>un({queryKey:[`dataset-sql`,e,t],queryFn:()=>_c.querySql(e,t),enabled:(n?.enabled??!0)&&!!e&&!!t.sql,placeholderData:e=>e});function yc({sql:e,x:t,y:n,title:r,horizontal:i=!1,xAxisName:a,yAxisName:o,height:s=`400px`}){let{accountUid:c}=gc(),[l,d]=(0,u.useState)(!1),{data:f,isLoading:p,isError:h,error:g}=vc(c,(0,u.useMemo)(()=>({sql:e}),[e])),_=(0,u.useMemo)(()=>{if(!f?.rows?.length)return null;let e=f.rows.map(e=>String(e[t]??``)),s=f.rows.map(e=>e[n]??null);return{title:r?{text:r}:void 0,tooltip:{trigger:`axis`,axisPointer:{type:`shadow`}},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)}}},grid:{containLabel:!0},...i?{xAxis:{type:`value`,name:a},yAxis:{type:`category`,data:e,name:o}}:{xAxis:{type:`category`,data:e,name:a},yAxis:{type:`value`,name:o}},series:[{type:`bar`,data:s,label:l?{show:!0,position:i?`right`:`top`}:void 0}]}},[f,t,n,r,i,a,o,l]),v={height:typeof s==`number`?`${s}px`:s,width:`100%`};return p?(0,m.jsx)(`div`,{style:v,className:`erica-chart-loading`}):h?(0,m.jsx)(`div`,{style:{...v,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-error-container`,children:(0,m.jsx)(`p`,{className:`erica-chart-error-text`,children:g?.message??`Failed to load chart data`})}):_?(0,m.jsx)(pc,{option:_,style:v}):(0,m.jsx)(`div`,{style:{...v,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{className:`erica-chart-no-data-text`,children:`No data`})})}function bc({sql:e,x:t,y:n,title:r,xAxisName:i,yAxisName:a,height:o=`400px`}){let{accountUid:s}=gc(),[c,l]=(0,u.useState)(!1),{data:d,isLoading:f,isError:p,error:h}=vc(s,(0,u.useMemo)(()=>({sql:e}),[e])),g=(0,u.useMemo)(()=>{if(!d?.rows?.length)return null;let e=d.rows.map(e=>String(e[t]??``)),o=d.rows.map(e=>e[n]??null);return{title:r?{text:r}:void 0,tooltip:{trigger:`axis`},toolbox:{feature:{myToggleLabels:{show:!0,title:c?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>l(e=>!e)}}},grid:{containLabel:!0},xAxis:{type:`category`,data:e,name:i},yAxis:{type:`value`,name:a},series:[{type:`line`,data:o,smooth:!0,label:c?{show:!0,position:`top`}:void 0}]}},[d,t,n,r,i,a,c]),_={height:typeof o==`number`?`${o}px`:o,width:`100%`};return f?(0,m.jsx)(`div`,{style:_,className:`erica-chart-loading`}):p?(0,m.jsx)(`div`,{style:{..._,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-error-container`,children:(0,m.jsx)(`p`,{className:`erica-chart-error-text`,children:h?.message??`Failed to load chart data`})}):g?(0,m.jsx)(pc,{option:g,style:_}):(0,m.jsx)(`div`,{style:{..._,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{className:`erica-chart-no-data-text`,children:`No data`})})}function xc({sql:e,name:t,value:n,title:r,height:i=`400px`,donut:a=!1,showLabels:o=!0,showLegend:s=!0}){let{accountUid:c}=gc(),[l,d]=(0,u.useState)(o),[f,p]=(0,u.useState)(s),{data:h,isLoading:g,isError:_,error:v}=vc(c,(0,u.useMemo)(()=>({sql:e}),[e])),y=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[t]??``),value:Number(e[n]??0)}));return{title:r?{text:r}:void 0,tooltip:{trigger:`item`,formatter:`{a} <br/>{b}: {c} ({d}%)`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:f?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>p(e=>!e)}}},legend:f?{show:!0,orient:`vertical`,left:`left`}:void 0,series:[{name:r??`Data`,type:`pie`,radius:a?[`40%`,`70%`]:`70%`,data:e,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:`rgba(0, 0, 0, 0.5)`}},label:{show:l,formatter:`{b}: {c} ({d}%)`}}]}},[h,t,n,r,a,l,f]),b={height:typeof i==`number`?`${i}px`:i,width:`100%`};return g?(0,m.jsx)(`div`,{style:b,className:`erica-chart-loading`}):_?(0,m.jsx)(`div`,{style:{...b,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-error-container`,children:(0,m.jsx)(`p`,{className:`erica-chart-error-text`,children:v?.message??`Failed to load chart data`})}):y?(0,m.jsx)(pc,{option:y,style:b}):(0,m.jsx)(`div`,{style:{...b,display:`flex`,alignItems:`center`,justifyContent:`center`},className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{className:`erica-chart-no-data-text`,children:`No data`})})}var Sc={red:`#dc2626`,green:`#16a34a`,blue:`#2563eb`,yellow:`#ca8a04`,orange:`#ea580c`,purple:`#9333ea`,pink:`#db2777`,gray:`#6b7280`,black:`#111827`,white:`#ffffff`},Cc=e=>{if(!e)return null;let t=e.indexOf(`|`);if(t===-1)return{text:e};let n=e.slice(0,t).trim().toLowerCase(),r=e.slice(t+1).trim();return r?{text:r,color:Sc[n]??n}:{text:e}};function wc({sql:e,value:t,title:n=`Big Number`,subtitle:r,description:i,prefix:a=``,suffix:o=``,decimals:s=0}){let{accountUid:c}=gc(),{data:l,isLoading:d,isError:f,error:p}=vc(c,(0,u.useMemo)(()=>({sql:e}),[e])),h=(0,u.useMemo)(()=>l?.rows?.length?l.rows[0]?.[t]??null:null,[l,t]),g=(0,u.useMemo)(()=>{if(h==null||h===``)return`--`;let e=Number(h);return Number.isNaN(e)?String(h):`${a}${e.toLocaleString(void 0,{minimumFractionDigits:s,maximumFractionDigits:s})}${o}`},[h,a,o,s]),_=(0,u.useMemo)(()=>Cc(n),[n]),v=(0,u.useMemo)(()=>Cc(r),[r]),y=(0,u.useMemo)(()=>Cc(i),[i]),b=(0,u.useMemo)(()=>Cc(g),[g]);return d?(0,m.jsxs)(`div`,{className:`erica-bignumber-chart erica-bignumber-loading`,children:[(0,m.jsx)(`div`,{className:`erica-bignumber-skeleton-title`}),(0,m.jsx)(`div`,{className:`erica-bignumber-skeleton-value`}),(0,m.jsx)(`div`,{className:`erica-bignumber-skeleton-subtitle`})]}):f?(0,m.jsx)(`div`,{className:`erica-bignumber-chart erica-bignumber-error`,children:(0,m.jsx)(`p`,{className:`erica-bignumber-error-text`,children:p?.message??`Failed to load big number data`})}):(0,m.jsxs)(`div`,{className:`erica-bignumber-chart`,children:[(0,m.jsxs)(`div`,{className:`erica-bignumber-header`,children:[(0,m.jsx)(`p`,{className:`erica-bignumber-title`,style:_?.color?{color:_.color}:void 0,children:_?.text??n}),v&&(0,m.jsx)(`p`,{className:`erica-bignumber-subtitle`,style:v.color?{color:v.color}:void 0,children:v.text})]}),(0,m.jsxs)(`div`,{className:`erica-bignumber-content`,children:[(0,m.jsx)(`p`,{className:`erica-bignumber-value`,style:b?.color?{color:b.color}:void 0,children:b?.text??g}),y&&(0,m.jsx)(`p`,{className:`erica-bignumber-description`,style:y.color?{color:y.color}:void 0,children:y.text})]})]})}var Tc=e=>e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e);function Ec({sql:e,title:t,height:n=`400px`,columns:r,maxRows:i}){let{accountUid:a}=gc(),{data:o,isLoading:s,isError:c,error:l}=vc(a,(0,u.useMemo)(()=>({sql:e}),[e])),d=(0,u.useMemo)(()=>{let e=o?.columns?.length?o.columns:[];return r?r.split(`,`).map(e=>e.trim()).filter(t=>e.includes(t)):e},[o,r]),f=(0,u.useMemo)(()=>{let e=o?.rows??[];return!i||i<=0?e:e.slice(0,i)},[o,i]),p={height:typeof n==`number`?`${n}px`:n,width:`100%`};return s?(0,m.jsx)(`div`,{style:p,className:`erica-chart-loading`,children:(0,m.jsx)(`div`,{className:`erica-chart-loading-spinner`})}):c?(0,m.jsx)(`div`,{style:p,className:`erica-chart-error`,children:(0,m.jsx)(`p`,{children:l?.message??`Failed to load table data`})}):!d.length||!f.length?(0,m.jsx)(`div`,{style:p,className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{children:`No data`})}):(0,m.jsxs)(`div`,{style:p,className:`erica-table-chart`,children:[t&&(0,m.jsx)(`div`,{className:`erica-table-chart-header`,children:(0,m.jsx)(`p`,{className:`erica-table-chart-title`,children:t})}),(0,m.jsx)(`div`,{className:`erica-table-chart-container`,children:(0,m.jsxs)(`table`,{className:`erica-table`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsx)(`tr`,{children:d.map(e=>(0,m.jsx)(`th`,{children:e},e))})}),(0,m.jsx)(`tbody`,{children:f.map((e,t)=>(0,m.jsx)(`tr`,{children:d.map(n=>(0,m.jsx)(`td`,{children:(0,m.jsx)(`div`,{className:`erica-table-cell-content`,children:Tc(e[n])})},`${t}-${n}`))},String(e._erica_id??t)))})]})})]})}var Dc=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0));function Oc({sql:e,x:t,y:n,seriesBy:r,size:i,color:a,title:o,height:s=`400px`,xAxisName:c,yAxisName:l}){let{accountUid:d}=gc(),[f,p]=(0,u.useState)(!1),h=(0,u.useMemo)(()=>n.includes(`,`)?n.split(`,`).map(e=>e.trim()):[n],[n]),{data:g,isLoading:_,isError:v,error:y}=vc(d,(0,u.useMemo)(()=>({sql:e}),[e])),b=(0,u.useMemo)(()=>{if(!g?.rows?.length)return null;let e=(e,n)=>{let r=[Number(e[t]??0),Number(e[n]??0)];return i&&r.push(Number(e[i]??0)),a&&r.push(String(e[a]??``)),r},n=r?g.rows.reduce((e,t)=>{let n=String(t[r]??`Unknown`);return e[n]||(e[n]=[]),e[n].push(t),e},{}):null,s=(e,t)=>({name:t,type:`scatter`,symbolSize:i?e=>Math.sqrt(e[2])*2:10,data:e,label:f?{show:!0,formatter:e=>{let t=e.value;return`${t[0]}, ${t[1]}`}}:void 0,itemStyle:a?{color:e=>{let t=e.value,n=t[t.length-1],r=[`#5470c6`,`#91cc75`,`#fac858`,`#ee6666`,`#73c0de`,`#3ba272`,`#fc8452`,`#9a60b4`,`#ea7ccc`];return r[n.split(``).reduce((e,t)=>e+t.charCodeAt(0),0)%r.length]}}:void 0}),u=n?Object.entries(n).flatMap(([t,n])=>h.map(r=>{let i=h.length>1?`${t} - ${r}`:t;return s(n.map(t=>e(t,r)),i)})):h.map(t=>s(g.rows.map(n=>e(n,t)),t));return Dc({title:o?{text:o}:void 0,tooltip:{trigger:`item`,formatter:e=>{let n=e.value,r=`${e.seriesName?`${e.seriesName}<br/>`:``}${t}: ${n[0]}<br/>${l??`Value`}: ${n[1]}`,o=2;return i&&(r+=`<br/>${i}: ${n[o++]}`),a&&(r+=`<br/>${a}: ${n[o]}`),r}},toolbox:{feature:{myToggleLabels:{show:!0,title:f?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>p(e=>!e)}}},xAxis:{type:`value`,name:c,scale:!0},yAxis:{type:`value`,name:l,scale:!0},legend:u.length>1?{show:!0}:void 0,series:u})},[g,t,h,r,i,a,o,c,l,f]),x={height:typeof s==`number`?`${s}px`:s,width:`100%`};return _?(0,m.jsxs)(`div`,{style:x,className:`erica-chart-loading`,children:[(0,m.jsx)(`div`,{className:`erica-chart-loading-spinner`}),(0,m.jsx)(`p`,{children:`Loading scatter chart...`})]}):v?(0,m.jsx)(`div`,{style:x,className:`erica-chart-error`,children:(0,m.jsx)(`p`,{children:y?.message??`Failed to load chart data`})}):b?(0,m.jsx)(pc,{option:b,style:x}):(0,m.jsx)(`div`,{style:x,className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{children:`No data`})})}var kc=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0));function Ac({sql:e,name:t,value:n,title:r,height:i=`400px`,showLabels:a=!0,showLegend:o=!1,sort:s=`descending`}){let{accountUid:c}=gc(),[l,d]=(0,u.useState)(a),[f,p]=(0,u.useState)(o),{data:h,isLoading:g,isError:_,error:v}=vc(c,(0,u.useMemo)(()=>({sql:e}),[e])),y=(0,u.useMemo)(()=>{if(!h?.rows?.length)return null;let e=h.rows.map(e=>({name:String(e[t]??``),value:Number(e[n]??0)}));return kc({title:r?{text:r}:void 0,tooltip:{trigger:`item`,formatter:`{b}: {c}`},toolbox:{feature:{myToggleLabels:{show:!0,title:l?`Hide Labels`:`Show Labels`,icon:`path://M3 3h18v18H3z M6 6h12v2H6z M6 10h8v2H6z`,onclick:()=>d(e=>!e)},myToggleLegend:{show:!0,title:f?`Hide Legend`:`Show Legend`,icon:`path://M4 6h16M4 12h16M4 18h16`,onclick:()=>p(e=>!e)}}},legend:f?{show:!0,top:`bottom`}:void 0,series:[{type:`funnel`,left:`10%`,top:60,bottom:20,width:`80%`,min:0,minSize:`0%`,maxSize:`100%`,sort:s,gap:4,label:{show:l,position:`inside`,formatter:`{b}: {c}`},emphasis:{label:{fontSize:14}},data:e}]})},[h,t,n,r,s,l,f]),b={height:typeof i==`number`?`${i}px`:i,width:`100%`};return g?(0,m.jsx)(`div`,{style:b,className:`erica-chart-loading`,children:(0,m.jsx)(`div`,{className:`erica-chart-loading-spinner`})}):_?(0,m.jsx)(`div`,{style:b,className:`erica-chart-error`,children:(0,m.jsx)(`p`,{children:v?.message??`Failed to load chart data`})}):y?(0,m.jsx)(pc,{option:y,style:b}):(0,m.jsx)(`div`,{style:b,className:`erica-chart-no-data`,children:(0,m.jsx)(`p`,{children:`No data`})})}function jc({type:e,errors:t}){return(0,m.jsxs)(`div`,{className:`erica-chart-error`,children:[(0,m.jsxs)(`p`,{className:`erica-chart-error-title`,children:[`Erica Chart syntax error — `,(0,m.jsx)(`code`,{children:e})]}),(0,m.jsx)(`ul`,{className:`erica-chart-error-list`,children:t.map(e=>(0,m.jsx)(`li`,{className:`erica-chart-error-item`,children:e.message},e.field))})]})}function Mc(e){let{type:t,attrs:n}=e,r=fc(t,n);if(!r.valid)return(0,m.jsx)(jc,{type:t,errors:r.errors});switch(t){case`bar`:return(0,m.jsx)(yc,{sql:n.sql,x:n.x,y:n.y,title:n.title,horizontal:cc(n.horizontal),xAxisName:n.xAxisName,yAxisName:n.yAxisName});case`line`:return(0,m.jsx)(bc,{sql:n.sql,x:n.x,y:n.y,title:n.title,xAxisName:n.xAxisName,yAxisName:n.yAxisName});case`pie`:return(0,m.jsx)(xc,{sql:n.sql,name:n.name,value:n.value,title:n.title});case`bignumber`:return(0,m.jsx)(wc,{sql:n.sql,value:n.value,title:n.title,subtitle:n.subtitle,description:n.description,prefix:n.prefix,suffix:n.suffix,decimals:lc(n.decimals)});case`table`:return(0,m.jsx)(Ec,{sql:n.sql,title:n.title,height:n.height,columns:n.columns,maxRows:lc(n.maxRows)});case`scatter`:return(0,m.jsx)(Oc,{sql:n.sql,x:n.x,y:n.y,seriesBy:n.seriesBy,size:n.size,color:n.color,title:n.title,height:n.height,xAxisName:n.xAxisName,yAxisName:n.yAxisName});case`funnel`:return(0,m.jsx)(Ac,{sql:n.sql,name:n.name,value:n.value,title:n.title,height:n.height,showLabels:cc(n.showLabels),showLegend:cc(n.showLegend),sort:n.sort});default:return null}}function Nc({markdown:e}){return(0,m.jsx)(`div`,{className:`erica-chart-container`,children:(0,u.useMemo)(()=>dc(e),[e]).map((e,t)=>e.kind===`text`?e.content.trim()?(0,m.jsx)(`div`,{className:`erica-chart-text`,children:e.content},t):null:(0,m.jsx)(`div`,{className:`erica-chart-wrapper`,children:Mc(e.node)},t))})}var Pc=ks({chartConfig:ns().describe(`Erica chart config syntax.`)});function Fc({chartConfig:e}){return(0,m.jsx)(`div`,{className:`erica-chart-card`,children:(0,m.jsx)(Nc,{markdown:e})})}var Ic=(0,u.createContext)(null);function Lc({children:e}){let[t,n]=(0,u.useState)(!1),[r,i]=(0,u.useState)(null),[a,o]=(0,u.useState)(`Artifacts`);return(0,m.jsx)(Ic.Provider,{value:{isOpen:t,onOpen:()=>n(!0),onClose:()=>n(!1),content:r,setContent:i,title:a,setTitle:o},children:e})}var Rc=()=>(0,u.useContext)(Ic)||{isOpen:!1,onOpen:()=>{},onClose:()=>{},content:null,setContent:()=>{},title:`Artifacts`,setTitle:()=>{}};function zc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Bc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hc={};function Uc(e,t){return((t||Hc).jsx?Vc:Bc).test(e)}var Wc=/[ \t\n\f\r]/g;function Gc(e){return typeof e==`object`?e.type===`text`?Kc(e.value):!1:Kc(e)}function Kc(e){return e.replace(Wc,``)===``}var qc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};qc.prototype.normal={},qc.prototype.property={},qc.prototype.space=void 0;function Jc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new qc(n,r,t)}function Yc(e){return e.toLowerCase()}var z=class{constructor(e,t){this.attribute=t,this.property=e}};z.prototype.attribute=``,z.prototype.booleanish=!1,z.prototype.boolean=!1,z.prototype.commaOrSpaceSeparated=!1,z.prototype.commaSeparated=!1,z.prototype.defined=!1,z.prototype.mustUseProperty=!1,z.prototype.number=!1,z.prototype.overloadedBoolean=!1,z.prototype.property=``,z.prototype.spaceSeparated=!1,z.prototype.space=void 0;var Xc=s({boolean:()=>B,booleanish:()=>V,commaOrSpaceSeparated:()=>W,commaSeparated:()=>$c,number:()=>H,overloadedBoolean:()=>Qc,spaceSeparated:()=>U}),Zc=0,B=el(),V=el(),Qc=el(),H=el(),U=el(),$c=el(),W=el();function el(){return 2**++Zc}var tl=Object.keys(Xc),nl=class extends z{constructor(e,t,n,r){let i=-1;if(super(e,t),rl(this,`space`,r),typeof n==`number`)for(;++i<tl.length;){let e=tl[i];rl(this,tl[i],(n&Xc[e])===Xc[e])}}};nl.prototype.defined=!0;function rl(e,t,n){n&&(e[t]=n)}function il(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new nl(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Yc(r)]=r,n[Yc(a.attribute)]=r}return new qc(t,n,e.space)}var al=il({properties:{ariaActiveDescendant:null,ariaAtomic:V,ariaAutoComplete:null,ariaBusy:V,ariaChecked:V,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:U,ariaCurrent:null,ariaDescribedBy:U,ariaDetails:null,ariaDisabled:V,ariaDropEffect:U,ariaErrorMessage:null,ariaExpanded:V,ariaFlowTo:U,ariaGrabbed:V,ariaHasPopup:null,ariaHidden:V,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:U,ariaLevel:H,ariaLive:null,ariaModal:V,ariaMultiLine:V,ariaMultiSelectable:V,ariaOrientation:null,ariaOwns:U,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:V,ariaReadOnly:V,ariaRelevant:null,ariaRequired:V,ariaRoleDescription:U,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:V,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function ol(e,t){return t in e?e[t]:t}function sl(e,t){return ol(e,t.toLowerCase())}var cl=il({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:$c,acceptCharset:U,accessKey:U,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:U,autoFocus:B,autoPlay:B,blocking:U,capture:null,charSet:null,checked:B,cite:null,className:U,cols:H,colSpan:null,content:null,contentEditable:V,controls:B,controlsList:U,coords:H|$c,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:Qc,draggable:V,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:U,height:H,hidden:Qc,high:H,href:null,hrefLang:null,htmlFor:U,httpEquiv:U,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:U,itemRef:U,itemScope:B,itemType:U,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,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:B,optimum:H,pattern:null,ping:U,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:U,required:B,reversed:B,rows:H,rowSpan:H,sandbox:U,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:V,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:V,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:U,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:V,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:B,disableRemotePlayback:B,prefix:null,property:null,results:H,security:null,unselectable:null},space:`html`,transform:sl}),ll=il({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:W,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:U,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:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,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:$c,g2:$c,glyphName:$c,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:W,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,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:H,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:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:U,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:W,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:W,rev:W,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:W,requiredFeatures:W,requiredFonts:W,requiredFormats:W,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:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:W,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:W,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:W,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:ol}),ul=il({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),dl=il({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:sl}),fl=il({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),pl={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`},ml=/[A-Z]/g,hl=/-[a-z]/g,gl=/^data[-\w.:]+$/i;function _l(e,t){let n=Yc(t),r=t,i=z;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&gl.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(hl,yl);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!hl.test(e)){let n=e.replace(ml,vl);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=nl}return new i(r,t)}function vl(e){return`-`+e.toLowerCase()}function yl(e){return e.charAt(1).toUpperCase()}var bl=Jc([al,cl,ul,dl,fl],`html`),xl=Jc([al,ll,ul,dl,fl],`svg`);function Sl(e){return e.join(` `).trim()}var Cl=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
45
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),wl=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Cl());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Tl=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),El=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(wl()),r=Tl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Dl=kl(`end`),Ol=kl(`start`);function kl(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Al(e){let t=Ol(e),n=Dl(e);if(t&&n)return{start:t,end:n}}function jl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Nl(e.position):`start`in e||`end`in e?Nl(e):`line`in e||`column`in e?Ml(e):``}function Ml(e){return Pl(e&&e.line)+`:`+Pl(e&&e.column)}function Nl(e){return Ml(e&&e.start)+`-`+Ml(e&&e.end)}function Pl(e){return e&&typeof e==`number`?e:1}var G=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let 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=jl(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};G.prototype.file=``,G.prototype.name=``,G.prototype.reason=``,G.prototype.message=``,G.prototype.stack=``,G.prototype.column=void 0,G.prototype.line=void 0,G.prototype.ancestors=void 0,G.prototype.cause=void 0,G.prototype.fatal=void 0,G.prototype.place=void 0,G.prototype.ruleId=void 0,G.prototype.source=void 0;var Fl=l(El(),1),Il={}.hasOwnProperty,Ll=new Map,Rl=/[A-Z]/g,zl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Bl=new Set([`td`,`th`]),Vl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Hl(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=$l(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ql(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?xl:bl,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Ul(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Ul(e,t,n){if(t.type===`element`)return Wl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Gl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ql(e,t,n);if(t.type===`mdxjsEsm`)return Kl(e,t);if(t.type===`root`)return Jl(e,t,n);if(t.type===`text`)return Yl(e,t)}function Wl(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=xl,e.schema=i),e.ancestors.push(t);let a=au(e,t.tagName,!1),o=eu(e,t),s=nu(e,t);return zl.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Gc(e):!0})),Xl(e,o,a,t),Zl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Gl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}ou(e,t.position)}function Kl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ou(e,t.position)}function ql(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=xl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:au(e,t.name,!0),o=tu(e,t),s=nu(e,t);return Xl(e,o,a,t),Zl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Jl(e,t,n){let r={};return Zl(r,nu(e,t)),e.create(t,e.Fragment,r,n)}function Yl(e,t){return t.value}function Xl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Zl(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ql(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function $l(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ol(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function eu(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Il.call(t.properties,i)){let a=ru(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Bl.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function tu(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ou(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else ou(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function nu(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ll;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Ul(e,a,o);s!==void 0&&n.push(s)}return n}function ru(e,t,n){let r=_l(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?zc(n):Sl(n)),r.property===`style`){let t=typeof n==`object`?n:iu(e,String(n));return e.stylePropertyNameCase===`css`&&(t=su(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?pl[r.property]||r.property:r.attribute,n]}}function iu(e,t){try{return(0,Fl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new G("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Vl+`#cannot-parse-style-attribute`,r}}function au(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Uc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Uc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Il.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ou(e)}function ou(e,t){let n=new G("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Vl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function su(e){let t={},n;for(n in e)Il.call(e,n)&&(t[cu(n)]=e[n]);return t}function cu(e){let t=e.replace(Rl,lu);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function lu(e){return`-`+e.toLowerCase()}var uu={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`]},du={};function fu(e,t){let n=t||du;return pu(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function pu(e,t,n){if(hu(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return mu(e.children,t,n)}return Array.isArray(e)?mu(e,t,n):``}function mu(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=pu(e[i],t,n);return r.join(``)}function hu(e){return!!(e&&typeof e==`object`)}var gu=document.createElement(`i`);function _u(e){let t=`&`+e+`;`;gu.innerHTML=t;let n=gu.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function K(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function vu(e,t){return e.length>0?(K(e,e.length,0,t),e):t}var yu={}.hasOwnProperty;function bu(e){let t={},n=-1;for(;++n<e.length;)xu(t,e[n]);return t}function xu(e,t){let n;for(n in t){let r=(yu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){yu.call(r,a)||(r[a]=[]);let e=i[a];Su(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Su(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);K(e,0,0,r)}function Cu(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function wu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var q=Mu(/[A-Za-z]/),J=Mu(/[\dA-Za-z]/),Tu=Mu(/[#-'*+\--9=?A-Z^-~]/);function Eu(e){return e!==null&&(e<32||e===127)}var Du=Mu(/\d/),Ou=Mu(/[\dA-Fa-f]/),ku=Mu(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function Z(e){return e===-2||e===-1||e===32}var Au=Mu(/\p{P}|\p{S}/u),ju=Mu(/\s/);function Mu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Nu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&J(e.charCodeAt(n+1))&&J(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Q(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Z(r)?(e.enter(n),s(r)):t(r)}function s(r){return Z(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Pu={tokenize:Fu};function Fu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Y(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Iu={tokenize:Ru},Lu={tokenize:zu};function Ru(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return K(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Lu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Lu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Y(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;K(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function zu(e,t,n){return Q(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Bu(e){if(e===null||X(e)||ju(e))return 1;if(Au(e))return 2}function Vu(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Hu={name:`attention`,resolveAll:Uu,tokenize:Wu};function Uu(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Gu(d,-c),Gu(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=vu(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=vu(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=vu(l,Vu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=vu(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=vu(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,K(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Wu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bu(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Bu(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Gu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ku={name:`autolink`,tokenize:qu};function qu(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return q(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||J(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||J(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Eu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Tu(t)?(e.consume(t),l):n(t)}function u(e){return J(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||J(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ju={partial:!0,tokenize:Yu};function Yu(e,t,n){return r;function r(t){return Z(t)?Q(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Y(e)?t(e):n(e)}}var Xu={continuation:{tokenize:Qu},exit:$u,name:`blockQuote`,tokenize:Zu};function Zu(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Z(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Qu(e,t,n){let r=this;return i;function i(t){return Z(t)?Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Xu,t,n)(r)}}function $u(e){e.exit(`blockQuote`)}var ed={name:`characterEscape`,tokenize:td};function td(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return ku(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var nd={name:`characterReference`,tokenize:rd};function rd(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=J,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Ou,u):(e.enter(`characterReferenceValue`),a=7,o=Du,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===J&&!_u(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var id={partial:!0,tokenize:sd},ad={concrete:!0,name:`codeFenced`,tokenize:od};function od(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Y(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(id,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Q(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Y(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Z(t)?Q(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Y(t)?e.check(id,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Z(t)?Q(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Z(t)?Q(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Y(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function sd(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var cd={name:`codeIndented`,tokenize:ud},ld={partial:!0,tokenize:dd};function ud(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Q(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Y(t)?e.attempt(ld,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Y(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function dd(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Q(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Y(e)?i(e):n(e)}}var fd={name:`codeText`,previous:md,resolve:pd,tokenize:hd};function pd(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||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),t-=r-i-2,r=i+2),i=void 0);return e}function md(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function hd(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Y(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var gd=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw 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,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&_d(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),_d(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_d(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){let t=this.left.splice(e,1/0);_d(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);_d(this.left,t.reverse())}}};function _d(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function vd(e){let t={},n=-1,r,i,a,o,s,c,l,u=new gd(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,yd(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return K(e,0,1/0,u.slice(0)),!l}function yd(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var bd={resolve:Sd,tokenize:Cd},xd={partial:!0,tokenize:wd};function Sd(e){return vd(e),e}function Cd(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Y(t)?e.check(xd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function wd(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,a,`linePrefix`)}function a(i){if(i===null||Y(i))return n(i);let 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?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Td(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Eu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Y(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||X(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Eu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Ed(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Y(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Y(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Z(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Dd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Q(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Y(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Od(e,t){let n;return r;function r(i){return Y(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Z(i)?Q(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var kd={name:`definition`,tokenize:jd},Ad={partial:!0,tokenize:Md};function jd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Ed.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=wu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return X(t)?Od(e,l)(t):l(t)}function l(t){return Td(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ad,d,d)(t)}function d(t){return Z(t)?Q(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Y(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Md(e,t,n){return r;function r(t){return X(t)?Od(e,i)(t):n(t)}function i(t){return Dd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Z(t)?Q(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Y(e)?t(e):n(e)}}var Nd={name:`hardBreakEscape`,tokenize:Pd};function Pd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Y(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Fd={name:`headingAtx`,resolve:Id,tokenize:Ld};function Id(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},K(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Ld(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||X(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Y(n)?(e.exit(`atxHeading`),t(n)):Z(n)?Q(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||X(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Rd=`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`.split(`.`),zd=[`pre`,`script`,`style`,`textarea`],Bd={concrete:!0,name:`htmlFlow`,resolveTo:Ud,tokenize:Wd},Vd={partial:!0,tokenize:Kd},Hd={partial:!0,tokenize:Gd};function Ud(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Wd(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ce):q(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):q(a)?(e.consume(a),i=4,r.interrupt?t:ce):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ce):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return q(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||X(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&zd.includes(l)?(i=1,r.interrupt?t(s):D(s)):Rd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||J(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return Z(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||q(t)?(e.consume(t),b):Z(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Z(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Z(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Y(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||X(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Z(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||Y(t)?D(t):Z(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ie):t===60&&i===1?(e.consume(t),ae):t===62&&i===4?(e.consume(t),le):t===63&&i===3?(e.consume(t),ce):t===93&&i===5?(e.consume(t),se):Y(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Vd,ue,te)(t)):t===null||Y(t)?(e.exit(`htmlFlowData`),te(t)):(e.consume(t),D)}function te(t){return e.check(Hd,ne,ue)(t)}function ne(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return t===null||Y(t)?te(t):(e.enter(`htmlFlowData`),D(t))}function ie(t){return t===45?(e.consume(t),ce):D(t)}function ae(t){return t===47?(e.consume(t),o=``,oe):D(t)}function oe(t){if(t===62){let n=o.toLowerCase();return zd.includes(n)?(e.consume(t),le):D(t)}return q(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),oe):D(t)}function se(t){return t===93?(e.consume(t),ce):D(t)}function ce(t){return t===62?(e.consume(t),le):t===45&&i===2?(e.consume(t),ce):D(t)}function le(t){return t===null||Y(t)?(e.exit(`htmlFlowData`),ue(t)):(e.consume(t),le)}function ue(n){return e.exit(`htmlFlow`),t(n)}}function Gd(e,t,n){let r=this;return i;function i(t){return Y(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Kd(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ju,t,n)}}var qd={name:`htmlText`,tokenize:Jd};function Jd(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):q(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):q(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Y(t)?(o=d,ae(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ie(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Y(t)?(o=h,ae(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ie(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ie(t):Y(t)?(o=v,ae(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Y(t)?(o=y,ae(t)):(e.consume(t),y)}function b(e){return e===62?ie(e):y(e)}function x(t){return q(t)?(e.consume(t),S):n(t)}function S(t){return t===45||J(t)?(e.consume(t),S):C(t)}function C(t){return Y(t)?(o=C,ae(t)):Z(t)?(e.consume(t),C):ie(t)}function w(t){return t===45||J(t)?(e.consume(t),w):t===47||t===62||X(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ie):t===58||t===95||q(t)?(e.consume(t),E):Y(t)?(o=T,ae(t)):Z(t)?(e.consume(t),T):ie(t)}function E(t){return t===45||t===46||t===58||t===95||J(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):Y(t)?(o=ee,ae(t)):Z(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,te):Y(t)?(o=D,ae(t)):Z(t)?(e.consume(t),D):(e.consume(t),ne)}function te(t){return t===i?(e.consume(t),i=void 0,re):t===null?n(t):Y(t)?(o=te,ae(t)):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||X(t)?T(t):(e.consume(t),ne)}function re(e){return e===47||e===62||X(e)?T(e):n(e)}function ie(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ae(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),oe}function oe(t){return Z(t)?Q(e,se,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):se(t)}function se(t){return e.enter(`htmlTextData`),o(t)}}var Yd={name:`labelEnd`,resolveAll:$d,resolveTo:ef,tokenize:tf},Xd={tokenize:nf},Zd={tokenize:rf},Qd={tokenize:af};function $d(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&K(e,0,e.length,n),e}function ef(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=vu(s,e.slice(a+1,a+r+3)),s=vu(s,[[`enter`,u,t]]),s=vu(s,Vu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=vu(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=vu(s,e.slice(o+1)),s=vu(s,[[`exit`,c,t]]),K(e,a,e.length,s),e}function tf(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(wu(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Xd,u,o?u:d)(t):t===91?e.attempt(Zd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Qd,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function nf(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return X(t)?Od(e,a)(t):a(t)}function a(t){return t===41?u(t):Td(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return X(t)?Od(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Dd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return X(t)?Od(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function rf(e,t,n){let r=this;return i;function i(t){return Ed.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(wu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function af(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var of={name:`labelStartImage`,resolveAll:Yd.resolveAll,tokenize:sf};function sf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var cf={name:`labelStartLink`,resolveAll:Yd.resolveAll,tokenize:lf};function lf(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var uf={name:`lineEnding`,tokenize:df};function df(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Q(e,t,`linePrefix`)}}var ff={name:`thematicBreak`,tokenize:pf};function pf(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Y(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Z(t)?Q(e,s,`whitespace`)(t):s(t))}}var $={continuation:{tokenize:_f},exit:yf,name:`list`,tokenize:gf},mf={partial:!0,tokenize:bf},hf={partial:!0,tokenize:vf};function gf(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Du(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ff,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Du(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ju,r.interrupt?n:u,e.attempt(mf,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Z(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function _f(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ju,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Q(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Z(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hf,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Q(e,e.attempt($,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function vf(e,t,n){let r=this;return Q(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function yf(e){e.exit(this.containerState.type)}function bf(e,t,n){let r=this;return Q(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Z(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var xf={name:`setextUnderline`,resolveTo:Sf,tokenize:Cf};function Sf(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Cf(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Z(t)?Q(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Y(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var wf={tokenize:Tf};function Tf(e){let t=this,n=e.attempt(Ju,r,e.attempt(this.parser.constructs.flowInitial,i,Q(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bd,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Ef={resolveAll:Af()},Df=kf(`string`),Of=kf(`text`);function kf(e){return{resolveAll:Af(e===`text`?jf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Af(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function jf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Mf=s({attentionMarkers:()=>Bf,contentInitial:()=>Pf,disable:()=>Vf,document:()=>Nf,flow:()=>If,flowInitial:()=>Ff,insideSpan:()=>zf,string:()=>Lf,text:()=>Rf}),Nf={42:$,43:$,45:$,48:$,49:$,50:$,51:$,52:$,53:$,54:$,55:$,56:$,57:$,62:Xu},Pf={91:kd},Ff={[-2]:cd,[-1]:cd,32:cd},If={35:Fd,42:ff,45:[xf,ff],60:Bd,61:xf,95:ff,96:ad,126:ad},Lf={38:nd,92:ed},Rf={[-5]:uf,[-4]:uf,[-3]:uf,33:of,38:nd,42:Hu,60:[Ku,qd],91:cf,92:[Nd,ed],93:Yd,95:Hu,96:fd},zf={null:[Hu,Ef]},Bf={null:[42,95]},Vf={null:[]};function Hf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=vu(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Vu(a,l.events,l),l.events):[]}function f(e,t){return Wf(p(e),t)}function p(e){return Uf(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Y(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&K(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Uf(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Wf(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
46
46
|
`;break;case-3:o=`\r
|
|
47
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Gf(e){let t={constructs:yu([Mf,...(e||{}).extensions||[]]),content:n(Pu),defined:[],document:n(Iu),flow:n(wf),lazy:{},string:n(Df),text:n(Of)};return t;function n(e){return n;function n(n){return Hf(t,e,n)}}}function Kf(e){for(;!vd(e););return e}var qf=/[\0\t\n\r]/g;function Jf(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(qf.lastIndex=u,c=qf.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Yf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Xf(e){return e.replace(Yf,Zf)}function Zf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Su(n.slice(t?2:1),t?16:10)}return gu(n)||e}var Qf={}.hasOwnProperty;function $f(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),ep(n)(Kf(Gf(n).document().write(Jf()(e,t,!0))))}function ep(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(De),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(Ce),blockQuote:a(ve),characterEscape:T,characterReference:T,codeFenced:a(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ye,o),codeText:a(be,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Se),hardBreakEscape:a(we),hardBreakTrailing:a(we),htmlFlow:a(Te,o),htmlFlowData:T,htmlText:a(Te,o),htmlTextData:T,image:a(Ee),label:o,link:a(De),listItem:a(ke),listItemValue:f,listOrdered:a(Oe,d),listUnordered:a(Oe),paragraph:a(Ae),reference:de,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Ce),strong:a(je),thematicBreak:a(Ne)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:_e,autolinkProtocol:ge,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:me,characterReference:he,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(ae),label:se,labelText:oe,lineEnding:ee,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:fe,resourceDestinationString:ce,resourceTitleString:le,resource:ue,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};np(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Qf.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||ip).call(a,void 0,e[0])}for(r.position={start:tp(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tp(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tp(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ip).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+`): it’s not open`);n.position.end=tp(e.end)}function u(){return du(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Cu(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Me(),n.position={start:tp(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tp(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=tp(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Xf(t),n.identifier=Cu(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function le(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ue(){this.data.inReference=void 0}function de(){this.data.referenceType=`collapsed`}function fe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Cu(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function pe(e){this.data.characterReferenceType=e.type}function me(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Su(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=gu(t);let i=this.stack[this.stack.length-1];i.value+=r}function he(e){let t=this.stack.pop();t.position.end=tp(e.end)}function ge(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function _e(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ve(){return{type:`blockquote`,children:[]}}function ye(){return{type:`code`,lang:null,meta:null,value:``}}function be(){return{type:`inlineCode`,value:``}}function xe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function Se(){return{type:`emphasis`,children:[]}}function Ce(){return{type:`heading`,depth:0,children:[]}}function we(){return{type:`break`}}function Te(){return{type:`html`,value:``}}function Ee(){return{type:`image`,title:null,url:``,alt:null}}function De(){return{type:`link`,title:null,url:``,children:[]}}function Oe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ke(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Ae(){return{type:`paragraph`,children:[]}}function je(){return{type:`strong`,children:[]}}function Me(){return{type:`text`,value:``}}function Ne(){return{type:`thematicBreak`}}}function tp(e){return{line:e.line,column:e.column,offset:e.offset}}function np(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?np(e,r):rp(e,r)}}function rp(e,t){let n;for(n in t)if(Qf.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function ip(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+`) is still open`)}function ap(e){let t=this;t.parser=n;function n(n){return $f(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function op(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function sp(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
47
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Gf(e){let t={constructs:bu([Mf,...(e||{}).extensions||[]]),content:n(Pu),defined:[],document:n(Iu),flow:n(wf),lazy:{},string:n(Df),text:n(Of)};return t;function n(e){return n;function n(n){return Hf(t,e,n)}}}function Kf(e){for(;!vd(e););return e}var qf=/[\0\t\n\r]/g;function Jf(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(qf.lastIndex=u,c=qf.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Yf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Xf(e){return e.replace(Yf,Zf)}function Zf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Cu(n.slice(t?2:1),t?16:10)}return _u(n)||e}var Qf={}.hasOwnProperty;function $f(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),ep(n)(Kf(Gf(n).document().write(Jf()(e,t,!0))))}function ep(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(De),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(Ce),blockQuote:a(ve),characterEscape:T,characterReference:T,codeFenced:a(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ye,o),codeText:a(be,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Se),hardBreakEscape:a(we),hardBreakTrailing:a(we),htmlFlow:a(Te,o),htmlFlowData:T,htmlText:a(Te,o),htmlTextData:T,image:a(Ee),label:o,link:a(De),listItem:a(ke),listItemValue:f,listOrdered:a(Oe,d),listUnordered:a(Oe),paragraph:a(Ae),reference:de,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Ce),strong:a(je),thematicBreak:a(Ne)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:_e,autolinkProtocol:ge,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:me,characterReference:he,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(re),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(te),htmlFlowData:E,htmlText:c(ne),htmlTextData:E,image:c(ae),label:se,labelText:oe,lineEnding:ee,link:c(ie),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:fe,resourceDestinationString:ce,resourceTitleString:le,resource:ue,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};np(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Qf.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||ip).call(a,void 0,e[0])}for(r.position={start:tp(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tp(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tp(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||ip).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+jl({start:e.start,end:e.end})+`): it’s not open`);n.position.end=tp(e.end)}function u(){return fu(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=wu(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Me(),n.position={start:tp(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tp(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=tp(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ae(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function oe(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Xf(t),n.identifier=wu(t).toLowerCase()}function se(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ce(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function le(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ue(){this.data.inReference=void 0}function de(){this.data.referenceType=`collapsed`}function fe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=wu(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function pe(e){this.data.characterReferenceType=e.type}function me(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Cu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=_u(t);let i=this.stack[this.stack.length-1];i.value+=r}function he(e){let t=this.stack.pop();t.position.end=tp(e.end)}function ge(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function _e(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ve(){return{type:`blockquote`,children:[]}}function ye(){return{type:`code`,lang:null,meta:null,value:``}}function be(){return{type:`inlineCode`,value:``}}function xe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function Se(){return{type:`emphasis`,children:[]}}function Ce(){return{type:`heading`,depth:0,children:[]}}function we(){return{type:`break`}}function Te(){return{type:`html`,value:``}}function Ee(){return{type:`image`,title:null,url:``,alt:null}}function De(){return{type:`link`,title:null,url:``,children:[]}}function Oe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ke(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Ae(){return{type:`paragraph`,children:[]}}function je(){return{type:`strong`,children:[]}}function Me(){return{type:`text`,value:``}}function Ne(){return{type:`thematicBreak`}}}function tp(e){return{line:e.line,column:e.column,offset:e.offset}}function np(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?np(e,r):rp(e,r)}}function rp(e,t){let n;for(n in t)if(Qf.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function ip(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+jl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jl({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+jl({start:t.start,end:t.end})+`) is still open`)}function ap(e){let t=this;t.parser=n;function n(n){return $f(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function op(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function sp(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
48
48
|
`}]}function cp(e,t){let n=t.value?t.value+`
|
|
49
49
|
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function lp(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function up(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dp(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Nu(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function fp(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pp(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mp(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function hp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mp(e,t);let i={src:Nu(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function gp(e,t){let n={src:Nu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function _p(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function vp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mp(e,t);let i={href:Nu(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function yp(e,t){let n={href:Nu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function bp(e,t,n){let r=e.all(t),i=n?xp(n):Sp(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
50
50
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
51
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function xp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Sp(n[r])}return t}function Sp(e){return e.spread??e.children.length>1}function Cp(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function wp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Ep(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Dp(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=
|
|
51
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function xp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Sp(n[r])}return t}function Sp(e){return e.spread??e.children.length>1}function Cp(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function wp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Ep(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Dp(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Ol(t.children[1]),o=Dl(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Op(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function kp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Ap=9,jp=32;function Mp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Np(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Np(t.slice(i),i>0,!1)),a.join(``)}function Np(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Ap||t===jp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Ap||t===jp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Pp(e,t){let n={type:`text`,value:Mp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Fp(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Ip={blockquote:op,break:sp,code:cp,delete:lp,emphasis:up,footnoteReference:dp,heading:fp,html:pp,imageReference:hp,image:gp,inlineCode:_p,linkReference:vp,link:yp,listItem:bp,list:Cp,paragraph:wp,root:Tp,strong:Ep,table:Dp,tableCell:kp,tableRow:Op,text:Pp,thematicBreak:Fp,toml:Lp,yaml:Lp,definition:Lp,footnoteDefinition:Lp};function Lp(){}var Rp=typeof self==`object`?self:globalThis,zp=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new Rp[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new Rp[a](o),i)};return r},Bp=e=>zp(new Map,e)(0),Vp=``,{toString:Hp}={},{keys:Up}=Object,Wp=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Hp.call(e).slice(8,-1);switch(n){case`Array`:return[1,Vp];case`Object`:return[2,Vp];case`Date`:return[3,Vp];case`RegExp`:return[4,Vp];case`Map`:return[5,Vp];case`Set`:return[6,Vp];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Gp=([e,t])=>e===0&&(t===`function`||t===`symbol`),Kp=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Wp(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Up(r))(e||!Gp(Wp(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Gp(Wp(n))||Gp(Wp(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Gp(Wp(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},qp=(e,{json:t,lossy:n}={})=>{let r=[];return Kp(!(t||n),!!t,new Map,r)(e),r},Jp=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Bp(qp(e,t)):structuredClone(e):(e,t)=>Bp(qp(e,t));function Yp(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Xp(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Zp(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Yp,r=e.options.footnoteBackLabel||Xp,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Nu(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Jp(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
52
52
|
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
53
|
-
`}]}}var Qp=(function(e){if(e==null)return rm;if(typeof e==`function`)return nm(e);if(typeof e==`object`)return Array.isArray(e)?$p(e):em(e);if(typeof e==`string`)return tm(e);throw Error(`Expected function, string, or object as test`)});function $p(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Qp(e[n]);return nm(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function em(e){let t=e;return nm(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function tm(e){return nm(t);function t(t){return t&&t.type===e}}function nm(e){return t;function t(t,n,r){return!!(im(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function rm(){return!0}function im(e){return typeof e==`object`&&!!e&&`type`in e}function am(e){return e}var om=[];function sm(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Qp(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+am(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=om,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=cm(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function cm(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?om:[e]}function lm(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),sm(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var um={}.hasOwnProperty,dm={};function fm(e,t){let n=t||dm,r=new Map,i=new Map,a={all:s,applyData:mm,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Ip,...n.handlers},one:o,options:n,patch:pm,wrap:gm};return lm(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(um.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Jp(n);return r.children=a.all(e),r}return Jp(e)}return(a.options.unknownHandler||hm)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=_m(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=_m(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function pm(e,t){e.position&&(t.position=
|
|
53
|
+
`}]}}var Qp=(function(e){if(e==null)return rm;if(typeof e==`function`)return nm(e);if(typeof e==`object`)return Array.isArray(e)?$p(e):em(e);if(typeof e==`string`)return tm(e);throw Error(`Expected function, string, or object as test`)});function $p(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Qp(e[n]);return nm(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function em(e){let t=e;return nm(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function tm(e){return nm(t);function t(t){return t&&t.type===e}}function nm(e){return t;function t(t,n,r){return!!(im(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function rm(){return!0}function im(e){return typeof e==`object`&&!!e&&`type`in e}function am(e){return e}var om=[];function sm(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Qp(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+am(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=om,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=cm(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function cm(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?om:[e]}function lm(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),sm(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var um={}.hasOwnProperty,dm={};function fm(e,t){let n=t||dm,r=new Map,i=new Map,a={all:s,applyData:mm,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Ip,...n.handlers},one:o,options:n,patch:pm,wrap:gm};return lm(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(um.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Jp(n);return r.children=a.all(e),r}return Jp(e)}return(a.options.unknownHandler||hm)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=_m(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=_m(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function pm(e,t){e.position&&(t.position=Al(e))}function mm(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Jp(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function hm(e,t){let n=t.data||{},r=`value`in t&&!(um.call(n,`hProperties`)||um.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gm(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
54
54
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
55
55
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
56
56
|
`}),n}function _m(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vm(e,t){let n=fm(e,t),r=n.one(e,void 0),i=Zp(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
57
|
-
`},i)),a}function ym(e,t){return e&&`run`in e?async function(n,r){let i=vm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return vm(n,{file:r,...e||t})}}function bm(e){if(e)throw e}var xm=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Sm(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Cm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?wm(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function wm(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Tm={basename:Em,dirname:Dm,extname:Om,join:km,sep:`/`};function Em(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Mm(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Dm(e){if(Mm(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Om(e){Mm(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function km(...e){let t=-1,n;for(;++t<e.length;)Mm(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Am(n)}function Am(e){Mm(e);let t=e.codePointAt(0)===47,n=jm(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function jm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Mm(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Nm={cwd:Pm};function Pm(){return`/`}function Fm(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Im(e){if(typeof e==`string`)e=new URL(e);else if(!Fm(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Lm(e)}function Lm(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Rm=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],zm=class{constructor(e){let t;t=e?Fm(e)?{path:e}:typeof e==`string`||Um(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Nm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Rm.length;){let e=Rm[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Rm.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Tm.basename(this.path):void 0}set basename(e){Vm(e,`basename`),Bm(e,`basename`),this.path=Tm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Tm.dirname(this.path):void 0}set dirname(e){Hm(this.basename,`dirname`),this.path=Tm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Tm.extname(this.path):void 0}set extname(e){if(Bm(e,`extname`),Hm(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Tm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Fm(e)&&(e=Im(e)),Vm(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Tm.basename(this.path,this.extname):void 0}set stem(e){Vm(e,`stem`),Bm(e,`stem`),this.path=Tm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new K(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Bm(e,t){if(e&&e.includes(Tm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Tm.sep+"`")}function Vm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Hm(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Um(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Wm=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Gm=l(xm(),1),Km={}.hasOwnProperty,qm=new class e extends Wm{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Cm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Gm.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Xm(`data`,this.frozen),this.namespace[e]=t,this):Km.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Xm(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=$m(e),n=this.parser||this.Parser;return Jm(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Jm(`process`,this.parser||this.Parser),Ym(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=$m(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);th(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Jm(`processSync`,this.parser||this.Parser),Ym(`processSync`,this.compiler||this.Compiler),this.process(e,r),Qm(`processSync`,`process`,t),n;function r(e,r){t=!0,bm(e),n=r}}run(e,t,n){Zm(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=$m(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Qm(`runSync`,`run`,n),r;function i(e,t){bm(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=$m(t),r=this.compiler||this.Compiler;return Ym(`stringify`,r),Zm(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Xm(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Gm.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Sm(o)&&Sm(r)&&(r=(0,Gm.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Jm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ym(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Xm(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Zm(e){if(!Sm(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Qm(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function $m(e){return eh(e)?e:new zm(e)}function eh(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function th(e){return typeof e==`string`||nh(e)}function nh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var rh=[],ih={allowDangerousHtml:!0},ah=/^(https?|ircs?|mailto|xmpp)$/i,oh=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function sh(e){let t=ch(e),n=lh(e);return uh(t.runSync(t.parse(n),n),e)}function ch(e){let t=e.rehypePlugins||rh,n=e.remarkPlugins||rh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ih}:ih;return qm().use(ap).use(n).use(ym,r).use(t)}function lh(e){let t=e.children||``,n=new zm;return typeof t==`string`?n.value=t:``+t,n}function uh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||dh;for(let e of oh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return lm(e,l),Vl(e,{Fragment:m.Fragment,components:i,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in lu)if(Object.hasOwn(lu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=lu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function dh(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ah.test(e.slice(0,t))?e:``}function fh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var ph=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),mh={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function hh(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function gh(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function _h(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function vh(e){return _h(e)||hh(e)}var yh=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function bh(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?vh:u===`decimal`?hh:gh;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&ph.includes(y)&&(_=y,v=gu(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?gu(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):vh(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(xh(e))h(7,S),C=`�`;else if(e in mh)h(6,S),C=mh[e];else{let t=``;Sh(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,yh[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function xh(e){return e>=55296&&e<=57343||e>1114111}function Sh(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var Ch=/["&'<>`]/g,wh=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Th=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Eh=/[|\\{}()[\]^$+*?.]/g,Dh=new WeakMap;function Oh(e,t){if(e=e.replace(t.subset?kh(t.subset):Ch,r),t.subset||t.escapeOnly)return e;return e.replace(wh,n).replace(Th,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function kh(e){let t=Dh.get(e);return t||(t=Ah(e),Dh.set(e,t)),t}function Ah(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Eh,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function jh(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Mh(e,t){return Oh(e,Object.assign({format:jh},t))}var Nh={}.hasOwnProperty,Ph={},Fh=/^[^\t\n\r "#'.<=>`}]+$/,Ih=/^[^\t\n\r "'<=>`}]+$/;function Lh(){return{canContainEols:[`textDirective`],enter:{directiveContainer:zh,directiveContainerAttributes:Kh,directiveContainerLabel:Wh,directiveLeaf:Bh,directiveLeafAttributes:Kh,directiveText:Vh,directiveTextAttributes:Kh},exit:{directiveContainer:Qh,directiveContainerAttributeClassValue:Jh,directiveContainerAttributeIdValue:qh,directiveContainerAttributeName:Xh,directiveContainerAttributeValue:Yh,directiveContainerAttributes:Zh,directiveContainerLabel:Gh,directiveContainerName:Uh,directiveLeaf:Qh,directiveLeafAttributeClassValue:Jh,directiveLeafAttributeIdValue:qh,directiveLeafAttributeName:Xh,directiveLeafAttributeValue:Yh,directiveLeafAttributes:Zh,directiveLeafName:Uh,directiveText:Qh,directiveTextAttributeClassValue:Jh,directiveTextAttributeIdValue:qh,directiveTextAttributeName:Xh,directiveTextAttributeValue:Yh,directiveTextAttributes:Zh,directiveTextName:Uh}}}function Rh(e){let t=e||Ph;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=$h,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
57
|
+
`},i)),a}function ym(e,t){return e&&`run`in e?async function(n,r){let i=vm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return vm(n,{file:r,...e||t})}}function bm(e){if(e)throw e}var xm=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Sm(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Cm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?wm(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function wm(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Tm={basename:Em,dirname:Dm,extname:Om,join:km,sep:`/`};function Em(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Mm(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Dm(e){if(Mm(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Om(e){Mm(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function km(...e){let t=-1,n;for(;++t<e.length;)Mm(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Am(n)}function Am(e){Mm(e);let t=e.codePointAt(0)===47,n=jm(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function jm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Mm(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Nm={cwd:Pm};function Pm(){return`/`}function Fm(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Im(e){if(typeof e==`string`)e=new URL(e);else if(!Fm(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Lm(e)}function Lm(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Rm=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],zm=class{constructor(e){let t;t=e?Fm(e)?{path:e}:typeof e==`string`||Um(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Nm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Rm.length;){let e=Rm[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Rm.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Tm.basename(this.path):void 0}set basename(e){Vm(e,`basename`),Bm(e,`basename`),this.path=Tm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Tm.dirname(this.path):void 0}set dirname(e){Hm(this.basename,`dirname`),this.path=Tm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Tm.extname(this.path):void 0}set extname(e){if(Bm(e,`extname`),Hm(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Tm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Fm(e)&&(e=Im(e)),Vm(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Tm.basename(this.path,this.extname):void 0}set stem(e){Vm(e,`stem`),Bm(e,`stem`),this.path=Tm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new G(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Bm(e,t){if(e&&e.includes(Tm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Tm.sep+"`")}function Vm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Hm(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Um(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Wm=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Gm=l(xm(),1),Km={}.hasOwnProperty,qm=new class e extends Wm{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Cm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Gm.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Xm(`data`,this.frozen),this.namespace[e]=t,this):Km.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Xm(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=$m(e),n=this.parser||this.Parser;return Jm(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Jm(`process`,this.parser||this.Parser),Ym(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=$m(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);th(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Jm(`processSync`,this.parser||this.Parser),Ym(`processSync`,this.compiler||this.Compiler),this.process(e,r),Qm(`processSync`,`process`,t),n;function r(e,r){t=!0,bm(e),n=r}}run(e,t,n){Zm(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=$m(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Qm(`runSync`,`run`,n),r;function i(e,t){bm(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=$m(t),r=this.compiler||this.Compiler;return Ym(`stringify`,r),Zm(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Xm(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Gm.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Sm(o)&&Sm(r)&&(r=(0,Gm.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Jm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Ym(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Xm(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Zm(e){if(!Sm(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Qm(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function $m(e){return eh(e)?e:new zm(e)}function eh(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function th(e){return typeof e==`string`||nh(e)}function nh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var rh=[],ih={allowDangerousHtml:!0},ah=/^(https?|ircs?|mailto|xmpp)$/i,oh=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function sh(e){let t=ch(e),n=lh(e);return uh(t.runSync(t.parse(n),n),e)}function ch(e){let t=e.rehypePlugins||rh,n=e.remarkPlugins||rh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ih}:ih;return qm().use(ap).use(n).use(ym,r).use(t)}function lh(e){let t=e.children||``,n=new zm;return typeof t==`string`?n.value=t:``+t,n}function uh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||dh;for(let e of oh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return lm(e,l),Hl(e,{Fragment:m.Fragment,components:i,ignoreInvalidStyle:!0,jsx:m.jsx,jsxs:m.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in uu)if(Object.hasOwn(uu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=uu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function dh(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ah.test(e.slice(0,t))?e:``}function fh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var ph=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),mh={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function hh(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function gh(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function _h(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function vh(e){return _h(e)||hh(e)}var yh=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function bh(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?vh:u===`decimal`?hh:gh;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&ph.includes(y)&&(_=y,v=_u(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?_u(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):vh(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(xh(e))h(7,S),C=`�`;else if(e in mh)h(6,S),C=mh[e];else{let t=``;Sh(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,yh[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function xh(e){return e>=55296&&e<=57343||e>1114111}function Sh(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var Ch=/["&'<>`]/g,wh=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Th=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Eh=/[|\\{}()[\]^$+*?.]/g,Dh=new WeakMap;function Oh(e,t){if(e=e.replace(t.subset?kh(t.subset):Ch,r),t.subset||t.escapeOnly)return e;return e.replace(wh,n).replace(Th,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function kh(e){let t=Dh.get(e);return t||(t=Ah(e),Dh.set(e,t)),t}function Ah(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Eh,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function jh(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Mh(e,t){return Oh(e,Object.assign({format:jh},t))}var Nh={}.hasOwnProperty,Ph={},Fh=/^[^\t\n\r "#'.<=>`}]+$/,Ih=/^[^\t\n\r "'<=>`}]+$/;function Lh(){return{canContainEols:[`textDirective`],enter:{directiveContainer:zh,directiveContainerAttributes:Kh,directiveContainerLabel:Wh,directiveLeaf:Bh,directiveLeafAttributes:Kh,directiveText:Vh,directiveTextAttributes:Kh},exit:{directiveContainer:Qh,directiveContainerAttributeClassValue:Jh,directiveContainerAttributeIdValue:qh,directiveContainerAttributeName:Xh,directiveContainerAttributeValue:Yh,directiveContainerAttributes:Zh,directiveContainerLabel:Gh,directiveContainerName:Uh,directiveLeaf:Qh,directiveLeafAttributeClassValue:Jh,directiveLeafAttributeIdValue:qh,directiveLeafAttributeName:Xh,directiveLeafAttributeValue:Yh,directiveLeafAttributes:Zh,directiveLeafName:Uh,directiveText:Qh,directiveTextAttributeClassValue:Jh,directiveTextAttributeIdValue:qh,directiveTextAttributeName:Xh,directiveTextAttributeValue:Yh,directiveTextAttributes:Zh,directiveTextName:Uh}}}function Rh(e){let t=e||Ph;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=$h,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
58
58
|
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=tg(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=eg(t)?t:void 0}else l=e;if(l&&l.children&&l.children.length>0){let t=n.enter(`label`),r=`${e.type}Label`,i=n.enter(r);c+=a.move(`[`),c+=a.move(n.containerPhrasing(l,{...a.current(),before:c,after:`]`})),c+=a.move(`]`),i(),t()}if(c+=a.move(r(e,n)),e.type===`containerDirective`){let t=(e.children||[])[0],r=e;eg(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
|
|
59
59
|
`),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
|
|
60
60
|
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(Nh.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&Fh.test(u)?`#`+u:i(`id`,u,e,n);else if(l===`class`){let r=u.split(/[\t\n\r ]+/g),a=[],c=[],l=-1;for(;++l<r.length;)(t.preferShortcut!==!1&&Fh.test(r[l])?c:a).push(r[l]);o=a.length>0?i(`class`,a.join(` `),e,n):``,s=c.length>0?`.`+c.join(`.`):``}else a.push(i(l,u,e,n))}return o&&a.unshift(o),s&&a.unshift(s),c&&a.unshift(c),a.length>0?`{`+a.join(` `)+`}`:``}function i(e,n,r,i){if(t.collapseEmptyAttributes!==!1&&!n)return e;if(t.preferUnquoted&&Ih.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&fh(n,a)>fh(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
|
|
61
|
-
`,`\r`];return e+`=`+s+Mh(n,{subset:c})+s}}function zh(e){Hh.call(this,`containerDirective`,e)}function Bh(e){Hh.call(this,`leafDirective`,e)}function Vh(e){Hh.call(this,`textDirective`,e)}function Hh(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function Uh(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function Wh(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function Gh(e){this.exit(e)}function Kh(){this.data.directiveAttributes=[],this.buffer()}function qh(e){this.data.directiveAttributes.push([`id`,bh(this.sliceSerialize(e),{attribute:!0})])}function Jh(e){this.data.directiveAttributes.push([`class`,bh(this.sliceSerialize(e),{attribute:!0})])}function Yh(e){let t=this.data.directiveAttributes;t[t.length-1][1]=bh(this.sliceSerialize(e),{attribute:!0})}function Xh(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Zh(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function Qh(e){this.exit(e)}function $h(){return`:`}function eg(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function tg(e){let t=0;return e.type===`containerDirective`?(sm(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function ng(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Z(t)?Q(e,v,`whitespace`)(t):!m&&X(t)?Od(e,v)(t):t===null||Y(t)||ju(t)||Au(t)&&t!==45&&t!==95?ne(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||X(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||X(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Y(t)||ju(t)||Au(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?Od(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Y(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&Z(t)?Q(e,w,`whitespace`)(t):!m&&X(t)?Od(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||X(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),te):(e.enter(d),ee(t))}function ee(t){return t===g?(e.exit(d),E(t)):t===null?n(t):Y(t)?m?n(t):Od(e,ee)(t):(e.enter(p),e.consume(t),D)}function D(t){return t===g||t===null||Y(t)?(e.exit(p),ee(t)):(e.consume(t),D)}function te(e){return e===125||X(e)?v(e):ne(e)}function ne(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function rg(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Y(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function ig(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||Au(t)||ju(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||ju(a)||Au(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var ag={tokenize:lg,concrete:!0},og={tokenize:ug,partial:!0},sg={tokenize:dg,partial:!0},cg={tokenize:fg,partial:!0};function lg(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),ig.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(og,d,d)(t):d(t)}function d(t){return t===123?e.attempt(sg,f,f)(t):f(t)}function f(t){return Q(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Y(i)?r.interrupt?t(i):e.attempt(cg,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check(cg,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Q(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Y(t)?e.check(cg,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Y(t)?e.check(cg,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Q(e,c,`whitespace`)(t))}function c(r){return r===null||Y(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function ug(e,t,n){return rg(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function dg(e,t,n){return ng(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function fg(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var pg={tokenize:gg},mg={tokenize:_g,partial:!0},hg={tokenize:vg,partial:!0};function gg(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),ig.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(mg,s,s)(t):s(t)}function s(t){return t===123?e.attempt(hg,c,c)(t):c(t)}function c(t){return Q(e,l,`whitespace`)(t)}function l(r){return r===null||Y(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function _g(e,t,n){return rg(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function vg(e,t,n){return ng(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var yg={tokenize:Cg,previous:Sg},bg={tokenize:wg,partial:!0},xg={tokenize:Tg,partial:!0};function Sg(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function Cg(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),ig.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(bg,o,o)(t):o(t)}function o(t){return t===123?e.attempt(xg,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function wg(e,t,n){return rg(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function Tg(e,t,n){return ng(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function Eg(){return{text:{58:yg},flow:{58:[ag,pg]}}}function Dg(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(Eg()),n.push(Lh()),r.push(Rh())}function Og({markdown:e}){return(0,m.jsx)(`div`,{className:`erica-report-artifact`,children:(0,m.jsx)(sh,{remarkPlugins:[Dg,()=>e=>{let t=e=>{let n=[`grid`,`column`].includes(e.name);[`containerDirective`,`leafDirective`,`textDirective`].includes(e.type)&&n&&(e.data=e.data||{},e.data.hName=e.name,e.data.hProperties=e.attributes||{}),e.children&&e.children.forEach(t)};t(e)}],components:{h1:({children:e})=>(0,m.jsx)(`h1`,{className:`erica-markdown-h1`,children:e}),h2:({children:e})=>(0,m.jsx)(`h2`,{className:`erica-markdown-h2`,children:e}),h3:({children:e})=>(0,m.jsx)(`h3`,{className:`erica-markdown-h3`,children:e}),p:({children:e})=>(0,m.jsx)(`p`,{className:`erica-markdown-p`,children:e}),ul:({children:e})=>(0,m.jsx)(`ul`,{className:`erica-markdown-ul`,children:e}),ol:({children:e})=>(0,m.jsx)(`ol`,{className:`erica-markdown-ol`,children:e}),li:({children:e})=>(0,m.jsx)(`li`,{className:`erica-markdown-li`,children:e}),a:({children:e,href:t})=>(0,m.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`erica-markdown-link`,children:e}),blockquote:({children:e})=>(0,m.jsx)(`blockquote`,{className:`erica-markdown-blockquote`,children:e}),hr:()=>(0,m.jsx)(`hr`,{className:`erica-markdown-hr`}),table:({children:e})=>(0,m.jsx)(`div`,{className:`erica-markdown-table-wrapper`,children:(0,m.jsx)(`table`,{className:`erica-markdown-table`,children:e})}),thead:({children:e})=>(0,m.jsx)(`thead`,{className:`erica-markdown-thead`,children:e}),th:({children:e})=>(0,m.jsx)(`th`,{className:`erica-markdown-th`,children:e}),td:({children:e})=>(0,m.jsx)(`td`,{className:`erica-markdown-td`,children:e}),code:e=>{let{children:t,className:n,...r}=e;return/language-(\w+)/.exec(n||``)?.[1]===`ericachart`?(0,m.jsx)(Mc,{markdown:t}):(0,m.jsx)(`code`,{...r,className:n,children:t})},grid:({children:e,columns:t})=>{let n=t?Number(t):2;return(0,m.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:n===3?`repeat(3, 1fr)`:n===1?`1fr`:`repeat(2, 1fr)`,gap:`1.5rem`,margin:`2rem 0`,width:`100%`},children:e})}},children:e})})}var kg=Os({title:ts().describe(`Title of the report.`),reportContent:ts().describe(`Markdown content of the report.`)});function Ag({title:e,reportContent:t}){let n=Lc(),r=()=>{n.setTitle(e),n.setContent((0,m.jsx)(Og,{markdown:t})),n.onOpen()};return(0,m.jsx)(`div`,{onClick:r,className:`erica-report-card`,children:(0,m.jsxs)(`div`,{className:`erica-report-content-wrapper`,children:[(0,m.jsx)(`div`,{className:`erica-report-icon`,children:(0,m.jsx)(D,{className:`erica-icon-md`})}),(0,m.jsxs)(`div`,{className:`erica-report-content`,children:[(0,m.jsx)(`span`,{className:`erica-report-title`,children:e}),(0,m.jsx)(`span`,{className:`erica-report-subtitle`,children:`Business Report`})]}),(0,m.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},className:`erica-report-button`,children:`Show Report`})]})})}var jg=()=>{(0,f.useComponent)({name:`showChart`,description:`Display a chart from erica chart syntax.`,parameters:Nc,render:Pc},[]),(0,f.useComponent)({name:`showReport`,description:`Display a report from markdown with erica report syntax.`,parameters:kg,render:Ag},[])};function Mg({threadId:e,handleNewChat:t,handleThreadSelect:n}){return jg(),(0,m.jsx)(p.CopilotSidebar,{labels:{initial:`Hi! How can I help you today?
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
`,`\r`];return e+`=`+s+Mh(n,{subset:c})+s}}function zh(e){Hh.call(this,`containerDirective`,e)}function Bh(e){Hh.call(this,`leafDirective`,e)}function Vh(e){Hh.call(this,`textDirective`,e)}function Hh(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function Uh(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function Wh(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function Gh(e){this.exit(e)}function Kh(){this.data.directiveAttributes=[],this.buffer()}function qh(e){this.data.directiveAttributes.push([`id`,bh(this.sliceSerialize(e),{attribute:!0})])}function Jh(e){this.data.directiveAttributes.push([`class`,bh(this.sliceSerialize(e),{attribute:!0})])}function Yh(e){let t=this.data.directiveAttributes;t[t.length-1][1]=bh(this.sliceSerialize(e),{attribute:!0})}function Xh(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function Zh(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function Qh(e){this.exit(e)}function $h(){return`:`}function eg(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function tg(e){let t=0;return e.type===`containerDirective`?(sm(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function ng(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Z(t)?Q(e,v,`whitespace`)(t):!m&&X(t)?Od(e,v)(t):t===null||Y(t)||ju(t)||Au(t)&&t!==45&&t!==95?ne(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||X(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||X(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Y(t)||ju(t)||Au(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Z(t)?Q(e,C,`whitespace`)(t):!m&&X(t)?Od(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Y(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,E):m&&Z(t)?Q(e,w,`whitespace`)(t):!m&&X(t)?Od(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||X(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function E(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),te):(e.enter(d),ee(t))}function ee(t){return t===g?(e.exit(d),E(t)):t===null?n(t):Y(t)?m?n(t):Od(e,ee)(t):(e.enter(p),e.consume(t),D)}function D(t){return t===g||t===null||Y(t)?(e.exit(p),ee(t)):(e.consume(t),D)}function te(e){return e===125||X(e)?v(e):ne(e)}function ne(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function rg(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Y(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function ig(e,t,n,r){let i=this;return a;function a(t){return t===null||Y(t)||Au(t)||ju(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Y(a)||ju(a)||Au(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var ag={tokenize:lg,concrete:!0},og={tokenize:ug,partial:!0},sg={tokenize:dg,partial:!0},cg={tokenize:fg,partial:!0};function lg(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),ig.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(og,d,d)(t):d(t)}function d(t){return t===123?e.attempt(sg,f,f)(t):f(t)}function f(t){return Q(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Y(i)?r.interrupt?t(i):e.attempt(cg,m,C)(i):n(i)}function m(t){return t===null?C(t):Y(t)?e.check(cg,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Q(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Y(t)?e.check(cg,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Y(t)?e.check(cg,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Q(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Q(e,c,`whitespace`)(t))}function c(r){return r===null||Y(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function ug(e,t,n){return rg(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function dg(e,t,n){return ng(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function fg(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var pg={tokenize:gg},mg={tokenize:_g,partial:!0},hg={tokenize:vg,partial:!0};function gg(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),ig.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(mg,s,s)(t):s(t)}function s(t){return t===123?e.attempt(hg,c,c)(t):c(t)}function c(t){return Q(e,l,`whitespace`)(t)}function l(r){return r===null||Y(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function _g(e,t,n){return rg(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function vg(e,t,n){return ng(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var yg={tokenize:Cg,previous:Sg},bg={tokenize:wg,partial:!0},xg={tokenize:Tg,partial:!0};function Sg(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function Cg(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),ig.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(bg,o,o)(t):o(t)}function o(t){return t===123?e.attempt(xg,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function wg(e,t,n){return rg(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function Tg(e,t,n){return ng(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function Eg(){return{text:{58:yg},flow:{58:[ag,pg]}}}function Dg(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(Eg()),n.push(Lh()),r.push(Rh())}function Og(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function kg(e,t,n){let r=Qp((n||{}).ignore||[]),i=Ag(t),a=-1;for(;++a<i.length;)sm(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function Ag(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([jg(e[0]),Mg(e[1])])}return t}function jg(e){return typeof e==`string`?new RegExp(Og(e),`g`):e}function Mg(e){return typeof e==`function`?e:function(){return e}}var Ng=`phrasing`,Pg=[`autolink`,`link`,`image`,`label`];function Fg(){return{transforms:[Ug],enter:{literalAutolink:Lg,literalAutolinkEmail:Rg,literalAutolinkHttp:Rg,literalAutolinkWww:Rg},exit:{literalAutolink:Hg,literalAutolinkEmail:Vg,literalAutolinkHttp:zg,literalAutolinkWww:Bg}}}function Ig(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Ng,notInConstruct:Pg},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Ng,notInConstruct:Pg},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Ng,notInConstruct:Pg}]}}function Lg(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Rg(e){this.config.enter.autolinkProtocol.call(this,e)}function zg(e){this.config.exit.autolinkProtocol.call(this,e)}function Bg(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Vg(e){this.config.exit.autolinkEmail.call(this,e)}function Hg(e){this.exit(e)}function Ug(e){kg(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Wg],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Gg]],{ignore:[`link`,`linkReference`]})}function Wg(e,t,n,r,i){let a=``;if(!Jg(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Kg(n)))return!1;let o=qg(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Gg(e,t,n,r){return!Jg(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Kg(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function qg(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=fh(e,`(`),a=fh(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Jg(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ju(n)||Au(n))&&(!t||n!==47)}i_.peek=r_;function Yg(){this.buffer()}function Xg(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Zg(){this.buffer()}function Qg(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function $g(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function e_(e){this.exit(e)}function t_(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function n_(e){this.exit(e)}function r_(){return`[`}function i_(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function a_(){return{enter:{gfmFootnoteCallString:Yg,gfmFootnoteCall:Xg,gfmFootnoteDefinitionLabelString:Zg,gfmFootnoteDefinition:Qg},exit:{gfmFootnoteCallString:$g,gfmFootnoteCall:e_,gfmFootnoteDefinitionLabelString:t_,gfmFootnoteDefinition:n_}}}function o_(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:i_},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
62
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?c_:s_))),s(),o}}function s_(e,t,n){return t===0?e:c_(e,t,n)}function c_(e,t,n){return(n?``:` `)+e}var l_=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];m_.peek=h_;function u_(){return{canContainEols:[`delete`],enter:{strikethrough:f_},exit:{strikethrough:p_}}}function d_(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:l_}],handlers:{delete:m_}}}function f_(e){this.enter({type:`delete`,children:[]},e)}function p_(e){this.exit(e)}function m_(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function h_(){return`~`}function g_(e){return e.length}function __(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||g_,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=v_(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=y_(r[d]);else{let e=y_(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
63
|
+
`)}function v_(e){return e==null?``:String(e)}function y_(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function b_(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),x_);return i(),o}function x_(e,t,n){return`>`+(n?``:` `)+e}function S_(e,t){return C_(e,t.inConstruct,!0)&&!C_(e,t.notInConstruct,!1)}function C_(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function w_(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
64
|
+
`&&S_(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
65
|
+
`}function T_(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function E_(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function D_(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function O_(e,t,n,r){let i=D_(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(E_(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,k_);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(T_(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
66
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
67
|
+
`),a&&(u+=s.move(a+`
|
|
68
|
+
`)),u+=s.move(c),l(),u}function k_(e,t,n){return(n?``:` `)+e}function A_(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function j_(e,t,n,r){let i=A_(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
69
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function M_(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function N_(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function P_(e,t,n){let r=Bu(e),i=Bu(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}F_.peek=I_;function F_(e,t,n,r){let i=M_(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=P_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=N_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=P_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+N_(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function I_(e,t,n){return n.options.emphasis||`*`}function L_(e,t){let n=!1;return lm(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&fu(e)&&(t.options.setext||n))}function R_(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(L_(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
70
|
+
`,after:`
|
|
71
|
+
`});return r(),t(),o+`
|
|
72
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
73
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
74
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=N_(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}z_.peek=B_;function z_(e){return e.value||``}function B_(){return`<`}V_.peek=H_;function V_(e,t,n,r){let i=A_(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function H_(){return`!`}U_.peek=W_;function U_(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function W_(){return`!`}G_.peek=K_;function G_(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function K_(){return"`"}function q_(e,t){let n=fu(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}J_.peek=Y_;function J_(e,t,n,r){let i=A_(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(q_(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Y_(e,t,n){return q_(e,n)?`<`:`[`}X_.peek=Z_;function X_(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Z_(){return`[`}function Q_(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function $_(e){let t=Q_(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ev(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function tv(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function nv(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?ev(n):Q_(n),s=e.ordered?o===`.`?`)`:`.`:$_(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),tv(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function rv(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function iv(e,t,n,r){let i=rv(n),a=n.bulletCurrent||Q_(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function av(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var ov=Qp([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function sv(e,t,n,r){return(e.children.some(function(e){return ov(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function cv(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}lv.peek=uv;function lv(e,t,n,r){let i=cv(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=P_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=N_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=P_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+N_(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function uv(e,t,n){return n.options.strong||`*`}function dv(e,t,n,r){return n.safe(e.value,r)}function fv(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function pv(e,t,n){let r=(tv(n)+(n.options.ruleSpaces?` `:``)).repeat(fv(n));return n.options.ruleSpaces?r.slice(0,-1):r}var mv={blockquote:b_,break:w_,code:O_,definition:j_,emphasis:F_,hardBreak:w_,heading:R_,html:z_,image:V_,imageReference:U_,inlineCode:G_,link:J_,linkReference:X_,list:nv,listItem:iv,paragraph:av,root:sv,strong:lv,text:dv,thematicBreak:pv};function hv(){return{enter:{table:gv,tableData:bv,tableHeader:bv,tableRow:vv},exit:{codeText:xv,table:_v,tableData:yv,tableHeader:yv,tableRow:yv}}}function gv(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function _v(e){this.exit(e),this.data.inTable=void 0}function vv(e){this.enter({type:`tableRow`,children:[]},e)}function yv(e){this.exit(e)}function bv(e){this.enter({type:`tableCell`,children:[]},e)}function xv(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Sv));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Sv(e,t){return t===`|`?t:e}function Cv(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
75
|
+
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
76
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return __(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=mv.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function wv(){return{exit:{taskListCheckValueChecked:Ev,taskListCheckValueUnchecked:Ev,paragraph:Dv}}}function Tv(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Ov}}}function Ev(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Dv(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Ov(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=mv.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function kv(){return[Fg(),a_(),u_(),hv(),wv()]}function Av(e){return{extensions:[Ig(),o_(e),d_(),Cv(e),Tv()]}}var jv={tokenize:Gv,partial:!0},Mv={tokenize:Kv,partial:!0},Nv={tokenize:qv,partial:!0},Pv={tokenize:Jv,partial:!0},Fv={tokenize:Yv,partial:!0},Iv={name:`wwwAutolink`,tokenize:Uv,previous:Xv},Lv={name:`protocolAutolink`,tokenize:Wv,previous:Zv},Rv={name:`emailAutolink`,tokenize:Hv,previous:Qv},zv={};function Bv(){return{text:zv}}for(var Vv=48;Vv<123;)zv[Vv]=Rv,Vv++,Vv===58?Vv=65:Vv===91&&(Vv=97);zv[43]=Rv,zv[45]=Rv,zv[46]=Rv,zv[95]=Rv,zv[72]=[Rv,Lv],zv[104]=[Rv,Lv],zv[87]=[Rv,Iv],zv[119]=[Rv,Iv];function Hv(e,t,n){let r=this,i,a;return o;function o(t){return!$v(t)||!Qv.call(r,r.previous)||ey(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return $v(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Fv,u,l)(t):t===45||t===95||J(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&q(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Uv(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Xv.call(r,r.previous)||ey(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(jv,e.attempt(Mv,e.attempt(Nv,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Wv(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Zv.call(r,r.previous)&&!ey(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(q(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Eu(t)||X(t)||ju(t)||Au(t)?n(t):e.attempt(Mv,e.attempt(Nv,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Gv(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Kv(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Pv,c,s)(t):t===null||X(t)||ju(t)||t!==45&&Au(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function qv(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Pv,t,a)(o):o===null||X(o)||ju(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Jv(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||X(o)||ju(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||X(e)||ju(e)?t(e):r(e)}function a(e){return q(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):q(t)?(e.consume(t),o):n(t)}}function Yv(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return J(e)?n(e):t(e)}}function Xv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function Zv(e){return!q(e)}function Qv(e){return!(e===47||$v(e))}function $v(e){return e===43||e===45||e===46||e===95||J(e)}function ey(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var ty={tokenize:ly,partial:!0};function ny(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:oy,continuation:{tokenize:sy},exit:cy}},text:{91:{name:`gfmFootnoteCall`,tokenize:ay},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ry,resolveTo:iy}}}}function ry(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=wu(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function iy(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function ay(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||X(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(wu(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return X(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function oy(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||X(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=wu(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return X(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Q(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function sy(e,t,n){return e.check(Ju,t,e.attempt(ty,t,n))}function cy(e){e.exit(`gfmFootnoteDefinition`)}function ly(e,t,n){let r=this;return Q(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function uy(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&K(o,o.length,0,Vu(s,e.slice(r+1,n),t)),K(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),K(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Bu(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Bu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var dy=class{constructor(){this.map=[]}add(e,t,n){fy(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function fy(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function py(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function my(){return{flow:{null:{name:`table`,tokenize:hy,resolveAll:gy}}}}function hy(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Y(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Z(t)?Q(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||X(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Z(t)?Q(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Z(t)?Q(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Y(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Z(t)?Q(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Y(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Y(n)?(e.exit(`tableRow`),t(n)):Z(n)?Q(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||X(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function gy(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new dy;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(vy(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=_y(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=_y(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=_y(f,t,o,i,n,d)):(o[0]=o[1],d=_y(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&vy(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=py(t.events,n))}return e}function _y(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},yy(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=yy(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=yy(t.events,n[2]),a=yy(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},yy(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function vy(e,t,n,r,i){let a=[],o=yy(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function yy(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var by={name:`tasklistCheck`,tokenize:Sy};function xy(){return{text:{91:by}}}function Sy(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return X(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Y(r)?t(r):Z(r)?e.check({tokenize:Cy},t,n)(r):n(r)}}function Cy(e,t,n){return Q(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function wy(e){return bu([Bv(),ny(),uy(e),my(),xy()])}var Ty={};function Ey(e){let t=this,n=e||Ty,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(wy(n)),a.push(kv()),o.push(Av(n))}function Dy({markdown:e}){return(0,m.jsx)(`div`,{className:`erica-report-artifact`,children:(0,m.jsx)(sh,{remarkPlugins:[Ey,Dg,()=>e=>{let t=e=>{let n=[`grid`,`column`].includes(e.name);[`containerDirective`,`leafDirective`,`textDirective`].includes(e.type)&&n&&(e.data=e.data||{},e.data.hName=e.name,e.data.hProperties=e.attributes||{}),e.children&&e.children.forEach(t)};t(e)}],components:{h1:({children:e})=>(0,m.jsx)(`h1`,{className:`erica-markdown-h1`,children:e}),h2:({children:e})=>(0,m.jsx)(`h2`,{className:`erica-markdown-h2`,children:e}),h3:({children:e})=>(0,m.jsx)(`h3`,{className:`erica-markdown-h3`,children:e}),p:({children:e})=>(0,m.jsx)(`p`,{className:`erica-markdown-p`,children:e}),ul:({children:e})=>(0,m.jsx)(`ul`,{className:`erica-markdown-ul`,children:e}),ol:({children:e})=>(0,m.jsx)(`ol`,{className:`erica-markdown-ol`,children:e}),li:({children:e})=>(0,m.jsx)(`li`,{className:`erica-markdown-li`,children:e}),a:({children:e,href:t})=>(0,m.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`erica-markdown-link`,children:e}),blockquote:({children:e})=>(0,m.jsx)(`blockquote`,{className:`erica-markdown-blockquote`,children:e}),hr:()=>(0,m.jsx)(`hr`,{className:`erica-markdown-hr`}),table:({children:e})=>(0,m.jsx)(`div`,{className:`erica-markdown-table-wrapper`,children:(0,m.jsx)(`table`,{className:`erica-markdown-table`,children:e})}),thead:({children:e})=>(0,m.jsx)(`thead`,{className:`erica-markdown-thead`,children:e}),th:({children:e})=>(0,m.jsx)(`th`,{className:`erica-markdown-th`,children:e}),td:({children:e})=>(0,m.jsx)(`td`,{className:`erica-markdown-td`,children:e}),code:e=>{let{children:t,className:n,...r}=e;return/language-(\w+)/.exec(n||``)?.[1]===`ericachart`?(0,m.jsx)(Nc,{markdown:t}):(0,m.jsx)(`code`,{...r,className:n,children:t})},grid:({children:e,columns:t})=>{let n=t?Number(t):2;return(0,m.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:n===3?`repeat(3, 1fr)`:n===1?`1fr`:`repeat(2, 1fr)`,gap:`1.5rem`,margin:`2rem 0`,width:`100%`},children:e})}},children:e})})}var Oy=ks({title:ns().describe(`Title of the report.`),reportContent:ns().describe(`Markdown content of the report.`)});function ky({title:e,reportContent:t}){let n=Rc(),r=()=>{n.setTitle(e),n.setContent((0,m.jsx)(Dy,{markdown:t})),n.onOpen()};return(0,m.jsx)(`div`,{onClick:r,className:`erica-report-card`,children:(0,m.jsxs)(`div`,{className:`erica-report-content-wrapper`,children:[(0,m.jsx)(`div`,{className:`erica-report-icon`,children:(0,m.jsx)(D,{className:`erica-icon-md`})}),(0,m.jsxs)(`div`,{className:`erica-report-content`,children:[(0,m.jsx)(`span`,{className:`erica-report-title`,children:e}),(0,m.jsx)(`span`,{className:`erica-report-subtitle`,children:`Business Report`})]}),(0,m.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r()},className:`erica-report-button`,children:`Show Report`})]})})}var Ay=()=>{(0,f.useComponent)({name:`showChart`,description:`Display a chart from erica chart syntax.`,parameters:Pc,render:Fc},[]),(0,f.useComponent)({name:`showReport`,description:`Display a report from markdown with erica report syntax.`,parameters:Oy,render:ky},[])};function jy({attachment:e}){let[t,n]=(0,u.useState)(!1);async function r(){n(!0);try{await ze.download(e.file_path,e.original_name)}catch(t){console.error(`Download failed:`,t),alert(`Failed to download ${e.original_name}`)}finally{n(!1)}}return(0,m.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:r,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r())},className:`erica-attachment-item`,title:e.original_name,children:[t?(0,m.jsx)(`div`,{className:`erica-spinner erica-spinner--sm`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(te,{className:`erica-attachment-icon erica-attachment-icon--default`}),(0,m.jsx)(ee,{className:`erica-attachment-icon erica-attachment-icon--hover`})]}),(0,m.jsx)(`span`,{className:`erica-attachment-name`,children:e.original_name})]})}function My({children:e}){let t=String(e).trim(),n=[];try{n=JSON.parse(t)}catch{return null}return!Array.isArray(n)||n.length===0?null:(0,m.jsx)(`div`,{className:`erica-attachment-block`,children:n.map((e,t)=>(0,m.jsx)(jy,{attachment:e},t))})}function Ny({threadId:e,handleNewChat:t,handleThreadSelect:n}){return Ay(),(0,m.jsx)(p.CopilotSidebar,{labels:{initial:`Halo! Saya asisten AI SPP, ada yg bisa saya bantu?`},Input:(0,u.useCallback)(t=>(0,m.jsx)(Be,{...t,threadId:e}),[e]),Header:(0,u.useCallback)(()=>(0,m.jsx)(gn,{onNewChat:t,onThreadSelect:n}),[t,n]),UserMessage:({message:e})=>(0,m.jsx)(`div`,{className:`copilotKitMessage copilotKitUserMessage`,children:(0,m.jsx)(sh,{components:{pre:({children:e})=>(0,m.jsx)(m.Fragment,{children:e}),code({children:e,className:t}){return/language-(\w+)/.exec(t||``)?.[1]===`attachments`?(0,m.jsx)(My,{children:e}):(0,m.jsx)(`code`,{className:t,style:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:`0.85em`},children:e})}},children:Array.isArray(e.content)?e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``):String(e.content)})})})}function Py({runtimeUrl:e,widgetToken:t}){let[n,r]=(0,u.useState)(void 0),i=(0,u.useMemo)(()=>{let t=new URL(e),n=t.pathname.split(`/`).filter(Boolean);return n.length>2&&n.pop(),t.pathname=`/`+n.join(`/`),t.toString()},[e]);(0,u.useMemo)(()=>{Ne(i,t)},[i,t]);let a=(0,u.useCallback)(()=>{r(void 0),console.log(`New chat started`)},[]),o=(0,u.useCallback)(e=>{r(e),console.log(`Thread selected:`,e)},[]);return(0,m.jsx)(f.CopilotChatConfigurationProvider,{isModalDefaultOpen:!0,children:(0,m.jsx)(`div`,{className:`h-full w-full`,children:(0,m.jsx)(d.CopilotKit,{runtimeUrl:e,headers:{Authorization:`Bearer ${t}`},properties:{agent:`platform:ultimate`},threadId:n,enableInspector:!1,children:(0,m.jsx)(Ny,{threadId:n,handleNewChat:a,handleThreadSelect:o})})})})}var Fy=new Kt({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:3e4}}});function Iy({accountUid:e,children:t}){return(0,m.jsx)(Yt,{client:Fy,children:(0,m.jsx)(hc,{accountUid:e,children:(0,m.jsx)(Lc,{children:t})})})}function Ly(){let{isOpen:e,onClose:t,content:n,title:r}=Rc(),[i,a]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{e?setTimeout(()=>a(!0),10):a(!1)},[e]),e?(0,m.jsxs)(`div`,{className:`erica-artifact-container`,children:[(0,m.jsx)(`div`,{className:`erica-artifact-backdrop ${i?`erica-artifact-backdrop--visible`:``}`,onClick:t}),(0,m.jsxs)(`div`,{className:`erica-artifact-drawer ${i?`erica-artifact-drawer--open`:``}`,children:[(0,m.jsxs)(`div`,{className:`erica-artifact-header`,children:[(0,m.jsx)(`h2`,{className:`erica-artifact-title`,children:r}),(0,m.jsx)(`button`,{onClick:t,className:`erica-artifact-close-button`,"aria-label":`Close drawer`,children:(0,m.jsx)(re,{className:`erica-icon-md`})})]}),(0,m.jsx)(`div`,{className:`erica-artifact-body`,children:n})]})]}):null}exports.ArtifactProvider=Lc,exports.EricaChat=Py,exports.EricaDrawer=Ly,exports.EricaProvider=Iy;
|
|
67
77
|
//# sourceMappingURL=index.cjs.map
|