=4?l(d):t.interrupt(u.parser.constructs.flow,a,l)(d)}}function cg(t,l,a,u,o,c,d,h,m){const p=m||Number.POSITIVE_INFINITY;let g=0;return b;function b(T){return T===60?(t.enter(u),t.enter(o),t.enter(c),t.consume(T),t.exit(c),x):T===null||T===32||T===41||Tc(T)?a(T):(t.enter(u),t.enter(d),t.enter(h),t.enter("chunkString",{contentType:"string"}),A(T))}function x(T){return T===62?(t.enter(c),t.consume(T),t.exit(c),t.exit(o),t.exit(u),l):(t.enter(h),t.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===62?(t.exit("chunkString"),t.exit(h),x(T)):T===null||T===60||Ce(T)?a(T):(t.consume(T),T===92?D:v)}function D(T){return T===60||T===62||T===92?(t.consume(T),v):v(T)}function A(T){return!g&&(T===null||T===41||Zt(T))?(t.exit("chunkString"),t.exit(h),t.exit(d),t.exit(u),l(T)):g999||v===null||v===91||v===93&&!m||v===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?a(v):v===93?(t.exit(c),t.enter(o),t.consume(v),t.exit(o),t.exit(u),l):Ce(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),g):(t.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===null||v===91||v===93||Ce(v)||h++>999?(t.exit("chunkString"),g(v)):(t.consume(v),m||(m=!Ze(v)),v===92?x:b)}function x(v){return v===91||v===92||v===93?(t.consume(v),h++,b):b(v)}}function dg(t,l,a,u,o,c){let d;return h;function h(x){return x===34||x===39||x===40?(t.enter(u),t.enter(o),t.consume(x),t.exit(o),d=x===40?41:x,m):a(x)}function m(x){return x===d?(t.enter(o),t.consume(x),t.exit(o),t.exit(u),l):(t.enter(c),p(x))}function p(x){return x===d?(t.exit(c),m(d)):x===null?a(x):Ce(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),lt(t,p,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===d||x===null||Ce(x)?(t.exit("chunkString"),p(x)):(t.consume(x),x===92?b:g)}function b(x){return x===d||x===92?(t.consume(x),g):g(x)}}function ii(t,l){let a;return u;function u(o){return Ce(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a=!0,u):Ze(o)?lt(t,u,a?"linePrefix":"lineSuffix")(o):l(o)}}const qT={name:"definition",tokenize:IT},GT={tokenize:YT,partial:!0};function IT(t,l,a){const u=this;let o;return c;function c(v){return t.enter("definition"),d(v)}function d(v){return fg.call(u,t,h,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function h(v){return o=Ll(u.sliceSerialize(u.events[u.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),m):a(v)}function m(v){return Zt(v)?ii(t,p)(v):p(v)}function p(v){return cg(t,g,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function g(v){return t.attempt(GT,b,b)(v)}function b(v){return Ze(v)?lt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ce(v)?(t.exit("definition"),u.parser.defined.push(o),l(v)):a(v)}}function YT(t,l,a){return u;function u(h){return Zt(h)?ii(t,o)(h):a(h)}function o(h){return dg(t,c,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return Ze(h)?lt(t,d,"whitespace")(h):d(h)}function d(h){return h===null||Ce(h)?l(h):a(h)}}const $T={name:"hardBreakEscape",tokenize:FT};function FT(t,l,a){return u;function u(c){return t.enter("hardBreakEscape"),t.consume(c),o}function o(c){return Ce(c)?(t.exit("hardBreakEscape"),l(c)):a(c)}}const XT={name:"headingAtx",tokenize:KT,resolve:QT};function QT(t,l){let a=t.length-2,u=3,o,c;return t[u][1].type==="whitespace"&&(u+=2),a-2>u&&t[a][1].type==="whitespace"&&(a-=2),t[a][1].type==="atxHeadingSequence"&&(u===a-1||a-4>u&&t[a-2][1].type==="whitespace")&&(a-=u+1===a?2:4),a>u&&(o={type:"atxHeadingText",start:t[u][1].start,end:t[a][1].end},c={type:"chunkText",start:t[u][1].start,end:t[a][1].end,contentType:"text"},Pn(t,u,a-u+1,[["enter",o,l],["enter",c,l],["exit",c,l],["exit",o,l]])),t}function KT(t,l,a){let u=0;return o;function o(g){return t.enter("atxHeading"),c(g)}function c(g){return t.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&u++<6?(t.consume(g),d):g===null||Zt(g)?(t.exit("atxHeadingSequence"),h(g)):a(g)}function h(g){return g===35?(t.enter("atxHeadingSequence"),m(g)):g===null||Ce(g)?(t.exit("atxHeading"),l(g)):Ze(g)?lt(t,h,"whitespace")(g):(t.enter("atxHeadingText"),p(g))}function m(g){return g===35?(t.consume(g),m):(t.exit("atxHeadingSequence"),h(g))}function p(g){return g===null||g===35||Zt(g)?(t.exit("atxHeadingText"),h(g)):(t.consume(g),p)}}const ZT=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],hg=["pre","script","style","textarea"],PT={name:"htmlFlow",tokenize:tw,resolveTo:ew,concrete:!0},JT={tokenize:rw,partial:!0},WT={tokenize:nw,partial:!0};function ew(t){let l=t.length;for(;l--&&!(t[l][0]==="enter"&&t[l][1].type==="htmlFlow"););return l>1&&t[l-2][1].type==="linePrefix"&&(t[l][1].start=t[l-2][1].start,t[l+1][1].start=t[l-2][1].start,t.splice(l-2,2)),t}function tw(t,l,a){const u=this;let o,c,d,h,m;return p;function p(w){return g(w)}function g(w){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(w),b}function b(w){return w===33?(t.consume(w),x):w===47?(t.consume(w),c=!0,A):w===63?(t.consume(w),o=3,u.interrupt?l:S):qn(w)?(t.consume(w),d=String.fromCharCode(w),U):a(w)}function x(w){return w===45?(t.consume(w),o=2,v):w===91?(t.consume(w),o=5,h=0,D):qn(w)?(t.consume(w),o=4,u.interrupt?l:S):a(w)}function v(w){return w===45?(t.consume(w),u.interrupt?l:S):a(w)}function D(w){const le="CDATA[";return w===le.charCodeAt(h++)?(t.consume(w),h===le.length?u.interrupt?l:X:D):a(w)}function A(w){return qn(w)?(t.consume(w),d=String.fromCharCode(w),U):a(w)}function U(w){if(w===null||w===47||w===62||Zt(w)){const le=w===47,ye=d.toLowerCase();return!le&&!c&&hg.includes(ye)?(o=1,u.interrupt?l(w):X(w)):ZT.includes(d.toLowerCase())?(o=6,le?(t.consume(w),T):u.interrupt?l(w):X(w)):(o=7,u.interrupt&&!u.parser.lazy[u.now().line]?a(w):c?N(w):O(w))}return w===45||an(w)?(t.consume(w),d+=String.fromCharCode(w),U):a(w)}function T(w){return w===62?(t.consume(w),u.interrupt?l:X):a(w)}function N(w){return Ze(w)?(t.consume(w),N):E(w)}function O(w){return w===47?(t.consume(w),E):w===58||w===95||qn(w)?(t.consume(w),L):Ze(w)?(t.consume(w),O):E(w)}function L(w){return w===45||w===46||w===58||w===95||an(w)?(t.consume(w),L):_(w)}function _(w){return w===61?(t.consume(w),R):Ze(w)?(t.consume(w),_):O(w)}function R(w){return w===null||w===60||w===61||w===62||w===96?a(w):w===34||w===39?(t.consume(w),m=w,G):Ze(w)?(t.consume(w),R):ne(w)}function G(w){return w===m?(t.consume(w),m=null,Y):w===null||Ce(w)?a(w):(t.consume(w),G)}function ne(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||Zt(w)?_(w):(t.consume(w),ne)}function Y(w){return w===47||w===62||Ze(w)?O(w):a(w)}function E(w){return w===62?(t.consume(w),q):a(w)}function q(w){return w===null||Ce(w)?X(w):Ze(w)?(t.consume(w),q):a(w)}function X(w){return w===45&&o===2?(t.consume(w),J):w===60&&o===1?(t.consume(w),ae):w===62&&o===4?(t.consume(w),K):w===63&&o===3?(t.consume(w),S):w===93&&o===5?(t.consume(w),be):Ce(w)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(JT,oe,P)(w)):w===null||Ce(w)?(t.exit("htmlFlowData"),P(w)):(t.consume(w),X)}function P(w){return t.check(WT,te,oe)(w)}function te(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),ue}function ue(w){return w===null||Ce(w)?P(w):(t.enter("htmlFlowData"),X(w))}function J(w){return w===45?(t.consume(w),S):X(w)}function ae(w){return w===47?(t.consume(w),d="",ie):X(w)}function ie(w){if(w===62){const le=d.toLowerCase();return hg.includes(le)?(t.consume(w),K):X(w)}return qn(w)&&d.length<8?(t.consume(w),d+=String.fromCharCode(w),ie):X(w)}function be(w){return w===93?(t.consume(w),S):X(w)}function S(w){return w===62?(t.consume(w),K):w===45&&o===2?(t.consume(w),S):X(w)}function K(w){return w===null||Ce(w)?(t.exit("htmlFlowData"),oe(w)):(t.consume(w),K)}function oe(w){return t.exit("htmlFlow"),l(w)}}function nw(t,l,a){const u=this;return o;function o(d){return Ce(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):a(d)}function c(d){return u.parser.lazy[u.now().line]?a(d):l(d)}}function rw(t,l,a){return u;function u(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Nu,l,a)}}const lw={name:"htmlText",tokenize:aw};function aw(t,l,a){const u=this;let o,c,d;return h;function h(S){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(S),m}function m(S){return S===33?(t.consume(S),p):S===47?(t.consume(S),_):S===63?(t.consume(S),O):qn(S)?(t.consume(S),ne):a(S)}function p(S){return S===45?(t.consume(S),g):S===91?(t.consume(S),c=0,D):qn(S)?(t.consume(S),N):a(S)}function g(S){return S===45?(t.consume(S),v):a(S)}function b(S){return S===null?a(S):S===45?(t.consume(S),x):Ce(S)?(d=b,ae(S)):(t.consume(S),b)}function x(S){return S===45?(t.consume(S),v):b(S)}function v(S){return S===62?J(S):S===45?x(S):b(S)}function D(S){const K="CDATA[";return S===K.charCodeAt(c++)?(t.consume(S),c===K.length?A:D):a(S)}function A(S){return S===null?a(S):S===93?(t.consume(S),U):Ce(S)?(d=A,ae(S)):(t.consume(S),A)}function U(S){return S===93?(t.consume(S),T):A(S)}function T(S){return S===62?J(S):S===93?(t.consume(S),T):A(S)}function N(S){return S===null||S===62?J(S):Ce(S)?(d=N,ae(S)):(t.consume(S),N)}function O(S){return S===null?a(S):S===63?(t.consume(S),L):Ce(S)?(d=O,ae(S)):(t.consume(S),O)}function L(S){return S===62?J(S):O(S)}function _(S){return qn(S)?(t.consume(S),R):a(S)}function R(S){return S===45||an(S)?(t.consume(S),R):G(S)}function G(S){return Ce(S)?(d=G,ae(S)):Ze(S)?(t.consume(S),G):J(S)}function ne(S){return S===45||an(S)?(t.consume(S),ne):S===47||S===62||Zt(S)?Y(S):a(S)}function Y(S){return S===47?(t.consume(S),J):S===58||S===95||qn(S)?(t.consume(S),E):Ce(S)?(d=Y,ae(S)):Ze(S)?(t.consume(S),Y):J(S)}function E(S){return S===45||S===46||S===58||S===95||an(S)?(t.consume(S),E):q(S)}function q(S){return S===61?(t.consume(S),X):Ce(S)?(d=q,ae(S)):Ze(S)?(t.consume(S),q):Y(S)}function X(S){return S===null||S===60||S===61||S===62||S===96?a(S):S===34||S===39?(t.consume(S),o=S,P):Ce(S)?(d=X,ae(S)):Ze(S)?(t.consume(S),X):(t.consume(S),te)}function P(S){return S===o?(t.consume(S),o=void 0,ue):S===null?a(S):Ce(S)?(d=P,ae(S)):(t.consume(S),P)}function te(S){return S===null||S===34||S===39||S===60||S===61||S===96?a(S):S===47||S===62||Zt(S)?Y(S):(t.consume(S),te)}function ue(S){return S===47||S===62||Zt(S)?Y(S):a(S)}function J(S){return S===62?(t.consume(S),t.exit("htmlTextData"),t.exit("htmlText"),l):a(S)}function ae(S){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),ie}function ie(S){return Ze(S)?lt(t,be,"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):be(S)}function be(S){return t.enter("htmlTextData"),d(S)}}const Oc={name:"labelEnd",tokenize:fw,resolveTo:cw,resolveAll:sw},iw={tokenize:dw},uw={tokenize:hw},ow={tokenize:pw};function sw(t){let l=-1;for(;++l=3&&(p===null||Ce(p))?(t.exit("thematicBreak"),l(p)):a(p)}function m(p){return p===o?(t.consume(p),u++,m):(t.exit("thematicBreakSequence"),Ze(p)?lt(t,h,"whitespace")(p):h(p))}}const Pt={name:"list",tokenize:Cw,continuation:{tokenize:Tw},exit:Aw},xw={tokenize:kw,partial:!0},Ew={tokenize:ww,partial:!0};function Cw(t,l,a){const u=this,o=u.events[u.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return h;function h(v){const D=u.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(D==="listUnordered"?!u.containerState.marker||v===u.containerState.marker:wc(v)){if(u.containerState.type||(u.containerState.type=D,t.enter(D,{_container:!0})),D==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(Bu,a,p)(v):p(v);if(!u.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),m(v)}return a(v)}function m(v){return wc(v)&&++d<10?(t.consume(v),m):(!u.interrupt||d<2)&&(u.containerState.marker?v===u.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),p(v)):a(v)}function p(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),u.containerState.marker=u.containerState.marker||v,t.check(Nu,u.interrupt?a:g,t.attempt(xw,x,b))}function g(v){return u.containerState.initialBlankLine=!0,c++,x(v)}function b(v){return Ze(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):a(v)}function x(v){return u.containerState.size=c+u.sliceSerialize(t.exit("listItemPrefix"),!0).length,l(v)}}function Tw(t,l,a){const u=this;return u.containerState._closeFlow=void 0,t.check(Nu,o,c);function o(h){return u.containerState.furtherBlankLines=u.containerState.furtherBlankLines||u.containerState.initialBlankLine,lt(t,l,"listItemIndent",u.containerState.size+1)(h)}function c(h){return u.containerState.furtherBlankLines||!Ze(h)?(u.containerState.furtherBlankLines=void 0,u.containerState.initialBlankLine=void 0,d(h)):(u.containerState.furtherBlankLines=void 0,u.containerState.initialBlankLine=void 0,t.attempt(Ew,l,d)(h))}function d(h){return u.containerState._closeFlow=!0,u.interrupt=void 0,lt(t,t.attempt(Pt,l,a),"linePrefix",u.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function ww(t,l,a){const u=this;return lt(t,o,"listItemIndent",u.containerState.size+1);function o(c){const d=u.events[u.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===u.containerState.size?l(c):a(c)}}function Aw(t){t.exit(this.containerState.type)}function kw(t,l,a){const u=this;return lt(t,o,"listItemPrefixWhitespace",u.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=u.events[u.events.length-1];return!Ze(c)&&d&&d[1].type==="listItemPrefixWhitespace"?l(c):a(c)}}const pg={name:"setextUnderline",tokenize:Ow,resolveTo:_w};function _w(t,l){let a=t.length,u,o,c;for(;a--;)if(t[a][0]==="enter"){if(t[a][1].type==="content"){u=a;break}t[a][1].type==="paragraph"&&(o=a)}else t[a][1].type==="content"&&t.splice(a,1),!c&&t[a][1].type==="definition"&&(c=a);const d={type:"setextHeading",start:Object.assign({},t[o][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[o][1].type="setextHeadingText",c?(t.splice(o,0,["enter",d,l]),t.splice(c+1,0,["exit",t[u][1],l]),t[u][1].end=Object.assign({},t[c][1].end)):t[u][1]=d,t.push(["exit",d,l]),t}function Ow(t,l,a){const u=this;let o;return c;function c(p){let g=u.events.length,b;for(;g--;)if(u.events[g][1].type!=="lineEnding"&&u.events[g][1].type!=="linePrefix"&&u.events[g][1].type!=="content"){b=u.events[g][1].type==="paragraph";break}return!u.parser.lazy[u.now().line]&&(u.interrupt||b)?(t.enter("setextHeadingLine"),o=p,d(p)):a(p)}function d(p){return t.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===o?(t.consume(p),h):(t.exit("setextHeadingLineSequence"),Ze(p)?lt(t,m,"lineSuffix")(p):m(p))}function m(p){return p===null||Ce(p)?(t.exit("setextHeadingLine"),l(p)):a(p)}}const Rw={tokenize:Dw};function Dw(t){const l=this,a=t.attempt(Nu,u,t.attempt(this.parser.constructs.flowInitial,o,lt(t,t.attempt(this.parser.constructs.flow,o,t.attempt(LT,o)),"linePrefix")));return a;function u(c){if(c===null){t.consume(c);return}return t.enter("lineEndingBlank"),t.consume(c),t.exit("lineEndingBlank"),l.currentConstruct=void 0,a}function o(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),l.currentConstruct=void 0,a}}const Mw={resolveAll:gg()},zw=mg("string"),Nw=mg("text");function mg(t){return{tokenize:l,resolveAll:gg(t==="text"?Bw:void 0)};function l(a){const u=this,o=this.parser.constructs[t],c=a.attempt(o,d,h);return d;function d(g){return p(g)?c(g):h(g)}function h(g){if(g===null){a.consume(g);return}return a.enter("data"),a.consume(g),m}function m(g){return p(g)?(a.exit("data"),c(g)):(a.consume(g),m)}function p(g){if(g===null)return!0;const b=o[g];let x=-1;if(b)for(;++x-1){const h=d[0];typeof h=="string"?d[0]=h.slice(u):d.shift()}c>0&&d.push(t[o].slice(0,c))}return d}function Hw(t,l){let a=-1;const u=[];let o;for(;++a0){const Me=ce.tokenStack[ce.tokenStack.length-1];(Me[1]||vg).call(ce,void 0,Me[0])}for(W.position={start:Er(I.length>0?I[0][1].start:{line:1,column:1,offset:0}),end:Er(I.length>0?I[I.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};t.patch(l,m);const p={type:"element",tagName:"sup",properties:{},children:[m]};return t.patch(l,p),t.applyData(l,p)}function nA(t,l){const a={type:"element",tagName:"h"+l.depth,properties:{},children:t.all(l)};return t.patch(l,a),t.applyData(l,a)}function rA(t,l){if(t.options.allowDangerousHtml){const a={type:"raw",value:l.value};return t.patch(l,a),t.applyData(l,a)}}function xg(t,l){const a=l.referenceType;let u="]";if(a==="collapsed"?u+="[]":a==="full"&&(u+="["+(l.label||l.identifier)+"]"),l.type==="imageReference")return[{type:"text",value:"!["+l.alt+u}];const o=t.all(l),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=u:o.push({type:"text",value:u}),o}function lA(t,l){const a=String(l.identifier).toUpperCase(),u=t.definitionById.get(a);if(!u)return xg(t,l);const o={src:Ul(u.url||""),alt:l.alt};u.title!==null&&u.title!==void 0&&(o.title=u.title);const c={type:"element",tagName:"img",properties:o,children:[]};return t.patch(l,c),t.applyData(l,c)}function aA(t,l){const a={src:Ul(l.url)};l.alt!==null&&l.alt!==void 0&&(a.alt=l.alt),l.title!==null&&l.title!==void 0&&(a.title=l.title);const u={type:"element",tagName:"img",properties:a,children:[]};return t.patch(l,u),t.applyData(l,u)}function iA(t,l){const a={type:"text",value:l.value.replace(/\r?\n|\r/g," ")};t.patch(l,a);const u={type:"element",tagName:"code",properties:{},children:[a]};return t.patch(l,u),t.applyData(l,u)}function uA(t,l){const a=String(l.identifier).toUpperCase(),u=t.definitionById.get(a);if(!u)return xg(t,l);const o={href:Ul(u.url||"")};u.title!==null&&u.title!==void 0&&(o.title=u.title);const c={type:"element",tagName:"a",properties:o,children:t.all(l)};return t.patch(l,c),t.applyData(l,c)}function oA(t,l){const a={href:Ul(l.url)};l.title!==null&&l.title!==void 0&&(a.title=l.title);const u={type:"element",tagName:"a",properties:a,children:t.all(l)};return t.patch(l,u),t.applyData(l,u)}function sA(t,l,a){const u=t.all(l),o=a?cA(a):Eg(l),c={},d=[];if(typeof l.checked=="boolean"){const g=u[0];let b;g&&g.type==="element"&&g.tagName==="p"?b=g:(b={type:"element",tagName:"p",properties:{},children:[]},u.unshift(b)),b.children.length>0&&b.children.unshift({type:"text",value:" "}),b.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:l.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h1}function fA(t,l){const a={},u=t.all(l);let o=-1;for(typeof l.start=="number"&&l.start!==1&&(a.start=l.start);++o0){const d={type:"element",tagName:"tbody",properties:{},children:t.wrap(a,!0)},h=yc(l.children[1]),m=Gm(l.children[l.children.length-1]);h&&m&&(d.position={start:h,end:m}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(l,c),t.applyData(l,c)}function gA(t,l,a){const u=a?a.children:void 0,c=(u?u.indexOf(l):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,h=d?d.length:l.children.length;let m=-1;const p=[];for(;++m0,!0),u[0]),o=u.index+u[0].length,u=a.exec(l);return c.push(wg(l.slice(o),o>0,!1)),c.join("")}function wg(t,l,a){let u=0,o=t.length;if(l){let c=t.codePointAt(u);for(;c===Cg||c===Tg;)u++,c=t.codePointAt(u)}if(a){let c=t.codePointAt(o-1);for(;c===Cg||c===Tg;)o--,c=t.codePointAt(o-1)}return o>u?t.slice(u,o):""}function SA(t,l){const a={type:"text",value:bA(String(l.value))};return t.patch(l,a),t.applyData(l,a)}function vA(t,l){const a={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(l,a),t.applyData(l,a)}const xA={blockquote:Zw,break:Pw,code:Jw,delete:Ww,emphasis:eA,footnoteReference:tA,heading:nA,html:rA,imageReference:lA,image:aA,inlineCode:iA,linkReference:uA,link:oA,listItem:sA,list:fA,paragraph:dA,root:hA,strong:pA,table:mA,tableCell:yA,tableRow:gA,text:SA,thematicBreak:vA,toml:Lu,yaml:Lu,definition:Lu,footnoteDefinition:Lu};function Lu(){}const Ag=-1,Uu=0,Hu=1,ju=2,Dc=3,Mc=4,zc=5,Nc=6,kg=7,_g=8,Og=typeof self=="object"?self:globalThis,EA=(t,l)=>{const a=(o,c)=>(t.set(c,o),o),u=o=>{if(t.has(o))return t.get(o);const[c,d]=l[o];switch(c){case Uu:case Ag:return a(d,o);case Hu:{const h=a([],o);for(const m of d)h.push(u(m));return h}case ju:{const h=a({},o);for(const[m,p]of d)h[u(m)]=u(p);return h}case Dc:return a(new Date(d),o);case Mc:{const{source:h,flags:m}=d;return a(new RegExp(h,m),o)}case zc:{const h=a(new Map,o);for(const[m,p]of d)h.set(u(m),u(p));return h}case Nc:{const h=a(new Set,o);for(const m of d)h.add(u(m));return h}case kg:{const{name:h,message:m}=d;return a(new Og[h](m),o)}case _g:return a(BigInt(d),o);case"BigInt":return a(Object(BigInt(d)),o)}return a(new Og[c](d),o)};return u},Rg=t=>EA(new Map,t)(0),Hl="",{toString:CA}={},{keys:TA}=Object,ui=t=>{const l=typeof t;if(l!=="object"||!t)return[Uu,l];const a=CA.call(t).slice(8,-1);switch(a){case"Array":return[Hu,Hl];case"Object":return[ju,Hl];case"Date":return[Dc,Hl];case"RegExp":return[Mc,Hl];case"Map":return[zc,Hl];case"Set":return[Nc,Hl]}return a.includes("Array")?[Hu,a]:a.includes("Error")?[kg,a]:[ju,a]},Vu=([t,l])=>t===Uu&&(l==="function"||l==="symbol"),wA=(t,l,a,u)=>{const o=(d,h)=>{const m=u.push(d)-1;return a.set(h,m),m},c=d=>{if(a.has(d))return a.get(d);let[h,m]=ui(d);switch(h){case Uu:{let g=d;switch(m){case"bigint":h=_g,g=d.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return o([Ag],d)}return o([h,g],d)}case Hu:{if(m)return o([m,[...d]],d);const g=[],b=o([h,g],d);for(const x of d)g.push(c(x));return b}case ju:{if(m)switch(m){case"BigInt":return o([m,d.toString()],d);case"Boolean":case"Number":case"String":return o([m,d.valueOf()],d)}if(l&&"toJSON"in d)return c(d.toJSON());const g=[],b=o([h,g],d);for(const x of TA(d))(t||!Vu(ui(d[x])))&&g.push([c(x),c(d[x])]);return b}case Dc:return o([h,d.toISOString()],d);case Mc:{const{source:g,flags:b}=d;return o([h,{source:g,flags:b}],d)}case zc:{const g=[],b=o([h,g],d);for(const[x,v]of d)(t||!(Vu(ui(x))||Vu(ui(v))))&&g.push([c(x),c(v)]);return b}case Nc:{const g=[],b=o([h,g],d);for(const x of d)(t||!Vu(ui(x)))&&g.push(c(x));return b}}const{message:p}=d;return o([h,{name:m,message:p}],d)};return c},Dg=(t,{json:l,lossy:a}={})=>{const u=[];return wA(!(l||a),!!l,new Map,u)(t),u},qu=typeof structuredClone=="function"?(t,l)=>l&&("json"in l||"lossy"in l)?Rg(Dg(t,l)):structuredClone(t):(t,l)=>Rg(Dg(t,l));function AA(t,l){const a=[{type:"text",value:"↩"}];return l>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(l)}]}),a}function kA(t,l){return"Back to reference "+(t+1)+(l>1?"-"+l:"")}function _A(t){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=t.options.footnoteBackContent||AA,u=t.options.footnoteBackLabel||kA,o=t.options.footnoteLabel||"Footnotes",c=t.options.footnoteLabelTagName||"h2",d=t.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let m=-1;for(;++m0&&D.push({type:"text",value:" "});let N=typeof a=="string"?a:a(m,v);typeof N=="string"&&(N={type:"text",value:N}),D.push({type:"element",tagName:"a",properties:{href:"#"+l+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof u=="string"?u:u(m,v),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const U=g[g.length-1];if(U&&U.type==="element"&&U.tagName==="p"){const N=U.children[U.children.length-1];N&&N.type==="text"?N.value+=" ":U.children.push({type:"text",value:" "}),U.children.push(...D)}else g.push(...D);const T={type:"element",tagName:"li",properties:{id:l+"fn-"+x},children:t.wrap(g,!0)};t.patch(p,T),h.push(T)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...qu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
+`},{type:"element",tagName:"ol",properties:{},children:t.wrap(h,!0)},{type:"text",value:`
+`}]}}const Mg=function(t){if(t==null)return MA;if(typeof t=="function")return Gu(t);if(typeof t=="object")return Array.isArray(t)?OA(t):RA(t);if(typeof t=="string")return DA(t);throw new Error("Expected function, string, or object as test")};function OA(t){const l=[];let a=-1;for(;++a":""))+")"})}return x;function x(){let v=zg,D,A,U;if((!l||c(m,p,g[g.length-1]||void 0))&&(v=UA(a(m,g)),v[0]===Ng))return v;if("children"in m&&m.children){const T=m;if(T.children&&v[0]!==BA)for(A=(u?T.children.length:-1)+d,U=g.concat(T);A>-1&&A0&&a.push({type:"text",value:`
+`}),a}function Lg(t){let l=0,a=t.charCodeAt(l);for(;a===9||a===32;)l++,a=t.charCodeAt(l);return t.slice(l)}function Ug(t,l){const a=jA(t,l),u=a.one(t,void 0),o=_A(a),c=Array.isArray(u)?{type:"root",children:u}:u||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
+`},o),c}function YA(t,l){return t&&"run"in t?async function(a,u){const o=Ug(a,{file:u,...l});await t.run(o,u)}:function(a,u){return Ug(a,{file:u,...t||l})}}function Hg(t){if(t)throw t}var Lc,jg;function $A(){if(jg)return Lc;jg=1;var t=Object.prototype.hasOwnProperty,l=Object.prototype.toString,a=Object.defineProperty,u=Object.getOwnPropertyDescriptor,o=function(p){return typeof Array.isArray=="function"?Array.isArray(p):l.call(p)==="[object Array]"},c=function(p){if(!p||l.call(p)!=="[object Object]")return!1;var g=t.call(p,"constructor"),b=p.constructor&&p.constructor.prototype&&t.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!b)return!1;var x;for(x in p);return typeof x>"u"||t.call(p,x)},d=function(p,g){a&&g.name==="__proto__"?a(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},h=function(p,g){if(g==="__proto__")if(t.call(p,g)){if(u)return u(p,g).value}else return;return p[g]};return Lc=function m(){var p,g,b,x,v,D,A=arguments[0],U=1,T=arguments.length,N=!1;for(typeof A=="boolean"&&(N=A,A=arguments[1]||{},U=2),(A==null||typeof A!="object"&&typeof A!="function")&&(A={});Ud.length;let m;h&&d.push(o);try{m=t.apply(this,d)}catch(p){const g=p;if(h&&a)throw g;return o(g)}h||(m&&m.then&&typeof m.then=="function"?m.then(c,o):m instanceof Error?o(m):c(m))}function o(d,...h){a||(a=!0,l(d,...h))}function c(d){o(null,d)}}const Gn={basename:KA,dirname:ZA,extname:PA,join:JA,sep:"/"};function KA(t,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');oi(t);let a=0,u=-1,o=t.length,c;if(l===void 0||l.length===0||l.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(c){a=o+1;break}}else u<0&&(c=!0,u=o+1);return u<0?"":t.slice(a,u)}if(l===t)return"";let d=-1,h=l.length-1;for(;o--;)if(t.codePointAt(o)===47){if(c){a=o+1;break}}else d<0&&(c=!0,d=o+1),h>-1&&(t.codePointAt(o)===l.codePointAt(h--)?h<0&&(u=o):(h=-1,u=d));return a===u?u=d:u<0&&(u=t.length),t.slice(a,u)}function ZA(t){if(oi(t),t.length===0)return".";let l=-1,a=t.length,u;for(;--a;)if(t.codePointAt(a)===47){if(u){l=a;break}}else u||(u=!0);return l<0?t.codePointAt(0)===47?"/":".":l===1&&t.codePointAt(0)===47?"//":t.slice(0,l)}function PA(t){oi(t);let l=t.length,a=-1,u=0,o=-1,c=0,d;for(;l--;){const h=t.codePointAt(l);if(h===47){if(d){u=l+1;break}continue}a<0&&(d=!0,a=l+1),h===46?o<0?o=l:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||a<0||c===0||c===1&&o===a-1&&o===u+1?"":t.slice(o,a)}function JA(...t){let l=-1,a;for(;++l0&&t.codePointAt(t.length-1)===47&&(a+="/"),l?"/"+a:a}function ek(t,l){let a="",u=0,o=-1,c=0,d=-1,h,m;for(;++d<=t.length;){if(d2){if(m=a.lastIndexOf("/"),m!==a.length-1){m<0?(a="",u=0):(a=a.slice(0,m),u=a.length-1-a.lastIndexOf("/")),o=d,c=0;continue}}else if(a.length>0){a="",u=0,o=d,c=0;continue}}l&&(a=a.length>0?a+"/..":"..",u=2)}else a.length>0?a+="/"+t.slice(o+1,d):a=t.slice(o+1,d),u=d-o-1;o=d,c=0}else h===46&&c>-1?c++:c=-1}return a}function oi(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const tk={cwd:nk};function nk(){return"/"}function jc(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function rk(t){if(typeof t=="string")t=new URL(t);else if(!jc(t)){const l=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw l.code="ERR_INVALID_ARG_TYPE",l}if(t.protocol!=="file:"){const l=new TypeError("The URL must be of scheme file");throw l.code="ERR_INVALID_URL_SCHEME",l}return lk(t)}function lk(t){if(t.hostname!==""){const u=new TypeError('File URL host must be "localhost" or empty on darwin');throw u.code="ERR_INVALID_FILE_URL_HOST",u}const l=t.pathname;let a=-1;for(;++a0){let[v,...D]=g;const A=u[x][1];Hc(A)&&Hc(v)&&(v=Uc(!0,A,v)),u[x]=[p,v,...D]}}}}const ok=new Ic().freeze();function Yc(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function $c(t,l){if(typeof l!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Fc(t,l){if(l)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Gg(t){if(!Hc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ig(t,l,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+l+"` instead")}function Iu(t){return sk(t)?t:new Vg(t)}function sk(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function ck(t){return typeof t=="string"||fk(t)}function fk(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const dk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Yg=[],$g={allowDangerousHtml:!0},hk=/^(https?|ircs?|mailto|xmpp)$/i,pk=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function mk(t){const l=t.allowedElements,a=t.allowElement,u=t.children||"",o=t.className,c=t.components,d=t.disallowedElements,h=t.rehypePlugins||Yg,m=t.remarkPlugins||Yg,p=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...$g}:$g,g=t.skipHtml,b=t.unwrapDisallowed,x=t.urlTransform||gk,v=ok().use(Kw).use(m).use(YA,p).use(h),D=new Vg;typeof u=="string"&&(D.value=u);for(const N of pk)Object.hasOwn(t,N.from)&&(""+N.from+(N.to?"use `"+N.to+"` instead":"remove it")+dk+N.id,void 0);const A=v.parse(D);let U=v.runSync(A,D);return o&&(U={type:"element",tagName:"div",properties:{className:o},children:U.type==="root"?U.children:[U]}),Bg(U,T),LC(U,{Fragment:Ye.Fragment,components:c,ignoreInvalidStyle:!0,jsx:Ye.jsx,jsxs:Ye.jsxs,passKeys:!0,passNode:!0});function T(N,O,L){if(N.type==="raw"&&L&&typeof O=="number")return g?L.children.splice(O,1):L.children[O]={type:"text",value:N.value},O;if(N.type==="element"){let _;for(_ in Ec)if(Object.hasOwn(Ec,_)&&Object.hasOwn(N.properties,_)){const R=N.properties[_],G=Ec[_];(G===null||G.includes(N.tagName))&&(N.properties[_]=x(String(R||""),_,N))}}if(N.type==="element"){let _=l?!l.includes(N.tagName):d?d.includes(N.tagName):!1;if(!_&&a&&typeof O=="number"&&(_=!a(N,O,L)),_&&L&&typeof O=="number")return b&&N.children?L.children.splice(O,1,...N.children):L.children.splice(O,1),O}}}function gk(t){const l=t.indexOf(":"),a=t.indexOf("?"),u=t.indexOf("#"),o=t.indexOf("/");return l<0||o>-1&&l>o||a>-1&&l>a||u>-1&&l>u||hk.test(t.slice(0,l))?t:""}const yk=(...t)=>l=>{t.forEach(a=>{typeof a=="function"?a(l):a&&(a.current=l)})},Fg=t=>t.scrollHeight-t.clientHeight-t.scrollTop,bk=t=>{t.scrollTop=t.scrollHeight},Sk=ot.div({overflow:"auto"}),vk=j.forwardRef(function({children:l,threshold:a=2,className:u},o){const c=j.useRef(),[d,h]=j.useState(l),m=j.useRef(null);return j.useLayoutEffect(()=>{c.current&&(m.current=Fg(c.current){if(!c.current)return;const p=Fg(c.current){var d;const[u,o]=j.useState(-1);j.useEffect(()=>{o(-1)},[l,a]),j.useEffect(()=>{const h=a[u+1];if(!l||!h)return()=>{};const m=setTimeout(()=>{o(u+1)},h.delay);return()=>{clearTimeout(m)}},[l,u,a]);const c=(d=a[u])==null?void 0:d.text;return j.createElement(xk,{"aria-atomic":"true","aria-live":"polite"},l?c:t)},Tk=ot.div(({theme:t})=>({width:"100%",height:"100%",border:`1px solid ${t.custom.colors.silverGrayLight}`,backgroundColor:t.custom.colors.lightGray1,display:"flex",flexDirection:"column"})),wk=ot(vk)({display:"flex",flexDirection:"column",flex:1,padding:"24px",paddingBottom:"0px",overflow:"auto"}),Xg=ot.div(({reverse:t})=>[{margin:"8px 0",display:"flex",width:"100%",flexDirection:t?"row-reverse":"row"}]),Qg=ot.div({}),Kg=ot.div(({theme:t})=>({border:`1px solid ${t.custom.colors.silverGrayLight}`,backgroundColor:t.custom.colors.white,borderRadius:"24px",padding:"4px 16px",...t.typography.body2,"p:first-of-type":{marginTop:0},"p:last-of-type":{marginBottom:0},a:{color:t.custom.colors.mitRed,textDecoration:"none"},"a:hover":{color:t.custom.colors.red,textDecoration:"underline"}})),Ak=ot.div({alignSelf:"flex-end",display:"flex",flexDirection:"column",gap:"4px"}),kk=ot.button(({theme:t})=>({border:`1px solid ${t.custom.colors.silverGrayLight}`,backgroundColor:t.custom.colors.white,borderRadius:"24px",padding:"4px 16px",...t.typography.body2,cursor:"pointer","&:hover":{backgroundColor:t.custom.colors.lightGray1}})),_k=ot.div(({theme:t})=>({display:"flex",justifyContent:"space-around",padding:"12px 24px",backgroundColor:t.custom.colors.white})),Ok=ot.form(()=>({display:"flex",width:"80%",gap:"12px",alignItems:"center"})),Rk=ot.span(({theme:t})=>({display:"inline-flex",gap:"4px",".MuiSkeleton-root":{backgroundColor:t.custom.colors.silverGray}})),Dk=()=>j.createElement(Rk,null,j.createElement(Gs,{variant:"circular",width:"8px",height:"8px"}),j.createElement(Gs,{variant:"circular",width:"8px",height:"8px"}),j.createElement(Gs,{variant:"circular",width:"8px",height:"8px"})),Pr={root:"MitAiChat--root",conversationStarter:"MitAiChat--conversationStarter",messagesContainer:"MitAiChat--messagesContainer",messageRow:"MitAiChat--messageRow",message:"MitAiChat--message",avatar:"MitAiChat--avatar",input:"MitAiChat--input"},Mk=function({className:l,conversationStarters:a,requestOpts:u,initialMessages:o,parseContent:c,srLoadingMessages:d}){var _;const[h,m]=j.useState(!0),p=j.useRef(null),g=j.useMemo(()=>{const R=Math.random().toString().slice(2);return o.map((G,ne)=>({...G,id:`initial-${R}-${ne}`}))},[o]),{messages:b,input:x,handleInputChange:v,handleSubmit:D,append:A,isLoading:U}=uC(u,{initialMessages:g}),T=j.useMemo(()=>{const R=g.map(G=>G.id);return b.map(G=>{if(G.role==="assistant"&&!R.includes(G.id)){const ne=c?c(G.content):G.content;return{...G,content:ne}}return G})},[c,b,g]),N=!h&&((_=T[T.length-1])==null?void 0:_.role)==="user",O=()=>{var R;(R=p.current)==null||R.scrollBy({behavior:"instant",top:p.current.scrollHeight})},L=T[T.length-1];return j.createElement(Tk,{className:OE(l,Pr.root)},j.createElement(wk,{className:Pr.messagesContainer,ref:p},T.map(R=>j.createElement(Xg,{key:R.id,reverse:R.role==="user","data-chat-role":R.role,className:Pr.messageRow},j.createElement(Qg,null),j.createElement(Kg,{className:Pr.message},j.createElement(mk,null,R.content)))),h?j.createElement(Ak,null,a==null?void 0:a.map(R=>j.createElement(kk,{className:Pr.conversationStarter,key:R.content,onClick:()=>{m(!1),O(),A({role:"user",content:R.content})}},R.content))):null,N?j.createElement(Xg,{key:"loading"},j.createElement(Qg,{className:Pr.avatar}),j.createElement(Kg,null,j.createElement(Dk,null))):null),j.createElement(_k,null,j.createElement(Ok,{onSubmit:R=>{m(!1),O(),D(R)}},j.createElement(NE,{className:Pr.input,placeholder:"Type a message...",name:"message",sx:{flex:1},value:x,onChange:v}),j.createElement(Qs,{"aria-label":"Send",type:"submit",disabled:U||!x},j.createElement(IE,null)))),j.createElement(Ck,{isLoading:U,loadingMessages:d,message:L.role==="assistant"?L.content:""}))},zk={defaultProps:{disableRipple:!0},styleOverrides:{root:{":focus-visible":{outline:"revert"}}}},Le={mitRed:"#750014",brightRed:"#FF1423",black:"#000000",white:"#FFFFFF",darkGray2:"#212326",darkGray1:"#40464C",silverGrayDark:"#626A73",silverGray:"#8B959E",silverGrayLight:"#B8C2CC",lightGray2:"#DDE1E6",lightGray1:"#F3F4F8",navGray:"#303337",darkPink:"#750062",pink:"#FF14F0",lightPink:"#FFB3FF",darkPurple:"#3E006B",purple:"#93F",lightPurple:"#BFB3FF",darkBlue:"#002896",blue:"#1966FF",lightBlue:"#99EBFF",darkGreen:"#004D1A",green:"#00AD00",lightGreen:"#AF3",darkRed:"#83192A",red:"#A31F34",lightRed:"#D02E44",orange:"#FAB005",yellow:"#FFEB00"},Nk={defaultProps:{size:"medium",color:"default",variant:"outlined",deleteIcon:j.createElement(GE,{"aria-hidden":"true"})},styleOverrides:{root:{borderRadius:"100vh",borderWidth:"1px"},deleteIcon:{"&:hover":{color:"inherit"},"&.MuiChip-deleteIconLarge":{width:"16px",height:"16px"},"&.MuiChip-deleteIconMedium":{width:"14px",height:"14px"},margin:"0 -2px 0 8px",color:"inherit"},icon:{margin:"0 8px 0 -2px",color:"inherit","&.MuiChip-iconLarge":{width:"16px",height:"16px"},"&.MuiChip-iconMedium":{width:"14px",height:"14px"}}},variants:[{props:{size:"medium"},style:({theme:t})=>({...t.typography.body3,boxSizing:"border-box",height:"24px",paddingRight:"12px",paddingLeft:"12px",".MuiChip-label":{paddingLeft:"0px",paddingRight:"0px"}})},{props:{size:"large"},style:({theme:t})=>({...t.typography.body2,height:"32px",paddingLeft:"16px",paddingRight:"16px",".MuiChip-label":{paddingLeft:"0px",paddingRight:"0px"}})},{props:{variant:"outlined"},style:{borderColor:Le.silverGrayLight,color:Le.darkGray1,"&.Mui-focusVisible":{backgroundColor:"transparent"},"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover":{color:Le.darkGray1,borderColor:Le.silverGrayDark,backgroundColor:"transparent"}}},{props:{variant:"outlinedWhite"},style:{backgroundColor:"white",border:"1px solid",borderColor:Le.silverGrayLight,color:Le.darkGray1,"&.Mui-focusVisible":{backgroundColor:"white"},"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover":{color:Le.darkGray1,borderColor:Le.silverGrayDark,backgroundColor:"white"}}},{props:{variant:"gray"},style:{backgroundColor:Le.lightGray2,border:"none",color:Le.darkGray2,"&.Mui-focusVisible":{backgroundColor:Le.lightGray2},"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover":{color:Le.darkGray1,backgroundColor:Le.silverGrayLight}}},{props:{variant:"dark"},style:{backgroundColor:Le.silverGrayDark,border:"none",color:Le.white,"&.Mui-focusVisible":{backgroundColor:Le.silverGrayDark},"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover":{backgroundColor:Le.darkGray1}}},{props:{variant:"darker"},style:{backgroundColor:Le.darkGray2,border:`1px solid ${Le.darkGray1}`,color:Le.white,"&.Mui-focusVisible":{backgroundColor:Le.darkGray2},"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover":{backgroundColor:Le.black,border:`1px solid ${Le.silverGray}`}}},{props:{variant:"filled"},style:{backgroundColor:Le.mitRed,border:"none",color:Le.white,"&.Mui-focusVisible":{backgroundColor:Le.mitRed},"&.MuiChip-clickable:hover, &.MuiChip-deletable:hover":{backgroundColor:Le.red}}}]},Bk={colors:Le,dimensions:{headerHeight:"72px",headerHeightSm:"60px"}},Lk={values:{xs:0,sm:600,md:900,lg:1320,xl:1536}},Zg={custom:Bk,palette:{primary:{main:Le.mitRed,light:Le.lightRed,active:Le.red,contrastText:Le.white},secondary:{light:Le.darkGray2,active:Le.silverGrayDark,main:Le.black,contrastText:Le.white}},shape:{borderRadius:8},spacing:8,typography:Lp,breakpoints:Lk,components:{MuiButtonBase:zk,MuiTypography:BE,MuiTabPanel:{styleOverrides:{root:{padding:"0px"}}},MuiMenu:{styleOverrides:{paper:{borderRadius:"4px"}}},MuiAutocomplete:{styleOverrides:{paper:{borderRadius:"4px"},popupIndicator:{paddingRight:0,marginRight:0}}},MuiChip:Nk}},Uk=(t=>ku({...Zg,custom:{...Zg.custom,...t==null?void 0:t.custom}}))(),Hk=({children:t,theme:l=Uk})=>j.createElement(rE,{theme:l},t);ot.span(({theme:t})=>({color:t.custom.colors.lightRed,marginLeft:"4px"})),ot.div(({theme:t,error:l})=>[{...t.typography.body2,color:l?t.custom.colors.lightRed:t.custom.colors.silverGrayDark},l&&{textIndent:"-24px",paddingLeft:"24px","> svg:first-of-type":{marginRight:"4px",transform:"translateY(2px)",width:"18px",height:"18px",position:"relative",top:"2px"}}]),ot.div(({fullWidth:t})=>[{display:"inline-flex",flexDirection:"column",alignItems:"start","> *:not(:last-child)":{marginBottom:"4px"}},t&&{width:"100%"}]);const jk=t=>{const l=t.root;Hb.createRoot(l).render(j.createElement(Hk,null,j.createElement(Mk,{...t})))};xl.aiChat=jk,Object.defineProperty(xl,Symbol.toStringTag,{value:"Module"})});
diff --git a/src/ol_openedx_chat/static/js/ai_chat.js b/src/ol_openedx_chat/static/js/ai_chat.js
new file mode 100644
index 00000000..51118022
--- /dev/null
+++ b/src/ol_openedx_chat/static/js/ai_chat.js
@@ -0,0 +1,37 @@
+function AiChatAsideView(runtime, element, block_element, init_args) {
+ console.log("INSIDE AiChatAsideView")
+ const INITIAL_MESSAGES = [
+ {
+ content: "Hi! What are you interested in learning about?",
+ role: "assistant",
+ },
+ ]
+
+ const STARTERS = [
+ { content: "I'm interested in quantum computing" },
+ { content: "I want to understand global warming. " },
+ { content: "I am curious about AI applications for business" },
+ ]
+
+ const REQUEST_OPTS = {
+ apiUrl: "http://ai.open.odl.local:8002/http/recommendation_agent/",
+ transformBody(messages) {
+ const message = messages[messages.length - 1].content
+ return { message }
+ },
+ }
+
+ const el = document.getElementById("app-root")
+ /**
+ * Accepts all options of https://mitodl.github.io/smoot-design/?path=/docs/smoot-design-aichat--docs,\
+ * plus root element
+ */
+ aiChat.aiChat({
+ root: el,
+ initialMessages: INITIAL_MESSAGES,
+ conversationStarters: STARTERS,
+ requestOpts: REQUEST_OPTS,
+ className: "ai-chat",
+ })
+ console.log(init_args)
+}