@lsamien/yaoyao 0.4.78 → 0.4.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build-info.json +6 -3
- package/dist/assets/{AboutDialog-jvhTP8-J.js → AboutDialog-CrajAC--.js} +2 -2
- package/dist/assets/{AboutDialog-jvhTP8-J.js.map → AboutDialog-CrajAC--.js.map} +1 -1
- package/dist/assets/{BotAutomationsView-ktoci79V.js → BotAutomationsView-DTOoFSEl.js} +2 -2
- package/dist/assets/{BotAutomationsView-ktoci79V.js.map → BotAutomationsView-DTOoFSEl.js.map} +1 -1
- package/dist/assets/{BotPluginsDialog-H85RI-7P.js → BotPluginsDialog-Ckiwmito.js} +2 -2
- package/dist/assets/{BotPluginsDialog-H85RI-7P.js.map → BotPluginsDialog-Ckiwmito.js.map} +1 -1
- package/dist/assets/{BotSettingsDialog-Ci_DZL4m.js → BotSettingsDialog-ChffrjSM.js} +4 -4
- package/dist/assets/{BotSettingsDialog-Ci_DZL4m.js.map → BotSettingsDialog-ChffrjSM.js.map} +1 -1
- package/dist/assets/{ChatView-6cdLMsuy.js → ChatView-znZF8RZE.js} +2 -2
- package/dist/assets/{ChatView-6cdLMsuy.js.map → ChatView-znZF8RZE.js.map} +1 -1
- package/dist/assets/{ComputerPanel-Dbwgx5n8.js → ComputerPanel-bNkvZAiT.js} +2 -2
- package/dist/assets/{ComputerPanel-Dbwgx5n8.js.map → ComputerPanel-bNkvZAiT.js.map} +1 -1
- package/dist/assets/{ComputerViewerView-csnhRedK.js → ComputerViewerView-DCTvbHr-.js} +2 -2
- package/dist/assets/{ComputerViewerView-csnhRedK.js.map → ComputerViewerView-DCTvbHr-.js.map} +1 -1
- package/dist/assets/{ConversationsView-CEO2SVGT.js → ConversationsView-BnysxvX_.js} +4 -4
- package/dist/assets/{ConversationsView-CEO2SVGT.js.map → ConversationsView-BnysxvX_.js.map} +1 -1
- package/dist/assets/{ConversationsView-CHLGKsJt.css → ConversationsView-CbArO1v2.css} +1 -1
- package/dist/assets/{FilesView-t5jA-H2-.js → FilesView-D7tA6Nu1.js} +2 -2
- package/dist/assets/{FilesView-t5jA-H2-.js.map → FilesView-D7tA6Nu1.js.map} +1 -1
- package/dist/assets/{FloatingResourceSearch-BAYymuJV.js → FloatingResourceSearch-c6l1JuAA.js} +2 -2
- package/dist/assets/{FloatingResourceSearch-BAYymuJV.js.map → FloatingResourceSearch-c6l1JuAA.js.map} +1 -1
- package/dist/assets/{HistoryView-BqMSV9iC.js → HistoryView-Cnsriop4.js} +2 -2
- package/dist/assets/{HistoryView-BqMSV9iC.js.map → HistoryView-Cnsriop4.js.map} +1 -1
- package/dist/assets/{KanbanView-CWwrwH9S.js → KanbanView-CXm05b62.js} +2 -2
- package/dist/assets/{KanbanView-CWwrwH9S.js.map → KanbanView-CXm05b62.js.map} +1 -1
- package/dist/assets/{LocalVmSettingsPanel-BXvZwFQP.js → LocalVmSettingsPanel-HgNC1SCF.js} +2 -2
- package/dist/assets/{LocalVmSettingsPanel-BXvZwFQP.js.map → LocalVmSettingsPanel-HgNC1SCF.js.map} +1 -1
- package/dist/assets/{RunnerSettingsPanel-KkpIkkob.js → RunnerSettingsPanel-CLKZvWua.js} +2 -2
- package/dist/assets/{RunnerSettingsPanel-KkpIkkob.js.map → RunnerSettingsPanel-CLKZvWua.js.map} +1 -1
- package/dist/assets/{StandaloneDialog-D4BQqjpB.js → StandaloneDialog-DODllzh1.js} +2 -2
- package/dist/assets/{StandaloneDialog-D4BQqjpB.js.map → StandaloneDialog-DODllzh1.js.map} +1 -1
- package/dist/assets/{UpdateCheckDialog-Ct0bT6xU.js → UpdateCheckDialog-DHcAuryL.js} +2 -2
- package/dist/assets/{UpdateCheckDialog-Ct0bT6xU.js.map → UpdateCheckDialog-DHcAuryL.js.map} +1 -1
- package/dist/assets/{WorkspaceKnowledgePanel-WBcPB49x.js → WorkspaceKnowledgePanel-BrE8xSi2.js} +2 -2
- package/dist/assets/{WorkspaceKnowledgePanel-WBcPB49x.js.map → WorkspaceKnowledgePanel-BrE8xSi2.js.map} +1 -1
- package/dist/assets/{WorkspaceRoutinesPanel-JubUwGsV.js → WorkspaceRoutinesPanel-CpDVEwHx.js} +2 -2
- package/dist/assets/{WorkspaceRoutinesPanel-JubUwGsV.js.map → WorkspaceRoutinesPanel-CpDVEwHx.js.map} +1 -1
- package/dist/assets/WorkspaceShell-Dhm3r61t.js +44 -0
- package/dist/assets/WorkspaceShell-Dhm3r61t.js.map +1 -0
- package/dist/assets/WorkspaceShell-Dk003lIq.css +1 -0
- package/dist/assets/{WorkspaceView-DTanioWW.js → WorkspaceView-CBWFRLki.js} +2 -2
- package/dist/assets/{WorkspaceView-DTanioWW.js.map → WorkspaceView-CBWFRLki.js.map} +1 -1
- package/dist/assets/{docx-preview-B1SjJgD_.js → docx-preview-CG4CK2Qm.js} +2 -2
- package/dist/assets/{docx-preview-B1SjJgD_.js.map → docx-preview-CG4CK2Qm.js.map} +1 -1
- package/dist/assets/{index-CWamgtSb.js → index-BRP9NWum.js} +4 -4
- package/dist/assets/index-BRP9NWum.js.map +1 -0
- package/dist/assets/{pdf-DVDddcFC.js → pdf-CFWXmhVF.js} +2 -2
- package/dist/assets/{pdf-DVDddcFC.js.map → pdf-CFWXmhVF.js.map} +1 -1
- package/dist/assets/{sessionOwnership-0hdKcwOs.js → sessionOwnership-B2YxdBdf.js} +2 -2
- package/dist/assets/{sessionOwnership-0hdKcwOs.js.map → sessionOwnership-B2YxdBdf.js.map} +1 -1
- package/dist/assets/{viewModels-DKBqaDRg.js → viewModels-CYJ8m5Uf.js} +4 -4
- package/dist/assets/{viewModels-DKBqaDRg.js.map → viewModels-CYJ8m5Uf.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/release.json +3 -3
- package/dist/assets/WorkspaceShell-0m4gg6AW.css +0 -1
- package/dist/assets/WorkspaceShell-Do2VAwIz.js +0 -44
- package/dist/assets/WorkspaceShell-Do2VAwIz.js.map +0 -1
- package/dist/assets/index-CWamgtSb.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-
|
|
2
|
-
import{_ as e,d as t,h as n,m as r}from"./WorkspaceShell-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-CFWXmhVF.js","assets/index-BRP9NWum.js","assets/_plugin-vue_export-helper-CscYwSBt.js","assets/index-g5POnMkp.css","assets/docx-preview-CG4CK2Qm.js","assets/WorkspaceShell-Dhm3r61t.js","assets/RunnerSettingsPanel-CLKZvWua.js","assets/RunnerSettingsPanel-CfxxQKpV.css","assets/WorkspaceShell-Dk003lIq.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as e,d as t,h as n,m as r}from"./WorkspaceShell-Dhm3r61t.js";import{A as i,D as a,F as o,H as s,L as c,M as l,P as u,W as d,Y as f,_ as p,at as m,ct as h,d as g,et as _,f as v,g as y,h as b,l as x,m as S,n as C,ot as w,p as T,st as E,t as D,u as O,v as k,x as A,y as j}from"./_plugin-vue_export-helper-CscYwSBt.js";import{G as M,J as N,K as P,X as F,Y as I,i as L,q as R,r as z,t as B}from"./index-BRP9NWum.js";import{t as ee}from"./ChevronForwardOutline-D--GIQK6.js";var te={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 512 512`},ne=A({name:`ChevronBackOutline`,render:function(e,t){return o(),p(`svg`,te,t[0]||=[S(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`48`,d:`M328 112L184 256l144 144`},null,-1)])}}),re={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 512 512`},ie=A({name:`CloseOutline`,render:function(e,t){return o(),p(`svg`,re,t[0]||=[S(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`32`,d:`M368 368L144 144`},null,-1),S(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`32`,d:`M368 144L144 368`},null,-1)])}}),ae={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 512 512`},V=A({name:`DownloadOutline`,render:function(e,t){return o(),p(`svg`,ae,t[0]||=[S(`path`,{d:`M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40`,fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`32`},null,-1),S(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`32`,d:`M176 272l80 80l80-80`},null,-1),S(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`32`,d:`M256 48v288`},null,-1)])}});function oe(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 H(e){if(Array.isArray(e))return e}function se(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 U(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ce(e,t){return H(e)||se(e,t)||le(e,t)||U()}function le(e,t){if(e){if(typeof e==`string`)return oe(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)?oe(e,t):void 0}}var ue=Object.entries,de=Object.setPrototypeOf,fe=Object.isFrozen,pe=Object.getPrototypeOf,me=Object.getOwnPropertyDescriptor,W=Object.freeze,G=Object.seal,he=Object.create,ge=typeof Reflect<`u`&&Reflect,_e=ge.apply,ve=ge.construct;W||=function(e){return e},G||=function(e){return e},_e||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ve||=function(e){return new e(...[...arguments].slice(1))};var ye=J(Array.prototype.forEach),be=J(Array.prototype.lastIndexOf),xe=J(Array.prototype.pop),Se=J(Array.prototype.push),Ce=J(Array.prototype.splice),we=Array.isArray,Te=J(String.prototype.toLowerCase),Ee=J(String.prototype.toString),De=J(String.prototype.match),Oe=J(String.prototype.replace),ke=J(String.prototype.indexOf),Ae=J(String.prototype.trim),je=J(Number.prototype.toString),Me=J(Boolean.prototype.toString),Ne=typeof BigInt>`u`?null:J(BigInt.prototype.toString),Pe=typeof Symbol>`u`?null:J(Symbol.prototype.toString),K=J(Object.prototype.hasOwnProperty),Fe=J(Object.prototype.toString),q=J(RegExp.prototype.test),Ie=Le(TypeError);function J(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return _e(e,t,n)}}function Le(e){return function(){return ve(e,[...arguments])}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Te;if(de&&de(e,null),!we(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(fe(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Re(e){for(let t=0;t<e.length;t++)K(e,t)||(e[t]=null);return e}function ze(e){let t=he(null);for(let r of ue(e)){var n=ce(r,2);let i=n[0],a=n[1];K(e,i)&&(t[i]=we(a)?Re(a):a&&typeof a==`object`&&a.constructor===Object?ze(a):a)}return t}function Be(e){switch(typeof e){case`string`:return e;case`number`:return je(e);case`boolean`:return Me(e);case`bigint`:return Ne?Ne(e):`0`;case`symbol`:return Pe?Pe(e):`Symbol()`;case`undefined`:return Fe(e);case`function`:case`object`:{if(e===null)return Fe(e);let t=e,n=Ve(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Fe(e)}return Fe(e)}default:return Fe(e)}}function Ve(e,t){for(;e!==null;){let n=me(e,t);if(n){if(n.get)return J(n.get);if(typeof n.value==`function`)return J(n.value)}e=pe(e)}function n(){return null}return n}function He(e){try{return q(e,``),!0}catch{return!1}}var Ue=W(`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(`.`)),We=W(`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(`.`)),Ge=W([`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`]),Ke=W([`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`]),qe=W(`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(`.`)),Je=W([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ye=W([`#text`]),Xe=W(`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(`.`)),Ze=W(`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.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.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(`.`)),Qe=W(`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(`.`)),$e=W([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),et=G(/{{[\w\W]*|^[\w\W]*}}/g),tt=G(/<%[\w\W]*|^[\w\W]*%>/g),nt=G(/\${[\w\W]*/g),rt=G(/^data-[\-\w.\u00B7-\uFFFF]+$/),it=G(/^aria-[\-\w]+$/),at=G(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ot=G(/^(?:\w+script|data):/i),st=G(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ct=G(/^html$/i),lt=G(/^[a-z][.\w]*(-[.\w]+)+$/i),ut=G(/<[/\w!]/g),dt=G(/<[/\w]/g),ft=G(/<\/no(script|embed|frames)/i),pt=G(/\/>/i),mt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ht=function(){return typeof window>`u`?null:window},gt=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}},_t=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},vt=function(e,t,n,r){return K(e,t)&&we(e[t])?Y(r.base?ze(r.base):{},e[t],r.transform):n};function yt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ht(),t=e=>yt(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==mt.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=Ve(d,`cloneNode`),p=Ve(d,`remove`),m=Ve(d,`nextSibling`),h=Ve(d,`childNodes`),g=Ve(d,`parentNode`),_=Ve(d,`shadowRoot`),v=Ve(d,`attributes`),y=o&&o.prototype?Ve(o.prototype,`nodeType`):null,b=o&&o.prototype?Ve(o.prototype,`nodeName`):null,x=o&&o.prototype?Ve(o.prototype,`ownerDocument`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,C=``,w,T=!1,E=0,D=function(){if(E>0)throw Ie(`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.`)},O=function(e){D(),E++;try{return S.createHTML(e)}finally{E--}},k=function(e){D(),E++;try{return S.createScriptURL(e)}finally{E--}},A=function(){return T||=(w=gt(u,i),!0),w},j=n,M=j.implementation,N=j.createNodeIterator,P=j.createDocumentFragment,F=j.getElementsByTagName,I=r.importNode,L=_t();t.isSupported=typeof ue==`function`&&typeof g==`function`&&M&&M.createHTMLDocument!==void 0;let R=et,z=tt,B=nt,ee=rt,te=it,ne=ot,re=st,ie=lt,ae=at,V=null,oe=Y({},[...Ue,...We,...Ge,...qe,...Ye]),H=null,se=Y({},[...Xe,...Ze,...Qe,...$e]),U=Object.seal(he(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}})),ce=null,le=null,de=Object.seal(he(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),fe=!0,pe=!0,me=!1,ge=!0,_e=!1,ve=!0,je=!1,Me=!1,Ne=null,Pe=null,Fe=!1,J=!1,Le=!1,Re=!1,bt=!0,xt=!1,St=`user-content-`,Ct=!0,wt=!1,Tt={},Et=null,Dt=Y({},`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(`.`)),Ot=null,kt=Y({},[`audio`,`video`,`img`,`source`,`image`,`track`]),At=null,jt=Y({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Mt=`http://www.w3.org/1998/Math/MathML`,Nt=`http://www.w3.org/2000/svg`,Pt=`http://www.w3.org/1999/xhtml`,Ft=Pt,It=!1,Lt=null,Rt=Y({},[Mt,Nt,Pt],Ee),zt=W([`mi`,`mo`,`mn`,`ms`,`mtext`]),Bt=Y({},zt),Vt=W([`annotation-xml`]),Ht=Y({},Vt),Ut=Y({},[`title`,`style`,`font`,`a`,`script`]),Wt=null,Gt=[`application/xhtml+xml`,`text/html`],X=null,Kt=null,qt=n.createElement(`form`),Jt=function(e){return e instanceof RegExp||e instanceof Function},Yt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Kt&&Kt===e)return;(!e||typeof e!=`object`)&&(e={}),e=ze(e),Wt=Gt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,X=Wt===`application/xhtml+xml`?Ee:Te,V=vt(e,`ALLOWED_TAGS`,oe,{transform:X}),H=vt(e,`ALLOWED_ATTR`,se,{transform:X}),Lt=vt(e,`ALLOWED_NAMESPACES`,Rt,{transform:Ee}),At=vt(e,`ADD_URI_SAFE_ATTR`,jt,{transform:X,base:jt}),Ot=vt(e,`ADD_DATA_URI_TAGS`,kt,{transform:X,base:kt}),Et=vt(e,`FORBID_CONTENTS`,Dt,{transform:X}),ce=vt(e,`FORBID_TAGS`,ze({}),{transform:X}),le=vt(e,`FORBID_ATTR`,ze({}),{transform:X}),Tt=K(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ze(e.USE_PROFILES):e.USE_PROFILES:!1,fe=e.ALLOW_ARIA_ATTR!==!1,pe=e.ALLOW_DATA_ATTR!==!1,me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ge=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_e=e.SAFE_FOR_TEMPLATES||!1,ve=e.SAFE_FOR_XML!==!1,je=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,Le=e.RETURN_DOM_FRAGMENT||!1,Re=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,bt=e.SANITIZE_DOM!==!1,xt=e.SANITIZE_NAMED_PROPS||!1,Ct=e.KEEP_CONTENT!==!1,wt=e.IN_PLACE||!1,ae=He(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:at,Ft=typeof e.NAMESPACE==`string`?e.NAMESPACE:Pt,Bt=K(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?ze(e.MATHML_TEXT_INTEGRATION_POINTS):Y({},zt),Ht=K(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?ze(e.HTML_INTEGRATION_POINTS):Y({},Vt);let t=K(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?ze(e.CUSTOM_ELEMENT_HANDLING):he(null);if(U=he(null),K(t,`tagNameCheck`)&&Jt(t.tagNameCheck)&&(U.tagNameCheck=t.tagNameCheck),K(t,`attributeNameCheck`)&&Jt(t.attributeNameCheck)&&(U.attributeNameCheck=t.attributeNameCheck),K(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(U.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),G(U),_e&&(pe=!1),Le&&(J=!0),Tt&&(V=Y({},Ye),H=he(null),Tt.html===!0&&(Y(V,Ue),Y(H,Xe)),Tt.svg===!0&&(Y(V,We),Y(H,Ze),Y(H,$e)),Tt.svgFilters===!0&&(Y(V,Ge),Y(H,Ze),Y(H,$e)),Tt.mathMl===!0&&(Y(V,qe),Y(H,Qe),Y(H,$e))),de.tagCheck=null,de.attributeCheck=null,K(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?de.tagCheck=e.ADD_TAGS:we(e.ADD_TAGS)&&(V===oe&&(V=ze(V)),Y(V,e.ADD_TAGS,X))),K(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?de.attributeCheck=e.ADD_ATTR:we(e.ADD_ATTR)&&(H===se&&(H=ze(H)),Y(H,e.ADD_ATTR,X))),K(e,`ADD_URI_SAFE_ATTR`)&&we(e.ADD_URI_SAFE_ATTR)&&Y(At,e.ADD_URI_SAFE_ATTR,X),K(e,`FORBID_CONTENTS`)&&we(e.FORBID_CONTENTS)&&(Et===Dt&&(Et=ze(Et)),Y(Et,e.FORBID_CONTENTS,X)),K(e,`ADD_FORBID_CONTENTS`)&&we(e.ADD_FORBID_CONTENTS)&&(Et===Dt&&(Et=ze(Et)),Y(Et,e.ADD_FORBID_CONTENTS,X)),Ct&&(V[`#text`]=!0),je&&Y(V,[`html`,`head`,`body`]),V.table&&(Y(V,[`tbody`]),delete ce.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ie(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ie(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{C=O(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,C=``):(S===void 0&&(S=A()),S&&typeof C==`string`&&(C=O(``)));W&&W(e),Kt=e},Xt=Y({},[...We,...Ge,...Ke]),Zt=Y({},[...qe,...Je]),Qt=function(e,t,n){return t.namespaceURI===Pt?e===`svg`:t.namespaceURI===Mt?e===`svg`&&(n===`annotation-xml`||Bt[n]):!!Xt[e]},$t=function(e,t,n){return t.namespaceURI===Pt?e===`math`:t.namespaceURI===Nt?e===`math`&&Ht[n]:!!Zt[e]},en=function(e,t,n){return t.namespaceURI===Nt&&!Ht[n]||t.namespaceURI===Mt&&!Bt[n]?!1:!Zt[e]&&(Ut[e]||!Xt[e])},tn=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ft,tagName:`template`});let n=Te(e.tagName),r=Te(t.tagName);return Lt[e.namespaceURI]?e.namespaceURI===Nt?Qt(n,t,r):e.namespaceURI===Mt?$t(n,t,r):e.namespaceURI===Pt?en(n,t,r):!!(Wt===`application/xhtml+xml`&&Lt[e.namespaceURI]):!1},nn=function(e){Se(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Ie(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},rn=function(e){sn(e);let t=h(e);if(t){let e=[];ye(t,t=>{Se(e,t)}),ye(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},an=function(e,n){try{Se(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Se(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(J||Le)try{nn(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},on=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||H[X(i)]))try{e.removeAttribute(i)}catch{}}},sn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===mt.element&&on(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},cn=function(e){if(!ve)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===mt.processingInstruction||n===mt.comment&&q(dt,e.data)){try{p(e)}catch{}continue}if(n===mt.element){let t=e,n=X(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},ln=function(e){let t=null,r=null;if(Fe)e=`<remove></remove>`+e;else{let t=De(e,/^[\r\n\t ]+/);r=t&&t[0]}Wt===`application/xhtml+xml`&&Ft===Pt&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?O(e):e;if(Ft===Pt)try{t=new l().parseFromString(i,Wt)}catch{}if(!t||!t.documentElement){t=M.createDocument(Ft,`template`,null);try{t.documentElement.innerHTML=It?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ft===Pt?F.call(t,je?`html`:`body`)[0]:je?t.documentElement:a},un=function(e){let t=x?x(e):e.ownerDocument;return N.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},dn=function(e){return e=Oe(e,R,` `),e=Oe(e,z,` `),e=Oe(e,B,` `),e},fn=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=N.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=dn(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&ye(i,e=>{mn(e.content)&&fn(e.content)})},pn=function(e){let t=b?b(e):null;return typeof t!=`string`||X(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},mn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===mt.documentFragment}catch{return!1}},hn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function gn(e,n,r){e.length!==0&&ye(e,e=>{e.call(t,n,r,Kt)})}let _n=function(e,t){return!!(ve&&e.hasChildNodes()&&!hn(e.firstElementChild)&&q(ut,e.textContent)&&q(ut,e.innerHTML)||ve&&e.namespaceURI===Pt&&t===`style`&&hn(e.firstElementChild)||e.nodeType===mt.processingInstruction||ve&&e.nodeType===mt.comment&&q(dt,e.data))},vn=function(e,t,n){if(!ce[t]&&Cn(t)&&(U.tagNameCheck instanceof RegExp&&q(U.tagNameCheck,t)||U.tagNameCheck instanceof Function&&U.tagNameCheck(t)))return!1;if(Ct&&!Et[t]){let t=g(e),r=h(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,m(e))}}}return nn(e),!0},yn=function(e,t,n,r){return e.length===0?t:t===n||t===r?ze(t):t},bn=function(e,n){if(gn(L.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return wt&&sn(e),!0;if(pn(e))return nn(e),!0;let r=X(b?b(e):e.nodeName);if(V=yn(L.uponSanitizeElement,V,oe,Ne),gn(L.uponSanitizeElement,e,{tagName:r,allowedTags:V}),e!==n&&g(e)===null)return wt&&sn(e),!0;if(_n(e,r))return nn(e),!0;if(ce[r]||!(de.tagCheck instanceof Function&&de.tagCheck(r))&&!V[r]){let t=vn(e,r,n);return t===!1&&gn(L.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===mt.element&&!tn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&q(ft,e.innerHTML))return nn(e),!0;if(_e&&e.nodeType===mt.text){let n=dn(e.textContent);e.textContent!==n&&(Se(t.removed,{element:e.cloneNode()}),e.textContent=n)}return gn(L.afterSanitizeElements,e,null),!1},xn=function(e,t,r){if(le[t]||ve&&t===`patchsrc`||ve&&t===`for`&&e!==`label`&&e!==`output`||bt&&(t===`id`||t===`name`)&&(r in n||r in qt))return!1;let i=H[t]||de.attributeCheck instanceof Function&&de.attributeCheck(t,e);if(!(pe&&q(ee,t))&&!(fe&&q(te,t))){if(!i){if(!(Cn(e)&&(U.tagNameCheck instanceof RegExp&&q(U.tagNameCheck,e)||U.tagNameCheck instanceof Function&&U.tagNameCheck(e))&&(U.attributeNameCheck instanceof RegExp&&q(U.attributeNameCheck,t)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(t,e))||t===`is`&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&q(U.tagNameCheck,r)||U.tagNameCheck instanceof Function&&U.tagNameCheck(r))))return!1}else if(!At[t]&&!q(ae,Oe(r,re,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ke(r,`data:`)===0&&Ot[e])&&!(me&&!q(ne,Oe(r,re,``)))&&r)return!1}return!0},Sn=Y({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Cn=function(e){return!Sn[Te(e)]&&q(ie,e)},wn=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return O(r);case`TrustedScriptURL`:return k(r)}return r},Tn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),pn(e)?nn(e):xe(t.removed)}catch{an(n,e)}},En=function(e){gn(L.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||pn(e))return;H=yn(L.uponSanitizeAttribute,H,se,Pe);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0},r=t.length,i=X(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=X(o),u=c,d=o===`value`?u:Ae(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,gn(L.uponSanitizeAttribute,e,n),d=n.attrValue,xt&&(l===`id`||l===`name`)&&ke(d,St)!==0&&(an(o,e),d=St+d),ve&&q(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){an(o,e);continue}if(l===`attributename`&&De(d,`href`)){an(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){an(o,e);continue}if(!ge&&q(pt,d)){an(o,e);continue}if(_e&&(d=dn(d)),!xn(i,l,d)){an(o,e);continue}d=wn(i,l,s,d),d!==u&&Tn(e,o,s,d)}}gn(L.afterSanitizeAttributes,e,null)},Dn=function(e){let t=null,n=un(e);for(gn(L.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(gn(L.uponSanitizeShadowNode,t,null),bn(t,e),En(t),mn(t.content)&&Dn(t.content),(y?y(t):t.nodeType)===mt.element){let e=_(t);mn(e)&&(On(e),Dn(e))}gn(L.afterSanitizeShadowDOM,e,null)},On=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Dn(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===mt.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&X(e)===`template`){let e=n.content;mn(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);mn(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(It=!e,It&&(e=`<!-->`),typeof e!=`string`&&!hn(e)&&(e=Be(e),typeof e!=`string`))throw Ie(`dirty is not a string, aborting`);if(!t.isSupported)return e;Me?(V=Ne,H=Pe):Yt(n),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(V=ze(V)),L.uponSanitizeAttribute.length>0&&(H=ze(H)),t.removed=[];let c=wt&&typeof e!=`string`&&hn(e);if(c){cn(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=X(t);if(!V[n]||ce[n])throw rn(e),Ie(`root node is forbidden and cannot be sanitized in-place`)}if(pn(e))throw rn(e),Ie(`root node is clobbered and cannot be sanitized in-place`);try{On(e)}catch(t){throw rn(e),t}}else if(hn(e))i=ln(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===mt.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),On(a);else{if(!J&&!_e&&!je&&e.indexOf(`<`)===-1)return S&&Re?O(e):e;if(i=ln(e),!i)return J?null:Re?C:``}i&&Fe&&nn(i.firstChild);let l=c?e:i;try{let e=un(l);for(;o=e.nextNode();)bn(o,l),En(o),mn(o.content)&&Dn(o.content)}catch(n){throw c&&(rn(e),ye(t.removed,e=>{e.element&&sn(e.element)})),n}if(c)return ye(t.removed,e=>{e.element&&sn(e.element)}),_e&&fn(e),e;if(J){if(_e&&fn(i),Le)for(s=P.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(H.shadowroot||H.shadowrootmode)&&(s=I.call(r,s,!0)),s}let u=je?i.outerHTML:i.innerHTML;return je&&V[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&q(ct,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
4
4
|
`+u),_e&&(u=dn(u)),S&&Re?O(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yt(e),Me=!0,Ne=V,Pe=H},t.clearConfig=function(){Kt=null,Me=!1,Ne=null,Pe=null,S=w,C=``},t.isValidAttribute=function(e,t,n){Kt||Yt({});let r=X(e),i=X(t);return xn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&K(L,e)&&Se(L[e],t)},t.removeHook=function(e,t){if(K(L,e)){if(t!==void 0){let n=be(L[e],t);return n===-1?void 0:Ce(L[e],n,1)[0]}return xe(L[e])}},t.removeHooks=function(e){K(L,e)&&(L[e]=[])},t.removeAllHooks=function(){L=_t()},t}var bt=yt(),xt=r(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=new RegExp(y(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],(e[0]===`(`||/^\(\?[<']/.test(e[0]))&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),z=I(`#`,`$`),B=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function ee(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function te(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ne(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=ee,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function re(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function ie(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function ae(e,t){e.relevance===void 0&&(e.relevance=1)}var V=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},oe=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],H=`keyword`;function se(e,t,n=H){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,se(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,U(n[0],n[1])]})}}function U(e,t){return t?Number(t):+!ce(e)}function ce(e){return oe.includes(e.toLowerCase())}var le={},ue=e=>{console.error(e)},de=(e,...t)=>{console.log(`WARN: ${e}`,...t)},fe=(e,t)=>{le[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),le[`${e}/${t}`]=!0)},pe=Error();function me(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function W(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw ue(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),pe;if(typeof e.beginScope!=`object`||e.beginScope===null)throw ue(`beginScope must be object`),pe;me(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function G(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw ue(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),pe;if(typeof e.endScope!=`object`||e.endScope===null)throw ue(`endScope must be object`),pe;me(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function he(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function ge(e){he(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),W(e),G(e)}function _e(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[te,ie,ge,V].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ne,re,ae].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=se(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return ye(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function ve(e){return e?e.endsWithParent||ve(e.starts):!1}function ye(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:ve(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var be=`11.12.0`,xe=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},Se=i,Ce=a,we=Symbol(`nomatch`),Te=7,Ee=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(de(s.replace(`{}`,n[1])),de(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(fe(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),fe(`10.7.0`,`Please use highlight(code, options) instead.
|
|
5
5
|
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Te&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return we;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}if(r.type===`end`){let e=C(r);if(e!==we)return e}if(r.type===`illegal`&&a===``)return r.index===n.length||(P+=`
|
|
@@ -30,9 +30,9 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
30
30
|
`;return n?e:Ml(jl(e,t,a),t)}).join(``)}var Pl=new Set([`md`,`markdown`,`mdown`,`mkd`]);function Fl(e){let t=e.match(/^( {0,3})(`{3,}|~{3,})(.*)$/);if(!t)return null;let[,n,r,i=``]=t,a=r[0],o=i.trim();return a==="`"&&o.includes("`")?null:{indent:n,marker:a,fence:r,length:r.length,info:o}}function Il(e,t=e.length,n=e.info){return`${e.indent}${e.marker.repeat(t)}${n?` ${n}`:``}`}function Ll(e){let t=e.info.split(/\s+/)[0]?.toLowerCase();return Pl.has(t)}function Rl(e,t){let n=Fl(e);return!!(n&&n.marker===t.marker&&n.length>=t.length&&n.info===``)}function zl(e,t=e.length-1){let n=t;for(;n>=0&&e[n].trim()===``;)--n;return n}function Bl(e,t,n){for(let r=zl(e);r>n;--r)if(Rl(e[r],t))return r;return-1}function Vl(e,t){let n=[],r=!1;for(let i of e){let e=Fl(i);if(!e||e.marker!==t)continue;r=!0;let a=n[n.length-1];if(e.info===``&&a&&e.length>=a.length){n.pop();continue}n.push({marker:e.marker,length:e.length})}return r&&n.length===0}function Hl(e,t,n){let r=[];for(let i=n;i<e.length;i+=1){let n=Fl(e[i]);n&&n.marker===t.marker&&n.info===``&&n.length>=t.length&&r.push(i)}for(let i=r.length-1;i>=0;--i){let a=r[i];if(Vl(e.slice(n,a),t.marker))return a}return r[0]??-1}function Ul(e,t){let n=0;for(let r of e){let e=Fl(r);e?.marker===t&&(n=Math.max(n,e.length))}return n}function Wl(e){let t=[];for(let n=0;n<e.length;n+=1){let r=Fl(e[n]);if(!r||!Ll(r)){t.push(e[n]);continue}let i=Hl(e,r,n+1);if(i===-1){t.push(e[n]);continue}let a=e.slice(n+1,i),o=Ul(a,r.marker);if(o>=r.length){let e=o+1;t.push(Il(r,e)),t.push(...a),t.push(Il(r,e,``))}else t.push(e[n]),t.push(...a),t.push(e[i]);n=i}return t}function Gl(e){if(!e.includes("```")&&!e.includes(`~~~`))return e;let t=e.split(`
|
|
31
31
|
`),n=[],r=!1;for(let e=0;e<t.length;e+=1){let i=Fl(t[e]);if(!i||!Ll(i)){n.push(t[e]);continue}let a=Bl(t,i,e+1);if(a===-1){n.push(t[e]);continue}if(a!==zl(t)){n.push(t[e]);continue}n.push(...Wl(t.slice(e+1,a))),n.push(...t.slice(a+1)),r=!0;break}return r?n.join(`
|
|
32
32
|
`):e}function Kl(e){let t=``,n=0;for(let r of e.split(`
|
|
33
|
-
`)){let e=Fl(r);e&&(t?e.marker===t&&e.info===``&&e.length>=n&&(t=``):(t=e.marker,n=e.length))}return t?`${e}\n${t.repeat(n)}`:e}function ql(e,t=!1){let n=Gl(e);return t?n:Kl(n)}var Jl={key:0,class:`plain-text`},Yl=[`innerHTML`],Xl={key:1,class:`plain-text`},Zl=[`innerHTML`],Ql=D(A({__name:`MarkdownContent`,props:{content:{},streaming:{type:Boolean,default:!1},streamIntervalMs:{default:80},legacyMedia:{type:Boolean,default:!1},plain:{type:Boolean,default:!1},mentionNames:{},fileCards:{type:Boolean,default:!1},processContent:{type:Boolean,default:!1},outlinePrefix:{default:``},fileProfile:{},separateMedia:{type:Boolean},bubble:{type:Boolean},attachments:{},contentParts:{}},emits:[`fileLink`,`preview`,`rendered`],setup(e,{emit:t}){let n=e,r=t,d=_(null),f=_(``),m=_(n.content),v;function x(){v!==void 0&&clearTimeout(v),v=void 0}s(()=>[n.content,n.streaming,n.plain],([e,t,r])=>{!t||r||n.streamIntervalMs===0||!e.startsWith(m.value)||!m.value?(x(),m.value=e):v===void 0&&(v=setTimeout(()=>{v=void 0,m.value=n.content},n.streamIntervalMs))}),i(x);let S=new Map,C=0;function E(e,t){let n=`${t}\0${e}`,r=S.get(n);if(r!==void 0)return r;let i=t&&$i.getLanguage(t)?$i.highlight(e,{language:t,ignoreIllegals:!0}).value:D(e);if(n.length+i.length<=256e3)for(S.set(n,i),C+=n.length+i.length;S.size>32||C>512e3;){let e=S.keys().next().value;C-=e.length+S.get(e).length,S.delete(e)}return i}function D(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}let O=new ol({html:!1,breaks:!0,linkify:!0,typographer:!1,highlight(e,t){let n=t.trim().split(/\s+/)[0]?.toLowerCase()||``,r=E(e,n),i=n||`text`;return`<pre class="code-block"><div class="code-header"><span class="code-lang">${D(i)}</span><button type="button" class="code-copy" aria-label="复制代码">复制</button></div><code class="hljs language-${D(i)}">${r}</code></pre>`}});O.disable(`smartquotes`);let k=O.validateLink;O.validateLink=e=>!!R(e)||k(e);let A=O.renderer.rules.image;O.renderer.rules.image=(e,t,r,i,a)=>{if(n.processContent)return D(e[t].content||e[t].attrGet(`src`)||`图片`);let o=e[t].attrGet(`src`)||``,s=R(o,n.fileProfile);return s&&e[t].attrSet(`src`,s),A(e,t,r,i,a)};let j=O.renderer.rules.link_open??((e,t,n,r,i)=>i.renderToken(e,t,n));O.renderer.rules.link_open=(e,t,r,i,a)=>{let o=e[t],s=o.attrGet(`href`)||``,c=!n.processContent&&n.fileCards?R(s,n.fileProfile):void 0;return c&&/\.[^/]+$/.test(P(s)??``)&&o.attrSet(`href`,c),o.attrSet(`target`,`_blank`),o.attrSet(`rel`,`noopener noreferrer`),j(e,t,r,i,a)};let N=T(()=>{let e=n.legacyMedia?Nl(m.value||``,n.streaming):m.value||``;return e=ql(e,n.streaming),e});function I(e){let t=n.mentionNames;if(!t?.length)return e;let r=[...new Set(t.filter(Boolean))].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`));if(!r.length)return e;let i=RegExp(`(?<![\\w])@(?:${r.join(`|`)})(?=$|[\\s.,!?;:,。!?;:)\\]}>])`,`gi`);return e.replace(i,e=>`<span class="mention-highlight">${e}</span>`)}let L={USE_PROFILES:{html:!0},FORBID_TAGS:[`style`,`svg`,`math`,`form`,`input`,`iframe`,`object`,`embed`],FORBID_ATTR:[`style`,`onerror`,`onclick`,`onload`],ALLOW_UNKNOWN_PROTOCOLS:!1,ADD_ATTR:[`target`]},z=bt(window);z.setConfig(L);function B(e){return z.sanitize(I(e))}let ee=T(()=>{if(n.plain||n.separateMedia)return[];let e={},t=O.parse(N.value,e),r=[],i=0,a=0;for(let n=0;n<t.length;n++)a+=t[n].nesting,a===0&&(r.push(B(O.renderer.render(t.slice(i,n+1),O.options,e))),i=n+1);return r});function te(e){try{let t=new URL(e,window.location.href);return t.pathname=t.pathname.replace(/(\/api\/app\/files\/[^/]+)\/(?:preview|download)$/,`$1`),t.searchParams.delete(`_retry`),t.searchParams.sort(),t.href}catch{return e}}let ne=T(()=>{if(!n.separateMedia)return[];let e=[],t=new Set,r=n.attachments??[];function i(n){t.add(n.id),e.push({attachment:n})}function a(t){if(!t.replace(/<[^>]+>/g,``).trim()&&!/<(?:img|hr|pre|table)\b/.test(t))return;let n=e.at(-1);n&&`html`in n&&!n.text?n.html+=t:e.push({html:t})}function o(t){if(n.plain){t.trim()&&e.push({html:``,text:t});return}let o=document.createElement(`template`);o.innerHTML=B(O.render(t));for(let e of[...o.content.children]){if(e.tagName!==`P`){a(e.outerHTML);continue}let t=``;for(let n of[...e.childNodes]){let e=n instanceof HTMLElement?n:void 0,o=e?.tagName===`IMG`?e:void 0,s=e?.tagName===`A`?e:void 0,c;if(s&&ie(s))try{c=ae(new URL(s.href,window.location.href))}catch{}if(o||c){a(`<p>${t}</p>`),t=``;let e=o?.getAttribute(`src`)||s.getAttribute(`href`),n=r.find(t=>t.url&&te(t.url)===te(e)),l=n?.name||(o?o.alt||`图片`:V(s,c));i(n??{id:e,url:e,name:l,kind:o?`image`:`file`})}else t+=e?e.outerHTML:D(n.textContent||``)}a(`<p>${t}</p>`)}}if(n.contentParts?.length)for(let e of n.contentParts)if(`text`in e)o(n.legacyMedia?Nl(e.text,n.streaming):e.text);else{let t=r.find(t=>t.id===e.attachmentId);t&&i(t)}else o(N.value);for(let e of r)t.has(e.id)||i(e);return e});s([ee,ne],async()=>{await a(),r(`rendered`)},{flush:`post`});function re(){d.value&&d.value.querySelectorAll(`pre .code-copy`).forEach((e,t)=>{e.dataset.bound||(e.dataset.bound=`true`,e.addEventListener(`click`,async()=>{let n=e.closest(`pre`)?.querySelector(`code`)?.textContent??``,r=`${t}:${n.length}`;f.value=r;let i=await yl(n);e.textContent=i?`已复制`:`复制失败`,e.setAttribute(`aria-label`,i?`代码已复制`:`复制代码失败`),window.setTimeout(()=>{f.value!==r||!e.isConnected||(f.value=``,e.textContent=`复制`,e.setAttribute(`aria-label`,`复制代码`))},1400)}))})}function ie(e){if(e.closest(`blockquote, table, h1, h2, h3, h4, h5, h6, pre, code, strong, em, del`))return!1;let t=e.parentElement;if(!t||t.tagName!==`P`&&t.tagName!==`LI`)return!1;for(let t=e.previousSibling;t&&t.nodeName!==`BR`;t=t.previousSibling)if(t.nodeType!==Node.TEXT_NODE||t.textContent?.trim())return!1;for(let t=e.nextSibling;t&&t.nodeName!==`BR`;t=t.nextSibling)if(t.nodeType!==Node.TEXT_NODE||t.textContent?.trim())return!1;return!0}function ae(e){if(e.origin!==window.location.origin)return;if(/^\/api\/app\/files\/[^/]+\/(?:download|preview)$/i.test(e.pathname))return{remote:!0};if(e.pathname!==`/api/files/download`)return;let t=P(e.searchParams.get(`path`)||``);if(!(!t||!M(t)))return{path:t,remote:!1}}function V(e,t){return t.path?.split(`/`).at(-1)||e.textContent?.trim()||`文件`}function oe(){n.processContent||!n.fileCards||!d.value||d.value.querySelectorAll(`a`).forEach(e=>{if(e.dataset.fileCard)return;let t;try{t=new URL(e.href,window.location.href)}catch{return}let n=ae(t);if(!n||!ie(e))return;e.dataset.fileCard=`true`,e.classList.add(`file-link-card`),e.removeAttribute(`target`),e.removeAttribute(`rel`);let i=V(e,n);e.textContent=i,e.setAttribute(`aria-label`,`预览文件 ${i}`),e.addEventListener(`click`,e=>{e.preventDefault(),r(`fileLink`,i,`${t.pathname}${t.search}`)})})}function H(){n.processContent||!n.fileCards||!d.value||d.value.querySelectorAll(`img`).forEach(e=>{if(e.dataset.mediaPreview||e.closest(`.message-media`))return;let t;try{t=new URL(e.currentSrc||e.src,window.location.href)}catch{return}if(t.origin!==window.location.origin)return;e.dataset.mediaPreview=`true`;let n=(t.searchParams.get(`path`)||decodeURIComponent(t.pathname)).split(`/`).at(-1)||`图片`;e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-label`,`预览图片 ${n}`);let i=e=>{e.preventDefault(),e.stopPropagation(),r(`fileLink`,n,`${t.pathname}${t.search}`)};e.addEventListener(`click`,i),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&i(e)});let a,o=async()=>{if(!e.isConnected||a)return;a=document.createElement(`span`),a.className=`media-load-error`,a.setAttribute(`role`,`alert`);let r=document.createElement(`span`);r.textContent=`${n}:图片加载失败。`;let i=document.createElement(`button`);if(i.type=`button`,i.textContent=`重试`,i.addEventListener(`click`,()=>{a?.remove(),a=void 0,e.hidden=!1;let n=new URL(t);n.searchParams.set(`_retry`,String(Date.now())),e.src=n.toString()}),a.append(r,i),e.after(a),e.hidden=!0,t.pathname===`/api/files/download`)try{let e=await fetch(t,{credentials:`same-origin`});if(e.ok)await e.body?.cancel(),r.textContent=`${n}:文件内容不是可解码的图片。`;else{let t=await e.json().catch(()=>({})),i=t.error?.message||(typeof t.error==`string`?t.error:void 0)||t.message||t.detail;r.textContent=`${n}:${typeof i==`string`?i:e.status===404?`服务器文件不存在或已被移动。`:e.status===403?`此目录未获授权,请检查设置中的文件访问权限。`:`服务器暂时无法读取此文件。`}`}}catch{r.textContent=`${n}:连接失败,请重试。`}};e.addEventListener(`error`,()=>{o()}),e.addEventListener(`load`,()=>{e.hidden=!1,a?.remove(),a=void 0}),e.complete&&e.naturalWidth===0&&o()})}function se(){!n.outlinePrefix||!d.value||d.value.querySelectorAll(`h1, h2, h3`).forEach((e,t)=>{e.id=`${n.outlinePrefix}-heading-${t+1}`})}function U(e){let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`)||``;/^(javascript|data|vbscript):/i.test(n)&&e.preventDefault()}return l(()=>{re(),oe(),H(),se()}),u(()=>{re(),oe(),H(),se()}),(t,n)=>(o(),p(g,null,[e.separateMedia?(o(),p(`div`,{key:0,ref_key:`root`,ref:d,class:w([`markdown message-parts`,{"message-parts--streaming":e.streaming}]),onClick:U},[(o(!0),p(g,null,c(ne.value,(t,i)=>(o(),p(g,{key:i},[`attachment`in t?(o(),b(_l,{key:0,attachment:t.attachment,onOpen:n[0]||=e=>r(`preview`,e),onRendered:n[1]||=e=>r(`rendered`)},null,8,[`attachment`])):(o(),p(`div`,{key:1,class:w([`message-prose`,{"chat-bubble":e.bubble}])},[t.text===void 0?(o(),p(`div`,{key:1,class:`markdown-block`,innerHTML:t.html},null,8,Yl)):(o(),p(`div`,Jl,h(t.text),1))],2))],64))),128))],2)):e.plain?(o(),p(`div`,Xl,h(e.content),1)):(o(),p(`div`,{key:2,ref_key:`root`,ref:d,class:w([`markdown`,{"markdown--streaming":e.streaming}]),onClick:U},[(o(!0),p(g,null,c(ee.value,(e,t)=>(o(),p(`div`,{key:t,class:`markdown-block`,innerHTML:e},null,8,Zl))),128))],2)),e.streaming?(o(),b(F,{key:3,class:`stream-caret`,name:`arrow-up`,size:0})):y(``,!0)],64))}}),[[`__scopeId`,`data-v-c17774dc`]]),$l={class:`preview-inspector`},eu=[`title`],tu={class:`preview-header-actions`},nu=[`href`],ru=[`src`,`alt`],iu=[`src`],au=[`src`],ou={key:5,class:`preview-sheet`},su={key:6,class:`preview-text`},cu={key:0},lu=[`href`],uu={key:8,class:`preview-unavailable`},du=D(A({__name:`PreviewInspector`,props:{item:{},showClose:{type:Boolean,default:!1},canAddToComposer:{type:Boolean,default:!0}},emits:[`close`,`addToComposer`,`source`],setup(e,{emit:t}){let n=e,r=t,l=T(()=>!!n.item.previewUrl),u=T(()=>[`text`,`code`].includes(n.item.kind)),d=T(()=>n.item.previewUrl||n.item.downloadUrl||``),f=_(null),m=_(null),v=_([]),x=_(``),C=_(!1),E=_(!1),D=_(``),O=T(()=>n.item.name.split(`.`).at(-1)?.toLocaleLowerCase()||``),k=T(()=>O.value===`docx`||/wordprocessingml/.test(n.item.mimeType||``)),A=T(()=>[`xlsx`,`xls`].includes(O.value)||/spreadsheetml|excel/.test(n.item.mimeType||``)),M=T(()=>n.item.kind===`pdf`||O.value===`pdf`||n.item.mimeType===`application/pdf`),N=0,P,I=new URL(`/assets/pdf.worker.min-iDqQPrd3.mjs`,``+import.meta.url).href;function L(){let e=f.value;if(!e)return;e.style.setProperty(`--docx-preview-scale`,`1`);let t=[...e.querySelectorAll(`section.docx`)],n=Math.max(0,...t.map(e=>e.getBoundingClientRect().width));if(!n)return;let r=Math.max(1,e.clientWidth),i=Math.min(1,Math.max(.1,r/n));e.style.setProperty(`--docx-preview-scale`,i.toFixed(4))}function R(){P?.disconnect(),!(!f.value||typeof ResizeObserver>`u`)&&(P=new ResizeObserver(L),P.observe(f.value))}async function z(){let e=++N;if(P?.disconnect(),P=void 0,f.value?.style.removeProperty(`--docx-preview-scale`),v.value=[],x.value=n.item.textContent||``,C.value=n.item.textContent!==void 0,D.value=``,d.value&&!(!k.value&&!A.value&&!u.value&&!M.value)){E.value=!0;try{let t=await fetch(d.value,{credentials:`same-origin`});if(!t.ok)throw Error(`预览读取失败(${t.status})`);let n=await t.blob();if(e!==N)return;if(M.value){let t=await B(()=>import(`./pdf-DVDddcFC.js`),__vite__mapDeps([0,1,2,3]));if(t.GlobalWorkerOptions.workerSrc=I,await a(),!m.value)return;m.value.replaceChildren();let r=await t.getDocument({data:await n.arrayBuffer()}).promise;for(let t=1;t<=Math.min(r.numPages,24);t+=1){if(e!==N||!m.value)return;let n=await r.getPage(t),i=n.getViewport({scale:1}),a=Math.min(1.45,Math.max(.55,(m.value.clientWidth-24)/i.width)),o=n.getViewport({scale:a}),s=Math.min(2,window.devicePixelRatio||1),c=document.createElement(`div`);c.className=`pdf-page`;let l=document.createElement(`canvas`);l.width=Math.floor(o.width*s),l.height=Math.floor(o.height*s),l.style.width=`${o.width}px`,l.style.height=`${o.height}px`,c.appendChild(l),m.value.appendChild(c);let u=l.getContext(`2d`);u&&await n.render({canvas:l,canvasContext:u,viewport:o,transform:s===1?void 0:[s,0,0,s,0,0]}).promise}}else if(k.value){let{renderAsync:e}=await B(async()=>{let{renderAsync:e}=await import(`./docx-preview-B1SjJgD_.js`);return{renderAsync:e}},__vite__mapDeps([4,5,2,1,3,6,7,8]));if(await a(),!f.value)return;f.value.replaceChildren(),await e(n,f.value,void 0,{inWrapper:!0,breakPages:!0,ignoreWidth:!1,ignoreHeight:!1}),L(),R()}else if(A.value){let{default:e}=await B(async()=>{let{default:e}=await import(`./browser-B97PQaMt.js`);return{default:e}},[]);v.value=await e(n)}else u.value&&(C.value||(x.value=await n.text()),C.value=!0)}catch(e){D.value=e instanceof Error?e.message:`无法生成预览`}finally{E.value=!1}}}return s(()=>n.item.id,z,{immediate:!0,flush:`post`}),i(()=>P?.disconnect()),(t,n)=>(o(),p(`div`,$l,[S(`header`,null,[S(`strong`,{title:e.item.name},h(e.item.title||e.item.name),9,eu),S(`div`,tu,[e.item.sourceSessionId?(o(),p(`button`,{key:0,class:`icon-button`,type:`button`,"aria-label":`跳转到来源消息`,title:`跳转到来源消息`,onClick:n[0]||=t=>r(`source`,e.item)},[j(F,{name:`external`,size:15})])):y(``,!0),e.item.downloadUrl||e.item.previewUrl?(o(),p(`a`,{key:1,class:`icon-button`,href:e.item.downloadUrl||e.item.previewUrl,download:``,"aria-label":`下载`,title:`下载`},[j(F,{name:`download`,size:16})],8,nu)):y(``,!0),e.canAddToComposer?(o(),p(`button`,{key:2,class:`icon-button`,type:`button`,"aria-label":`加入输入框`,title:`加入输入框`,onClick:n[1]||=t=>r(`addToComposer`,e.item)},[j(F,{name:`plus`,size:17})])):y(``,!0),e.showClose?(o(),p(`button`,{key:3,class:`icon-button preview-close`,type:`button`,"aria-label":`关闭预览`,title:`关闭预览`,onClick:n[2]||=e=>r(`close`)},[j(F,{name:`close`,size:17})])):y(``,!0)])]),S(`div`,{class:w([`preview-stage`,`preview-stage--${e.item.kind}`])},[e.item.kind===`image`&&l.value?(o(),p(`img`,{key:0,src:e.item.previewUrl,alt:e.item.name},null,8,ru)):e.item.kind===`video`&&l.value?(o(),p(`video`,{key:1,src:e.item.previewUrl,controls:``,playsinline:``},null,8,iu)):e.item.kind===`audio`&&l.value?(o(),p(`audio`,{key:2,src:e.item.previewUrl,controls:``},null,8,au)):M.value&&l.value?(o(),p(`div`,{key:3,ref_key:`pdfRoot`,ref:m,class:`preview-pdf`},null,512)):k.value?(o(),p(`div`,{key:4,ref_key:`officeRoot`,ref:f,class:`preview-office`},null,512)):A.value&&v.value.length?(o(),p(`div`,ou,[S(`table`,null,[S(`tbody`,null,[(o(!0),p(g,null,c(v.value.slice(0,200),(e,t)=>(o(),p(`tr`,{key:t},[(o(!0),p(g,null,c(e.slice(0,50),(e,t)=>(o(),p(`td`,{key:t},h(e),1))),128))]))),128))])])])):u.value&&C.value?(o(),p(`div`,su,[e.item.kind===`code`?(o(),p(`pre`,cu,h(x.value),1)):(o(),b(Ql,{key:1,content:x.value},null,8,[`content`]))])):e.item.kind===`link`&&(e.item.previewUrl||e.item.downloadUrl)?(o(),p(`a`,{key:7,class:`preview-link`,href:e.item.previewUrl||e.item.downloadUrl,target:`_blank`,rel:`noopener noreferrer`},[S(`span`,null,[j(F,{name:`link`,size:27})]),S(`strong`,null,h(e.item.title||e.item.name),1),n[3]||=S(`small`,null,`在新窗口中打开`,-1)],8,lu)):(o(),p(`div`,uu,[S(`span`,null,[j(F,{name:D.value?`alert`:`file`,size:28},null,8,[`name`])]),S(`strong`,null,h(E.value?`正在生成预览…`:D.value||`此格式暂不支持内嵌预览`),1),S(`p`,null,h(D.value?`仍可下载文件后使用系统应用查看。`:`可下载文件,使用系统应用查看。`),1)]))],2)]))}}),[[`__scopeId`,`data-v-da7e4daa`]]),fu=[`aria-label`],pu=D(A({__name:`PreviewModal`,props:{item:{},items:{default:()=>[]},canAddToComposer:{type:Boolean,default:!0}},emits:[`close`,`addToComposer`,`source`],setup(e,{emit:t}){let n=e,r=t,a=T(()=>{let e=n.items.filter(e=>e.kind===`image`||e.kind===`video`);return e.some(e=>e.id===n.item.id||e.previewUrl===n.item.previewUrl)?e:[n.item]}),c=_(0),u=T(()=>a.value[c.value]??n.item),m=T(()=>c.value>0),h=T(()=>c.value<a.value.length-1),g;function x(){let e=a.value.findIndex(e=>e.id===n.item.id||e.previewUrl===n.item.previewUrl);c.value=e>=0?e:0}function w(){m.value&&--c.value}function E(){h.value&&(c.value+=1)}function D(e){(e.button===0||e.pointerType!==`mouse`)&&(e.target.closest(`button, a, audio`)||(g=e.clientX))}function k(e){if(g===void 0)return;let t=e.clientX-g;g=void 0,!(Math.abs(t)<48)&&(t<0?E():w())}function A(e){e.key===`Escape`?(e.preventDefault(),r(`close`)):e.key===`ArrowLeft`?(e.preventDefault(),w()):e.key===`ArrowRight`&&(e.preventDefault(),E())}return s([()=>n.item.id,a],x,{immediate:!0}),l(()=>window.addEventListener(`keydown`,A)),i(()=>window.removeEventListener(`keydown`,A)),(t,n)=>(o(),b(v,{to:`body`},[j(C,{name:`preview-modal`},{default:d(()=>[S(`div`,{class:`preview-modal-layer`,onMousedown:n[4]||=O(e=>r(`close`),[`self`])},[S(`section`,{class:`preview-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`预览 ${u.value.title||u.value.name}`,onPointerdown:D,onPointerup:k,onPointercancel:n[3]||=e=>f(g)?g.value=void 0:g=void 0},[j(du,{item:u.value,"show-close":``,"can-add-to-composer":e.canAddToComposer,onClose:n[0]||=e=>r(`close`),onAddToComposer:n[1]||=e=>r(`addToComposer`,e),onSource:n[2]||=e=>r(`source`,e)},null,8,[`item`,`can-add-to-composer`]),m.value?(o(),p(`button`,{key:0,class:`media-nav media-nav--previous`,type:`button`,"aria-label":`上一张媒体`,title:`上一张媒体`,onClick:w},[j(F,{name:`chevron-left`,size:22})])):y(``,!0),h.value?(o(),p(`button`,{key:1,class:`media-nav media-nav--next`,type:`button`,"aria-label":`下一张媒体`,title:`下一张媒体`,onClick:E},[j(F,{class:`media-nav__next-icon`,name:`chevron-left`,size:22})])):y(``,!0)],40,fu)],32)]),_:1})]))}}),[[`__scopeId`,`data-v-b797b8fc`]]),mu=[`aria-label`],hu={class:`image-preview-actions`},gu=[`href`,`aria-label`,`title`],_u=[`aria-label`,`title`],vu=[`aria-label`,`title`],yu=[`aria-label`],bu=[`src`,`aria-label`],xu=[`src`,`alt`],Su=[`aria-label`],Cu={key:2,class:`image-preview-counter`},wu=D(A({__name:`ImagePreviewLightbox`,props:{images:{},modelValue:{},closeLabel:{},addLabel:{},canAdd:{type:Boolean,default:!0},previousLabel:{},nextLabel:{}},emits:[`update:modelValue`,`close`,`add`],setup(e,{emit:n}){let r=e,a=n,s=_(null),c=T(()=>r.modelValue===null?null:r.images[r.modelValue]||null),u=T(()=>(r.modelValue??0)>0),f=T(()=>r.modelValue!==null&&r.modelValue<r.images.length-1);function g(){s.value=null,a(`update:modelValue`,null),a(`close`)}function x(e){if(r.modelValue===null)return;let t=r.modelValue+e;t>=0&&t<r.images.length&&a(`update:modelValue`,t)}function w(e){r.modelValue!==null&&(e.key===`Escape`?(e.preventDefault(),g()):e.key===`ArrowLeft`?(e.preventDefault(),x(-1)):e.key===`ArrowRight`&&(e.preventDefault(),x(1)))}function E(e){e.isPrimary&&(s.value={pointerId:e.pointerId,x:e.clientX})}function D(e){let t=s.value;s.value=null,!(!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)<48)&&x(e.clientX<t.x?1:-1)}return l(()=>window.addEventListener(`keydown`,w)),i(()=>window.removeEventListener(`keydown`,w)),(n,r)=>(o(),b(v,{to:`body`},[c.value?(o(),p(`div`,{key:0,class:`image-preview-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`预览 ${c.value.name}`,onClick:O(g,[`self`]),onPointerdown:E,onPointerup:D,onPointercancel:r[7]||=e=>s.value=null},[S(`div`,hu,[S(`a`,{href:c.value.url,download:``,"aria-label":`下载 ${c.value.name}`,title:`下载 ${c.value.name}`},[j(m(V),{"aria-hidden":`true`})],8,gu),e.canAdd?(o(),p(`button`,{key:0,type:`button`,"aria-label":e.addLabel||`添加到聊天`,title:e.addLabel||`添加到聊天`,onClick:r[0]||=O(e=>a(`add`,c.value),[`stop`])},[j(m(t),{"aria-hidden":`true`})],8,_u)):y(``,!0),S(`button`,{type:`button`,"aria-label":e.closeLabel||`关闭预览`,title:e.closeLabel||`关闭预览`,onClick:g},[j(m(ie),{"aria-hidden":`true`})],8,vu)]),u.value?(o(),p(`button`,{key:0,class:`image-preview-nav image-preview-nav--previous`,type:`button`,"aria-label":e.previousLabel||`上一张媒体`,onClick:r[1]||=O(e=>x(-1),[`stop`])},[j(m(ne),{"aria-hidden":`true`})],8,yu)):y(``,!0),j(C,{name:`image-preview-change`,mode:`out-in`},{default:d(()=>[c.value.type===`video`?(o(),p(`video`,{key:c.value.url,src:c.value.url,"aria-label":c.value.name,class:`image-preview-video`,controls:``,playsinline:``,preload:`metadata`,onClick:r[2]||=O(()=>{},[`stop`]),onPointerdown:r[3]||=O(()=>{},[`stop`]),onPointerup:r[4]||=O(()=>{},[`stop`])},null,40,bu)):(o(),p(`img`,{key:c.value.url,src:c.value.url,alt:c.value.name,class:`image-preview-img`,draggable:`false`,onClick:r[5]||=O(()=>{},[`stop`])},null,8,xu))]),_:1}),f.value?(o(),p(`button`,{key:1,class:`image-preview-nav image-preview-nav--next`,type:`button`,"aria-label":e.nextLabel||`下一张媒体`,onClick:r[6]||=O(e=>x(1),[`stop`])},[j(m(ee),{"aria-hidden":`true`})],8,Su)):y(``,!0),e.images.length>1?(o(),p(`span`,Cu,h((e.modelValue||0)+1)+` / `+h(e.images.length),1)):y(``,!0)],40,mu)):y(``,!0)]))}}),[[`__scopeId`,`data-v-c250743b`]]);function Tu(e){return e.replace(/<(think|thinking|reasoning)>[\s\S]*?<\/\1>/gi,``).replace(/<(?:think|thinking|reasoning)>[\s\S]*$/gi,``)}function Eu(e,t=``){let n=[...e.matchAll(/<(think|thinking|reasoning)>([\s\S]*?)(?:<\/\1>|$)/gi)].map(e=>e[2].trim()).filter(Boolean);return[...new Set([t.trim(),...n].filter(Boolean))].join(`
|
|
33
|
+
`)){let e=Fl(r);e&&(t?e.marker===t&&e.info===``&&e.length>=n&&(t=``):(t=e.marker,n=e.length))}return t?`${e}\n${t.repeat(n)}`:e}function ql(e,t=!1){let n=Gl(e);return t?n:Kl(n)}var Jl={key:0,class:`plain-text`},Yl=[`innerHTML`],Xl={key:1,class:`plain-text`},Zl=[`innerHTML`],Ql=D(A({__name:`MarkdownContent`,props:{content:{},streaming:{type:Boolean,default:!1},streamIntervalMs:{default:80},legacyMedia:{type:Boolean,default:!1},plain:{type:Boolean,default:!1},mentionNames:{},fileCards:{type:Boolean,default:!1},processContent:{type:Boolean,default:!1},outlinePrefix:{default:``},fileProfile:{},separateMedia:{type:Boolean},bubble:{type:Boolean},attachments:{},contentParts:{}},emits:[`fileLink`,`preview`,`rendered`],setup(e,{emit:t}){let n=e,r=t,d=_(null),f=_(``),m=_(n.content),v;function x(){v!==void 0&&clearTimeout(v),v=void 0}s(()=>[n.content,n.streaming,n.plain],([e,t,r])=>{!t||r||n.streamIntervalMs===0||!e.startsWith(m.value)||!m.value?(x(),m.value=e):v===void 0&&(v=setTimeout(()=>{v=void 0,m.value=n.content},n.streamIntervalMs))}),i(x);let S=new Map,C=0;function E(e,t){let n=`${t}\0${e}`,r=S.get(n);if(r!==void 0)return r;let i=t&&$i.getLanguage(t)?$i.highlight(e,{language:t,ignoreIllegals:!0}).value:D(e);if(n.length+i.length<=256e3)for(S.set(n,i),C+=n.length+i.length;S.size>32||C>512e3;){let e=S.keys().next().value;C-=e.length+S.get(e).length,S.delete(e)}return i}function D(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}let O=new ol({html:!1,breaks:!0,linkify:!0,typographer:!1,highlight(e,t){let n=t.trim().split(/\s+/)[0]?.toLowerCase()||``,r=E(e,n),i=n||`text`;return`<pre class="code-block"><div class="code-header"><span class="code-lang">${D(i)}</span><button type="button" class="code-copy" aria-label="复制代码">复制</button></div><code class="hljs language-${D(i)}">${r}</code></pre>`}});O.disable(`smartquotes`);let k=O.validateLink;O.validateLink=e=>!!R(e)||k(e);let A=O.renderer.rules.image;O.renderer.rules.image=(e,t,r,i,a)=>{if(n.processContent)return D(e[t].content||e[t].attrGet(`src`)||`图片`);let o=e[t].attrGet(`src`)||``,s=R(o,n.fileProfile);return s&&e[t].attrSet(`src`,s),A(e,t,r,i,a)};let j=O.renderer.rules.link_open??((e,t,n,r,i)=>i.renderToken(e,t,n));O.renderer.rules.link_open=(e,t,r,i,a)=>{let o=e[t],s=o.attrGet(`href`)||``,c=!n.processContent&&n.fileCards?R(s,n.fileProfile):void 0;return c&&/\.[^/]+$/.test(P(s)??``)&&o.attrSet(`href`,c),o.attrSet(`target`,`_blank`),o.attrSet(`rel`,`noopener noreferrer`),j(e,t,r,i,a)};let N=T(()=>{let e=n.legacyMedia?Nl(m.value||``,n.streaming):m.value||``;return e=ql(e,n.streaming),e});function I(e){let t=n.mentionNames;if(!t?.length)return e;let r=[...new Set(t.filter(Boolean))].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`));if(!r.length)return e;let i=RegExp(`(?<![\\w])@(?:${r.join(`|`)})(?=$|[\\s.,!?;:,。!?;:)\\]}>])`,`gi`);return e.replace(i,e=>`<span class="mention-highlight">${e}</span>`)}let L={USE_PROFILES:{html:!0},FORBID_TAGS:[`style`,`svg`,`math`,`form`,`input`,`iframe`,`object`,`embed`],FORBID_ATTR:[`style`,`onerror`,`onclick`,`onload`],ALLOW_UNKNOWN_PROTOCOLS:!1,ADD_ATTR:[`target`]},z=bt(window);z.setConfig(L);function B(e){return z.sanitize(I(e))}let ee=T(()=>{if(n.plain||n.separateMedia)return[];let e={},t=O.parse(N.value,e),r=[],i=0,a=0;for(let n=0;n<t.length;n++)a+=t[n].nesting,a===0&&(r.push(B(O.renderer.render(t.slice(i,n+1),O.options,e))),i=n+1);return r});function te(e){try{let t=new URL(e,window.location.href);return t.pathname=t.pathname.replace(/(\/api\/app\/files\/[^/]+)\/(?:preview|download)$/,`$1`),t.searchParams.delete(`_retry`),t.searchParams.sort(),t.href}catch{return e}}let ne=T(()=>{if(!n.separateMedia)return[];let e=[],t=new Set,r=n.attachments??[];function i(n){t.add(n.id),e.push({attachment:n})}function a(t){if(!t.replace(/<[^>]+>/g,``).trim()&&!/<(?:img|hr|pre|table)\b/.test(t))return;let n=e.at(-1);n&&`html`in n&&!n.text?n.html+=t:e.push({html:t})}function o(t){if(n.plain){t.trim()&&e.push({html:``,text:t});return}let o=document.createElement(`template`);o.innerHTML=B(O.render(t));for(let e of[...o.content.children]){if(e.tagName!==`P`){a(e.outerHTML);continue}let t=``;for(let n of[...e.childNodes]){let e=n instanceof HTMLElement?n:void 0,o=e?.tagName===`IMG`?e:void 0,s=e?.tagName===`A`?e:void 0,c;if(s&&ie(s))try{c=ae(new URL(s.href,window.location.href))}catch{}if(o||c){a(`<p>${t}</p>`),t=``;let e=o?.getAttribute(`src`)||s.getAttribute(`href`),n=r.find(t=>t.url&&te(t.url)===te(e)),l=n?.name||(o?o.alt||`图片`:V(s,c));i(n??{id:e,url:e,name:l,kind:o?`image`:`file`})}else t+=e?e.outerHTML:D(n.textContent||``)}a(`<p>${t}</p>`)}}if(n.contentParts?.length)for(let e of n.contentParts)if(`text`in e)o(n.legacyMedia?Nl(e.text,n.streaming):e.text);else{let t=r.find(t=>t.id===e.attachmentId);t&&i(t)}else o(N.value);for(let e of r)t.has(e.id)||i(e);return e});s([ee,ne],async()=>{await a(),r(`rendered`)},{flush:`post`});function re(){d.value&&d.value.querySelectorAll(`pre .code-copy`).forEach((e,t)=>{e.dataset.bound||(e.dataset.bound=`true`,e.addEventListener(`click`,async()=>{let n=e.closest(`pre`)?.querySelector(`code`)?.textContent??``,r=`${t}:${n.length}`;f.value=r;let i=await yl(n);e.textContent=i?`已复制`:`复制失败`,e.setAttribute(`aria-label`,i?`代码已复制`:`复制代码失败`),window.setTimeout(()=>{f.value!==r||!e.isConnected||(f.value=``,e.textContent=`复制`,e.setAttribute(`aria-label`,`复制代码`))},1400)}))})}function ie(e){if(e.closest(`blockquote, table, h1, h2, h3, h4, h5, h6, pre, code, strong, em, del`))return!1;let t=e.parentElement;if(!t||t.tagName!==`P`&&t.tagName!==`LI`)return!1;for(let t=e.previousSibling;t&&t.nodeName!==`BR`;t=t.previousSibling)if(t.nodeType!==Node.TEXT_NODE||t.textContent?.trim())return!1;for(let t=e.nextSibling;t&&t.nodeName!==`BR`;t=t.nextSibling)if(t.nodeType!==Node.TEXT_NODE||t.textContent?.trim())return!1;return!0}function ae(e){if(e.origin!==window.location.origin)return;if(/^\/api\/app\/files\/[^/]+\/(?:download|preview)$/i.test(e.pathname))return{remote:!0};if(e.pathname!==`/api/files/download`)return;let t=P(e.searchParams.get(`path`)||``);if(!(!t||!M(t)))return{path:t,remote:!1}}function V(e,t){return t.path?.split(`/`).at(-1)||e.textContent?.trim()||`文件`}function oe(){n.processContent||!n.fileCards||!d.value||d.value.querySelectorAll(`a`).forEach(e=>{if(e.dataset.fileCard)return;let t;try{t=new URL(e.href,window.location.href)}catch{return}let n=ae(t);if(!n||!ie(e))return;e.dataset.fileCard=`true`,e.classList.add(`file-link-card`),e.removeAttribute(`target`),e.removeAttribute(`rel`);let i=V(e,n);e.textContent=i,e.setAttribute(`aria-label`,`预览文件 ${i}`),e.addEventListener(`click`,e=>{e.preventDefault(),r(`fileLink`,i,`${t.pathname}${t.search}`)})})}function H(){n.processContent||!n.fileCards||!d.value||d.value.querySelectorAll(`img`).forEach(e=>{if(e.dataset.mediaPreview||e.closest(`.message-media`))return;let t;try{t=new URL(e.currentSrc||e.src,window.location.href)}catch{return}if(t.origin!==window.location.origin)return;e.dataset.mediaPreview=`true`;let n=(t.searchParams.get(`path`)||decodeURIComponent(t.pathname)).split(`/`).at(-1)||`图片`;e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-label`,`预览图片 ${n}`);let i=e=>{e.preventDefault(),e.stopPropagation(),r(`fileLink`,n,`${t.pathname}${t.search}`)};e.addEventListener(`click`,i),e.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&i(e)});let a,o=async()=>{if(!e.isConnected||a)return;a=document.createElement(`span`),a.className=`media-load-error`,a.setAttribute(`role`,`alert`);let r=document.createElement(`span`);r.textContent=`${n}:图片加载失败。`;let i=document.createElement(`button`);if(i.type=`button`,i.textContent=`重试`,i.addEventListener(`click`,()=>{a?.remove(),a=void 0,e.hidden=!1;let n=new URL(t);n.searchParams.set(`_retry`,String(Date.now())),e.src=n.toString()}),a.append(r,i),e.after(a),e.hidden=!0,t.pathname===`/api/files/download`)try{let e=await fetch(t,{credentials:`same-origin`});if(e.ok)await e.body?.cancel(),r.textContent=`${n}:文件内容不是可解码的图片。`;else{let t=await e.json().catch(()=>({})),i=t.error?.message||(typeof t.error==`string`?t.error:void 0)||t.message||t.detail;r.textContent=`${n}:${typeof i==`string`?i:e.status===404?`服务器文件不存在或已被移动。`:e.status===403?`此目录未获授权,请检查设置中的文件访问权限。`:`服务器暂时无法读取此文件。`}`}}catch{r.textContent=`${n}:连接失败,请重试。`}};e.addEventListener(`error`,()=>{o()}),e.addEventListener(`load`,()=>{e.hidden=!1,a?.remove(),a=void 0}),e.complete&&e.naturalWidth===0&&o()})}function se(){!n.outlinePrefix||!d.value||d.value.querySelectorAll(`h1, h2, h3`).forEach((e,t)=>{e.id=`${n.outlinePrefix}-heading-${t+1}`})}function U(e){let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`)||``;/^(javascript|data|vbscript):/i.test(n)&&e.preventDefault()}return l(()=>{re(),oe(),H(),se()}),u(()=>{re(),oe(),H(),se()}),(t,n)=>(o(),p(g,null,[e.separateMedia?(o(),p(`div`,{key:0,ref_key:`root`,ref:d,class:w([`markdown message-parts`,{"message-parts--streaming":e.streaming}]),onClick:U},[(o(!0),p(g,null,c(ne.value,(t,i)=>(o(),p(g,{key:i},[`attachment`in t?(o(),b(_l,{key:0,attachment:t.attachment,onOpen:n[0]||=e=>r(`preview`,e),onRendered:n[1]||=e=>r(`rendered`)},null,8,[`attachment`])):(o(),p(`div`,{key:1,class:w([`message-prose`,{"chat-bubble":e.bubble}])},[t.text===void 0?(o(),p(`div`,{key:1,class:`markdown-block`,innerHTML:t.html},null,8,Yl)):(o(),p(`div`,Jl,h(t.text),1))],2))],64))),128))],2)):e.plain?(o(),p(`div`,Xl,h(e.content),1)):(o(),p(`div`,{key:2,ref_key:`root`,ref:d,class:w([`markdown`,{"markdown--streaming":e.streaming}]),onClick:U},[(o(!0),p(g,null,c(ee.value,(e,t)=>(o(),p(`div`,{key:t,class:`markdown-block`,innerHTML:e},null,8,Zl))),128))],2)),e.streaming?(o(),b(F,{key:3,class:`stream-caret`,name:`arrow-up`,size:0})):y(``,!0)],64))}}),[[`__scopeId`,`data-v-c17774dc`]]),$l={class:`preview-inspector`},eu=[`title`],tu={class:`preview-header-actions`},nu=[`href`],ru=[`src`,`alt`],iu=[`src`],au=[`src`],ou={key:5,class:`preview-sheet`},su={key:6,class:`preview-text`},cu={key:0},lu=[`href`],uu={key:8,class:`preview-unavailable`},du=D(A({__name:`PreviewInspector`,props:{item:{},showClose:{type:Boolean,default:!1},canAddToComposer:{type:Boolean,default:!0}},emits:[`close`,`addToComposer`,`source`],setup(e,{emit:t}){let n=e,r=t,l=T(()=>!!n.item.previewUrl),u=T(()=>[`text`,`code`].includes(n.item.kind)),d=T(()=>n.item.previewUrl||n.item.downloadUrl||``),f=_(null),m=_(null),v=_([]),x=_(``),C=_(!1),E=_(!1),D=_(``),O=T(()=>n.item.name.split(`.`).at(-1)?.toLocaleLowerCase()||``),k=T(()=>O.value===`docx`||/wordprocessingml/.test(n.item.mimeType||``)),A=T(()=>[`xlsx`,`xls`].includes(O.value)||/spreadsheetml|excel/.test(n.item.mimeType||``)),M=T(()=>n.item.kind===`pdf`||O.value===`pdf`||n.item.mimeType===`application/pdf`),N=0,P,I=new URL(`/assets/pdf.worker.min-iDqQPrd3.mjs`,``+import.meta.url).href;function L(){let e=f.value;if(!e)return;e.style.setProperty(`--docx-preview-scale`,`1`);let t=[...e.querySelectorAll(`section.docx`)],n=Math.max(0,...t.map(e=>e.getBoundingClientRect().width));if(!n)return;let r=Math.max(1,e.clientWidth),i=Math.min(1,Math.max(.1,r/n));e.style.setProperty(`--docx-preview-scale`,i.toFixed(4))}function R(){P?.disconnect(),!(!f.value||typeof ResizeObserver>`u`)&&(P=new ResizeObserver(L),P.observe(f.value))}async function z(){let e=++N;if(P?.disconnect(),P=void 0,f.value?.style.removeProperty(`--docx-preview-scale`),v.value=[],x.value=n.item.textContent||``,C.value=n.item.textContent!==void 0,D.value=``,d.value&&!(!k.value&&!A.value&&!u.value&&!M.value)){E.value=!0;try{let t=await fetch(d.value,{credentials:`same-origin`});if(!t.ok)throw Error(`预览读取失败(${t.status})`);let n=await t.blob();if(e!==N)return;if(M.value){let t=await B(()=>import(`./pdf-CFWXmhVF.js`),__vite__mapDeps([0,1,2,3]));if(t.GlobalWorkerOptions.workerSrc=I,await a(),!m.value)return;m.value.replaceChildren();let r=await t.getDocument({data:await n.arrayBuffer()}).promise;for(let t=1;t<=Math.min(r.numPages,24);t+=1){if(e!==N||!m.value)return;let n=await r.getPage(t),i=n.getViewport({scale:1}),a=Math.min(1.45,Math.max(.55,(m.value.clientWidth-24)/i.width)),o=n.getViewport({scale:a}),s=Math.min(2,window.devicePixelRatio||1),c=document.createElement(`div`);c.className=`pdf-page`;let l=document.createElement(`canvas`);l.width=Math.floor(o.width*s),l.height=Math.floor(o.height*s),l.style.width=`${o.width}px`,l.style.height=`${o.height}px`,c.appendChild(l),m.value.appendChild(c);let u=l.getContext(`2d`);u&&await n.render({canvas:l,canvasContext:u,viewport:o,transform:s===1?void 0:[s,0,0,s,0,0]}).promise}}else if(k.value){let{renderAsync:e}=await B(async()=>{let{renderAsync:e}=await import(`./docx-preview-CG4CK2Qm.js`);return{renderAsync:e}},__vite__mapDeps([4,5,2,1,3,6,7,8]));if(await a(),!f.value)return;f.value.replaceChildren(),await e(n,f.value,void 0,{inWrapper:!0,breakPages:!0,ignoreWidth:!1,ignoreHeight:!1}),L(),R()}else if(A.value){let{default:e}=await B(async()=>{let{default:e}=await import(`./browser-B97PQaMt.js`);return{default:e}},[]);v.value=await e(n)}else u.value&&(C.value||(x.value=await n.text()),C.value=!0)}catch(e){D.value=e instanceof Error?e.message:`无法生成预览`}finally{E.value=!1}}}return s(()=>n.item.id,z,{immediate:!0,flush:`post`}),i(()=>P?.disconnect()),(t,n)=>(o(),p(`div`,$l,[S(`header`,null,[S(`strong`,{title:e.item.name},h(e.item.title||e.item.name),9,eu),S(`div`,tu,[e.item.sourceSessionId?(o(),p(`button`,{key:0,class:`icon-button`,type:`button`,"aria-label":`跳转到来源消息`,title:`跳转到来源消息`,onClick:n[0]||=t=>r(`source`,e.item)},[j(F,{name:`external`,size:15})])):y(``,!0),e.item.downloadUrl||e.item.previewUrl?(o(),p(`a`,{key:1,class:`icon-button`,href:e.item.downloadUrl||e.item.previewUrl,download:``,"aria-label":`下载`,title:`下载`},[j(F,{name:`download`,size:16})],8,nu)):y(``,!0),e.canAddToComposer?(o(),p(`button`,{key:2,class:`icon-button`,type:`button`,"aria-label":`加入输入框`,title:`加入输入框`,onClick:n[1]||=t=>r(`addToComposer`,e.item)},[j(F,{name:`plus`,size:17})])):y(``,!0),e.showClose?(o(),p(`button`,{key:3,class:`icon-button preview-close`,type:`button`,"aria-label":`关闭预览`,title:`关闭预览`,onClick:n[2]||=e=>r(`close`)},[j(F,{name:`close`,size:17})])):y(``,!0)])]),S(`div`,{class:w([`preview-stage`,`preview-stage--${e.item.kind}`])},[e.item.kind===`image`&&l.value?(o(),p(`img`,{key:0,src:e.item.previewUrl,alt:e.item.name},null,8,ru)):e.item.kind===`video`&&l.value?(o(),p(`video`,{key:1,src:e.item.previewUrl,controls:``,playsinline:``},null,8,iu)):e.item.kind===`audio`&&l.value?(o(),p(`audio`,{key:2,src:e.item.previewUrl,controls:``},null,8,au)):M.value&&l.value?(o(),p(`div`,{key:3,ref_key:`pdfRoot`,ref:m,class:`preview-pdf`},null,512)):k.value?(o(),p(`div`,{key:4,ref_key:`officeRoot`,ref:f,class:`preview-office`},null,512)):A.value&&v.value.length?(o(),p(`div`,ou,[S(`table`,null,[S(`tbody`,null,[(o(!0),p(g,null,c(v.value.slice(0,200),(e,t)=>(o(),p(`tr`,{key:t},[(o(!0),p(g,null,c(e.slice(0,50),(e,t)=>(o(),p(`td`,{key:t},h(e),1))),128))]))),128))])])])):u.value&&C.value?(o(),p(`div`,su,[e.item.kind===`code`?(o(),p(`pre`,cu,h(x.value),1)):(o(),b(Ql,{key:1,content:x.value},null,8,[`content`]))])):e.item.kind===`link`&&(e.item.previewUrl||e.item.downloadUrl)?(o(),p(`a`,{key:7,class:`preview-link`,href:e.item.previewUrl||e.item.downloadUrl,target:`_blank`,rel:`noopener noreferrer`},[S(`span`,null,[j(F,{name:`link`,size:27})]),S(`strong`,null,h(e.item.title||e.item.name),1),n[3]||=S(`small`,null,`在新窗口中打开`,-1)],8,lu)):(o(),p(`div`,uu,[S(`span`,null,[j(F,{name:D.value?`alert`:`file`,size:28},null,8,[`name`])]),S(`strong`,null,h(E.value?`正在生成预览…`:D.value||`此格式暂不支持内嵌预览`),1),S(`p`,null,h(D.value?`仍可下载文件后使用系统应用查看。`:`可下载文件,使用系统应用查看。`),1)]))],2)]))}}),[[`__scopeId`,`data-v-da7e4daa`]]),fu=[`aria-label`],pu=D(A({__name:`PreviewModal`,props:{item:{},items:{default:()=>[]},canAddToComposer:{type:Boolean,default:!0}},emits:[`close`,`addToComposer`,`source`],setup(e,{emit:t}){let n=e,r=t,a=T(()=>{let e=n.items.filter(e=>e.kind===`image`||e.kind===`video`);return e.some(e=>e.id===n.item.id||e.previewUrl===n.item.previewUrl)?e:[n.item]}),c=_(0),u=T(()=>a.value[c.value]??n.item),m=T(()=>c.value>0),h=T(()=>c.value<a.value.length-1),g;function x(){let e=a.value.findIndex(e=>e.id===n.item.id||e.previewUrl===n.item.previewUrl);c.value=e>=0?e:0}function w(){m.value&&--c.value}function E(){h.value&&(c.value+=1)}function D(e){(e.button===0||e.pointerType!==`mouse`)&&(e.target.closest(`button, a, audio`)||(g=e.clientX))}function k(e){if(g===void 0)return;let t=e.clientX-g;g=void 0,!(Math.abs(t)<48)&&(t<0?E():w())}function A(e){e.key===`Escape`?(e.preventDefault(),r(`close`)):e.key===`ArrowLeft`?(e.preventDefault(),w()):e.key===`ArrowRight`&&(e.preventDefault(),E())}return s([()=>n.item.id,a],x,{immediate:!0}),l(()=>window.addEventListener(`keydown`,A)),i(()=>window.removeEventListener(`keydown`,A)),(t,n)=>(o(),b(v,{to:`body`},[j(C,{name:`preview-modal`},{default:d(()=>[S(`div`,{class:`preview-modal-layer`,onMousedown:n[4]||=O(e=>r(`close`),[`self`])},[S(`section`,{class:`preview-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`预览 ${u.value.title||u.value.name}`,onPointerdown:D,onPointerup:k,onPointercancel:n[3]||=e=>f(g)?g.value=void 0:g=void 0},[j(du,{item:u.value,"show-close":``,"can-add-to-composer":e.canAddToComposer,onClose:n[0]||=e=>r(`close`),onAddToComposer:n[1]||=e=>r(`addToComposer`,e),onSource:n[2]||=e=>r(`source`,e)},null,8,[`item`,`can-add-to-composer`]),m.value?(o(),p(`button`,{key:0,class:`media-nav media-nav--previous`,type:`button`,"aria-label":`上一张媒体`,title:`上一张媒体`,onClick:w},[j(F,{name:`chevron-left`,size:22})])):y(``,!0),h.value?(o(),p(`button`,{key:1,class:`media-nav media-nav--next`,type:`button`,"aria-label":`下一张媒体`,title:`下一张媒体`,onClick:E},[j(F,{class:`media-nav__next-icon`,name:`chevron-left`,size:22})])):y(``,!0)],40,fu)],32)]),_:1})]))}}),[[`__scopeId`,`data-v-b797b8fc`]]),mu=[`aria-label`],hu={class:`image-preview-actions`},gu=[`href`,`aria-label`,`title`],_u=[`aria-label`,`title`],vu=[`aria-label`,`title`],yu=[`aria-label`],bu=[`src`,`aria-label`],xu=[`src`,`alt`],Su=[`aria-label`],Cu={key:2,class:`image-preview-counter`},wu=D(A({__name:`ImagePreviewLightbox`,props:{images:{},modelValue:{},closeLabel:{},addLabel:{},canAdd:{type:Boolean,default:!0},previousLabel:{},nextLabel:{}},emits:[`update:modelValue`,`close`,`add`],setup(e,{emit:n}){let r=e,a=n,s=_(null),c=T(()=>r.modelValue===null?null:r.images[r.modelValue]||null),u=T(()=>(r.modelValue??0)>0),f=T(()=>r.modelValue!==null&&r.modelValue<r.images.length-1);function g(){s.value=null,a(`update:modelValue`,null),a(`close`)}function x(e){if(r.modelValue===null)return;let t=r.modelValue+e;t>=0&&t<r.images.length&&a(`update:modelValue`,t)}function w(e){r.modelValue!==null&&(e.key===`Escape`?(e.preventDefault(),g()):e.key===`ArrowLeft`?(e.preventDefault(),x(-1)):e.key===`ArrowRight`&&(e.preventDefault(),x(1)))}function E(e){e.isPrimary&&(s.value={pointerId:e.pointerId,x:e.clientX})}function D(e){let t=s.value;s.value=null,!(!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)<48)&&x(e.clientX<t.x?1:-1)}return l(()=>window.addEventListener(`keydown`,w)),i(()=>window.removeEventListener(`keydown`,w)),(n,r)=>(o(),b(v,{to:`body`},[c.value?(o(),p(`div`,{key:0,class:`image-preview-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":`预览 ${c.value.name}`,onClick:O(g,[`self`]),onPointerdown:E,onPointerup:D,onPointercancel:r[7]||=e=>s.value=null},[S(`div`,hu,[S(`a`,{href:c.value.url,download:``,"aria-label":`下载 ${c.value.name}`,title:`下载 ${c.value.name}`},[j(m(V),{"aria-hidden":`true`})],8,gu),e.canAdd?(o(),p(`button`,{key:0,type:`button`,"aria-label":e.addLabel||`添加到聊天`,title:e.addLabel||`添加到聊天`,onClick:r[0]||=O(e=>a(`add`,c.value),[`stop`])},[j(m(t),{"aria-hidden":`true`})],8,_u)):y(``,!0),S(`button`,{type:`button`,"aria-label":e.closeLabel||`关闭预览`,title:e.closeLabel||`关闭预览`,onClick:g},[j(m(ie),{"aria-hidden":`true`})],8,vu)]),u.value?(o(),p(`button`,{key:0,class:`image-preview-nav image-preview-nav--previous`,type:`button`,"aria-label":e.previousLabel||`上一张媒体`,onClick:r[1]||=O(e=>x(-1),[`stop`])},[j(m(ne),{"aria-hidden":`true`})],8,yu)):y(``,!0),j(C,{name:`image-preview-change`,mode:`out-in`},{default:d(()=>[c.value.type===`video`?(o(),p(`video`,{key:c.value.url,src:c.value.url,"aria-label":c.value.name,class:`image-preview-video`,controls:``,playsinline:``,preload:`metadata`,onClick:r[2]||=O(()=>{},[`stop`]),onPointerdown:r[3]||=O(()=>{},[`stop`]),onPointerup:r[4]||=O(()=>{},[`stop`])},null,40,bu)):(o(),p(`img`,{key:c.value.url,src:c.value.url,alt:c.value.name,class:`image-preview-img`,draggable:`false`,onClick:r[5]||=O(()=>{},[`stop`])},null,8,xu))]),_:1}),f.value?(o(),p(`button`,{key:1,class:`image-preview-nav image-preview-nav--next`,type:`button`,"aria-label":e.nextLabel||`下一张媒体`,onClick:r[6]||=O(e=>x(1),[`stop`])},[j(m(ee),{"aria-hidden":`true`})],8,Su)):y(``,!0),e.images.length>1?(o(),p(`span`,Cu,h((e.modelValue||0)+1)+` / `+h(e.images.length),1)):y(``,!0)],40,mu)):y(``,!0)]))}}),[[`__scopeId`,`data-v-c250743b`]]);function Tu(e){return e.replace(/<(think|thinking|reasoning)>[\s\S]*?<\/\1>/gi,``).replace(/<(?:think|thinking|reasoning)>[\s\S]*$/gi,``)}function Eu(e,t=``){let n=[...e.matchAll(/<(think|thinking|reasoning)>([\s\S]*?)(?:<\/\1>|$)/gi)].map(e=>e[2].trim()).filter(Boolean);return[...new Set([t.trim(),...n].filter(Boolean))].join(`
|
|
34
34
|
|
|
35
35
|
`)}new ol({html:!1});function Du(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Ou(e,t=new Date){if(!e)return``;let n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return``;let r=new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n),i=Math.round((Du(t)-Du(n))/864e5);if(i===0)return r;if(i===1)return`昨天 ${r}`;if(i>=2&&i<7)return`周${`日一二三四五六`[n.getDay()]} ${r}`;let a=`${n.getMonth()+1}月${n.getDate()}日`;return n.getFullYear()===t.getFullYear()?`${a} ${r}`:`${n.getFullYear()}年${a} ${r}`}function ku(e,t=new Date){if(!e)return``;let n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return``;let r=Math.round((Du(t)-Du(n))/864e5);return r===0?new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n):r===1?`昨天`:r>=2&&r<7?`星期${`日一二三四五六`[n.getDay()]}`:`${n.getFullYear()===t.getFullYear()?``:n.getFullYear()+`年`}${n.getMonth()+1}月${n.getDate()}日`}var Au={class:`resource-sidebar`},ju={key:0,class:`sidebar-search`},Mu=[`value`,`placeholder`],Nu={key:0,class:`sidebar-loading`,"aria-label":`正在加载`},Pu=[`aria-selected`,`data-sidebar-id`,`onClick`,`onContextmenu`,`onKeydown`],Fu=[`aria-label`,`aria-expanded`,`onClick`],Iu={class:`sidebar-item__copy`},Lu={class:`sidebar-item__row`},Ru={key:0},zu={key:0,class:`sidebar-item__row sidebar-item__row--secondary`},Bu={key:0,class:`sidebar-unread-dot`,role:`img`,"aria-label":`未读`},Vu={key:1},Hu=[`onClick`],Uu=[`disabled`],Wu={key:3,class:`sidebar-empty`},Gu=`hermes-yaoyao:sidebar-search`,Ku=`hermes-yaoyao:sidebar-search-close`,qu=D(A({__name:`ResourceSidebar`,props:{items:{},activeId:{default:``},loading:{type:Boolean,default:!1},searchable:{type:Boolean,default:!0},externalSearch:{type:Boolean,default:!1},search:{default:``},searchPlaceholder:{default:`搜索`},emptyTitle:{default:`暂无内容`},emptyDescription:{default:`新建一项开始使用。`},singleLine:{type:Boolean,default:!1},avatarSize:{default:23},hasMore:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1}},emits:[`select`,`search`,`more`,`contextMenu`,`toggle`,`loadMore`],setup(e,{expose:t,emit:n}){let r=e,u=n,f=_(null),m=_(!!r.search),v=T(()=>r.items.reduce((e,t)=>(t.section&&!t.nested&&(e[t.section]=(e[t.section]??0)+1),e),{})),D=T(()=>r.items.map((e,t)=>({item:e,section:e.section&&e.section!==r.items[t-1]?.section?e.section:``,sectionLabel:e.section===`已置顶`?`已置顶 ${v.value[e.section]??0}`:e.section||``})));async function A(){if(!r.searchable)return;m.value=!0,await a();let e=f.value;!e||e.offsetParent===null||(e.focus(),e.select())}function M(e){let t=e.target.value;u(`search`,t),t||(m.value=!1)}function N(e=!1){e&&u(`search`,``),m.value=!1,document.dispatchEvent(new CustomEvent(Ku))}function P(){r.externalSearch||A()}function I(){m.value=!1}function R(e){let t=e.currentTarget;r.hasMore&&!r.loadingMore&&t.scrollHeight-t.scrollTop-t.clientHeight<96&&u(`loadMore`)}return s(()=>r.search,e=>{e&&(m.value=!0)}),l(()=>{document.addEventListener(Gu,P),document.addEventListener(Ku,I)}),i(()=>{document.removeEventListener(Gu,P),document.removeEventListener(Ku,I)}),t({focusSearch:A}),(t,n)=>(o(),p(`div`,Au,[j(C,{name:`search-reveal`},{default:d(()=>[e.searchable&&!e.externalSearch&&m.value?(o(),p(`label`,ju,[j(F,{name:`search`,size:15}),S(`input`,{ref_key:`searchInput`,ref:f,value:e.search,type:`search`,placeholder:e.searchPlaceholder,onInput:M,onKeydown:n[0]||=x(O(e=>N(!0),[`prevent`]),[`esc`]),onBlur:n[1]||=t=>!e.search&&N()},null,40,Mu)])):y(``,!0)]),_:1}),S(`div`,{class:`sidebar-list`,role:`listbox`,"aria-label":`资源列表`,onScrollPassive:R},[e.loading&&!e.items.length?(o(),p(`div`,Nu,[(o(),p(g,null,c(7,e=>S(`span`,{key:e,class:`sidebar-skeleton`,style:E({opacity:1-e*.08})},null,4)),64))])):(o(!0),p(g,{key:1},c(D.value,t=>(o(),p(g,{key:t.item.id},[t.section?(o(),p(`div`,{key:0,class:w([`sidebar-section-label`,{"sidebar-section-label--pinned":t.section===`已置顶`}]),role:`presentation`},[S(`span`,null,h(t.sectionLabel),1)],2)):y(``,!0),S(`div`,{class:w([`sidebar-item`,{active:t.item.id===e.activeId||t.item.active,"sidebar-item--single-line":e.singleLine,"sidebar-item--nested":t.item.nested,"sidebar-item--topic":t.item.topic,"sidebar-item--expandable":t.item.expandable}]),role:`option`,tabindex:`0`,"aria-selected":t.item.id===e.activeId||t.item.active,"data-sidebar-id":t.item.id,onClick:e=>u(`select`,t.item.id),onContextmenu:O(e=>u(`contextMenu`,t.item.id,e),[`prevent`,`stop`]),onKeydown:[x(O(e=>u(`select`,t.item.id),[`prevent`]),[`enter`]),x(O(e=>u(`select`,t.item.id),[`prevent`]),[`space`])]},[t.item.expandable?(o(),p(`button`,{key:0,class:w([`sidebar-item__expand`,{"sidebar-item__expand--collapsed":!t.item.expanded}]),type:`button`,"aria-label":`${t.item.expanded?`收起`:`展开`} ${t.item.title} 的话题`,"aria-expanded":t.item.expanded,onClick:O(e=>u(`toggle`,t.item.id),[`stop`])},[j(F,{name:`chevron-down`,size:13})],10,Fu)):y(``,!0),e.singleLine?y(``,!0):(o(),p(`span`,{key:1,class:w([`sidebar-item__icon`,{"sidebar-item__icon--avatar":!t.item.icon}])},[t.item.avatarKind===`agent`?(o(),b(L,{key:0,name:t.item.title,avatar:t.item.avatar,state:t.item.avatarState,"activity-key":t.item.avatarActivityKey,size:e.avatarSize},null,8,[`name`,`avatar`,`state`,`activity-key`,`size`])):t.item.avatar!==void 0||t.item.avatarMembers?.length?(o(),b(z,{key:1,name:t.item.title,avatar:t.item.avatar||``,members:t.item.avatarMembers||[],"fallback-key":t.item.avatarFallbackKey||t.item.id,size:e.avatarSize},null,8,[`name`,`avatar`,`members`,`fallback-key`,`size`])):t.item.icon?(o(),b(F,{key:2,name:t.item.icon,size:t.item.topic?14:15},null,8,[`name`,`size`])):(o(),p(g,{key:3},[k(h(t.item.title.slice(0,1).toUpperCase()),1)],64)),t.item.status?(o(),p(`span`,{key:4,class:w([`presence`,`presence--${t.item.status}`])},null,2)):y(``,!0)],2)),S(`span`,Iu,[S(`span`,Lu,[S(`strong`,null,[t.item.pinned?(o(),b(F,{key:0,name:`pin-filled`,size:12})):y(``,!0),k(h(t.item.title),1)]),t.item.meta?(o(),p(`small`,Ru,h(t.item.meta),1)):y(``,!0)]),!e.singleLine&&t.item.subtitle?(o(),p(`span`,zu,[S(`span`,null,h(t.item.subtitle),1),t.item.unreadDot?(o(),p(`i`,Bu)):t.item.unread?(o(),p(`b`,Vu,h(t.item.unread>99?`99+`:t.item.unread),1)):y(``,!0)])):y(``,!0)]),t.item.showMore===!1?y(``,!0):(o(),p(`button`,{key:2,class:`sidebar-item__more`,type:`button`,"aria-label":`更多操作`,onClick:O(e=>u(`more`,t.item.id,e),[`stop`])},[j(F,{name:`dots`,size:16})],8,Hu))],42,Pu)],64))),128)),e.hasMore?(o(),p(`button`,{key:2,class:`sidebar-load-more`,type:`button`,disabled:e.loadingMore,onClick:n[2]||=e=>u(`loadMore`)},h(e.loadingMore?`正在加载更多…`:`继续加载会话`),9,Uu)):y(``,!0),!e.loading&&!e.items.length?(o(),p(`div`,Wu,[S(`span`,null,[j(F,{name:`chat`,size:20})]),S(`strong`,null,h(e.emptyTitle),1),S(`p`,null,h(e.emptyDescription),1)])):y(``,!0)],32)]))}}),[[`__scopeId`,`data-v-624cdf20`]]);function Ju(e){return e.lastMessageAt??e.createdAt}function Yu(e,t){return Number(t.pinned)-Number(e.pinned)||Ju(t)-Ju(e)||(e.id<t.id?-1:+(e.id>t.id))}function Xu(e){return e.unread??(e.unreadCount===void 0?e.lastSeq>e.readSeq:e.unreadCount>0)}function Zu(e){return e.some(e=>e.visible!==!1&&e.role===`assistant`&&[`queued`,`streaming`,`uncertain`].includes(e.status))}function Qu(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function $u(e){let t=e<1e10?e*1e3:e,n=Date.now()-t;if(n<6e4)return`刚刚`;if(n<36e5)return`${Math.max(1,Math.floor(n/6e4))} 分钟`;if(n<864e5)return`${Math.max(1,Math.floor(n/36e5))} 小时`;let r=new Date(t);return`${r.getMonth()+1}/${r.getDate()}`}function ed(e,t=!1){if(t)return`已置顶`;let n=e<1e10?e*1e3:e,r=new Date;r.setHours(0,0,0,0);let i=new Date(r);return i.setDate(i.getDate()-1),n>=r.getTime()?`今天`:n>=i.getTime()?`昨天`:`更早`}function td(e,t=0,n=``){return{id:e.id,title:e.title||`未命名会话`,subtitle:e.preview||`${e.messageCount} 条消息`,meta:n||e.agent||$u(e.updatedAt),section:ed(e.updatedAt,e.pinned),icon:`chat`,pinned:e.pinned,unread:t}}function nd(e){let t=e.status===`completed`?`success`:e.status===`failed`?`error`:e.status;return{id:e.id,name:e.name,status:t,input:e.arguments,output:e.error||e.result||e.preview,durationMs:e.durationSeconds?Math.round(e.durationSeconds*1e3):void 0}}function rd(e){let t=Qu(e.raw);if(t.result!==void 0)return t.result;if(t.output!==void 0&&typeof t.output!=`string`)return t.output;try{return JSON.parse(e.content)}catch{return e.content||void 0}}function id(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:void 0}var ad=`[context compaction`,od=/^\[IMPORTANT:\s*Background process\s+(\S+)\s+exited\s+\(exit code\s+(-?\d+)(?:,\s*([^)]+))?\)\.?\]?(?:\r?\n|$)/i;function sd(e){return e.content.trim().toLocaleLowerCase().startsWith(ad)||e.displayKind?.toLocaleLowerCase().includes(`compaction`)===!0}function cd(e){let t=e.trim().match(od);if(t)return{process_id:t[1],exit_code:Number(t[2]),...t[3]?.trim()?{signal:t[3].trim()}:{}}}function ld(e){return!!e.displayKind||/^\[system:/i.test(e.content.trim())||sd(e)||!!cd(e.content)}function ud(e,t){let n=e.attachments?.map(t=>({id:t.id,name:t.name,kind:t.kind===`image`?`image`:`file`,url:R(t.url||t.path||``,e.profile)||t.url||t.path,size:t.size}));return{id:e.id,role:e.role,author:e.role===`assistant`?t?.(e.profile)||e.profile:void 0,content:e.role===`assistant`?Tu(e.content):e.content,reasoning:e.role===`assistant`?Eu(e.content,e.reasoning):e.reasoning,createdAt:e.timestamp<1e10?e.timestamp*1e3:e.timestamp,status:e.isStreaming?`streaming`:e.stage,error:e.error,attachments:n,contentParts:e.contentParts?.filter(e=>`text`in e).map(e=>e.text).filter(Boolean).join(`
|
|
36
36
|
|
|
37
37
|
`)===e.content?e.contentParts?.map(t=>`text`in t&&e.role===`assistant`?{text:Tu(t.text)}:t):void 0,tools:e.toolCalls?.filter(e=>e.id).map(t=>nd(!e.isStreaming&&[`pending`,`running`].includes(t.status)?{...t,status:`interrupted`}:t)),profile:e.profile}}function dd(e,t){let n=[],r=new Map,i;for(let a of e){if(a.role===`tool`){let e=a.toolCallId&&r.get(a.toolCallId)||i;if(!e)continue;let t=a.toolCallId||a.id,n=[...e.tools??[]],o=n.findIndex(e=>e.id===t),s={id:t,name:a.toolName||n[o]?.name||`工具`,status:N(rd(a),a.error)?`error`:`success`,input:n[o]?.input,output:a.error||rd(a)};o>=0?n[o]={...n[o],...s}:n.push(s),e.tools=n,a.toolCallId&&r.set(a.toolCallId,e);continue}if(a.role===`system`&&!ld(a))continue;let e=ud(a,t);if(ld(a)){let t=cd(a.content);e.role=`system`,e.timelineKind=a.displayKind===`async_delegation_complete`?`delegation-complete`:t?`background-process`:`system`,e.timelineMetadata={...id(a.displayMetadata)??{},...t??{},eventKind:sd(a)?`compaction`:a.displayKind}}n.push(e),a.role===`assistant`&&(i=e,e.tools=e.tools?.map(t=>{let n=r.get(t.id),i=n?.tools?.find(e=>e.id===t.id);return n&&i&&!/^tool-\d+$/.test(t.id)&&(n.tools=n.tools?.filter(e=>e.id!==t.id),t={...i,...t,input:t.input??i.input,output:t.output??i.output,status:[`success`,`error`].includes(i.status)&&![`success`,`error`].includes(t.status)?i.status:t.status}),r.set(t.id,e),t}))}return n}function fd(e,t){return e?{id:e.id,kind:`approval`,title:e.toolName?`允许 ${e.toolName}`:`允许这项操作`,prompt:e.message||`机器人请求执行一项需要确认的操作。`,options:e.choices,detail:JSON.stringify(e.payload,null,2)}:t?{id:t.id,kind:`clarification`,prompt:t.question,options:t.choices,detail:JSON.stringify(t.payload,null,2)}:null}function pd(e){let t=(e.extension||e.name.split(`.`).at(-1)||``).replace(/^\./,``).toLocaleLowerCase(),n=[`md`,`markdown`,`txt`,`json`,`yaml`,`yml`,`csv`,`js`,`ts`,`py`,`sh`,`css`,`html`,`xml`].includes(t),r=e.mimeType===`application/pdf`||t===`pdf`?`pdf`:n||/text|json|xml|javascript|typescript|css|html/i.test(e.mimeType)?`text`:e.kind===`document`?`document`:e.kind===`other`?`file`:e.kind,i=e.origins.at(-1);return{id:e.id,name:e.name,kind:r,mimeType:e.mimeType,size:e.size,updatedAt:e.modifiedAt<1e10?e.modifiedAt*1e3:e.modifiedAt,previewUrl:e.previewUrl,downloadUrl:e.downloadUrl,sourceLabel:i?.sessionTitle||i?.authorName||i?.profile,sourceSessionId:i?.sessionId,sourceWorkspaceConversationId:i?.workspaceConversationId,sourceMessageId:i?.messageId,sourceProfile:i?.profile}}function md(e){return e.filter(e=>e.visible!==!1).map(e=>({id:e.id,role:e.role,author:e.agentName,communication:e.communication,browserCard:e.browserCard,serviceWarnings:e.serviceWarnings,taskReference:e.taskReference,error:e.error,runId:e.runId,profile:e.agentId,createdAt:e.createdAt,content:(e.communication?.content??(e.role===`assistant`?Nl(Tu(e.content),e.status===`streaming`):e.content)).replace(/(!?\[[^\]]*\])\(<?([^)>]+)>?\)/g,(t,n,r)=>{let i=P(r),a=e.attachments.find(e=>e.sourcePath===r||i&&e.sourcePath&&P(e.sourcePath,!1)===i);return a?`${n}(/api/app/files/${a.id}/${n.startsWith(`!`)?`preview`:`download`})`:t}),reasoning:e.role===`assistant`?Eu(e.content,e.reasoning):e.reasoning,status:e.status===`complete`||e.status===`interrupted`?`settled`:e.status===`uncertain`?`unknown-receipt`:e.status===`queued`?`pending`:e.status,attachments:e.attachments.map(e=>({id:e.id,name:e.name,size:e.size,kind:e.mimeType.startsWith(`image/`)?`image`:e.mimeType.startsWith(`video/`)?`video`:e.mimeType.startsWith(`audio/`)?`audio`:`file`,url:`/api/app/files/${e.id}/${e.mimeType.startsWith(`image/`)?`preview`:`download`}`})),tools:e.tools.map((t,n)=>{let r=I(t.status,t.result??t.output,t.error);return r===`running`&&[`complete`,`failed`,`interrupted`].includes(e.status)&&(r=e.status===`complete`?`completed`:e.status===`failed`?`failed`:`interrupted`),{id:String(t.id||n),name:String(t.name||t.tool_name||`工具`),status:r===`completed`?`success`:r===`failed`?`error`:r,input:t.arguments??t.args??t.input,output:t.error??t.result??t.output}})}))}function hd(e,t,n){let r=new Map(t.map(e=>[e.id,e]));return e.flatMap(e=>{let t=r.get(e);return t?[{name:t.name,avatar:t.avatar,state:gd(n,t.id),activityKey:n?.lastSeq}]:[]})}function gd(e,t){let n=e?.activeAgentStates?.[t];if(n)return n===`running`?`working`:n===`queued`?`loading`:`waiting`;let r=e?.avatarSignals?.[t];return r&&Date.now()-r.at<2e3?r.state:e?.activeRunStatus===`queued`&&e.memberIds[0]===t?`loading`:!e?.activeRunId||e.activeAgentId!==t?e?.previewAgentId===t&&Xu(e)?`notifying`:`idle`:e.activeRunStatus===`waiting`||e.activeRunStatus===`uncertain`?`waiting`:`working`}function _d(e){let t=new Map,n={working:3,waiting:2,loading:1};for(let r of e)for(let e of r.memberIds){let i=gd(r,e);if(i!==`working`&&i!==`waiting`&&i!==`loading`)continue;let a=t.get(e);(!a||n[i]>n[a])&&t.set(e,i)}return t}function vd(e,t,n){let r=e.kind===`direct`?n?.get(e.memberIds[0]||``):void 0;return{id:e.id,title:e.name,subtitle:e.preview||e.kind===`direct`&&t.find(t=>t.id===e.memberIds[0])?.job||`开始聊天`,pinned:e.pinned,section:e.pinned?`已置顶`:`聊天`,avatar:e.kind===`group`?``:e.avatar,avatarMembers:e.kind===`group`?hd(e.memberIds,t,e):[],meta:ku(Ju(e)),avatarKind:e.kind===`direct`?`agent`:`team`,avatarState:r??gd(e,e.memberIds[0]||``),avatarActivityKey:e.lastSeq,unreadDot:Xu(e),status:r||e.activeRunId?`working`:void 0}}export{du as _,_d as a,yl as b,vd as c,Zu as d,qu as f,pu as g,wu as h,td as i,md as l,Tu as m,dd as n,hd as o,Ou as p,pd as r,gd as s,fd as t,Yu as u,Ql as v,ol as x,Nl as y};
|
|
38
|
-
//# sourceMappingURL=viewModels-
|
|
38
|
+
//# sourceMappingURL=viewModels-CYJ8m5Uf.js.map
|