132 lines
219 KiB
JavaScript
132 lines
219 KiB
JavaScript
import{o as e,r as t,t as n}from"./request-DWqS4XYU.js";import{Cn as r,Er as i,Ft as a,In as o,Ln as s,M as c,N as l,Nn as u,Nr as d,Pr as f,Rn as p,Wn as m,_n as h,jr as g,n as _,t as v,tr as y,wn as b}from"./jsx-runtime-Dk2XcqH2.js";import{o as x,s as S}from"./chunk-OB3PAWPO-6cTVLEZE.js";import{t as C}from"./global-Gbg-XsXS.js";import{t as w}from"./typography-DvDsdb2f.js";import{t as T}from"./tooltip-Up9y7xD6.js";import{t as E}from"./config-provider-C5VHLPRf.js";import{r as D,t as O}from"./PlusOutlined-B7_Swmw6.js";import{t as k}from"./space-DZlFkFGY.js";import{t as A}from"./button-CdrnzceP.js";import{t as j}from"./card-CAlqEh_K.js";import{t as ee}from"./divider-D8FfJHwP.js";import{t as M}from"./dropdown-DwgqHpVM.js";import{t as N}from"./flex-CMoo-fhP.js";import{t as te}from"./input-DXwsBeeJ.js";import{r as ne}from"./CopyOutlined-DB3MBLEL.js";import{t as re}from"./UserOutlined-BNDq6QEe.js";import{t as ie}from"./useTranslation-BktiQivz.js";import{$ as ae,Ht as P,K as oe,ct as se,et as F,lt as ce,mt as I,rn as le,tt as ue}from"./index-kOY0oRfZ.js";import{t as de}from"./agent-VZOA_xNn.js";function fe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function L(e){if(Array.isArray(e))return e}function pe(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function R(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(e,t){return L(e)||pe(e,t)||he(e,t)||R()}function he(e,t){if(e){if(typeof e==`string`)return fe(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fe(e,t):void 0}}var ge=Object.entries,_e=Object.setPrototypeOf,ve=Object.isFrozen,ye=Object.getPrototypeOf,be=Object.getOwnPropertyDescriptor,z=Object.freeze,B=Object.seal,xe=Object.create,Se=typeof Reflect<`u`&&Reflect,Ce=Se.apply,we=Se.construct;z||=function(e){return e},B||=function(e){return e},Ce||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},we||=function(e){return new e(...[...arguments].slice(1))};var Te=U(Array.prototype.forEach),Ee=U(Array.prototype.lastIndexOf),De=U(Array.prototype.pop),Oe=U(Array.prototype.push),ke=U(Array.prototype.splice),Ae=Array.isArray,je=U(String.prototype.toLowerCase),Me=U(String.prototype.toString),Ne=U(String.prototype.match),Pe=U(String.prototype.replace),Fe=U(String.prototype.indexOf),Ie=U(String.prototype.trim),Le=U(Number.prototype.toString),Re=U(Boolean.prototype.toString),ze=typeof BigInt>`u`?null:U(BigInt.prototype.toString),Be=typeof Symbol>`u`?null:U(Symbol.prototype.toString),V=U(Object.prototype.hasOwnProperty),Ve=U(Object.prototype.toString),H=U(RegExp.prototype.test),He=Ue(TypeError);function U(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ce(e,t,n)}}function Ue(e){return function(){return we(e,[...arguments])}}function W(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:je;if(_e&&_e(e,null),!Ae(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ve(t)||(t[r]=e),i=e)}e[i]=!0}return e}function We(e){for(let t=0;t<e.length;t++)V(e,t)||(e[t]=null);return e}function Ge(e){let t=xe(null);for(let r of ge(e)){var n=me(r,2);let i=n[0],a=n[1];V(e,i)&&(t[i]=Ae(a)?We(a):a&&typeof a==`object`&&a.constructor===Object?Ge(a):a)}return t}function Ke(e){switch(typeof e){case`string`:return e;case`number`:return Le(e);case`boolean`:return Re(e);case`bigint`:return ze?ze(e):`0`;case`symbol`:return Be?Be(e):`Symbol()`;case`undefined`:return Ve(e);case`function`:case`object`:{if(e===null)return Ve(e);let t=e,n=qe(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Ve(e)}return Ve(e)}default:return Ve(e)}}function qe(e,t){for(;e!==null;){let n=be(e,t);if(n){if(n.get)return U(n.get);if(typeof n.value==`function`)return U(n.value)}e=ye(e)}function n(){return null}return n}function Je(e){try{return H(e,``),!0}catch{return!1}}var Ye=z(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Xe=z(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Ze=z([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Qe=z([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),$e=z(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),et=z([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),tt=z([`#text`]),nt=z(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),rt=z(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),it=z(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),at=z([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ot=B(/{{[\w\W]*|^[\w\W]*}}/g),st=B(/<%[\w\W]*|^[\w\W]*%>/g),ct=B(/\${[\w\W]*/g),lt=B(/^data-[\-\w.\u00B7-\uFFFF]+$/),ut=B(/^aria-[\-\w]+$/),dt=B(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ft=B(/^(?:\w+script|data):/i),pt=B(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mt=B(/^html$/i),ht=B(/^[a-z][.\w]*(-[.\w]+)+$/i),gt=B(/<[/\w!]/g),_t=B(/<[/\w]/g),vt=B(/<\/no(script|embed|frames)/i),yt=B(/\/>/i),bt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},xt=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],St=z(W({},xt)),Ct=function(){let e={};return Te(xt,t=>{e[t]=B(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),z(e)}(),wt=function(){return typeof window>`u`?null:window},Tt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Et=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Dt=function(e,t,n,r){return V(e,t)&&Ae(e[t])?W(r.base?Ge(r.base):{},e[t],r.transform):n},Ot=function(e,t,n){let r=V(e,t)?e[t]:void 0;return r&&typeof r==`object`?Ge(r):n()};function kt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wt(),t=e=>kt(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==bt.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=qe(d,`cloneNode`),p=qe(d,`remove`),m=qe(d,`removeAttributeNode`),h=qe(d,`nextSibling`),g=qe(d,`childNodes`),_=qe(d,`parentNode`),v=qe(d,`shadowRoot`),y=qe(d,`attributes`),b=o&&o.prototype?qe(o.prototype,`nodeType`):null,x=o&&o.prototype?qe(o.prototype,`nodeName`):null,S=o&&o.prototype?qe(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw He(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},ee=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},M=function(){return O||=(D=Tt(u,i),!0),D},N=n,te=N.implementation,ne=N.createNodeIterator,re=N.createDocumentFragment,ie=N.getElementsByTagName,ae=r.importNode,P=Et();t.isSupported=typeof ge==`function`&&typeof _==`function`&&te&&te.createHTMLDocument!==void 0;let oe=ot,se=st,F=ct,ce=lt,I=ut,le=ft,ue=pt,de=ht,fe=dt,L=null,pe=W({},[...Ye,...Xe,...Ze,...$e,...tt]),R=null,me=W({},[...nt,...rt,...it,...at]),he=Object.seal(xe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_e=null,ve=null,ye=Object.seal(xe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),be=!0,Se=!0,Ce=!1,we=!0,Le=!1,Re=!0,ze=!1,Be=!1,Ve=null,U=null,Ue=!1,We=!1,xt=!1,At=!1,jt=!0,G=!1,Mt=`user-content-`,Nt=!0,Pt=!1,K={},Ft=null,q=W({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),It=null,Lt=W({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Rt=null,zt=W({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Bt=`http://www.w3.org/1998/Math/MathML`,Vt=`http://www.w3.org/2000/svg`,Ht=`http://www.w3.org/1999/xhtml`,Ut=Ht,Wt=!1,Gt=null,Kt=W({},[Bt,Vt,Ht],Me),qt=z([`mi`,`mo`,`mn`,`ms`,`mtext`]),Jt=W({},qt),Yt=z([`annotation-xml`]),Xt=W({},Yt),Zt=W({},[`title`,`style`,`font`,`a`,`script`]),Qt=null,$t=[`application/xhtml+xml`,`text/html`],J=null,en=null,tn=n.createElement(`form`),nn=function(e){return e instanceof RegExp||e instanceof Function},rn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(en&&en===e)return;(!e||typeof e!=`object`)&&(e={}),e=Ge(e),Qt=$t.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,J=Qt===`application/xhtml+xml`?Me:je,L=Dt(e,`ALLOWED_TAGS`,pe,{transform:J}),R=Dt(e,`ALLOWED_ATTR`,me,{transform:J}),Gt=Dt(e,`ALLOWED_NAMESPACES`,Kt,{transform:Me}),Rt=Dt(e,`ADD_URI_SAFE_ATTR`,zt,{transform:J,base:zt}),It=Dt(e,`ADD_DATA_URI_TAGS`,Lt,{transform:J,base:Lt}),Ft=Dt(e,`FORBID_CONTENTS`,q,{transform:J}),_e=Dt(e,`FORBID_TAGS`,Ge({}),{transform:J}),ve=Dt(e,`FORBID_ATTR`,Ge({}),{transform:J}),K=V(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Ge(e.USE_PROFILES):e.USE_PROFILES:!1,be=e.ALLOW_ARIA_ATTR!==!1,Se=e.ALLOW_DATA_ATTR!==!1,Ce=e.ALLOW_UNKNOWN_PROTOCOLS||!1,we=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Le=e.SAFE_FOR_TEMPLATES||!1,Re=e.SAFE_FOR_XML!==!1,ze=e.WHOLE_DOCUMENT||!1,We=e.RETURN_DOM||!1,xt=e.RETURN_DOM_FRAGMENT||!1,At=e.RETURN_TRUSTED_TYPE||!1,Ue=e.FORCE_BODY||!1,jt=e.SANITIZE_DOM!==!1,G=e.SANITIZE_NAMED_PROPS||!1,Nt=e.KEEP_CONTENT!==!1,Pt=e.IN_PLACE||!1,fe=Je(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:dt,Ut=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ht,Jt=Ot(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>W({},qt)),Xt=Ot(e,`HTML_INTEGRATION_POINTS`,()=>W({},Yt));let t=Ot(e,`CUSTOM_ELEMENT_HANDLING`,()=>xe(null));if(he=xe(null),V(t,`tagNameCheck`)&&nn(t.tagNameCheck)&&(he.tagNameCheck=t.tagNameCheck),V(t,`attributeNameCheck`)&&nn(t.attributeNameCheck)&&(he.attributeNameCheck=t.attributeNameCheck),V(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(he.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),B(he),Le&&(Se=!1),xt&&(We=!0),K&&(L=W({},tt),R=xe(null),K.html===!0&&(W(L,Ye),W(R,nt)),K.svg===!0&&(W(L,Xe),W(R,rt),W(R,at)),K.svgFilters===!0&&(W(L,Ze),W(R,rt),W(R,at)),K.mathMl===!0&&(W(L,$e),W(R,it),W(R,at))),ye.tagCheck=null,ye.attributeCheck=null,V(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?ye.tagCheck=e.ADD_TAGS:Ae(e.ADD_TAGS)&&(L===pe&&(L=Ge(L)),W(L,e.ADD_TAGS,J))),V(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?ye.attributeCheck=e.ADD_ATTR:Ae(e.ADD_ATTR)&&(R===me&&(R=Ge(R)),W(R,e.ADD_ATTR,J))),V(e,`ADD_FORBID_CONTENTS`)&&Ae(e.ADD_FORBID_CONTENTS)&&(Ft===q&&(Ft=Ge(Ft)),W(Ft,e.ADD_FORBID_CONTENTS,J)),Nt&&(L[`#text`]=!0),ze&&W(L,[`html`,`head`,`body`]),L.table&&(W(L,[`tbody`]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw He(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw He(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=j(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=M()),T&&typeof E==`string`&&(E=j(``)));z&&z(e),en=e},an=W({},[...Xe,...Ze,...Qe]),on=W({},[...$e,...et]),sn=function(e,t,n){return t.namespaceURI===Ht?e===`svg`:t.namespaceURI===Bt?e===`svg`&&(n===`annotation-xml`||Jt[n]):!!an[e]},cn=function(e,t,n){return t.namespaceURI===Ht?e===`math`:t.namespaceURI===Vt?e===`math`&&Xt[n]:!!on[e]},ln=function(e,t,n){return t.namespaceURI===Vt&&!Xt[n]||t.namespaceURI===Bt&&!Jt[n]?!1:!on[e]&&(Zt[e]||!an[e])},un=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ut,tagName:`template`});let n=je(e.tagName),r=je(t.tagName);return Gt[e.namespaceURI]?e.namespaceURI===Vt?sn(n,t,r):e.namespaceURI===Bt?cn(n,t,r):e.namespaceURI===Ht?ln(n,t,r):!!(Qt===`application/xhtml+xml`&&Gt[e.namespaceURI]):!1},dn=function(e){Oe(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw He(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},fn=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},pn=function(e){gn(e);let t=g(e);if(t){let e=[];Te(t,t=>{Oe(e,t)}),Te(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&fn(e,r,i)}},mn=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Oe(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(We||xt)try{dn(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},hn=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||R[J(i)]||fn(e,r,i)}},gn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===bt.element&&hn(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},_n=function(e,t){return Re?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},vn=function(e){if(!Re)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===bt.processingInstruction||n===bt.comment&&H(_t,e.data)){try{p(e)}catch{}continue}if(n===bt.element){let t=e,n=J(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&_n(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},yn=function(e){let t=null,r=null;if(Ue)e=`<remove></remove>`+e;else{let t=Ne(e,/^[\r\n\t ]+/);r=t&&t[0]}Qt===`application/xhtml+xml`&&Ut===Ht&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?j(e):e;if(Ut===Ht)try{t=new l().parseFromString(i,Qt)}catch{}if(!t||!t.documentElement){t=te.createDocument(Ut,`template`,null);try{t.documentElement.innerHTML=Wt?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ut===Ht?ie.call(t,ze?`html`:`body`)[0]:ze?t.documentElement:a},bn=function(e){let t=S?S(e):e.ownerDocument;return ne.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},xn=function(e){return e=Pe(e,oe,` `),e=Pe(e,se,` `),e=Pe(e,F,` `),e},Sn=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ne.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=xn(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Te(i,e=>{wn(e.content)&&Sn(e.content)})},Cn=function(e){let t=x?x(e):null;return typeof t!=`string`||J(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},wn=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===bt.documentFragment}catch{return!1}},Tn=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function En(e,n,r){e.length!==0&&Te(e,e=>{e.call(t,n,r,en)})}let Dn=function(e,t){return!!(Re&&e.hasChildNodes()&&!Tn(e.firstElementChild)&&H(gt,e.textContent)&&H(gt,e.innerHTML)||Re&&e.namespaceURI===Ht&&St[t]&&(Tn(e.firstElementChild)||typeof e.textContent==`string`&&H(Ct[t],e.textContent))||e.nodeType===bt.processingInstruction||Re&&e.nodeType===bt.comment&&H(_t,e.data))},On=function(e,t){return e instanceof RegExp?H(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},kn=function(e,t,n){if(!_e[t]&&Fn(t)&&On(he.tagNameCheck,t))return!1;if(Nt&&!Ft[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return dn(e),!0},An=function(e,t,n,r){return e.length===0?t:t===n||t===r?Ge(t):t},jn=function(e,t){return e===t||_(e)!==null?!1:(Pt&&gn(e),!0)},Mn=function(e,n){if(En(P.beforeSanitizeElements,e,null),jn(e,n))return!0;if(Cn(e))return dn(e),!0;let r=J(w(e));if(L=An(P.uponSanitizeElement,L,pe,Ve),En(P.uponSanitizeElement,e,{tagName:r,allowedTags:L}),jn(e,n))return!0;if(Dn(e,r))return dn(e),!0;if(_e[r]||!(ye.tagCheck instanceof Function&&ye.tagCheck(r))&&!L[r]){let t=kn(e,r,n);return t===!1&&En(P.afterSanitizeElements,e,null),t}if(C(e)===bt.element&&!un(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&H(vt,e.innerHTML))return dn(e),!0;if(Le&&e.nodeType===bt.text){let n=xn(e.textContent);e.textContent!==n&&(Oe(t.removed,{element:e.cloneNode()}),e.textContent=n)}return En(P.afterSanitizeElements,e,null),!1},Nn=function(e,t,r){if(ve[t]||_n(t,e)||jt&&(t===`id`||t===`name`)&&(r in n||r in tn))return!1;let i=R[t]||ye.attributeCheck instanceof Function&&ye.attributeCheck(t,e);return Se&&H(ce,t)||be&&H(I,t)?!0:i?Rt[t]||H(fe,Pe(r,ue,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Fe(r,`data:`)===0&&It[e]||Ce&&!H(le,Pe(r,ue,``))?!0:!r:Fn(e)&&On(he.tagNameCheck,e)&&On(he.attributeNameCheck,t,e)||t===`is`&&he.allowCustomizedBuiltInElements&&On(he.tagNameCheck,r)},Pn=W({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Fn=function(e){return!Pn[je(e)]&&H(de,e)},In=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return ee(r)}return r},Ln=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Cn(e)||(dn(e),!1)}catch{return mn(t,e),!1}},Rn=function(e){En(P.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||Cn(e))return;R=An(P.uponSanitizeAttribute,R,me,U);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},i=n.length,a=J(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=J(s),d=l,f=s===`value`?d:Ie(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,En(P.uponSanitizeAttribute,e,r),f=r.attrValue,G&&(u===`id`||u===`name`)&&Fe(f,Mt)!==0&&(mn(s,e,o),f=Mt+f,p=!0),Re&&H(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){mn(s,e,o);continue}if(u===`attributename`&&Ne(f,`href`)){mn(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){mn(s,e,o);continue}if(!we&&H(yt,f)){mn(s,e,o);continue}if(Le&&(f=xn(f)),!Nn(a,u,f)){mn(s,e,o);continue}f=In(a,u,c,f),f!==d&&Ln(e,s,c,f)&&p&&De(t.removed)}}En(P.afterSanitizeAttributes,e,null)},zn=function(e){let t=null,n=bn(e);for(En(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(En(P.uponSanitizeShadowNode,t,null),Mn(t,e),Rn(t),wn(t.content)&&zn(t.content),C(t)===bt.element){let e=v(t);wn(e)&&(Bn(e),zn(e))}En(P.afterSanitizeShadowDOM,e,null)},Bn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zn(e.shadow);continue}let n=e.node,r=C(n)===bt.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&J(e)===`template`){let e=n.content;wn(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);wn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Wt=!e,Wt&&(e=`<!-->`),typeof e!=`string`&&!Tn(e)&&(e=Ke(e),typeof e!=`string`))throw He(`dirty is not a string, aborting`);if(!t.isSupported)return e;Be?(L=Ve,R=U):rn(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(L=Ge(L)),P.uponSanitizeAttribute.length>0&&(R=Ge(R)),t.removed=[];let c=Pt&&typeof e!=`string`&&Tn(e);if(c){vn(e);let t=w(e);if(typeof t==`string`){let n=J(t);if(!L[n]||_e[n])throw pn(e),He(`root node is forbidden and cannot be sanitized in-place`)}if(Cn(e))throw pn(e),He(`root node is clobbered and cannot be sanitized in-place`);try{Bn(e)}catch(t){throw pn(e),t}}else if(Tn(e))i=yn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===bt.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bn(i);else{if(!We&&!Le&&!ze&&e.indexOf(`<`)===-1)return T&&At?j(e):e;if(i=yn(e),!i)return We?null:At?E:``}i&&Ue&&dn(i.firstChild);let l=c?e:i;try{let e=bn(l);for(;o=e.nextNode();)Mn(o,l),Rn(o),wn(o.content)&&zn(o.content)}catch(n){throw c&&(pn(e),Te(t.removed,e=>{e.element&&gn(e.element)})),n}if(c)return Te(t.removed,e=>{e.element&&gn(e.element)}),Le&&Sn(e),e;if(We){if(Le&&Sn(i),xt)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=ae.call(r,s,!0)),s}let u=ze?i.outerHTML:i.innerHTML;return ze&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&H(mt,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
`+u),Le&&(u=xn(u)),T&&At?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};rn(e),Be=!0,Ve=L,U=R},t.clearConfig=function(){en=null,Be=!1,Ve=null,U=null,T=D,E=``},t.isValidAttribute=function(e,t,n){en||rn({});let r=J(e),i=J(t);return Nn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&V(P,e)&&Oe(P[e],t)},t.removeHook=function(e,t){if(V(P,e)){if(t!==void 0){let n=Ee(P[e],t);return n===-1?void 0:ke(P[e],n,1)[0]}return De(P[e])}},t.removeHooks=function(e){V(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=Et()},t}var At=kt(),jt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var t=`accept acceptCharset accessKey action allowFullScreen allowTransparency
|
|
alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
|
|
charSet checked classID className colSpan cols content contentEditable contextMenu
|
|
controls coords crossOrigin data dateTime default defer dir disabled download draggable
|
|
encType form formAction formEncType formMethod formNoValidate formTarget frameBorder
|
|
headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity
|
|
is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media
|
|
mediaGroup method min minLength multiple muted name noValidate nonce open
|
|
optimum pattern placeholder poster preload radioGroup readOnly rel required
|
|
reversed role rowSpan rows sandbox scope scoped scrolling seamless selected
|
|
shape size sizes span spellCheck src srcDoc srcLang srcSet start step style
|
|
summary tabIndex target title type useMap value width wmode wrap onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown
|
|
onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick
|
|
onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown
|
|
onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
|
|
onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
|
|
onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
|
|
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad
|
|
onPointerDown onPointerMove onPointerUp onPointerCancel onPointerEnter onPointerLeave onPointerOver onPointerOut onGotPointerCapture onLostPointerCapture
|
|
onAnimationStart onAnimationEnd onAnimationIteration
|
|
onTransitionEnd onTransitionRun onTransitionStart onTransitionCancel
|
|
onBeforeInput onReset onInvalid
|
|
onAuxClick onToggle onBeforeToggle onCancel onClose onResize onScrollEnd`.split(/[\s\n]+/),n=`aria-`,r=`data-`;function i(e,t){return e.indexOf(t)===0}function a(e,a=!1){let o;o=a===!1?{aria:!0,data:!0,attr:!0}:a===!0?{aria:!0}:{...a};let s={};return Object.keys(e).forEach(a=>{(o.aria&&(a===`role`||i(a,n))||o.data&&i(a,r)||o.attr&&t.includes(a))&&(s[a]=e[a])}),s}})),G=e(f());function Mt(e,t){return(0,G.useImperativeHandle)(e,()=>{let e=t(),{nativeElement:n}=e;return new Proxy(n,{get(t,n){return e[n]?e[n]:Reflect.get(t,n)}})})}var Nt=G.createContext({}),Pt={classNames:{},styles:{},className:``,style:{},shortcutKeys:{}},K=e=>{let t=G.useContext(Nt);return G.useMemo(()=>({...Pt,...t[e]}),[t[e]])};t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.preMessage=void 0;var t={},n=[],r=e=>{n.push(e)};e.preMessage=r;function i(e,t){}function a(e,t){}function o(){t={}}function s(e,n,r){!n&&!t[r]&&(e(!1,r),t[r]=!0)}function c(e,t){s(i,e,t)}function l(e,t){s(a,e,t)}c.preMessage=r,c.resetWarned=o,c.noteOnce=l,e.default=c}))();function Ft(){}var q=Ft,It=(0,G.createContext)(void 0),Lt=t(((e,t)=>{function n(e){return e&&e.__esModule?e:{default:e}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Rt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={items_per_page:`/ page`,jump_to:`Go to`,jump_to_confirm:`confirm`,page:`Page`,prev_page:`Previous Page`,next_page:`Next Page`,prev_5:`Previous 5 Pages`,next_5:`Next 5 Pages`,prev_3:`Previous 3 Pages`,next_3:`Next 3 Pages`,page_size:`Page Size`}})),zt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.commonLocale=void 0,e.commonLocale={yearFormat:`YYYY`,dayFormat:`D`,cellMeridiemFormat:`A`,monthBeforeYear:!0}})),Bt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={...zt().commonLocale,locale:`en_US`,today:`Today`,now:`Now`,backToToday:`Back to today`,ok:`OK`,clear:`Clear`,week:`Week`,month:`Month`,year:`Year`,timeSelect:`select time`,dateSelect:`select date`,weekSelect:`Choose a week`,monthSelect:`Choose a month`,yearSelect:`Choose a year`,decadeSelect:`Choose a decade`,previousMonth:`Previous month`,nextMonth:`Next month`,previousYear:`Last year`,nextYear:`Next year`,previousDecade:`Last decade`,nextDecade:`Next decade`,previousCentury:`Last century`,nextCentury:`Next century`}})),Vt=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default={placeholder:`Select time`,rangePlaceholder:[`Start time`,`End time`]}})),Ht=t((e=>{var t=Lt().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(Bt()),r=t(Vt());e.default={lang:{placeholder:`Select date`,yearPlaceholder:`Select year`,quarterPlaceholder:`Select quarter`,monthPlaceholder:`Select month`,weekPlaceholder:`Select week`,rangePlaceholder:[`Start date`,`End date`],rangeYearPlaceholder:[`Start year`,`End year`],rangeQuarterPlaceholder:[`Start quarter`,`End quarter`],rangeMonthPlaceholder:[`Start month`,`End month`],rangeWeekPlaceholder:[`Start week`,`End week`],...n.default},timePickerLocale:{...r.default}}})),Ut=t((e=>{var t=Lt().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=t(Ht()).default})),Wt=t((e=>{var t=Lt().default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(Rt()),r=t(Ut()),i=t(Ht()),a=t(Vt()),o="${label} is not a valid ${type}";e.default={locale:`en`,Pagination:n.default,DatePicker:i.default,TimePicker:a.default,Calendar:r.default,global:{placeholder:`Please select`,close:`Close`,sortable:`sortable`,show:`Show`,hide:`Hide`},Table:{filterTitle:`Filter menu`,filterConfirm:`OK`,filterReset:`Reset`,filterEmptyText:`No filters`,filterCheckAll:`Select all items`,filterSearchPlaceholder:`Search in filters`,emptyText:`No data`,selectAll:`Select current page`,selectInvert:`Invert current page`,selectNone:`Clear all data`,selectionAll:`Select all data`,sortTitle:`Sort`,expand:`Expand row`,collapse:`Collapse row`,triggerDesc:`Click to sort descending`,triggerAsc:`Click to sort ascending`,cancelSort:`Click to cancel sorting`},Tour:{Next:`Next`,Previous:`Previous`,Finish:`Finish`},Modal:{okText:`OK`,cancelText:`Cancel`,justOkText:`OK`},Popconfirm:{okText:`OK`,cancelText:`Cancel`},Transfer:{titles:[``,``],searchPlaceholder:`Search here`,itemUnit:`item`,itemsUnit:`items`,remove:`Remove`,selectCurrent:`Select current page`,removeCurrent:`Remove current page`,selectAll:`Select all data`,deselectAll:`Deselect all data`,removeAll:`Remove all data`,selectInvert:`Invert current page`},Upload:{uploading:`Uploading...`,removeFile:`Remove file`,uploadError:`Upload error`,previewFile:`Preview file`,downloadFile:`Download file`},Empty:{description:`No data`},Icon:{icon:`icon`},Text:{edit:`Edit`,copy:`Copy`,copied:`Copied`,expand:`Expand`,collapse:`Collapse`},Carousel:{prevSlide:`Previous slide`,nextSlide:`Next slide`},Form:{optional:`(optional)`,defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:o,method:o,array:o,object:o,number:o,date:o,boolean:o,integer:o,float:o,regexp:o,email:o,url:o,hex:o},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},QRCode:{expired:`QR code expired`,refresh:`Refresh`,scanned:`Scanned`},ColorPicker:{presetEmpty:`Empty`,transparent:`Transparent`,singleColor:`Single`,gradientColor:`Gradient`}}})),Gt=t(((e,t)=>{t.exports=Wt()})),Kt={locale:`en`,Conversations:{create:`New chat`},Sender:{stopLoading:`Stop loading`,speechRecording:`Speech recording`},Actions:{feedbackLike:`Like`,feedbackDislike:`Dislike`,audio:`Play audio`,audioRunning:`Audio playing`,audioError:`Playback error`,audioLoading:`Loading audio`},Bubble:{editableOk:`OK`,editableCancel:`Cancel`},Mermaid:{zoomIn:`Zoom in`,zoomOut:`Zoom out`,zoomReset:`Reset`,download:`Download`,code:`Code`,image:`Image`},Folder:{selectFile:`Please select a file`,loadError:`Failed to load file`,noService:`File content service not configured`,loadFailed:`Failed to load file`}},qt=e(Gt()),Jt=(e,t)=>{let n=G.useContext(It);return[G.useMemo(()=>{let r=t||Kt?.[e]||qt.default?.[e],i=n?.[e]??{};return{...typeof r==`function`?r():r,...i||{}}},[e,t,n]),G.useMemo(()=>{let e=n?.locale;return n?.exist&&!e?Kt.locale:e},[n])]};function Yt(){let{getPrefixCls:e,direction:t,csp:n,iconPrefixCls:r,theme:i}=G.useContext(E.ConfigContext);return{theme:i,getPrefixCls:e,direction:t,csp:n,iconPrefixCls:r}}var Xt=1e3,Zt=4,Qt=140,$t=Qt/2,J=250,en=500,tn=.8;function nn({className:e}){let[t]=Jt(`Sender`,Kt.Sender);return G.createElement(`svg`,{color:`currentColor`,viewBox:`0 0 ${Xt} ${Xt}`,xmlns:`http://www.w3.org/2000/svg`,className:e},G.createElement(`title`,null,t.speechRecording),Array.from({length:Zt}).map((e,t)=>{let n=t*286.66666666666663,r=Xt/2-J/2,i=Xt/2-en/2;return G.createElement(`rect`,{fill:`currentColor`,rx:$t,ry:$t,height:J,width:Qt,x:n,y:r,key:t},G.createElement(`animate`,{attributeName:`height`,values:`${J}; ${en}; ${J}`,keyTimes:`0; 0.5; 1`,dur:`${tn}s`,begin:`${tn/Zt*t}s`,repeatCount:`indefinite`}),G.createElement(`animate`,{attributeName:`y`,values:`${r}; ${i}; ${r}`,keyTimes:`0; 0.5; 1`,dur:`${tn}s`,begin:`${tn/Zt*t}s`,repeatCount:`indefinite`}))}))}var rn=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(y());function n(e){return e&&e.__esModule?e:{default:e}}var r;e.default=()=>(r===void 0&&(r=(0,t.default)()),r)}))()),an=()=>{let[e,t]=G.useState(!1);return G.useEffect(()=>{t((0,rn.default)())},[]),e},on=e=>({[e.componentCls]:{[`${e.antCls}-motion-collapse-legacy`]:{overflow:`hidden`,"&-active":{transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},
|
|
opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}},[`${e.antCls}-motion-collapse`]:{overflow:`hidden`,transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},
|
|
opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}}}),sn=`2.9.0`,cn={blue:`#1677FF`,purple:`#722ED1`,cyan:`#13C2C2`,green:`#52C41A`,magenta:`#EB2F96`,pink:`#EB2F96`,red:`#F5222D`,orange:`#FA8C16`,yellow:`#FADB14`,volcano:`#FA541C`,geekblue:`#2F54EB`,gold:`#FAAD14`,lime:`#A0D911`,colorPrimary:`#1677ff`,colorSuccess:`#52c41a`,colorWarning:`#faad14`,colorError:`#ff4d4f`,colorInfo:`#1677ff`,colorLink:``,colorTextBase:``,colorBgBase:``,fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
'Noto Color Emoji'`,fontFamilyCode:`'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,fontSize:14,lineWidth:1,lineType:`solid`,motionUnit:.1,motionBase:0,motionEaseOutCirc:`cubic-bezier(0.08, 0.82, 0.17, 1)`,motionEaseInOutCirc:`cubic-bezier(0.78, 0.14, 0.15, 0.86)`,motionEaseOut:`cubic-bezier(0.215, 0.61, 0.355, 1)`,motionEaseInOut:`cubic-bezier(0.645, 0.045, 0.355, 1)`,motionEaseOutBack:`cubic-bezier(0.12, 0.4, 0.29, 1.46)`,motionEaseInBack:`cubic-bezier(0.71, -0.46, 0.88, 0.6)`,motionEaseInQuint:`cubic-bezier(0.755, 0.05, 0.855, 0.06)`,motionEaseOutQuint:`cubic-bezier(0.23, 1, 0.32, 1)`,borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0};function ln(e){return e>=0&&e<=255}function un(e,t){let{r:n,g:r,b:i,a}=new h(e).toRgb();if(a<1)return e;let{r:o,g:s,b:c}=new h(t).toRgb();for(let e=.01;e<=1;e+=.01){let t=Math.round((n-o*(1-e))/e),a=Math.round((r-s*(1-e))/e),l=Math.round((i-c*(1-e))/e);if(ln(t)&&ln(a)&&ln(l))return new h({r:t,g:a,b:l,a:Math.round(e*100)/100}).toRgbString()}return new h({r:n,g:r,b:i,a:1}).toRgbString()}function dn(e){let{override:t,...n}=e,r={...t};Object.keys(cn).forEach(e=>{delete r[e]});let i={...n,...r},a=1200,o=1600;return i.motion===!1&&(i.motionDurationFast=`0s`,i.motionDurationMid=`0s`,i.motionDurationSlow=`0s`),{...i,colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:un(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:un(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:un(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:un(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:`none`,linkHoverDecoration:`none`,linkFocusDecoration:`none`,controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:`
|
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowSecondary:`
|
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowTertiary:`
|
|
0 1px 2px 0 rgba(0, 0, 0, 0.03),
|
|
0 1px 6px -1px rgba(0, 0, 0, 0.02),
|
|
0 2px 4px 0 rgba(0, 0, 0, 0.02)
|
|
`,screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:a,screenXLMin:a,screenXLMax:1599,screenXXL:o,screenXXLMin:o,boxShadowPopoverArrow:`2px 2px 5px rgba(0, 0, 0, 0.05)`,boxShadowCard:`
|
|
0 1px 2px -2px ${new h(`rgba(0, 0, 0, 0.16)`).toRgbString()},
|
|
0 3px 6px 0 ${new h(`rgba(0, 0, 0, 0.12)`).toRgbString()},
|
|
0 5px 12px 4px ${new h(`rgba(0, 0, 0, 0.09)`).toRgbString()}
|
|
`,boxShadowDrawerRight:`
|
|
-6px 0 16px 0 rgba(0, 0, 0, 0.08),
|
|
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
|
-9px 0 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowDrawerLeft:`
|
|
6px 0 16px 0 rgba(0, 0, 0, 0.08),
|
|
3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
|
9px 0 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowDrawerUp:`
|
|
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowDrawerDown:`
|
|
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
`,boxShadowTabsOverflowLeft:`inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)`,boxShadowTabsOverflowRight:`inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)`,boxShadowTabsOverflowTop:`inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)`,boxShadowTabsOverflowBottom:`inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)`,...r}}var fn={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},pn={motionBase:!0,motionUnit:!0},mn=p(ce.defaultAlgorithm),hn={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},gn=(e,t,n)=>{let r=n.getDerivativeToken(e),{override:i,...a}=t,o={...r,override:i};return o=dn(o),a&&Object.entries(a).forEach(([e,t])=>{let{theme:n,...r}=t,i=r;n&&(i=gn({...o,...r},{override:r},n)),o[e]=i}),o};function _n(){let{token:e,hashed:t,theme:n,override:r,cssVar:i,zeroRuntime:a}=G.useContext(ce._internalContext),s={prefix:i?.prefix??`ant`,key:i?.key??`css-var-root`},c=n||mn,[l,u,d]=o(c,[ce.defaultSeed,e],{salt:`${sn}-${t||``}`,override:r,getComputedToken:gn,cssVar:{...s,unitless:fn,ignore:pn,preserve:hn}});return[c,d,t?u:``,l,s,!!a]}function vn(){let[e,t,n]=_n();return{theme:e,token:t,hashId:n}}var{genStyleHooks:yn,genComponentStyleHook:bn,genSubStyleComponent:xn}=r({usePrefix:()=>{let{getPrefixCls:e,iconPrefixCls:t}=Yt();return{iconPrefixCls:t,rootPrefixCls:e()}},useToken:()=>{let[e,t,n,r,i,a]=_n();return{theme:e,realToken:t,hashId:n,token:r,cssVar:i,zeroRuntime:a}},useCSP:()=>{let{csp:e}=Yt();return e??{}},layer:{name:`antdx`}}),Sn=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e,t){let n=Object.assign({},e);return Array.isArray(t)&&t.forEach(e=>{delete n[e]}),n}})),Cn=G.createContext({});function wn(e){let t=getComputedStyle(e).display;return t===`block`||t===`flex`||t===`list-item`||t===`table`}function Tn(e){let t=[``],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(;n.nextNode();){let e=n.currentNode;if(e.nodeType===Node.TEXT_NODE){t[t.length-1]+=e.textContent;continue}(e.tagName!==`BR`||e.parentNode?.childElementCount!==1)&&(e.tagName===`BR`||wn(e))&&t.push(``)}return t.join(`
|
|
`)}var En=({content:e,prefixCls:t,okText:n,cancelText:r,onEditConfirm:i,onEditCancel:a})=>{let o=G.useRef(null),[s]=Jt(`Bubble`,Kt.Bubble),c=g(()=>{i?.(Tn(o.current))}),l=g(()=>a?.());if(G.useEffect(()=>{o.current.textContent=e,o.current.focus();let t=window.getSelection(),n=document.createRange();n.selectNodeContents(o.current),n.collapse(!1),t.removeAllRanges(),t.addRange(n)},[]),typeof e!=`string`)throw Error(`Content of editable Bubble should be string`);let u=G.useMemo(()=>G.createElement(`div`,{ref:o,contentEditable:!0}),[]);return G.createElement(G.Fragment,null,u,G.createElement(N,{rootClassName:`${t}-editing-opts`,gap:8},G.createElement(A,{type:`primary`,shape:`round`,size:`small`,onClick:c},n||s.editableOk),G.createElement(A,{type:`text`,shape:`round`,size:`small`,onClick:l},r||s.editableCancel)))},Dn=({prefixCls:e})=>G.createElement(`span`,{className:`${e}-dot`},G.createElement(`i`,{className:`${e}-dot-item`,key:`item-1`}),G.createElement(`i`,{className:`${e}-dot-item`,key:`item-2`}),G.createElement(`i`,{className:`${e}-dot-item`,key:`item-3`})),On=new u(`loadingMove`,{"0%":{transform:`translateY(0)`},"10%":{transform:`translateY(4px)`},"20%":{transform:`translateY(0)`},"30%":{transform:`translateY(-4px)`},"40%":{transform:`translateY(0)`}}),kn=new u(`cursorBlink`,{"0%":{opacity:1},"50%":{opacity:0},"100%":{opacity:1}}),An=new u(`fadeIn`,{"0%":{opacity:0},"100%":{opacity:1}}),jn=e=>{let{componentCls:t,fontSize:n,typingContent:r,typingAnimationDuration:i,typingAnimationName:a,lineHeight:o,paddingSM:c,colorText:l,calc:u}=e;return[{[t]:{display:`flex`,columnGap:c,[`&${t}-rtl`]:{direction:`rtl`},[`&${t}-loading`]:{alignItems:`center`},[`${t}-body`]:{display:`flex`,flexDirection:`column`,maxWidth:`100%`},[`${t}-content`]:{position:`relative`,boxSizing:`border-box`,minWidth:0,maxWidth:`100%`,minHeight:u(c).mul(2).add(u(o).mul(n)).equal(),paddingInline:`${s(e.padding)}`,paddingBlock:`${s(c)}`,color:l,fontSize:e.fontSize,lineHeight:e.lineHeight,wordBreak:`break-word`,"&-string":{whiteSpace:`pre-wrap`}},[`${t}-typing:last-child::after`]:{content:r,fontWeight:900,userSelect:`none`,opacity:1,marginInlineStart:`0.1em`,animationName:a,animationDuration:s(i),animationIterationCount:`infinite`,animationTimingFunction:`linear`},[`${t}-fade-in .fade-in`]:{display:`inline`,animationName:An,animationDuration:`1s`,animationTimingFunction:`linear`},[`${t}-dot`]:{position:`relative`,height:e.controlHeight,display:`flex`,alignItems:`center`,columnGap:e.marginXS,padding:`0 ${s(e.paddingXXS)}`,alignSelf:`center`,"&-item":{backgroundColor:e.colorPrimary,borderRadius:`100%`,width:4,height:4,animationName:On,animationDuration:`2s`,animationIterationCount:`infinite`,animationTimingFunction:`linear`,"&:nth-child(1)":{animationDelay:`0s`},"&:nth-child(2)":{animationDelay:`0.2s`},"&:nth-child(3)":{animationDelay:`0.4s`}}},[`&${t}-start`]:{flexDirection:`row`,alignSelf:`flex-start`,[`& ${t}-header`]:{flexDirection:`row`}},[`&${t}-end`]:{flexDirection:`row-reverse`,alignSelf:`flex-end`,[`& ${t}-header`]:{flexDirection:`row-reverse`},[`& ${t}-editing-opts`]:{flexDirection:`row-reverse`}}}},kn]},Mn=e=>{let{componentCls:t}=e;return{[t]:{[`${t}-content`]:{"&-filled":{backgroundColor:e.colorFillContent},"&-outlined":{border:`1px solid ${e.colorBorderSecondary}`},"&-shadow":{boxShadow:e.boxShadowTertiary},"&-borderless":{backgroundColor:`transparent`,padding:0,minHeight:0}}}}},Nn=e=>{let{componentCls:t,fontSize:n,lineHeight:r,paddingSM:i,borderRadius:a,calc:o}=e,s=o(n).mul(r).div(2).add(i).equal(),c=o(a).mul(2).equal(),l=`${t}-content`;return{[t]:{[l]:{"&-default":{borderRadius:{_skip_check_:!0,value:c}},"&-round":{borderRadius:{_skip_check_:!0,value:s}},"&-corner":{borderRadius:{_skip_check_:!0,value:c}},"&-editing":{"div:first-child":{outline:`none`},[`${t}-editing-opts`]:{marginBlockStart:e.marginSM,"button:last-child":{backgroundColor:e.colorBgContainer,"&:hover":{backgroundColor:e.colorBgLayout}}}}},[`&${t}-start ${t}-content-corner`]:{borderStartStartRadius:e.borderRadiusXS},[`&${t}-end ${t}-content-corner`]:{borderStartEndRadius:e.borderRadiusXS}}}},Pn=e=>{let{componentCls:t}=e;return{[t]:{"&-divider":{width:`100%`,justifyContent:`center`,[`& ${t}-body`]:{width:`100%`}}}}},Fn=e=>{let{componentCls:t}=e;return{[`${t}-list`]:{maxHeight:`100%`,width:`100%`,boxSizing:`border-box`,[`& ${t}`]:{width:`100%`,boxSizing:`border-box`,paddingBlock:e.padding},[`& ${t}-start:not(${t}-divider):not(${t}-system)`]:{paddingInlineEnd:`15%`},[`& ${t}-end:not(${t}-divider):not(${t}-system)`]:{paddingInlineStart:`15%`},[`${t}-list-scroll-box`]:{overflowY:`auto`,display:`flex`,width:`100%`,maxHeight:`100%`,flexDirection:`column`,scrollbarWidth:`thin`,scrollbarColor:`${e.colorTextTertiary} transparent`,"&::-webkit-scrollbar":{width:8,backgroundColor:`transparent`},"&::-webkit-scrollbar-thumb":{backgroundColor:e.colorTextTertiary,borderRadius:e.borderRadiusSM}},[`${t}-list-autoscroll`]:{flexDirection:`column-reverse`},[`${t}-list-scroll-content`]:{display:`flex`,width:`100%`,height:`fit-content`,flexDirection:`column`,boxSizing:`border-box`,paddingInline:e.paddingXS}}}},In=e=>{let{componentCls:t,fontSize:n,lineHeight:r,paddingXXS:i,margin:a,colorText:o,fontSizeLG:s,calc:c}=e;return{[t]:{[`${t}-header`]:{display:`flex`,marginBottom:i,fontSize:n,lineHeight:r,color:o},[`${t}-footer`]:{display:`flex`,marginBlockStart:a,fontSize:n,lineHeight:r,color:o,"&-start":{flexDirection:`row`},"&-end":{flexDirection:`row-reverse`}},[`${t}-avatar`]:{minWidth:c(s).mul(2).equal()}}}},Ln=e=>{let{componentCls:t,paddingSM:n,paddingXS:r,lineHeight:i,fontSize:a,fontSizeSM:o,calc:c}=e;return{[t]:{[`&${t}-system`]:{width:`100%`,justifyContent:`center`,[`${t}-content`]:{display:`flex`,gap:`${s(o)}`,alignItems:`center`,minHeight:c(r).mul(2).add(c(i).mul(a)).equal(),fontSize:`${s(a)}`,paddingInline:`${s(n)}`,paddingBlock:`${s(r)}`},[`${t}-system-content`]:{},[`${t}-system-extra`]:{}}}}},Rn=yn(`Bubble`,e=>{let t=b(e,{});return[jn(t),Mn(t),Nn(t),In(t),Fn(t),Ln(t),Pn(t)]},()=>({typingContent:`"|"`,typingAnimationName:`cursorBlink`,typingAnimationDuration:`0.8s`})),zn=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(){return!!(typeof window<`u`&&window.document&&window.document.createElement)}})),Bn=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useLayoutUpdateEffect=e.default=void 0;var t=a(f()),n=r(zn());function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(typeof WeakMap!=`function`)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(e===null||typeof e!=`object`&&typeof e!=`function`)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!=="default"&&Object.prototype.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}var o=(0,n.default)()?t.useLayoutEffect:t.useEffect,s=(e,n)=>{let r=t.useRef(!0);o(()=>e(r.current),n),o(()=>(r.current=!1,()=>{r.current=!0}),[])};e.useLayoutUpdateEffect=(e,t)=>{s(t=>{if(!t)return e()},t)},e.default=s}))());function Vn(e){return!e||e.length===0?``:e.reduce((e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return e.slice(0,n)})}function Hn({streaming:e,content:t,typing:n,onTyping:r,onTypingComplete:i}){let[a,o]=G.useState([]),s=G.useRef(!1),c=G.useRef(``),l=G.useRef(1),u=G.useRef(-1),d=G.useRef(e);d.current=e;let f=G.useMemo(()=>{let e={effect:`fade-in`,interval:100,step:6,keepPrefix:!0};if(n===!0)return e;let{step:t=6,interval:r=100}=n,i=e=>typeof e==`number`;if(!i(r)||r<=0)throw`[Bubble] invalid prop typing.interval, expect positive number.`;if(!i(t)&&!Array.isArray(t))throw`[Bubble] invalid prop typing.step, expect positive number or positive number array`;if(i(t)&&t<=0)throw`[Bubble] invalid prop typing.step, expect positive number`;if(Array.isArray(t)){if(!i(t[0])||t[0]<=0)throw`[Bubble] invalid prop typing.step[0], expect positive number`;if(!i(t[1])||t[1]<=0)throw`[Bubble] invalid prop typing.step[1], expect positive number`;if(t[0]>t[1])throw`[Bubble] invalid prop typing.step, step[0] should less than step[1]`}return{...e,...n}},[n]),p=G.useRef({content:t,interval:f.interval,step:f.step});p.current={content:t,interval:f.interval,step:f.step};let m=()=>Math.random().toString().slice(2),h=G.useCallback(e=>{let t=0;c.current=f.keepPrefix?Vn([p.current.content,c.current]):``,o(c.current?[{text:c.current,id:m(),taskId:e,done:!0}]:[]);let n=()=>{if(e!==l.current)return;let a=performance.now(),{content:f,interval:h,step:g}=p.current;if(a-t<h){u.current=requestAnimationFrame(n);return}let _=c.current.length,v=typeof g==`number`?g:Math.floor(Math.random()*(g[1]-g[0]))+g[0],y=f.slice(_,_+v);if(!y){if(d.current){u.current=requestAnimationFrame(n);return}o(t=>[{text:t.map(({text:e})=>e).join(``),id:m(),taskId:e,done:!0}]),i?.(f),s.current=!1,l.current++;return}c.current+=y;let b={id:m(),text:y,taskId:e,done:!1};o(e=>e.concat(b)),s.current||=!0,t=a,u.current=requestAnimationFrame(n),r?.(c.current,f)};n()},[f.keepPrefix,r,i]),g=G.useCallback(()=>{cancelAnimationFrame(u.current),o([]),c.current=``,s.current=!1},[]);return(0,Bn.default)(()=>{if(!t)return g();t!==c.current&&(s.current&&!t.startsWith(c.current)?(cancelAnimationFrame(u.current),s.current=!1,requestAnimationFrame(()=>h(++l.current))):s.current===!1&&h(l.current))},[t,h]),{renderedData:a,animating:s.current,memoedAnimationCfg:f}}var Un=({prefixCls:e,streaming:t,content:n,typing:r,onTyping:i,onTypingComplete:a})=>{let{renderedData:o,animating:s,memoedAnimationCfg:c}=Hn({streaming:t,content:n,typing:r,onTyping:i,onTypingComplete:a}),{effect:l}=c,u=o.map(e=>l===`fade-in`&&!e.done?G.createElement(`span`,{key:e.id,className:`fade-in`},e.text):e.text),d=r!==!0&&l===`typing`;return G.createElement(`div`,{className:m({[`${e}-typing`]:d&&s,[`${e}-fade-in`]:!d})},u)},Wn=e(jt()),Gn=G.forwardRef(({prefixCls:e,rootClassName:t,style:n,className:r,styles:i={},classNames:a={},placement:o=`start`,content:s,contentRender:l,editable:u=!1,typing:d,streaming:f=!1,variant:p=`filled`,shape:h=`default`,header:g,footer:_,avatar:v,extra:y,footerPlacement:b,loading:x,loadingRender:S,onTyping:C,onTypingComplete:w,onEditConfirm:T,onEditCancel:E,...D},O)=>{let k=G.useRef(null);G.useImperativeHandle(O,()=>({nativeElement:k.current}));let A=K(`bubble`),{direction:j,getPrefixCls:ee}=Yt(),M=ee(`bubble`,e),N=G.useContext(Cn),[te,ne]=Rn(M),re={...A.style,...A.styles.root,...i.root,...n},ie=m(M,A.className,A.classNames.root,a.root,t,r,te,ne,`${M}-${o}`,{[`${M}-${N.status}`]:N.status,[`${M}-rtl`]:j===`rtl`,[`${M}-loading`]:x}),ae=(0,Wn.default)(D,{attr:!0,aria:!0,data:!0}),P={key:N?.key,status:N?.status,extraInfo:N?.extraInfo},oe=G.useMemo(()=>l?l(s,P):s,[s,l,P.key,P.status,P.extraInfo]),se=typeof d==`function`?d(s,P):d,F=!!se&&typeof oe==`string`;G.useEffect(()=>{F||f||s&&w?.(s)},[oe,F,f]);let ce=b||(o===`start`?`outer-start`:`outer-end`),I=typeof u==`boolean`?u:u.editing,le=()=>{if(x)return S?S():G.createElement(Dn,{prefixCls:M});let e=G.createElement(G.Fragment,null,F?G.createElement(Un,{prefixCls:M,streaming:f,typing:se,content:oe,onTyping:C,onTypingComplete:w}):oe),t=ce.includes(`inner`);return G.createElement(`div`,{className:ue(`body`),style:de(`body`)},R(),G.createElement(`div`,{style:{...A.styles.content,...i.content},className:m(`${M}-content`,`${M}-content-${p}`,A.classNames.content,a.content,{[`${M}-content-${N?.status}`]:N?.status,[`${M}-content-${h}`]:p!==`borderless`,[`${M}-content-editing`]:I,[`${M}-content-string`]:typeof oe==`string`})},I?G.createElement(En,{prefixCls:M,content:s,okText:u?.okText,cancelText:u?.cancelText,onEditConfirm:T,onEditCancel:E}):G.createElement(G.Fragment,null,t?G.createElement(`div`,{className:m(`${M}-content-with-footer`)},e):e,t&&me())),!I&&!t&&me())},ue=e=>m(`${M}-${e}`,A.classNames[e],a[e]),de=e=>({...A.styles[e],...i[e]}),fe=e=>typeof e==`function`?e(s,P):e,L=()=>v?G.createElement(`div`,{className:ue(`avatar`),style:de(`avatar`)},fe(v)):null,pe=()=>y?G.createElement(`div`,{className:ue(`extra`),style:de(`extra`)},fe(y)):null,R=()=>g?G.createElement(`div`,{className:ue(`header`),style:de(`header`)},fe(g)):null,me=()=>{if(!_)return null;let e=m(ue(`footer`),{[`${M}-footer-start`]:ce.includes(`start`),[`${M}-footer-end`]:ce.includes(`end`)});return G.createElement(`div`,{className:e,style:de(`footer`)},fe(_))};return G.createElement(`div`,c({className:ie,style:re},D,ae,{ref:k}),L(),le(),!I&&!x&&pe())}),Kn=G.forwardRef(({prefixCls:e,content:t=``,rootClassName:n,style:r,className:i,styles:a={},classNames:o={},dividerProps:s,...l},u)=>{let{getPrefixCls:d}=Yt(),f=K(`bubble`),p=d(`bubble`,e),[h,g]=Rn(p),_=m(h,g,p,`${p}-divider`,f.className,f.classNames.root,i,o.root,n);return G.createElement(Gn,c({ref:u,style:r,styles:a,className:_,classNames:o,prefixCls:p,variant:`borderless`,content:t,contentRender:e=>G.createElement(ee,s,e)},l))});function qn(e){return getComputedStyle(e).flexDirection===`column-reverse`}function Jn(e,t){let n=(0,G.useRef)(null),r=(0,G.useRef)(!0),i=(0,G.useRef)(!1),a=(0,G.useRef)(0),o=(0,G.useRef)(void 0),s=(0,G.useRef)(!1),c=(0,G.useRef)(!1);(0,G.useLayoutEffect)(()=>{if(!e||!t)return;if(!n.current){let t=document.createElement(`div`);t.style.bottom=`0`,t.style.flexShrink=`0`,t.style.pointerEvents=`none`,t.style.height=`10px`,t.style.visibility=`hidden`,e.insertBefore(t,e.firstChild),n.current=t}let a=new IntersectionObserver(([e])=>{r.current=e.isIntersecting,i.current=!e.isIntersecting},{root:e,threshold:0});a.observe(n.current);let s=new ResizeObserver(()=>{if(e){if(o.current){c.current&&requestAnimationFrame(()=>e.scrollTo({top:qn(e)?0:e.scrollHeight,behavior:`instant`}));return}qn(e)&&i.current&&d()}});return s.observe(t),()=>{a.disconnect(),s.disconnect(),clearTimeout(o.current),n.current?.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null)}},[e,t]);let l=(0,G.useCallback)(()=>{o.current=setTimeout(()=>{clearTimeout(o.current),o.current=void 0,c.current=!1},50)},[]),u=(0,G.useCallback)(e=>{let t=e.target;if(!qn(t))return;let{scrollTop:n,scrollHeight:r}=t;if(a.current=r+n,s.current){s.current=!1;return}o.current&&clearTimeout(o.current),l()},[l]);(0,G.useLayoutEffect)(()=>{if(e)return e.addEventListener(`scroll`,u,{capture:!0}),()=>e?.removeEventListener(`scroll`,u,{capture:!0})},[e,u]);let d=(0,G.useCallback)(()=>{e.scrollTop=a.current-e.scrollHeight,s.current=!0},[e]);return{reset:(0,G.useCallback)(()=>{r.current=!0,i.current=!1,a.current=e?.scrollHeight||0},[e]),scrollTo:(0,G.useCallback)(n=>{if(!e||!t)return;let{top:r,intoView:i,intoViewDom:a}=n||{};qn(e)?r!==void 0&&r>=-10?c.current=!0:a&&i?.block===`end`?c.current=t.lastElementChild===a:c.current=!1:r!==void 0&&r>=e.scrollHeight-e.clientHeight-10?c.current=!0:a&&i?.block===`end`?c.current=t.lastElementChild===a:c.current=!1,o.current||l(),a?a.scrollIntoView(i):e.scrollTo(n)},[e,t])}}var Yn=G.forwardRef(({prefixCls:e,content:t,variant:n=`shadow`,shape:r,style:i,className:a,styles:o={},classNames:s={},rootClassName:l,...u},d)=>{let f=K(`bubble`),{getPrefixCls:p}=Yt(),h=p(`bubble`,e),[g,_]=Rn(h),v=`${h}-system`,y=m(g,_,v,h,f.className,f.classNames.root,s.root,a,l);return G.createElement(Gn,c({ref:d,style:i,className:y,styles:o,classNames:s,variant:n,shape:r,content:t},u))}),Xn=e(Sn());function Zn(e){return typeof e==`function`&&e instanceof Function}var Qn=G.memo(Gn),$n=G.memo(Kn),er=G.memo(Yn),tr=e=>{let{_key:t,bubblesRef:n,extraInfo:r,status:i,role:a,classNames:o={},styles:s={},...l}=e,u=G.useCallback(e=>{e?n.current[t]=e:delete n.current[t]},[t]),{root:d,bubble:f,divider:p,system:m,...h}=o,{root:g,bubble:_,divider:v,system:y,...b}=s,x=G.createElement(Qn,c({ref:u,style:g||_,className:d||f,classNames:h,styles:b},l));return a===`divider`?x=G.createElement($n,c({ref:u,style:g||v,className:d||p,classNames:h,styles:b},l)):a===`system`&&(x=G.createElement(er,c({ref:u,style:g||y,className:d||m,classNames:h,styles:b},l))),G.createElement(Cn.Provider,{value:{key:t,status:i,extraInfo:r}},x)};Gn.List=G.forwardRef((e,t)=>{let{prefixCls:n,rootClassName:r,className:i,styles:a={},classNames:o={},style:s,items:l,autoScroll:u=!0,role:d,onScroll:f,...p}=e,h=(0,Wn.default)(p,{attr:!0,aria:!0}),g=G.useRef(null),_=G.useRef({}),[v,y]=G.useState(),[b,x]=G.useState(),{scrollTo:S}=Jn(v,b),{getPrefixCls:C}=Yt(),w=C(`bubble`,n),T=`${w}-list`,[E,D]=Rn(w),O=m(T,r,i,o.root,E,D),k={...a.root,...s};return Mt(t,()=>({nativeElement:g.current,scrollBoxNativeElement:v,scrollTo:({key:e,top:t,behavior:n=`smooth`,block:r})=>{let{scrollHeight:i,clientHeight:a}=v;if(typeof t==`number`)S({top:u?-i+a+t:t,behavior:n});else if(t===`bottom`)S({top:u?0:i,behavior:n});else if(t===`top`){let e=u?-i:0;S({top:e,behavior:n})}else e&&_.current[e]&&S({intoView:{behavior:n,block:r},intoViewDom:_.current[e].nativeElement})}})),G.createElement(`div`,c({},h,{className:O,style:k,ref:g}),G.createElement(`div`,{className:m(`${T}-scroll-box`,o.scroll,{[`${T}-autoscroll`]:u}),style:a.scroll,ref:e=>y(e),onScroll:f},G.createElement(`div`,{ref:e=>x(e),className:m(`${T}-scroll-content`)},l.map(e=>{let t;if(e.role&&d){let n=d[e.role];t={...Zn(n)?n(e):n,...e}}else t=e;return G.createElement(tr,c({classNames:(0,Xn.default)(o,[`root`,`scroll`]),styles:(0,Xn.default)(a,[`root`,`scroll`])},(0,Xn.default)(t,[`key`]),{key:e.key,_key:e.key,bubblesRef:_}))}))))}),Gn.System=Yn,Gn.Divider=Kn;var nr=Gn,rr=()=>({height:0,opacity:0}),ir=e=>{let{scrollHeight:t}=e;return{height:t,opacity:1}},ar=e=>({height:e?e.offsetHeight:0}),or=(e,t)=>t?.deadline===!0||t.propertyName===`height`,sr=(e=`ant`)=>({motionName:`${e}-motion-collapse`,onAppearStart:rr,onEnterStart:rr,onAppearActive:ir,onEnterActive:ir,onLeaveStart:ar,onLeaveActive:rr,onAppearEnd:or,onEnterEnd:or,onLeaveEnd:or,motionDeadline:500}),cr=(e,t,n)=>{let r=typeof e==`boolean`||e?.expandedKeys===void 0,[a,o,s,c]=G.useMemo(()=>{let t={expandedKeys:[],defaultExpandedKeys:[],onExpand:()=>{}};return e?(typeof e==`object`&&(t={...t,...e}),[!0,t.defaultExpandedKeys,t.expandedKeys,t.onExpand]):[!1,t.defaultExpandedKeys,t.expandedKeys,t.onExpand]},[e]),[l,u]=i(o||[],r?void 0:s),d=e=>{u(t=>{let n=r?t:s,i=n.includes(e)?n.filter(t=>t!==e):[...n,e];return c?.(i),i})},f=G.useMemo(()=>a?{...sr(n),motionAppear:!1,leavedClassName:`${t}-content-hidden`}:{},[n,t,a]);return[a,l,a?d:void 0,f]},lr=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){let{keyCode:n}=e;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=t.F1&&n<=t.F12)return!1;switch(n){case t.ALT:case t.CAPS_LOCK:case t.CONTEXT_MENU:case t.CTRL:case t.DOWN:case t.END:case t.ESC:case t.HOME:case t.INSERT:case t.LEFT:case t.MAC_FF_META:case t.META:case t.NUMLOCK:case t.NUM_CENTER:case t.PAGE_DOWN:case t.PAGE_UP:case t.PAUSE:case t.PRINT_SCREEN:case t.RIGHT:case t.SHIFT:case t.UP:case t.WIN_KEY:case t.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=t.ZERO&&e<=t.NINE||e>=t.NUM_ZERO&&e<=t.NUM_MULTIPLY||e>=t.A&&e<=t.Z||window.navigator.userAgent.indexOf(`WebKit`)!==-1&&e===0)return!0;switch(e){case t.SPACE:case t.QUESTION_MARK:case t.NUM_PLUS:case t.NUM_MINUS:case t.NUM_PERIOD:case t.NUM_DIVISION:case t.SEMICOLON:case t.DASH:case t.EQUALS:case t.COMMA:case t.PERIOD:case t.SLASH:case t.APOSTROPHE:case t.SINGLE_QUOTE:case t.OPEN_SQUARE_BRACKET:case t.BACKSLASH:case t.CLOSE_SQUARE_BRACKET:return!0;default:return!1}},isEditableTarget:function(e){let t=e.target;if(!(t instanceof HTMLElement))return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)}};e.default=t}))()),ur={Alt:[`altKey`,`⌥`,`Alt`],Ctrl:[`ctrlKey`,`⌃`,`Ctrl`],Meta:[`metaKey`,`⌘`,`Win`],Shift:[`shiftKey`,`⇧`,`Shift`]},dr=Array.from({length:9},(e,t)=>lr.default.ONE+t),fr=/(mac|iphone|ipod|ipad)/i.test(typeof navigator<`u`?navigator?.platform:``),pr=e=>e===`number`?e:typeof e==`string`&&ur?.[e]?.[fr?1:2]?ur[e][fr?1:2]:Object.entries(lr.default||{})?.find(([t,n])=>n===e)?.[0]||``,mr=(e,t)=>{let n=[...e],r=n.pop();return n.reduce((e,n)=>e&&(t[ur?.[n]?.[0]]||!1),r===t.keyCode)?{actionShortcutKey:e,actionKeyCodeNumber:dr.indexOf(t.keyCode)>-1&&dr.indexOf(t.keyCode),actionKeyCode:t.keyCode,timeStamp:t.timeStamp}:!1},hr=e=>{let t=[...e],n=t.pop();return{keyCodeDict:n===`number`?dr:[n],prefixKeys:t}},gr=(e,t,n)=>{q(!e.find(({shortcutKey:e})=>e.toString()===t.toString()),n,`Same shortcutKey ${t.toString()}`)},_r=(e,t,n)=>{let r=Object.assign({},t||{},n);return Object.keys(r).reduce(({flattenShortcutKeys:t,shortcutKeysInfo:n},i)=>{let a=r[i];if(!Array.isArray(a))return{flattenShortcutKeys:t,shortcutKeysInfo:n};if(n={...n,[i]:{shortcutKeys:a,shortcutKeysIcon:[]}},a.every(e=>Array.isArray(e)))a.forEach((r,a)=>{let o=r;gr(t,o,e),t.push({name:i,shortcutKey:o,index:a}),n[i].shortcutKeysIcon.push(o?.map(e=>pr(e)))});else{let{keyCodeDict:r,prefixKeys:o}=hr(a);r.forEach(n=>{gr(t,[...o,n],e),t.push({name:i,shortcutKey:[...o,n]})}),n[i].shortcutKeysIcon=a.map(e=>pr(e))}return{flattenShortcutKeys:t,shortcutKeysInfo:n}},{flattenShortcutKeys:[],shortcutKeysInfo:{}})},vr=()=>{let e=(0,G.useRef)(void 0);return[e,t=>{e.current=t}]},yr=(e,t)=>{let{flattenShortcutKeys:n,shortcutKeysInfo:r}=_r(e,K(e).shortcutKeys,t),[i,a]=(0,G.useState)(null),[o,s]=vr(),c=(0,G.useRef)(!1),l=e=>{for(let t of n){let n=mr(t.shortcutKey,e);if(n){let e={...n,name:t.name,index:t?.index};if(c.current)return;c.current=!0,a(e),o?.current?.(e)}}},u=()=>{c.current=!1};return(0,G.useEffect)(()=>{if(n.length!==0)return document.addEventListener(`keydown`,l),document.addEventListener(`keyup`,u),()=>{document.removeEventListener(`keydown`,l),document.removeEventListener(`keyup`,u)}},[n.length,o]),[i,r,s]},br=({shortcutKeysIcon:e,prefixCls:t})=>{let[n]=Jt(`Conversations`,Kt.Conversations),r=!!e?.length;return G.createElement(`div`,{className:m(t,{[`${t}-shortcut-keys-show`]:r})},G.createElement(`span`,null,n.create),r&&G.createElement(`span`,{className:m(`${t}-shortcut-keys`)},e.map(e=>G.createElement(`span`,{className:m(`${t}-shortcut-key`),key:e},e))))},xr=({icon:e,label:t,align:n,shortcutKeyInfo:r,prefixCls:i})=>{let{shortcutKeysIcon:a}=r||{},o={label:G.createElement(br,{prefixCls:`${i}-label`,shortcutKeysIcon:a}),icon:G.createElement(O,{className:`${i}-icon`}),align:`center`};return t&&(o.label=typeof t==`function`?t({shortcutKeyInfo:r,components:{CreationLabel:br}}):t),e&&(o.icon=typeof e==`function`?e():e),[o.icon,o.label,n||o.align]},Sr=({className:e,icon:t,label:n,align:r,style:i,disabled:a,onClick:o,prefixCls:s,shortcutKeyInfo:c})=>{let[l,u,d]=xr({prefixCls:s,label:n,icon:t,align:r,shortcutKeyInfo:c});return G.createElement(`button`,{type:`button`,onClick:e=>{a||o?.(e)},style:i,className:m(s,e,`${s}-${d}`,{[`${s}-disabled`]:a})},l,u)},Cr=G.createContext(null),wr=({className:e,children:t})=>{let{prefixCls:n,groupInfo:r,enableCollapse:i,expandedKeys:o,onItemExpand:s,collapseMotion:u}=G.useContext(Cr)||{},{label:d,name:f,collapsible:p}=r||{},h=typeof d==`function`?d(f,{groupInfo:r}):d||f,g=p&&i,_=()=>{g&&s?.(r.name)},v=g&&!!o?.includes?.(f);return G.createElement(`li`,{className:e},G.createElement(`div`,{className:m(`${n}-group-title`,{[`${n}-group-title-collapsible`]:g}),onClick:_},h&&G.createElement(`div`,{className:m(`${n}-group-label`)},h),g&&G.createElement(`div`,{className:m(`${n}-group-collapse-trigger `,`${n}-group-collapse-trigger-${v?`open`:`close`}`)},G.createElement(l,null))),G.createElement(a,c({},u,{visible:!g||v}),({className:e,style:n},r)=>G.createElement(`div`,{className:m(e),ref:r,style:n},t)))},Tr=(e,t=[])=>{let[n,r,i]=(0,G.useMemo)(()=>{let t={label:``,collapsibleHandle:!1,collapsibleOptions:{}};if(!e)return[``,t.collapsibleHandle,t.collapsibleOptions];if(typeof e==`object`){let{collapsible:n,defaultExpandedKeys:r,expandedKeys:i,onExpand:a,...o}=e;t={...t,...o,collapsibleHandle:n,collapsibleOptions:{defaultExpandedKeys:r,expandedKeys:i,onExpand:a}}}return[t.label,t.collapsibleHandle,t.collapsibleOptions]},[e]);return G.useMemo(()=>{let a=t.reduce((t,i)=>{if(i?.type===`divider`||!i.group||!e)return t.push({data:[i],name:``,label:``,enableGroup:!1,collapsible:!1}),t;let a=i,o=t.some((e,n)=>e.name===a?.group&&(t[n].data.push(a),!0)),s=typeof r==`function`?r?.(a?.group):r;return o||t.push({data:[a],enableGroup:!0,name:a?.group,label:n,collapsible:s}),t},[]),o=a.reduce((e,t)=>(t.data.forEach(t=>{t.type!==`divider`&&e.push({key:t.key,disabled:t.disabled})}),e),[]);return[a,i,o]},[t,i])},Er=e=>{e.stopPropagation()},Dr=e=>{let{prefixCls:t,info:n,className:r,direction:i,onClick:a,active:o,menu:s,...l}=e,u=an(),d=(0,Wn.default)(l,{aria:!0,data:!0,attr:!0}),{disabled:f}=n,p=m(r,`${t}-item`,{[`${t}-item-active`]:o&&!f},{[`${t}-item-disabled`]:f}),h=()=>{!f&&a&&a(n.key)},{trigger:g,...v}=s||{},y=v?.getPopupContainer;return G.createElement(`li`,c({title:typeof n.label==`object`?void 0:`${n.label}`},d,{className:p,onClick:h}),n.icon&&G.createElement(`div`,{className:`${t}-icon`},n.icon),G.createElement(w.Text,{className:`${t}-label`},n.label),!f&&s&&G.createElement(`div`,{onClick:Er},G.createElement(M,{menu:v,placement:i===`rtl`?`bottomLeft`:`bottomRight`,trigger:[`click`],disabled:f,getPopupContainer:y},(e=>{let n=G.createElement(_,{onClick:Er,className:m(`${t}-menu-icon`,{[`${t}-menu-icon-mobile`]:u})});return g?typeof g==`function`?g(e,{originNode:n}):g:n})(n))))},Or=e=>{let{componentCls:t,calc:n}=e;return{[t]:{display:`flex`,flexDirection:`column`,gap:e.paddingXXS,overflowY:`auto`,padding:e.paddingSM,margin:0,listStyle:`none`,"ul, ol":{margin:0,padding:0,listStyle:`none`},[`&${t}-rtl`]:{direction:`rtl`},[`${t}-creation`]:{backgroundColor:e.creationBgColor,color:e.colorPrimary,border:`none`,fontWeight:500,paddingBlock:e.paddingXS,paddingInline:e.paddingSM,fontSize:e.fontSize,cursor:`pointer`,display:`flex`,touchAction:`manipulation`,gap:e.paddingXS,marginBlockEnd:e.marginSM,lineHeight:e.lineHeight,borderRadius:e.borderRadiusLG,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,[`&:not(${t}-creation-disabled):hover`]:{color:e.colorPrimary,background:e.creationHoverColor},[`&:not(${t}-creation-disabled)`]:{border:`${s(e.lineWidth)} ${e.lineType}, ${e.creationBorderColor}`},"&-start":{justifyContent:`flex-start`},"&-center":{justifyContent:`center`},"&-end":{justifyContent:`flex-end`},"&-label":{display:`flex`,justifyContent:`space-between`,alignItems:`center`},"&-label-shortcut-keys-show":{flex:1},"&-label-shortcut-keys":{height:e.controlHeightXS,display:`flex`,alignItems:`center`,gap:s(4)},"&-label-shortcut-key":{borderRadius:e.borderRadiusSM,height:`100%`,boxSizing:`border-box`,fontSize:e.fontSizeIcon,paddingInline:`${s(n(e.paddingXXS).sub(1).equal())}`,display:`flex`,justifyContent:`center`,alignItems:`center`,color:e.shortcutKeyTextColor,border:`${s(e.lineWidth)} ${e.lineType}, ${e.creationBorderColor}`},"&-disabled":{cursor:`not-allowed`,background:e.colorBgContainerDisabled,[`& ${t}-creation-label, ${t}-creation-icon`]:{color:e.colorTextDisabled},[`& ${t}-creation-label-shortcut-keys`]:{color:e.colorTextDisabled,border:`${s(e.lineWidth)} ${e.lineType}, ${e.colorBgContainerDisabled}`}}},[`${t}-divider`]:{marginBlock:e.marginXXS},[`${t}-item`]:{display:`flex`,height:e.controlHeightLG,minHeight:e.controlHeightLG,gap:e.paddingXS,padding:`0 ${s(e.paddingXS)}`,alignItems:`center`,borderRadius:e.borderRadiusLG,cursor:`pointer`,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,touchAction:`manipulation`,[`&:not(${t}-item-disabled):hover`]:{backgroundColor:e.colorBgTextHover},"&-active":{backgroundColor:e.colorBgTextHover,[`& ${t}-label, ${t}-menu-icon`]:{color:e.colorText}},"&-disabled":{cursor:`not-allowed`,[`& ${t}-label, ${t}-icon, ${t}-menu-icon`]:{color:e.colorTextDisabled}},"&:hover, &-active":{[`& ${t}-menu-icon`]:{opacity:.6}},[`${t}-menu-icon:hover`]:{opacity:1}},[`${t}-content-hidden`]:{display:`none`},[`${t}-label`]:{flex:1,color:e.colorText,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},[`${t}-menu-icon`]:{opacity:0,fontSize:e.fontSizeXL,[`&${t}-menu-icon-mobile`]:{opacity:.6}},[`${t}-list`]:{display:`flex`,gap:e.paddingXXS,flexDirection:`column`},[`${t}-group-collapsible-list`]:{paddingBlockStart:e.paddingXXS,[`& ${t}-item`]:{paddingInlineStart:e.paddingXL}},[`${t}-group-title`]:{display:`flex`,alignItems:`center`,color:e.colorTextDescription,height:e.controlHeightLG,minHeight:e.controlHeightLG,padding:`0 ${s(e.paddingXS)}`},[`${t}-group-title-collapsible`]:{justifyContent:`space-between`,cursor:`pointer`,color:e.colorText,borderRadius:e.borderRadiusLG,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,touchAction:`manipulation`,"&:hover":{backgroundColor:e.colorBgTextHover}},[`${t}-group-collapse-trigger`]:{transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,transform:`rotate(0deg)`,transformOrigin:`center center`},[`${t}-group-collapse-trigger-open`]:{transform:`rotate(90deg)`},[`${t}-group-collapse-trigger-close`]:{transform:`rotate(0deg)`}}}},kr=yn(`Conversations`,e=>{let t=b(e,{});return[Or(t),on(t)]},e=>{let t=new h(e.colorPrimary).setA(.15),n=new h(e.colorPrimary).setA(.22),r=new h(e.colorPrimary).setA(.25),i=new h(e.colorPrimary).setA(.65);return{creationBgColor:t.toRgbString(),creationBorderColor:n.toRgbString(),creationHoverColor:r.toRgbString(),shortcutKeyTextColor:i.toRgbString()}}),Ar=G.forwardRef((e,t)=>{let{prefixCls:n,shortcutKeys:r,rootClassName:a,items:o,activeKey:s,defaultActiveKey:l,onActiveChange:u,menu:d,styles:f={},classNames:p={},groupable:h,className:g,style:_,creation:v,...y}=e,b=(0,Wn.default)(y,{attr:!0,aria:!0,data:!0}),x=G.useRef(null);Mt(t,()=>({nativeElement:x.current}));let[S,C]=i(l,s),[w,T,E]=Tr(h,o),{getPrefixCls:D,direction:O}=Yt(),k=D(`conversations`,n),A=K(`conversations`),[j,M]=kr(k),N=m(k,A.className,A.classNames.root,g,p.root,a,j,M,{[`${k}-rtl`]:O===`rtl`}),te=e=>{C(e),u?.(e,o?.find(t=>t.key===e))},[ne,re,ie]=yr(`conversations`,r);ie(e=>{switch(e?.name){case`items`:{let t=e?.actionKeyCodeNumber??e?.index;typeof t==`number`&&!E?.[t]?.disabled&&E?.[t]?.key&&(C(E?.[t]?.key),u?.(E?.[t]?.key,o?.find(e=>e.key===E?.[t]?.key)))}break;case`creation`:typeof v?.onClick==`function`&&!v?.disabled&&v.onClick()}});let ae=e=>e.map((e,t)=>{if(e.type===`divider`)return G.createElement(ee,{key:`key-divider-${t}`,className:`${k}-divider`,dashed:e.dashed});let n=e,{label:r,disabled:i,icon:a,...o}=n;return G.createElement(Dr,c({},o,{key:n.key||`key-${t}`,info:n,prefixCls:k,direction:O,className:m(p.item,A.classNames.item,n.className),style:{...A.styles.item,...f.item,...n.style},menu:typeof d==`function`?d(n):d,active:S===n.key,onClick:te}))}),[P,oe,se,F]=cr(T,k,D());return G.createElement(`ul`,c({},b,{style:{...A.style,..._,...A.styles.root,...f.root},className:N,ref:x}),!!v&&G.createElement(Sr,c({className:m(A.classNames.creation,p.creation),style:{...A.styles.creation,...f.creation},shortcutKeyInfo:re?.creation,prefixCls:`${k}-creation`},v)),w.map((e,t)=>{let n=ae(e.data);return e.enableGroup?G.createElement(Cr.Provider,{key:e.name||`key-${t}`,value:{prefixCls:k,groupInfo:e,enableCollapse:P,expandedKeys:oe,onItemExpand:se,collapseMotion:F}},G.createElement(wr,{className:m(A.classNames.group,p.group)},G.createElement(`ul`,{className:m(`${k}-list`,{[`${k}-group-collapsible-list`]:e.collapsible}),style:{...A.styles.group,...f.group}},n))):n}))});Ar.Creation=Sr;var jr=G.createContext(null),Mr=G.forwardRef((e,t)=>{let{className:n,action:r,onClick:i,...a}=e,o=(0,G.useContext)(jr),{prefixCls:s,disabled:l,setSubmitDisabled:u}=o,d=a.disabled??l??o[`${r}Disabled`];return(0,G.useEffect)(()=>{r===`onSend`&&u?.(d)},[d,r,u]),G.createElement(A,c({type:`text`},a,{ref:t,onClick:e=>{d||(o[r]?.(),i?.(e))},disabled:d,className:m(s,n,{[`${s}-disabled`]:d})}))});function Nr(e,t){return G.createElement(Mr,c({icon:G.createElement(oe,null)},e,{action:`onClear`,ref:t}))}var Pr=G.forwardRef(Nr),Fr=(0,G.memo)(e=>{let{className:t}=e,[n]=Jt(`Sender`,Kt.Sender);return G.createElement(`svg`,{color:`currentColor`,viewBox:`0 0 1000 1000`,xmlns:`http://www.w3.org/2000/svg`,className:t},G.createElement(`title`,null,n.stopLoading),G.createElement(`rect`,{fill:`currentColor`,height:`250`,rx:`24`,ry:`24`,width:`250`,x:`375`,y:`375`}),G.createElement(`circle`,{cx:`500`,cy:`500`,fill:`none`,r:`450`,stroke:`currentColor`,strokeWidth:`100`,opacity:`0.45`}),G.createElement(`circle`,{cx:`500`,cy:`500`,fill:`none`,r:`450`,stroke:`currentColor`,strokeWidth:`100`,strokeDasharray:`600 9999999`},G.createElement(`animateTransform`,{attributeName:`transform`,dur:`1s`,from:`0 500 500`,repeatCount:`indefinite`,to:`360 500 500`,type:`rotate`})))}),Ir=G.forwardRef((e,t)=>{let{prefixCls:n}=G.useContext(jr),{className:r}=e;return G.createElement(Mr,c({icon:G.createElement(Fr,{className:`${n}-loading-icon`}),color:`primary`,variant:`text`,shape:`circle`},e,{className:m(r,`${n}-loading-button`),action:`onCancel`,ref:t}))});function Lr(e,t){return G.createElement(Mr,c({icon:G.createElement(ue,null),type:`primary`,shape:`circle`},e,{action:`onSend`,ref:t}))}var Rr=G.forwardRef(Lr),zr=G.createContext({}),Br=e=>{let t=(0,G.useCallback)(()=>typeof window>`u`?null:window.getSelection(),[]),n=(e,t)=>{if(!e||!t)return t;let n=e,r=null;for(n.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n!==t;)n instanceof HTMLElement&&n.tagName===`SPAN`&&(r=n),n=n.parentElement;return r||t},r=(0,G.useCallback)(()=>{let e=t();if(!e)return{range:null,selection:e};try{return{range:e.getRangeAt(0)||document.createRange(),selection:e}}catch{return{range:document.createRange(),selection:e}}},[t]),i=(0,G.useCallback)((e,t)=>{if(e&&t)try{t.removeAllRanges(),t.addRange(e)}catch(e){q(!1,`Sender`,`Failed to set range: ${e}`)}},[]),a=(0,G.useCallback)(()=>{let e=t();if(e)try{e.removeAllRanges()}catch(e){q(!1,`Sender`,`Failed to remove all ranges: ${e}`)}},[t]),o=(0,G.useCallback)((e,t=!1)=>{if(e&&typeof e.focus==`function`)try{e.focus({preventScroll:t})}catch(e){q(!1,`Sender`,`Failed to focus element: ${e}`)}},[]),s=(0,G.useCallback)((e,t)=>{if(!e)return;o(e,t);let{range:n,selection:a}=r();if(n&&a)try{n.selectNodeContents(e),n.collapse(!1),i(n,a)}catch(e){q(!1,`Sender`,`Failed to set end cursor: ${e}`)}},[o,r,i]),c=(0,G.useCallback)((e,t)=>{if(!e)return;o(e,t);let{range:n,selection:a}=r();if(n&&a)try{n.selectNodeContents(e),n.collapse(!0),i(n,a)}catch(e){q(!1,`Sender`,`Failed to set start cursor: ${e}`)}},[o,r,i]),l=(0,G.useCallback)((e,t,n)=>{if(!e)return;o(e,n);let{range:a,selection:s}=r();if(a&&s)try{a.selectNodeContents(e),t&&a.setStart(e,1),i(a,s)}catch(e){q(!1,`Sender`,`Failed to select all content: ${e}`)}},[o,r,i]),u=(0,G.useCallback)((e,t,n,a)=>{if(!e||typeof n!=`number`||n<0||!t)return{range:null,selection:null};o(t,a);let{range:s,selection:c}=r();if(s&&c)try{let t=Math.min(n,e.childNodes.length);s.setStart(e,t),s.setEnd(e,t),s.collapse(!1),i(s,c)}catch(e){q(!1,`Sender`,`Failed to set cursor position:: ${e}`)}return{range:s,selection:c}},[o,r,i]),d=(0,G.useCallback)((t,n,r=!1)=>{if(!e||!t?.current)return;let{getSlotDom:i,slotConfigMap:a}=e,o=e=>{let t=i(e);if(!t)return null;let n=a.get(e);if(!n)return null;if(n.type===`input`)return t.querySelector(`input`);let r=t?.getAttribute?.(`data-node-type`)||``;return n.type===`content`&&r!==`nbsp`?t:null},s=(e=>{let n=t.current;if(!n)return null;if(e)return o(e);for(let e of Array.from(n.childNodes)){let t=e?.getAttribute?.(`data-slot-key`);if(t){let e=o(t);if(e)return e}}return null})(n);s&&(s.nodeName===`INPUT`?s.focus({preventScroll:r}):u(s,t.current,0,r))},[e,u]),f=(0,G.useCallback)((e,t,n,r,i)=>{n&&r&&(o(t,i),n?.setStartAfter(e),n.collapse(!1),r.removeAllRanges(),r.addRange(n))},[o]),p=(0,G.useCallback)(e=>{if(!e)return{value:``,startContainer:null,startOffset:0};let n=t();if(!n||n.rangeCount===0)return{value:``,startContainer:null,startOffset:0};try{let t=n.getRangeAt(0),r=t.cloneRange();if(!e.contains(t.startContainer))return{value:``,startContainer:null,startOffset:0};if(t.endContainer===e&&t.endContainer.lastChild?.nodeType===Node.TEXT_NODE){let e=t.endContainer.lastChild;t=document.createRange(),t.setStart(e,e.length),t.setEnd(e,e.length)}return r=t.cloneRange(),r.selectNodeContents(e),r.setEnd(t.startContainer,t.startOffset),{value:r.toString().replace(/\u200B/g,``),startContainer:t.startContainer,startOffset:t.startOffset}}catch(e){return q(!1,`Sender`,`Failed to get text before cursor: ${e}`),{value:``,startContainer:null,startOffset:0}}},[t]),m=(0,G.useCallback)((i,a,o)=>{if(i===`start`||i===`end`)return{type:i,selection:t()};let l=null,u=null;if(o?.current)l=o.current,u=t();else{let e=r();l=e.range,u=e.selection}if(!l||!u)return{type:`end`,selection:u};let d=a?.current;if(!d)return{type:`end`,selection:u};let f=d.contains(l.endContainer),p=d.contains(l.startContainer);if(!f)return s(d,!0),{type:`end`,selection:u};if(!p)return c(d,!0),{type:`start`,selection:u};let m=n(l.endContainer,d),h=n(l.startContainer,d);if(m===h&&h!==d&&e?.getNodeInfo){let{slotKey:t,slotConfig:n,skillKey:r}=e.getNodeInfo(m)||{};if(t)return{type:`slot`,slotKey:n?.key,slotType:n?.type,range:l,selection:u};if(r)return{type:`start`,selection:u}}return{type:`box`,range:l,selection:u}},[e,r,t,s,c,n]),h=(0,G.useCallback)(e=>{let t=e.childNodes[e.childNodes.length-1],n=t?.nodeType===Node.TEXT_NODE&&t.textContent===`
|
|
`?e.childNodes.length-1:e.childNodes.length;return u(e,e,n).range||document.createRange()},[u]),g=(0,G.useCallback)(t=>{let n=+!!e?.getEditorValue?.().skill;return u(t,t,n).range||document.createRange()},[u,e]),_=(0,G.useCallback)(e=>e.replace(/\u200B/g,``).replace(/\n/g,``).replace(/^\n+|\n+$/g,``),[]);return{setEndCursor:s,setStartCursor:c,setAllSelectCursor:l,setCursorPosition:u,setAfterNodeFocus:f,setSlotFocus:d,getTextBeforeCursor:p,getSelection:t,removeAllRanges:a,getRange:r,getInsertPosition:m,getEndRange:h,getStartRange:g,copySelectionString:(0,G.useCallback)(async()=>{try{let e=t();if(!e)return!1;let n=e.toString();if(!n)return!1;let r=_(n);return await navigator.clipboard.writeText(r),!0}catch(e){return q(!1,`Sender`,`Failed to copy selection: ${e}`),!1}},[t,_]),getCleanedText:_}},Vr=4.35,Hr=(e,t,n)=>{let{token:r}=vn(),i=n.current?window.getComputedStyle(n.current):{},a=parseFloat(`${e.lineHeight||r.lineHeight}`),o=parseFloat(`${i?.fontSize||e.fontSize||r.fontSize}`),s=i?.lineHeight?parseFloat(`${i?.lineHeight}`):a*o;return t===!1||!t?{}:t===!0?{height:`auto`}:{minHeight:t.minRows?(s+Vr)*t.minRows:`auto`,maxHeight:t.maxRows?(s+Vr)*t.maxRows:`auto`,overflowY:`auto`}},Ur=e=>{let{prefixCls:t,placeholder:n,slotDomMap:r,slotConfigMap:i}=e,a=(0,G.useCallback)(e=>{let r=document.createElement(`span`);return r.setAttribute(`contenteditable`,`false`),r.dataset.skillKey=e,r.dataset.placeholder=n||``,r.className=`${t}-skill`,r},[t,n]),o=(0,G.useCallback)(e=>{let n=document.createElement(`span`);return n.setAttribute(`contenteditable`,`true`),n.dataset.slotKey=e.key,n.className=m(`${t}-slot`,`${t}-slot-content`),n},[t]),s=(0,G.useCallback)(e=>{let n=document.createElement(`span`);return n.setAttribute(`contenteditable`,`false`),n.dataset.slotKey=e,n.className=`${t}-slot`,n},[t]),c=(0,G.useCallback)((e,n)=>{let r=document.createElement(`span`);return r.setAttribute(`contenteditable`,`false`),r.dataset.slotKey=e,r.dataset.nodeType=`nbsp`,r.className=m(`${t}-slot-${n}`,`${t}-slot-no-width`),r.textContent=`\xA0`,r},[t]),l=(e,t)=>{r.current.set(e,t)},u=e=>r.current.get(e);return{buildSkillSpan:a,buildEditSlotSpan:o,buildSlotSpan:s,buildSpaceSpan:c,saveSlotDom:l,getSlotDom:u,getSlotLastDom:(e,t)=>(t??i.get(e)?.type)===`content`?u(`${e}_after`):u(e)}},Wr=new Set([`input`,`select`,`custom`,`content`]),Gr=e=>e?.reduce((e,t)=>{let{key:n,type:r}=t;if(!n)return e;let i=t.props||{};return e[n]=(Wr.has(r)?i.defaultValue:i.value??i.label)??``,e},{})??{},Kr=(e,t)=>{e?.forEach(e=>{e.key&&t.set(e.key,e)})},qr=(e,t)=>{if(!e?.dataset)return null;let{dataset:n}=e;return{slotKey:n.slotKey,placeholder:n.placeholder,nodeType:n.nodeType,skillKey:n.skillKey,slotConfig:n.slotKey?t.get(n.slotKey):void 0,targetNode:e}},Jr=e=>{let[t,n]=(0,G.useState)({}),r=(0,G.useRef)(t),i=(0,G.useRef)(new Map),a=(0,G.useRef)(new Set);(0,G.useEffect)(()=>{if(!e)return;i.current.forEach((e,t)=>{a.current.has(t)||i.current.delete(t)}),Kr(e,i.current);let t=Gr(e);a.current.forEach(e=>{e in r.current&&(t[e]=r.current[e])}),n(t),r.current=t},[e]);let o=(0,G.useCallback)(e=>{let t=typeof e==`function`?e(r.current):e;n(t),r.current=t},[]),s=(0,G.useCallback)(e=>{let t=Gr(e);e.forEach(e=>{e.key&&(i.current.set(e.key,e),a.current.add(e.key))}),n(e=>({...e,...t})),r.current={...r.current,...t}},[]),c=(0,G.useCallback)(()=>{i.current.clear(),a.current.clear(),n({}),r.current={}},[]),l=(0,G.useCallback)(e=>qr(e,i.current),[]);return[i.current,{getSlotValues:()=>r.current,setSlotValues:o,mergeSlotConfig:s,getNodeInfo:l,getNodeTextValue:e=>{let t=e.nodeType;if(t===Node.TEXT_NODE)return e.textContent||``;if(t!==Node.ELEMENT_NODE)return``;let n=e,i=l(n);if(!i)return n.innerText||``;let{slotKey:a,skillKey:o,nodeType:s,slotConfig:c}=i;if(o)return``;let u=n.innerText||``;if(a){if(s===`nbsp`)return` `;if(!c)return u;let e=c.type===`content`?u:r.current[a]??``;return c.formatResult?.(e)??e}return u},clear:c}]},Yr=({removeSkill:e,prefixCls:t,toolTip:n,closable:r,title:i,value:a})=>{let o=`${t}-skill`,s=(0,G.useMemo)(()=>{if(!r)return[null];let t=typeof r==`boolean`?{}:r,n=n=>{t.disabled||(n.stopPropagation(),e(),t.onClose?.(n))},i=t.closeIcon||G.createElement(D,{className:`${o}-close-icon`});return G.createElement(`div`,{className:m(`${o}-close`,{[`${o}-close-disabled`]:t.disabled}),onClick:n,role:`button`,"aria-label":`Close skill`,tabIndex:0},i)},[r,e]),c=i||a,l=n?G.createElement(T,n,c):c;return G.createElement(`div`,{className:`${o}-wrapper`,contentEditable:!1},G.createElement(`div`,{className:`${o}-tag`,contentEditable:!1,role:`button`,tabIndex:0},G.createElement(`span`,{className:`${o}-tag-text`},l),s),G.createElement(`div`,{className:`${o}-holder`}))};Yr.displayName=`Skill`;var Xr=e(d()),Zr=G.forwardRef((e,t)=>{let{onChange:n,onKeyUp:r,onKeyDown:i,onPaste:a,onPasteFile:o,disabled:s,readOnly:l,submitType:u=`enter`,prefixCls:d,styles:f={},classNames:p={},autoSize:h,triggerSend:g,placeholder:_,onFocus:v,onBlur:y,slotConfig:b,skill:x,...S}=G.useContext(zr),{direction:C,getPrefixCls:w}=Yt(),T=`${w(`sender`,d)}`,E=K(`sender`),D=`${T}-input`,O=(0,G.useRef)(null),k=(0,G.useRef)(new Map),A=(0,G.useRef)(!1),j=(0,G.useRef)(!1),ee=(0,G.useRef)(null),N=(0,G.useRef)(null),ne=(0,G.useRef)(null),re={...E.styles?.input,...f.input},ie=Hr(re,h,O),ae={...(0,Wn.default)(S,{attr:!0,aria:!0,data:!0}),ref:O},[P,{getSlotValues:oe,setSlotValues:se,getNodeInfo:F,mergeSlotConfig:ce,getNodeTextValue:le,clear:ue}]=Jr(b),[de,fe]=(0,G.useState)(new Map),[L,pe]=(0,G.useState)(null),{setEndCursor:R,setStartCursor:me,setAllSelectCursor:he,setCursorPosition:ge,setSlotFocus:_e,setAfterNodeFocus:ve,getTextBeforeCursor:ye,removeAllRanges:be,getRange:z,getInsertPosition:B,getEndRange:xe,getStartRange:Se,getSelection:Ce,copySelectionString:we,getCleanedText:Te}=Br({prefixCls:T,getSlotDom:e=>k.current.get(e),slotConfigMap:P,getNodeInfo:F,getEditorValue:()=>Le()}),{buildSkillSpan:Ee,buildEditSlotSpan:De,buildSlotSpan:Oe,buildSpaceSpan:ke,getSlotDom:Ae,saveSlotDom:je,getSlotLastDom:Me}=Ur({prefixCls:T,placeholder:_,slotDomMap:k,slotConfigMap:P}),Ne=e=>{let t=Le();N.current&&(!t?.value&&t.slotConfig.length===0&&_?(N.current.setAttribute(`contenteditable`,`true`),N.current.classList.add(`${T}-skill-empty`)):(N.current.setAttribute(`contenteditable`,`false`),N.current.classList.remove(`${T}-skill-empty`))),n?.(t.value,e,t.slotConfig,t.skill)},Pe=(e,t,n)=>{let r=Ae(e),i=P.get(e);if(se(n=>({...n,[e]:t})),r&&i){let t=Fe(i,r);fe(n=>{let r=new Map(n);return r.set(e,t),r}),Ne(n)}},Fe=(e,t)=>{if(!e.key)return null;let n=oe()[e.key];return(0,Xr.createPortal)((()=>{switch(e.type){case`content`:return t.innerHTML=n||``,t.setAttribute(`data-placeholder`,e.props?.placeholder||``),null;case`input`:return G.createElement(te,{readOnly:l,className:`${T}-slot-input`,placeholder:e.props?.placeholder||``,"data-slot-input":e.key,size:`small`,variant:`borderless`,value:n||``,tabIndex:0,onKeyDown:qe,onChange:t=>{Pe(e.key,t.target.value,t)},spellCheck:!1});case`select`:return G.createElement(M,{disabled:l,menu:{items:e.props?.options?.map(e=>({label:e,key:e})),defaultSelectedKeys:e.props?.defaultValue?[e.props.defaultValue]:[],selectable:!0,onSelect:({key:t,domEvent:n})=>{Pe(e.key,t,n)}},trigger:[`click`]},G.createElement(`span`,{className:m(`${T}-slot-select`,{placeholder:!n,[`${T}-slot-select-selector-value`]:n})},G.createElement(`span`,{"data-placeholder":e.props?.placeholder,className:`${T}-slot-select-value`},n||``),G.createElement(`span`,{className:`${T}-slot-select-arrow`},G.createElement(I,null))));case`tag`:return G.createElement(`span`,{className:`${T}-slot-tag`},e.props?.label||e.props?.value||``);case`custom`:return e.customRender?.(n,t=>{Pe(e.key,t)},{disabled:s,readOnly:l},e);default:return null}})(),t)},Ie=e=>e.reduce((e,t)=>{if(t.type===`text`)return e.push(document.createTextNode(t.value||``)),e;let n=t.key;if(q(!!n,`Sender`,`Slot key is missing: ${n}`),n){let r,i;if(t.type===`content`){i=De(t);let e=ke(n,`before`),a=ke(n,`after`);r=[e,i,a],je(`${n}_before`,e),je(n,i),je(`${n}_after`,a)}else i=Oe(n),r=[i],je(n,i);if(i){let a=Fe(t,i);a&&(fe(e=>{let t=new Map(e);return t.set(n,a),t}),e.push(...r))}}return e},[]),Le=()=>{let e=O.current,t={value:``,slotConfig:[],skill:void 0};if(!e)return t;let n=e.childNodes;if(n.length===0)return e.innerHTML=``,N.current=null,t;let r=!!x,i=Array(n.length),a=[],o,s=0;for(let e=0;e<n.length;e++){let t=n[e],c=le(t);if(i[s++]=c,t.nodeType===Node.TEXT_NODE)c&&a.push({type:`text`,value:c});else if(t.nodeType===Node.ELEMENT_NODE){let e=F(t);if(e){let{skillKey:t,slotKey:n,nodeType:i}=e;if(t&&r&&(o=x),n&&i!==`nbsp`){let e=P.get(n);e&&a.push({...e,value:c})}}}}let c=i.slice(0,s).join(``);return o||(N.current=null),{value:c,slotConfig:a,skill:o}},Re=()=>{let e=O.current;e&&(e.innerHTML=``,N.current=null,ne.current=null,ee.current=null,be(),k?.current?.clear())},ze=e=>{e.forEach(e=>{O.current?.appendChild(e)})},Be=(e,t)=>{let n=O.current;n&&(n.querySelectorAll(`[data-slot-key="${e}"]`).forEach(e=>{e.remove()}),k.current.delete(e),se(t=>{let{[e]:n,...r}=t;return r}),fe(t=>{let n=new Map(t);return n.delete(e),n}),Ne(t))},V=()=>{if(x&&ne.current!==x){Ve(!1),ne.current=x;let e=Ee(x.value),t=(0,Xr.createPortal)(G.createElement(Yr,c({removeSkill:Ve},x,{prefixCls:T})),e);pe(t);let n=document.createRange(),r=O.current;if(!r)return;n.setStart(r,0),n.insertNode(e),N.current=e,Ne()}},Ve=(e=!0)=>{O.current&&N.current&&(N.current?.remove(),N.current=null,ne.current=null,e&&Ne())},H=e=>{u===`enter`&&e&&e.querySelectorAll(`br`).forEach(e=>{e.remove()})},He=()=>{b&&b.length>0&&O.current&&(Re(),ze(Ie(b)))},U=e=>{let t=i?.(e);return j.current||A.current||t===!1},Ue=(e,t)=>{if(!O.current)return!1;let{range:n,selection:r}=z();if(!r||r.rangeCount===0)return!1;let{focusOffset:i,anchorNode:a}=r;if(!a||!O.current.contains(a))return!1;if(a.nodeType===Node.TEXT_NODE&&n){let r=a.parentNode,o=F(r),s=n.toString(),c=a.textContent?.length===s.length,l=a.textContent?.length===1&&i===1;if(o?.slotConfig?.type===`content`&&(c||l))return e.preventDefault(),t===`cut`&&we(),a.parentNode.innerHTML=``,!0}if(t===`backspace`&&i===0){let t=a.previousSibling;if(t){let n=F(t);if(n){let{slotKey:t,skillKey:r}=n;if(t)return e.preventDefault(),Be(t,e),!0;if(r)return e.preventDefault(),Ve(),!0}}}return!1},W=e=>{let{key:t,shiftKey:n,ctrlKey:r,altKey:i,metaKey:a}=e;if(t!==`Enter`)return!1;let o=r||i||a;return u===`enter`&&!n&&!o||u===`shiftEnter`&&n&&!o},We=()=>{if(!N.current||!O.current||N.current.getAttribute(`contenteditable`)===`false`)return;let e=Ce();e?.anchorNode&&N.current.contains(e.anchorNode)&&O.current.contains(e.anchorNode)&&(N.current.setAttribute(`contenteditable`,`false`),N.current.classList.remove(`${T}-skill-empty`),ot({cursor:`end`}))},Ge=()=>{A.current=!0},Ke=()=>{A.current=!1,j.current=!1},qe=e=>{if(!U(e)&&!(e.key===`Backspace`&&Ue(e,`backspace`))){if(W(e)){e.preventDefault(),j.current=!0,g?.();return}if((e.key===`a`||e.key===`A`)&&(e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){he(O.current,N.current),e.preventDefault();return}We()}},Je=e=>{v?.(e)},Ye=e=>{j.current&&=!1;let{range:t}=z();ee.current=t;let n=setTimeout(()=>{ee.current=null,clearTimeout(n)},200);y?.(e)},Xe=e=>{H(O?.current),Ne(e)},Ze=e=>{Ue(e,`cut`)},Qe=e=>{e.preventDefault();let t=e.clipboardData?.files,n=e.clipboardData?.getData(`text/plain`);if(!n&&t?.length&&o){o(t);return}if(n){let e=!1,t=Te(n);try{e=document.execCommand(`insertText`,!1,t)}catch(e){q(!1,`Sender`,`insertText command failed: ${e}`)}e||tt([{type:`text`,value:t}])}a?.(e)},$e=e=>{e.key===`Enter`&&(j.current=!1),r?.(e)},et=()=>{let e=O.current,t=Ce();e&&t?.focusNode===e&&t.focusOffset===0&&Le().skill&&ge(e,O.current,1)},tt=(e,t,n,r)=>{let i=O.current;if(i)try{ce(e);let a=Ie(e);if(a.length===0)return;let o=nt(t,i);if(!o.range||!o.selection)return;let{range:s,selection:c}=o;n?.length&&rt(s,n,i),s.deleteContents(),it(a,s,o),at(a,s,c,r)}catch(e){q(!1,`Sender`,`Insert operation failed: ${e}`)}},nt=(e,t)=>{let{type:n,slotKey:r,slotType:i,range:a,selection:o}=B(e,O,ee);if(!o)return{range:null,selection:null,type:n};let s=null;switch(n){case`end`:s=xe(t);break;case`start`:s=Se(t);break;case`slot`:s=z().range;break;case`box`:s=a||null,s&&N.current&&s.collapsed&&s.startOffset===0&&s.setStartAfter(N.current)}return{range:s,selection:o,type:n,slotKey:r,slotType:i}},rt=(e,t,n)=>{let{value:r,startContainer:i,startOffset:a}=ye(n);r.length>=t.length&&r.endsWith(t)&&i&&a>=0&&(e.setStart(i,a-t.length),e.setEnd(i,a),e.deleteContents())},it=(e,t,n)=>{let{type:r,slotKey:i,slotType:a}=n,o=!0;e.forEach(e=>{if(o&&r===`slot`&&(a!==`content`||e.nodeType!==Node.TEXT_NODE)&&i){o=!1;let e=Me(i);e&&t.setStartAfter(e)}t.insertNode(e),t.setStartAfter(e)})},at=(e,t,n,r)=>{let i=e[e.length-1];ve(i,O.current,t,n,r),setTimeout(()=>{Xe(null)},0)},ot=e=>{let t={preventScroll:e?.preventScroll??!1,cursor:e?.cursor??`end`,key:e?.key};switch(t.cursor){case`slot`:_e(O,e?.key,t.preventScroll);break;case`start`:me(O.current,t.preventScroll);break;case`all`:he(O.current,N.current,t.preventScroll);break;case`end`:R(O.current,t.preventScroll)}},st=()=>{let e=O.current;e&&(e.innerHTML=``,ne.current=null,N.current=null,ue(),V(),ee.current=null,k?.current?.clear(),Xe(null))};return(0,G.useEffect)(()=>{He(),x?V():Ne()},[b]),(0,G.useEffect)(()=>{V()},[x]),(0,G.useImperativeHandle)(t,()=>({nativeElement:O.current,focus:ot,blur:()=>O.current?.blur(),insert:tt,clear:st,getValue:Le})),G.createElement(G.Fragment,null,G.createElement(`div`,c({},ae,{role:`textbox`,tabIndex:0,style:{...re,...ie},className:m(D,`${D}-slot`,E.classNames.input,p.input,{[`${T}-rtl`]:C===`rtl`}),"data-placeholder":_,contentEditable:!l,suppressContentEditableWarning:!0,spellCheck:!1,onCut:Ze,onKeyDown:qe,onKeyUp:$e,onPaste:Qe,onCompositionStart:Ge,onCompositionEnd:Ke,onFocus:Je,onBlur:Ye,onSelect:et,onInput:Xe},S)),G.createElement(`div`,{style:{display:`none`},id:`${T}-slot-placeholders`},Array.from(de.values()),L))}),Qr=G.forwardRef((e,t)=>{let{speechRecording:n,disabled:r,onSpeechDisabled:i,prefixCls:a}=G.useContext(jr),o=e.disabled??r??i,s=null;return s=n?G.createElement(nn,{className:`${a}-recording-icon`}):o?G.createElement(F,null):G.createElement(ae,null),G.createElement(Mr,c({icon:s,variant:`text`,color:`primary`},e,{action:`onSpeech`,ref:t}))}),$r=e(t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e,t){let n=e;for(let e=0;e<t.length;e+=1){if(n==null)return;n=n[t[e]]}return n}}))());function ei(e,t,n){return(0,$r.default)(e,t)||n}var ti=G.forwardRef((e,t)=>{let{value:n,onChange:r,onKeyUp:i,onKeyDown:a,onPaste:o,onPasteFile:s,disabled:l,readOnly:u,submitType:d=`enter`,prefixCls:f,styles:p={},classNames:h={},autoSize:g,components:_,triggerSend:v,placeholder:y,onFocus:b,onBlur:x,...S}=G.useContext(zr),C=G.useRef(null),w=(e,t=`cursor`)=>{let n=C.current?.resizableTextArea?.textArea,i=n.value,a=i.length,o=i.length;t===`cursor`&&(a=n?.selectionStart,o=n?.selectionEnd),t===`start`&&(a=0,o=0),n.value=i.substring(0,a)+e+i.substring(o,i.length),n.selectionStart=a+e.length,n.selectionEnd=a+e.length,n.focus(),r?.(n.value)},T=()=>{r?.(``)},E=()=>({value:n||``,slotConfig:[]});G.useImperativeHandle(t,()=>({nativeElement:C.current?.resizableTextArea?.textArea,focus:C.current?.focus,blur:C.current?.blur,insert:w,clear:T,getValue:E}));let D=G.useRef(!1),O=()=>{D.current=!0},k=()=>{D.current=!1},A=e=>{let t=a?.(e),{key:n,shiftKey:r,ctrlKey:i,altKey:o,metaKey:s}=e;if(!(D.current||n!==`Enter`||t===!1)&&n===`Enter`){let t=i||o||s;if(d===`enter`&&!r&&!t||d===`shiftEnter`&&r&&!t){e.preventDefault(),v?.();return}}},j=e=>{let t=e.clipboardData?.files;!e.clipboardData?.getData(`text/plain`)&&t?.length&&s&&(s(t),e.preventDefault()),o?.(e)},ee=ei(_,[`input`],te.TextArea),M={...(0,Wn.default)(S,{attr:!0,aria:!0,data:!0}),ref:C};return G.createElement(ee,c({},M,{disabled:l,style:p.input,className:m(`${f}-input`,h.input),autoSize:g,value:n,onChange:e=>{r?.(e.target.value,e)},onKeyUp:i,onCompositionStart:O,onCompositionEnd:k,onKeyDown:A,onPaste:j,variant:`borderless`,readOnly:u,placeholder:y,onFocus:b,onBlur:x}))});function ni(e,t){let n=g(e),[r,a,o]=G.useMemo(()=>typeof t==`object`?[t.recording,t.onRecordingChange,typeof t.recording==`boolean`]:[void 0,void 0,!1],[t]),[s,c]=G.useState(null);G.useEffect(()=>{if(!o&&`permissions`in navigator){let e=null;return navigator.permissions.query({name:`microphone`}).then(t=>{c(t.state),t.onchange=function(){c(this.state)},e=t}).catch(e=>{q(!1,`Sender`,`Browser does not support querying microphone permission. ${e instanceof Error?e.message:String(e)}`)}),()=>{e&&(e.onchange=null)}}},[o]);let l;!l&&typeof window<`u`&&(l=window.SpeechRecognition||window.webkitSpeechRecognition);let u=!!(o||l&&s!==`denied`),d=G.useRef(null),[f,p]=i(!1,r),m=G.useRef(!1),h=()=>{if(u&&!d.current){let e=new l;e.onstart=()=>{p(!0)},e.onend=()=>{p(!1)},e.onresult=e=>{if(!m.current){let t=e.results?.[0]?.[0]?.transcript;n(t)}m.current=!1},d.current=e}},_=g(e=>{(!e||f)&&(m.current=e,o?a?.(!f):(h(),d.current&&(f?(d.current.stop(),a?.(!1)):(d.current.start(),a?.(!0)))))});return G.useEffect(()=>()=>{let e=d.current;if(e){e.onstart=null,e.onend=null,e.onresult=null;try{e.stop()}catch{}d.current=null}},[]),[u,_,f]}var ri=G.createContext({}),ii=()=>({height:0}),ai=e=>({height:e.scrollHeight});function oi(e){let{title:t,onOpenChange:n,open:r,children:i,className:o,style:s,classNames:c={},styles:l={},prefixCls:u,closable:d,forceRender:f}=e,{prefixCls:p}=G.useContext(ri),{direction:h,getPrefixCls:g}=Yt(),_=g(`sender`,u||p),v=`${_}-header`,y=()=>{n?.(!r)};return G.createElement(a,{motionEnter:!0,motionLeave:!0,motionName:`${v}-motion`,leavedClassName:`${v}-motion-hidden`,onEnterStart:ii,onEnterActive:ai,onLeaveStart:ai,onLeaveActive:ii,visible:r,forceRender:f},({className:e,style:n})=>G.createElement(`div`,{className:m(_,v,e,o,{[`${v}-rtl`]:h===`rtl`}),style:{...n,...s}},(d!==!1||t)&&G.createElement(`div`,{className:m(`${v}-header`,c.header),style:{...l.header}},G.createElement(`div`,{className:`${v}-title`},t),d!==!1&&G.createElement(`div`,{className:`${v}-close`},G.createElement(A,{type:`text`,icon:G.createElement(D,null),size:`small`,onClick:y}))),i&&G.createElement(`div`,{className:m(`${v}-content`,c.content),style:{...l.content}},i)))}var si=e=>{let{componentCls:t,calc:n}=e,r=`${t}-header`;return{[t]:{[`&${r}-rtl`]:{direction:`rtl`},[`${r}`]:{borderBottomWidth:e.lineWidth,borderBottomStyle:`solid`,borderBottomColor:e.colorBorderInput,[`${r}-header`]:{background:e.colorFillAlter,fontSize:e.fontSize,lineHeight:e.lineHeight,paddingBlock:n(e.paddingSM).sub(e.lineWidthBold).equal(),paddingInlineStart:e.padding,paddingInlineEnd:e.paddingXS,display:`flex`,borderRadius:{_skip_check_:!0,value:n(e.borderRadius).mul(2).equal()},borderEndStartRadius:0,borderEndEndRadius:0,[`${r}-title`]:{flex:`auto`}},[`${r}-content`]:{padding:e.padding}},[`${r}-motion`]:{transition:[`height`,`border`].map(t=>`${t} ${e.motionDurationSlow}`).join(`,`),overflow:`hidden`,"&-enter-start, &-leave-active":{borderBottomColor:`transparent`},"&-hidden":{display:`none`}}}}},ci=e=>{let{componentCls:t,antCls:n,calc:r}=e,i=`${t}-slot`,a=`${n}-input`,o=`${a}-borderless`,c=`${n}-dropdown-trigger`,l=`${t}-slot-input`,u=`${t}-slot-select`,d=`${t}-slot-tag`,f=`${t}-slot-content`,p=`${t}-skill`;return{[t]:{[`${t}-input-slot`]:{outline:`none`,cursor:`text`,whiteSpace:`pre-wrap`,width:`100%`,caretColor:e.colorPrimary,fontSize:e.fontSize,lineHeight:e.lineHeight,"&:empty::before":{content:`attr(data-placeholder)`,color:e.colorTextPlaceholder}},[`${i}:not(${f})`]:{display:`inline-block`,verticalAlign:`middle`,alignItems:`center`,marginBlock:1,height:r(e.fontSize).mul(e.lineHeight).add(2).equal(),wordBreak:`break-all`,marginInline:e.marginXXS},[`${a}${l}`]:{height:`100%`,background:e.colorBgSlot,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,paddingInline:e.paddingXXS,fontSize:`inherit`,lineHeight:`inherit`,position:`relative`,[`&${o}`]:{"&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)":{outline:`none`}},"&::placeholder":{color:e.colorTextSlotPlaceholder,fontSize:`inherit`,lineHeight:`inherit`},[i]:{display:`inline-flex`,margin:`0 ${s(e.marginXXS)}`,verticalAlign:`bottom`,alignItems:`center`,marginBlock:s(r(e.marginXXS).div(2).equal()),minHeight:e.controlHeightSM,wordBreak:`break-all`}},[u]:{fontSize:e.fontSize,lineHeight:e.lineHeight,paddingInline:e.paddingXXS,transition:`border-color ${e.motionDurationMid}`,position:`relative`,display:`inline-flex`,alignItems:`center`,cursor:`pointer`,background:e.colorBgSlot,height:`100%`,boxSizing:`border-box`,borderRadius:e.borderRadius,color:e.colorTextSlot,border:`1px solid ${e.colorBorderSlot}`,"&.placeholder":{color:e.colorTextSlotPlaceholder},[`${u}`]:{fontSize:e.fontSize,lineHeight:e.lineHeight,padding:`0 ${s(e.paddingXXS)}`,transition:`border-color ${e.motionDurationMid}`,position:`relative`,display:`inline`,cursor:`pointer`,background:e.colorBgSlot,alignItems:`center`,justifyContent:`center`,borderRadius:e.borderRadius,color:e.colorTextSlot,border:`1px solid ${e.colorBorderSlot}`,"&.placeholder":{color:e.colorTextSlotPlaceholder},[`&${c}-open`]:{borderColor:e.colorBorderSlotHover}},[`${u}-value`]:{flex:1,fontSize:e.fontSize,lineHeight:e.lineHeight,"&:empty::before":{content:`attr(data-placeholder)`}},[`${u}-arrow`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSize,lineHeight:e.lineHeight,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},[`${d}`]:{background:e.colorBgSlot,border:`1px solid ${e.colorBorderSlot}`,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,padding:`0 ${s(e.paddingXXS)}`,fontSize:e.fontSize,lineHeight:e.lineHeight,position:`relative`,cursor:`default`}},[`${u}-arrow`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSize,lineHeight:e.lineHeight,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},[d]:{background:e.colorBgSlot,border:`1px solid ${e.colorBorderSlot}`,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,padding:`0 ${s(e.paddingXXS)}`,fontSize:e.fontSize,lineHeight:e.lineHeight,height:`100%`,boxSizing:`border-box`,position:`relative`,cursor:`default`},[f]:{height:r(e.fontSize).mul(e.lineHeight).add(2).equal(),caretColor:e.colorPrimary,background:e.colorBgSlot,outline:`none`,color:e.colorTextSlot,borderRadius:e.borderRadius,paddingInline:e.paddingXXS,boxSizing:`border-box`,verticalAlign:`middle`,fontSize:e.fontSize,marginBlock:1,lineHeight:e.lineHeight,display:`inline-block`,position:`relative`,cursor:`text`,"&:empty":{width:`fit-content`,"&::after":{display:`inline-block`,height:`inherit`,content:`attr(data-placeholder)`,color:e.colorTextSlotPlaceholder}}},[`${i}-no-width`]:{userSelect:`none`,width:`3px`,display:`inline-block`,lineHeight:`inherit`},[p]:{display:`inline-block`,verticalAlign:`baseline`,alignItems:`center`,marginBlock:1,height:r(e.fontSize).mul(e.lineHeight).add(2).equal(),wordBreak:`break-all`,paddingInlineEnd:0,paddingInlineStart:0,marginInlineEnd:0,marginInlineStart:-1,[`&${p}-empty`]:{"&::after":{display:`inline-block`,pointerEvents:`none`,height:`inherit`,content:`attr(data-placeholder)`,color:e.colorTextPlaceholder}}},[`${p}-wrapper`]:{height:`100%`,display:`inline-flex`},[`${p}-tag`]:{paddingInline:e.paddingXS,height:`100%`,backgroundColor:e.colorBgSkill,borderRadius:e.borderRadius,color:e.colorPrimary,alignItems:`center`,fontWeight:500,display:`inline-flex`,cursor:`pointer`,gap:e.marginXXS,transition:`background-color ${e.motionDurationMid}`,"&:hover":{backgroundColor:e.colorBgSkillHover,[`${p}-tag-close:not(${p}-tag-close-disabled)`]:{color:e.colorPrimaryHover}},"&-close":{fontSize:e.fontSizeSM,display:`inline-flex`,transition:`color ${e.motionDurationMid}`,color:e.colorPrimary},"&-close-disabled":{cursor:`not-allowed`,color:e.colorTextDisabled}},[`${p}-holder`]:{width:e.marginXS,height:`100%`}}}},li=e=>{let{componentCls:t,antCls:n}=e,r=`${t}-switch`;return{[t]:{[`&${r}-rtl`]:{direction:`rtl`},[`&${r}`]:{display:`inline-block`,[`${n}-btn:not(:disabled):not(${n}-btn-disabled):hover`]:{background:e.switchUncheckedHoverBg,borderColor:e.colorBorder,color:e.colorText},[`&${r}-checked`]:{[`${n}-btn:not(:disabled):not(${n}-btn-disabled):hover`]:{background:e.switchCheckedHoverBg,borderColor:e.colorPrimary,color:e.colorPrimaryText},[`${r}-content`]:{background:e.switchCheckedBg}}}}}},ui=e=>{let{antCls:t,componentCls:n,paddingSM:r,paddingXS:i,paddingXXS:a,lineWidth:o,calc:s}=e;return{[n]:{[`&${n}-main`]:{position:`relative`,width:`100%`,boxSizing:`border-box`,boxShadow:`${e.boxShadowTertiary}`,borderRadius:{_skip_check_:!0,value:s(e.borderRadius).mul(2).equal()},borderColor:e.colorBorderInput,borderWidth:o,borderStyle:`solid`},[`&${n}-disabled`]:{background:e.colorBgContainerDisabled,borderColor:`transparent`},[`&${n}-rtl`]:{direction:`rtl`},[`${n}-content`]:{display:`flex`,gap:i,width:`100%`,paddingBlock:r,paddingInlineStart:r,paddingInlineEnd:r,boxSizing:`border-box`,alignItems:`flex-end`},[`${n}-prefix`]:{flex:`none`},[`${n}-input`]:{paddingInline:0,borderRadius:0,flex:`auto`,alignSelf:`center`,caretColor:e.colorPrimary,fontSize:e.fontSize,[`&${t}-input-borderless`]:{"&:focus-visible, &:has(input:focus-visible), &:has(textarea:focus-visible)":{outline:`none`}}},[`${n}-actions-list`]:{flex:`none`,display:`flex`,"&-presets":{gap:e.paddingXS}},[`${n}-actions-btn`]:{[`&-disabled:where(${t}-btn-variant-text)`]:{color:e.colorTextActionsDisabled,borderColor:`transparent`},[`&-disabled:not(${t}-btn-variant-text)`]:{background:e.colorBgActionsDisabled,color:e.colorTextLightSolid,borderColor:`transparent`},"&-loading-button":{padding:0,border:0},"&-loading-icon":{height:e.controlHeight,width:e.controlHeight,verticalAlign:`top`},"&-recording-icon":{height:`1.2em`,width:`1.2em`,verticalAlign:`top`}},[`${n}-footer`]:{paddingInlineStart:r,paddingInlineEnd:r,paddingBlockEnd:r,paddingBlockStart:a,boxSizing:`border-box`}}}},di=yn(`Sender`,e=>{let{paddingXS:t,calc:n}=e,r=b(e,{SenderContentMaxWidth:`calc(100% - ${s(n(t).add(32).equal())})`});return[ui(r),si(r),li(r),ci(r)]},e=>{let{colorPrimary:t,colorFillTertiary:n}=e,r=new h(t).setA(.06).toRgbString(),i=new h(t).setA(.08).toRgbString(),a=new h(t).setA(.15).toRgbString(),o=t,s=new h(t).setA(.25).toRgbString(),c=new h(t).setA(.1).toRgbString(),l=r,u=new h(t).setA(.08).toRgbString(),d=new h(n).setA(.04).toRgbString(),f=new h(t).setA(.1).toRgbString(),p=new h(n).setA(.1).toRgbString(),m=`0 4px 12px 0 ${new h(t).setA(.1).toRgbString()}`,g=new h(t).setA(.45).toRgbString();return{colorBgSlot:r,colorBgSkill:i,colorBgSkillHover:a,colorTextSlot:o,colorTextSlotPlaceholder:s,colorBorderSlotHover:c,colorBorderSlot:l,switchCheckedBg:u,switchCheckedHoverBg:f,switchUncheckedHoverBg:d,colorBorderInput:p,boxShadowInput:m,colorBgActionsDisabled:g,colorTextActionsDisabled:g}}),fi={SendButton:Rr,ClearButton:Pr,LoadingButton:Ir,SpeechButton:Qr},pi=G.forwardRef((e,t)=>{let{prefixCls:n,styles:r={},classNames:a={},className:o,rootClassName:s,style:l,defaultValue:u,value:d,slotConfig:f,readOnly:p,submitType:h=`enter`,onSubmit:g,loading:_,components:v,onCancel:y,onChange:b,suffix:x,onKeyUp:S,onKeyDown:C,disabled:w,allowSpeech:T,prefix:E,footer:D,header:O,onPaste:k,onPasteFile:A,autoSize:j={maxRows:8},placeholder:ee,onFocus:M,onBlur:te,skill:ne,...re}=e,ie=(0,Wn.default)(re,{attr:!0,aria:!0,data:!0}),ae=G.useId(),P=Array.isArray(f)||ne?.value,{direction:oe,getPrefixCls:se}=Yt(),F=se(`sender`,n),ce=G.useRef(null),I=G.useRef(null);Mt(t,()=>({nativeElement:ce.current,inputElement:I.current?.nativeElement,focus:e=>I.current?.focus(e),blur:()=>I.current?.blur(),insert:(...e)=>I.current?.insert?.(...e),clear:()=>I.current?.clear(),getValue:()=>I.current?.getValue()??{value:``,slotConfig:[],skill:void 0}}));let le=K(`sender`),ue=`${F}-input`,[de,fe]=di(F),L=m(F,le.className,o,s,le.classNames.root,a.root,de,fe,`${F}-main`,{[`${F}-rtl`]:oe===`rtl`,[`${F}-disabled`]:w}),pe=`${F}-actions-btn`,R=`${F}-actions-list`,[me,he]=i(u||``,d),ge=(e,t,n,r)=>{he(e),b?.(e,t,n??[],r)},[_e,ve,ye]=ni(e=>{P?I.current?.insert?.([{type:`text`,value:e}]):ge(`${me} ${e}`)},T),be=()=>{if(I?.current&&g&&!_&&!Te){let e=I.current.getValue();g(e.value,e.slotConfig,e.skill)}},z=()=>{ge(``),P&&I.current?.clear?.()},B=G.createElement(N,{className:`${R}-presets`},T&&G.createElement(Qr,null),_?G.createElement(Ir,null):G.createElement(Rr,null)),xe=B;typeof x==`function`?xe=x(B,{components:fi}):(x||x===!1)&&(xe=x);let Se=typeof E==`function`?E(B,{components:fi}):E||null,Ce=typeof O==`function`?O(B,{components:fi}):O||null,we=typeof D==`function`?D(B,{components:fi}):D||null,[Te,Ee]=(0,G.useState)(!me),De={prefixCls:pe,onSend:be,onSendDisabled:!me,onClear:z,onClearDisabled:!me,onCancel:y,onCancelDisabled:!_,onSpeech:()=>ve(!1),onSpeechDisabled:!_e,speechRecording:ye,disabled:w,setSubmitDisabled:Ee},Oe=G.useMemo(()=>({value:me,onChange:ge,slotConfig:f,onKeyUp:S,onKeyDown:C,onPaste:k,onPasteFile:A,disabled:w,readOnly:p,submitType:h,prefixCls:F,styles:r,classNames:a,autoSize:j,components:v,triggerSend:be,placeholder:ee,onFocus:M,onBlur:te,skill:ne,...re}),[me,ge,f,S,C,k,A,w,p,h,F,r,a,j,v,be,ee,M,te,ne,re]),ke=e=>{!P&&e.target!==ce.current?.querySelector(`.${ue}`)&&e.preventDefault(),e.target===ce.current?.querySelector(`.${ue}`)&&I.current?.focus()};return G.createElement(`div`,c({key:ae,ref:ce,className:L,style:{...le.style,...l,...le.styles.root,...r.root}},ie),G.createElement(zr.Provider,{value:Oe},G.createElement(jr.Provider,{value:De},Ce&&G.createElement(ri.Provider,{value:{prefixCls:F}},Ce),G.createElement(`div`,{className:m(`${F}-content`,a.content),style:r.content,onMouseDown:ke},Se&&G.createElement(`div`,{className:m(`${F}-prefix`,le.classNames.prefix,a.prefix),style:{...le.styles.prefix,...r.prefix}},Se),P?G.createElement(Zr,{ref:I}):G.createElement(ti,{ref:I}),xe&&G.createElement(`div`,{className:m(R,le.classNames.suffix,a.suffix),style:{...le.styles.suffix,...r.suffix}},xe)),we&&G.createElement(`div`,{className:m(`${F}-footer`,le.classNames.footer,a.footer),style:{...le.styles.footer,...r.footer}},we))))}),mi=G.forwardRef((e,t)=>{let{children:n,className:r,classNames:a={},styles:o={},icon:s,style:l,onChange:u,rootClassName:d,loading:f,defaultValue:p,value:h,checkedChildren:g,unCheckedChildren:_,disabled:v,prefixCls:y,...b}=e,{styles:x={},classNames:S={},prefixCls:C}=G.useContext(zr),w=(0,Wn.default)(b,{attr:!0,aria:!0,data:!0}),T=G.useId(),{direction:E,getPrefixCls:D}=Yt(),O=D(`sender`,y||C),k=`${O}-switch`,[j,ee]=di(O),M=G.useRef(null);Mt(t,()=>({nativeElement:M.current}));let[N,te]=i(p,h),ne=K(`sender`),re=m(O,k,r,d,ne.classNames.switch,S.switch,a.root,j,ee,{[`${k}-checked`]:N,[`${k}-rtl`]:E===`rtl`});return G.createElement(`div`,c({ref:M,className:re,key:T,style:{...l,...ne.styles.switch,...x.switch,...o.root}},w),G.createElement(A,{disabled:v,loading:f,className:m(`${k}-content`,a.content),style:o.content,styles:{icon:o.icon,content:o.title},classNames:{icon:a.icon,content:a.title},variant:`outlined`,color:N?`primary`:`default`,icon:s,onClick:()=>{let e=!N;te(e),u?.(e)}},N?g:_,n))}),hi=pi;hi.Header=oi,hi.Switch=mi;var gi=e=>{let{componentCls:t,calc:n}=e,r=n(e.fontSizeHeading3).mul(e.lineHeightHeading3).equal(),i=n(e.fontSize).mul(e.lineHeight).equal();return{[t]:{gap:e.padding,[`${t}-icon`]:{height:n(r).add(i).add(e.paddingXXS).equal(),display:`flex`,img:{height:`100%`}},[`${t}-content-wrapper`]:{gap:e.paddingXS,flex:`auto`,minWidth:0,[`${t}-title-wrapper`]:{gap:e.paddingXS},[`${t}-title`]:{margin:0},[`${t}-extra`]:{marginInlineStart:`auto`}}}}},_i=e=>{let{componentCls:t}=e;return{[t]:{"&-filled":{paddingInline:e.padding,paddingBlock:e.paddingSM,background:e.colorFillContent,borderRadius:e.borderRadiusLG},"&-borderless":{[`${t}-title`]:{fontSize:e.fontSizeHeading3,lineHeight:e.lineHeightHeading3}}}}},vi=yn(`Welcome`,e=>{let t=b(e,{});return[gi(t),_i(t)]},()=>({})),yi=G.forwardRef((e,t)=>{let{prefixCls:n,rootClassName:r,className:i,style:a,variant:o=`filled`,classNames:s={},styles:c={},icon:l,title:u,description:d,extra:f}=e,{direction:p,getPrefixCls:h}=Yt(),g=h(`welcome`,n),_=K(`welcome`),[v,y]=vi(g),b=G.useMemo(()=>{if(!l)return null;let e=l;return typeof l==`string`&&l.startsWith(`http`)&&(e=G.createElement(`img`,{src:l,alt:`icon`})),G.createElement(`div`,{className:m(`${g}-icon`,_.classNames.icon,s.icon),style:c.icon},e)},[l]),x=G.useMemo(()=>u?G.createElement(w.Title,{level:4,className:m(`${g}-title`,_.classNames.title,s.title),style:c.title},u):null,[u]),S=G.useMemo(()=>f?G.createElement(`div`,{className:m(`${g}-extra`,_.classNames.extra,s.extra),style:c.extra},f):null,[f]);return G.createElement(N,{ref:t,className:m(g,_.className,i,r,s.root,v,y,`${g}-${o}`,{[`${g}-rtl`]:p===`rtl`}),style:{...a,...c.root}},b,G.createElement(N,{vertical:!0,className:`${g}-content-wrapper`},f?G.createElement(N,{align:`flex-start`,className:`${g}-title-wrapper`},x,S):x,d&&G.createElement(w.Text,{className:m(`${g}-description`,_.classNames.description,s.description),style:c.description},d)))}),bi={_chatMessagesStores:new Map,get:e=>bi._chatMessagesStores.get(e),set:(e,t)=>{bi._chatMessagesStores.set(e,t)},delete:e=>{bi._chatMessagesStores.delete(e)},getMessages:e=>bi._chatMessagesStores.get(e)?.getMessages()},xi={_allConversationStores:new Map,set:(e,t)=>{xi._allConversationStores.set(e,t)},delete:e=>{xi._allConversationStores.delete(e)},getConversation:e=>{for(let t of xi._allConversationStores.values())if(t){let n=t.getConversation(e);if(n)return n}}},Si=class{conversations=[];listeners=[];storeKey;activeConversationKey;emitListeners(){this.listeners.forEach(e=>{e()})}constructor(e,t){this.setConversations(e),this.storeKey=Math.random().toString(),xi.set(this.storeKey,this),this.activeConversationKey=t}setActiveConversationKey=e=>(this.activeConversationKey=e,this.emitListeners(),!0);setConversations=e=>(this.conversations=[...e],this.emitListeners(),!0);getConversation=e=>this.conversations.find(t=>t.key===e);addConversation=(e,t)=>!this.getConversation(e.key)&&(this.setConversations(t===`prepend`?[e,...this.conversations]:[...this.conversations,e]),!0);setConversation=(e,t)=>{let n=this.getConversation(e);return n?(Object.assign(n,t),this.setConversations([...this.conversations]),!0):!1};removeConversation=e=>{let t=this.conversations.findIndex(t=>t.key===e);return t!==-1&&(this.conversations.splice(t,1),this.setConversations([...this.conversations]),!0)};getMessages=e=>bi.getMessages(e);getSnapshot=()=>this.conversations;getActiveConversationKey=()=>this.activeConversationKey;subscribe=e=>(this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)});destroy=()=>{xi.delete(this.storeKey)}};function Ci(e){let[t]=(0,G.useState)(()=>new Si(e?.defaultConversations||[],e?.defaultActiveConversationKey||``));return(0,G.useEffect)(()=>()=>{t.destroy()},[]),{conversations:(0,G.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot),activeConversationKey:(0,G.useSyncExternalStore)(t.subscribe,t.getActiveConversationKey,t.getActiveConversationKey),setActiveConversationKey:t.setActiveConversationKey,addConversation:t.addConversation,removeConversation:t.removeConversation,setConversation:t.setConversation,getConversation:t.getConversation,setConversations:t.setConversations,getMessages:t.getMessages}}var wi=`
|
|
|
|
`,Ti=`
|
|
`,Ei=`:`,Di=e=>(e??``).trim()!==``;function Oi(e=wi){let t=``;return new TransformStream({transform(n,r){t+=n;let i=t.split(e);i.slice(0,-1).forEach(e=>{Di(e)&&r.enqueue(e)}),t=i[i.length-1]},flush(e){Di(t)&&e.enqueue(t)}})}function ki(e=Ti,t=Ei){return new TransformStream({transform(n,r){let i=n.split(e).reduce((e,n)=>{let r=n.indexOf(t);if(r===-1)return console.warn(`The key-value separator "${t}" is not found in the sse line: ${n} !`),e;let i=n.slice(0,r).trim();if(!Di(i))return e;let a=n.slice(r+1).trim();return{...e,[i]:a}},{});Object.keys(i).length!==0&&r.enqueue(i)}})}function Ai(){if(typeof TextDecoderStream<`u`)return new TextDecoderStream;let e=new TextDecoder(`utf-8`);return new TransformStream({transform(t,n){n.enqueue(e.decode(t,{stream:!0}))},flush(t){t.enqueue(e.decode())}})}function ji(e){let{readableStream:t,transformStream:n,streamSeparator:r,partSeparator:i,kvSeparator:a}=e;if(!(t instanceof ReadableStream))throw Error(`The options.readableStream must be an instance of ReadableStream.`);let o=Ai(),s=n?t.pipeThrough(o).pipeThrough(n):t.pipeThrough(o).pipeThrough(Oi(r)).pipeThrough(ki(i,a));return s[Symbol.asyncIterator]=async function*(){let e=this.getReader(),t=!1;try{for(;;){let{done:n,value:r}=await e.read();if(n){t=!0;break}r&&(yield r)}}finally{t||e.cancel().catch(()=>{}),e.releaseLock()}},s}var Mi=async(e,t)=>{let{fetch:n=globalThis.fetch,middlewares:r={},...i}=t;if(typeof n!=`function`)throw Error(`The options.fetch must be a typeof fetch function!`);let a=[e,i];typeof r.onRequest==`function`&&(a=await r.onRequest(...a));let o=await n(...a);if(typeof r.onResponse==`function`){let e=await r.onResponse(o);if(!(e instanceof Response))throw Error(`The options.onResponse must return a Response instance!`);o=e}if(!o.ok)throw Error(`Fetch failed with status ${o.status}`);if(!o.body)throw Error(`The response body is empty.`);return o},Ni={manual:!1,headers:{"Content-Type":`application/json`}},Pi=`Last-Event-ID`,Fi=class{baseURL;options;constructor(e,t){if(!e||typeof e!=`string`)throw Error(`The baseURL is not valid!`);this.baseURL=e,this.options=t||{}}},Ii=class extends Fi{_asyncHandler;timeoutHandler;_isTimeout=!1;streamTimeoutHandler;_isStreamTimeout=!1;abortController;_isRequesting=!1;_manual=!1;lastManualParams;retryTimes=0;retryTimer;lastEventId=void 0;get asyncHandler(){return this._asyncHandler}get isTimeout(){return this._isTimeout}set isTimeout(e){this._isTimeout=e}get isStreamTimeout(){return this._isStreamTimeout}set isStreamTimeout(e){this._isStreamTimeout=e}get isRequesting(){return this._isRequesting}get manual(){return this._manual}constructor(e,t){super(e,t),this._manual=t?.manual||!1,this.manual||this.init()}run(e){return this.manual?(this.resetRetry(),this.lastManualParams=e,this.init(e),!0):(console.warn(`The request is not manual, so it cannot be run!`),!1)}abort(){clearTimeout(this.timeoutHandler),clearTimeout(this.streamTimeoutHandler),this.abortController.abort()}init(e,t){this.abortController=new AbortController;let{callbacks:n,params:r,headers:i={},transformStream:a,fetch:o,timeout:s,streamTimeout:c,middlewares:l,streamSeparator:u,partSeparator:d,kvSeparator:f,...p}=this.options,m=Object.assign({},Ni.headers||{},i,t||{}),h={...p,method:`POST`,body:JSON.stringify({...r,...e||{}}),params:{...r,...e},headers:m,signal:this.abortController.signal,middlewares:l};s&&s>0&&(this.timeoutHandler=window.setTimeout(()=>{this.isTimeout=!0,this.finishRequest(),n?.onError?.(Error(`TimeoutError`))},s)),this.startRequest(),this._asyncHandler=Mi(this.baseURL,{fetch:o,...h}).then(async e=>{if(clearTimeout(this.timeoutHandler),this.isTimeout)return;if(a){let t=a;typeof a==`function`&&(t=a(this.baseURL,e.headers)),await this.customResponseHandler(e,n,t,c,u,d,f);return}let t=e.headers.get(`content-type`)||``;switch(t.split(`;`)[0].trim()){case`text/event-stream`:await this.sseResponseHandler(e,n,c,u,d,f);break;case`application/json`:await this.jsonResponseHandler(e,n);break;default:throw Error(`The response content-type: ${t} is not support!`)}}).catch(e=>{clearTimeout(this.timeoutHandler),this.finishRequest();let t=e instanceof Error||e instanceof DOMException?e:Error(`Unknown error!`),r=n?.onError?.(t);if(t.name!==`AbortError`){let e=typeof r==`number`?r:this.options.retryInterval;if(e&&e>0){if(typeof this.options.retryTimes==`number`&&this.retryTimes>=this.options.retryTimes)return;clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{let e={};this.lastEventId!==void 0&&(e[Pi]=this.lastEventId),this.init(this.lastManualParams,e)},e),this.retryTimes+=1}}})}startRequest(){this._isRequesting=!0}finishRequest(){this._isRequesting=!1}customResponseHandler=async(e,t,n,r,i,a,o)=>{let s=ji({readableStream:e.body,transformStream:n,streamSeparator:i,partSeparator:a,kvSeparator:o});await this.processStream(s,e,t,r)};sseResponseHandler=async(e,t,n,r,i,a)=>{let o=ji({readableStream:e.body,streamSeparator:r,partSeparator:i,kvSeparator:a});await this.processStream(o,e,t,n)};async processStream(e,t,n,r){let i=[],a=e[Symbol.asyncIterator](),o;do{if(r&&(this.streamTimeoutHandler=window.setTimeout(()=>{this.isStreamTimeout=!0,this.finishRequest(),n?.onError?.(Error(`StreamTimeoutError`),void 0,t.headers)},r)),o=await a.next(),clearTimeout(this.streamTimeoutHandler),this.isStreamTimeout)break;o.value&&(i.push(o.value),n?.onUpdate?.(o.value,t.headers),o?.value?.id!==void 0&&(this.lastEventId=o.value.id))}while(!o.done);if(r&&(clearTimeout(this.streamTimeoutHandler),this.isStreamTimeout)){this.finishRequest();return}this.finishRequest(),n?.onSuccess?.(i,t.headers)}jsonResponseHandler=async(e,t)=>{let n=await e.json();if(n?.success===!1){let r=Error(n.message||`System error`);r.name=n.name||`SystemError`,t?.onError?.(r,n,e.headers)}else t?.onUpdate?.(n,e.headers),this.finishRequest(),t?.onSuccess?.([n],e.headers)};resetRetry(){clearTimeout(this.retryTimer),this.retryTimes=0,this.lastEventId=void 0}};function Li(e,t){return new Ii(e,t)}function Ri(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var zi=Ri();function Bi(e){zi=e}var Vi={exec:()=>null};function Y(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(X.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var X={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ 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,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,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:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},Hi=/^(?:[ \t]*(?:\n|$))+/,Ui=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Gi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ki=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,qi=/(?:[*+-]|\d{1,9}[.)])/,Ji=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yi=Y(Ji).replace(/bull/g,qi).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Xi=Y(Ji).replace(/bull/g,qi).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Zi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qi=/^[^\n]+/,$i=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ea=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,$i).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ta=Y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,qi).getRegex(),na=`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`,ra=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ia=Y(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,ra).replace(`tag`,na).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),aa=Y(Zi).replace(`hr`,Gi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,na).getRegex(),oa={blockquote:Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,aa).getRegex(),code:Ui,def:ea,fences:Wi,heading:Ki,hr:Gi,html:ia,lheading:Yi,list:ta,newline:Hi,paragraph:aa,table:Vi,text:Qi},sa=Y(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Gi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,na).getRegex(),ca={...oa,lheading:Xi,table:sa,paragraph:Y(Zi).replace(`hr`,Gi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,sa).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,na).getRegex()},la={...oa,html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,ra).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:Vi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(Zi).replace(`hr`,Gi).replace(`heading`,` *#{1,6} *[^
|
|
]`).replace(`lheading`,Yi).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ua=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,da=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fa=/^( {2,}|\\)\n(?!\s*$)/,pa=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ma=/[\p{P}\p{S}]/u,ha=/[\s\p{P}\p{S}]/u,ga=/[^\s\p{P}\p{S}]/u,_a=Y(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ha).getRegex(),va=/(?!~)[\p{P}\p{S}]/u,ya=/(?!~)[\s\p{P}\p{S}]/u,ba=/(?:[^\s\p{P}\p{S}]|~)/u,xa=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Sa=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ca=Y(Sa,`u`).replace(/punct/g,ma).getRegex(),wa=Y(Sa,`u`).replace(/punct/g,va).getRegex(),Ta=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ea=Y(Ta,`gu`).replace(/notPunctSpace/g,ga).replace(/punctSpace/g,ha).replace(/punct/g,ma).getRegex(),Da=Y(Ta,`gu`).replace(/notPunctSpace/g,ba).replace(/punctSpace/g,ya).replace(/punct/g,va).getRegex(),Oa=Y(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,ga).replace(/punctSpace/g,ha).replace(/punct/g,ma).getRegex(),ka=Y(/\\(punct)/,`gu`).replace(/punct/g,ma).getRegex(),Aa=Y(/^<(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(),ja=Y(ra).replace(`(?:-->|$)`,`-->`).getRegex(),Ma=Y(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,ja).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Na=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Pa=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,Na).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fa=Y(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Na).replace(`ref`,$i).getRegex(),Ia=Y(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,$i).getRegex(),La={_backpedal:Vi,anyPunctuation:ka,autolink:Aa,blockSkip:xa,br:fa,code:da,del:Vi,emStrongLDelim:Ca,emStrongRDelimAst:Ea,emStrongRDelimUnd:Oa,escape:ua,link:Pa,nolink:Ia,punctuation:_a,reflink:Fa,reflinkSearch:Y(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Fa).replace(`nolink`,Ia).getRegex(),tag:Ma,text:pa,url:Vi},Ra={...La,link:Y(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Na).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Na).getRegex()},za={...La,emStrongRDelimAst:Da,emStrongLDelim:wa,url:Y(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ba={...za,br:Y(fa).replace(`{2,}`,`*`).getRegex(),text:Y(za.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Va={normal:oa,gfm:ca,pedantic:la},Ha={normal:La,gfm:za,breaks:Ba,pedantic:Ra},Ua={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Wa=e=>Ua[e];function Ga(e,t){if(t){if(X.escapeTest.test(e))return e.replace(X.escapeReplace,Wa)}else if(X.escapeTestNoEncode.test(e))return e.replace(X.escapeReplaceNoEncode,Wa);return e}function Ka(e){try{e=encodeURI(e).replace(X.percentDecode,`%`)}catch{return null}return e}function qa(e,t){let n=e.replace(X.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(X.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(X.slashPipe,`|`);return n}function Ja(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 Ya(e,t){if(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 Xa(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Za(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
`)}var Qa=class{options;rules;lexer;constructor(e){this.options=e||zi}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=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Ja(e,`
|
|
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Za(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=Ja(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],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:Ja(t[0],`
|
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Ja(t[0],`
|
|
`).split(`
|
|
`),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(`
|
|
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
${s}`:s,r=r?`${r}
|
|
${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`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
`+e.join(`
|
|
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
`+e.join(`
|
|
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().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:t[0],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=qa(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
`):[],a={type:`table`,raw:t[0],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(qa(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)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
`?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){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Ja(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ya(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 n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Xa(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.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 e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Xa(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}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){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}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,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,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:t[0],escaped:e}}}},$a=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||zi,this.options.tokenizer=this.options.tokenizer||new Qa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:X,block:Va.normal,inline:Ha.normal};this.options.pedantic?(t.block=Va.pedantic,t.inline=Ha.pedantic):this.options.gfm&&(t.block=Va.gfm,t.inline=this.options.breaks?Ha.breaks:Ha.gfm),this.tokenizer.rules=t}static get rules(){return{block:Va,inline:Ha}}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(X.carriageReturn,`
|
|
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(X.tabCharGlobal,` `).replace(X.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
`+r.raw,n.text+=`
|
|
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=`
|
|
`+r.raw,n.text+=`
|
|
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=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&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=`
|
|
`+r.raw,a.text+=`
|
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=`
|
|
`+r.raw,n.text+=`
|
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=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&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},eo=class{options;parser;constructor(e){this.options=e||zi}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(X.notSpaceStart)?.[0],i=e.replace(X.endingNewline,``)+`
|
|
`;return r?`<pre><code class="language-`+Ga(r)+`">`+(n?i:Ga(i,!0))+`</code></pre>
|
|
`:`<pre><code>`+(n?i:Ga(i,!0))+`</code></pre>
|
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
${this.parser.parse(e)}</blockquote>
|
|
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
`}hr(e){return`<hr>
|
|
`}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+`>
|
|
`+r+`</`+i+`>
|
|
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+Ga(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
`}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>
|
|
<thead>
|
|
`+t+`</thead>
|
|
`+r+`</table>
|
|
`}tablerow({text:e}){return`<tr>
|
|
${e}</tr>
|
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${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>${Ga(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ka(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Ga(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ka(e);if(i===null)return Ga(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Ga(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Ga(e.text)}},to=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},no=class e{options;renderer;textRenderer;constructor(e){this.options=e||zi,this.options.renderer=this.options.renderer||new eo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new to}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
`+this.renderer.text(i);n+=t?this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){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`,`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`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}},ro=class{options;block;constructor(e){this.options=e||zi}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?$a.lex:$a.lexInline}provideParser(){return this.block?no.parse:no.parseInline}},io=class{defaults=Ri();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=no;Renderer=eo;TextRenderer=to;Lexer=$a;Tokenizer=Qa;Hooks=ro;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(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);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(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 eo(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 Qa(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 ro;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]=ro.passThroughHooks.has(n)?e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:(...e)=>{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&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return $a.lex(e,t??this.defaults)}parser(e,t){return no.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(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(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?$a.lex:$a.lexInline,s=i.hooks?i.hooks.provideParser():e?no.parse:no.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Ga(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},ao=new io;function Z(e,t){return ao.parse(e,t)}Z.options=Z.setOptions=function(e){return ao.setOptions(e),Z.defaults=ao.defaults,Bi(Z.defaults),Z},Z.getDefaults=Ri,Z.defaults=zi,Z.use=function(...e){return ao.use(...e),Z.defaults=ao.defaults,Bi(Z.defaults),Z},Z.walkTokens=function(e,t){return ao.walkTokens(e,t)},Z.parseInline=ao.parseInline,Z.Parser=no,Z.parser=no.parse,Z.Renderer=eo,Z.TextRenderer=to,Z.Lexer=$a,Z.lexer=$a.lex,Z.Tokenizer=Qa,Z.Hooks=ro,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,no.parse,$a.lex;var oo={escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeTest:/[&<>"'/]/,notSpaceStart:/^\S*/,endingNewline:/\n$/,escapeReplace:/[&<>"'/]/g,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,completeFencedCode:/^ {0,3}(`{3,}|~{3,})([\s\S]*?)\n {0,3}\1[ \n\t]*$/},so={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`,"/":`/`},co=e=>so[e];function lo(e,t){if(t){if(oo.escapeTest.test(e))return e.replace(oo.escapeReplace,co)}else if(oo.escapeTestNoEncode.test(e))return e.replace(oo.escapeReplaceNoEncode,co);return e}var uo=Symbol(`tailMarker`),fo=`X_MD_NL_`,po=``,mo=/\uE000X_MD_NL_\d+\uE001/g,ho=class{options;markdownInstance;injectTail=!1;constructor(e={}){this.options=e,this.markdownInstance=new io,this.configureLinkRenderer(),this.configureParagraphRenderer(),this.configureCodeRenderer(),this.configureHtmlEscapeRenderer(),this.configureTailInjection(),this.markdownInstance.use(e.markedConfig||{})}configureHtmlEscapeRenderer(){this.options.escapeRawHtml&&this.markdownInstance.use({renderer:{html(e){let{raw:t=``,text:n=``}=e;return lo(t||n,!0)}}})}configureLinkRenderer(){this.options.openLinksInNewTab&&this.markdownInstance.use({renderer:{link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n);return`<a href="${e}"${t?` title="${t}"`:``} target="_blank" rel="noopener noreferrer">${r}</a>`}}})}configureParagraphRenderer(){let{paragraphTag:e}=this.options;e&&this.markdownInstance.use({renderer:{paragraph({tokens:t}){return`<${e}>${this.parser.parseInline(t)}</${e}>\n`}}})}configureCodeRenderer(){this.markdownInstance.use({renderer:{code({text:e,raw:t,lang:n,escaped:r,codeBlockStyle:i}){let a=(n||``).trim(),o=a.match(oo.notSpaceStart)?.[0],s=`${e.replace(oo.endingNewline,``)}\n`,c=i===`indented`||oo.completeFencedCode.test(t)?`done`:`loading`,l=r?s:lo(s,!0),u=o?` class="language-${lo(o)}"`:``;return`<pre><code${` data-block="true" data-state="${c}"`+(a?` data-lang="${lo(a)}"`:``)}${u}>${l}</code></pre>\n`}}})}configureTailInjection(){let e=this;this.markdownInstance.use({hooks:{processAllTokens(t){if(!e.injectTail)return t;let n=e.findLastTextToken(t);return n&&(n[uo]=!0),t}},renderer:{text(e){let t=`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`text`in e?e.text:``;return e[uo]?`${t}<xmd-tail></xmd-tail>`:t}}})}protectCustomTags(e,t){let n=new Map,r=Object.keys(this.options.components||{});if(r.length===0)return{protected:e,placeholders:n};let i=0,a=e=>e.replace(/\n/g,()=>{let e=`${fo}${i++}${po}`;return n.set(e,`
|
|
`),e}),o=r.map(e=>e.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),s=RegExp(`<(${o})(?:\\s[^>]*)?>`,`gi`),c=RegExp(`</(${o})>`,`gi`),l=[],u=s.exec(e);for(;u!==null;)l.push({index:u.index,type:`open`,tagName:u[1].toLowerCase(),match:u[0]}),u=s.exec(e);for(c.lastIndex=0,u=c.exec(e);u!==null;)l.push({index:u.index,type:`close`,tagName:u[1].toLowerCase(),match:u[0]}),u=c.exec(e);l.sort((e,t)=>e.index-t.index);let d=[],f=[],p=0;for(let n of l)if(n.type===`open`)n.match.endsWith(`/>`)||d.push({tagName:n.tagName,start:n.index,openTag:n.match});else if(n.type===`close`&&d.length>0&&d[d.length-1].tagName===n.tagName){let r=d.pop();if(d.length===0){let i=r.start,o=n.index+n.match.length,s=r.openTag,c=n.match,l=e.slice(i+s.length,n.index);if(p<i&&f.push(e.slice(p,i)),t&&l.includes(`
|
|
`)){let e=a(l);f.push(s+e+c)}else if(l.includes(`
|
|
|
|
`)){let e=l.replace(/\n{2,}/g,e=>a(e));f.push(s+e+c)}else f.push(s+l+c);p=o}}return p<e.length&&f.push(e.slice(p)),{protected:f.join(``),placeholders:n}}restorePlaceholders(e,t){return t.size===0?e:e.replace(mo,e=>t.get(e)??e)}findLastNonEmptyToken(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`list`&&`items`in n&&Array.isArray(n.items))for(let e=n.items.length-1;e>=0;e--){let t=n.items[e];if(`tokens`in t&&t.tokens&&t.tokens.length>0){let e=this.findLastNonEmptyToken(t.tokens);if(e)return e}}if(`tokens`in n&&n.tokens&&n.tokens.length>0){let e=this.findLastNonEmptyToken(n.tokens);if(e)return e}if(n.type===`text`){if((`text`in n?n.text:``).trim())return n}else if(n.type===`html`||n.type===`tag`)return n}return null}findLastTextToken(e){let t=this.findLastNonEmptyToken(e);return t?.type===`text`?t:null}parse(e,t){if(this.injectTail=t?.injectTail??!1,this.options.protectCustomTagNewlines||this.options.disableCustomTagBlockMarkdown){let{protected:t,placeholders:n}=this.protectCustomTags(e,!!this.options.disableCustomTagBlockMarkdown),r=this.markdownInstance.parse(t);return this.restorePlaceholders(r,n)}return this.markdownInstance.parse(e)}},go=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(t=e.ElementType||={});function n(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype})),_o=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),n=e&&e.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.cloneNode=e.hasChildren=e.isDocument=e.isDirective=e.isComment=e.isText=e.isCDATA=e.isTag=e.Element=e.Document=e.CDATA=e.NodeWithChildren=e.ProcessingInstruction=e.Comment=e.Text=e.DataNode=e.Node=void 0;var r=go(),i=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return e===void 0&&(e=!1),b(this,e)},e}();e.Node=i;var a=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.data=t,n}return Object.defineProperty(n.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),n}(i);e.DataNode=a;var o=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Text,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),n}(a);e.Text=o;var s=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Comment,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),n}(a);e.Comment=s;var c=function(e){t(n,e);function n(t,n){var i=e.call(this,n)||this;return i.name=t,i.type=r.ElementType.Directive,i}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),n}(a);e.ProcessingInstruction=c;var l=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.children=t,n}return Object.defineProperty(n.prototype,"firstChild",{get:function(){return this.children[0]??null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),n}(i);e.NodeWithChildren=l;var u=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.CDATA,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),n}(l);e.CDATA=u;var d=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Root,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),n}(l);e.Document=d;var f=function(e){t(n,e);function n(t,n,i,a){i===void 0&&(i=[]),a===void 0&&(a=t===`script`?r.ElementType.Script:t===`style`?r.ElementType.Style:r.ElementType.Tag);var o=e.call(this,i)||this;return o.name=t,o.attribs=n,o.type=a,o}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map(function(t){return{name:t,value:e.attribs[t],namespace:e[`x-attribsNamespace`]?.[t],prefix:e[`x-attribsPrefix`]?.[t]}})},enumerable:!1,configurable:!0}),n}(l);e.Element=f;function p(e){return(0,r.isTag)(e)}e.isTag=p;function m(e){return e.type===r.ElementType.CDATA}e.isCDATA=m;function h(e){return e.type===r.ElementType.Text}e.isText=h;function g(e){return e.type===r.ElementType.Comment}e.isComment=g;function _(e){return e.type===r.ElementType.Directive}e.isDirective=_;function v(e){return e.type===r.ElementType.Root}e.isDocument=v;function y(e){return Object.prototype.hasOwnProperty.call(e,`children`)}e.hasChildren=y;function b(e,t){t===void 0&&(t=!1);var r;if(h(e))r=new o(e.data);else if(g(e))r=new s(e.data);else if(p(e)){var i=t?x(e.children):[],a=new f(e.name,n({},e.attribs),i);i.forEach(function(e){return e.parent=a}),e.namespace!=null&&(a.namespace=e.namespace),e[`x-attribsNamespace`]&&(a[`x-attribsNamespace`]=n({},e[`x-attribsNamespace`])),e[`x-attribsPrefix`]&&(a[`x-attribsPrefix`]=n({},e[`x-attribsPrefix`])),r=a}else if(m(e)){var i=t?x(e.children):[],l=new u(i);i.forEach(function(e){return e.parent=l}),r=l}else if(v(e)){var i=t?x(e.children):[],y=new d(i);i.forEach(function(e){return e.parent=y}),e[`x-mode`]&&(y[`x-mode`]=e[`x-mode`]),r=y}else if(_(e)){var b=new c(e.name,e.data);e[`x-name`]!=null&&(b[`x-name`]=e[`x-name`],b[`x-publicId`]=e[`x-publicId`],b[`x-systemId`]=e[`x-systemId`]),r=b}else throw Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}e.cloneNode=b;function x(e){for(var t=e.map(function(e){return b(e,!0)}),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}})),vo=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var r=go(),i=_o();n(_o(),e);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},o=function(){function e(e,t,n){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=a),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??a,this.elementCB=n??null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?r.ElementType.Tag:void 0,a=new i.Element(e,t,void 0,n);this.addNode(a),this.tagStack.push(a)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===r.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new i.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===r.ElementType.Comment){this.lastNode.data+=e;return}var t=new i.Comment(e);this.addNode(t),this.lastNode=t},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new i.Text(``),t=new i.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new i.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();e.DomHandler=o,e.default=o})),yo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=`animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.linearGradient.radialGradient.textPath`.split(`.`),e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,t){return e[t.toLowerCase()]=t,e},{}),e.CARRIAGE_RETURN=`\r`,e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,`g`),e.CARRIAGE_RETURN_PLACEHOLDER=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,`g`)})),bo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatAttributes=i,e.hasOpenTag=o,e.escapeSpecialCharacters=s,e.revertEscapedCharacters=c,e.formatDOM=l;var t=vo(),n=yo();function r(e){return n.CASE_SENSITIVE_TAG_NAMES_MAP[e]}function i(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n];t[i.name]=i.value}return t}function a(e){return e=e.toLowerCase(),r(e)||e}function o(e,t){var n=`<`+t,r=e.toLowerCase().indexOf(n);if(r===-1)return!1;var i=e[r+n.length];return i===`>`||i===` `||i===` `||i===`
|
|
`||i===`\r`||i===`/`}function s(e){return e.replace(n.CARRIAGE_RETURN_REGEX,n.CARRIAGE_RETURN_PLACEHOLDER)}function c(e){return e.replace(n.CARRIAGE_RETURN_PLACEHOLDER_REGEX,n.CARRIAGE_RETURN)}function l(e,n,r){n===void 0&&(n=null);for(var o=[],s,u=0,d=e.length;u<d;u++){var f=e[u];switch(f.nodeType){case 1:var p=a(f.nodeName);s=new t.Element(p,i(f.attributes)),s.children=l(p===`template`?f.content.childNodes:f.childNodes,s);break;case 3:s=new t.Text(c(f.nodeValue??``));break;case 8:s=new t.Comment(f.nodeValue??``);break;default:continue}var m=o[u-1]??null;m&&(m.next=s),s.parent=n,s.prev=m,s.next=null,o.push(s)}return r&&(s=new t.ProcessingInstruction(r.substring(0,r.indexOf(` `)).toLowerCase(),r),s.next=o[0]??null,s.parent=n,o.unshift(s),o[1]&&(o[1].prev=o[0])),o}})),xo=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=h;var t=bo(),n=`html`,r=`head`,i=`body`,a=/<([a-zA-Z]+[0-9]?)/,o=function(e,t){throw Error("This browser does not support `document.implementation.createHTMLDocument`")},s=function(e,t){throw Error("This browser does not support `DOMParser.prototype.parseFromString`")},c=typeof window==`object`&&window.DOMParser;if(typeof c==`function`){var l=new c,u=`text/html`;s=function(e,t){return t&&(e=`<${t}>${e}</${t}>`),l.parseFromString(e,u)},o=s}if(typeof document==`object`&&document.implementation){var d=document.implementation.createHTMLDocument();o=function(e,t){if(t){var n=d.documentElement.querySelector(t);return n&&(n.innerHTML=e),d}return d.documentElement.innerHTML=e,d}}var f=typeof document==`object`&&document.createElement(`template`),p;f&&f.content&&(p=function(e){return f.innerHTML=e,f.content.childNodes});var m=function(){return document.createDocumentFragment().childNodes};function h(e){var c,l;e=(0,t.escapeSpecialCharacters)(e);var u=(a.exec(e)?.[1])?.toLowerCase();switch(u){case n:var d=s(e);if(!(0,t.hasOpenTag)(e,r)){var f=d.querySelector(r);(c=f?.parentNode)==null||c.removeChild(f)}if(!(0,t.hasOpenTag)(e,i)){var f=d.querySelector(i);(l=f?.parentNode)==null||l.removeChild(f)}return d.querySelectorAll(n);case r:case i:var h=o(e).querySelectorAll(u);return(0,t.hasOpenTag)(e,i)&&(0,t.hasOpenTag)(e,r)?h[0].parentNode?.childNodes??m():h;default:if(p)return p(e);var f=o(e,i).querySelector(i);return f?.childNodes??m()}}})),So=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var n=t(xo()),r=bo(),i=/<(![a-zA-Z\s]+)>/;function a(e){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];var t=i.exec(e),a=t?t[1]:void 0;return(0,r.formatDOM)((0,n.default)(e),null,a)}})),Co=t((e=>{e.SAME=0,e.CAMELCASE=1,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":`acceptCharset`,accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:`className`,classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:`htmlFor`,form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":`httpEquiv`,icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":`accentHeight`,accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":`alignmentBaseline`,allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":`arabicForm`,ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":`baselineShift`,baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":`capHeight`,clip:0,clipPath:1,"clip-path":`clipPath`,clipPathUnits:1,clipRule:1,"clip-rule":`clipRule`,color:0,colorInterpolation:1,"color-interpolation":`colorInterpolation`,colorInterpolationFilters:1,"color-interpolation-filters":`colorInterpolationFilters`,colorProfile:1,"color-profile":`colorProfile`,colorRendering:1,"color-rendering":`colorRendering`,contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":`dominantBaseline`,dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":`enableBackground`,end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":`fillOpacity`,fillRule:1,"fill-rule":`fillRule`,filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":`floodOpacity`,floodColor:1,"flood-color":`floodColor`,focusable:0,fontFamily:1,"font-family":`fontFamily`,fontSize:1,"font-size":`fontSize`,fontSizeAdjust:1,"font-size-adjust":`fontSizeAdjust`,fontStretch:1,"font-stretch":`fontStretch`,fontStyle:1,"font-style":`fontStyle`,fontVariant:1,"font-variant":`fontVariant`,fontWeight:1,"font-weight":`fontWeight`,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":`glyphName`,glyphOrientationHorizontal:1,"glyph-orientation-horizontal":`glyphOrientationHorizontal`,glyphOrientationVertical:1,"glyph-orientation-vertical":`glyphOrientationVertical`,glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":`horizAdvX`,horizOriginX:1,"horiz-origin-x":`horizOriginX`,ideographic:0,imageRendering:1,"image-rendering":`imageRendering`,in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":`letterSpacing`,lightingColor:1,"lighting-color":`lightingColor`,limitingConeAngle:1,local:0,markerEnd:1,"marker-end":`markerEnd`,markerHeight:1,markerMid:1,"marker-mid":`markerMid`,markerStart:1,"marker-start":`markerStart`,markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":`overlinePosition`,overlineThickness:1,"overline-thickness":`overlineThickness`,paintOrder:1,"paint-order":`paintOrder`,panose1:0,"panose-1":`panose1`,pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":`pointerEvents`,points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":`renderingIntent`,repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":`shapeRendering`,slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":`stopColor`,stopOpacity:1,"stop-opacity":`stopOpacity`,strikethroughPosition:1,"strikethrough-position":`strikethroughPosition`,strikethroughThickness:1,"strikethrough-thickness":`strikethroughThickness`,string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":`strokeDasharray`,strokeDashoffset:1,"stroke-dashoffset":`strokeDashoffset`,strokeLinecap:1,"stroke-linecap":`strokeLinecap`,strokeLinejoin:1,"stroke-linejoin":`strokeLinejoin`,strokeMiterlimit:1,"stroke-miterlimit":`strokeMiterlimit`,strokeWidth:1,"stroke-width":`strokeWidth`,strokeOpacity:1,"stroke-opacity":`strokeOpacity`,suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":`textAnchor`,textDecoration:1,"text-decoration":`textDecoration`,textLength:1,textRendering:1,"text-rendering":`textRendering`,to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":`underlinePosition`,underlineThickness:1,"underline-thickness":`underlineThickness`,unicode:0,unicodeBidi:1,"unicode-bidi":`unicodeBidi`,unicodeRange:1,"unicode-range":`unicodeRange`,unitsPerEm:1,"units-per-em":`unitsPerEm`,unselectable:0,vAlphabetic:1,"v-alphabetic":`vAlphabetic`,values:0,vectorEffect:1,"vector-effect":`vectorEffect`,version:0,vertAdvY:1,"vert-adv-y":`vertAdvY`,vertOriginX:1,"vert-origin-x":`vertOriginX`,vertOriginY:1,"vert-origin-y":`vertOriginY`,vHanging:1,"v-hanging":`vHanging`,vIdeographic:1,"v-ideographic":`vIdeographic`,viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":`vMathematical`,vocab:0,widths:0,wordSpacing:1,"word-spacing":`wordSpacing`,writingMode:1,"writing-mode":`writingMode`,x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":`xHeight`,xlinkActuate:1,"xlink:actuate":`xlinkActuate`,xlinkArcrole:1,"xlink:arcrole":`xlinkArcrole`,xlinkHref:1,"xlink:href":`xlinkHref`,xlinkRole:1,"xlink:role":`xlinkRole`,xlinkShow:1,"xlink:show":`xlinkShow`,xlinkTitle:1,"xlink:title":`xlinkTitle`,xlinkType:1,"xlink:type":`xlinkType`,xmlBase:1,"xml:base":`xmlBase`,xmlLang:1,"xml:lang":`xmlLang`,xmlns:0,"xml:space":`xmlSpace`,xmlnsXlink:1,"xmlns:xlink":`xmlnsXlink`,xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),wo=t((e=>{var t=0,n=1,r=2,i=3,a=4,o=5,s=6;function c(e){return u.hasOwnProperty(e)?u[e]:null}function l(e,t,n,o,s,c,l){this.acceptsBooleans=t===r||t===i||t===a,this.attributeName=o,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=l}var u={};[`children`,`dangerouslySetInnerHTML`,`defaultValue`,`defaultChecked`,`innerHTML`,`suppressContentEditableWarning`,`suppressHydrationWarning`,`style`].forEach(e=>{u[e]=new l(e,t,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(([e,t])=>{u[e]=new l(e,n,!1,t,null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(e=>{u[e]=new l(e,r,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(e=>{u[e]=new l(e,r,!1,e,null,!1,!1)}),[`allowFullScreen`,`async`,`autoFocus`,`autoPlay`,`controls`,`default`,`defer`,`disabled`,`disablePictureInPicture`,`disableRemotePlayback`,`formNoValidate`,`hidden`,`loop`,`noModule`,`noValidate`,`open`,`playsInline`,`readOnly`,`required`,`reversed`,`scoped`,`seamless`,`itemScope`].forEach(e=>{u[e]=new l(e,i,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(e=>{u[e]=new l(e,i,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(e=>{u[e]=new l(e,a,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(e=>{u[e]=new l(e,s,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(e=>{u[e]=new l(e,o,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-\:]([a-z])/g,f=e=>e[1].toUpperCase();`accent-height.alignment-baseline.arabic-form.baseline-shift.cap-height.clip-path.clip-rule.color-interpolation.color-interpolation-filters.color-profile.color-rendering.dominant-baseline.enable-background.fill-opacity.fill-rule.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.glyph-name.glyph-orientation-horizontal.glyph-orientation-vertical.horiz-adv-x.horiz-origin-x.image-rendering.letter-spacing.lighting-color.marker-end.marker-mid.marker-start.overline-position.overline-thickness.paint-order.panose-1.pointer-events.rendering-intent.shape-rendering.stop-color.stop-opacity.strikethrough-position.strikethrough-thickness.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.text-anchor.text-decoration.text-rendering.underline-position.underline-thickness.unicode-bidi.unicode-range.units-per-em.v-alphabetic.v-hanging.v-ideographic.v-mathematical.vector-effect.vert-adv-y.vert-origin-x.vert-origin-y.word-spacing.writing-mode.xmlns:xlink.x-height`.split(`.`).forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,null,!1,!1)}),[`xlink:actuate`,`xlink:arcrole`,`xlink:role`,`xlink:show`,`xlink:title`,`xlink:type`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!1,!1)});var p=`xlinkHref`;u[p]=new l(`xlinkHref`,n,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!0,!0)});var{CAMELCASE:m,SAME:h,possibleStandardNames:g}=Co(),_=RegExp.prototype.test.bind(RegExp(`^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`)),v=Object.keys(g).reduce((e,t)=>{let n=g[t];return n===h?e[t]=t:n===m?e[t.toLowerCase()]=t:e[t]=n,e},{});e.BOOLEAN=i,e.BOOLEANISH_STRING=r,e.NUMERIC=o,e.OVERLOADED_BOOLEAN=a,e.POSITIVE_NUMERIC=s,e.RESERVED=t,e.STRING=n,e.getPropertyInfo=c,e.isCustomAttribute=_,e.possibleStandardNames=v})),To=t(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Eo=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(To());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Do=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Oo=t(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Eo()),r=Do();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),ko=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=a,e.setStyleProp=s;var n=f(),r=t(Oo()),i=new Set([`annotation-xml`,`color-profile`,`font-face`,`font-face-src`,`font-face-uri`,`font-face-format`,`font-face-name`,`missing-glyph`]);function a(e,t){return e.includes(`-`)?!i.has(e):!!(t&&typeof t.is==`string`)}var o={reactCompat:!0};function s(e,t){if(typeof e==`string`){if(!e.trim()){t.style={};return}try{t.style=(0,r.default)(e,o)}catch{t.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(`.`)[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set([`tr`,`tbody`,`thead`,`tfoot`,`colgroup`,`table`,`head`,`html`,`frameset`]),e.canTextBeChildOfNode=function(t){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(t.name)},e.returnFirstArg=function(e){return e}})),Ao=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var t=wo(),n=ko(),r=[`checked`,`value`],i=[`input`,`select`,`textarea`],a={reset:!0,submit:!0};function o(e,o){e===void 0&&(e={});var c={},l=!!(e.type&&a[e.type]);for(var u in e){var d=e[u];if((0,t.isCustomAttribute)(u)){c[u]=d;continue}var f=u.toLowerCase(),p=s(f);if(p){var m=(0,t.getPropertyInfo)(p);switch(r.includes(p)&&i.includes(o)&&!l&&(p=s(`default`+f)),c[p]=d,m?.type){case t.BOOLEAN:c[p]=!0;break;case t.OVERLOADED_BOOLEAN:d===``&&(c[p]=!0)}continue}n.PRESERVE_CUSTOM_ATTRIBUTES&&(c[u]=d)}return(0,n.setStyleProp)(e.style,c),c}function s(e){return t.possibleStandardNames[e]}})),jo=t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var n=f(),r=t(Ao()),i=ko(),a={cloneElement:n.cloneElement,createElement:n.createElement,isValidElement:n.isValidElement};function o(e,t){t===void 0&&(t={});for(var n=[],c=typeof t.replace==`function`,l=t.transform??i.returnFirstArg,u=t.library??a,d=u.cloneElement,f=u.createElement,p=u.isValidElement,m=e.length,h=0;h<m;h++){var g=e[h];if(c){var _=t.replace?.call(t,g,h);if(p(_)){m>1&&(_=d(_,{key:_.key??h})),n.push(l(_,g,h));continue}}if(g.type===`text`){var v=!g.data.trim().length;if(v&&g.parent&&!(0,i.canTextBeChildOfNode)(g.parent)||t.trim&&v)continue;n.push(l(g.data,g,h));continue}var y=g,b={};s(y)?((0,i.setStyleProp)(y.attribs.style,y.attribs),b=y.attribs):y.attribs&&(b=(0,r.default)(y.attribs,y.name));var x=void 0;switch(g.type){case`script`:case`style`:g.children[0]&&(b.dangerouslySetInnerHTML={__html:g.children[0].data});break;case`tag`:g.name===`textarea`&&g.children[0]?b.defaultValue=g.children[0].data:g.children?.length&&(x=o(g.children,t));break;default:continue}m>1&&(b.key=h),n.push(l(f(g.name,b,x),g,h))}return n.length===1?n[0]:n}function s(e){return i.PRESERVE_CUSTOM_ATTRIBUTES&&e.type===`tag`&&(0,i.isCustomComponent)(e.name,e.attribs)}})),Mo=e(t((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=o;var n=t(So());e.htmlToDOM=n.default,e.attributesToProps=t(Ao()).default;var r=t(jo());e.domToReact=r.default;var i=vo();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return i.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return i.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return i.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return i.Text}});var a={lowerCaseAttributeNames:!1};function o(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);return e?(0,r.default)((0,n.default)(e,t?.htmlparser2??a),t):[]}}))(),1),No=Mo.default.default||Mo.default,Po=G.memo(e=>{let{text:t,animationConfig:n}=e,{fadeDuration:r=200,easing:i=`ease-in-out`}=n||{},[a,o]=(0,G.useState)([]),s=(0,G.useRef)(``);(0,G.useEffect)(()=>{if(t===s.current)return;if(!(s.current&&t.indexOf(s.current)===0)){o([t]),s.current=t;return}let e=t.slice(s.current.length);e&&(o(t=>[...t,e]),s.current=t)},[t]);let c=(0,G.useMemo)(()=>({animation:`x-markdown-fade-in ${r}ms ${i} forwards`,color:`inherit`}),[r,i]);return G.createElement(G.Fragment,null,a.map((e,t)=>G.createElement(`span`,{style:c,key:`animation-text-${t}`},e)))}),Fo=/\s/,Io=/[a-zA-Z0-9-]/,Lo=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Ro=`<!--`,zo=`-->`,Bo=`<![CDATA[`,Vo=`]]>`,Ho=(e,t)=>`${e}-${t}`,Uo=(e,t)=>{if(!e.startsWith(Ro,t))return t;let n=e.indexOf(zo,t+4);return n===-1?e.length:n+3},Wo=(e,t)=>{if(!e.startsWith(Bo,t))return t;let n=e.indexOf(Vo,t+9);return n===-1?e.length:n+3},Go=(e,t)=>{if(e[t+1]!==`/`)return null;let n=t+2,r=``;for(;n<e.length&&Fo.test(e[n]);)n++;for(;n<e.length&&Io.test(e[n]);)r+=e[n],n++;for(;n<e.length&&Fo.test(e[n]);)n++;return!r||e[n]!==`>`?null:{tagName:r.toLowerCase(),endPos:n+1}},Ko=(e,t)=>{let n=t+1,r=``;for(;n<e.length&&Io.test(e[n]);)r+=e[n],n++;if(!r)return null;let i=!1,a=!1;for(;n<e.length;){if(e[n]===`>`){i=!0,a=e[n-1]===`/`;break}if(e[n]===`"`||e[n]===`'`){let t=e[n];for(n++;n<e.length;){if(e[n]===`\\`&&n+1<e.length){n+=2;continue}if(e[n]===t){n++;break}n++}continue}n++}return{tagName:r.toLowerCase(),endPos:i?n+1:e.length,foundEnd:i,isSelfClosing:a}};function qo(e,t){let n=new Set(Array.from(t,e=>e.toLowerCase()));if(n.size===0||e.length===0)return new Set;let r=new Set,i={},a={},o=0;for(;o<e.length;){let t=Uo(e,o);if(t!==o){o=t;continue}let c=Wo(e,o);if(c!==o){o=c;continue}if(e[o]!==`<`){o++;continue}let l=Go(e,o);if(l){let e=a[l.tagName];n.has(l.tagName)&&e?.length&&e.pop(),o=l.endPos;continue}let u=Ko(e,o);if(!u||!n.has(u.tagName)){o++;continue}i[u.tagName]=(i[u.tagName]??0)+1;let d=i[u.tagName];if(!u.foundEnd)r.add(Ho(u.tagName,d));else if(!u.isSelfClosing&&!Lo.has(u.tagName)){var s;a[s=u.tagName]??(a[s]=[]),a[u.tagName].push(d)}o=u.endPos}for(let[e,t]of Object.entries(a))t.forEach(t=>{r.add(Ho(e,t))});return r}var Jo=null;function Yo(){if(Jo)return Jo;if(typeof window<`u`&&typeof Node<`u`)try{let e=document.createElement(`template`);e.innerHTML=`<test-detect></test-detect>`;let t=e.content.firstChild;if(t){let n=Object.getOwnPropertyDescriptor(Node.prototype,`nodeName`)?.get,r=Object.getOwnPropertyDescriptor(Node.prototype,`nodeValue`)?.get,i=n&&t.nodeName&&!n.call(t);if(i){let e=n;Object.defineProperty(Node.prototype,"nodeName",{get:function(){let t=e.call(this);if(t)return t;if(this.nodeType===1&&`tagName`in this)return this.tagName;switch(this.nodeType){case 3:return`#text`;case 4:return`#cdata-section`;case 7:return`#processing-instruction`;case 8:return`#comment`;case 9:return`#document`;case 11:return`#document-fragment`}return t},configurable:!0,enumerable:!0})}let a=r&&(()=>{e.innerHTML=`<div>test</div>`;let t=e.content.firstChild?.firstChild;if(!t)return!1;let n=r.call(t);return t.nodeValue!=null&&n==null})();if(a){let e=r;Object.defineProperty(Node.prototype,"nodeValue",{get:function(){let t=e.call(this);return t==null&&(this.nodeType===3||this.nodeType===4||this.nodeType===8)&&`data`in this?this.data:t},configurable:!0,enumerable:!0})}if(i||a)return Jo=At(window),Jo}}catch{}return Jo=At,Jo}var Xo=class e{options;static NON_WHITESPACE_REGEX=/[^\r\n\s]+/;constructor(e){this.options=e}detectUnclosedTags(e){return qo(e,Object.keys(this.options.components??{}))}configureDOMPurify(){let e=Object.keys(this.options.components||{}),t=this.options.dompurifyConfig||{},n=Array.isArray(t.ADD_TAGS)?t.ADD_TAGS:[],r=Array.isArray(t.ADD_ATTR)?t.ADD_ATTR:[];return{...t,ADD_TAGS:Array.from(new Set([...e,...n])),ADD_ATTR:Array.from(new Set([`target`,`rel`,...r]))}}createReplaceElement(t,n){let{enableAnimation:r,animationConfig:i}=this.options.streaming||{};return a=>{let o=`x-markdown-component-${n.current++}`,s=a.type===`text`&&a.data&&e.NON_WHITESPACE_REGEX.test(a.data),c=a.parent?.name,l=c&&this.options.components?.[c];if(r&&s&&!l)return G.createElement(Po,{text:a.data,key:o,animationConfig:i});if(!(`name`in a))return;let{name:u,attribs:d,children:f}=a,p=this.options.components?.[u];if(p){n.tagIndexes[u]=(n.tagIndexes[u]??0)+1;let e={domNode:a,streamStatus:t?.has(Ho(u,n.tagIndexes[u]))?`loading`:`done`,key:o,...d,...d.disabled!==void 0&&{disabled:!0},...d.checked!==void 0&&{checked:!0}};if(e.className=[e.className,e.classname,e.class].filter(Boolean).join(` `).trim()||``,u===`code`){let{"data-block":t=`false`,"data-state":n=`done`}=d||{};e.block=t===`true`,e.streamStatus=n===`loading`?`loading`:`done`;let r=d?.[`data-lang`],i=d?.class?.match(/(?:^|\s)language-([^\s]+)/)?.[1]??d?.class?.match(/(?:^|\s)lang-([^\s]+)/)?.[1],a=r||i;a&&(e.lang=a)}return f&&(e.children=this.processChildren(f,t,n)),G.createElement(p,e)}}}processChildren(e,t,n){return(0,Mo.domToReact)(e,{replace:this.createReplaceElement(t,n)})}processHtml(e){if(typeof At.sanitize!=`function`)return null;let t=this.detectUnclosedTags(e),n={current:0,tagIndexes:{}},r=Yo(),i=this.configureDOMPurify();return No(r.sanitize(e,i),{replace:this.createReplaceElement(t,n)})}render(e){return this.processHtml(e)}},Zo={FPS_THRESHOLD:{GOOD:55,WARNING:40},COLORS:{GOOD:`#52c41a`,WARNING:`#faad14`,DANGER:`#ff4d4f`},CHART:{WIDTH:750,HEIGHT:400,PADDING:80}},Qo=()=>typeof window>`u`?{x:12,y:12}:{x:window.innerWidth-220,y:window.innerHeight/2-100},$o=()=>{let[e,t]=(0,G.useState)(0),[n,r]=(0,G.useState)(0),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)([]),[u,d]=(0,G.useState)(Qo()),[f,p]=(0,G.useState)(!1),m=(0,G.useRef)([]),h=(0,G.useRef)([]),g=(0,G.useRef)(0),_=(0,G.useRef)(0),v=(0,G.useRef)(void 0),y=(0,G.useRef)({isDragging:!1,startX:0,startY:0,initialX:0,initialY:0});(0,G.useEffect)(()=>{if(typeof window>`u`)return;f||(p(!0),g.current=performance.now());let e=()=>{let n=performance.now(),a=n-g.current;if(h.current.push(a),h.current.length>60&&h.current.shift(),_.current++,a>=1e3){let e=Math.round(_.current*1e3/a),o=b();t(e),r(o),i&&m.current.push({timestamp:Date.now(),fps:e,memory:o}),_.current=0,g.current=n}v.current=requestAnimationFrame(e)};return v.current=requestAnimationFrame(e),()=>{v.current!==void 0&&cancelAnimationFrame(v.current)}},[i,f]);let b=()=>{let e=performance;return e.memory?Math.round(e.memory.usedJSHeapSize/1024/1024):0},x=e=>e<1?`${Math.round(e*1024)} KB`:e>=1024?`${(e/1024).toFixed(2)} GB`:`${e.toFixed(2)} MB`,S=e=>e>=Zo.FPS_THRESHOLD.GOOD?Zo.COLORS.GOOD:e>=Zo.FPS_THRESHOLD.WARNING?Zo.COLORS.WARNING:Zo.COLORS.DANGER,C=(0,G.useCallback)(()=>{i?(a(!1),l([...m.current]),s(!0)):(m.current=[],a(!0))},[i]),w=(0,G.useCallback)(e=>{e.target.closest(`.x-markdown-debug-action`)||(y.current={isDragging:!0,startX:e.clientX,startY:e.clientY,initialX:u.x,initialY:u.y})},[u]),T=(0,G.useCallback)(e=>{if(!y.current.isDragging)return;let t=e.clientX-y.current.startX,n=e.clientY-y.current.startY;d({x:y.current.initialX+t,y:y.current.initialY+n})},[]),E=(0,G.useCallback)(()=>{y.current.isDragging=!1},[]);return(0,G.useEffect)(()=>{if(!(typeof window>`u`))return document.addEventListener(`mousemove`,T),document.addEventListener(`mouseup`,E),()=>{document.removeEventListener(`mousemove`,T),document.removeEventListener(`mouseup`,E)}},[T,E]),G.createElement(G.Fragment,null,G.createElement(`div`,{className:`x-markdown-debug-panel`,style:{left:u.x,top:u.y,cursor:y.current.isDragging?`grabbing`:`grab`},onMouseDown:w},G.createElement(`div`,{className:`x-markdown-debug-row`},G.createElement(`span`,{className:`x-markdown-debug-label`},`FPS`),G.createElement(`span`,{className:`x-markdown-debug-value`,style:{color:S(e)}},e)),G.createElement(`div`,{className:`x-markdown-debug-row`},G.createElement(`span`,{className:`x-markdown-debug-label`},`Memory`),G.createElement(`span`,{className:`x-markdown-debug-value`},x(n))),G.createElement(`div`,{className:`x-markdown-debug-actions`},G.createElement(`button`,{type:`button`,className:`x-markdown-debug-action x-markdown-debug-record-btn ${i?`recording`:``}`,onClick:C},i?`⏹ Stop`:`⏺ Record`),c.length>0&&!i&&G.createElement(`button`,{type:`button`,className:`x-markdown-debug-action`,onClick:()=>s(!0)},`📊 View`))),o&&c.length>0?G.createElement(`div`,{className:`x-markdown-debug-modal-overlay`,onClick:()=>s(!1)},G.createElement(`div`,{className:`x-markdown-debug-modal`,onClick:e=>e.stopPropagation()},G.createElement(`div`,{className:`x-markdown-debug-modal-header`},G.createElement(`span`,{style:{color:`#fff`,fontSize:18,fontWeight:`600`}},`Performance Recording`),G.createElement(`button`,{type:`button`,className:`x-markdown-debug-close-btn`,onClick:()=>s(!1)},`✕`)),G.createElement(()=>{if(!c.length)return null;let{WIDTH:e,HEIGHT:t,PADDING:n}=Zo.CHART,r=e-n*2,i=t-n*2,a=c[0]?.timestamp??0,o=(c[c.length-1]?.timestamp??0)-a||1,s=Math.max(...c.map(e=>e.fps),60),l=Math.max(...c.map(e=>e.memory),0)*1.1,u=c.length>0?c.reduce((e,t)=>e+t.fps,0)/c.length:0,d=c.length>0?c.reduce((e,t)=>e+t.memory,0)/c.length:0,f=c.length>0?Math.min(...c.map(e=>e.fps)):0,p=c.length>0?Math.max(...c.map(e=>e.fps)):0,m=(e,t)=>c.map(s=>`${n+(s.timestamp-a)/o*r},${n+i-s[e]/t*i}`).join(` `);return G.createElement(`div`,{className:`x-markdown-debug-modal-content`},G.createElement(`div`,{className:`x-markdown-debug-stats-summary`},G.createElement(`div`,{className:`x-markdown-debug-stat-item`},G.createElement(`div`,{className:`x-markdown-debug-stat-label`},`Duration`),G.createElement(`div`,{className:`x-markdown-debug-stat-value`},(o/1e3).toFixed(2),`s`)),G.createElement(`div`,{className:`x-markdown-debug-stat-item`},G.createElement(`div`,{className:`x-markdown-debug-stat-label`},`FPS Avg`),G.createElement(`div`,{className:`x-markdown-debug-stat-value`,style:{color:S(u)}},u.toFixed(1))),G.createElement(`div`,{className:`x-markdown-debug-stat-item`},G.createElement(`div`,{className:`x-markdown-debug-stat-label`},`FPS Range`),G.createElement(`div`,{className:`x-markdown-debug-stat-value`},f,` - `,p)),G.createElement(`div`,{className:`x-markdown-debug-stat-item`},G.createElement(`div`,{className:`x-markdown-debug-stat-label`},`Memory Avg`),G.createElement(`div`,{className:`x-markdown-debug-stat-value`},x(d)))),G.createElement(`svg`,{width:e,height:t,className:`x-markdown-debug-chart-full`,role:`img`,"aria-label":`Performance chart showing FPS and memory usage over time`},G.createElement(`title`,null,`Performance Chart`),[0,.25,.5,.75,1].map(a=>G.createElement(`g`,{key:a},G.createElement(`line`,{x1:n,y1:n+i*a,x2:e-n,y2:n+i*a,stroke:`rgba(255,255,255,0.1)`,strokeWidth:`1`}),G.createElement(`line`,{x1:n+r*a,y1:n,x2:n+r*a,y2:t-n,stroke:`rgba(255,255,255,0.1)`,strokeWidth:`1`}))),G.createElement(`polyline`,{points:m(`fps`,s),fill:`none`,stroke:Zo.COLORS.GOOD,strokeWidth:`2`,className:`fps-line`}),G.createElement(`polyline`,{points:m(`memory`,l),fill:`none`,stroke:`#1890ff`,strokeWidth:`2`,className:`memory-line`}),G.createElement(`text`,{x:n-10,y:n,fill:Zo.COLORS.GOOD,fontSize:`12`,textAnchor:`end`},s.toFixed(0)),G.createElement(`text`,{x:n-10,y:t-n,fill:Zo.COLORS.GOOD,fontSize:`12`,textAnchor:`end`},`0`),G.createElement(`text`,{x:n-10,y:n-15,fill:Zo.COLORS.GOOD,fontSize:`14`,fontWeight:`bold`,textAnchor:`end`},`FPS`),G.createElement(`text`,{x:e-n+10,y:n+20,fill:`#1890ff`,fontSize:`12`,textAnchor:`start`},x(l)),G.createElement(`text`,{x:e-n+10,y:t-n,fill:`#1890ff`,fontSize:`12`,textAnchor:`start`},x(0)),G.createElement(`text`,{x:e-n+10,y:n+5,fill:`#1890ff`,fontSize:`14`,fontWeight:`bold`,textAnchor:`start`},`Memory`),G.createElement(`text`,{x:n,y:t-n+20,fill:`rgba(255,255,255,0.6)`,fontSize:`12`,textAnchor:`middle`},`0s`),G.createElement(`text`,{x:e-n,y:t-n+20,fill:`rgba(255,255,255,0.6)`,fontSize:`12`,textAnchor:`middle`},(o/1e3).toFixed(1),`s`)),G.createElement(`div`,{className:`x-markdown-debug-legend`},G.createElement(`div`,{className:`x-markdown-debug-legend-item`},G.createElement(`span`,{className:`x-markdown-debug-legend-color`,style:{backgroundColor:Zo.COLORS.GOOD}}),G.createElement(`span`,null,`FPS`)),G.createElement(`div`,{className:`x-markdown-debug-legend-item`},G.createElement(`span`,{className:`x-markdown-debug-legend-color`,style:{backgroundColor:`#1890ff`}}),G.createElement(`span`,null,`Memory`))))},null))):null)},Q=function(e){return e.Text=`text`,e.Link=`link`,e.Image=`image`,e.Html=`html`,e.Emphasis=`emphasis`,e.List=`list`,e.Table=`table`,e.InlineCode=`inline-code`,e}({}),es={image:[/^!\[[^\]\r\n]{0,1000}$/,/^!\[[^\r\n]{0,1000}\]\(*[^)\r\n]{0,1000}$/],link:[/^\[[^\]\r\n]{0,1000}$/,/^\[[^\r\n]{0,1000}\]\(*[^)\r\n]{0,1000}$/],html:[/^<\/$/,/^<\/?[a-zA-Z][a-zA-Z0-9-]{0,100}[^>\r\n]{0,1000}$/],commonEmphasis:[/^(\*{1,3}|_{1,3})(?!\s)(?!.*\1$)[^\r\n]{0,1000}$/],list:[/^[-+*]\s{0,3}$/,/^[-+*]\s{1,3}(\*{1,3}|_{1,3})(?!\s)(?!.*\1$)[^\r\n]{0,1000}$/],"inline-code":[/^`[^`\r\n]{0,300}$/]},ts=e=>{if(e.includes(`
|
|
|
|
`))return!1;let t=e.split(`
|
|
`);if(t.length<=1)return!0;let[n,r]=t,i=n.trim();if(!/^\|.*\|$/.test(i))return!1;let a=r.trim().split(`|`).map(e=>e.trim()).filter(Boolean),o=/^:?-+:?$/;return a.every((e,t)=>t===a.length-1&&e===`:`||o.test(e))},ns={[Q.Link]:{tokenType:Q.Link,isStartOfToken:e=>e.startsWith(`[`),isStreamingValid:e=>es.link.some(t=>t.test(e))},[Q.Image]:{tokenType:Q.Image,isStartOfToken:e=>e.startsWith(`!`),isStreamingValid:e=>es.image.some(t=>t.test(e))},[Q.Html]:{tokenType:Q.Html,isStartOfToken:e=>e.startsWith(`<`),isStreamingValid:e=>es.html.some(t=>t.test(e))},[Q.Emphasis]:{tokenType:Q.Emphasis,isStartOfToken:e=>e.startsWith(`*`)||e.startsWith(`_`),isStreamingValid:e=>es.commonEmphasis.some(t=>t.test(e))},[Q.List]:{tokenType:Q.List,isStartOfToken:e=>/^[-+*]/.test(e),isStreamingValid:e=>es.list.some(t=>t.test(e)),getCommitPrefix:e=>{let t=e.match(/^([-+*]\s{0,3})/)?.[1],n=t?e.slice(t.length):``;return t&&n.startsWith("`")?t:null}},[Q.Table]:{tokenType:Q.Table,isStartOfToken:e=>e.startsWith(`|`),isStreamingValid:ts},[Q.InlineCode]:{tokenType:Q.InlineCode,isStartOfToken:e=>e.startsWith("`"),isStreamingValid:e=>es[`inline-code`].some(t=>t.test(e))}},rs=(e,t)=>{let n=ns[t];if(!n)return;let{token:r,pending:i}=e;if(r===Q.Text&&n.isStartOfToken(i)){e.token=t;return}if(r===t&&!n.isStreamingValid(i)){let t=n.getCommitPrefix?.(i);if(t){e.completeMarkdown+=t,e.pending=i.slice(t.length),e.token=Q.Text;return}ss(e)}},is=Object.values(ns).map(e=>({tokenType:e.tokenType,recognize:t=>rs(t,e.tokenType)})),as=()=>({inFenced:!1,fenceChar:``,fenceLen:0,lineFenceChar:``,lineFenceLen:0,lineFenceRunEnded:!1,lineTailBlank:!0}),os=()=>({pending:``,token:Q.Text,processedLength:0,completeMarkdown:``,fence:as()}),ss=e=>{e.pending&&=(e.completeMarkdown+=e.pending,``),e.token=Q.Text},cs=(e,t)=>{if(t===`
|
|
`){e.lineFenceLen>=3&&(e.inFenced?e.lineFenceChar===e.fenceChar&&e.lineFenceLen>=e.fenceLen&&e.lineTailBlank&&(e.inFenced=!1,e.fenceChar=``,e.fenceLen=0):(e.inFenced=!0,e.fenceChar=e.lineFenceChar,e.fenceLen=e.lineFenceLen)),e.lineFenceChar=``,e.lineFenceLen=0,e.lineFenceRunEnded=!1,e.lineTailBlank=!0;return}e.lineFenceRunEnded?e.lineTailBlank=e.lineTailBlank&&/\s/.test(t):e.lineFenceLen===0&&(t==="`"||t===`~`)?(e.lineFenceChar=t,e.lineFenceLen=1):e.lineFenceLen>0&&t===e.lineFenceChar?e.lineFenceLen+=1:(e.lineFenceRunEnded=!0,e.lineTailBlank=e.lineTailBlank&&/\s/.test(t))},ls=e=>e.inFenced||e.lineFenceLen>=3,us=e=>{let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=55296&&r<=56319?n+1<e.length&&e.charCodeAt(n+1)>=56320&&e.charCodeAt(n+1)<=57343&&(t+=e[n]+e[n+1],n++):(r<56320||r>57343)&&(t+=e[n])}return t},ds=e=>{try{return encodeURIComponent(e)}catch(t){return t instanceof URIError?encodeURIComponent(us(e)):``}},fs=(e,t)=>{let{streaming:n,components:r={}}=t||{},{hasNextChunk:i=!1,incompleteMarkdownComponentMap:a}=n||{},[o,s]=(0,G.useState)(``),c=i?o:typeof e==`string`?e:``,l=(0,G.useRef)(os()),u=(0,G.useCallback)(e=>{let{token:t,pending:n}=e;if(t===Q.Text||t===Q.Image&&n===`!`)return;if(t===Q.Table&&n.split(`
|
|
`).length>2)return n;let i=(a||{})[t]||`incomplete-${t}`,o=ds(n);return r?.[i]?`<${i} data-raw="${o}" />`:void 0},[a,r]),d=(0,G.useCallback)(e=>{if(!e){s(``),l.current=os();return}let t=l.current.completeMarkdown+l.current.pending;e.startsWith(t)||(l.current=os());let n=l.current,r=e.slice(n.processedLength);if(!r)return;n.processedLength+=r.length;for(let e of r){if(n.pending+=e,cs(n.fence,e),ls(n.fence)){ss(n);continue}if(n.token===Q.Text)for(let e of is)e.recognize(n);else if(is.find(e=>e.tokenType===n.token)?.recognize(n),n.token===Q.Text)for(let e of is)e.recognize(n);n.token===Q.Text&&ss(n)}let i=u(n);s(n.completeMarkdown+(i||``))},[u]);return(0,G.useEffect)(()=>{if(typeof e!=`string`){console.error(`X-Markdown: input must be string, not ${typeof e}.`),s(``);return}i&&d(e)},[e,i,d]),c},ps=e=>e?typeof e==`boolean`?`▋`:e.content||`▋`:null,ms=G.memo(e=>{let{streaming:t,config:n,components:r,paragraphTag:i,content:a,children:o,rootClassName:s,className:c,style:l,openLinksInNewTab:u,dompurifyConfig:d,protectCustomTagNewlines:f,disableCustomTagBlockMarkdown:p,escapeRawHtml:h,debug:g,disableDefaultStyles:_}=e,v=(0,G.useMemo)(()=>ps(t?.tail),[t?.tail]),y=typeof t?.tail==`object`?t.tail.component:void 0,b=!!t?.hasNextChunk&&v,x=(0,G.useMemo)(()=>{if(_===!0)return`x-md-disable-all`;if(Array.isArray(_))return _.map(e=>`x-md-disable-${e}`)},[_]),S=m(`x-markdown`,x,s,c),C=fs(a||o||``,{streaming:t,components:r}),w=(0,G.useMemo)(()=>{if(!b)return r;let e=y?G.createElement(y,{content:v}):G.createElement(`span`,{className:`xmd-tail`},v);return{...r,"xmd-tail":()=>e}},[b,r,y,v]),T=(0,G.useMemo)(()=>new ho({markedConfig:n,paragraphTag:i,openLinksInNewTab:u,components:w,protectCustomTagNewlines:f,disableCustomTagBlockMarkdown:p,escapeRawHtml:h}),[n,i,u,w,f,p,h]),E=(0,G.useMemo)(()=>new Xo({components:w,dompurifyConfig:d,streaming:t}),[w,d,t]),D=(0,G.useMemo)(()=>C?T.parse(C,{injectTail:!!b}):``,[C,T,b]),O=(0,G.useMemo)(()=>D?E.render(D):null,[D,E]);return C?G.createElement(G.Fragment,null,G.createElement(`div`,{className:S,style:l},O),g?G.createElement($o,null):null):null});async function hs(){return n({url:`/ai/chat/conversations`,method:`get`})}async function gs(e){return n({url:`/ai/chat/messages/${e}`,method:`get`})}async function _s(e){return n({url:`/ai/chat/conversations/${e}`,method:`delete`})}var $=v(),{Text:vs}=w,ys=()=>{let{t:e}=ie(),{message:t,modal:n}=le.useApp(),{token:r}=ce.useToken(),i=C(e=>e.themeConfig),a=x(),[o]=S(),s=o.get(`agent_id`),[c,l]=(0,G.useState)(null),u=(0,G.useRef)(null),{conversations:d,setConversations:f,activeConversationKey:p,setActiveConversationKey:m}=Ci({}),[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[w,T]=(0,G.useState)(!1),E=async()=>{let{data:e}=await hs();e.success&&e.data&&f(e.data)},D=async e=>{let{data:t}=await gs(e);t.success&&t.data&&(g(t.data),setTimeout(()=>{u.current?.scrollTo({top:`bottom`})},100))};(0,G.useEffect)(()=>{E()},[]),(0,G.useEffect)(()=>{s&&de(Number(s)).then(({data:e})=>{e.success&&e.data&&l(e.data)})},[s]);let O=e=>{m(e),D(e)},ee=()=>{m(``),g([])},M=r=>{n.confirm({title:e(`ai.chat.delete.confirm`),okButtonProps:{danger:!0},onOk:async()=>{await _s(r),t.success(e(`ai.chat.delete.success`)),p===r&&(m(``),g([])),await E()}})},N=async e=>{if(!e.trim()||_)return;let t={key:`user-${Date.now()}`,role:`user`,content:e,status:`success`},n={key:`assistant-${Date.now()}`,role:`assistant`,content:``,loading:!0,extraInfo:{isStreaming:!0}};g(e=>[...e,t,n]),v(!0),T(!0);let r=localStorage.getItem(`token`),i=``;Li(`/index.php/ai/chat/send`,{headers:{"Content-Type":`application/json`,Authorization:`Bearer ${r}`,Accept:`text/event-stream`},method:`post`,params:{conversation_id:p,message:e,agent_id:s?Number(s):void 0},callbacks:{onSuccess:async()=>{if(v(!1),b(``),T(!1),!p){let{data:e}=await hs();if(e.success&&e.data&&e.data.length>0){f(e.data);let t=e.data[0].key;m(t)}}},onError:()=>{v(!1),T(!1)},onUpdate:e=>{console.log(`onUpdate`,e);let t=e.data;if(t!==`[DONE]`)try{let e=JSON.parse(t);e.type===`text_delta`&&e.delta&&(i+=e.delta,g(e=>e.map(e=>e.key===n.key?{...e,content:i,loading:!1}:e))),e.type===`text_end`&&g(t=>t.map(t=>t.key===n.key?{...t,key:e.message_id,loading:!1}:t))}catch{}}}})},te={assistant:{placement:`start`,variant:`filled`,avatar:(0,$.jsx)(P,{src:c?.icon||`https://file.xinadmin.cn/file/favicons.ico`}),contentRender:(e,t)=>{if(!e)return null;let n=t?.extraInfo?.isStreaming===!0;return(0,$.jsx)(ms,{content:e,streaming:{hasNextChunk:n,enableAnimation:!0,tail:n},openLinksInNewTab:!0,escapeRawHtml:!0})}},user:{placement:`end`,variant:`filled`,avatar:(0,$.jsx)(P,{icon:(0,$.jsx)(re,{}),style:{background:r.colorFillSecondary,color:r.colorTextSecondary},size:36})}},ae=h.length>0;return(0,$.jsxs)(j,{styles:{body:{padding:0,overflow:`hidden`,display:`flex`,height:`calc(100vh - 180px)`}},title:(0,$.jsx)(k,{align:`center`,children:c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{src:c.icon,size:36}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{style:{fontSize:18,fontWeight:600,marginRight:10},children:c.name}),c.description&&(0,$.jsx)(vs,{type:`secondary`,style:{fontSize:12,lineHeight:1},children:c.description})]})]}):(0,$.jsx)(`span`,{children:e(`ai.chat.defaultTitle`)})}),extra:(0,$.jsx)(A,{onClick:()=>a(`/ai/agent`),children:e(`ai.chat.switchAgent`)}),children:[(0,$.jsx)(`div`,{style:{width:280,borderRight:`1px solid ${r.colorBorderSecondary}`},children:(0,$.jsx)(Ar,{items:d,activeKey:p,onActiveChange:O,menu:e=>({items:[{label:`Rename`,key:`Rename`,icon:(0,$.jsx)(ne,{})},{type:`divider`},{label:`Delete Chat`,key:`delete`,icon:(0,$.jsx)(se,{}),danger:!0,onClick:()=>M(e.key)}]}),creation:{onClick:ee},style:{flex:1,overflow:`auto`}})}),(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 px-1`,children:[!ae&&(0,$.jsx)(`div`,{className:`h-full flex items-center justify-center`,children:(0,$.jsx)(yi,{icon:c?.icon||`https://file.xinadmin.cn/file/favicons.ico`,style:{backgroundImage:i.themeScheme===`dark`?`linear-gradient(97deg, rgba(90,196,255,0.12) 0%, rgba(174,136,255,0.12) 100%)`:`linear-gradient(97deg, #f2f9fe 0%, #f7f3ff 100%)`,borderRadius:20,width:`80%`,padding:`20px`},title:e(`ai.chat.welcome.title`),description:e(`ai.chat.welcome.description`),variant:`borderless`})}),ae&&(0,$.jsx)(`div`,{style:{flex:1,overflow:`hidden`},children:(0,$.jsx)(nr.List,{ref:u,items:h,autoScroll:!0,style:{height:`100%`,padding:16},role:te})}),(0,$.jsx)(`div`,{style:{padding:`0 16px 16px`},children:(0,$.jsx)(hi,{loading:_,disabled:w,value:y,onChange:b,placeholder:e(`ai.chat.placeholder`),onSubmit:N,onCancel:()=>v(!1),autoSize:{minRows:1,maxRows:6}})})]})]})};export{ys as default}; |