@boldare/askdare 0.1.0-rc.0 → 0.1.0-rc.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @boldare/askdare
2
2
 
3
+ ## 0.1.0-rc.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 13259d4: When the chat opens with a stored conversation and the server refuses the session, it shows the server's reason (explained in development) instead of "Could not load the previous conversation." The conversation stays stored for the next try.
8
+
3
9
  ## 0.1.0-rc.0
4
10
 
5
11
  ### Minor Changes
package/dist/next.js CHANGED
@@ -62,9 +62,9 @@ function scrub(text) {
62
62
  }
63
63
  // src/generated/assets.ts
64
64
  const LOADER_JS = "(function(){function e(e){let t=typeof e==`object`&&e?e:{},n={v:1,type:`configure`};return typeof t.greeting==`string`&&(n.greeting=t.greeting),typeof t.context==`string`&&(n.context=t.context),Array.isArray(t.starters)&&(n.starters=t.starters.filter(e=>typeof e==`string`)),n}var t=`\n:host { all: initial; }\n[part=launcher] {\n position: fixed; right: 24px; bottom: 24px; z-index: 2147483000;\n display: flex; align-items: center; justify-content: center; gap: 10px;\n min-width: 56px; height: 56px; padding: 0; border: 0; border-radius: 999px;\n background: var(--a); color: var(--o); cursor: pointer;\n font: 600 15px/1 system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n box-shadow: 0 12px 32px -10px rgb(15 23 42 / .45), 0 2px 6px rgb(15 23 42 / .16);\n transition: transform .16s ease, box-shadow .16s ease;\n}\n[part=launcher]:hover { transform: translateY(-2px); }\n[part=launcher]:focus-visible { outline: 3px solid var(--a); outline-offset: 3px; }\n.pill { padding: 0 22px 0 6px; }\n.av { display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden;\n border-radius: 50%; background: var(--o); color: var(--a); font-size: 14px; }\n.av img { width: 100%; height: 100%; object-fit: cover; }\n/* The orb launcher: the orb with its label, on the panel's background, so it reads as a chat. */\n.orb { height: 60px; padding: 0 22px 0 6px; background: var(--l); color: var(--t);\n box-shadow: 0 14px 34px -12px var(--a), 0 2px 8px rgb(15 23 42 / .12),\n 0 0 0 1px rgb(15 23 42 / .06); }\n:host([data-askdare-scheme=dark]) .orb { background: var(--d); color: var(--u); }\n@media (prefers-color-scheme: dark) {\n :host([data-askdare-scheme=auto]) .orb { background: var(--d); color: var(--u); }\n}\n.ob { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--b);\n box-shadow: inset 0 -5px 12px rgb(0 0 0 / .18), inset 0 4px 10px rgb(255 255 255 / .6); }\n.ob::after { content: \"\"; position: absolute; top: 12%; left: 20%; width: 36%; height: 28%;\n border-radius: 50%; background: radial-gradient(closest-side, #fffe, #fff0); }\n[aria-expanded=true], :host .orb[aria-expanded=true] { background: var(--a); color: var(--o); }\n[aria-expanded=true] .av, [aria-expanded=true] .ob, [aria-expanded=true] .lb { display: none; }\n.pill[aria-expanded=true], .orb[aria-expanded=true] { padding: 0; width: 56px; }\n[part=panel] {\n position: fixed; right: 24px; bottom: 96px; z-index: 2147483000;\n width: min(400px, calc(100vw - 48px)); height: min(680px, calc(100dvh - 120px));\n overflow: hidden; border-radius: var(--r); background: var(--l);\n box-shadow: 0 28px 70px -12px rgb(15 23 42 / .4), 0 0 0 1px rgb(15 23 42 / .06);\n transform-origin: bottom right; animation: in .22s cubic-bezier(.2, .8, .2, 1);\n}\n:host([data-askdare-scheme=dark]) [part=panel] { background: var(--d); }\n@media (prefers-color-scheme: dark) {\n :host([data-askdare-scheme=auto]) [part=panel] { background: var(--d); }\n}\n[part=panel][hidden] { display: none; }\n[part=unavailable] { position: absolute; inset: 0; display: grid; place-items: center;\n margin: 0; padding: 24px; background: var(--l); color: var(--t); text-align: center;\n font: 15px/1.5 system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif; }\n[part=panel].solo { bottom: 24px; }\n[part=panel].inline { position: relative; inset: auto; width: 100%; height: 100%; border-radius: inherit;\n box-shadow: none; animation: none; }\niframe { display: block; width: 100%; height: 100%; border: 0; }\n@keyframes in { from { opacity: 0; transform: translateY(10px) scale(.97); } }\n@media (max-width: 480px) {\n [part=panel] { inset: 0; width: 100vw; height: 100dvh; border-radius: 0; }\n [aria-expanded=true][data-ready] { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n [part=launcher], [part=panel] { transition: none; animation: none; }\n}\n`;function n(){try{return JSON.parse(`__ASKDARE_LAUNCHERS__`)}catch{return{}}}function r(){if(window.askdare?.loaded)return;let r=document.currentScript;if(!(r instanceof HTMLScriptElement)||!r.src)return;let i=new URL(r.src),a=r.dataset.bot??i.searchParams.get(`bot`);if(!a){console.warn(`[askdare] Load the widget as widget.js?bot=<bot id>.`);return}let o=i.origin,s=i.pathname.replace(/\\/widget\\.js$/,``),c=r.dataset.mode===`inline`?r.dataset.target:void 0,l=()=>{try{return c?document.querySelector(c):null}catch{return null}};c&&!l()&&document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>u(r,l(),a),{once:!0}):u(r,l(),a);function u(r,i,a){let l=window.askdare;if(l?.loaded)return;let u=Array.isArray(l?.q)?l.q:[];c&&!i&&console.warn(`[askdare] No element matches ${c}.`);let d=i!==null,f=!d&&r.dataset.launcher!==`none`,p=document.documentElement.lang,m=new URLSearchParams({...p?{lang:p}:{},...d?{mode:`inline`}:{}}).toString(),h=`${o}${s}/embed/${encodeURIComponent(a)}${m?`?${m}`:``}`,g=n()[a],_=(g?.locale||p||navigator.language).toLowerCase().split(`-`)[0],v=g?.texts[_??`en`]??g?.texts.en??{label:`Ask us`,open:`Open chat`,close:`Close chat`,unavailable:`The chat couldn’t load. Please try again later.`,title:`Chat`},y=document.createElement(`div`);y.dataset.askdare=a,y.dataset.askdareScheme=g?.scheme??`auto`;for(let[e,t]of[[`--a`,g?.accent??`#1f5fe0`],[`--o`,g?.onAccent??`#ffffff`],[`--b`,g?.orb??`var(--a)`],[`--l`,g?.light??`#ffffff`],[`--d`,g?.dark??`#0a0f1c`],[`--t`,g?.text??`#0d1526`],[`--u`,g?.textDark??`#e8edf7`],[`--r`,g?.radius?`min(${g.radius}, 24px)`:`18px`]])y.style.setProperty(e,t);let b=y.attachShadow({mode:`open`});try{let e=new CSSStyleSheet;e.replaceSync(t),b.adoptedStyleSheets=[e]}catch{let e=document.createElement(`style`);e.textContent=t,b.append(e)}let x=document.createElement(`button`);x.type=`button`,x.className=g?.style??`circle`,x.setAttribute(`part`,`launcher`);let S=g?.style===`pill`||g?.style===`orb`?`${v.label}, ${v.open}`:v.open;x.setAttribute(`aria-label`,S),x.setAttribute(`aria-expanded`,`false`);let C=document.createElement(`span`);C.style.display=`contents`;let w=e=>{C.innerHTML=e?`<svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" aria-hidden=\"true\"><path d=\"M6 6l12 12M18 6 6 18\"/></svg>`:g?.style===`circle`||!g?`<svg width=\"26\" height=\"26\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\"><path d=\"M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.2 3.6A.5.5 0 0 1 5 19.2V16h-.5A.5.5 0 0 1 4 15.5z\" fill=\"currentColor\"/></svg>`:``};if(w(!1),g?.style===`pill`||g?.style===`orb`){let e=document.createElement(`span`);if(e.className=g.style===`orb`?`ob`:`av`,g.style===`pill`&&(e.textContent=g.initials),g.style===`pill`&&g.avatar){let t=document.createElement(`img`);t.alt=``,t.src=g.avatar.startsWith(`/`)?`${o}${g.avatar}`:g.avatar,t.onload=()=>e.replaceChildren(t)}let t=document.createElement(`span`);t.className=`lb`,t.textContent=v.label,x.append(e,t)}x.append(C);let T=document.createElement(`div`);T.setAttribute(`part`,`panel`),T.setAttribute(`role`,`dialog`),T.setAttribute(`aria-label`,v.title),T.hidden=!0,d?T.className=`inline`:f||(T.className=`solo`),b.append(T),f&&b.append(x);let E,D,O=!1,k,A=()=>{O||k||(k=document.createElement(`p`),k.setAttribute(`part`,`unavailable`),k.setAttribute(`role`,`status`),k.textContent=v.unavailable,T.append(k),console.warn(`[askdare] The chat \"${a}\" didn't load on ${location.origin}. Is this origin in the bot's security.allowedOrigins? Check with: npx @boldare/askdare doctor --origin ${location.origin}`))},j,M,N,P=e=>{D?.close();let t=new MessageChannel;D=t.port1,D.onmessage=e=>{e.data?.v===1&&(e.data.type===`close`&&I(),e.data.type===`ready`&&(O=!0,k?.remove(),k=void 0,x.dataset.ready=``))},e.contentWindow?.postMessage({v:1,type:`askdare:init`,...M===void 0?{}:{identity:M}},o,[t.port2]),j&&D.postMessage(j)},F=(e=!0)=>{if(!d&&T.hidden){let e=document.activeElement;N=e instanceof HTMLElement&&e!==y?e:void 0}E||(E=document.createElement(`iframe`),E.title=`Chat`,E.src=h,E.referrerPolicy=`strict-origin`,E.allow=`clipboard-write; microphone`,E.addEventListener(`load`,()=>E&&P(E)),T.append(E),setTimeout(A,8e3)),T.hidden=!1,w(!0),x.setAttribute(`aria-expanded`,`true`),x.setAttribute(`aria-label`,v.close),e&&E.focus()};function I(){if(d||T.hidden)return;D?.postMessage({v:1,type:`hidden`}),T.hidden=!0,w(!1),x.setAttribute(`aria-expanded`,`false`),x.setAttribute(`aria-label`,S);let e=N?.isConnected?N:f?x:void 0;e&&(window.focus(),e.focus())}x.addEventListener(`click`,()=>T.hidden?F():I()),(i??document.body??document.documentElement).append(y),d&&F(!1);let L=((t,n)=>{t===`open`?F():t===`close`?I():t===`toggle`?(T.hidden?F:I)():t===`identify`?(typeof n!=`string`&&n!==null&&console.warn(`[askdare] askdare('identify') expects a token or null; signing out.`),M=typeof n==`string`?n:null,D?.postMessage({v:1,type:`identify`,token:M})):t===`configure`&&(j=e(n),D?.postMessage(j))});Object.defineProperty(L,\"loaded\",{value:!0}),window.askdare=L;for(let e of u)L(...e)}}r()})();";
65
- const WIDGET_JS = "var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m={},h=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function y(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return b(t,s,i,a,null)}function b(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function x(e){return e.children}function S(e,t){this.props=e,this.context=t}function C(e,t){if(t==null)return e.__?C(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?C(e):null}function te(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=v({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),j(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??C(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,se(i,o,a),n.__e=n.__=null,o.__e!=r&&w(o)}}function w(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),w(e)}function T(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!E.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(E)}function E(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,te(e)}finally{r.length=E.__r=0}}function ne(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,ee=r&&r.__k||h,y=t.length;for(c=D(n,t,ee,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&ee[p.__i]||m,p.__i=d,v=j(e,p,f,i,a,o,s,c,l,u),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&le(f.ref,null,p),u.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),4&p.__u?(c=O(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-7);return n.__e=_,c}function D(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=b(null,o,null,null,null):_(o)?o=e.__k[a]=b(x,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=b(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=re(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=C(s)),ue(s,s));return r}function O(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=O(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=C(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function k(e,t){return t||=[],e==null||typeof e==`boolean`||(_(e)?e.some(function(e){k(e,t)}):t.push(e)),t}function re(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ie(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||g.test(t)?n:n+`px`}function A(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ie(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ie(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ae(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function j(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,g,y,b,te,w,T,E,D,O,k,re,ie,A=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof A==`function`){f=s.length;try{if(w=n.props,T=A.prototype&&A.prototype.render,E=(d=A.contextType)&&i[d.__c],D=d?E?E.props.value:d.__:i,r.__c?te=(p=n.__c=r.__c).__=p.__E:(T?n.__c=p=new A(w,D):(n.__c=p=new S(w,D),p.constructor=A,p.render=de),E&&E.sub(p),p.state||(p.state={}),p.__n=i,m=p.__d=!0,p.__h=[],p._sb=[]),T&&p.__s==null&&(p.__s=p.state),T&&A.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),g=p.props,y=p.state,p.__v=n,m)T&&A.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),T&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(T&&A.getDerivedStateFromProps==null&&w!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(w,D),n.__v==r.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(w,p.__s,D)){n.__v!=r.__v&&(p.props=w,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),h.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=C(r);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(w,p.__s,D),T&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,y,b)})}if(p.context=D,p.props=w,p.__P=e,p.__e=!1,O=t.__r,k=0,T)p.state=p.__s,p.__d=!1,O&&O(n),d=p.render(p.props,p.state,p.context),h.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,O&&O(n),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++k<25);p.state=p.__s,p.getChildContext!=null&&(i=v(v({},i),p.getChildContext())),T&&!m&&p.getSnapshotBeforeUpdate!=null&&(b=p.getSnapshotBeforeUpdate(g,y)),re=d!=null&&d.type===x&&d.key==null?ce(d.props.children):d,c=ne(e,_(re)?re:[re],n,r,i,a,o,s,c,l,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),te&&(p.__E=p.__=null)}catch(e){if(s.length=f,n.__v=null,l||o!=null){if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),n.__e=c}else if(o!=null)for(ie=o.length;ie--;)ee(o[ie])}else n.__e=r.__e;n.__k??=r.__k||[],e.then||oe(n),t.__e(e,n,r)}}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=M(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function oe(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(oe))}function se(e,n,r){for(var i=0;i<r.length;i++)le(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function ce(e){return typeof e!=`object`||!e||e.__b>0?e:_(e)?e.map(ce):e.constructor===void 0?v({},e):null}function M(n,r,i,a,o,s,c,l,u){var d,f,p,h,g,v,y,b=i.props||m,x=r.props,S=r.type;if(S==`svg`?o=`http://www.w3.org/2000/svg`:S==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!S&&(S?g.localName==S:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(S==null)return document.createTextNode(x);n=document.createElementNS(o,S,x.is&&x),l&&=(t.__m&&t.__m(r,s),!1),s=null}if(S==null)b===x||l&&n.data==x||(n.data=x);else{if(s=S==`textarea`&&x.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(b={},d=0;d<n.attributes.length;d++)b[(g=n.attributes[d]).name]=g.value;for(d in b)g=b[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||A(n,d,null,g,o);for(d in x)g=x[d],d==`children`?h=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?v=g:d==`checked`?y=g:l&&typeof g!=`function`||b[d]===g||A(n,d,g,b[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),ne(r.type==`template`?n.content:n,_(h)?h:[h],r,i,a,S==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&C(i,0),l,u),s!=null)for(d=s.length;d--;)ee(s[d]);l&&S!=`textarea`||(d=`value`,S==`progress`&&v==null?n.removeAttribute(`value`):v!=null&&(v!==n[d]||S==`progress`&&!v||S==`option`&&v!=b[d])&&A(n,d,v,b[d],o),d=`checked`,y!=null&&y!=n[d]&&A(n,d,y,b[d],o))}return n}function le(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function ue(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||le(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&ue(i[a],n,r||typeof e.type!=`function`);r||ee(e.__e),e.__c=e.__=e.__e=void 0}function de(e,t,n){return this.constructor(e,n)}function fe(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],j(r,n=(!a&&i||r).__k=y(x,null,[n]),o||m,m,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),se(s,n,c),n.props.children=null}e=h.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,S.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v({},this.state);typeof e==`function`&&(e=e(v({},n),this.props)),e&&v(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),T(this))},S.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),T(this))},S.prototype.render=x,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},E.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=ae(!1),p=ae(!0);var N,P,F,pe,me=0,he=[],I=t,ge=I.__b,_e=I.__r,ve=I.diffed,ye=I.__c,be=I.unmount,xe=I.__;function Se(e,t){I.__h&&I.__h(P,e,me||t),me=0;var n=P.__H||(P.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function L(e){return me=1,Ce(Fe,e)}function Ce(e,t,n){var r=Se(N++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Fe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=P,!P.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};P.__f=!0;var a=P.shouldComponentUpdate,o=P.componentWillUpdate;P.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},P.shouldComponentUpdate=i}return r.__N||r.__}function we(e,t){var n=Se(N++,3);!I.__s&&Pe(n.__H,t)&&(n.__=e,n.u=t,P.__H.__h.push(n))}function Te(e,t){var n=Se(N++,4);!I.__s&&Pe(n.__H,t)&&(n.__=e,n.u=t,P.__h.push(n))}function R(e){return me=5,Ee(function(){return{current:e}},[])}function Ee(e,t){var n=Se(N++,7);return Pe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function De(e,t){return me=8,Ee(function(){return e},t)}function Oe(){var e=Se(N++,11);if(!e.__){for(var t=P.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function ke(){for(var e;e=he.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Me),t.__h.some(Ne),t.__h=[]}catch(n){t.__h=[],I.__e(n,e.__v)}}}I.__b=function(e){P=null,ge&&ge(e)},I.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),xe&&xe(e,t)},I.__r=function(e){_e&&_e(e),N=0;var t=(P=e.__c).__H;t&&(F===P?(t.__h=[],P.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Me),t.__h.some(Ne),t.__h=[],N=0)),F=P},I.diffed=function(e){ve&&ve(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(he.push(t)!==1&&pe===I.requestAnimationFrame||((pe=I.requestAnimationFrame)||je)(ke)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),F=P=null},I.__c=function(e,t){t.some(function(e){try{e.__h.some(Me),e.__h=e.__h.filter(function(e){return!e.__||Ne(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],I.__e(n,e.__v)}}),ye&&ye(e,t)},I.unmount=function(e){be&&be(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Me(e)}catch(e){t=e}}),n.__H=void 0,t&&I.__e(t,n.__v))};var Ae=typeof requestAnimationFrame==`function`;function je(e){var t,n=function(){clearTimeout(r),Ae&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ae&&(t=requestAnimationFrame(n))}function Me(e){var t=P,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),P=t}function Ne(e){var t=P;e.__c=e.__(),P=t}function Pe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Fe(e,t){return typeof t==`function`?t(e):t}function Ie(e,t){for(var n in t)e[n]=t[n];return e}function Le(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Re(e,t){this.props=e,this.context=t}function ze(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Le(this.props,e)}function r(t){return this.shouldComponentUpdate=n,y(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(Re.prototype=new S).isPureReactComponent=!0,Re.prototype.shouldComponentUpdate=function(e,t){return Le(this.props,e)||Le(this.state,t)};var Be=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Be&&Be(e)},typeof Symbol<`u`&&Symbol.for;var Ve=t.__e;t.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Ve(e,t,n,r)};var He=t.unmount;function Ue(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Ie({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ue(e,t,n)})),e}function We(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return We(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ge(){this.__u=0,this.o=null,this.__b=null}function Ke(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function qe(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),He&&He(e)},(Ge.prototype=new S).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Ke(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=We(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Ge.prototype.componentWillUnmount=function(){this.o=[]},Ge.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Ue(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&y(x,null,e.fallback);return i&&(i.__u&=-33),[y(x,null,t.__a?null:e.children),i]};var Je=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(qe.prototype=new S).__a=function(e){var t=this,n=Ke(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Je(t,e,r)):i()};n?n(a):a()}},qe.prototype.render=function(e){this.i=null,this.l=/* @__PURE__ */ new Map;var t=k(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},qe.prototype.componentDidUpdate=qe.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Je(e,n,t)})};var Ye=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Xe=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ze=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Qe=/[A-Z0-9]/g,$e=typeof document<`u`,et=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function tt(e,t,n){return t.__k??(t.textContent=``),fe(e,t),typeof n==`function`&&n(),e?e.__c:null}S.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(S.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var nt=t.event;t.event=function(e){return nt&&(e=nt(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var rt={configurable:!0,get:function(){return this.class}},it=t.vnode;t.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||$e&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||et(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Ze.test(a)&&(a=s):s=a=`oninput`:i&&Xe.test(a)?a=a.replace(Qe,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=k(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=k(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,\"className\",rt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Ye,it&&it(e)};var at=t.__r;t.__r=function(e){at&&at(e),e.__c};var ot=t.diffed;t.diffed=function(e){ot&&ot(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function st(e){return!!e.__k&&(fe(null,e),!0)}function ct(e){return{render:function(t){tt(t,e)},unmount:function(){st(e)}}}function lt(e,t={}){return e.replace(/\\{(\\w+)\\}/g,(e,n)=>n in t?String(t[n]):e)}function ut(e,t,n,r){let i=`other`;try{i=new Intl.PluralRules(r).select(n)}catch{}return lt(e[`${t}.${i}`]??e[`${t}.other`]??``,{count:n})}var dt=0;Array.isArray;function z(e,n,r,i,a,o){n||={};var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--dt,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}function B({children:e,size:t=20}){return/* @__PURE__ */ z(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,\"aria-hidden\":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:e})}var ft=()=>/* @__PURE__ */ z(B,{children:/* @__PURE__ */ z(`path`,{d:`M12 19V5M5.5 11.5 12 5l6.5 6.5`})}),pt=()=>/* @__PURE__ */ z(B,{children:/* @__PURE__ */ z(`path`,{d:`M20 11.5 12.2 19.3a5 5 0 0 1-7.1-7.1l8.1-8.1a3.4 3.4 0 0 1 4.8 4.8l-8 8a1.8 1.8 0 0 1-2.6-2.6l7.3-7.3`})}),mt=()=>/* @__PURE__ */ z(B,{children:[/* @__PURE__ */ z(`rect`,{x:`9`,y:`3`,width:`6`,height:`11`,rx:`3`}),/* @__PURE__ */ z(`path`,{d:`M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21`})]}),ht=({size:e=18})=>/* @__PURE__ */ z(B,{size:e,children:/* @__PURE__ */ z(`path`,{d:`M6 6l12 12M18 6 6 18`})}),gt=()=>/* @__PURE__ */ z(B,{size:18,children:/* @__PURE__ */ z(`path`,{d:`M4 12a8 8 0 1 0 2.4-5.7M4 4v4.5h4.5`})}),_t=()=>/* @__PURE__ */ z(B,{size:18,children:/* @__PURE__ */ z(`path`,{d:`M5 12.5l4.5 4.5L19 7.5`})}),vt=({size:e=16})=>/* @__PURE__ */ z(B,{size:e,children:[/* @__PURE__ */ z(`path`,{d:`M12 3.5c.5 4.3 2.2 6 6.5 6.5-4.3.5-6 2.2-6.5 6.5-.5-4.3-2.2-6-6.5-6.5 4.3-.5 6-2.2 6.5-6.5Z`}),/* @__PURE__ */ z(`path`,{d:`M18.5 15.5c.2 1.6.9 2.3 2.5 2.5-1.6.2-2.3.9-2.5 2.5-.2-1.6-.9-2.3-2.5-2.5 1.6-.2 2.3-.9 2.5-2.5Z`})]}),yt=()=>/* @__PURE__ */ z(B,{size:16,children:/* @__PURE__ */ z(`path`,{d:`M5 12h14M13 6l6 6-6 6`})});function bt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var xt=bt();function St(e){xt=e}var Ct={exec:()=>null};function wt(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function V(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(H.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Tt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),H={codeRemoveIndent:/^(?: {0,3}\\t| {1,4})/gm,outputLinkReplace:/\\\\([\\[\\]])/g,indentCodeCompensation:/^(\\s+)(?:```)/,beginningSpace:/^\\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \\t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\\n/g,tabCharGlobal:/\\t/g,leadingSpaceTab:/^[ \\t]+/,multipleSpaceGlobal:/\\s+/g,blankLine:/^[ \\t]*$/,doubleBlankLine:/\\n[ \\t]*\\n[ \\t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \\t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \\t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\\[[ xX]\\] +\\S/,listReplaceTask:/^\\[[ xX]\\] +/,listTaskCheckbox:/\\[[ xX]\\]/,anyLine:/\\n.*\\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\\||\\| *$/g,tableRowBlankLine:/\\n[ \\t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\\s|>)/i,endPreScriptTag:/^<\\/(pre|code|kbd|script)(\\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'\"]*[^\\s])\\s+(['\"])(.*)\\2/,unicodeAlphaNumeric:/[\\p{L}\\p{N}]/u,numericCharacterReference:/&#(?:(\\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,escapeTest:/[&<>\"']/,escapeReplace:/[&<>\"']/g,escapeTestNoEncode:/[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/,escapeReplaceNoEncode:/[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,caret:/(^|[^\\[])\\^/g,percentDecode:/%25/g,findPipe:/\\|/g,splitPipe:/ \\|/,slashPipe:/\\\\\\|/g,carriageReturn:/\\r\\n|\\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\\S*/,endingNewline:/\\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\\\n]*)?(?:\\\\n|$))`),nextBulletRegex:wt(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ ][^\\\\n]*)?(?:\\\\n|$))`)),hrRegex:wt(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\\\*[ ]*){3,})(?:\\\\n+|$)`)),fencesBeginRegex:wt(e=>RegExp(`^ {0,${e}}(?:\\`\\`\\`|~~~)`)),headingBeginRegex:wt(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\\\s|$)`)),pedanticHeadingBeginRegex:wt(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:wt(e=>RegExp(`^ {0,${e}}(?:</?(?:${Bt})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`,`i`)),blockquoteBeginRegex:wt(e=>RegExp(`^ {0,${e}}>`))},Et=/^(?:[ \\t]*(?:\\n|$))+/,Dt=/^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/,Ot=/^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/,kt=/^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/,At=/^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/,jt=/ {0,3}(?:[*+-]|\\d{1,9}[.)])/,Mt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\\n(?!\\s*?\\n|bull |fences|blockquote|heading|hr|html|table))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,Nt=V(Mt).replace(/bull/g,jt).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/\\|table/g,``).getRegex(),Pt=V(Mt).replace(/bull/g,jt).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/table/g,/ {0,3}\\|?(?:[:\\- ]*\\|)+[\\:\\- ]*\\n/).getRegex(),Ft=/^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \\t]+\\n)[^\\n]+)*)/,It=/^[^\\n]+/,Lt=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\])+/,Rt=V(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/).replace(`label`,Lt).replace(`title`,/(?:\"(?:\\\\\"?|[^\"\\\\])*\"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/).getRegex(),zt=V(/^(bull)([ \\t][^\\n]*?)?(?:\\n|$)/).replace(/bull/g,jt).getRegex(),Bt=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Vt=/<!--(?:-?>|[\\s\\S]*?(?:-->|$))/,Ht=V(`^ {0,3}(?:<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:</\\\\1>[^\\\\n]*\\\\n*|$)|comment[^\\\\n]*(\\\\n+|$)|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>[^\\\\n]*\\\\n*|$)|<![A-Z][\\\\s\\\\S]*?(?:>[^\\\\n]*\\\\n*|$)|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?(?:\\\\]\\\\]>[^\\\\n]*\\\\n*|$)|</?(tag)(?:[ \\\\t]+|\\\\n|/?>|$)[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|</[a-z][a-z0-9-]*\\\\s*>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$))`,`i`).replace(`comment`,Vt).replace(`tag`,Bt).replace(`attribute`,/ +[a-zA-Z:_][\\w.:-]*(?: *= *\"[^\"\\n]*\"| *= *'[^'\\n]*'| *= *[^\\s\"'=<>`]+)?/).getRegex(),Ut=e=>V(Ft).replace(`hr`,kt).replace(`heading`,` {0,3}#{1,6}(?:\\\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`,\" {0,3}(?:`{3,}(?=[^`\\\\n]*(?:\\\\n|$))|~~~)[^\\\\n]*(?:\\\\n|$)\").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`).replace(`tag`,Bt).getRegex(),Wt=Ut(/ {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]/),Gt=Ut(/ {0,3}(?:[*+-]|\\d{1,9}[.)])(?:[ \\t]|\\n|$)/),Kt={blockquote:V(/^( {0,3}> ?(?:(?![ \\t]*(?:\\n|$))(paragraph)|[^\\n]*)(?:\\n|$))+/).replace(`paragraph`,Gt).getRegex(),code:Dt,def:Rt,fences:Ot,heading:At,hr:kt,html:Ht,lheading:Nt,list:zt,newline:Et,paragraph:Wt,table:Ct,text:It},qt=V(`^ *([^\\\\n ].*)\\\\n {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)`).replace(`hr`,kt).replace(`heading`,` {0,3}#{1,6}(?:\\\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\\\n]`).replace(`fences`,\" {0,3}(?:`{3,}(?=[^`\\\\n]*(?:\\\\n|$))|~~~)[^\\\\n]*(?:\\\\n|$)\").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\\\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`).replace(`tag`,Bt).getRegex(),Jt={...Kt,lheading:Pt,table:qt,paragraph:V(Ft).replace(`hr`,kt).replace(`heading`,` {0,3}#{1,6}(?:\\\\s|$)`).replace(`|lheading`,``).replace(`table`,qt).replace(`blockquote`,` {0,3}>`).replace(`fences`,\" {0,3}(?:`{3,}(?=[^`\\\\n]*(?:\\\\n|$))|~~~)[^\\\\n]*(?:\\\\n|$)\").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`).replace(`tag`,Bt).getRegex()},Yt={...Kt,html:V(`^ *(?:comment *(?:\\\\n|\\\\s*$)|<(tag)[\\\\s\\\\S]+?</\\\\1> *(?:\\\\n{2,}|\\\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\\\s[^'\"/>\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))`).replace(`comment`,Vt).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b`).getRegex(),def:/^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +([\"(][^\\n]+[\")]))? *(?:\\n+|$)/,heading:/^(#{1,6})(.*)(?:\\n+|$)/,fences:Ct,lheading:/^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,paragraph:V(Ft).replace(`hr`,kt).replace(`heading`,` *#{1,6} *[^\n]`).replace(`lheading`,Nt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Xt=/^\\\\([!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/,Zt=/^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/,Qt=/^( {2,}|\\\\)\\n(?!\\s*$)[ \\t]*/,$t=/^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/,U=/[\\p{P}\\p{S}]/u,en=/[\\s\\p{P}\\p{S}]/u,tn=/[^\\s\\p{P}\\p{S}]/u,nn=V(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,en).getRegex(),rn=/[\\p{Pi}\\p{Ps}\"']/u,an=/(?!~)[\\p{P}\\p{S}]/u,on=/(?!~)[\\s\\p{P}\\p{S}]/u,sn=/(?:[^\\s\\p{P}\\p{S}]|~)/u,cn=V(/link|precode-code|html/,`g`).replace(`link`,/\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace(`precode-`,Tt?\"(?<!`)()\":\"(^^|[^`])\").replace(`code`,/(?<b>`+)[^`]+\\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ln=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/,un=V(ln,`u`).replace(/punct/g,U).getRegex(),dn=V(ln,`u`).replace(/punct/g,an).getRegex(),fn=V(/^(?:\\*+(?:((?!\\*)(?!openQuote)punct)|([^\\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\\s_]))?/,`u`).replace(/openQuote/g,rn).replace(/punct/g,U).getRegex(),pn=`^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)`,mn=V(pn,`gu`).replace(/notPunctSpace/g,tn).replace(/punctSpace/g,en).replace(/punct/g,U).getRegex(),hn=V(pn,`gu`).replace(/notPunctSpace/g,sn).replace(/punctSpace/g,on).replace(/punct/g,an).getRegex(),gn=V(`^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)[\\\\s](\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|(?:(?!\\\\*)punct|notPunctSpace)(\\\\*+)(?!\\\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,tn).replace(/punctSpace/g,en).replace(/punct/g,U).getRegex(),_n=V(`^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,tn).replace(/punctSpace/g,en).replace(/punct/g,U).getRegex(),vn=V(`^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\\\s](_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,tn).replace(/punctSpace/g,en).replace(/punct/g,U).getRegex(),yn=V(/^~~?(?:((?!~)punct)|[^\\s~])/,`u`).replace(/punct/g,U).getRegex(),bn=V(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,tn).replace(/punctSpace/g,en).replace(/punct/g,U).getRegex(),xn=V(/\\\\(punct)/,`gu`).replace(/punct/g,U).getRegex(),Sn=V(/(`+)(?:[^`]|[^`][\\s\\S]*?[^`])\\1(?!`)|`+|\\\\(punct)/,`gu`).replace(/punct/g,U).getRegex(),Cn=V(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),wn=V(Vt).replace(`(?:-->|$)`,`-->`).getRegex(),Tn=V(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\\\s*/?>|^<\\\\?[\\\\s\\\\S]*?\\\\?>|^<![a-zA-Z]+\\\\s[\\\\s\\\\S]*?>|^<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>`).replace(`comment`,wn).replace(`attribute`,/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*\"[^\"]*\"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s\"'=<>`]+)?/).getRegex(),En=/\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]/,Dn=V(/(?:\\[(?:brackets|\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\\])|[^\\[\\]\\\\`])*?/).replace(`brackets`,En).getRegex(),On=V(/^!?\\[(label)\\]\\([ \\t\\n]*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?[ \\t\\n]*\\)/).replace(`label`,Dn).replace(`href`,/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]+|(?=\\))/).replace(`title`,/\"(?:\\\\\"?|[^\"\\\\])*\"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex(),kn=V(/^!?\\[(label)\\]\\[(ref)\\]/).replace(`label`,Dn).replace(`ref`,Lt).getRegex(),An=V(/^!?\\[(ref)\\](?:\\[\\])?/).replace(`ref`,Lt).getRegex(),jn=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\]){1,999}/,Mn=V(/(?:[^\\[\\]\\\\`]*(?:\\[(?:brackets|\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\\]))){0,999}?[^\\[\\]\\\\`]*?/).replace(`brackets`,En).getRegex(),Nn=V(`reflink|nolink(?!\\\\()`,`g`).replace(`reflink`,V(/^!?\\[(label)\\]\\[(ref)\\]/).replace(`label`,Mn).replace(`ref`,jn).getRegex()).replace(`nolink`,V(/^!?\\[(ref)\\](?:\\[\\])?/).replace(`ref`,jn).getRegex()).getRegex(),Pn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Fn=V(/(?:mailto:email|xmpp:email(?:\\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\\w-])/).getRegex(),In={_backpedal:Ct,anyPunctuation:xn,anyPunctuationOutsideCode:Sn,autolink:Cn,blockSkip:cn,br:Qt,code:Zt,del:Ct,delLDelim:Ct,delRDelim:Ct,emStrongLDelim:un,emStrongRDelimAst:mn,emStrongRDelimUnd:_n,escape:Xt,link:On,nolink:An,punctuation:nn,reflink:kn,reflinkSearch:Nn,tag:Tn,text:$t,url:Ct},Ln={...In,emStrongLDelim:fn,emStrongRDelimAst:gn,emStrongRDelimUnd:vn,link:V(/^!?\\[(label)\\]\\((.*?)\\)/).replace(`label`,Dn).getRegex(),reflink:V(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace(`label`,Dn).getRegex()},Rn={...In,emStrongRDelimAst:hn,emStrongLDelim:dn,delLDelim:yn,delRDelim:bn,url:V(/^emailProtocol|^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace(`emailProtocol`,Fn).replace(`protocol`,Pn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'\"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'\"~)]+(?!$))+/,del:/^(~~?)(?=[^\\s~])((?:\\\\[\\s\\S]|[^\\\\])*?(?:\\\\[\\s\\S]|[^\\s~\\\\]))\\1(?=[^~]|$)/,text:V(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*~_]|\\b_|protocol:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-](?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@))))/).replace(`protocol`,Pn).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},zn={...Rn,br:V(Qt).replace(`{2,}`,`*`).getRegex(),text:V(Rn.text).replace(`\\\\b_`,`\\\\b_| {2,}\\\\n`).replace(/\\{2,\\}/g,`*`).getRegex()},Bn={normal:Kt,gfm:Jt,pedantic:Yt},Vn={normal:In,gfm:Rn,breaks:zn,pedantic:Ln},Hn={\"&\":`&amp;`,\"<\":`&lt;`,\">\":`&gt;`,'\"':`&quot;`,\"'\":`&#39;`},Un=e=>Hn[e];function W(e,t){if(t){if(H.escapeTest.test(e))return e.replace(H.escapeReplace,Un)}else if(H.escapeTestNoEncode.test(e))return e.replace(H.escapeReplaceNoEncode,Un);return e}function Wn(e){return H.numericCharacterReference.test(e)?e.replace(H.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function Gn(e){try{e=encodeURI(e).replace(H.percentDecode,`%`)}catch{return null}return e}function Kn(e,t){let n=e.replace(H.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\\\`;)r=!r;return r?`|`:` |`}).split(H.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(H.slashPipe,`|`);return n}function G(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function qn(e){let t=e.split(`\n`),n=t.length-1;for(;n>=0&&H.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`\n`)}function Jn(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Yn(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Xn(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Zn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function Qn(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`\n`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`\n`)}function $n(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\\\`){i++;continue}if(t[i]===\"`\"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var er=class{options;rules;lexer;constructor(e){this.options=e||xt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:qn(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Qn(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=G(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:G(t[0],`\n`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:G(t[0],`\n`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=G(t[0],`\n`).split(`\n`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`\n`),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+Xn(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`\n $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}\n${s}`:s,r=r?`${r}\n${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`\n`),o=t.raw+`\n`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\\n/,``),l=c?c.split(`\n`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}\n${d.join(`\n`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`\n`+e.join(`\n`),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`\n`).length:0;if(s>0){let t=e.slice(0,s).join(`\n`);n=`${n}\n${t}`,r=`${r}\n${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\\\d{1,9}\\\\${i.slice(-1)}`:`\\\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`\n`,1)[0],d=t[1].length,f=this.options.pedantic?Xn(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>Xn(e,d)),p=e.split(`\n`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`\n`,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>Xn(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`\n`+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}\n${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`\n`+e}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=qn(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Yn(t[2],`()`)!==-1)return;let e=Jn(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:G(t[0],`\n`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Kn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`\n`):[],a={type:`table`,raw:G(t[0],`\n`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Kn(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:G(t[0],`\n`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`\n`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&$n(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=G(r.slice(0,-1),`\\\\`);if((r.length-e.length)%2==0)return}else{let e=Yn(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Zn(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&$n(e,n[1],r,this.rules))return;let i=t[Jn((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Zn(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l),_=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,t=t.slice(-1*e.length+n);(r=_.exec(t))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Wn(t[0]),escaped:e}}}},K=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||xt,this.options.tokenizer=this.options.tokenizer||new er,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:H,block:Bn.normal,inline:Vn.normal};this.options.pedantic?(t.block=Bn.pedantic,t.inline=Vn.pedantic):this.options.gfm&&(t.block=Bn.gfm,t.inline=this.options.breaks?Vn.breaks:Vn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Bn,inline:Vn}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(H.carriageReturn,`\n`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(H.tabCharGlobal,` `).replace(H.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`\n`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`\n`)?``:`\n`)+i.raw,n.text+=`\n`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`\n`)?``:`\n`)+i.raw,n.text+=`\n`+i.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`\n`)?``:`\n`)+i.raw,r.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`\n`)?``:`\n`)+i.raw,n.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,Jn(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==er.prototype.emStrong||this.tokenizer.del!==er.prototype.del?this.#t(e):e,r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}#t(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,Jn(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=t.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},tr=class{options;parser;constructor(e){this.options=e||xt}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(H.notSpaceStart)?.[0],i=e?e.replace(H.endingNewline,``)+`\n`:``;return r?`<pre><code class=\"language-`+W(r)+`\">`+(n?i:W(i,!0))+`</code></pre>\n`:`<pre><code>`+(n?i:W(i,!0))+`</code></pre>\n`}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return`<hr>\n`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start=\"`+n+`\"`:``;return`<`+i+a+`>\n`+r+`</`+i+`>\n`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return`<input `+(e?`checked=\"\" `:``)+`disabled=\"\" type=\"checkbox\"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>\n<thead>\n`+t+`</thead>\n`+r+`</table>\n`}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align=\"${e.align}\">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${W(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?W(n,!0):this.parser.parseInline(r),o=Gn(e);if(o===null)return a;e=W(o,i);let s=`<a href=\"`+e+`\"`;return t&&(s+=` title=\"`+W(t)+`\"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Gn(e);if(i===null)return W(n);e=i;let a=`<img src=\"${W(e)}\" alt=\"${W(n)}\"`;return t&&(a+=` title=\"${W(t)}\"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:W(e.text)}},nr=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},q=class e{options;renderer;textRenderer;constructor(e){this.options=e||xt,this.options.renderer=this.options.renderer||new tr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new nr,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with \"`+i.type+`\" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with \"`+a.type+`\" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},rr=class{options;block;constructor(e){this.options=e||xt}static passThroughHooks=/* @__PURE__ */ new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=/* @__PURE__ */ new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?K.lex:K.lexInline}provideParser(e=this.block){return e?q.parse:q.parseInline}};function ir(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var J=new class{defaults=bt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=q;Renderer=tr;TextRenderer=nr;Lexer=K;Tokenizer=er;Hooks=rr;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(ir(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)ir(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)ir(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;ir(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);ir(n,this.walkTokens(i,t))}):e.tokens&&ir(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new tr(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new er(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new rr;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=rr.passThroughHooks.has(n)?e=>{if(t.options.async&&rr.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&ir(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return K.lex(e,t??this.defaults)}parser(e,t){return q.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(/* @__PURE__ */ Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(/* @__PURE__ */ Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(/* @__PURE__ */ Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?K.lex:K.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?q.parse:q.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?K.lex:K.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?q.parse:q.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`\nPlease report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+W(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Y(e,t){return J.parse(e,t)}Y.options=Y.setOptions=function(e){return J.setOptions(e),Y.defaults=J.defaults,St(Y.defaults),Y},Y.getDefaults=bt,Y.defaults=xt;function ar(...e){return J.use(...e),Y.defaults=J.defaults,St(Y.defaults),Y}Y.use=ar,Y.walkTokens=function(e,t){return J.walkTokens(e,t)},Y.parseInline=J.parseInline,Y.Parser=q,Y.parser=q.parse,Y.Renderer=tr,Y.TextRenderer=nr,Y.Lexer=K,Y.lexer=K.lex,Y.Tokenizer=er,Y.Hooks=rr,Y.parse=Y,Y.options,Y.setOptions,Y.walkTokens,Y.parseInline,q.parse,K.lex;var or=/* @__PURE__ */ new Set([`http:`,`https:`,`mailto:`]),sr=16;function cr(e){try{let t=new URL(e);return or.has(t.protocol)?t.href:``}catch{return``}}var lr={amp:`&`,lt:`<`,gt:`>`,quot:`\"`,apos:`'`,nbsp:`\\xA0`,copy:`©`,reg:`®`,trade:`™`,hellip:`…`,mdash:`—`,ndash:`–`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,laquo:`«`,raquo:`»`,bull:`•`,middot:`·`,deg:`°`,plusmn:`±`,times:`×`,divide:`÷`,euro:`€`,pound:`£`,yen:`¥`,cent:`¢`,sect:`§`,para:`¶`};function ur(e){return e.includes(`&`)?e.replace(/&(#\\d{1,7}|#[xX][\\da-fA-F]{1,6}|[a-zA-Z]{2,8});/g,(e,t)=>{if(t[0]!==`#`)return lr[t]??e;let n=t[1]===`x`||t[1]===`X`?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return n>0&&n<=1114111&&(n<55296||n>57343)?String.fromCodePoint(n):`�`}):e}function X(e,t){return t>sr?[(e??[]).map(e=>e.raw).join(``)]:(e??[]).map((e,n)=>{switch(e.type){case`text`:return`tokens`in e&&e.tokens?X(e.tokens,t+1):ur(e.text);case`escape`:return e.text;case`strong`:return/* @__PURE__ */ z(`strong`,{children:X(e.tokens,t+1)},n);case`em`:return/* @__PURE__ */ z(`em`,{children:X(e.tokens,t+1)},n);case`del`:return/* @__PURE__ */ z(`del`,{children:X(e.tokens,t+1)},n);case`codespan`:return/* @__PURE__ */ z(`code`,{children:e.text},n);case`br`:return/* @__PURE__ */ z(`br`,{},n);case`link`:{let r=cr(ur(e.href));return r?/* @__PURE__ */ z(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer nofollow`,children:X(e.tokens,t+1)},n):/* @__PURE__ */ z(`span`,{children:X(e.tokens,t+1)},n)}case`image`:return e.text?/* @__PURE__ */ z(`span`,{\"data-ask-part\":`image-alt`,children:[`[`,ur(e.text),`]`]},n):null;default:return null}})}function dr(e,t,n){return e.map((e,r)=>/* @__PURE__ */ z(t?`th`:`td`,{style:e.align?{textAlign:e.align}:void 0,children:X(e.tokens,n+1)},r))}function fr(e,t){return t>sr?[e.map(e=>e.raw).join(``)]:e.map((e,n)=>{switch(e.type){case`paragraph`:return/* @__PURE__ */ z(`p`,{children:X(e.tokens,t+1)},n);case`text`:return e.tokens?X(e.tokens,t+1):ur(e.text);case`heading`:return/* @__PURE__ */ z(`h${Math.min(Math.max(e.depth,1),6)}`,{children:X(e.tokens,t+1)},n);case`code`:return/* @__PURE__ */ z(`pre`,{children:/* @__PURE__ */ z(`code`,{children:e.text})},n);case`blockquote`:return/* @__PURE__ */ z(`blockquote`,{children:fr(e.tokens??[],t+1)},n);case`hr`:return/* @__PURE__ */ z(`hr`,{},n);case`list`:{let r=e.items.map((e,n)=>/* @__PURE__ */ z(`li`,{children:[e.task&&/* @__PURE__ */ z(`input`,{type:`checkbox`,checked:e.checked??!1,disabled:!0}),fr(e.tokens.filter(e=>e.type!==`checkbox`),t+1)]},n));return e.ordered?/* @__PURE__ */ z(`ol`,{start:typeof e.start==`number`?e.start:void 0,children:r},n):/* @__PURE__ */ z(`ul`,{children:r},n)}case`table`:return/* @__PURE__ */ z(`table`,{children:[/* @__PURE__ */ z(`thead`,{children:/* @__PURE__ */ z(`tr`,{children:dr(e.header,!0,t)})}),/* @__PURE__ */ z(`tbody`,{children:e.rows.map((e,n)=>/* @__PURE__ */ z(`tr`,{children:dr(e,!1,t)},n))})]},n);default:return null}})}var pr=e=>e.split(/\\n{2,}/).map((e,t)=>/* @__PURE__ */ z(`p`,{children:e},t));function mr(e){try{return fr(K.lex(e,{gfm:!0}),0)}catch{return pr(e)}}var hr=class extends S{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?pr(this.props.text):this.props.children}},gr=ze(function({text:e}){return/* @__PURE__ */ z(hr,{text:e,children:mr(e)})}),_r=2048,vr=.85,yr=/\\.(png|jpe?g|webp|gif|heic|heif|avif|bmp)$/i,br=class extends Error{},xr=e=>e.type===`application/pdf`||/\\.pdf$/i.test(e.name),Sr=e=>e.type.startsWith(`image/`)&&e.type!==`image/svg+xml`||yr.test(e.name),Cr=e=>e.replace(/\\.[^.]*$/,``)||`image`;function wr(e){return[...e.images?[`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/heic`]:[],...e.pdf?[`application/pdf`]:[]].join(`,`)}async function Tr(e,t,n){let r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw new br;return i.fillStyle=`#fff`,i.fillRect(0,0,t,n),i.drawImage(e,0,0,t,n),new Promise((e,t)=>r.toBlob(n=>n?e(n):t(new br),`image/jpeg`,vr))}async function Er(e,t){if(t.pdf&&xr(e))return{blob:e,name:e.name,kind:`pdf`};if(!t.images||!Sr(e))throw new br;let n;try{n=await createImageBitmap(e,{imageOrientation:`from-image`})}catch{throw new br}try{let t=Math.min(1,_r/Math.max(n.width,n.height)),r=Math.max(1,Math.round(n.width*t)),i=Math.max(1,Math.round(n.height*t));return{blob:await Tr(n,r,i),name:`${Cr(e.name)}.jpg`,kind:`image`}}finally{n.close()}}var Dr=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4;codecs=mp4a.40.2`,`audio/mp4`],Or=32e3;function kr(){if(typeof MediaRecorder<`u`)return Dr.find(e=>MediaRecorder.isTypeSupported(e))}function Ar(){return!navigator.mediaDevices?.getUserMedia||!kr()?!1:document.featurePolicy?.allowsFeature(`microphone`)??!0}var jr=class extends Error{reason;constructor(e,t){super(`Microphone ${e}`,t),this.reason=e}};async function Mr(e){let t=kr();if(!t)throw new jr(`failed`);let n;try{n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch(e){let t=e instanceof DOMException?e.name:``;throw t===`NotAllowedError`||t===`SecurityError`?new jr(`blocked`,{cause:e}):t===`NotFoundError`||t===`OverconstrainedError`?new jr(`missing`,{cause:e}):new jr(`failed`,{cause:e})}try{return Nr(n,t,e)}catch(e){for(let e of n.getTracks())e.stop();throw new jr(`failed`,{cause:e})}}function Nr(e,t,n){let r=new MediaRecorder(e,{mimeType:t,audioBitsPerSecond:Or}),i=[];r.addEventListener(`dataavailable`,e=>{e.data.size>0&&i.push(e.data)});let a=new Promise(e=>r.addEventListener(`stop`,()=>e(),{once:!0})),o=new AudioContext,s=o.createAnalyser();s.fftSize=512,o.createMediaStreamSource(e).connect(s);let c=new Uint8Array(s.fftSize),l=()=>{for(let t of e.getTracks())t.stop();o.close()},u,d=()=>{clearTimeout(u),r.state!==`inactive`&&r.stop()};return r.start(250),u=setTimeout(d,n*1e3),{level(){s.getByteTimeDomainData(c);let e=0;for(let t of c){let n=(t-128)/128;e+=n*n}return Math.min(1,Math.sqrt(e/c.length)*4)},async stop(){return d(),await a,l(),new Blob(i,{type:t.split(`;`)[0]??t})},cancel(){d(),l()}}}var Pr=e=>e.split(/\\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``)||`AI`;function Fr(e){return e.split(`**`).map((e,t)=>t%2==1?/* @__PURE__ */ z(`strong`,{children:e},t):e)}function Ir({widget:e,size:t}){let n=e.avatar?`image`:e.variants.avatar;return n===`none`?null:/* @__PURE__ */ z(`span`,{\"data-ask-part\":`avatar`,\"data-kind\":n,\"data-size\":t,\"aria-hidden\":`true`,children:[n===`image`&&/* @__PURE__ */ z(`img`,{src:e.avatar,alt:``}),n===`orb`&&/* @__PURE__ */ z(`span`,{\"data-ask-part\":`orb`}),n===`icon`&&/* @__PURE__ */ z(vt,{size:t===`large`?28:16}),n===`initials`&&Pr(e.title)]})}function Lr({widget:e,disabled:t,onPick:n}){if(e.starters.length===0)return null;let r=e.variants.welcome===`intro`;return/* @__PURE__ */ z(`ul`,{\"data-ask-part\":`starters`,\"aria-label\":e.texts[`welcome.suggestions`],children:e.starters.map(i=>/* @__PURE__ */ z(`li`,{children:/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`starter`,disabled:t,onClick:()=>n(i),children:[z(r?_t:vt,{}),/* @__PURE__ */ z(`span`,{children:i}),e.variants.welcome===`persona`&&/* @__PURE__ */ z(yt,{})]})},i))})}function Rr({widget:e,disabled:t,onPick:n}){let r=e.variants.welcome,i=/* @__PURE__ */ z(Lr,{widget:e,disabled:t,onPick:n});return r===`intro`?/* @__PURE__ */ z(`section`,{\"data-ask-part\":`welcome`,\"data-layout\":`intro`,\"aria-label\":e.texts[`welcome.label`],children:/* @__PURE__ */ z(`div`,{\"data-ask-part\":`intro`,children:[/* @__PURE__ */ z(Ir,{widget:e,size:`small`}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`intro-card`,children:[/* @__PURE__ */ z(`p`,{\"data-ask-part\":`greeting`,children:Fr(e.greeting)}),i]})]})}):r===`persona`?/* @__PURE__ */ z(`section`,{\"data-ask-part\":`welcome`,\"data-layout\":`persona`,\"aria-label\":e.texts[`welcome.label`],children:[/* @__PURE__ */ z(`div`,{\"data-ask-part\":`persona`,children:[/* @__PURE__ */ z(Ir,{widget:e,size:`large`}),/* @__PURE__ */ z(`div`,{children:[/* @__PURE__ */ z(`h2`,{\"data-ask-part\":`persona-name`,children:e.title}),/* @__PURE__ */ z(`span`,{\"data-ask-part\":`presence`,children:e.texts[`welcome.online`]})]})]}),/* @__PURE__ */ z(`p`,{\"data-ask-part\":`greeting`,children:Fr(e.greeting)}),i]}):/* @__PURE__ */ z(`section`,{\"data-ask-part\":`welcome`,\"data-layout\":`hero`,\"aria-label\":e.texts[`welcome.label`],children:[/* @__PURE__ */ z(Ir,{widget:e,size:`large`}),/* @__PURE__ */ z(`h2`,{\"data-ask-part\":`greeting`,children:Fr(e.greeting)}),i]})}var zr=e=>`${Math.floor(e/1e5)/10} MB`,Br=e=>e.role===`user`||e.status===`streaming`||e.text!==``||e.citations.length>0;function Vr(e){e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`}var Hr=e=>`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`,Ur={blocked:`microphone.blocked`,missing:`microphone.missing`,failed:`microphone.failed`};function Wr(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function Gr({files:e,part:t,t:n,onRemove:r}){return/* @__PURE__ */ z(`ul`,{\"data-ask-part\":t,\"aria-label\":n(`attachment.list`),children:e.map((e,t)=>{let i=`status`in e?e:void 0;return/* @__PURE__ */ z(`li`,{\"data-ask-part\":`attachment`,\"data-kind\":e.kind,\"data-status\":i?.status,children:[e.previewUrl?/* @__PURE__ */ z(`img`,{\"data-ask-part\":`attachment-preview`,src:e.previewUrl,alt:``}):/* @__PURE__ */ z(`span`,{\"data-ask-part\":`attachment-badge`,\"aria-hidden\":`true`,children:e.kind===`image`?`IMG`:e.kind===`pdf`?`PDF`:`FILE`}),/* @__PURE__ */ z(`span`,{\"data-ask-part\":`attachment-name`,children:e.name}),i?.status===`uploading`&&/* @__PURE__ */ z(`span`,{\"data-ask-part\":`attachment-status`,children:n(`attachment.uploading`)}),i?.status===`error`&&/* @__PURE__ */ z(`span`,{\"data-ask-part\":`attachment-status`,role:`alert`,children:i.error}),i&&r&&/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`attachment-remove`,\"aria-label\":n(`attachment.remove`,{name:e.name}),onClick:()=>r(i),children:`×`})]},i?.key??t)})})}var Kr=0,qr=()=>`local_${++Kr}`,Jr=e=>({...e,status:`done`});function Yr(e,t){let n=(t,n)=>e.map(e=>e.id===t?n(e):e);switch(t.type){case`message.start`:return[...e,{id:t.messageId,role:`assistant`,text:``,citations:[],attachments:0,status:`streaming`}];case`text.delta`:return n(t.messageId,e=>({...e,text:e.text+t.delta}));case`citation`:return n(t.messageId,e=>({...e,citations:[...e.citations,{index:t.index,title:t.title,url:t.url}]}));case`message.end`:return n(t.messageId,e=>({...e,status:`done`}));default:return e}}function Xr(e,t){if(e.type===`reasoning`)return e.state===`started`?t(`status.thinking`):null;if(e.type===`tool.status`)return e.state===`running`?e.name===`file_search`?t(`status.searching`):t(`status.tool`,{name:e.name}):null;if(e.type===`text.delta`||e.type===`message.end`)return null}function Zr({config:e,client:t,bridge:n,fixture:r,inline:i=!1}){let[a,o]=L({});we(()=>n.onConfigure(o),[n]);let s={...e.widget,...a.greeting?{greeting:a.greeting}:{},...a.starters?{starters:a.starters}:{}},c=De((e,t)=>lt(s.texts[e]??e,t),[s.texts]),[l,u]=L(r?.messages??[]),[d,f]=L(r?.draft??``),[p,m]=L(r?.busy??!1),[h,g]=L(()=>!r&&t.hasConversation()),[_,v]=L(r?.error),[ee,y]=L(r?.activity??null),[b,S]=L(r?.pending??[]),[C,te]=L(!1),w=R(null),T=R(null),[E,ne]=L(!1),D=R(!1);D.current=E;let O=R(null),k=R(null),re=Oe(),ie=R(null),A=e.voice,[ae]=L(()=>A!==void 0&&(!!r||Ar())),[j,oe]=L(r?.dictation??`idle`),[se,ce]=L(r?.elapsed??0),M=R(void 0),le=R(!1),ue=R(void 0),de=R(null),fe=R(null),N=R(/* @__PURE__ */ new Map),P=e.attachments;Te(()=>{T.current&&j===`idle`&&Vr(T.current)},[d,j]);let F=De(()=>{clearTimeout(ue.current),M.current?.cancel(),M.current=void 0,oe(`idle`)},[]);we(()=>{let e=e=>{e.key===`Escape`&&(D.current?(ne(!1),requestAnimationFrame(()=>O.current?.focus())):M.current?(F(),requestAnimationFrame(()=>T.current?.focus())):n.close())},t=()=>F(),r=()=>{document.visibilityState===`hidden`&&F()};window.addEventListener(`keydown`,e),document.addEventListener(`visibilitychange`,r);let a=n.onHidden(t);return i||T.current?.focus(),()=>{window.removeEventListener(`keydown`,e),document.removeEventListener(`visibilitychange`,r),a(),F()}},[n,F,i]);let[pe,me]=L(r!==void 0),[he,I]=L(0);we(()=>{if(r)return;let e=!0,i=()=>{},a=Promise.resolve(),o=n=>{a=a.then(async()=>{await t.identify(n)&&e&&(u([]),v(void 0),I(e=>e+1))})};return n.handshake.then(()=>(e&&(i=n.onIdentify(o)),a)).finally(()=>{e&&me(!0)}),()=>{e=!1,i()}},[n,t,r]),we(()=>{if(r||!pe)return;if(!t.hasConversation()){g(!1);return}g(!0);let e=new AbortController;return t.loadHistory(e.signal).then(e=>u(e.map(Jr))).catch(()=>{e.signal.aborted||v(c(`error.history`))}).finally(()=>g(!1)),()=>e.abort()},[t,r,pe,he,c]);let ge=l.at(-1)?.text;we(()=>{let e=w.current;e&&ge!==void 0&&(e.scrollTop=e.scrollHeight)},[ge]);let _e=b.some(e=>e.status===`uploading`),ve=b.filter(e=>e.status===`ready`),ye=pe&&!p&&!h&&!_e&&(d.trim()!==``||ve.length>0),be=async e=>{if(!P)return;let n=qr(),r=e=>S(t=>t.map(t=>t.key===n?{...t,...e}:t)),i=new AbortController;N.current.set(n,i),S(t=>[...t,{key:n,name:e.name,status:`uploading`}]);let a=e=>{N.current.delete(n),i.signal.aborted||r({status:`error`,error:e})},o;try{o=await Er(e,P)}catch{a(c(`attachment.unsupported`));return}if(o.blob.size>P.maxBytes){a(c(`attachment.tooLarge`,{size:zr(P.maxBytes)}));return}if(i.signal.aborted)return;let s=o.kind===`image`?URL.createObjectURL(o.blob):void 0;r({name:o.name,kind:o.kind,previewUrl:s});let l=await t.upload(o.blob,o.name,i.signal);N.current.delete(n),i.signal.aborted?Wr([{previewUrl:s}]):r(l.ok?{status:`ready`,handle:l.file.id,name:l.file.name}:{status:`error`,error:l.message})},xe=e=>{if(!P||e.length===0)return;let t=P.maxPerMessage-b.length;e.length>t&&v(c(`attachment.tooMany`,{count:P.maxPerMessage}));for(let n of e.slice(0,Math.max(0,t)))be(n)},Se=e=>{for(let t of[...e])N.current.get(t)?.abort(),N.current.delete(t)},Ce=e=>{Se([e.key]),Wr([e]),S(t=>t.filter(t=>t.key!==e.key))},Ee=async n=>{let r=(n??d).trim();if(n===void 0?!ye:!pe||p||h||_e||r===``)return;let i=ve.flatMap(({name:e,kind:t,previewUrl:n})=>t?[{name:e,kind:t,previewUrl:n}]:[]),o=ve.flatMap(e=>e.handle?[e.handle]:[]);Wr(b.filter(e=>e.status!==`ready`)),S([]),n===void 0&&f(``),v(void 0),m(!0),u(e=>[...e,{id:qr(),role:`user`,text:r,citations:[],attachments:i.length,files:i,status:`done`}]);let s=e.pageContext?a.context:void 0;await t.send({text:r,attachments:o,context:s},e=>{let t=Xr(e,c);t!==void 0&&y(t),e.type===`error`?(v(e.message),u(e=>e.map(e=>e.status===`streaming`?{...e,status:`error`}:e))):u(t=>Yr(t,e))}),y(null),m(!1),T.current?.focus()},ke=async()=>{let n=M.current;if(!n)return;M.current=void 0,clearTimeout(ue.current),oe(`transcribing`);let r=await n.stop();if(r.size<1e3){oe(`idle`),v(c(`dictation.empty`));return}let i=[...navigator.languages.slice(0,2),e.widget.locale],a=await t.transcribe(r,i);oe(`idle`),a.ok?a.text&&f(e=>e.trim()?`${e.trimEnd()} ${a.text}`:a.text):v(a.message),requestAnimationFrame(()=>T.current?.focus())},Ae=async()=>{if(!A||M.current||le.current)return;v(void 0),le.current=!0;let e;try{e=await Mr(A.maxSeconds)}catch(e){v(c(Ur[e instanceof jr?e.reason:`failed`]));return}finally{le.current=!1}M.current=e,ce(0),oe(`recording`),requestAnimationFrame(()=>fe.current?.focus()),ue.current=setTimeout(()=>void ke(),A.maxSeconds*1e3);let t=performance.now(),n=()=>{M.current===e&&(de.current?.style.setProperty(`--ask-level`,e.level().toFixed(3)),ce(Math.min(A.maxSeconds,Math.floor((performance.now()-t)/1e3))),requestAnimationFrame(n))};requestAnimationFrame(n)},je=()=>{F(),requestAnimationFrame(()=>T.current?.focus())},Me=()=>{ne(!0),requestAnimationFrame(()=>k.current?.querySelector(`button`)?.focus())},Ne=()=>{ne(!1),requestAnimationFrame(()=>O.current?.focus())},Pe=e=>{if(e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`button`)),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},Fe=async()=>{ne(!1),m(!0),await t.deleteConversation().catch(()=>void 0),Wr(l.flatMap(e=>e.files??[])),Se(N.current.keys()),Wr(b),S([]),u([]),v(void 0),m(!1),T.current?.focus()},Ie=e=>{e.preventDefault(),Ee()},Le=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),Ee())},Re=e=>{let t=Array.from(e.clipboardData.files);P&&t.length!==0&&(e.preventDefault(),xe(t))},ze=R(xe);we(()=>{ze.current=xe}),we(()=>{if(!P)return;let e=e=>e.dataTransfer?.types.includes(`Files`)??!1,t=t=>{e(t)&&(t.preventDefault(),te(!0))},n=e=>{e.relatedTarget===null&&te(!1)},r=t=>{e(t)&&(t.preventDefault(),te(!1),ze.current(Array.from(t.dataTransfer?.files??[])))};return document.addEventListener(`dragover`,t),document.addEventListener(`dragleave`,n),document.addEventListener(`drop`,r),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`dragleave`,n),document.removeEventListener(`drop`,r)}},[P]);let Be=l.length===0&&!h;return/* @__PURE__ */ z(`main`,{\"data-ask-part\":`panel`,\"data-dragging\":C||void 0,\"data-busy\":p||j!==`idle`||void 0,children:[/* @__PURE__ */ z(`header`,{\"data-ask-part\":`header`,children:[/* @__PURE__ */ z(`div`,{\"data-ask-part\":`identity`,children:[/* @__PURE__ */ z(Ir,{widget:s,size:`small`}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`identity-text`,children:[/* @__PURE__ */ z(`h1`,{\"data-ask-part\":`title`,children:s.title}),s.subtitle&&/* @__PURE__ */ z(`p`,{\"data-ask-part\":`subtitle`,children:s.subtitle})]})]}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`actions`,children:[l.length>0&&/* @__PURE__ */ z(`button`,{ref:O,type:`button`,\"data-ask-part\":`new-conversation`,\"aria-label\":c(`header.newConversation`),\"aria-haspopup\":`dialog`,title:c(`header.newConversation`),disabled:p,onClick:Me,children:/* @__PURE__ */ z(gt,{})}),n.embedded&&!i&&/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`close`,\"aria-label\":c(`header.close`),title:c(`header.close`),onClick:()=>{F(),n.close()},children:/* @__PURE__ */ z(ht,{})})]})]}),E&&/* @__PURE__ */ z(`div`,{\"data-ask-part\":`confirm-backdrop`,children:/* @__PURE__ */ z(`div`,{ref:k,\"data-ask-part\":`confirm`,role:`alertdialog`,\"aria-modal\":`true`,\"aria-describedby\":re,\"aria-label\":c(`header.newConversation`),onKeyDown:Pe,children:[/* @__PURE__ */ z(`span`,{\"data-ask-part\":`confirm-icon`,\"aria-hidden\":`true`,children:/* @__PURE__ */ z(gt,{})}),/* @__PURE__ */ z(`p`,{id:re,\"data-ask-part\":`confirm-text`,children:c(`confirm.newConversation`)}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`confirm-actions`,children:[/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`confirm-cancel`,onClick:Ne,children:c(`confirm.cancel`)}),/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`confirm-accept`,onClick:()=>void Fe(),children:c(`confirm.accept`)})]})]})}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`messages`,ref:w,role:`log`,\"aria-live\":`polite`,\"aria-relevant\":`additions`,\"aria-busy\":h,children:[Be&&/* @__PURE__ */ z(Rr,{widget:s,disabled:p||!pe,onPick:e=>void Ee(e)}),h&&/* @__PURE__ */ z(`p`,{\"data-ask-part\":`status`,role:`status`,children:c(`status.loading`)}),l.filter(Br).map(e=>/* @__PURE__ */ z(`div`,{\"data-ask-part\":`message`,\"data-role\":e.role,\"data-status\":e.status,children:[e.role===`assistant`&&/* @__PURE__ */ z(Ir,{widget:s,size:`small`}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`message-body`,children:[e.text===``?e.status===`streaming`&&/* @__PURE__ */ z(`div`,{\"data-ask-part\":`bubble`,children:/* @__PURE__ */ z(`span`,{\"data-ask-part\":`typing`,role:`img`,\"aria-label\":c(`status.typing`),children:[/* @__PURE__ */ z(`i`,{}),/* @__PURE__ */ z(`i`,{}),/* @__PURE__ */ z(`i`,{})]})}):/* @__PURE__ */ z(`div`,{\"data-ask-part\":`bubble`,children:e.role===`assistant`?/* @__PURE__ */ z(gr,{text:e.text}):e.text}),e.files&&e.files.length>0?/* @__PURE__ */ z(Gr,{files:e.files,part:`message-attachments`,t:c}):e.attachments>0&&/* @__PURE__ */ z(`p`,{\"data-ask-part\":`attachments-note`,children:ut(s.texts,`message.attachments`,e.attachments,s.locale)}),e.citations.length>0&&/* @__PURE__ */ z(`ol`,{\"data-ask-part\":`citations`,\"aria-label\":c(`message.sources`),children:e.citations.map(e=>/* @__PURE__ */ z(`li`,{\"data-ask-part\":`citation`,children:e.url?/* @__PURE__ */ z(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,children:e.title}):/* @__PURE__ */ z(`span`,{children:e.title})},e.index))})]})]},e.id)),ee&&/* @__PURE__ */ z(`p`,{\"data-ask-part\":`status`,role:`status`,children:ee})]}),_&&/* @__PURE__ */ z(`p`,{\"data-ask-part\":`error`,role:`alert`,children:_}),/* @__PURE__ */ z(`form`,{\"data-ask-part\":`composer`,onSubmit:Ie,children:[b.length>0&&/* @__PURE__ */ z(Gr,{files:b,part:`attachments`,t:c,onRemove:Ce}),/* @__PURE__ */ z(`div`,{\"data-ask-part\":`composer-box`,children:j===`idle`?/* @__PURE__ */ z(x,{children:[P&&/* @__PURE__ */ z(x,{children:[/* @__PURE__ */ z(`input`,{ref:ie,type:`file`,hidden:!0,multiple:!0,accept:wr(P),onChange:e=>{xe(Array.from(e.target.files??[])),e.target.value=``}}),/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`attach`,\"aria-label\":c(`composer.attach`),title:c(`composer.attach`),disabled:p||b.length>=P.maxPerMessage,onClick:()=>ie.current?.click(),children:/* @__PURE__ */ z(pt,{})})]}),/* @__PURE__ */ z(`textarea`,{ref:T,\"data-ask-part\":`input`,rows:1,value:d,placeholder:s.placeholder,\"aria-label\":s.placeholder,onChange:e=>f(e.target.value),onKeyDown:Le,onPaste:Re}),ae&&/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`voice`,\"aria-label\":c(`composer.dictate`),title:c(`composer.dictate`),onClick:()=>void Ae(),children:/* @__PURE__ */ z(mt,{})}),/* @__PURE__ */ z(`button`,{type:`submit`,\"data-ask-part\":`send`,\"aria-label\":c(`composer.send`),title:c(`composer.send`),disabled:!ye,children:[/* @__PURE__ */ z(ft,{}),/* @__PURE__ */ z(`span`,{\"data-ask-part\":`send-label`,\"aria-hidden\":`true`,children:c(`composer.send`)})]})]}):/* @__PURE__ */ z(`div`,{\"data-ask-part\":`recorder`,\"data-state\":j,children:[/* @__PURE__ */ z(`span`,{\"data-ask-part\":`recorder-level`,ref:de,\"aria-hidden\":`true`}),/* @__PURE__ */ z(`span`,{\"data-ask-part\":`recorder-label`,role:`status`,children:c(j===`recording`?`dictation.listening`:`dictation.transcribing`)}),j===`recording`&&/* @__PURE__ */ z(x,{children:[/* @__PURE__ */ z(`span`,{\"data-ask-part\":`recorder-time`,children:[Hr(se),` / `,Hr(A?.maxSeconds??0)]}),/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`recorder-cancel`,\"aria-label\":c(`dictation.cancel`),title:c(`dictation.cancel`),onClick:je,children:/* @__PURE__ */ z(ht,{})}),/* @__PURE__ */ z(`button`,{type:`button`,\"data-ask-part\":`recorder-done`,ref:fe,onClick:()=>void ke(),children:c(`dictation.done`)})]})]})})]}),s.disclosure!==!1&&/* @__PURE__ */ z(`p`,{\"data-ask-part\":`disclosure`,children:[c(`disclosure.text`),s.disclosure.privacyUrl&&/* @__PURE__ */ z(x,{children:[` `,/* @__PURE__ */ z(`a`,{href:s.disclosure.privacyUrl,target:`_blank`,rel:`noopener noreferrer`,children:c(`disclosure.privacy`)})]})]})]})}var Qr=[`invalid_input`,`unauthorized`,`session_expired`,`not_found`,`rate_limited`,`budget_exceeded`,`bot_unavailable`,`content_blocked`,`timeout`,`upstream_error`,`internal_error`],$r=[`completed`,`max_steps`,`max_output_tokens`,`timeout`,`content_filter`,`aborted`],ei=[`conversation.created`,`user.ack`,`message.start`,`reasoning`,`text.delta`,`citation`,`tool.status`,`message.end`,`error`],ti=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Z=(e,t=0,n=1/0)=>typeof e==`string`&&e.length>=t&&e.length<=n,ni=(e,t)=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=t,ri=(e,t)=>t.includes(e),ii=e=>Z(e,1,128);function ai(e){if(typeof e!=`string`||!/^https?:\\/\\/[^\\s/?#]+[^\\s]*$/i.test(e))return!1;try{let{protocol:t}=new URL(e);return t===`http:`||t===`https:`}catch{return!1}}function oi(e){if(ti(e)&&ni(e.index,1)&&Z(e.title,1)&&(e.url===void 0||ai(e.url)))return{index:e.index,title:e.title,...e.url===void 0?{}:{url:e.url}}}function si(e){if(!ti(e))return;let t={};for(let[n,r]of Object.entries(e)){if(n.length>32||!(Z(r,0,200)||typeof r==`number`&&Number.isFinite(r)))return;t[n]=r}return t}function ci(e){if(!ti(e))return;let t=e.messageId;switch(e.type){case`conversation.created`:return Z(e.resumeToken,1)?{type:`conversation.created`,resumeToken:e.resumeToken}:void 0;case`user.ack`:case`message.start`:return ii(t)?{type:e.type,messageId:t}:void 0;case`reasoning`:return ii(t)&&ri(e.state,[`started`,`done`])?{type:`reasoning`,messageId:t,state:e.state}:void 0;case`text.delta`:return ii(t)&&Z(e.delta)?{type:`text.delta`,messageId:t,delta:e.delta}:void 0;case`citation`:{let n=oi(e);return ii(t)&&n?{type:`citation`,messageId:t,...n}:void 0}case`tool.status`:return ii(t)&&Z(e.callId,1,128)&&Z(e.name,1,64)&&ri(e.state,[`running`,`done`,`error`])?{type:`tool.status`,messageId:t,callId:e.callId,name:e.name,state:e.state}:void 0;case`message.end`:{let{resumeToken:n}=e;return!ii(t)||!ri(e.reason,$r)||n!==void 0&&!Z(n,1)?void 0:{type:`message.end`,messageId:t,reason:e.reason,...typeof n==`string`?{resumeToken:n}:{}}}case`error`:{let{code:t,message:n,retryAfterMs:r,key:i,params:a}=e;if(!ri(t,Qr)||!Z(n,0,500)||r!==void 0&&!ni(r,0)||i!==void 0&&!Z(i,0,64))return;let o=a===void 0?void 0:si(a);return a!==void 0&&!o?void 0:{type:`error`,code:t,message:n,...r===void 0?{}:{retryAfterMs:r},...i===void 0?{}:{key:i},...o?{params:o}:{}}}default:return}}function li(e){if(!ti(e)||!Z(e.id,1,256)||!ri(e.role,[`user`,`assistant`])||!Z(e.text)||!Array.isArray(e.citations)||!ni(e.attachments,0))return;let t=e.citations.map(oi);if(!t.some(e=>e===void 0))return{id:e.id,role:e.role,text:e.text,citations:t,attachments:e.attachments}}function ui(e){if(!ti(e)||!Array.isArray(e.messages))return;let t=e.messages.map(li);return t.some(e=>e===void 0)?void 0:{messages:t}}var di=new Set(ei);function fi(e){if(!di.has(e.event))return{ok:!1,reason:`unknown_type`,type:e.event};let t;try{t=JSON.parse(e.data)}catch{return{ok:!1,reason:`invalid_json`,type:e.event}}let n=ci(t);return!n||n.type!==e.event?{ok:!1,reason:`invalid_payload`,type:e.event}:{ok:!0,event:n}}var pi=class{#e=``;#t=!1;#n=!1;#r=``;#i=[];push(e){let t=e;!this.#n&&t.length>0&&(this.#n=!0,t.charCodeAt(0)===65279&&(t=t.slice(1))),this.#t&&t.startsWith(`\n`)&&(t=t.slice(1)),this.#t=!1,this.#e+=t;let n=[],r=0;for(let e=0;e<this.#e.length;e+=1){let t=this.#e[e];if(t!==`\n`&&t!==`\\r`)continue;let i=this.#e.slice(r,e);t===`\\r`&&(e+1===this.#e.length?this.#t=!0:this.#e[e+1]===`\n`&&(e+=1)),r=e+1;let a=this.#a(i);a&&n.push(a)}return this.#e=this.#e.slice(r),n}#a(e){if(e===``)return this.#o();if(e.startsWith(`:`))return;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),r=t===-1?``:e.slice(t+1);r.startsWith(` `)&&(r=r.slice(1)),n===`event`?this.#r=r:n===`data`&&this.#i.push(r)}#o(){let e=this.#i.length>0,t={event:this.#r===``?`message`:this.#r,data:this.#i.join(`\n`)};return this.#r=``,this.#i=[],e?t:void 0}},mi=e=>({contentType:`application/json`,body:JSON.stringify(e)}),hi=30,gi=class extends Error{event;constructor(e){super(e.message),this.event=e}},_i=class{#e;#t;#n;#r;#i;#a;#o;#s=!1;#c;#l;#u;constructor(e){this.#e=e,this.#t=e.fetch??((e,t)=>fetch(e,t)),this.#n=e.botId}#d(e,t,n){return{type:`error`,code:e,key:t,message:this.#e.translate?.(t)??n}}#f(e){let t=e.key?this.#e.translate?.(e.key,e.params):void 0;return t?{...e,message:t}:e}async identify(e){if(e===this.#o)return!1;this.#o=e,this.#s=!0,await this.#a?.catch(()=>void 0);let t=this.#p();this.#u=this.#r?.accessToken??this.#u,this.#r=void 0;try{await this.#h(!1)}catch{}return this.#p()!==t}#p(){let e=`askdare:${this.#n}:resume`;return this.#l?`${e}:${this.#l}`:e}reset(){this.#i=void 0,this.#e.storage.remove(this.#p())}hasConversation(){return this.#e.storage.get(this.#p())!==void 0}async loadHistory(e){let t=this.#e.storage.get(this.#p());if(!t)return[];let n=await this.#m(`POST`,`/history`,()=>mi({botId:this.#e.botId,resumeToken:t}),e);if(n.status===404)return this.reset(),[];if(!n.ok)throw Error(`History request failed with ${n.status}`);return ui(await n.json())?.messages??[]}async deleteConversation(){let e=this.#e.storage.get(this.#p());try{e&&await this.#m(`DELETE`,`/conversation`,()=>mi({botId:this.#e.botId,resumeToken:e}))}finally{this.reset()}}async upload(e,t,n){try{let r=await this.#m(`POST`,`/attachments`,()=>({contentType:`application/octet-stream`,body:e,headers:{\"x-askdare-bot\":this.#e.botId,\"x-askdare-filename\":encodeURIComponent(t)}}),n);if(!r.ok)return{ok:!1,message:(await this.#y(r)).message};let i=(await r.json()).attachment;return typeof i?.id!=`string`||i.kind!==`image`&&i.kind!==`pdf`||typeof i.name!=`string`?{ok:!1,message:this.#d(`upstream_error`,`error.uploadFailed`,`The file could not be uploaded.`).message}:{ok:!0,file:{id:i.id,kind:i.kind,name:i.name}}}catch(e){return{ok:!1,message:this.#_(e,`upstream_error`).message}}}async transcribe(e,t){try{let n=await this.#m(`POST`,`/transcriptions`,()=>({contentType:`application/octet-stream`,body:e,headers:{\"x-askdare-bot\":this.#e.botId,\"x-askdare-languages\":t.join(`,`)}}));if(!n.ok)return{ok:!1,message:(await this.#y(n)).message};let r=await n.json();return typeof r.text==`string`?{ok:!0,text:r.text}:{ok:!1,message:this.#d(`upstream_error`,`error.transcriptionFailed`,`The recording could not be transcribed.`).message}}catch(e){return{ok:!1,message:this.#_(e,`upstream_error`).message}}}async send(e,t,n){let r=e.context===this.#i?void 0:e.context;try{let i=await this.#m(`POST`,`/messages`,()=>{let t=this.#e.storage.get(this.#p());return mi({botId:this.#e.botId,text:e.text,locale:this.#e.locale,...e.attachments?.length?{attachments:e.attachments}:{},...r?{context:r}:{},...t?{resumeToken:t}:{}})},n);if(!i.ok||!i.body){t(await this.#y(i));return}if(i.headers.get(`x-askdare-protocol`)!==`1`){t(this.#d(`bot_unavailable`,`error.updated`,`The assistant was updated. Please reload the page.`));return}await this.#b(i.body,e=>{e.type===`message.start`&&r&&(this.#i=r),t(e)},n)}catch(e){if(n?.aborted)return;t(this.#_(e,e instanceof DOMException&&e.name===`TimeoutError`?`timeout`:`upstream_error`))}}async#m(e,t,n,r){let i=async i=>{let a=await this.#h(i),{contentType:o,body:s,headers:c}=n();return this.#t(`${this.#e.basePath}${t}`,{method:e,headers:{...c,\"content-type\":o,authorization:`Bearer ${a.accessToken}`},body:s,...r?{signal:r}:{}})},a=await i(!1);return a.status===401?i(!0):a}async#h(e){let t=Date.now()/1e3;return!e&&!this.#s&&this.#r&&this.#r.expiresAt-hi>t?this.#r:(this.#a??=this.#g().finally(()=>{this.#a=void 0}),this.#a)}async#g(){let e=this.#e.storage.get(this.#p()),t=this.#r?.accessToken??this.#u,n=this.#o,r=this.#p(),i=await this.#t(`${this.#e.basePath}/session`,{method:`POST`,headers:{\"content-type\":`application/json`},body:JSON.stringify({botId:this.#e.botId,...e?{resumeToken:e}:{},...t?{accessToken:t}:{},...n===void 0?{}:{identityToken:n}})});if(!i.ok)throw new gi(await this.#y(i,!1));let a=await i.json();return this.#o===n&&(this.#s=!1),this.#u=void 0,this.#l=a.identified?a.identityKey:void 0,n&&!a.identified&&this.#c!==n&&(this.#c=n,console.warn(`[askdare] askdare('identify') was refused (${a.identityProblem??`unknown`}); the chat continues anonymously.`)),a.resumeToken?(this.#e.storage.set(this.#p(),a.resumeToken),r!==this.#p()&&this.#e.storage.remove(r)):!a.resumable&&e&&r===this.#p()&&this.reset(),this.#r={accessToken:a.accessToken,expiresAt:a.expiresAt},this.#r}#_(e,t){return e instanceof gi?e.event:this.#v(t)}#v(e){return this.#d(e,`error.connection`,`Connection problem. Please try again.`)}async#y(e,t=!0){let n={};try{n=await e.json()}catch{}t&&e.status===404&&n.error?.code===`not_found`&&this.reset();let r=fi({event:`error`,data:JSON.stringify({type:`error`,...n.error})});return r.ok&&r.event.type===`error`?this.#f(r.event):this.#d(`upstream_error`,`error.upstream_error`,`The assistant is temporarily unavailable. Please try again.`)}async#b(e,t,n){let r=e.getReader(),i=new TextDecoder,a=new pi,o=this.#e.watchdogMs??45e3,s,c=!1,l=()=>{clearTimeout(s),s=setTimeout(()=>{c=!0,r.cancel()},o)},u=()=>void r.cancel();n?.addEventListener(`abort`,u,{once:!0});try{for(l();;){let{done:e,value:n}=await r.read();if(e)break;l();for(let e of a.push(i.decode(n,{stream:!0}))){let n=fi(e);n.ok&&(n.event.type===`conversation.created`||n.event.type===`message.end`&&n.event.resumeToken?this.#e.storage.set(this.#p(),n.event.resumeToken):n.event.type===`error`&&n.event.code===`not_found`&&this.reset(),t(n.event.type===`error`?this.#f(n.event):n.event))}}c&&t(this.#d(`timeout`,`error.stalled`,`The connection stalled. Please try again.`))}finally{clearTimeout(s),n?.removeEventListener(`abort`,u)}}},vi=`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2040%2040%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%239cc9ff%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23fde2c4%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%2240%22%20height%3D%2240%22%20fill%3D%22url(%23s)%22%2F%3E%3Ccircle%20cx%3D%2229%22%20cy%3D%2212%22%20r%3D%225%22%20fill%3D%22%23fff6d5%22%2F%3E%3Cpath%20d%3D%22M0%2030l11-11%209%209%206-5%2014%2012v5H0z%22%20fill%3D%22%234f7d6a%22%2F%3E%3C%2Fsvg%3E`,Q=(e,t,n,r={})=>({id:e,role:t,text:n,citations:[],attachments:0,status:`done`,...r}),yi=[Q(`u1`,`user`,`What does the Business plan include?`),Q(`a1`,`assistant`,`The **Business** plan is built for larger teams:\n\n- Unlimited users and **1 TB** of storage\n- Single sign-on with SAML and an audit log\n- Priority support, first reply within 4 business hours\n\n| Billing | Price per user |\n| --- | --- |\n| Monthly | €15 |\n| Yearly | €12 |`,{citations:[{index:1,title:`Brightloop pricing and plans`,url:`https://example.com/pricing`},{index:2,title:`Brightloop security and privacy`,url:`https://example.com/security`}]}),Q(`u2`,`user`,`Can we try it first?`),Q(`a2`,`assistant`,`Yes. Every paid plan starts with a **14-day free trial**, and you don’t need a card to start it.`)],bi={welcome:{messages:[]},conversation:{messages:yi},streaming:{messages:[...yi.slice(0,2),Q(`u2`,`user`,`How do I move our projects from Trello?`),Q(`a2`,`assistant`,`Go to **Settings → Import** and choose Trello. Brightloop brings over`,{status:`streaming`})],busy:!0},attachments:{messages:[Q(`u1`,`user`,`Is this the right screen for exporting?`,{attachments:2,files:[{name:`screenshot.jpg`,kind:`image`,previewUrl:vi},{name:`export-guide.pdf`,kind:`pdf`}]}),Q(`a1`,`assistant`,``,{status:`streaming`})],pending:[{key:`p1`,name:`invoice-march.pdf`,kind:`pdf`,status:`ready`,handle:`h`},{key:`p2`,name:`team-photo.jpg`,kind:`image`,status:`uploading`,previewUrl:vi},{key:`p3`,name:`notes.svg`,status:`error`,error:`This file type is not supported.`}],busy:!0,activity:`Searching documents…`},error:{messages:[...yi.slice(0,2),Q(`u2`,`user`,`And the Enterprise plan?`),Q(`a2`,`assistant`,`Enterprise adds`,{status:`error`})],error:`The assistant took too long to respond. Please try again.`,draft:`And the Enterprise plan?`},listening:{messages:yi.slice(0,2),dictation:`recording`,elapsed:7}},xi=1e3,Si=3e3,Ci=/^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$/;function wi(e){if(e===null)return null;if(typeof e==`string`)return e.length<=4096&&Ci.test(e)?e:(console.warn(`[askdare] askdare('identify') got something that isn't a JWT; signing out.`),null)}function Ti(e){let t=typeof e.greeting==`string`?e.greeting.trim():``,n=Array.isArray(e.starters)?e.starters.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0&&e.length<=80).slice(0,4):void 0,r=typeof e.context==`string`?e.context.trim():``;return{...t&&t.length<=500?{greeting:t}:{},...n?{starters:n}:{},...r?{context:r.slice(0,xi)}:{}}}function Ei(e){let t=window.parent!==window,n,r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a,o=/* @__PURE__ */ new Set,s,c=e=>{if(e!==void 0){s=e;for(let t of o)t(e)}},l=()=>{},u=new Promise(e=>{l=e,t?setTimeout(e,Si):e()}),d=/* @__PURE__ */ new Set([window.location.origin,...e]),f=e=>{if(n||e.source!==window.parent||!d.has(e.origin))return;let t=e.data;t?.v===1&&t.type===`askdare:init`&&e.ports[0]&&(n=e.ports[0],n.onmessage=e=>{if(e.data?.v===1){if(e.data.type===`hidden`)for(let e of r)e();else if(e.data.type===`configure`){a=Ti(e.data);for(let e of i)e(a)}else e.data.type===`identify`&&c(wi(e.data.token))}},n.start(),n.postMessage({v:1,type:`ready`}),window.removeEventListener(`message`,f),c(wi(t.identity)),l())};return t&&window.addEventListener(`message`,f),{embedded:t,close(){n?.postMessage({v:1,type:`close`})},onHidden(e){return r.add(e),()=>r.delete(e)},onConfigure(e){return i.add(e),a&&e(a),()=>i.delete(e)},handshake:u,onIdentify(e){return o.add(e),s!==void 0&&e(s),()=>o.delete(e)}}}function Di(){return{get(e){try{return window.localStorage.getItem(e)??void 0}catch{return}},set(e,t){try{window.localStorage.setItem(e,t)}catch{}},remove(e){try{window.localStorage.removeItem(e)}catch{}}}}function Oi(){let e=document.getElementById(`askdare-config`),t=JSON.parse(e?.textContent??`null`);if(!t?.botId||!t.basePath)throw Error(`[askdare] Missing embed configuration.`);return t}var $=Oi(),ki=document.getElementById(`askdare-root`);if(ki){let e=new _i({basePath:$.basePath,botId:$.botId,locale:$.widget.locale,storage:Di(),translate:(e,t)=>{let n=$.widget.texts[e];return n===void 0?void 0:lt(n,t)}});ct(ki).render(/* @__PURE__ */ z(Zr,{config:$,client:e,bridge:Ei($.allowedOrigins),fixture:$.gallery?bi[$.gallery]:void 0,inline:new URLSearchParams(window.location.search).get(`mode`)===`inline`}))}";
65
+ const WIDGET_JS = "var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m={},h=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_=Array.isArray;function v(e,t){for(var n in t)e[n]=t[n];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function y(t,n,r){var i,a,o,s={};for(o in n)o==`key`?i=n[o]:o==`ref`?a=n[o]:s[o]=n[o];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):r),typeof t==`function`&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return b(t,s,i,a,null)}function b(e,r,i,a,o){var s={type:e,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++n,__i:-1,__u:0};return o==null&&t.vnode!=null&&t.vnode(s),s}function x(e){return e.children}function S(e,t){this.props=e,this.context=t}function C(e,t){if(t==null)return e.__?C(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?C(e):null}function te(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],a=[],o=v({},n);o.__v=n.__v+1,t.vnode&&t.vnode(o),j(e.__P,o,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??C(n),!!(32&n.__u),a),o.__v=n.__v,o.__.__k[o.__i]=o,oe(i,o,a),n.__e=n.__=null,o.__e!=r&&w(o)}}function w(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),w(e)}function T(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!E.__r++||i!=t.debounceRendering)&&((i=t.debounceRendering)||a)(E)}function E(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,te(e)}finally{r.length=E.__r=0}}function ne(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,ee=r&&r.__k||h,y=t.length;for(c=D(n,t,ee,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&ee[p.__i]||m,p.__i=d,v=j(e,p,f,i,a,o,s,c,l,u),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&ce(f.ref,null,p),u.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),4&p.__u?(c=O(p,c,e),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-7);return n.__e=_,c}function D(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=b(null,o,null,null,null):_(o)?o=e.__k[a]=b(x,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=b(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=re(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=C(s)),le(s,s));return r}function O(e,t,n){var r,i;if(typeof e.type==`function`){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=O(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=C(e)),t=n.insertBefore(e.__e,t||null));do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function k(e,t){return t||=[],e==null||typeof e==`boolean`||(_(e)?e.some(function(e){k(e,t)}):t.push(e)),t}function re(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ie(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||g.test(t)?n:n+`px`}function A(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ie(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ie(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(u,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[l]=r[l]:(n[l]=d,e.addEventListener(t,a?p:f,a)):e.removeEventListener(t,a?p:f,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ae(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[c]==null)n[c]=d++;else if(n[c]<r[l])return;return r(t.event?t.event(n):n)}}}function j(e,n,r,i,a,o,s,c,l,u){var d,f,p,m,g,y,b,te,w,T,E,D,O,k,re,ie,A=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[c=n.__e=r.__e]),(d=t.__b)&&d(n);n:if(typeof A==`function`){f=s.length;try{if(w=n.props,T=A.prototype&&A.prototype.render,E=(d=A.contextType)&&i[d.__c],D=d?E?E.props.value:d.__:i,r.__c?te=(p=n.__c=r.__c).__=p.__E:(T?n.__c=p=new A(w,D):(n.__c=p=new S(w,D),p.constructor=A,p.render=ue),E&&E.sub(p),p.state||(p.state={}),p.__n=i,m=p.__d=!0,p.__h=[],p._sb=[]),T&&p.__s==null&&(p.__s=p.state),T&&A.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),g=p.props,y=p.state,p.__v=n,m)T&&A.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),T&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(T&&A.getDerivedStateFromProps==null&&w!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(w,D),n.__v==r.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(w,p.__s,D)){n.__v!=r.__v&&(p.props=w,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),h.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p),c=C(r);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(w,p.__s,D),T&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,y,b)})}if(p.context=D,p.props=w,p.__P=e,p.__e=!1,O=t.__r,k=0,T)p.state=p.__s,p.__d=!1,O&&O(n),d=p.render(p.props,p.state,p.context),h.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,O&&O(n),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++k<25);p.state=p.__s,p.getChildContext!=null&&(i=v(v({},i),p.getChildContext())),T&&!m&&p.getSnapshotBeforeUpdate!=null&&(b=p.getSnapshotBeforeUpdate(g,y)),re=d!=null&&d.type===x&&d.key==null?se(d.props.children):d,c=ne(e,_(re)?re:[re],n,r,i,a,o,s,c,l,u),p.base=n.__e,n.__u&=-161,p.__h.length&&s.push(p),te&&(p.__E=p.__=null)}catch(e){if(s.length=f,n.__v=null,l||o!=null){if(e.then){for(n.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),n.__e=c}else if(o!=null)for(ie=o.length;ie--;)ee(o[ie])}else n.__e=r.__e;n.__k??=r.__k||[],e.then||M(n),t.__e(e,n,r)}}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=N(r.__e,n,r,i,a,o,s,l,u);return(d=t.diffed)&&d(n),128&n.__u?void 0:c}function M(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(M))}function oe(e,n,r){for(var i=0;i<r.length;i++)ce(r[i],r[++i],r[++i]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b>0?e:_(e)?e.map(se):e.constructor===void 0?v({},e):null}function N(n,r,i,a,o,s,c,l,u){var d,f,p,h,g,v,y,b=i.props||m,x=r.props,S=r.type;if(S==`svg`?o=`http://www.w3.org/2000/svg`:S==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!S&&(S?g.localName==S:g.nodeType==3)){n=g,s[d]=null;break}}if(n==null){if(S==null)return document.createTextNode(x);n=document.createElementNS(o,S,x.is&&x),l&&=(t.__m&&t.__m(r,s),!1),s=null}if(S==null)b===x||l&&n.data==x||(n.data=x);else{if(s=S==`textarea`&&x.defaultValue!=null?null:s&&e.call(n.childNodes),!l&&s!=null)for(b={},d=0;d<n.attributes.length;d++)b[(g=n.attributes[d]).name]=g.value;for(d in b)g=b[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||A(n,d,null,g,o);for(d in x)g=x[d],d==`children`?h=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?v=g:d==`checked`?y=g:l&&typeof g!=`function`||b[d]===g||A(n,d,g,b[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==n.innerHTML)||(n.innerHTML=f.__html),r.__k=[];else if(p&&(n.innerHTML=``),ne(r.type==`template`?n.content:n,_(h)?h:[h],r,i,a,S==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:i.__k&&C(i,0),l,u),s!=null)for(d=s.length;d--;)ee(s[d]);l&&S!=`textarea`||(d=`value`,S==`progress`&&v==null?n.removeAttribute(`value`):v!=null&&(v!==n[d]||S==`progress`&&!v||S==`option`&&v!=b[d])&&A(n,d,v,b[d],o),d=`checked`,y!=null&&y!=n[d]&&A(n,d,y,b[d],o))}return n}function ce(e,n,r){try{if(typeof e==`function`){var i=typeof e.__u==`function`;i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,r)}}function le(e,n,r){var i,a;if(t.unmount&&t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ce(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){t.__e(e,n)}i.base=i.__P=i.__n=null}if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&le(i[a],n,r||typeof e.type!=`function`);r||ee(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}function de(n,r,i){var a,o,s,c;r==document&&(r=document.documentElement),t.__&&t.__(n,r),o=(a=typeof i==`function`)?null:i&&i.__k||r.__k,s=[],c=[],j(r,n=(!a&&i||r).__k=y(x,null,[n]),o||m,m,r.namespaceURI,!a&&i?[i]:o?null:r.firstChild?e.call(r.childNodes):null,s,!a&&i?i:o?o.__e:r.firstChild,a,c),oe(s,n,c),n.props.children=null}e=h.slice,t={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},n=0,S.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=v({},this.state);typeof e==`function`&&(e=e(v({},n),this.props)),e&&v(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),T(this))},S.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),T(this))},S.prototype.render=x,r=[],a=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o=function(e,t){return e.__v.__b-t.__v.__b},E.__r=0,s=Math.random().toString(8),c=`__d`+s,l=`__a`+s,u=/(PointerCapture)$|Capture$/i,d=0,f=ae(!1),p=ae(!0);var P,F,I,fe,pe=0,me=[],L=t,he=L.__b,ge=L.__r,_e=L.diffed,ve=L.__c,ye=L.unmount,be=L.__;function xe(e,t){L.__h&&L.__h(F,e,pe||t),pe=0;var n=F.__H||(F.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function R(e){return pe=1,Se(Pe,e)}function Se(e,t,n){var r=xe(P++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Pe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=F,!F.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};F.__f=!0;var a=F.shouldComponentUpdate,o=F.componentWillUpdate;F.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},F.shouldComponentUpdate=i}return r.__N||r.__}function Ce(e,t){var n=xe(P++,3);!L.__s&&Ne(n.__H,t)&&(n.__=e,n.u=t,F.__H.__h.push(n))}function we(e,t){var n=xe(P++,4);!L.__s&&Ne(n.__H,t)&&(n.__=e,n.u=t,F.__h.push(n))}function z(e){return pe=5,Te(function(){return{current:e}},[])}function Te(e,t){var n=xe(P++,7);return Ne(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ee(e,t){return pe=8,Te(function(){return e},t)}function De(){var e=xe(P++,11);if(!e.__){for(var t=F.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function Oe(){for(var e;e=me.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(je),t.__h.some(Me),t.__h=[]}catch(n){t.__h=[],L.__e(n,e.__v)}}}L.__b=function(e){F=null,he&&he(e)},L.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),be&&be(e,t)},L.__r=function(e){ge&&ge(e),P=0;var t=(F=e.__c).__H;t&&(I===F?(t.__h=[],F.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(je),t.__h.some(Me),t.__h=[],P=0)),I=F},L.diffed=function(e){_e&&_e(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(me.push(t)!==1&&fe===L.requestAnimationFrame||((fe=L.requestAnimationFrame)||Ae)(Oe)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),I=F=null},L.__c=function(e,t){t.some(function(e){try{e.__h.some(je),e.__h=e.__h.filter(function(e){return!e.__||Me(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],L.__e(n,e.__v)}}),ve&&ve(e,t)},L.unmount=function(e){ye&&ye(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{je(e)}catch(e){t=e}}),n.__H=void 0,t&&L.__e(t,n.__v))};var ke=typeof requestAnimationFrame==`function`;function Ae(e){var t,n=function(){clearTimeout(r),ke&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ke&&(t=requestAnimationFrame(n))}function je(e){var t=F,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),F=t}function Me(e){var t=F;e.__c=e.__(),F=t}function Ne(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Pe(e,t){return typeof t==`function`?t(e):t}function Fe(e,t){for(var n in t)e[n]=t[n];return e}function Ie(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Le(e,t){this.props=e,this.context=t}function Re(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Ie(this.props,e)}function r(t){return this.shouldComponentUpdate=n,y(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(Le.prototype=new S).isPureReactComponent=!0,Le.prototype.shouldComponentUpdate=function(e,t){return Ie(this.props,e)||Ie(this.state,t)};var ze=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ze&&ze(e)},typeof Symbol<`u`&&Symbol.for;var Be=t.__e;t.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Be(e,t,n,r)};var Ve=t.unmount;function He(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=Fe({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return He(e,t,n)})),e}function Ue(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ue(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function We(){this.__u=0,this.o=null,this.__b=null}function Ge(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ke(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ve&&Ve(e)},(We.prototype=new S).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Ge(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ue(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},We.prototype.componentWillUnmount=function(){this.o=[]},We.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=He(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&y(x,null,e.fallback);return i&&(i.__u&=-33),[y(x,null,t.__a?null:e.children),i]};var qe=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ke.prototype=new S).__a=function(e){var t=this,n=Ge(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),qe(t,e,r)):i()};n?n(a):a()}},Ke.prototype.render=function(e){this.i=null,this.l=/* @__PURE__ */ new Map;var t=k(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ke.prototype.componentDidUpdate=Ke.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){qe(e,n,t)})};var Je=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Ye=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xe=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ze=/[A-Z0-9]/g,Qe=typeof document<`u`,$e=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};function et(e,t,n){return t.__k??(t.textContent=``),de(e,t),typeof n==`function`&&n(),e?e.__c:null}S.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(S.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var tt=t.event;t.event=function(e){return tt&&(e=tt(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var nt={configurable:!0,get:function(){return this.class}},rt=t.vnode;t.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Qe&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||$e(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Xe.test(a)&&(a=s):s=a=`oninput`:i&&Ye.test(a)?a=a.replace(Ze,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=k(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=k(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,\"className\",nt)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Je,rt&&rt(e)};var it=t.__r;t.__r=function(e){it&&it(e),e.__c};var at=t.diffed;t.diffed=function(e){at&&at(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function ot(e){return!!e.__k&&(de(null,e),!0)}function st(e){return{render:function(t){et(t,e)},unmount:function(){ot(e)}}}function ct(e,t={}){return e.replace(/\\{(\\w+)\\}/g,(e,n)=>n in t?String(t[n]):e)}function lt(e,t,n,r){let i=`other`;try{i=new Intl.PluralRules(r).select(n)}catch{}return ct(e[`${t}.${i}`]??e[`${t}.other`]??``,{count:n})}var ut=[`invalid_input`,`unauthorized`,`session_expired`,`not_found`,`rate_limited`,`budget_exceeded`,`bot_unavailable`,`content_blocked`,`timeout`,`upstream_error`,`internal_error`],dt=[`completed`,`max_steps`,`max_output_tokens`,`timeout`,`content_filter`,`aborted`],ft=[`conversation.created`,`user.ack`,`message.start`,`reasoning`,`text.delta`,`citation`,`tool.status`,`message.end`,`error`],pt=e=>typeof e==`object`&&!!e&&!Array.isArray(e),B=(e,t=0,n=1/0)=>typeof e==`string`&&e.length>=t&&e.length<=n,mt=(e,t)=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=t,ht=(e,t)=>t.includes(e),gt=e=>B(e,1,128);function _t(e){if(typeof e!=`string`||!/^https?:\\/\\/[^\\s/?#]+[^\\s]*$/i.test(e))return!1;try{let{protocol:t}=new URL(e);return t===`http:`||t===`https:`}catch{return!1}}function vt(e){if(pt(e)&&mt(e.index,1)&&B(e.title,1)&&(e.url===void 0||_t(e.url)))return{index:e.index,title:e.title,...e.url===void 0?{}:{url:e.url}}}function yt(e){if(!pt(e))return;let t={};for(let[n,r]of Object.entries(e)){if(n.length>32||!(B(r,0,200)||typeof r==`number`&&Number.isFinite(r)))return;t[n]=r}return t}function bt(e){if(!pt(e))return;let t=e.messageId;switch(e.type){case`conversation.created`:return B(e.resumeToken,1)?{type:`conversation.created`,resumeToken:e.resumeToken}:void 0;case`user.ack`:case`message.start`:return gt(t)?{type:e.type,messageId:t}:void 0;case`reasoning`:return gt(t)&&ht(e.state,[`started`,`done`])?{type:`reasoning`,messageId:t,state:e.state}:void 0;case`text.delta`:return gt(t)&&B(e.delta)?{type:`text.delta`,messageId:t,delta:e.delta}:void 0;case`citation`:{let n=vt(e);return gt(t)&&n?{type:`citation`,messageId:t,...n}:void 0}case`tool.status`:return gt(t)&&B(e.callId,1,128)&&B(e.name,1,64)&&ht(e.state,[`running`,`done`,`error`])?{type:`tool.status`,messageId:t,callId:e.callId,name:e.name,state:e.state}:void 0;case`message.end`:{let{resumeToken:n}=e;return!gt(t)||!ht(e.reason,dt)||n!==void 0&&!B(n,1)?void 0:{type:`message.end`,messageId:t,reason:e.reason,...typeof n==`string`?{resumeToken:n}:{}}}case`error`:{let{code:t,message:n,retryAfterMs:r,key:i,params:a}=e;if(!ht(t,ut)||!B(n,0,500)||r!==void 0&&!mt(r,0)||i!==void 0&&!B(i,0,64))return;let o=a===void 0?void 0:yt(a);return a!==void 0&&!o?void 0:{type:`error`,code:t,message:n,...r===void 0?{}:{retryAfterMs:r},...i===void 0?{}:{key:i},...o?{params:o}:{}}}default:return}}function xt(e){if(!pt(e)||!B(e.id,1,256)||!ht(e.role,[`user`,`assistant`])||!B(e.text)||!Array.isArray(e.citations)||!mt(e.attachments,0))return;let t=e.citations.map(vt);if(!t.some(e=>e===void 0))return{id:e.id,role:e.role,text:e.text,citations:t,attachments:e.attachments}}function St(e){if(!pt(e)||!Array.isArray(e.messages))return;let t=e.messages.map(xt);return t.some(e=>e===void 0)?void 0:{messages:t}}var Ct=new Set(ft);function wt(e){if(!Ct.has(e.event))return{ok:!1,reason:`unknown_type`,type:e.event};let t;try{t=JSON.parse(e.data)}catch{return{ok:!1,reason:`invalid_json`,type:e.event}}let n=bt(t);return!n||n.type!==e.event?{ok:!1,reason:`invalid_payload`,type:e.event}:{ok:!0,event:n}}var Tt=class{#e=``;#t=!1;#n=!1;#r=``;#i=[];push(e){let t=e;!this.#n&&t.length>0&&(this.#n=!0,t.charCodeAt(0)===65279&&(t=t.slice(1))),this.#t&&t.startsWith(`\n`)&&(t=t.slice(1)),this.#t=!1,this.#e+=t;let n=[],r=0;for(let e=0;e<this.#e.length;e+=1){let t=this.#e[e];if(t!==`\n`&&t!==`\\r`)continue;let i=this.#e.slice(r,e);t===`\\r`&&(e+1===this.#e.length?this.#t=!0:this.#e[e+1]===`\n`&&(e+=1)),r=e+1;let a=this.#a(i);a&&n.push(a)}return this.#e=this.#e.slice(r),n}#a(e){if(e===``)return this.#o();if(e.startsWith(`:`))return;let t=e.indexOf(`:`),n=t===-1?e:e.slice(0,t),r=t===-1?``:e.slice(t+1);r.startsWith(` `)&&(r=r.slice(1)),n===`event`?this.#r=r:n===`data`&&this.#i.push(r)}#o(){let e=this.#i.length>0,t={event:this.#r===``?`message`:this.#r,data:this.#i.join(`\n`)};return this.#r=``,this.#i=[],e?t:void 0}},Et=e=>({contentType:`application/json`,body:JSON.stringify(e)}),Dt=30,Ot=class extends Error{event;constructor(e){super(e.message),this.event=e}},kt=class{#e;#t;#n;#r;#i;#a;#o;#s=!1;#c;#l;#u;constructor(e){this.#e=e,this.#t=e.fetch??((e,t)=>fetch(e,t)),this.#n=e.botId}#d(e,t,n){return{type:`error`,code:e,key:t,message:this.#e.translate?.(t)??n}}#f(e){let t=e.key?this.#e.translate?.(e.key,e.params):void 0;return t?{...e,message:t}:e}async identify(e){if(e===this.#o)return!1;this.#o=e,this.#s=!0,await this.#a?.catch(()=>void 0);let t=this.#p();this.#u=this.#r?.accessToken??this.#u,this.#r=void 0;try{await this.#h(!1)}catch{}return this.#p()!==t}#p(){let e=`askdare:${this.#n}:resume`;return this.#l?`${e}:${this.#l}`:e}reset(){this.#i=void 0,this.#e.storage.remove(this.#p())}hasConversation(){return this.#e.storage.get(this.#p())!==void 0}async loadHistory(e){let t=this.#e.storage.get(this.#p());if(!t)return[];let n=await this.#m(`POST`,`/history`,()=>Et({botId:this.#e.botId,resumeToken:t}),e);if(n.status===404)return this.reset(),[];if(!n.ok)throw Error(`History request failed with ${n.status}`);return St(await n.json())?.messages??[]}async deleteConversation(){let e=this.#e.storage.get(this.#p());try{e&&await this.#m(`DELETE`,`/conversation`,()=>Et({botId:this.#e.botId,resumeToken:e}))}finally{this.reset()}}async upload(e,t,n){try{let r=await this.#m(`POST`,`/attachments`,()=>({contentType:`application/octet-stream`,body:e,headers:{\"x-askdare-bot\":this.#e.botId,\"x-askdare-filename\":encodeURIComponent(t)}}),n);if(!r.ok)return{ok:!1,message:(await this.#y(r)).message};let i=(await r.json()).attachment;return typeof i?.id!=`string`||i.kind!==`image`&&i.kind!==`pdf`||typeof i.name!=`string`?{ok:!1,message:this.#d(`upstream_error`,`error.uploadFailed`,`The file could not be uploaded.`).message}:{ok:!0,file:{id:i.id,kind:i.kind,name:i.name}}}catch(e){return{ok:!1,message:this.#_(e,`upstream_error`).message}}}async transcribe(e,t){try{let n=await this.#m(`POST`,`/transcriptions`,()=>({contentType:`application/octet-stream`,body:e,headers:{\"x-askdare-bot\":this.#e.botId,\"x-askdare-languages\":t.join(`,`)}}));if(!n.ok)return{ok:!1,message:(await this.#y(n)).message};let r=await n.json();return typeof r.text==`string`?{ok:!0,text:r.text}:{ok:!1,message:this.#d(`upstream_error`,`error.transcriptionFailed`,`The recording could not be transcribed.`).message}}catch(e){return{ok:!1,message:this.#_(e,`upstream_error`).message}}}async send(e,t,n){let r=e.context===this.#i?void 0:e.context;try{let i=await this.#m(`POST`,`/messages`,()=>{let t=this.#e.storage.get(this.#p());return Et({botId:this.#e.botId,text:e.text,locale:this.#e.locale,...e.attachments?.length?{attachments:e.attachments}:{},...r?{context:r}:{},...t?{resumeToken:t}:{}})},n);if(!i.ok||!i.body){t(await this.#y(i));return}if(i.headers.get(`x-askdare-protocol`)!==`1`){t(this.#d(`bot_unavailable`,`error.updated`,`The assistant was updated. Please reload the page.`));return}await this.#b(i.body,e=>{e.type===`message.start`&&r&&(this.#i=r),t(e)},n)}catch(e){if(n?.aborted)return;t(this.#_(e,e instanceof DOMException&&e.name===`TimeoutError`?`timeout`:`upstream_error`))}}async#m(e,t,n,r){let i=async i=>{let a=await this.#h(i),{contentType:o,body:s,headers:c}=n();return this.#t(`${this.#e.basePath}${t}`,{method:e,headers:{...c,\"content-type\":o,authorization:`Bearer ${a.accessToken}`},body:s,...r?{signal:r}:{}})},a=await i(!1);return a.status===401?i(!0):a}async#h(e){let t=Date.now()/1e3;return!e&&!this.#s&&this.#r&&this.#r.expiresAt-Dt>t?this.#r:(this.#a??=this.#g().finally(()=>{this.#a=void 0}),this.#a)}async#g(){let e=this.#e.storage.get(this.#p()),t=this.#r?.accessToken??this.#u,n=this.#o,r=this.#p(),i=await this.#t(`${this.#e.basePath}/session`,{method:`POST`,headers:{\"content-type\":`application/json`},body:JSON.stringify({botId:this.#e.botId,...e?{resumeToken:e}:{},...t?{accessToken:t}:{},...n===void 0?{}:{identityToken:n}})});if(!i.ok)throw new Ot(await this.#y(i,!1));let a=await i.json();return this.#o===n&&(this.#s=!1),this.#u=void 0,this.#l=a.identified?a.identityKey:void 0,n&&!a.identified&&this.#c!==n&&(this.#c=n,console.warn(`[askdare] askdare('identify') was refused (${a.identityProblem??`unknown`}); the chat continues anonymously.`)),a.resumeToken?(this.#e.storage.set(this.#p(),a.resumeToken),r!==this.#p()&&this.#e.storage.remove(r)):!a.resumable&&e&&r===this.#p()&&this.reset(),this.#r={accessToken:a.accessToken,expiresAt:a.expiresAt},this.#r}#_(e,t){return e instanceof Ot?e.event:this.#v(t)}#v(e){return this.#d(e,`error.connection`,`Connection problem. Please try again.`)}async#y(e,t=!0){let n={};try{n=await e.json()}catch{}t&&e.status===404&&n.error?.code===`not_found`&&this.reset();let r=wt({event:`error`,data:JSON.stringify({type:`error`,...n.error})});return r.ok&&r.event.type===`error`?this.#f(r.event):this.#d(`upstream_error`,`error.upstream_error`,`The assistant is temporarily unavailable. Please try again.`)}async#b(e,t,n){let r=e.getReader(),i=new TextDecoder,a=new Tt,o=this.#e.watchdogMs??45e3,s,c=!1,l=()=>{clearTimeout(s),s=setTimeout(()=>{c=!0,r.cancel()},o)},u=()=>void r.cancel();n?.addEventListener(`abort`,u,{once:!0});try{for(l();;){let{done:e,value:n}=await r.read();if(e)break;l();for(let e of a.push(i.decode(n,{stream:!0}))){let n=wt(e);n.ok&&(n.event.type===`conversation.created`||n.event.type===`message.end`&&n.event.resumeToken?this.#e.storage.set(this.#p(),n.event.resumeToken):n.event.type===`error`&&n.event.code===`not_found`&&this.reset(),t(n.event.type===`error`?this.#f(n.event):n.event))}}c&&t(this.#d(`timeout`,`error.stalled`,`The connection stalled. Please try again.`))}finally{clearTimeout(s),n?.removeEventListener(`abort`,u)}}},At=0;Array.isArray;function V(e,n,r,i,a,o){n||={};var s,c,l=n;if(`ref`in l)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--At,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return t.vnode&&t.vnode(u),u}function H({children:e,size:t=20}){return/* @__PURE__ */ V(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,\"aria-hidden\":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:e})}var jt=()=>/* @__PURE__ */ V(H,{children:/* @__PURE__ */ V(`path`,{d:`M12 19V5M5.5 11.5 12 5l6.5 6.5`})}),Mt=()=>/* @__PURE__ */ V(H,{children:/* @__PURE__ */ V(`path`,{d:`M20 11.5 12.2 19.3a5 5 0 0 1-7.1-7.1l8.1-8.1a3.4 3.4 0 0 1 4.8 4.8l-8 8a1.8 1.8 0 0 1-2.6-2.6l7.3-7.3`})}),Nt=()=>/* @__PURE__ */ V(H,{children:[/* @__PURE__ */ V(`rect`,{x:`9`,y:`3`,width:`6`,height:`11`,rx:`3`}),/* @__PURE__ */ V(`path`,{d:`M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21`})]}),Pt=({size:e=18})=>/* @__PURE__ */ V(H,{size:e,children:/* @__PURE__ */ V(`path`,{d:`M6 6l12 12M18 6 6 18`})}),Ft=()=>/* @__PURE__ */ V(H,{size:18,children:/* @__PURE__ */ V(`path`,{d:`M4 12a8 8 0 1 0 2.4-5.7M4 4v4.5h4.5`})}),It=()=>/* @__PURE__ */ V(H,{size:18,children:/* @__PURE__ */ V(`path`,{d:`M5 12.5l4.5 4.5L19 7.5`})}),Lt=({size:e=16})=>/* @__PURE__ */ V(H,{size:e,children:[/* @__PURE__ */ V(`path`,{d:`M12 3.5c.5 4.3 2.2 6 6.5 6.5-4.3.5-6 2.2-6.5 6.5-.5-4.3-2.2-6-6.5-6.5 4.3-.5 6-2.2 6.5-6.5Z`}),/* @__PURE__ */ V(`path`,{d:`M18.5 15.5c.2 1.6.9 2.3 2.5 2.5-1.6.2-2.3.9-2.5 2.5-.2-1.6-.9-2.3-2.5-2.5 1.6-.2 2.3-.9 2.5-2.5Z`})]}),Rt=()=>/* @__PURE__ */ V(H,{size:16,children:/* @__PURE__ */ V(`path`,{d:`M5 12h14M13 6l6 6-6 6`})});function zt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Bt=zt();function Vt(e){Bt=e}var Ht={exec:()=>null};function Ut(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function U(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(W.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Wt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),W={codeRemoveIndent:/^(?: {0,3}\\t| {1,4})/gm,outputLinkReplace:/\\\\([\\[\\]])/g,indentCodeCompensation:/^(\\s+)(?:```)/,beginningSpace:/^\\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \\t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\\n/g,tabCharGlobal:/\\t/g,leadingSpaceTab:/^[ \\t]+/,multipleSpaceGlobal:/\\s+/g,blankLine:/^[ \\t]*$/,doubleBlankLine:/\\n[ \\t]*\\n[ \\t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \\t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \\t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\\[[ xX]\\] +\\S/,listReplaceTask:/^\\[[ xX]\\] +/,listTaskCheckbox:/\\[[ xX]\\]/,anyLine:/\\n.*\\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\\||\\| *$/g,tableRowBlankLine:/\\n[ \\t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\\s|>)/i,endPreScriptTag:/^<\\/(pre|code|kbd|script)(\\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'\"]*[^\\s])\\s+(['\"])(.*)\\2/,unicodeAlphaNumeric:/[\\p{L}\\p{N}]/u,numericCharacterReference:/&#(?:(\\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,escapeTest:/[&<>\"']/,escapeReplace:/[&<>\"']/g,escapeTestNoEncode:/[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/,escapeReplaceNoEncode:/[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,caret:/(^|[^\\[])\\^/g,percentDecode:/%25/g,findPipe:/\\|/g,splitPipe:/ \\|/,slashPipe:/\\\\\\|/g,carriageReturn:/\\r\\n|\\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\\S*/,endingNewline:/\\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\\\n]*)?(?:\\\\n|$))`),nextBulletRegex:Ut(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ ][^\\\\n]*)?(?:\\\\n|$))`)),hrRegex:Ut(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\\\*[ ]*){3,})(?:\\\\n+|$)`)),fencesBeginRegex:Ut(e=>RegExp(`^ {0,${e}}(?:\\`\\`\\`|~~~)`)),headingBeginRegex:Ut(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\\\s|$)`)),pedanticHeadingBeginRegex:Ut(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Ut(e=>RegExp(`^ {0,${e}}(?:</?(?:${on})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`,`i`)),blockquoteBeginRegex:Ut(e=>RegExp(`^ {0,${e}}>`))},Gt=/^(?:[ \\t]*(?:\\n|$))+/,Kt=/^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/,qt=/^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/,Jt=/^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/,Yt=/^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/,Xt=/ {0,3}(?:[*+-]|\\d{1,9}[.)])/,Zt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\\n(?!\\s*?\\n|bull |fences|blockquote|heading|hr|html|table))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,Qt=U(Zt).replace(/bull/g,Xt).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/\\|table/g,``).getRegex(),$t=U(Zt).replace(/bull/g,Xt).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/table/g,/ {0,3}\\|?(?:[:\\- ]*\\|)+[\\:\\- ]*\\n/).getRegex(),en=/^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \\t]+\\n)[^\\n]+)*)/,tn=/^[^\\n]+/,nn=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\])+/,rn=U(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/).replace(`label`,nn).replace(`title`,/(?:\"(?:\\\\\"?|[^\"\\\\])*\"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/).getRegex(),an=U(/^(bull)([ \\t][^\\n]*?)?(?:\\n|$)/).replace(/bull/g,Xt).getRegex(),on=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,sn=/<!--(?:-?>|[\\s\\S]*?(?:-->|$))/,cn=U(`^ {0,3}(?:<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:</\\\\1>[^\\\\n]*\\\\n*|$)|comment[^\\\\n]*(\\\\n+|$)|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>[^\\\\n]*\\\\n*|$)|<![A-Z][\\\\s\\\\S]*?(?:>[^\\\\n]*\\\\n*|$)|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?(?:\\\\]\\\\]>[^\\\\n]*\\\\n*|$)|</?(tag)(?:[ \\\\t]+|\\\\n|/?>|$)[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$)|</[a-z][a-z0-9-]*\\\\s*>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ ]*)+\\\\n|$))`,`i`).replace(`comment`,sn).replace(`tag`,on).replace(`attribute`,/ +[a-zA-Z:_][\\w.:-]*(?: *= *\"[^\"\\n]*\"| *= *'[^'\\n]*'| *= *[^\\s\"'=<>`]+)?/).getRegex(),ln=e=>U(en).replace(`hr`,Jt).replace(`heading`,` {0,3}#{1,6}(?:\\\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`,\" {0,3}(?:`{3,}(?=[^`\\\\n]*(?:\\\\n|$))|~~~)[^\\\\n]*(?:\\\\n|$)\").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`).replace(`tag`,on).getRegex(),un=ln(/ {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]/),dn=ln(/ {0,3}(?:[*+-]|\\d{1,9}[.)])(?:[ \\t]|\\n|$)/),fn={blockquote:U(/^( {0,3}> ?(?:(?![ \\t]*(?:\\n|$))(paragraph)|[^\\n]*)(?:\\n|$))+/).replace(`paragraph`,dn).getRegex(),code:Kt,def:rn,fences:qt,heading:Yt,hr:Jt,html:cn,lheading:Qt,list:an,newline:Gt,paragraph:un,table:Ht,text:tn},pn=U(`^ *([^\\\\n ].*)\\\\n {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)`).replace(`hr`,Jt).replace(`heading`,` {0,3}#{1,6}(?:\\\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\\\n]`).replace(`fences`,\" {0,3}(?:`{3,}(?=[^`\\\\n]*(?:\\\\n|$))|~~~)[^\\\\n]*(?:\\\\n|$)\").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\\\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`).replace(`tag`,on).getRegex(),mn={...fn,lheading:$t,table:pn,paragraph:U(en).replace(`hr`,Jt).replace(`heading`,` {0,3}#{1,6}(?:\\\\s|$)`).replace(`|lheading`,``).replace(`table`,pn).replace(`blockquote`,` {0,3}>`).replace(`fences`,\" {0,3}(?:`{3,}(?=[^`\\\\n]*(?:\\\\n|$))|~~~)[^\\\\n]*(?:\\\\n|$)\").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\\\s>]|$)|!--)|<\\\\?|<![A-Za-z]|<!\\\\[CDATA\\\\[)`).replace(`tag`,on).getRegex()},hn={...fn,html:U(`^ *(?:comment *(?:\\\\n|\\\\s*$)|<(tag)[\\\\s\\\\S]+?</\\\\1> *(?:\\\\n{2,}|\\\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\\\s[^'\"/>\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))`).replace(`comment`,sn).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b`).getRegex(),def:/^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +([\"(][^\\n]+[\")]))? *(?:\\n+|$)/,heading:/^(#{1,6})(.*)(?:\\n+|$)/,fences:Ht,lheading:/^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,paragraph:U(en).replace(`hr`,Jt).replace(`heading`,` *#{1,6} *[^\n]`).replace(`lheading`,Qt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},gn=/^\\\\([!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/,_n=/^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/,vn=/^( {2,}|\\\\)\\n(?!\\s*$)[ \\t]*/,yn=/^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/,G=/[\\p{P}\\p{S}]/u,bn=/[\\s\\p{P}\\p{S}]/u,xn=/[^\\s\\p{P}\\p{S}]/u,Sn=U(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,bn).getRegex(),Cn=/[\\p{Pi}\\p{Ps}\"']/u,wn=/(?!~)[\\p{P}\\p{S}]/u,Tn=/(?!~)[\\s\\p{P}\\p{S}]/u,En=/(?:[^\\s\\p{P}\\p{S}]|~)/u,Dn=U(/link|precode-code|html/,`g`).replace(`link`,/\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace(`precode-`,Wt?\"(?<!`)()\":\"(^^|[^`])\").replace(`code`,/(?<b>`+)[^`]+\\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),On=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/,kn=U(On,`u`).replace(/punct/g,G).getRegex(),An=U(On,`u`).replace(/punct/g,wn).getRegex(),jn=U(/^(?:\\*+(?:((?!\\*)(?!openQuote)punct)|([^\\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\\s_]))?/,`u`).replace(/openQuote/g,Cn).replace(/punct/g,G).getRegex(),Mn=`^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)`,Nn=U(Mn,`gu`).replace(/notPunctSpace/g,xn).replace(/punctSpace/g,bn).replace(/punct/g,G).getRegex(),Pn=U(Mn,`gu`).replace(/notPunctSpace/g,En).replace(/punctSpace/g,Tn).replace(/punct/g,wn).getRegex(),Fn=U(`^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)[\\\\s](\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|(?:(?!\\\\*)punct|notPunctSpace)(\\\\*+)(?!\\\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,xn).replace(/punctSpace/g,bn).replace(/punct/g,G).getRegex(),In=U(`^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,xn).replace(/punctSpace/g,bn).replace(/punct/g,G).getRegex(),Ln=U(`^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\\\s](_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,xn).replace(/punctSpace/g,bn).replace(/punct/g,G).getRegex(),Rn=U(/^~~?(?:((?!~)punct)|[^\\s~])/,`u`).replace(/punct/g,G).getRegex(),zn=U(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,xn).replace(/punctSpace/g,bn).replace(/punct/g,G).getRegex(),Bn=U(/\\\\(punct)/,`gu`).replace(/punct/g,G).getRegex(),Vn=U(/(`+)(?:[^`]|[^`][\\s\\S]*?[^`])\\1(?!`)|`+|\\\\(punct)/,`gu`).replace(/punct/g,G).getRegex(),Hn=U(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Un=U(sn).replace(`(?:-->|$)`,`-->`).getRegex(),Wn=U(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\\\s*/?>|^<\\\\?[\\\\s\\\\S]*?\\\\?>|^<![a-zA-Z]+\\\\s[\\\\s\\\\S]*?>|^<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>`).replace(`comment`,Un).replace(`attribute`,/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*\"[^\"]*\"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s\"'=<>`]+)?/).getRegex(),Gn=/\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]/,Kn=U(/(?:\\[(?:brackets|\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\\])|[^\\[\\]\\\\`])*?/).replace(`brackets`,Gn).getRegex(),qn=U(/^!?\\[(label)\\]\\([ \\t\\n]*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?[ \\t\\n]*\\)/).replace(`label`,Kn).replace(`href`,/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]+|(?=\\))/).replace(`title`,/\"(?:\\\\\"?|[^\"\\\\])*\"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex(),Jn=U(/^!?\\[(label)\\]\\[(ref)\\]/).replace(`label`,Kn).replace(`ref`,nn).getRegex(),Yn=U(/^!?\\[(ref)\\](?:\\[\\])?/).replace(`ref`,nn).getRegex(),Xn=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\]){1,999}/,Zn=U(/(?:[^\\[\\]\\\\`]*(?:\\[(?:brackets|\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\\]))){0,999}?[^\\[\\]\\\\`]*?/).replace(`brackets`,Gn).getRegex(),Qn=U(`reflink|nolink(?!\\\\()`,`g`).replace(`reflink`,U(/^!?\\[(label)\\]\\[(ref)\\]/).replace(`label`,Zn).replace(`ref`,Xn).getRegex()).replace(`nolink`,U(/^!?\\[(ref)\\](?:\\[\\])?/).replace(`ref`,Xn).getRegex()).getRegex(),$n=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,er=U(/(?:mailto:email|xmpp:email(?:\\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\\w-])/).getRegex(),tr={_backpedal:Ht,anyPunctuation:Bn,anyPunctuationOutsideCode:Vn,autolink:Hn,blockSkip:Dn,br:vn,code:_n,del:Ht,delLDelim:Ht,delRDelim:Ht,emStrongLDelim:kn,emStrongRDelimAst:Nn,emStrongRDelimUnd:In,escape:gn,link:qn,nolink:Yn,punctuation:Sn,reflink:Jn,reflinkSearch:Qn,tag:Wn,text:yn,url:Ht},nr={...tr,emStrongLDelim:jn,emStrongRDelimAst:Fn,emStrongRDelimUnd:Ln,link:U(/^!?\\[(label)\\]\\((.*?)\\)/).replace(`label`,Kn).getRegex(),reflink:U(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace(`label`,Kn).getRegex()},rr={...tr,emStrongRDelimAst:Pn,emStrongLDelim:An,delLDelim:Rn,delRDelim:zn,url:U(/^emailProtocol|^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace(`emailProtocol`,er).replace(`protocol`,$n).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'\"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'\"~)]+(?!$))+/,del:/^(~~?)(?=[^\\s~])((?:\\\\[\\s\\S]|[^\\\\])*?(?:\\\\[\\s\\S]|[^\\s~\\\\]))\\1(?=[^~]|$)/,text:U(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*~_]|\\b_|protocol:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-](?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@))))/).replace(`protocol`,$n).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},ir={...rr,br:U(vn).replace(`{2,}`,`*`).getRegex(),text:U(rr.text).replace(`\\\\b_`,`\\\\b_| {2,}\\\\n`).replace(/\\{2,\\}/g,`*`).getRegex()},ar={normal:fn,gfm:mn,pedantic:hn},or={normal:tr,gfm:rr,breaks:ir,pedantic:nr},sr={\"&\":`&amp;`,\"<\":`&lt;`,\">\":`&gt;`,'\"':`&quot;`,\"'\":`&#39;`},cr=e=>sr[e];function K(e,t){if(t){if(W.escapeTest.test(e))return e.replace(W.escapeReplace,cr)}else if(W.escapeTestNoEncode.test(e))return e.replace(W.escapeReplaceNoEncode,cr);return e}function lr(e){return W.numericCharacterReference.test(e)?e.replace(W.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function ur(e){try{e=encodeURI(e).replace(W.percentDecode,`%`)}catch{return null}return e}function dr(e,t){let n=e.replace(W.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\\\`;)r=!r;return r?`|`:` |`}).split(W.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(W.slashPipe,`|`);return n}function q(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function fr(e){let t=e.split(`\n`),n=t.length-1;for(;n>=0&&W.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`\n`)}function pr(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function mr(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function hr(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function gr(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function _r(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`\n`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`\n`)}function vr(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\\\`){i++;continue}if(t[i]===\"`\"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var yr=class{options;rules;lexer;constructor(e){this.options=e||Bt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:fr(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=_r(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=q(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:q(t[0],`\n`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:q(t[0],`\n`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=q(t[0],`\n`).split(`\n`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`\n`),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+hr(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`\n $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}\n${s}`:s,r=r?`${r}\n${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`\n`),o=t.raw+`\n`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\\n/,``),l=c?c.split(`\n`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}\n${d.join(`\n`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`\n`+e.join(`\n`),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`\n`).length:0;if(s>0){let t=e.slice(0,s).join(`\n`);n=`${n}\n${t}`,r=`${r}\n${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\\\d{1,9}\\\\${i.slice(-1)}`:`\\\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`\n`,1)[0],d=t[1].length,f=this.options.pedantic?hr(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>hr(e,d)),p=e.split(`\n`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`\n`,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>hr(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`\n`+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}\n${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`\n`+e}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=fr(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&mr(t[2],`()`)!==-1)return;let e=pr(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:q(t[0],`\n`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=dr(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`\n`):[],a={type:`table`,raw:q(t[0],`\n`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(dr(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:q(t[0],`\n`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`\n`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&vr(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=q(r.slice(0,-1),`\\\\`);if((r.length-e.length)%2==0)return}else{let e=mr(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),gr(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&vr(e,n[1],r,this.rules))return;let i=t[pr((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return gr(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l),_=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,t=t.slice(-1*e.length+n);(r=_.exec(t))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:lr(t[0]),escaped:e}}}},J=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Bt,this.options.tokenizer=this.options.tokenizer||new yr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:W,block:ar.normal,inline:or.normal};this.options.pedantic?(t.block=ar.pedantic,t.inline=or.pedantic):this.options.gfm&&(t.block=ar.gfm,t.inline=this.options.breaks?or.breaks:or.gfm),this.tokenizer.rules=t}static get rules(){return{block:ar,inline:or}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(W.carriageReturn,`\n`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(W.tabCharGlobal,` `).replace(W.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`\n`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`\n`)?``:`\n`)+i.raw,n.text+=`\n`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`\n`)?``:`\n`)+i.raw,n.text+=`\n`+i.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`\n`)?``:`\n`)+i.raw,r.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`\n`)?``:`\n`)+i.raw,n.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,pr(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==yr.prototype.emStrong||this.tokenizer.del!==yr.prototype.del?this.#t(e):e,r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}#t(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,pr(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=t.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},br=class{options;parser;constructor(e){this.options=e||Bt}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(W.notSpaceStart)?.[0],i=e?e.replace(W.endingNewline,``)+`\n`:``;return r?`<pre><code class=\"language-`+K(r)+`\">`+(n?i:K(i,!0))+`</code></pre>\n`:`<pre><code>`+(n?i:K(i,!0))+`</code></pre>\n`}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return`<hr>\n`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start=\"`+n+`\"`:``;return`<`+i+a+`>\n`+r+`</`+i+`>\n`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return`<input `+(e?`checked=\"\" `:``)+`disabled=\"\" type=\"checkbox\"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>\n<thead>\n`+t+`</thead>\n`+r+`</table>\n`}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align=\"${e.align}\">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?K(n,!0):this.parser.parseInline(r),o=ur(e);if(o===null)return a;e=K(o,i);let s=`<a href=\"`+e+`\"`;return t&&(s+=` title=\"`+K(t)+`\"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=ur(e);if(i===null)return K(n);e=i;let a=`<img src=\"${K(e)}\" alt=\"${K(n)}\"`;return t&&(a+=` title=\"${K(t)}\"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:K(e.text)}},xr=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||Bt,this.options.renderer=this.options.renderer||new br,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new xr,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with \"`+i.type+`\" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with \"`+a.type+`\" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Sr=class{options;block;constructor(e){this.options=e||Bt}static passThroughHooks=/* @__PURE__ */ new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=/* @__PURE__ */ new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?J.lex:J.lexInline}provideParser(e=this.block){return e?Y.parse:Y.parseInline}};function Cr(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var wr=new class{defaults=zt();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=br;TextRenderer=xr;Lexer=J;Tokenizer=yr;Hooks=Sr;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Cr(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Cr(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Cr(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Cr(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);Cr(n,this.walkTokens(i,t))}):e.tokens&&Cr(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new br(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new yr(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Sr;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Sr.passThroughHooks.has(n)?e=>{if(t.options.async&&Sr.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&Cr(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return J.lex(e,t??this.defaults)}parser(e,t){return Y.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(/* @__PURE__ */ Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(/* @__PURE__ */ Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(/* @__PURE__ */ Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?J.lex:J.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?J.lex:J.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`\nPlease report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+K(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function X(e,t){return wr.parse(e,t)}X.options=X.setOptions=function(e){return wr.setOptions(e),X.defaults=wr.defaults,Vt(X.defaults),X},X.getDefaults=zt,X.defaults=Bt;function Tr(...e){return wr.use(...e),X.defaults=wr.defaults,Vt(X.defaults),X}X.use=Tr,X.walkTokens=function(e,t){return wr.walkTokens(e,t)},X.parseInline=wr.parseInline,X.Parser=Y,X.parser=Y.parse,X.Renderer=br,X.TextRenderer=xr,X.Lexer=J,X.lexer=J.lex,X.Tokenizer=yr,X.Hooks=Sr,X.parse=X,X.options,X.setOptions,X.walkTokens,X.parseInline,Y.parse,J.lex;var Er=/* @__PURE__ */ new Set([`http:`,`https:`,`mailto:`]),Dr=16;function Or(e){try{let t=new URL(e);return Er.has(t.protocol)?t.href:``}catch{return``}}var kr={amp:`&`,lt:`<`,gt:`>`,quot:`\"`,apos:`'`,nbsp:`\\xA0`,copy:`©`,reg:`®`,trade:`™`,hellip:`…`,mdash:`—`,ndash:`–`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,laquo:`«`,raquo:`»`,bull:`•`,middot:`·`,deg:`°`,plusmn:`±`,times:`×`,divide:`÷`,euro:`€`,pound:`£`,yen:`¥`,cent:`¢`,sect:`§`,para:`¶`};function Ar(e){return e.includes(`&`)?e.replace(/&(#\\d{1,7}|#[xX][\\da-fA-F]{1,6}|[a-zA-Z]{2,8});/g,(e,t)=>{if(t[0]!==`#`)return kr[t]??e;let n=t[1]===`x`||t[1]===`X`?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return n>0&&n<=1114111&&(n<55296||n>57343)?String.fromCodePoint(n):`�`}):e}function Z(e,t){return t>Dr?[(e??[]).map(e=>e.raw).join(``)]:(e??[]).map((e,n)=>{switch(e.type){case`text`:return`tokens`in e&&e.tokens?Z(e.tokens,t+1):Ar(e.text);case`escape`:return e.text;case`strong`:return/* @__PURE__ */ V(`strong`,{children:Z(e.tokens,t+1)},n);case`em`:return/* @__PURE__ */ V(`em`,{children:Z(e.tokens,t+1)},n);case`del`:return/* @__PURE__ */ V(`del`,{children:Z(e.tokens,t+1)},n);case`codespan`:return/* @__PURE__ */ V(`code`,{children:e.text},n);case`br`:return/* @__PURE__ */ V(`br`,{},n);case`link`:{let r=Or(Ar(e.href));return r?/* @__PURE__ */ V(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer nofollow`,children:Z(e.tokens,t+1)},n):/* @__PURE__ */ V(`span`,{children:Z(e.tokens,t+1)},n)}case`image`:return e.text?/* @__PURE__ */ V(`span`,{\"data-ask-part\":`image-alt`,children:[`[`,Ar(e.text),`]`]},n):null;default:return null}})}function jr(e,t,n){return e.map((e,r)=>/* @__PURE__ */ V(t?`th`:`td`,{style:e.align?{textAlign:e.align}:void 0,children:Z(e.tokens,n+1)},r))}function Mr(e,t){return t>Dr?[e.map(e=>e.raw).join(``)]:e.map((e,n)=>{switch(e.type){case`paragraph`:return/* @__PURE__ */ V(`p`,{children:Z(e.tokens,t+1)},n);case`text`:return e.tokens?Z(e.tokens,t+1):Ar(e.text);case`heading`:return/* @__PURE__ */ V(`h${Math.min(Math.max(e.depth,1),6)}`,{children:Z(e.tokens,t+1)},n);case`code`:return/* @__PURE__ */ V(`pre`,{children:/* @__PURE__ */ V(`code`,{children:e.text})},n);case`blockquote`:return/* @__PURE__ */ V(`blockquote`,{children:Mr(e.tokens??[],t+1)},n);case`hr`:return/* @__PURE__ */ V(`hr`,{},n);case`list`:{let r=e.items.map((e,n)=>/* @__PURE__ */ V(`li`,{children:[e.task&&/* @__PURE__ */ V(`input`,{type:`checkbox`,checked:e.checked??!1,disabled:!0}),Mr(e.tokens.filter(e=>e.type!==`checkbox`),t+1)]},n));return e.ordered?/* @__PURE__ */ V(`ol`,{start:typeof e.start==`number`?e.start:void 0,children:r},n):/* @__PURE__ */ V(`ul`,{children:r},n)}case`table`:return/* @__PURE__ */ V(`table`,{children:[/* @__PURE__ */ V(`thead`,{children:/* @__PURE__ */ V(`tr`,{children:jr(e.header,!0,t)})}),/* @__PURE__ */ V(`tbody`,{children:e.rows.map((e,n)=>/* @__PURE__ */ V(`tr`,{children:jr(e,!1,t)},n))})]},n);default:return null}})}var Nr=e=>e.split(/\\n{2,}/).map((e,t)=>/* @__PURE__ */ V(`p`,{children:e},t));function Pr(e){try{return Mr(J.lex(e,{gfm:!0}),0)}catch{return Nr(e)}}var Fr=class extends S{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?Nr(this.props.text):this.props.children}},Ir=Re(function({text:e}){return/* @__PURE__ */ V(Fr,{text:e,children:Pr(e)})}),Lr=2048,Rr=.85,zr=/\\.(png|jpe?g|webp|gif|heic|heif|avif|bmp)$/i,Br=class extends Error{},Vr=e=>e.type===`application/pdf`||/\\.pdf$/i.test(e.name),Hr=e=>e.type.startsWith(`image/`)&&e.type!==`image/svg+xml`||zr.test(e.name),Ur=e=>e.replace(/\\.[^.]*$/,``)||`image`;function Wr(e){return[...e.images?[`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/heic`]:[],...e.pdf?[`application/pdf`]:[]].join(`,`)}async function Gr(e,t,n){let r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)throw new Br;return i.fillStyle=`#fff`,i.fillRect(0,0,t,n),i.drawImage(e,0,0,t,n),new Promise((e,t)=>r.toBlob(n=>n?e(n):t(new Br),`image/jpeg`,Rr))}async function Kr(e,t){if(t.pdf&&Vr(e))return{blob:e,name:e.name,kind:`pdf`};if(!t.images||!Hr(e))throw new Br;let n;try{n=await createImageBitmap(e,{imageOrientation:`from-image`})}catch{throw new Br}try{let t=Math.min(1,Lr/Math.max(n.width,n.height)),r=Math.max(1,Math.round(n.width*t)),i=Math.max(1,Math.round(n.height*t));return{blob:await Gr(n,r,i),name:`${Ur(e.name)}.jpg`,kind:`image`}}finally{n.close()}}var qr=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4;codecs=mp4a.40.2`,`audio/mp4`],Jr=32e3;function Yr(){if(typeof MediaRecorder<`u`)return qr.find(e=>MediaRecorder.isTypeSupported(e))}function Xr(){return!navigator.mediaDevices?.getUserMedia||!Yr()?!1:document.featurePolicy?.allowsFeature(`microphone`)??!0}var Zr=class extends Error{reason;constructor(e,t){super(`Microphone ${e}`,t),this.reason=e}};async function Qr(e){let t=Yr();if(!t)throw new Zr(`failed`);let n;try{n=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch(e){let t=e instanceof DOMException?e.name:``;throw t===`NotAllowedError`||t===`SecurityError`?new Zr(`blocked`,{cause:e}):t===`NotFoundError`||t===`OverconstrainedError`?new Zr(`missing`,{cause:e}):new Zr(`failed`,{cause:e})}try{return $r(n,t,e)}catch(e){for(let e of n.getTracks())e.stop();throw new Zr(`failed`,{cause:e})}}function $r(e,t,n){let r=new MediaRecorder(e,{mimeType:t,audioBitsPerSecond:Jr}),i=[];r.addEventListener(`dataavailable`,e=>{e.data.size>0&&i.push(e.data)});let a=new Promise(e=>r.addEventListener(`stop`,()=>e(),{once:!0})),o=new AudioContext,s=o.createAnalyser();s.fftSize=512,o.createMediaStreamSource(e).connect(s);let c=new Uint8Array(s.fftSize),l=()=>{for(let t of e.getTracks())t.stop();o.close()},u,d=()=>{clearTimeout(u),r.state!==`inactive`&&r.stop()};return r.start(250),u=setTimeout(d,n*1e3),{level(){s.getByteTimeDomainData(c);let e=0;for(let t of c){let n=(t-128)/128;e+=n*n}return Math.min(1,Math.sqrt(e/c.length)*4)},async stop(){return d(),await a,l(),new Blob(i,{type:t.split(`;`)[0]??t})},cancel(){d(),l()}}}var ei=e=>e.split(/\\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``)||`AI`;function ti(e){return e.split(`**`).map((e,t)=>t%2==1?/* @__PURE__ */ V(`strong`,{children:e},t):e)}function ni({widget:e,size:t}){let n=e.avatar?`image`:e.variants.avatar;return n===`none`?null:/* @__PURE__ */ V(`span`,{\"data-ask-part\":`avatar`,\"data-kind\":n,\"data-size\":t,\"aria-hidden\":`true`,children:[n===`image`&&/* @__PURE__ */ V(`img`,{src:e.avatar,alt:``}),n===`orb`&&/* @__PURE__ */ V(`span`,{\"data-ask-part\":`orb`}),n===`icon`&&/* @__PURE__ */ V(Lt,{size:t===`large`?28:16}),n===`initials`&&ei(e.title)]})}function ri({widget:e,disabled:t,onPick:n}){if(e.starters.length===0)return null;let r=e.variants.welcome===`intro`;return/* @__PURE__ */ V(`ul`,{\"data-ask-part\":`starters`,\"aria-label\":e.texts[`welcome.suggestions`],children:e.starters.map(i=>/* @__PURE__ */ V(`li`,{children:/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`starter`,disabled:t,onClick:()=>n(i),children:[V(r?It:Lt,{}),/* @__PURE__ */ V(`span`,{children:i}),e.variants.welcome===`persona`&&/* @__PURE__ */ V(Rt,{})]})},i))})}function ii({widget:e,disabled:t,onPick:n}){let r=e.variants.welcome,i=/* @__PURE__ */ V(ri,{widget:e,disabled:t,onPick:n});return r===`intro`?/* @__PURE__ */ V(`section`,{\"data-ask-part\":`welcome`,\"data-layout\":`intro`,\"aria-label\":e.texts[`welcome.label`],children:/* @__PURE__ */ V(`div`,{\"data-ask-part\":`intro`,children:[/* @__PURE__ */ V(ni,{widget:e,size:`small`}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`intro-card`,children:[/* @__PURE__ */ V(`p`,{\"data-ask-part\":`greeting`,children:ti(e.greeting)}),i]})]})}):r===`persona`?/* @__PURE__ */ V(`section`,{\"data-ask-part\":`welcome`,\"data-layout\":`persona`,\"aria-label\":e.texts[`welcome.label`],children:[/* @__PURE__ */ V(`div`,{\"data-ask-part\":`persona`,children:[/* @__PURE__ */ V(ni,{widget:e,size:`large`}),/* @__PURE__ */ V(`div`,{children:[/* @__PURE__ */ V(`h2`,{\"data-ask-part\":`persona-name`,children:e.title}),/* @__PURE__ */ V(`span`,{\"data-ask-part\":`presence`,children:e.texts[`welcome.online`]})]})]}),/* @__PURE__ */ V(`p`,{\"data-ask-part\":`greeting`,children:ti(e.greeting)}),i]}):/* @__PURE__ */ V(`section`,{\"data-ask-part\":`welcome`,\"data-layout\":`hero`,\"aria-label\":e.texts[`welcome.label`],children:[/* @__PURE__ */ V(ni,{widget:e,size:`large`}),/* @__PURE__ */ V(`h2`,{\"data-ask-part\":`greeting`,children:ti(e.greeting)}),i]})}var ai=e=>`${Math.floor(e/1e5)/10} MB`,oi=e=>e.role===`user`||e.status===`streaming`||e.text!==``||e.citations.length>0;function si(e){e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`}var ci=e=>`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`,li={blocked:`microphone.blocked`,missing:`microphone.missing`,failed:`microphone.failed`};function ui(e){for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl)}function di({files:e,part:t,t:n,onRemove:r}){return/* @__PURE__ */ V(`ul`,{\"data-ask-part\":t,\"aria-label\":n(`attachment.list`),children:e.map((e,t)=>{let i=`status`in e?e:void 0;return/* @__PURE__ */ V(`li`,{\"data-ask-part\":`attachment`,\"data-kind\":e.kind,\"data-status\":i?.status,children:[e.previewUrl?/* @__PURE__ */ V(`img`,{\"data-ask-part\":`attachment-preview`,src:e.previewUrl,alt:``}):/* @__PURE__ */ V(`span`,{\"data-ask-part\":`attachment-badge`,\"aria-hidden\":`true`,children:e.kind===`image`?`IMG`:e.kind===`pdf`?`PDF`:`FILE`}),/* @__PURE__ */ V(`span`,{\"data-ask-part\":`attachment-name`,children:e.name}),i?.status===`uploading`&&/* @__PURE__ */ V(`span`,{\"data-ask-part\":`attachment-status`,children:n(`attachment.uploading`)}),i?.status===`error`&&/* @__PURE__ */ V(`span`,{\"data-ask-part\":`attachment-status`,role:`alert`,children:i.error}),i&&r&&/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`attachment-remove`,\"aria-label\":n(`attachment.remove`,{name:e.name}),onClick:()=>r(i),children:`×`})]},i?.key??t)})})}var fi=0,pi=()=>`local_${++fi}`,mi=e=>({...e,status:`done`});function hi(e,t){let n=(t,n)=>e.map(e=>e.id===t?n(e):e);switch(t.type){case`message.start`:return[...e,{id:t.messageId,role:`assistant`,text:``,citations:[],attachments:0,status:`streaming`}];case`text.delta`:return n(t.messageId,e=>({...e,text:e.text+t.delta}));case`citation`:return n(t.messageId,e=>({...e,citations:[...e.citations,{index:t.index,title:t.title,url:t.url}]}));case`message.end`:return n(t.messageId,e=>({...e,status:`done`}));default:return e}}function gi(e,t){if(e.type===`reasoning`)return e.state===`started`?t(`status.thinking`):null;if(e.type===`tool.status`)return e.state===`running`?e.name===`file_search`?t(`status.searching`):t(`status.tool`,{name:e.name}):null;if(e.type===`text.delta`||e.type===`message.end`)return null}function _i({config:e,client:t,bridge:n,fixture:r,inline:i=!1}){let[a,o]=R({});Ce(()=>n.onConfigure(o),[n]);let s={...e.widget,...a.greeting?{greeting:a.greeting}:{},...a.starters?{starters:a.starters}:{}},c=Ee((e,t)=>ct(s.texts[e]??e,t),[s.texts]),[l,u]=R(r?.messages??[]),[d,f]=R(r?.draft??``),[p,m]=R(r?.busy??!1),[h,g]=R(()=>!r&&t.hasConversation()),[_,v]=R(r?.error),[ee,y]=R(r?.activity??null),[b,S]=R(r?.pending??[]),[C,te]=R(!1),w=z(null),T=z(null),[E,ne]=R(!1),D=z(!1);D.current=E;let O=z(null),k=z(null),re=De(),ie=z(null),A=e.voice,[ae]=R(()=>A!==void 0&&(!!r||Xr())),[j,M]=R(r?.dictation??`idle`),[oe,se]=R(r?.elapsed??0),N=z(void 0),ce=z(!1),le=z(void 0),ue=z(null),de=z(null),P=z(/* @__PURE__ */ new Map),F=e.attachments;we(()=>{T.current&&j===`idle`&&si(T.current)},[d,j]);let I=Ee(()=>{clearTimeout(le.current),N.current?.cancel(),N.current=void 0,M(`idle`)},[]);Ce(()=>{let e=e=>{e.key===`Escape`&&(D.current?(ne(!1),requestAnimationFrame(()=>O.current?.focus())):N.current?(I(),requestAnimationFrame(()=>T.current?.focus())):n.close())},t=()=>I(),r=()=>{document.visibilityState===`hidden`&&I()};window.addEventListener(`keydown`,e),document.addEventListener(`visibilitychange`,r);let a=n.onHidden(t);return i||T.current?.focus(),()=>{window.removeEventListener(`keydown`,e),document.removeEventListener(`visibilitychange`,r),a(),I()}},[n,I,i]);let[fe,pe]=R(r!==void 0),[me,L]=R(0);Ce(()=>{if(r)return;let e=!0,i=()=>{},a=Promise.resolve(),o=n=>{a=a.then(async()=>{await t.identify(n)&&e&&(u([]),v(void 0),L(e=>e+1))})};return n.handshake.then(()=>(e&&(i=n.onIdentify(o)),a)).finally(()=>{e&&pe(!0)}),()=>{e=!1,i()}},[n,t,r]),Ce(()=>{if(r||!fe)return;if(!t.hasConversation()){g(!1);return}g(!0);let e=new AbortController;return t.loadHistory(e.signal).then(e=>u(e.map(mi))).catch(t=>{e.signal.aborted||v(t instanceof Ot?t.message:c(`error.history`))}).finally(()=>g(!1)),()=>e.abort()},[t,r,fe,me,c]);let he=l.at(-1)?.text;Ce(()=>{let e=w.current;e&&he!==void 0&&(e.scrollTop=e.scrollHeight)},[he]);let ge=b.some(e=>e.status===`uploading`),_e=b.filter(e=>e.status===`ready`),ve=fe&&!p&&!h&&!ge&&(d.trim()!==``||_e.length>0),ye=async e=>{if(!F)return;let n=pi(),r=e=>S(t=>t.map(t=>t.key===n?{...t,...e}:t)),i=new AbortController;P.current.set(n,i),S(t=>[...t,{key:n,name:e.name,status:`uploading`}]);let a=e=>{P.current.delete(n),i.signal.aborted||r({status:`error`,error:e})},o;try{o=await Kr(e,F)}catch{a(c(`attachment.unsupported`));return}if(o.blob.size>F.maxBytes){a(c(`attachment.tooLarge`,{size:ai(F.maxBytes)}));return}if(i.signal.aborted)return;let s=o.kind===`image`?URL.createObjectURL(o.blob):void 0;r({name:o.name,kind:o.kind,previewUrl:s});let l=await t.upload(o.blob,o.name,i.signal);P.current.delete(n),i.signal.aborted?ui([{previewUrl:s}]):r(l.ok?{status:`ready`,handle:l.file.id,name:l.file.name}:{status:`error`,error:l.message})},be=e=>{if(!F||e.length===0)return;let t=F.maxPerMessage-b.length;e.length>t&&v(c(`attachment.tooMany`,{count:F.maxPerMessage}));for(let n of e.slice(0,Math.max(0,t)))ye(n)},xe=e=>{for(let t of[...e])P.current.get(t)?.abort(),P.current.delete(t)},Se=e=>{xe([e.key]),ui([e]),S(t=>t.filter(t=>t.key!==e.key))},Te=async n=>{let r=(n??d).trim();if(n===void 0?!ve:!fe||p||h||ge||r===``)return;let i=_e.flatMap(({name:e,kind:t,previewUrl:n})=>t?[{name:e,kind:t,previewUrl:n}]:[]),o=_e.flatMap(e=>e.handle?[e.handle]:[]);ui(b.filter(e=>e.status!==`ready`)),S([]),n===void 0&&f(``),v(void 0),m(!0),u(e=>[...e,{id:pi(),role:`user`,text:r,citations:[],attachments:i.length,files:i,status:`done`}]);let s=e.pageContext?a.context:void 0;await t.send({text:r,attachments:o,context:s},e=>{let t=gi(e,c);t!==void 0&&y(t),e.type===`error`?(v(e.message),u(e=>e.map(e=>e.status===`streaming`?{...e,status:`error`}:e))):u(t=>hi(t,e))}),y(null),m(!1),T.current?.focus()},Oe=async()=>{let n=N.current;if(!n)return;N.current=void 0,clearTimeout(le.current),M(`transcribing`);let r=await n.stop();if(r.size<1e3){M(`idle`),v(c(`dictation.empty`));return}let i=[...navigator.languages.slice(0,2),e.widget.locale],a=await t.transcribe(r,i);M(`idle`),a.ok?a.text&&f(e=>e.trim()?`${e.trimEnd()} ${a.text}`:a.text):v(a.message),requestAnimationFrame(()=>T.current?.focus())},ke=async()=>{if(!A||N.current||ce.current)return;v(void 0),ce.current=!0;let e;try{e=await Qr(A.maxSeconds)}catch(e){v(c(li[e instanceof Zr?e.reason:`failed`]));return}finally{ce.current=!1}N.current=e,se(0),M(`recording`),requestAnimationFrame(()=>de.current?.focus()),le.current=setTimeout(()=>void Oe(),A.maxSeconds*1e3);let t=performance.now(),n=()=>{N.current===e&&(ue.current?.style.setProperty(`--ask-level`,e.level().toFixed(3)),se(Math.min(A.maxSeconds,Math.floor((performance.now()-t)/1e3))),requestAnimationFrame(n))};requestAnimationFrame(n)},Ae=()=>{I(),requestAnimationFrame(()=>T.current?.focus())},je=()=>{ne(!0),requestAnimationFrame(()=>k.current?.querySelector(`button`)?.focus())},Me=()=>{ne(!1),requestAnimationFrame(()=>O.current?.focus())},Ne=e=>{if(e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`button`)),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},Pe=async()=>{ne(!1),m(!0),await t.deleteConversation().catch(()=>void 0),ui(l.flatMap(e=>e.files??[])),xe(P.current.keys()),ui(b),S([]),u([]),v(void 0),m(!1),T.current?.focus()},Fe=e=>{e.preventDefault(),Te()},Ie=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),Te())},Le=e=>{let t=Array.from(e.clipboardData.files);F&&t.length!==0&&(e.preventDefault(),be(t))},Re=z(be);Ce(()=>{Re.current=be}),Ce(()=>{if(!F)return;let e=e=>e.dataTransfer?.types.includes(`Files`)??!1,t=t=>{e(t)&&(t.preventDefault(),te(!0))},n=e=>{e.relatedTarget===null&&te(!1)},r=t=>{e(t)&&(t.preventDefault(),te(!1),Re.current(Array.from(t.dataTransfer?.files??[])))};return document.addEventListener(`dragover`,t),document.addEventListener(`dragleave`,n),document.addEventListener(`drop`,r),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`dragleave`,n),document.removeEventListener(`drop`,r)}},[F]);let ze=l.length===0&&!h;return/* @__PURE__ */ V(`main`,{\"data-ask-part\":`panel`,\"data-dragging\":C||void 0,\"data-busy\":p||j!==`idle`||void 0,children:[/* @__PURE__ */ V(`header`,{\"data-ask-part\":`header`,children:[/* @__PURE__ */ V(`div`,{\"data-ask-part\":`identity`,children:[/* @__PURE__ */ V(ni,{widget:s,size:`small`}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`identity-text`,children:[/* @__PURE__ */ V(`h1`,{\"data-ask-part\":`title`,children:s.title}),s.subtitle&&/* @__PURE__ */ V(`p`,{\"data-ask-part\":`subtitle`,children:s.subtitle})]})]}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`actions`,children:[l.length>0&&/* @__PURE__ */ V(`button`,{ref:O,type:`button`,\"data-ask-part\":`new-conversation`,\"aria-label\":c(`header.newConversation`),\"aria-haspopup\":`dialog`,title:c(`header.newConversation`),disabled:p,onClick:je,children:/* @__PURE__ */ V(Ft,{})}),n.embedded&&!i&&/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`close`,\"aria-label\":c(`header.close`),title:c(`header.close`),onClick:()=>{I(),n.close()},children:/* @__PURE__ */ V(Pt,{})})]})]}),E&&/* @__PURE__ */ V(`div`,{\"data-ask-part\":`confirm-backdrop`,children:/* @__PURE__ */ V(`div`,{ref:k,\"data-ask-part\":`confirm`,role:`alertdialog`,\"aria-modal\":`true`,\"aria-describedby\":re,\"aria-label\":c(`header.newConversation`),onKeyDown:Ne,children:[/* @__PURE__ */ V(`span`,{\"data-ask-part\":`confirm-icon`,\"aria-hidden\":`true`,children:/* @__PURE__ */ V(Ft,{})}),/* @__PURE__ */ V(`p`,{id:re,\"data-ask-part\":`confirm-text`,children:c(`confirm.newConversation`)}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`confirm-actions`,children:[/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`confirm-cancel`,onClick:Me,children:c(`confirm.cancel`)}),/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`confirm-accept`,onClick:()=>void Pe(),children:c(`confirm.accept`)})]})]})}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`messages`,ref:w,role:`log`,\"aria-live\":`polite`,\"aria-relevant\":`additions`,\"aria-busy\":h,children:[ze&&/* @__PURE__ */ V(ii,{widget:s,disabled:p||!fe,onPick:e=>void Te(e)}),h&&/* @__PURE__ */ V(`p`,{\"data-ask-part\":`status`,role:`status`,children:c(`status.loading`)}),l.filter(oi).map(e=>/* @__PURE__ */ V(`div`,{\"data-ask-part\":`message`,\"data-role\":e.role,\"data-status\":e.status,children:[e.role===`assistant`&&/* @__PURE__ */ V(ni,{widget:s,size:`small`}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`message-body`,children:[e.text===``?e.status===`streaming`&&/* @__PURE__ */ V(`div`,{\"data-ask-part\":`bubble`,children:/* @__PURE__ */ V(`span`,{\"data-ask-part\":`typing`,role:`img`,\"aria-label\":c(`status.typing`),children:[/* @__PURE__ */ V(`i`,{}),/* @__PURE__ */ V(`i`,{}),/* @__PURE__ */ V(`i`,{})]})}):/* @__PURE__ */ V(`div`,{\"data-ask-part\":`bubble`,children:e.role===`assistant`?/* @__PURE__ */ V(Ir,{text:e.text}):e.text}),e.files&&e.files.length>0?/* @__PURE__ */ V(di,{files:e.files,part:`message-attachments`,t:c}):e.attachments>0&&/* @__PURE__ */ V(`p`,{\"data-ask-part\":`attachments-note`,children:lt(s.texts,`message.attachments`,e.attachments,s.locale)}),e.citations.length>0&&/* @__PURE__ */ V(`ol`,{\"data-ask-part\":`citations`,\"aria-label\":c(`message.sources`),children:e.citations.map(e=>/* @__PURE__ */ V(`li`,{\"data-ask-part\":`citation`,children:e.url?/* @__PURE__ */ V(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,children:e.title}):/* @__PURE__ */ V(`span`,{children:e.title})},e.index))})]})]},e.id)),ee&&/* @__PURE__ */ V(`p`,{\"data-ask-part\":`status`,role:`status`,children:ee})]}),_&&/* @__PURE__ */ V(`p`,{\"data-ask-part\":`error`,role:`alert`,children:_}),/* @__PURE__ */ V(`form`,{\"data-ask-part\":`composer`,onSubmit:Fe,children:[b.length>0&&/* @__PURE__ */ V(di,{files:b,part:`attachments`,t:c,onRemove:Se}),/* @__PURE__ */ V(`div`,{\"data-ask-part\":`composer-box`,children:j===`idle`?/* @__PURE__ */ V(x,{children:[F&&/* @__PURE__ */ V(x,{children:[/* @__PURE__ */ V(`input`,{ref:ie,type:`file`,hidden:!0,multiple:!0,accept:Wr(F),onChange:e=>{be(Array.from(e.target.files??[])),e.target.value=``}}),/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`attach`,\"aria-label\":c(`composer.attach`),title:c(`composer.attach`),disabled:p||b.length>=F.maxPerMessage,onClick:()=>ie.current?.click(),children:/* @__PURE__ */ V(Mt,{})})]}),/* @__PURE__ */ V(`textarea`,{ref:T,\"data-ask-part\":`input`,rows:1,value:d,placeholder:s.placeholder,\"aria-label\":s.placeholder,onChange:e=>f(e.target.value),onKeyDown:Ie,onPaste:Le}),ae&&/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`voice`,\"aria-label\":c(`composer.dictate`),title:c(`composer.dictate`),onClick:()=>void ke(),children:/* @__PURE__ */ V(Nt,{})}),/* @__PURE__ */ V(`button`,{type:`submit`,\"data-ask-part\":`send`,\"aria-label\":c(`composer.send`),title:c(`composer.send`),disabled:!ve,children:[/* @__PURE__ */ V(jt,{}),/* @__PURE__ */ V(`span`,{\"data-ask-part\":`send-label`,\"aria-hidden\":`true`,children:c(`composer.send`)})]})]}):/* @__PURE__ */ V(`div`,{\"data-ask-part\":`recorder`,\"data-state\":j,children:[/* @__PURE__ */ V(`span`,{\"data-ask-part\":`recorder-level`,ref:ue,\"aria-hidden\":`true`}),/* @__PURE__ */ V(`span`,{\"data-ask-part\":`recorder-label`,role:`status`,children:c(j===`recording`?`dictation.listening`:`dictation.transcribing`)}),j===`recording`&&/* @__PURE__ */ V(x,{children:[/* @__PURE__ */ V(`span`,{\"data-ask-part\":`recorder-time`,children:[ci(oe),` / `,ci(A?.maxSeconds??0)]}),/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`recorder-cancel`,\"aria-label\":c(`dictation.cancel`),title:c(`dictation.cancel`),onClick:Ae,children:/* @__PURE__ */ V(Pt,{})}),/* @__PURE__ */ V(`button`,{type:`button`,\"data-ask-part\":`recorder-done`,ref:de,onClick:()=>void Oe(),children:c(`dictation.done`)})]})]})})]}),s.disclosure!==!1&&/* @__PURE__ */ V(`p`,{\"data-ask-part\":`disclosure`,children:[c(`disclosure.text`),s.disclosure.privacyUrl&&/* @__PURE__ */ V(x,{children:[` `,/* @__PURE__ */ V(`a`,{href:s.disclosure.privacyUrl,target:`_blank`,rel:`noopener noreferrer`,children:c(`disclosure.privacy`)})]})]})]})}var vi=`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2040%2040%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%239cc9ff%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23fde2c4%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%2240%22%20height%3D%2240%22%20fill%3D%22url(%23s)%22%2F%3E%3Ccircle%20cx%3D%2229%22%20cy%3D%2212%22%20r%3D%225%22%20fill%3D%22%23fff6d5%22%2F%3E%3Cpath%20d%3D%22M0%2030l11-11%209%209%206-5%2014%2012v5H0z%22%20fill%3D%22%234f7d6a%22%2F%3E%3C%2Fsvg%3E`,Q=(e,t,n,r={})=>({id:e,role:t,text:n,citations:[],attachments:0,status:`done`,...r}),yi=[Q(`u1`,`user`,`What does the Business plan include?`),Q(`a1`,`assistant`,`The **Business** plan is built for larger teams:\n\n- Unlimited users and **1 TB** of storage\n- Single sign-on with SAML and an audit log\n- Priority support, first reply within 4 business hours\n\n| Billing | Price per user |\n| --- | --- |\n| Monthly | €15 |\n| Yearly | €12 |`,{citations:[{index:1,title:`Brightloop pricing and plans`,url:`https://example.com/pricing`},{index:2,title:`Brightloop security and privacy`,url:`https://example.com/security`}]}),Q(`u2`,`user`,`Can we try it first?`),Q(`a2`,`assistant`,`Yes. Every paid plan starts with a **14-day free trial**, and you don’t need a card to start it.`)],bi={welcome:{messages:[]},conversation:{messages:yi},streaming:{messages:[...yi.slice(0,2),Q(`u2`,`user`,`How do I move our projects from Trello?`),Q(`a2`,`assistant`,`Go to **Settings → Import** and choose Trello. Brightloop brings over`,{status:`streaming`})],busy:!0},attachments:{messages:[Q(`u1`,`user`,`Is this the right screen for exporting?`,{attachments:2,files:[{name:`screenshot.jpg`,kind:`image`,previewUrl:vi},{name:`export-guide.pdf`,kind:`pdf`}]}),Q(`a1`,`assistant`,``,{status:`streaming`})],pending:[{key:`p1`,name:`invoice-march.pdf`,kind:`pdf`,status:`ready`,handle:`h`},{key:`p2`,name:`team-photo.jpg`,kind:`image`,status:`uploading`,previewUrl:vi},{key:`p3`,name:`notes.svg`,status:`error`,error:`This file type is not supported.`}],busy:!0,activity:`Searching documents…`},error:{messages:[...yi.slice(0,2),Q(`u2`,`user`,`And the Enterprise plan?`),Q(`a2`,`assistant`,`Enterprise adds`,{status:`error`})],error:`The assistant took too long to respond. Please try again.`,draft:`And the Enterprise plan?`},listening:{messages:yi.slice(0,2),dictation:`recording`,elapsed:7}},xi=1e3,Si=3e3,Ci=/^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$/;function wi(e){if(e===null)return null;if(typeof e==`string`)return e.length<=4096&&Ci.test(e)?e:(console.warn(`[askdare] askdare('identify') got something that isn't a JWT; signing out.`),null)}function Ti(e){let t=typeof e.greeting==`string`?e.greeting.trim():``,n=Array.isArray(e.starters)?e.starters.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0&&e.length<=80).slice(0,4):void 0,r=typeof e.context==`string`?e.context.trim():``;return{...t&&t.length<=500?{greeting:t}:{},...n?{starters:n}:{},...r?{context:r.slice(0,xi)}:{}}}function Ei(e){let t=window.parent!==window,n,r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a,o=/* @__PURE__ */ new Set,s,c=e=>{if(e!==void 0){s=e;for(let t of o)t(e)}},l=()=>{},u=new Promise(e=>{l=e,t?setTimeout(e,Si):e()}),d=/* @__PURE__ */ new Set([window.location.origin,...e]),f=e=>{if(n||e.source!==window.parent||!d.has(e.origin))return;let t=e.data;t?.v===1&&t.type===`askdare:init`&&e.ports[0]&&(n=e.ports[0],n.onmessage=e=>{if(e.data?.v===1){if(e.data.type===`hidden`)for(let e of r)e();else if(e.data.type===`configure`){a=Ti(e.data);for(let e of i)e(a)}else e.data.type===`identify`&&c(wi(e.data.token))}},n.start(),n.postMessage({v:1,type:`ready`}),window.removeEventListener(`message`,f),c(wi(t.identity)),l())};return t&&window.addEventListener(`message`,f),{embedded:t,close(){n?.postMessage({v:1,type:`close`})},onHidden(e){return r.add(e),()=>r.delete(e)},onConfigure(e){return i.add(e),a&&e(a),()=>i.delete(e)},handshake:u,onIdentify(e){return o.add(e),s!==void 0&&e(s),()=>o.delete(e)}}}function Di(){return{get(e){try{return window.localStorage.getItem(e)??void 0}catch{return}},set(e,t){try{window.localStorage.setItem(e,t)}catch{}},remove(e){try{window.localStorage.removeItem(e)}catch{}}}}function Oi(){let e=document.getElementById(`askdare-config`),t=JSON.parse(e?.textContent??`null`);if(!t?.botId||!t.basePath)throw Error(`[askdare] Missing embed configuration.`);return t}var $=Oi(),ki=document.getElementById(`askdare-root`);if(ki){let e=new kt({basePath:$.basePath,botId:$.botId,locale:$.widget.locale,storage:Di(),translate:(e,t)=>{let n=$.widget.texts[e];return n===void 0?void 0:ct(n,t)}});st(ki).render(/* @__PURE__ */ V(_i,{config:$,client:e,bridge:Ei($.allowedOrigins),fixture:$.gallery?bi[$.gallery]:void 0,inline:new URLSearchParams(window.location.search).get(`mode`)===`inline`}))}";
66
66
  const WIDGET_CSS = "@layer askdare{:root{--ask-color-accent:#6b52e0;--ask-color-on-accent:#fff;--ask-color-background:#fdfbfd;--ask-color-surface:#f5f0f7;--ask-color-text:#242424;--ask-color-muted:#5f5a68;--ask-color-border:#2424241a;--ask-color-danger:#b42318;--ask-color-success:#067647;--ask-color-user-bubble:#c2386f;--ask-color-on-user-bubble:#fff;--ask-backdrop:none;--ask-orb:radial-gradient(circle at 50% 28%, #ffa3c6, #b8a1f6 60%, #7dd8d0);--ask-font-family:system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;--ask-font-family-heading:var(--ask-font-family);--ask-font-size:15px;--ask-radius:18px;--ask-space:8px;--ask-radius-small:calc(var(--ask-radius) * .6);--ask-shadow:0 1px 2px color-mix(in srgb, var(--ask-color-text) 6%, transparent), 0 8px 24px -10px color-mix(in srgb, var(--ask-color-text) 18%, transparent);--ask-ring:0 0 0 3px color-mix(in srgb, var(--ask-color-accent) 24%, transparent);--ask-glass:color-mix(in srgb, var(--ask-color-surface) 68%, transparent);--ask-ease:cubic-bezier(.2, .8, .2, 1);--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:root[data-ask-density=compact]{--ask-space:6px}*,:before,:after{box-sizing:border-box}html,body,#askdare-root{height:100%;margin:0}body{background:var(--ask-backdrop), var(--ask-color-background);background-color:var(--ask-color-background);color:var(--ask-color-text);font:var(--ask-font-size) / 1.55 var(--ask-font-family);-webkit-font-smoothing:antialiased;text-rendering:optimizelegibility}button{font:inherit;color:inherit}:focus-visible{outline:2px solid var(--ask-color-accent);outline-offset:2px}[data-ask-part=panel]{flex-direction:column;height:100%;display:flex;position:relative}[data-ask-part=header]{justify-content:space-between;align-items:center;gap:var(--ask-space);padding:calc(var(--ask-space) * 1.5) calc(var(--ask-space) * 1.5) calc(var(--ask-space) * 1.5) calc(var(--ask-space) * 2);border-bottom:1px solid var(--ask-color-border);background:var(--ask-color-background);display:flex}:root[data-ask-surface=glass] [data-ask-part=header]{background:color-mix(in srgb, var(--ask-color-background) 55%, transparent);-webkit-backdrop-filter:blur(18px)saturate(150%);backdrop-filter:blur(18px)saturate(150%);border-bottom-color:color-mix(in srgb, var(--ask-color-border) 70%, transparent)}[data-ask-part=identity]{align-items:center;gap:calc(var(--ask-space) * 1.25);min-width:0;display:flex}[data-ask-part=identity-text]{min-width:0}[data-ask-part=title]{font-family:var(--ask-font-family-heading);letter-spacing:-.01em;text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:1rem;font-weight:600;line-height:1.3;overflow:hidden}:root[data-ask-welcome=persona] [data-ask-part=title]{letter-spacing:0;font-size:1.15rem;font-weight:300}[data-ask-part=subtitle]{color:var(--ask-color-muted);text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:.8rem;line-height:1.35;overflow:hidden}[data-ask-part=actions]{flex:none;gap:2px;display:flex}:is([data-ask-part=new-conversation],[data-ask-part=close]){width:34px;height:34px;color:var(--ask-color-muted);cursor:pointer;transition:background-color .15s var(--ask-ease), color .15s var(--ask-ease);background:0 0;border:0;border-radius:50%;place-items:center;padding:0;display:grid}:is([data-ask-part=new-conversation],[data-ask-part=close]):hover{background:var(--ask-color-surface);color:var(--ask-color-text)}[data-ask-part=avatar]{width:30px;height:30px;font-family:var(--ask-font-family);letter-spacing:.02em;border-radius:50%;flex:none;place-items:center;font-size:.75rem;font-weight:600;display:grid;overflow:hidden}[data-ask-part=avatar][data-size=large]{width:72px;height:72px;font-size:1.5rem}[data-ask-part=avatar] img{object-fit:cover;width:100%;height:100%}[data-ask-part=avatar][data-kind=initials]{background:var(--ask-color-user-bubble);color:var(--ask-color-on-user-bubble)}[data-ask-part=avatar][data-kind=icon]{background:var(--ask-color-accent);color:var(--ask-color-on-accent);border-radius:30%}[data-ask-part=avatar][data-kind=orb]{overflow:visible}[data-ask-part=avatar][data-kind=orb][data-size=large]{filter:drop-shadow(0 14px 22px color-mix(in srgb, var(--ask-color-accent) 32%, transparent))}[data-ask-part=orb]{background:var(--ask-orb);border-radius:50%;width:100%;height:100%;animation:6s ease-in-out infinite ask-breathe;display:block;position:relative;overflow:hidden;box-shadow:inset 0 -5px 12px #0000002e,inset 0 4px 10px #ffffff8c}[data-ask-part=orb]:before{content:\"\";background:conic-gradient(from 0deg, transparent 0 55%, #ffffff73 70%, transparent 85%);mix-blend-mode:soft-light;animation:9s linear infinite ask-spin;position:absolute;inset:-35%}[data-ask-part=orb]:after{content:\"\";background:radial-gradient(closest-side,#ffffffe6,#fff0);border-radius:50%;width:36%;height:28%;position:absolute;top:13%;left:20%}[data-ask-part=panel][data-busy] [data-ask-part=orb]{animation-duration:1.4s}[data-ask-part=messages]{gap:calc(var(--ask-space) * 1.5);overscroll-behavior:contain;padding:calc(var(--ask-space) * 2);scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--ask-color-text) 18%, transparent) transparent;flex-direction:column;flex:1;display:flex;overflow-y:auto}[data-ask-part=status]{align-items:center;gap:var(--ask-space);color:var(--ask-color-muted);margin:0;font-size:.85rem;display:flex}[data-ask-part=status]:before{content:\"\";background:var(--ask-color-accent);border-radius:50%;width:8px;height:8px;animation:1.2s ease-in-out infinite ask-pulse}[data-ask-part=message]{align-items:flex-start;gap:var(--ask-space);max-width:88%;animation:ask-rise .26s var(--ask-ease) both;display:flex}[data-ask-part=message][data-role=user]{align-self:flex-end}[data-ask-part=message]>[data-ask-part=avatar]{margin-top:2px}[data-ask-part=message-body]{gap:calc(var(--ask-space) * .75);flex-direction:column;min-width:0;display:flex}[data-ask-part=message][data-role=user] [data-ask-part=message-body]{align-items:flex-end}[data-ask-part=bubble]{padding:calc(var(--ask-space) * 1.25) calc(var(--ask-space) * 1.75);border-radius:var(--ask-radius);overflow-wrap:anywhere;white-space:pre-wrap}[data-ask-part=message][data-role=assistant] [data-ask-part=bubble]{border-top-left-radius:calc(var(--ask-radius-small) * .6);background:var(--ask-color-surface);white-space:normal}[data-ask-part=message][data-role=user] [data-ask-part=bubble]{border-bottom-right-radius:calc(var(--ask-radius-small) * .6);background:var(--ask-color-user-bubble);color:var(--ask-color-on-user-bubble)}[data-ask-part=message][data-status=error] [data-ask-part=bubble]{opacity:.6}:root[data-ask-surface=glass] [data-ask-part=message][data-role=assistant] [data-ask-part=bubble]{border:1px solid color-mix(in srgb, var(--ask-color-background) 60%, transparent);background:var(--ask-glass);-webkit-backdrop-filter:blur(12px)saturate(140%);backdrop-filter:blur(12px)saturate(140%);box-shadow:0 1px 2px color-mix(in srgb, var(--ask-color-text) 5%, transparent)}:root[data-ask-bubbles=plain] [data-ask-part=message][data-role=assistant] [data-ask-part=bubble]{box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none;background:0 0;border:0;padding-inline:0}[data-ask-part=bubble]>:first-child{margin-top:0}[data-ask-part=bubble]>:last-child{margin-bottom:0}[data-ask-part=bubble] :is(p,ul,ol,pre,table,blockquote){margin:0 0 var(--ask-space)}[data-ask-part=bubble] :is(h1,h2,h3,h4){margin:calc(var(--ask-space) * 1.5) 0 calc(var(--ask-space) * .75);font-size:1em;font-weight:650;line-height:1.35}[data-ask-part=bubble] :is(ul,ol){padding-left:calc(var(--ask-space) * 2.5)}[data-ask-part=bubble] li+li{margin-top:2px}[data-ask-part=bubble] blockquote{padding-left:calc(var(--ask-space) * 1.5);border-left:3px solid var(--ask-color-border);color:var(--ask-color-muted)}[data-ask-part=bubble] code{background:color-mix(in srgb, var(--ask-color-text) 7%, transparent);border-radius:5px;padding:.1em .35em;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.88em}[data-ask-part=bubble] pre{padding:calc(var(--ask-space) * 1.25);border-radius:var(--ask-radius-small);background:color-mix(in srgb, var(--ask-color-text) 6%, transparent);overflow-x:auto}[data-ask-part=bubble] pre code{background:0 0;padding:0}[data-ask-part=bubble] table{border-collapse:collapse;font-size:.92em;display:block;overflow-x:auto}[data-ask-part=bubble] :is(th,td){border-bottom:1px solid var(--ask-color-border);text-align:left;padding:5px 10px}[data-ask-part=bubble] th{font-weight:600}[data-ask-part=bubble] a{color:var(--ask-color-accent);text-underline-offset:2px;text-decoration-thickness:1px}[data-ask-part=typing]{gap:4px;padding:6px 2px;display:inline-flex}[data-ask-part=typing] i{background:var(--ask-color-muted);border-radius:50%;width:7px;height:7px;animation:1.2s ease-in-out infinite ask-dot}[data-ask-part=typing] i:nth-child(2){animation-delay:.15s}[data-ask-part=typing] i:nth-child(3){animation-delay:.3s}[data-ask-part=attachments-note]{color:var(--ask-color-muted);margin:0;font-size:.8rem}[data-ask-part=citations]{counter-reset:ask-citation;flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none;display:flex}[data-ask-part=citation]{border:1px solid var(--ask-color-border);background:var(--ask-color-background);counter-increment:ask-citation;border-radius:999px;align-items:center;gap:6px;max-width:100%;padding:3px 10px 3px 4px;font-size:.78rem;line-height:1.4;display:inline-flex}[data-ask-part=citation]:before{content:counter(ask-citation);background:var(--ask-color-surface);min-width:18px;height:18px;color:var(--ask-color-muted);border-radius:999px;flex:none;place-items:center;font-size:.7rem;font-weight:600;display:grid}[data-ask-part=citation] :is(a,span){color:var(--ask-color-text);text-overflow:ellipsis;white-space:nowrap;text-decoration:none;overflow:hidden}[data-ask-part=citation] a:hover{color:var(--ask-color-accent);text-decoration:underline}[data-ask-part=welcome]{gap:calc(var(--ask-space) * 1.5);flex-direction:column;display:flex}[data-ask-part=welcome][data-layout=hero]{padding:calc(var(--ask-space) * 2) calc(var(--ask-space) * .5);text-align:center;align-items:center;margin:auto 0}[data-ask-part=welcome][data-layout=hero] [data-ask-part=greeting]{max-width:300px;margin:calc(var(--ask-space) * 1.5) 0 0;font-family:var(--ask-font-family-heading);letter-spacing:-.02em;text-wrap:balance;font-size:1.45rem;font-weight:600;line-height:1.25}[data-ask-part=starters]{gap:var(--ask-space);width:100%;margin:calc(var(--ask-space) * .5) 0 0;flex-direction:column;padding:0;list-style:none;display:flex}[data-ask-part=starter]{align-items:center;gap:calc(var(--ask-space) * 1.25);width:100%;padding:calc(var(--ask-space) * 1.25) calc(var(--ask-space) * 1.75);border:1px solid var(--ask-color-border);border-radius:var(--ask-radius-small);background:var(--ask-color-background);box-shadow:0 1px 2px color-mix(in srgb, var(--ask-color-text) 5%, transparent);text-align:left;cursor:pointer;transition:border-color .15s var(--ask-ease), transform .15s var(--ask-ease), box-shadow .15s var(--ask-ease);font-size:.92rem;line-height:1.4;display:flex}[data-ask-part=starter] svg{color:var(--ask-color-accent);flex:none}[data-ask-part=starter] span{flex:1}[data-ask-part=starter]:hover:not(:disabled){border-color:color-mix(in srgb, var(--ask-color-accent) 45%, var(--ask-color-border));box-shadow:var(--ask-shadow);transform:translateY(-1px)}[data-ask-part=starter]:disabled{opacity:.55;cursor:default}:root[data-ask-surface=glass] [data-ask-part=starter]{border-color:color-mix(in srgb, var(--ask-color-background) 70%, var(--ask-color-border));background:var(--ask-glass);-webkit-backdrop-filter:blur(12px)saturate(140%);backdrop-filter:blur(12px)saturate(140%)}[data-ask-part=welcome][data-layout=persona]{padding-top:calc(var(--ask-space) * 2);margin-top:auto}[data-ask-part=persona]{align-items:center;gap:calc(var(--ask-space) * 2);display:flex}[data-ask-part=persona] [data-ask-part=avatar][data-size=large]{border-radius:22px;width:64px;height:64px}[data-ask-part=persona-name]{font-family:var(--ask-font-family-heading);letter-spacing:-.01em;margin:0 0 6px;font-size:1.75rem;font-weight:300;line-height:1.1}[data-ask-part=presence]{border:1px solid var(--ask-color-border);color:var(--ask-color-muted);border-radius:999px;align-items:center;gap:6px;padding:2px 10px 2px 8px;font-size:.75rem;font-weight:500;display:inline-flex}[data-ask-part=presence]:before{content:\"\";background:var(--ask-color-success);width:7px;height:7px;box-shadow:0 0 0 3px color-mix(in srgb, var(--ask-color-success) 20%, transparent);border-radius:50%}[data-ask-part=welcome][data-layout=persona] [data-ask-part=greeting]{margin:calc(var(--ask-space) * .5) 0 0;font-size:1rem;line-height:1.6}[data-ask-part=welcome][data-layout=persona] [data-ask-part=starter]{padding:calc(var(--ask-space) * 1.4) calc(var(--ask-space) * 2.25);background:var(--ask-color-accent);box-shadow:none;color:var(--ask-color-on-accent);border-color:#0000;border-radius:999px;font-weight:500}[data-ask-part=welcome][data-layout=persona] [data-ask-part=starter] svg{color:inherit}[data-ask-part=welcome][data-layout=persona] [data-ask-part=starter] svg:first-child{display:none}[data-ask-part=welcome][data-layout=persona] [data-ask-part=starter]:hover:not(:disabled){box-shadow:0 8px 20px -10px color-mix(in srgb, var(--ask-color-accent) 70%, transparent)}[data-ask-part=intro]{align-items:flex-start;gap:var(--ask-space);animation:ask-rise .26s var(--ask-ease) both;display:flex}[data-ask-part=intro]>[data-ask-part=avatar]{margin-top:2px}[data-ask-part=intro-card]{min-width:0;padding:calc(var(--ask-space) * 1.25) calc(var(--ask-space) * 1.75);border-radius:var(--ask-radius);border-top-left-radius:calc(var(--ask-radius-small) * .6);background:var(--ask-color-surface);flex:1}:root[data-ask-surface=glass] [data-ask-part=intro-card]{border:1px solid color-mix(in srgb, var(--ask-color-background) 60%, transparent);background:var(--ask-glass);-webkit-backdrop-filter:blur(12px)saturate(140%);backdrop-filter:blur(12px)saturate(140%)}[data-ask-part=welcome][data-layout=intro] [data-ask-part=greeting]{margin:0;font-size:1.02rem}[data-ask-part=intro-card] [data-ask-part=starters]{margin-top:var(--ask-space);gap:0;padding:0}[data-ask-part=welcome][data-layout=intro] li+li{border-top:1px solid var(--ask-color-border)}[data-ask-part=welcome][data-layout=intro] [data-ask-part=starter]{padding:calc(var(--ask-space) * 1.1) 0;box-shadow:none;background:0 0;border:0;border-radius:0;font-size:.98rem}[data-ask-part=welcome][data-layout=intro] [data-ask-part=starter] svg{color:var(--ask-color-success)}[data-ask-part=welcome][data-layout=intro] [data-ask-part=starter]:hover:not(:disabled){box-shadow:none;text-underline-offset:3px;text-decoration:underline;transform:none}[data-ask-part=confirm-backdrop]{z-index:5;padding:calc(var(--ask-space) * 2);background:color-mix(in srgb, var(--ask-color-background) 60%, transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);animation:ask-fade .16s var(--ask-ease);place-items:center;display:grid;position:absolute;inset:0}[data-ask-part=confirm]{justify-items:center;gap:calc(var(--ask-space) * 1.5);width:min(300px,100%);padding:calc(var(--ask-space) * 2.5) calc(var(--ask-space) * 2) calc(var(--ask-space) * 2);border:1px solid var(--ask-color-border);border-radius:var(--ask-radius);background:var(--ask-color-surface);box-shadow:var(--ask-shadow);text-align:center;animation:ask-pop .2s var(--ask-ease);display:grid}[data-ask-part=confirm-icon]{background:color-mix(in srgb, var(--ask-color-accent) 12%, transparent);width:44px;height:44px;color:var(--ask-color-accent);border-radius:50%;place-items:center;display:grid}[data-ask-part=confirm-text]{color:var(--ask-color-text);text-wrap:balance;margin:0;font-size:.95rem;line-height:1.45}[data-ask-part=confirm-actions]{gap:var(--ask-space);width:100%;margin-top:calc(var(--ask-space) / 2);display:flex}:is([data-ask-part=confirm-cancel],[data-ask-part=confirm-accept]){padding:calc(var(--ask-space) * 1.1) var(--ask-space);border:1px solid var(--ask-color-border);border-radius:var(--ask-radius-small);color:var(--ask-color-text);font:inherit;cursor:pointer;transition:background .15s var(--ask-ease);background:0 0;flex:1;font-size:.9rem;font-weight:600}[data-ask-part=confirm-cancel]:hover{background:color-mix(in srgb, var(--ask-color-text) 6%, transparent)}[data-ask-part=confirm-accept]{border-color:var(--ask-color-accent);background:var(--ask-color-accent);color:var(--ask-color-on-accent)}[data-ask-part=confirm-accept]:hover{background:color-mix(in srgb, var(--ask-color-accent) 80%, var(--ask-color-background))}@keyframes ask-fade{0%{opacity:0}}@keyframes ask-pop{0%{opacity:0;transform:translateY(6px)scale(.97)}}[data-ask-part=error]{margin:0 calc(var(--ask-space) * 1.5) var(--ask-space);padding:var(--ask-space) calc(var(--ask-space) * 1.5);border:1px solid color-mix(in srgb, var(--ask-color-danger) 30%, transparent);border-radius:var(--ask-radius-small);background:color-mix(in srgb, var(--ask-color-danger) 8%, var(--ask-color-background));color:var(--ask-color-danger);font-size:.88rem}[data-ask-part=panel][data-dragging]{outline:2px dashed var(--ask-color-accent);outline-offset:-6px}[data-ask-part=composer]{gap:var(--ask-space);padding:var(--ask-space) calc(var(--ask-space) * 1.5) calc(var(--ask-space) * 1.5);flex-direction:column;display:flex}[data-ask-part=composer-box]{border:1px solid var(--ask-color-border);border-radius:calc(var(--ask-radius) + 4px);background:var(--ask-color-background);box-shadow:var(--ask-shadow);transition:border-color .15s var(--ask-ease), box-shadow .15s var(--ask-ease);align-items:flex-end;gap:4px;padding:6px;display:flex}[data-ask-part=composer-box]:focus-within{border-color:color-mix(in srgb, var(--ask-color-accent) 55%, var(--ask-color-border));box-shadow:var(--ask-shadow), var(--ask-ring)}:root[data-ask-surface=glass] [data-ask-part=composer-box]{background:color-mix(in srgb, var(--ask-color-background) 78%, transparent);-webkit-backdrop-filter:blur(16px)saturate(150%);backdrop-filter:blur(16px)saturate(150%)}:root[data-ask-composer=gradient] [data-ask-part=composer-box]{background:linear-gradient(var(--ask-color-background), var(--ask-color-background)) padding-box, var(--ask-orb) border-box;border:1.5px solid #0000}:root[data-ask-composer=gradient] [data-ask-part=composer-box]:focus-within{border-color:#0000}[data-ask-part=input]{min-height:36px;max-height:140px;color:inherit;font:inherit;resize:none;background:0 0;border:0;outline:0;flex:1;margin:0;padding:7px 8px;line-height:1.45}[data-ask-part=input]::placeholder{color:var(--ask-color-muted);opacity:1}:is([data-ask-part=attach],[data-ask-part=voice],[data-ask-part=send],[data-ask-part=recorder-cancel]){cursor:pointer;width:36px;height:36px;transition:background-color .15s var(--ask-ease), color .15s var(--ask-ease), transform .15s var(--ask-ease), opacity .15s var(--ask-ease);border:0;border-radius:50%;flex:none;place-items:center;padding:0;display:grid}:is([data-ask-part=attach],[data-ask-part=voice],[data-ask-part=recorder-cancel]){color:var(--ask-color-muted);background:0 0}:is([data-ask-part=attach],[data-ask-part=voice],[data-ask-part=recorder-cancel]):hover:not(:disabled){background:var(--ask-color-surface);color:var(--ask-color-text)}[data-ask-part=send]{background:var(--ask-color-accent);color:var(--ask-color-on-accent)}[data-ask-part=send]:hover:not(:disabled){transform:translateY(-1px)}[data-ask-part=send-label]{display:none}:is([data-ask-part=attach],[data-ask-part=voice],[data-ask-part=send]):disabled{opacity:.35;cursor:default}[data-ask-part=disclosure]{margin:calc(var(--ask-space) * -.5) 0 0;padding:0 calc(var(--ask-space) * 2) calc(var(--ask-space) * 1.25);color:var(--ask-color-muted);text-align:center;font-size:.72rem;line-height:1.4}[data-ask-part=disclosure] a{color:inherit;text-underline-offset:2px}:is([data-ask-part=attachments],[data-ask-part=message-attachments]){flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none;display:flex}[data-ask-part=message-attachments]{justify-content:flex-end}[data-ask-part=attachment]{border:1px solid var(--ask-color-border);border-radius:var(--ask-radius-small);background:var(--ask-color-background);align-items:center;gap:8px;max-width:100%;padding:4px 6px 4px 4px;font-size:.82rem;display:flex}[data-ask-part=attachment][data-status=error]{border-color:var(--ask-color-danger)}:is([data-ask-part=attachment-preview],[data-ask-part=attachment-badge]){border-radius:calc(var(--ask-radius-small) * .7);flex:none;width:34px;height:34px}[data-ask-part=attachment-preview]{object-fit:cover}[data-ask-part=attachment-badge]{background:var(--ask-color-surface);color:var(--ask-color-muted);letter-spacing:.04em;place-items:center;font-size:.65rem;font-weight:700;display:grid}[data-ask-part=attachment-name]{text-overflow:ellipsis;white-space:nowrap;max-width:160px;overflow:hidden}[data-ask-part=attachment-status]{color:var(--ask-color-muted)}[data-ask-part=attachment][data-status=error] [data-ask-part=attachment-status]{color:var(--ask-color-danger)}[data-ask-part=attachment-remove]{color:var(--ask-color-muted);cursor:pointer;background:0 0;border:0;padding:0 4px;font-size:1.1em}[data-ask-part=recorder]{align-items:center;gap:var(--ask-space);flex:1;min-height:36px;padding-left:10px;display:flex}[data-ask-part=recorder-level]{background:var(--ask-color-danger);width:14px;height:14px;box-shadow:0 0 0 calc(var(--ask-level,0) * 10px) color-mix(in srgb, var(--ask-color-danger) 18%, transparent);transform:scale(calc(.7 + var(--ask-level,0) * .6));border-radius:50%;flex:none;transition:transform 80ms linear,box-shadow 80ms linear}[data-ask-part=recorder][data-state=transcribing] [data-ask-part=recorder-level]{background:var(--ask-color-muted);box-shadow:none;animation:1.2s ease-in-out infinite ask-pulse;transform:none}[data-ask-part=recorder-label]{font-weight:600}[data-ask-part=recorder-time]{color:var(--ask-color-muted);font-variant-numeric:tabular-nums;margin-right:auto}[data-ask-part=recorder][data-state=transcribing] [data-ask-part=recorder-label]{margin-right:auto}[data-ask-part=recorder-done]{height:36px;padding:0 calc(var(--ask-space) * 2);background:var(--ask-color-accent);color:var(--ask-color-on-accent);cursor:pointer;border:0;border-radius:999px;font-weight:600}@media (max-width:480px){[data-ask-part=input]{font-size:16px}}@keyframes ask-rise{0%{opacity:0;transform:translateY(6px)}}@keyframes ask-dot{0%,60%,to{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}@keyframes ask-pulse{50%{opacity:.35}}@keyframes ask-breathe{50%{filter:saturate(1.15)brightness(1.04);transform:scale(1.04)}}@keyframes ask-spin{to{transform:rotate(360deg)}}:root:is([data-ask-preset=aura],[data-ask-preset=halo]) [data-ask-part=starters]{flex-flow:wrap;justify-content:center;gap:8px}:root:is([data-ask-preset=aura],[data-ask-preset=halo]) [data-ask-part=starter]{border-radius:999px;width:auto;padding:7px 14px 7px 11px;font-size:.82rem}:root[data-ask-preset=aura] [data-ask-part=welcome][data-layout=hero]{isolation:isolate;position:relative}:root[data-ask-preset=aura] [data-ask-part=welcome][data-layout=hero]:before{content:\"\";z-index:-1;background:radial-gradient(circle, color-mix(in srgb, var(--ask-color-text) 9%, transparent) 1px, transparent 1.4px) 0 0 / 14px 14px;pointer-events:none;position:absolute;inset:-6% 0 34%;-webkit-mask-image:radial-gradient(closest-side,#000 20%,#0000 100%);mask-image:radial-gradient(closest-side,#000 20%,#0000 100%)}:root[data-ask-preset=aura] [data-ask-part=welcome][data-layout=hero] [data-ask-part=avatar][data-size=large]{width:116px;height:116px;filter:drop-shadow(0 22px 26px color-mix(in srgb, var(--ask-color-accent) 22%, transparent));-webkit-box-reflect:below 6px linear-gradient(transparent 52%, #ffffff6b);margin-bottom:30px}:root[data-ask-preset=aura] [data-ask-part=orb]{box-shadow:inset 0 -10px 22px #ffffff59,inset 0 8px 16px #ffffffa6,inset 0 0 0 1px #ffffff80}:root[data-ask-preset=aura] [data-ask-part=welcome][data-layout=hero] [data-ask-part=greeting]{letter-spacing:-.03em;max-width:320px;font-size:1.6rem;font-weight:700}:root[data-ask-preset=aura] [data-layout=hero] [data-ask-part=greeting]:has(strong){color:color-mix(in srgb, var(--ask-color-text) 58%, var(--ask-color-background));font-weight:500}:root[data-ask-preset=aura] [data-ask-part=greeting] strong{color:var(--ask-color-text);font-weight:700}:root[data-ask-preset=aura] [data-ask-part=starter]{background:var(--ask-color-background);-webkit-backdrop-filter:none;backdrop-filter:none}:root[data-ask-preset=aura]{--ask-aura-gradient-end:var(--ask-color-accent)}:root[data-ask-preset=aura][data-ask-scheme=dark]{--ask-aura-gradient-end:color-mix(in srgb, var(--ask-color-accent) 55%, #000)}@media (prefers-color-scheme:dark){:root[data-ask-preset=aura][data-ask-scheme=auto]{--ask-aura-gradient-end:color-mix(in srgb, var(--ask-color-accent) 55%, #000)}}:root[data-ask-preset=aura] [data-ask-part=message][data-role=user] [data-ask-part=bubble],:root[data-ask-preset=aura] [data-ask-part=send]{background:linear-gradient(115deg, var(--ask-color-user-bubble), var(--ask-aura-gradient-end));color:var(--ask-color-on-user-bubble)}:root[data-ask-preset=aura] [data-ask-part=message][data-role=user] [data-ask-part=bubble]{border-radius:20px 20px 6px}:root[data-ask-preset=aura] [data-ask-part=composer-box]{border-radius:22px;flex-wrap:wrap;align-items:center;padding:10px 10px 8px}:root[data-ask-preset=aura] [data-ask-part=input]{flex:1 0 100%;order:-1;min-height:44px;padding:4px 8px 6px}:root[data-ask-preset=aura] :is([data-ask-part=attach],[data-ask-part=voice]){border:1px solid var(--ask-color-border);background:var(--ask-color-background);border-radius:999px;width:34px;height:32px}:root[data-ask-preset=aura] :is([data-ask-part=voice],[data-ask-part=send]:not([data-ask-part=voice]~*)){margin-left:auto}:root[data-ask-preset=aura] [data-ask-part=send]{border-radius:999px;gap:6px;width:auto;height:32px;padding:0 14px 0 10px;display:inline-flex}:root[data-ask-preset=aura] [data-ask-part=send] svg{width:16px;height:16px}:root[data-ask-preset=aura] [data-ask-part=send-label]{font-size:.82rem;font-weight:600;display:inline}:root[data-ask-preset=halo] [data-ask-part=welcome][data-layout=hero] [data-ask-part=avatar][data-size=large]{width:104px;height:104px;box-shadow:0 0 0 12px color-mix(in srgb, var(--ask-color-accent) 9%, transparent), 0 0 0 26px color-mix(in srgb, var(--ask-color-accent) 5%, transparent), 0 26px 50px -14px color-mix(in srgb, var(--ask-color-accent) 45%, transparent);filter:none;border-radius:50%;margin:18px 0 14px}:root[data-ask-preset=halo] [data-ask-part=orb]{box-shadow:inset 0 0 0 2px #ffffff8c, inset 0 -12px 24px color-mix(in srgb, var(--ask-color-accent) 35%, transparent), inset 0 10px 18px #ffffffb3}:root[data-ask-preset=halo] [data-ask-part=welcome][data-layout=hero] [data-ask-part=greeting]{letter-spacing:-.035em;font-size:1.7rem;font-weight:700}:root[data-ask-preset=halo] [data-ask-part=message][data-role=user] [data-ask-part=bubble]{border-radius:18px 18px 6px}:root[data-ask-preset=halo] [data-ask-part=composer-box]{box-shadow:0 10px 30px -14px color-mix(in srgb, var(--ask-color-accent) 45%, transparent);border-radius:999px;align-items:center;padding:6px 6px 6px 10px}:root[data-ask-preset=halo] :is([data-ask-part=voice],[data-ask-part=send]){background:color-mix(in srgb, var(--ask-color-accent) 15%, var(--ask-color-background));width:40px;height:40px;color:var(--ask-color-accent)}:root[data-ask-preset=halo] [data-ask-part=input]{align-self:center}:root[data-ask-preset=sage] [data-ask-part=welcome][data-layout=persona]{padding:calc(var(--ask-space) * 2.25);border:1px solid var(--ask-color-border);background:linear-gradient(160deg, var(--ask-color-background) 30%, color-mix(in srgb, var(--ask-color-surface) 70%, var(--ask-color-background)));box-shadow:var(--ask-shadow);border-radius:26px}:root[data-ask-preset=sage] [data-ask-part=persona]{flex-direction:row-reverse;justify-content:space-between}:root[data-ask-preset=sage] [data-ask-part=welcome] [data-ask-part=persona] [data-ask-part=avatar][data-size=large]{border-radius:50%;width:84px;height:84px}:root[data-ask-preset=sage] [data-ask-part=persona-name]{letter-spacing:-.03em;order:2;margin:10px 0 0;font-size:1.9rem;font-weight:300}:root[data-ask-preset=sage] [data-ask-part=persona]>div{flex-direction:column;align-items:flex-start;display:flex}:root[data-ask-preset=sage] [data-ask-part=presence]{background:var(--ask-color-background);box-shadow:0 1px 2px color-mix(in srgb, var(--ask-color-text) 8%, transparent);color:var(--ask-color-text);border-color:#0000;padding:3px 10px 3px 8px}:root[data-ask-preset=sage] [data-ask-part=welcome][data-layout=persona] [data-ask-part=greeting]{color:var(--ask-color-muted);font-weight:300}:root[data-ask-preset=sage] [data-ask-part=starters]{flex-flow:wrap;gap:8px}:root[data-ask-preset=sage] [data-ask-part=starter]{border-radius:999px;width:auto;padding:8px 16px;font-size:.85rem}:root[data-ask-preset=sage] [data-ask-part=starter] svg{display:none}:root[data-ask-preset=sage] li:first-child>[data-ask-part=starter]{border-color:var(--ask-color-accent);background:var(--ask-color-accent);color:var(--ask-color-on-accent)}:root[data-ask-preset=sage] [data-ask-part=message][data-role=user] [data-ask-part=bubble]{border:1px solid var(--ask-color-border);box-shadow:0 1px 2px color-mix(in srgb, var(--ask-color-text) 6%, transparent)}:root[data-ask-preset=sage] [data-ask-part=composer-box]{border-radius:999px;align-items:center;padding:6px 6px 6px 8px;position:relative}:root[data-ask-preset=sage] [data-ask-part=composer-box]:has(>[data-ask-part=voice]){margin-right:54px}:root[data-ask-preset=sage] [data-ask-part=send]{width:40px;height:40px}:root[data-ask-preset=sage] [data-ask-part=voice]{border:1px solid var(--ask-color-border);background:var(--ask-color-background);width:46px;height:46px;box-shadow:var(--ask-shadow);color:var(--ask-color-text);position:absolute;top:50%;right:-54px;transform:translateY(-50%)}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}[data-ask-part=recorder-level]{opacity:calc(.4 + var(--ask-level,0) * .6);transform:none}}}\n/*$vite$:1*/";
67
- const WIDGET_JS_FILE = "widget.59b5e54b633b.js";
67
+ const WIDGET_JS_FILE = "widget.7c4dfe0648d2.js";
68
68
  const WIDGET_CSS_FILE = "widget.820e1bb47b3f.css";
69
69
  const FONTS_CSS = "@font-face {\n font-family: 'Geist Variable';\n font-style: normal;\n font-display: swap;\n font-weight: 100 900;\n src: url(./geist-latin-ext-wght-normal.824f485b5d26.woff2) format('woff2');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n@font-face {\n font-family: 'Geist Variable';\n font-style: normal;\n font-display: swap;\n font-weight: 100 900;\n src: url(./geist-latin-wght-normal.19f9c92546aa.woff2) format('woff2');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}\n@font-face {\n font-family: 'Plus Jakarta Sans Variable';\n font-style: normal;\n font-display: swap;\n font-weight: 200 800;\n src: url(./plus-jakarta-sans-latin-ext-wght-normal.38e3b8fd8045.woff2) format('woff2');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n@font-face {\n font-family: 'Plus Jakarta Sans Variable';\n font-style: normal;\n font-display: swap;\n font-weight: 200 800;\n src: url(./plus-jakarta-sans-latin-wght-normal.153fc85b7029.woff2) format('woff2');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}\n@font-face {\n font-family: 'Atkinson Hyperlegible Next Variable';\n font-style: normal;\n font-display: swap;\n font-weight: 200 800;\n src: url(./atkinson-hyperlegible-next-latin-ext-wght-normal.7dae0c6c66af.woff2) format('woff2');\n unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;\n}\n@font-face {\n font-family: 'Atkinson Hyperlegible Next Variable';\n font-style: normal;\n font-display: swap;\n font-weight: 200 800;\n src: url(./atkinson-hyperlegible-next-latin-wght-normal.18b2a1a39a2f.woff2) format('woff2');\n unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;\n}";
70
70
  const FONTS_CSS_FILE = "fonts.c3792c78d2c3.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boldare/askdare",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.1.0-rc.1",
4
4
  "description": "Embeddable AI chatbot for Next.js, built on the official OpenAI SDK.",
5
5
  "license": "MIT",
6
6
  "author": {