@liip/liipgpt 3.11.2 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/button/liipgpt-button.iife.js +1 -1
  2. package/button/liipgpt-button.js +1 -1
  3. package/chat/liipgpt-chat.iife.js +18 -18
  4. package/chat/liipgpt-chat.js +18 -18
  5. package/config/index.cjs +1 -0
  6. package/config/index.d.ts +11 -1
  7. package/config/index.js +1 -0
  8. package/configurator/_app/env.js +1 -1
  9. package/configurator/_app/immutable/chunks/BGriYQSA.js +143 -0
  10. package/configurator/_app/immutable/chunks/{CIHHNprL.js → BJVrdkuG.js} +1 -1
  11. package/configurator/_app/immutable/chunks/{59Qy4pzN.js → BOogcmRI.js} +1 -1
  12. package/configurator/_app/immutable/chunks/{BBBsf1IY.js → BgPvdYLz.js} +2 -2
  13. package/configurator/_app/immutable/chunks/BndQp4ie.js +1 -0
  14. package/configurator/_app/immutable/chunks/{MXZgHzgQ.js → BzwH5m-K.js} +1 -1
  15. package/configurator/_app/immutable/chunks/C6xrTJ8-.js +1 -0
  16. package/configurator/_app/immutable/chunks/{C32fguu7.js → C7SVO0yB.js} +1 -1
  17. package/configurator/_app/immutable/chunks/CNNudH1c.js +15 -0
  18. package/configurator/_app/immutable/chunks/CrAgD5Zd.js +16 -0
  19. package/configurator/_app/immutable/chunks/{BZRp1cWz.js → CxsmcPPu.js} +1 -1
  20. package/configurator/_app/immutable/chunks/{SzunIEqj.js → DHHLckcz.js} +1 -1
  21. package/configurator/_app/immutable/chunks/DK3lEKRX.js +3 -0
  22. package/configurator/_app/immutable/chunks/DUHuqsF-.js +1 -0
  23. package/configurator/_app/immutable/chunks/{CD6_VnKE.js → DmZKIk3Y.js} +1 -1
  24. package/configurator/_app/immutable/chunks/DmafQ_KV.js +1 -0
  25. package/configurator/_app/immutable/chunks/{hdHt6us6.js → I5DxyXWx.js} +1 -1
  26. package/configurator/_app/immutable/chunks/MqTIsSeD.js +1 -0
  27. package/configurator/_app/immutable/chunks/{6ikKRAEA.js → hJTLHSgs.js} +2 -2
  28. package/configurator/_app/immutable/chunks/{Bzr04ZcD.js → lj2Jt22R.js} +3 -3
  29. package/configurator/_app/immutable/entry/{app.B_61kXQ4.js → app.CFqiYWk3.js} +2 -2
  30. package/configurator/_app/immutable/entry/start.CT4FgDr_.js +1 -0
  31. package/configurator/_app/immutable/nodes/{0.Bi08LRX0.js → 0.DwmuWxZI.js} +2 -1
  32. package/configurator/_app/immutable/nodes/1.Bjv1gqx4.js +1 -0
  33. package/configurator/_app/immutable/nodes/{2.BNeVNh0R.js → 2.CyWhas6h.js} +9 -9
  34. package/configurator/_app/immutable/nodes/{3.D1rPht9H.js → 3.BlXQFvKY.js} +1 -1
  35. package/configurator/_app/version.json +1 -1
  36. package/configurator/index.html +7 -7
  37. package/configurator/sidebar.html +7 -7
  38. package/index.cjs +6 -5
  39. package/index.d.ts +29 -3
  40. package/index.js +6 -5
  41. package/package.json +1 -1
  42. package/search-summary/liipgpt-search-summary.iife.js +3 -3
  43. package/search-summary/liipgpt-search-summary.js +2 -2
  44. package/search-summary/{load-chat-config-BnSgm085.js → load-chat-config-C0gjKjFi.js} +1 -1
  45. package/configurator/_app/immutable/chunks/C1yKSdkL.js +0 -143
  46. package/configurator/_app/immutable/chunks/COh_IaBC.js +0 -1
  47. package/configurator/_app/immutable/chunks/CYtlA8cd.js +0 -1
  48. package/configurator/_app/immutable/chunks/Ct3VxfiR.js +0 -1
  49. package/configurator/_app/immutable/chunks/CzUv7c8S.js +0 -1
  50. package/configurator/_app/immutable/chunks/DBQyBiSh.js +0 -16
  51. package/configurator/_app/immutable/chunks/oxab-KY5.js +0 -15
  52. package/configurator/_app/immutable/chunks/rEsbAd0y.js +0 -3
  53. package/configurator/_app/immutable/chunks/s6x81Lfq.js +0 -1
  54. package/configurator/_app/immutable/entry/start.BOhSSe81.js +0 -1
  55. package/configurator/_app/immutable/nodes/1.E_trvDMx.js +0 -1
@@ -1,4 +1,4 @@
1
- import{Dt as e,Et as t,Nt as n,Tt as r,it as i,jt as a,ot as o,ut as s,wt as c}from"./rEsbAd0y.js";import{S as l,a as u,b as d,h as f,l as p,m,o as ee,p as h,y as te}from"./BaFk5JeE.js";import{c as ne,f as re,l as g,o as ie,s as ae,u as oe}from"./CIHHNprL.js";var{entries:se,setPrototypeOf:ce,isFrozen:le,getPrototypeOf:ue,getOwnPropertyDescriptor:_}=Object,{freeze:v,seal:y,create:de}=Object,{apply:fe,construct:pe}=typeof Reflect<`u`&&Reflect;v||=function(e){return e},y||=function(e){return e},fe||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},pe||=function(e){return new e(...[...arguments].slice(1))};var me=S(Array.prototype.forEach),he=S(Array.prototype.lastIndexOf),ge=S(Array.prototype.pop),_e=S(Array.prototype.push),ve=S(Array.prototype.splice),ye=S(String.prototype.toLowerCase),be=S(String.prototype.toString),xe=S(String.prototype.match),Se=S(String.prototype.replace),Ce=S(String.prototype.indexOf),we=S(String.prototype.trim),b=S(Object.prototype.hasOwnProperty),x=S(RegExp.prototype.test),Te=Ee(TypeError);function S(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return fe(e,t,n)}}function Ee(e){return function(){return pe(e,[...arguments])}}function C(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ye;ce&&ce(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(le(t)||(t[r]=e),i=e)}e[i]=!0}return e}function De(e){for(let t=0;t<e.length;t++)b(e,t)||(e[t]=null);return e}function w(e){let t=de(null);for(let[n,r]of se(e))b(e,n)&&(Array.isArray(r)?t[n]=De(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=w(r):t[n]=r);return t}function Oe(e,t){for(;e!==null;){let n=_(e,t);if(n){if(n.get)return S(n.get);if(typeof n.value==`function`)return S(n.value)}e=ue(e)}function n(){return null}return n}var ke=v(`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(`.`)),Ae=v(`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(`.`)),je=v([`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`]),Me=v([`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`]),Ne=v(`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(`.`)),Pe=v([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Fe=v([`#text`]),Ie=v(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.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.slot`.split(`.`)),Le=v(`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.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-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(`.`)),Re=v(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.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(`.`)),ze=v([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Be=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ve=y(/<%[\w\W]*|[\w\W]*%>/gm),He=y(/\$\{[\w\W]*/gm),T=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ue=y(/^aria-[\-\w]+$/),We=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),E=y(/^(?:\w+script|data):/i),Ge=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ke=y(/^html$/i),D=y(/^[a-z][.\w]*(-[.\w]+)+$/i),qe=Object.freeze({__proto__:null,ARIA_ATTR:Ue,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:D,DATA_ATTR:T,DOCTYPE_NAME:Ke,ERB_EXPR:Ve,IS_ALLOWED_URI:We,IS_SCRIPT_OR_DATA:E,MUSTACHE_EXPR:Be,TMPLIT_EXPR:He}),Je={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ye=function(){return typeof window>`u`?null:window},Xe=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}},Ze=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Qe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ye(),t=e=>Qe(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Je.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,ee=Oe(m,`cloneNode`),h=Oe(m,`remove`),te=Oe(m,`nextSibling`),ne=Oe(m,`childNodes`),re=Oe(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let g,ie=``,{implementation:ae,createNodeIterator:oe,createDocumentFragment:ce,getElementsByTagName:le}=n,{importNode:ue}=r,_=Ze();t.isSupported=typeof se==`function`&&typeof re==`function`&&ae&&ae.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:y,ERB_EXPR:fe,TMPLIT_EXPR:pe,DATA_ATTR:S,ARIA_ATTR:Ee,IS_SCRIPT_OR_DATA:De,ATTR_WHITESPACE:Be,CUSTOM_ELEMENT:Ve}=qe,{IS_ALLOWED_URI:He}=qe,T=null,Ue=C({},[...ke,...Ae,...je,...Ne,...Fe]),E=null,Ge=C({},[...Ie,...Le,...Re,...ze]),D=Object.seal(de(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$e=null,et=null,O=Object.seal(de(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),tt=!0,k=!0,A=!1,j=!0,M=!1,nt=!0,N=!1,P=!1,rt=!1,F=!1,it=!1,at=!1,ot=!0,st=!1,ct=!0,I=!1,L={},R=null,z=C({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),lt=null,ut=C({},[`audio`,`video`,`img`,`source`,`image`,`track`]),dt=null,ft=C({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),pt=`http://www.w3.org/1998/Math/MathML`,mt=`http://www.w3.org/2000/svg`,B=`http://www.w3.org/1999/xhtml`,V=B,ht=!1,gt=null,_t=C({},[pt,mt,B],be),H=C({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),U=C({},[`annotation-xml`]),vt=C({},[`title`,`style`,`font`,`a`,`script`]),yt=null,bt=[`application/xhtml+xml`,`text/html`],W=null,xt=null,St=n.createElement(`form`),Ct=function(e){return e instanceof RegExp||e instanceof Function},wt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xt&&xt===e)){if((!e||typeof e!=`object`)&&(e={}),e=w(e),yt=bt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=yt===`application/xhtml+xml`?be:ye,T=b(e,`ALLOWED_TAGS`)?C({},e.ALLOWED_TAGS,W):Ue,E=b(e,`ALLOWED_ATTR`)?C({},e.ALLOWED_ATTR,W):Ge,gt=b(e,`ALLOWED_NAMESPACES`)?C({},e.ALLOWED_NAMESPACES,be):_t,dt=b(e,`ADD_URI_SAFE_ATTR`)?C(w(ft),e.ADD_URI_SAFE_ATTR,W):ft,lt=b(e,`ADD_DATA_URI_TAGS`)?C(w(ut),e.ADD_DATA_URI_TAGS,W):ut,R=b(e,`FORBID_CONTENTS`)?C({},e.FORBID_CONTENTS,W):z,$e=b(e,`FORBID_TAGS`)?C({},e.FORBID_TAGS,W):w({}),et=b(e,`FORBID_ATTR`)?C({},e.FORBID_ATTR,W):w({}),L=b(e,`USE_PROFILES`)?e.USE_PROFILES:!1,tt=e.ALLOW_ARIA_ATTR!==!1,k=e.ALLOW_DATA_ATTR!==!1,A=e.ALLOW_UNKNOWN_PROTOCOLS||!1,j=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,M=e.SAFE_FOR_TEMPLATES||!1,nt=e.SAFE_FOR_XML!==!1,N=e.WHOLE_DOCUMENT||!1,F=e.RETURN_DOM||!1,it=e.RETURN_DOM_FRAGMENT||!1,at=e.RETURN_TRUSTED_TYPE||!1,rt=e.FORCE_BODY||!1,ot=e.SANITIZE_DOM!==!1,st=e.SANITIZE_NAMED_PROPS||!1,ct=e.KEEP_CONTENT!==!1,I=e.IN_PLACE||!1,He=e.ALLOWED_URI_REGEXP||We,V=e.NAMESPACE||B,H=e.MATHML_TEXT_INTEGRATION_POINTS||H,U=e.HTML_INTEGRATION_POINTS||U,D=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ct(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ct(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(D.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),M&&(k=!1),it&&(F=!0),L&&(T=C({},Fe),E=de(null),L.html===!0&&(C(T,ke),C(E,Ie)),L.svg===!0&&(C(T,Ae),C(E,Le),C(E,ze)),L.svgFilters===!0&&(C(T,je),C(E,Le),C(E,ze)),L.mathMl===!0&&(C(T,Ne),C(E,Re),C(E,ze))),b(e,`ADD_TAGS`)||(O.tagCheck=null),b(e,`ADD_ATTR`)||(O.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?O.tagCheck=e.ADD_TAGS:(T===Ue&&(T=w(T)),C(T,e.ADD_TAGS,W))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?O.attributeCheck=e.ADD_ATTR:(E===Ge&&(E=w(E)),C(E,e.ADD_ATTR,W))),e.ADD_URI_SAFE_ATTR&&C(dt,e.ADD_URI_SAFE_ATTR,W),e.FORBID_CONTENTS&&(R===z&&(R=w(R)),C(R,e.FORBID_CONTENTS,W)),e.ADD_FORBID_CONTENTS&&(R===z&&(R=w(R)),C(R,e.ADD_FORBID_CONTENTS,W)),ct&&(T[`#text`]=!0),N&&C(T,[`html`,`head`,`body`]),T.table&&(C(T,[`tbody`]),delete $e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);g=e.TRUSTED_TYPES_POLICY,ie=g.createHTML(``)}else g===void 0&&(g=Xe(p,i)),g!==null&&typeof ie==`string`&&(ie=g.createHTML(``));v&&v(e),xt=e}},Tt=C({},[...Ae,...je,...Me]),Et=C({},[...Ne,...Pe]),Dt=function(e){let t=re(e);(!t||!t.tagName)&&(t={namespaceURI:V,tagName:`template`});let n=ye(e.tagName),r=ye(t.tagName);return gt[e.namespaceURI]?e.namespaceURI===mt?t.namespaceURI===B?n===`svg`:t.namespaceURI===pt?n===`svg`&&(r===`annotation-xml`||H[r]):!!Tt[n]:e.namespaceURI===pt?t.namespaceURI===B?n===`math`:t.namespaceURI===mt?n===`math`&&U[r]:!!Et[n]:e.namespaceURI===B?t.namespaceURI===mt&&!U[r]||t.namespaceURI===pt&&!H[r]?!1:!Et[n]&&(vt[n]||!Tt[n]):!!(yt===`application/xhtml+xml`&&gt[e.namespaceURI]):!1},G=function(e){_e(t.removed,{element:e});try{re(e).removeChild(e)}catch{h(e)}},K=function(e,n){try{_e(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{_e(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(F||it)try{G(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ot=function(e){let t=null,r=null;if(rt)e=`<remove></remove>`+e;else{let t=xe(e,/^[\r\n\t ]+/);r=t&&t[0]}yt===`application/xhtml+xml`&&V===B&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=g?g.createHTML(e):e;if(V===B)try{t=new f().parseFromString(i,yt)}catch{}if(!t||!t.documentElement){t=ae.createDocument(V,`template`,null);try{t.documentElement.innerHTML=ht?ie:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),V===B?le.call(t,N?`html`:`body`)[0]:N?t.documentElement:a},kt=function(e){return oe.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},At=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},jt=function(e){return typeof s==`function`&&e instanceof s};function q(e,n,r){me(e,e=>{e.call(t,n,r,xt)})}let Mt=function(e){let n=null;if(q(_.beforeSanitizeElements,e,null),At(e))return G(e),!0;let r=W(e.nodeName);if(q(_.uponSanitizeElement,e,{tagName:r,allowedTags:T}),nt&&e.hasChildNodes()&&!jt(e.firstElementChild)&&x(/<[/\w!]/g,e.innerHTML)&&x(/<[/\w!]/g,e.textContent)||e.nodeType===Je.progressingInstruction||nt&&e.nodeType===Je.comment&&x(/<[/\w]/g,e.data))return G(e),!0;if(!(O.tagCheck instanceof Function&&O.tagCheck(r))&&(!T[r]||$e[r])){if(!$e[r]&&Pt(r)&&(D.tagNameCheck instanceof RegExp&&x(D.tagNameCheck,r)||D.tagNameCheck instanceof Function&&D.tagNameCheck(r)))return!1;if(ct&&!R[r]){let t=re(e)||e.parentNode,n=ne(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=ee(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,te(e))}}}return G(e),!0}return e instanceof c&&!Dt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&x(/<\/no(script|embed|frames)/i,e.innerHTML)?(G(e),!0):(M&&e.nodeType===Je.text&&(n=e.textContent,me([y,fe,pe],e=>{n=Se(n,e,` `)}),e.textContent!==n&&(_e(t.removed,{element:e.cloneNode()}),e.textContent=n)),q(_.afterSanitizeElements,e,null),!1)},Nt=function(e,t,r){if(et[t]||ot&&(t===`id`||t===`name`)&&(r in n||r in St))return!1;if(!(k&&!et[t]&&x(S,t))&&!(tt&&x(Ee,t))&&!(O.attributeCheck instanceof Function&&O.attributeCheck(t,e))){if(!E[t]||et[t]){if(!(Pt(e)&&(D.tagNameCheck instanceof RegExp&&x(D.tagNameCheck,e)||D.tagNameCheck instanceof Function&&D.tagNameCheck(e))&&(D.attributeNameCheck instanceof RegExp&&x(D.attributeNameCheck,t)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(t,e))||t===`is`&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&x(D.tagNameCheck,r)||D.tagNameCheck instanceof Function&&D.tagNameCheck(r))))return!1}else if(!dt[t]&&!x(He,Se(r,Be,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ce(r,`data:`)===0&&lt[e])&&!(A&&!x(De,Se(r,Be,``)))&&r)return!1}return!0},Pt=function(e){return e!==`annotation-xml`&&xe(e,Ve)},Ft=function(e){q(_.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||At(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=W(a),l=s,u=a===`value`?l:we(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,q(_.uponSanitizeAttribute,e,r),u=r.attrValue,st&&(c===`id`||c===`name`)&&(K(a,e),u=`user-content-`+u),nt&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){K(a,e);continue}if(c===`attributename`&&xe(u,`href`)){K(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){K(a,e);continue}if(!j&&x(/\/>/i,u)){K(a,e);continue}M&&me([y,fe,pe],e=>{u=Se(u,e,` `)});let d=W(e.nodeName);if(!Nt(d,c,u)){K(a,e);continue}if(g&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=g.createHTML(u);break;case`TrustedScriptURL`:u=g.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),At(e)?G(e):ge(t.removed)}catch{K(a,e)}}q(_.afterSanitizeAttributes,e,null)},It=function e(t){let n=null,r=kt(t);for(q(_.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)q(_.uponSanitizeShadowNode,n,null),Mt(n),Ft(n),n.content instanceof a&&e(n.content);q(_.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(ht=!e,ht&&(e=`<!-->`),typeof e!=`string`&&!jt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Te(`dirty is not a string, aborting`)}else throw Te(`toString is not a function`);if(!t.isSupported)return e;if(P||wt(n),t.removed=[],typeof e==`string`&&(I=!1),I){if(e.nodeName){let t=W(e.nodeName);if(!T[t]||$e[t])throw Te(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=Ot(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Je.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!F&&!M&&!N&&e.indexOf(`<`)===-1)return g&&at?g.createHTML(e):e;if(i=Ot(e),!i)return F?null:at?ie:``}i&&rt&&G(i.firstChild);let u=kt(I?e:i);for(;c=u.nextNode();)Mt(c),Ft(c),c.content instanceof a&&It(c.content);if(I)return e;if(F){if(it)for(l=ce.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(E.shadowroot||E.shadowrootmode)&&(l=ue.call(r,l,!0)),l}let d=N?i.outerHTML:i.innerHTML;return N&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&x(Ke,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
1
+ import{Dt as e,Et as t,Nt as n,Tt as r,it as i,jt as a,ot as o,ut as s,wt as c}from"./DK3lEKRX.js";import{S as l,a as u,b as d,h as f,l as p,m,o as ee,p as h,y as te}from"./BaFk5JeE.js";import{c as ne,f as re,l as g,o as ie,s as ae,u as oe}from"./BJVrdkuG.js";var{entries:se,setPrototypeOf:ce,isFrozen:le,getPrototypeOf:ue,getOwnPropertyDescriptor:_}=Object,{freeze:v,seal:y,create:de}=Object,{apply:fe,construct:pe}=typeof Reflect<`u`&&Reflect;v||=function(e){return e},y||=function(e){return e},fe||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},pe||=function(e){return new e(...[...arguments].slice(1))};var me=S(Array.prototype.forEach),he=S(Array.prototype.lastIndexOf),ge=S(Array.prototype.pop),_e=S(Array.prototype.push),ve=S(Array.prototype.splice),ye=S(String.prototype.toLowerCase),be=S(String.prototype.toString),xe=S(String.prototype.match),Se=S(String.prototype.replace),Ce=S(String.prototype.indexOf),we=S(String.prototype.trim),b=S(Object.prototype.hasOwnProperty),x=S(RegExp.prototype.test),Te=Ee(TypeError);function S(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return fe(e,t,n)}}function Ee(e){return function(){return pe(e,[...arguments])}}function C(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ye;ce&&ce(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(le(t)||(t[r]=e),i=e)}e[i]=!0}return e}function De(e){for(let t=0;t<e.length;t++)b(e,t)||(e[t]=null);return e}function w(e){let t=de(null);for(let[n,r]of se(e))b(e,n)&&(Array.isArray(r)?t[n]=De(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=w(r):t[n]=r);return t}function Oe(e,t){for(;e!==null;){let n=_(e,t);if(n){if(n.get)return S(n.get);if(typeof n.value==`function`)return S(n.value)}e=ue(e)}function n(){return null}return n}var ke=v(`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(`.`)),Ae=v(`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(`.`)),je=v([`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`]),Me=v([`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`]),Ne=v(`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(`.`)),Pe=v([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Fe=v([`#text`]),Ie=v(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.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.slot`.split(`.`)),Le=v(`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.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-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(`.`)),Re=v(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.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(`.`)),ze=v([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Be=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ve=y(/<%[\w\W]*|[\w\W]*%>/gm),He=y(/\$\{[\w\W]*/gm),T=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ue=y(/^aria-[\-\w]+$/),We=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),E=y(/^(?:\w+script|data):/i),Ge=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ke=y(/^html$/i),D=y(/^[a-z][.\w]*(-[.\w]+)+$/i),qe=Object.freeze({__proto__:null,ARIA_ATTR:Ue,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:D,DATA_ATTR:T,DOCTYPE_NAME:Ke,ERB_EXPR:Ve,IS_ALLOWED_URI:We,IS_SCRIPT_OR_DATA:E,MUSTACHE_EXPR:Be,TMPLIT_EXPR:He}),Je={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ye=function(){return typeof window>`u`?null:window},Xe=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}},Ze=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Qe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ye(),t=e=>Qe(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Je.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,ee=Oe(m,`cloneNode`),h=Oe(m,`remove`),te=Oe(m,`nextSibling`),ne=Oe(m,`childNodes`),re=Oe(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let g,ie=``,{implementation:ae,createNodeIterator:oe,createDocumentFragment:ce,getElementsByTagName:le}=n,{importNode:ue}=r,_=Ze();t.isSupported=typeof se==`function`&&typeof re==`function`&&ae&&ae.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:y,ERB_EXPR:fe,TMPLIT_EXPR:pe,DATA_ATTR:S,ARIA_ATTR:Ee,IS_SCRIPT_OR_DATA:De,ATTR_WHITESPACE:Be,CUSTOM_ELEMENT:Ve}=qe,{IS_ALLOWED_URI:He}=qe,T=null,Ue=C({},[...ke,...Ae,...je,...Ne,...Fe]),E=null,Ge=C({},[...Ie,...Le,...Re,...ze]),D=Object.seal(de(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$e=null,et=null,O=Object.seal(de(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),tt=!0,k=!0,A=!1,j=!0,M=!1,nt=!0,N=!1,P=!1,rt=!1,F=!1,it=!1,at=!1,ot=!0,st=!1,ct=!0,I=!1,L={},R=null,z=C({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),lt=null,ut=C({},[`audio`,`video`,`img`,`source`,`image`,`track`]),dt=null,ft=C({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),pt=`http://www.w3.org/1998/Math/MathML`,mt=`http://www.w3.org/2000/svg`,B=`http://www.w3.org/1999/xhtml`,V=B,ht=!1,gt=null,_t=C({},[pt,mt,B],be),H=C({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),U=C({},[`annotation-xml`]),vt=C({},[`title`,`style`,`font`,`a`,`script`]),yt=null,bt=[`application/xhtml+xml`,`text/html`],W=null,xt=null,St=n.createElement(`form`),Ct=function(e){return e instanceof RegExp||e instanceof Function},wt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xt&&xt===e)){if((!e||typeof e!=`object`)&&(e={}),e=w(e),yt=bt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=yt===`application/xhtml+xml`?be:ye,T=b(e,`ALLOWED_TAGS`)?C({},e.ALLOWED_TAGS,W):Ue,E=b(e,`ALLOWED_ATTR`)?C({},e.ALLOWED_ATTR,W):Ge,gt=b(e,`ALLOWED_NAMESPACES`)?C({},e.ALLOWED_NAMESPACES,be):_t,dt=b(e,`ADD_URI_SAFE_ATTR`)?C(w(ft),e.ADD_URI_SAFE_ATTR,W):ft,lt=b(e,`ADD_DATA_URI_TAGS`)?C(w(ut),e.ADD_DATA_URI_TAGS,W):ut,R=b(e,`FORBID_CONTENTS`)?C({},e.FORBID_CONTENTS,W):z,$e=b(e,`FORBID_TAGS`)?C({},e.FORBID_TAGS,W):w({}),et=b(e,`FORBID_ATTR`)?C({},e.FORBID_ATTR,W):w({}),L=b(e,`USE_PROFILES`)?e.USE_PROFILES:!1,tt=e.ALLOW_ARIA_ATTR!==!1,k=e.ALLOW_DATA_ATTR!==!1,A=e.ALLOW_UNKNOWN_PROTOCOLS||!1,j=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,M=e.SAFE_FOR_TEMPLATES||!1,nt=e.SAFE_FOR_XML!==!1,N=e.WHOLE_DOCUMENT||!1,F=e.RETURN_DOM||!1,it=e.RETURN_DOM_FRAGMENT||!1,at=e.RETURN_TRUSTED_TYPE||!1,rt=e.FORCE_BODY||!1,ot=e.SANITIZE_DOM!==!1,st=e.SANITIZE_NAMED_PROPS||!1,ct=e.KEEP_CONTENT!==!1,I=e.IN_PLACE||!1,He=e.ALLOWED_URI_REGEXP||We,V=e.NAMESPACE||B,H=e.MATHML_TEXT_INTEGRATION_POINTS||H,U=e.HTML_INTEGRATION_POINTS||U,D=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ct(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(D.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ct(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(D.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(D.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),M&&(k=!1),it&&(F=!0),L&&(T=C({},Fe),E=de(null),L.html===!0&&(C(T,ke),C(E,Ie)),L.svg===!0&&(C(T,Ae),C(E,Le),C(E,ze)),L.svgFilters===!0&&(C(T,je),C(E,Le),C(E,ze)),L.mathMl===!0&&(C(T,Ne),C(E,Re),C(E,ze))),b(e,`ADD_TAGS`)||(O.tagCheck=null),b(e,`ADD_ATTR`)||(O.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?O.tagCheck=e.ADD_TAGS:(T===Ue&&(T=w(T)),C(T,e.ADD_TAGS,W))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?O.attributeCheck=e.ADD_ATTR:(E===Ge&&(E=w(E)),C(E,e.ADD_ATTR,W))),e.ADD_URI_SAFE_ATTR&&C(dt,e.ADD_URI_SAFE_ATTR,W),e.FORBID_CONTENTS&&(R===z&&(R=w(R)),C(R,e.FORBID_CONTENTS,W)),e.ADD_FORBID_CONTENTS&&(R===z&&(R=w(R)),C(R,e.ADD_FORBID_CONTENTS,W)),ct&&(T[`#text`]=!0),N&&C(T,[`html`,`head`,`body`]),T.table&&(C(T,[`tbody`]),delete $e.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Te(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);g=e.TRUSTED_TYPES_POLICY,ie=g.createHTML(``)}else g===void 0&&(g=Xe(p,i)),g!==null&&typeof ie==`string`&&(ie=g.createHTML(``));v&&v(e),xt=e}},Tt=C({},[...Ae,...je,...Me]),Et=C({},[...Ne,...Pe]),Dt=function(e){let t=re(e);(!t||!t.tagName)&&(t={namespaceURI:V,tagName:`template`});let n=ye(e.tagName),r=ye(t.tagName);return gt[e.namespaceURI]?e.namespaceURI===mt?t.namespaceURI===B?n===`svg`:t.namespaceURI===pt?n===`svg`&&(r===`annotation-xml`||H[r]):!!Tt[n]:e.namespaceURI===pt?t.namespaceURI===B?n===`math`:t.namespaceURI===mt?n===`math`&&U[r]:!!Et[n]:e.namespaceURI===B?t.namespaceURI===mt&&!U[r]||t.namespaceURI===pt&&!H[r]?!1:!Et[n]&&(vt[n]||!Tt[n]):!!(yt===`application/xhtml+xml`&&gt[e.namespaceURI]):!1},G=function(e){_e(t.removed,{element:e});try{re(e).removeChild(e)}catch{h(e)}},K=function(e,n){try{_e(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{_e(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(F||it)try{G(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ot=function(e){let t=null,r=null;if(rt)e=`<remove></remove>`+e;else{let t=xe(e,/^[\r\n\t ]+/);r=t&&t[0]}yt===`application/xhtml+xml`&&V===B&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=g?g.createHTML(e):e;if(V===B)try{t=new f().parseFromString(i,yt)}catch{}if(!t||!t.documentElement){t=ae.createDocument(V,`template`,null);try{t.documentElement.innerHTML=ht?ie:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),V===B?le.call(t,N?`html`:`body`)[0]:N?t.documentElement:a},kt=function(e){return oe.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},At=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},jt=function(e){return typeof s==`function`&&e instanceof s};function q(e,n,r){me(e,e=>{e.call(t,n,r,xt)})}let Mt=function(e){let n=null;if(q(_.beforeSanitizeElements,e,null),At(e))return G(e),!0;let r=W(e.nodeName);if(q(_.uponSanitizeElement,e,{tagName:r,allowedTags:T}),nt&&e.hasChildNodes()&&!jt(e.firstElementChild)&&x(/<[/\w!]/g,e.innerHTML)&&x(/<[/\w!]/g,e.textContent)||e.nodeType===Je.progressingInstruction||nt&&e.nodeType===Je.comment&&x(/<[/\w]/g,e.data))return G(e),!0;if(!(O.tagCheck instanceof Function&&O.tagCheck(r))&&(!T[r]||$e[r])){if(!$e[r]&&Pt(r)&&(D.tagNameCheck instanceof RegExp&&x(D.tagNameCheck,r)||D.tagNameCheck instanceof Function&&D.tagNameCheck(r)))return!1;if(ct&&!R[r]){let t=re(e)||e.parentNode,n=ne(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=ee(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,te(e))}}}return G(e),!0}return e instanceof c&&!Dt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&x(/<\/no(script|embed|frames)/i,e.innerHTML)?(G(e),!0):(M&&e.nodeType===Je.text&&(n=e.textContent,me([y,fe,pe],e=>{n=Se(n,e,` `)}),e.textContent!==n&&(_e(t.removed,{element:e.cloneNode()}),e.textContent=n)),q(_.afterSanitizeElements,e,null),!1)},Nt=function(e,t,r){if(et[t]||ot&&(t===`id`||t===`name`)&&(r in n||r in St))return!1;if(!(k&&!et[t]&&x(S,t))&&!(tt&&x(Ee,t))&&!(O.attributeCheck instanceof Function&&O.attributeCheck(t,e))){if(!E[t]||et[t]){if(!(Pt(e)&&(D.tagNameCheck instanceof RegExp&&x(D.tagNameCheck,e)||D.tagNameCheck instanceof Function&&D.tagNameCheck(e))&&(D.attributeNameCheck instanceof RegExp&&x(D.attributeNameCheck,t)||D.attributeNameCheck instanceof Function&&D.attributeNameCheck(t,e))||t===`is`&&D.allowCustomizedBuiltInElements&&(D.tagNameCheck instanceof RegExp&&x(D.tagNameCheck,r)||D.tagNameCheck instanceof Function&&D.tagNameCheck(r))))return!1}else if(!dt[t]&&!x(He,Se(r,Be,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ce(r,`data:`)===0&&lt[e])&&!(A&&!x(De,Se(r,Be,``)))&&r)return!1}return!0},Pt=function(e){return e!==`annotation-xml`&&xe(e,Ve)},Ft=function(e){q(_.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||At(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=W(a),l=s,u=a===`value`?l:we(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,q(_.uponSanitizeAttribute,e,r),u=r.attrValue,st&&(c===`id`||c===`name`)&&(K(a,e),u=`user-content-`+u),nt&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){K(a,e);continue}if(c===`attributename`&&xe(u,`href`)){K(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){K(a,e);continue}if(!j&&x(/\/>/i,u)){K(a,e);continue}M&&me([y,fe,pe],e=>{u=Se(u,e,` `)});let d=W(e.nodeName);if(!Nt(d,c,u)){K(a,e);continue}if(g&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=g.createHTML(u);break;case`TrustedScriptURL`:u=g.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),At(e)?G(e):ge(t.removed)}catch{K(a,e)}}q(_.afterSanitizeAttributes,e,null)},It=function e(t){let n=null,r=kt(t);for(q(_.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)q(_.uponSanitizeShadowNode,n,null),Mt(n),Ft(n),n.content instanceof a&&e(n.content);q(_.afterSanitizeShadowDOM,t,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(ht=!e,ht&&(e=`<!-->`),typeof e!=`string`&&!jt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw Te(`dirty is not a string, aborting`)}else throw Te(`toString is not a function`);if(!t.isSupported)return e;if(P||wt(n),t.removed=[],typeof e==`string`&&(I=!1),I){if(e.nodeName){let t=W(e.nodeName);if(!T[t]||$e[t])throw Te(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=Ot(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Je.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!F&&!M&&!N&&e.indexOf(`<`)===-1)return g&&at?g.createHTML(e):e;if(i=Ot(e),!i)return F?null:at?ie:``}i&&rt&&G(i.firstChild);let u=kt(I?e:i);for(;c=u.nextNode();)Mt(c),Ft(c),c.content instanceof a&&It(c.content);if(I)return e;if(F){if(it)for(l=ce.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(E.shadowroot||E.shadowrootmode)&&(l=ue.call(r,l,!0)),l}let d=N?i.outerHTML:i.innerHTML;return N&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&x(Ke,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
2
2
  `+d),M&&me([y,fe,pe],e=>{d=Se(d,e,` `)}),g&&at?g.createHTML(d):d},t.setConfig=function(){wt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),P=!0},t.clearConfig=function(){xt=null,P=!1},t.isValidAttribute=function(e,t,n){return xt||wt({}),Nt(W(e),W(t),n)},t.addHook=function(e,t){typeof t==`function`&&_e(_[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=he(_[e],t);return n===-1?void 0:ve(_[e],n,1)[0]}return ge(_[e])},t.removeHooks=function(e){_[e]=[]},t.removeAllHooks=function(){_=Ze()},t}var $e=Qe();function et(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var O=et();function tt(e){O=e}var k={exec:()=>null};function A(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(j.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var j={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},M=/^(?:[ \t]*(?:\n|$))+/,nt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,N=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,F=/(?:[*+-]|\d{1,9}[.)])/,it=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,at=A(it).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ot=A(it).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),st=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ct=/^[^\n]+/,I=/(?!\s*\])(?:\\.|[^\[\]\\])+/,L=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,I).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),R=A(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,F).getRegex(),z=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,lt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ut=A(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,lt).replace(`tag`,z).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),dt=A(st).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex(),ft={blockquote:A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,dt).getRegex(),code:nt,def:L,fences:N,heading:rt,hr:P,html:ut,lheading:at,list:R,newline:M,paragraph:dt,table:k,text:ct},pt=A(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex(),mt={...ft,lheading:ot,table:pt,paragraph:A(st).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,pt).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex()},B={...ft,html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,lt).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(st).replace(`hr`,P).replace(`heading`,` *#{1,6} *[^
3
3
  ]`).replace(`lheading`,at).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},V=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ht=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gt=/^( {2,}|\\)\n(?!\s*$)/,_t=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,H=/[\p{P}\p{S}]/u,U=/[\s\p{P}\p{S}]/u,vt=/[^\s\p{P}\p{S}]/u,yt=A(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,U).getRegex(),bt=/(?!~)[\p{P}\p{S}]/u,W=/(?!~)[\s\p{P}\p{S}]/u,xt=/(?:[^\s\p{P}\p{S}]|~)/u,St=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ct=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,wt=A(Ct,`u`).replace(/punct/g,H).getRegex(),Tt=A(Ct,`u`).replace(/punct/g,bt).getRegex(),Et=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Dt=A(Et,`gu`).replace(/notPunctSpace/g,vt).replace(/punctSpace/g,U).replace(/punct/g,H).getRegex(),G=A(Et,`gu`).replace(/notPunctSpace/g,xt).replace(/punctSpace/g,W).replace(/punct/g,bt).getRegex(),K=A(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,vt).replace(/punctSpace/g,U).replace(/punct/g,H).getRegex(),Ot=A(/\\(punct)/,`gu`).replace(/punct/g,H).getRegex(),kt=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),At=A(lt).replace(`(?:-->|$)`,`-->`).getRegex(),jt=A(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,At).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Mt=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,q).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nt=A(/^!?\[(label)\]\[(ref)\]/).replace(`label`,q).replace(`ref`,I).getRegex(),Pt=A(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,I).getRegex(),Ft={_backpedal:k,anyPunctuation:Ot,autolink:kt,blockSkip:St,br:gt,code:ht,del:k,emStrongLDelim:wt,emStrongRDelimAst:Dt,emStrongRDelimUnd:K,escape:V,link:Mt,nolink:Pt,punctuation:yt,reflink:Nt,reflinkSearch:A(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Nt).replace(`nolink`,Pt).getRegex(),tag:jt,text:_t,url:k},It={...Ft,link:A(/^!?\[(label)\]\((.*?)\)/).replace(`label`,q).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,q).getRegex()},Lt={...Ft,emStrongRDelimAst:G,emStrongLDelim:Tt,url:A(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Rt={...Lt,br:A(gt).replace(`{2,}`,`*`).getRegex(),text:A(Lt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},zt={normal:ft,gfm:mt,pedantic:B},Bt={normal:Ft,gfm:Lt,breaks:Rt,pedantic:It},Vt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ht=e=>Vt[e];function J(e,t){if(t){if(j.escapeTest.test(e))return e.replace(j.escapeReplace,Ht)}else if(j.escapeTestNoEncode.test(e))return e.replace(j.escapeReplaceNoEncode,Ht);return e}function Ut(e){try{e=encodeURI(e).replace(j.percentDecode,`%`)}catch{return null}return e}function Wt(e,t){let n=e.replace(j.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(j.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(j.slashPipe,`|`);return n}function Gt(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Kt(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Jt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
4
4
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
@@ -54,8 +54,8 @@ ${e}</tr>
54
54
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
55
55
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${J(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ut(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+J(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ut(e);if(i===null)return J(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${J(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:J(e.text)}},Zt=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},X=class e{options;renderer;textRenderer;constructor(e){this.options=e||O,this.options.renderer=this.options.renderer||new Xt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zt}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
56
56
  `+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Qt=class{options;block;constructor(e){this.options=e||O}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Y.lex:Y.lexInline}provideParser(){return this.block?X.parse:X.parseInline}},$t=class{defaults=et();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=X;Renderer=Xt;TextRenderer=Zt;Lexer=Y;Tokenizer=Yt;Hooks=Qt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Xt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Yt(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Qt;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Qt.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Y.lex(e,t??this.defaults)}parser(e,t){return X.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(t==null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?Y.lex:Y.lexInline,s=i.hooks?i.hooks.provideParser():e?X.parse:X.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then(e=>o(e,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>s(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=s(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
57
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+J(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},en=new $t;function Z(e,t){return en.parse(e,t)}Z.options=Z.setOptions=function(e){return en.setOptions(e),Z.defaults=en.defaults,tt(Z.defaults),Z},Z.getDefaults=et,Z.defaults=O,Z.use=function(...e){return en.use(...e),Z.defaults=en.defaults,tt(Z.defaults),Z},Z.walkTokens=function(e,t){return en.walkTokens(e,t)},Z.parseInline=en.parseInline,Z.Parser=X,Z.parser=X.parse,Z.Renderer=Xt,Z.TextRenderer=Zt,Z.Lexer=Y,Z.lexer=Y.lex,Z.Tokenizer=Yt,Z.Hooks=Qt,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,X.parse,Y.lex;var tn=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&tn(n)}),Object.freeze(e)),nn=tn({all:[],used:[],unused:[]}),rn=(e,t)=>{let n=$e(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},an=class{marked;currentReferences=nn;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new $t({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=rn(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+(?:\.\d+)?)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+(?:\.\d+)?)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=e.currentReferences.all,r=n.some(e=>e.citationId!==void 0)?n.findIndex(e=>e.citationId===t.refNumber):/^\d+$/.test(t.refNumber)?Number(t.refNumber)-1:-1,i=e.currentReferences.all[r];if(!i)return console.error(`Could not find ref for citation:`,t.refNumber),``;let a;return i?.referenceIndex.used?a=i.referenceIndex.used:(e.currentReferences.used.push(i),e.lastUsedIndex++,a=e.lastUsedIndex,i.referenceIndex.used=a),` <liipgpt-reference-number data-all-index="${r}" data-used-index="${a}" data-source="${JSON.stringify(i).replace(/"/g,`&quot;`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=nn,n}};function on(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var sn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=on();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},cn=class{hasValue=new sn;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},ln=e=>{try{return new URL(e).hostname}catch{return e}};function un(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var dn=({citationId:e,url:t,considered:n,title:r,description:i,summary:a})=>{let o=ln(t),s=i||a;return{...e?{citationId:e}:{},url:t,considered:n,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:s,badge:t},listItem:{title:r,badge:o}}}},fn=class{store;content=new cn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=n({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e){this.options.onError?.(e),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=un(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(dn(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},pn=[{type:`email`,check:e=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(e)},{type:`creditCard`,check:e=>/\b(?:\d[ -]*?){13,16}\b/.test(e)},{type:`ahv`,check:e=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(e)},{type:`phoneSwiss`,check:e=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(e)},{type:`phoneInternational`,check:e=>/(?:\+|00)(?:\s*\d){10,}\b/.test(e)},{type:`swissPassport`,check:e=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(e)},{type:`longNumber`,check:e=>/\b\d{9,}\b/.test(e)}],mn=e=>{for(let t of pn)if(t.check(e))return t.type},hn=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},gn=class{latestRequest=new cn;state=n({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},Q=[];for(let e=0;e<256;++e)Q.push((e+256).toString(16).slice(1));function _n(e,t=0){return(Q[e[t+0]]+Q[e[t+1]]+Q[e[t+2]]+Q[e[t+3]]+`-`+Q[e[t+4]]+Q[e[t+5]]+`-`+Q[e[t+6]]+Q[e[t+7]]+`-`+Q[e[t+8]]+Q[e[t+9]]+`-`+Q[e[t+10]]+Q[e[t+11]]+Q[e[t+12]]+Q[e[t+13]]+Q[e[t+14]]+Q[e[t+15]]).toLowerCase()}var vn,yn=new Uint8Array(16);function bn(){if(!vn){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);vn=crypto.getRandomValues.bind(crypto)}return vn(yn)}var xn={};function Sn(e,t,n){let r;if(e)r=wn(e.random??e.rng?.()??bn(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=bn();Cn(xn,e,i),r=wn(i,xn.msecs,xn.seq,t,n)}return t??_n(r)}function Cn(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function wn(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Tn=new Map,En=class{get length(){return Tn.size}clear(){Tn.clear()}getItem(e){return Tn.get(e)||null}key(e){return Array.from(Tn.keys())[e]||null}removeItem(e){Tn.delete(e)}setItem(e,t){Tn.set(e,String(t))}},Dn=globalThis.localStorage??new En,On=async(e,t)=>{try{let n=Dn.getItem(`liipgpt:uID`)||Dn.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,ne,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,ne,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return Dn.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},$=function(e,t){if(!(this instanceof $))return new $(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=$.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState($.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
57
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+J(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},en=new $t;function Z(e,t){return en.parse(e,t)}Z.options=Z.setOptions=function(e){return en.setOptions(e),Z.defaults=en.defaults,tt(Z.defaults),Z},Z.getDefaults=et,Z.defaults=O,Z.use=function(...e){return en.use(...e),Z.defaults=en.defaults,tt(Z.defaults),Z},Z.walkTokens=function(e,t){return en.walkTokens(e,t)},Z.parseInline=en.parseInline,Z.Parser=X,Z.parser=X.parse,Z.Renderer=Xt,Z.TextRenderer=Zt,Z.Lexer=Y,Z.lexer=Y.lex,Z.Tokenizer=Yt,Z.Hooks=Qt,Z.parse=Z,Z.options,Z.setOptions,Z.use,Z.walkTokens,Z.parseInline,X.parse,Y.lex;var tn=e=>(Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t];n&&typeof n==`object`&&tn(n)}),Object.freeze(e)),nn=tn({all:[],used:[],unused:[]}),rn=(e,t)=>{let n=$e(e);return n.addHook(`uponSanitizeElement`,function(e,t){let n=t.tagName||e.nodeName.toLowerCase();n.startsWith(`liipgpt-`)&&(t.allowedTags[n]=!0)}),n.addHook(`afterSanitizeAttributes`,function(e){if(e.tagName!==`A`||!e.getAttribute(`href`)?.startsWith(`http`)||(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`),!t||e.querySelector(`.sr-only`)))return;let n=e.ownerDocument.createElement(`span`);n.className=`sr-only`,n.textContent=` ${t}`,e.appendChild(n)}),n},an=class{marked;currentReferences=nn;lastUsedIndex=0;DomPurity;constructor(e={}){this.marked=new $t({async:!1,breaks:!0}).use(this.createFootnoteExtension(),...e.extensions??[]),this.DomPurity=rn(e.window,e.newTabSrText)}createFootnoteExtension=()=>{let e=this;return{extensions:[{name:`footnote`,level:`inline`,start(e){return e.match(/\[\^(\d+(?:\.\d+)?)\]/)?.index},tokenizer(e){let t=/^\[\^(\d+(?:\.\d+)?)\]/.exec(e);if(t){let[e,n]=t;return{type:`footnote`,raw:e,refNumber:n}}},renderer(t){if(t.type===`footnote`){let n=e.currentReferences.all,r=n.some(e=>e.citationId!==void 0)?n.findIndex(e=>e.citationId===t.refNumber):/^\d+$/.test(t.refNumber)?Number(t.refNumber)-1:-1,i=e.currentReferences.all[r];if(!i)return console.error(`Could not find ref for citation:`,t.refNumber),``;let a;return i?.referenceIndex.used?a=i.referenceIndex.used:(e.currentReferences.used.push(i),e.lastUsedIndex++,a=e.lastUsedIndex,i.referenceIndex.used=a),` <liipgpt-reference-number data-all-index="${r}" data-used-index="${a}" data-source="${JSON.stringify(i).replace(/"/g,`&quot;`)}"></liipgpt-reference-number>`}}}]}};parse(e){return this.DomPurity.sanitize(this.marked.parse(e),{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0,mathMl:!0},FORBID_TAGS:[`hr`],ADD_ATTR:[`target`]})}toHTML(e,t){this.currentReferences=t;let n=this.parse(e);return this.currentReferences=nn,n}};function on(){let e,t;return{promise:new Promise((n,r)=>{t=n,e=r}),reject:e,resolve:t}}var sn=class{promise;resolve;reject;constructor(){let{promise:e,resolve:t,reject:n}=on();this.promise=e,this.resolve=t,this.reject=n}then(e,t){return this.promise.then(e,t)}catch(e){return this.promise.catch(e)}finally(e){return this.promise.finally(e)}toPromise(){return this.promise}[Symbol.toStringTag]=`Flag`},cn=class{hasValue=new sn;currentValue;setValue(e){this.currentValue=e,this.hasValue.resolve()}cleanup(e){this.hasValue.reject(e)}getCurrentValue(){return this.currentValue}async toPromise(){return await this.hasValue,this.currentValue}then(e,t){return this.toPromise().then(e,t)}catch(e){return this.toPromise().catch(e)}finally(e){return this.toPromise().finally(e)}[Symbol.toStringTag]=`FutureValue`},ln=e=>{try{return new URL(e).hostname}catch{return e}};function un(e){return e.replace(/<[^>]*>/g,``).replace(/&nbsp;/g,` `).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`)}var dn=({citationId:e,url:t,considered:n,title:r,description:i,summary:a})=>{let o=ln(t),s=i||a;return{...e?{citationId:e}:{},url:t,considered:n,referenceIndex:{},score:0,metadata:{},display:{card:{title:r,description:s,badge:t},listItem:{title:r,badge:o}}}},fn=class{store;content=new cn;backendSendsMappedRefs=!1;constructor(e){this.options=e,this.store=n({id:e.id,state:`loading`,errors:[],type:`bot`,time:new Date().toISOString(),message:{markdown:``,html:``,text:``},references:{all:[],used:[],unused:[]},retrievalQuestion:e.userQuestion})}pushError(e,t){this.options.onError?.(e,t),this.store.update(t=>({...t,errors:[...t.errors,e]}))}updateRequestId(e){this.store.update(t=>({...t,id:e}))}updateText(e){this.store.update(t=>{let n=t.message.markdown+e,r=this.options.markdownRenderer.toHTML(n,t.references);return{...t,state:`streaming`,message:{markdown:n,html:r,text:``}}})}finishMessage(){this.store.update(e=>{let t={...e,state:`done`};return t.references.unused=t.references.all.filter(e=>e.referenceIndex.used===void 0),t.message.text=un(t.message.html),this.options?.onFinish?.(t),this.content.setValue(t),t})}addReference(e){this.store.update(t=>{let n=t.references.all,r=n.length,i=[...n,{...e,referenceIndex:{all:r}}];return{...t,references:{used:t.references.used,all:i}}})}addMappedReference(e){this.backendSendsMappedRefs=!0,this.addReference(e)}addOldReference(e){this.backendSendsMappedRefs||this.addReference(dn(e))}updateRetrievalQuestion(e){this.store.update(t=>({...t,retrievalQuestion:e}))}setNoFeedback(){this.store.update(e=>({...e,noFeedback:!0}))}getReadableStore(){return{subscribe:this.store.subscribe}}getPromise(){return this.content.toPromise()}},pn=[{type:`email`,check:e=>/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/.test(e)},{type:`creditCard`,check:e=>/\b(?:\d[ -]*?){13,16}\b/.test(e)},{type:`ahv`,check:e=>/\b756\.\d{4}\.\d{4}\.\d{2}\b/.test(e)},{type:`phoneSwiss`,check:e=>/\b0(?:\s*\d){2}(?:\s*\/\s*)?(?:\s*\d){7,}\b/.test(e)},{type:`phoneInternational`,check:e=>/(?:\+|00)(?:\s*\d){10,}\b/.test(e)},{type:`swissPassport`,check:e=>/\b[A-HJ-NP-Z](?=.*\d)[A-HJ-NP-Z0-9]{7}\b/.test(e)},{type:`longNumber`,check:e=>/\b\d{9,}\b/.test(e)}],mn=e=>{for(let t of pn)if(t.check(e))return t.type},hn=class{id;constructor(e){this.chatResponseData=e,this.id=this.chatResponseData.id}async isReadyForFeedback(){return await this.chatResponseData.readyForFeedback.toPromise(),!0}subscribe(e,t){return this.chatResponseData.readableStore.subscribe(e,t)}getContent(){return this.chatResponseData.content.toPromise()}abort(){return this.chatResponseData.abort()}async thumbsUp(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsUp(this.id,this.chatResponseData.question)}async thumbsDown(){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.thumbsDown(this.id,this.chatResponseData.question)}async feedback(e){await this.isReadyForFeedback(),await this.chatResponseData.liipgptClientPrimitive.feedback(this.id,this.chatResponseData.question,e)}},gn=class{latestRequest=new cn;state=n({state:`idle`});id;history=[];constructor(e){this.clientPrimitive=e,this.id=e.createConversationId()}subscribe(e){return this.state.subscribe(e)}chat(e,t={}){let n=this.clientPrimitive.chat(this.id,e,t);return this.history.push(n),this.latestRequest.setValue({question:e,response:n}),n}async abort(){let e=this.history.map(e=>e.abort());await Promise.all(e)}async thumbsUp(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsUp(t.id,e)}async thumbsDown(){let{question:e,response:t}=await this.latestRequest;await t.isReadyForFeedback(),await this.clientPrimitive.thumbsDown(t.id,e)}async feedback(e){let{question:t,response:n}=await this.latestRequest;await n.isReadyForFeedback(),await this.clientPrimitive.feedback(n.id,t,e)}},Q=[];for(let e=0;e<256;++e)Q.push((e+256).toString(16).slice(1));function _n(e,t=0){return(Q[e[t+0]]+Q[e[t+1]]+Q[e[t+2]]+Q[e[t+3]]+`-`+Q[e[t+4]]+Q[e[t+5]]+`-`+Q[e[t+6]]+Q[e[t+7]]+`-`+Q[e[t+8]]+Q[e[t+9]]+`-`+Q[e[t+10]]+Q[e[t+11]]+Q[e[t+12]]+Q[e[t+13]]+Q[e[t+14]]+Q[e[t+15]]).toLowerCase()}var vn,yn=new Uint8Array(16);function bn(){if(!vn){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);vn=crypto.getRandomValues.bind(crypto)}return vn(yn)}var xn={};function Sn(e,t,n){let r;if(e)r=wn(e.random??e.rng?.()??bn(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=bn();Cn(xn,e,i),r=wn(i,xn.msecs,xn.seq,t,n)}return t??_n(r)}function Cn(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function wn(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Tn=new Map,En=class{get length(){return Tn.size}clear(){Tn.clear()}getItem(e){return Tn.get(e)||null}key(e){return Array.from(Tn.keys())[e]||null}removeItem(e){Tn.delete(e)}setItem(e,t){Tn.set(e,String(t))}},Dn=globalThis.localStorage??new En,On=async(e,t)=>{try{let n=Dn.getItem(`liipgpt:uID`)||Dn.getItem(`uID`),r={method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({referrer:globalThis?.document?.referrer||null,uID:n,...t?{startParameters:t}:{}})},i=await e.fetchData(`/login`,ne,{},r).catch(t=>(console.log(`Failed to /login use /log`,t),e.fetchData(`/log`,ne,{},r)));if(`maintenance`in i&&i.maintenance)return{mode:`maintenance`};if(!(`id`in i))throw Error(`Invalid response format: missing user id`);return Dn.setItem(`liipgpt:uID`,i.id),{mode:`ready`,userId:i.id}}catch(e){throw console.error(`Failed to fetch user data:`,e),e}},$=function(e,t){if(!(this instanceof $))return new $(e,t);this.url=e,t||={},this.headers=t.headers||{},this.payload=t.payload===void 0?``:t.payload,this.method=t.method||this.payload&&`POST`||`GET`,this.withCredentials=!!t.withCredentials,this.debug=!!t.debug,this.autoReconnect=t.autoReconnect===void 0?!1:t.autoReconnect,this.reconnectDelay=t.reconnectDelay===void 0?3e3:t.reconnectDelay,this.maxRetries=t.maxRetries===void 0?null:t.maxRetries,this.retryCount=0,this.reconnectTimer=null,this.useLastEventId=t.useLastEventId===void 0?!0:t.useLastEventId,this.FIELD_SEPARATOR=`:`,this.listeners={},this.xhr=null,this.readyState=$.INITIALIZING,this.progress=0,this.chunk=``,this.lastEventId=``,this._hasParsedBom=!1,this.addEventListener=function(e,t){this.listeners[e]===void 0&&(this.listeners[e]=[]),this.listeners[e].indexOf(t)===-1&&this.listeners[e].push(t)},this.removeEventListener=function(e,t){if(this.listeners[e]===void 0)return;let n=[];this.listeners[e].forEach(function(e){e!==t&&n.push(e)}),n.length===0?delete this.listeners[e]:this.listeners[e]=n},this.dispatchEvent=function(e){if(!e)return!0;this.debug&&console.debug(e),e.source=this;let t=`on`+e.type;return this.hasOwnProperty(t)&&(this[t].call(this,e),e.defaultPrevented)?!1:this.listeners[e.type]?this.listeners[e.type].every(function(t){return t(e),!e.defaultPrevented}):!0},this._markClosed=function(){if(this.xhr=null,this.progress=0,this.chunk=``,this._setReadyState($.CLOSED),this.autoReconnect){if(this.maxRetries!==null&&this.retryCount>=this.maxRetries){this.debug&&console.debug(`SSE max retries (${this.maxRetries}) reached, stopping reconnection attempts`),this.autoReconnect=!1,this.close();return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.debug&&console.debug(`SSE will attempt to reconnect in ${this.reconnectDelay}ms (attempt ${this.retryCount+1}${this.maxRetries?`/`+this.maxRetries:``})`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.retryCount++,this.stream()},this.reconnectDelay)}},this._setReadyState=function(e){let t=new CustomEvent(`readystatechange`);t.readyState=e,this.readyState=e,this.dispatchEvent(t)},this._onStreamFailure=function(e){let t=new CustomEvent(`error`);t.responseCode=e.currentTarget.status,t.data=e.currentTarget.response,this.dispatchEvent(t),this._markClosed()},this._onStreamAbort=function(){this.dispatchEvent(new CustomEvent(`abort`)),this._markClosed()},this._onStreamProgress=function(e){if(!this.xhr)return;if(this.xhr.status<200||this.xhr.status>=300){this._onStreamFailure(e);return}this.retryCount=0;let t=this.xhr.responseText.substring(this.progress);this.progress+=t.length,!this._hasParsedBom&&this.chunk.length===0&&(t.charCodeAt(0)===65279&&(t=t.substring(1)),this._hasParsedBom=!0);let n=(this.chunk+t).split(/(\r\n\r\n|\r\r|\n\n)/g),r=n.pop();n.forEach(function(e){e.trim().length>0&&this.dispatchEvent(this._parseEventChunk(e))}.bind(this)),this.chunk=r},this._onStreamLoaded=function(e){this._onStreamProgress(e),this.dispatchEvent(this._parseEventChunk(this.chunk)),this.chunk=``,this._markClosed()},this._parseEventChunk=function(e){if(!e||e.length===0)return null;this.debug&&console.debug(e);let t={id:null,retry:null,data:null,event:null};if(e.split(/\n|\r\n|\r/).forEach(function(e){let n=e.indexOf(this.FIELD_SEPARATOR),r,i;if(n>0){let t=e[n+1]===` `?2:1;r=e.substring(0,n),i=e.substring(n+t)}else if(n<0)r=e,i=``;else return;r in t&&(r===`data`&&t[r]!==null?t.data+=`
58
58
  `+i:t[r]=i)}.bind(this)),t.id!==null&&t.id.indexOf(`\0`)===-1&&(this.lastEventId=t.id),t.retry!==null&&/^[0-9]+$/.test(t.retry)&&(this.reconnectDelay=parseInt(t.retry,10)),t.data===null)return null;let n=new CustomEvent(t.event||`message`);return n.id=t.id,n.data=t.data||``,n.lastEventId=this.lastEventId,n},this._onReadyStateChange=function(){if(this.xhr&&this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED){let e={},t=this.xhr.getAllResponseHeaders().trim().split(`\r
59
59
  `);for(let n of t){let[t,...r]=n.split(`:`),i=r.join(`:`).trim();e[t.trim().toLowerCase()]=e[t.trim().toLowerCase()]||[],e[t.trim().toLowerCase()].push(i)}let n=new CustomEvent(`open`);n.responseCode=this.xhr.status,n.headers=e,this.dispatchEvent(n),this._setReadyState($.OPEN)}},this.stream=function(){if(!this.xhr){this._setReadyState($.CONNECTING),this.xhr=new XMLHttpRequest,this.xhr.addEventListener(`progress`,this._onStreamProgress.bind(this)),this.xhr.addEventListener(`load`,this._onStreamLoaded.bind(this)),this.xhr.addEventListener(`readystatechange`,this._onReadyStateChange.bind(this)),this.xhr.addEventListener(`error`,this._onStreamFailure.bind(this)),this.xhr.addEventListener(`abort`,this._onStreamAbort.bind(this)),this.xhr.open(this.method,this.url);for(let e in this.headers)this.xhr.setRequestHeader(e,this.headers[e]);this.useLastEventId&&this.lastEventId.length>0&&this.xhr.setRequestHeader(`Last-Event-ID`,this.lastEventId),this.xhr.withCredentials=this.withCredentials,this.xhr.send(this.payload)}},this.close=function(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.autoReconnect=!1,this.xhr&&this.xhr.abort()},(t.start===void 0||t.start)&&this.stream()};$.INITIALIZING=-1,$.CONNECTING=0,$.OPEN=1,$.CLOSED=2;var kn=class{eventSource;triggeredOnClose=!1;constructor(e,t,n){this.options=t,this.payload=n;let r={headers:{"content-type":`application/json`}};n&&(r.payload=JSON.stringify(n)),t.apiKey&&(r.headers[`api-key`]=t.apiKey),this.eventSource=new(t.EventSource??$)(e,r),this.eventSource.onmessage=e=>{try{let n=JSON.parse(e.data);t.onMessage(n)}catch(e){t.onError(new CustomEvent(`parse-error`,{detail:e}))}},this.eventSource.onerror=e=>{t.onError(e),this.isClosed()&&this.close()}}isClosed(){return this.eventSource.readyState===EventSource.CLOSED}close(){this.isClosed()||this.eventSource.close(),this.triggeredOnClose||(this.triggeredOnClose=!0,this.options.onClose())}},An=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!=null)),jn=class{constructor(e){this.options=e}getDefaultHeaders(e={}){let t={"Content-Type":`application/json`,...e};return this.options.apiKey&&(t[`api-key`]=this.options.apiKey),t}get speechRecognitionApiKey(){return this.options.speechRecognitionApiKey}async subscribeSse(e,t={},n){let r=An(t);return this.options.apiKey&&(n.apiKey=this.options.apiKey),new kn(`${this.options.apiUrl}${e}`,n,r)}async fetchData(e,t,n={},r={}){let i=`${this.options.apiUrl}${e}?${new URLSearchParams(An(n)).toString()}`,a={...r,headers:this.getDefaultHeaders(r?.headers)},o=await fetch(i,a);if(!o.ok){let e=await o.text();throw Error(`API request failed: ${o.status} - ${e}`)}let s=await o.json(),{success:c,data:l,error:u}=t.safeParse(s);if(this.options.strict){if(!c)throw console.error(`Server response has wrong type:
60
60
  `,{error:u,url:i,opts:a,data:s}),Error(`Server response has wrong type: ${u.message}`);return l}else return c||console.warn(`Server response has wrong type:
61
- `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Mn=m({links:u(d([m({url:f(l()),title:f(te()),considered:f(ee()),orgMetadata:f(m({authors:f(u(te()))})),type:f(te()),date:f(re()),similarity:f(h()),content:f(te()),fromFullTextSearch:f(ee()),rerank:f(m({index:f(p()),adjustment:f(h()),score:f(h()),similarityOld:f(h())}))}),oe]))}),Nn=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Pn=7,Fn=8,In=160,Ln=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Rn=e=>{let t=Ln(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},zn=e=>Math.max(Fn,Math.min(In,e.length*Pn)),Bn=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Rn(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:zn(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Vn=class{constructor(e){this.results=e}},Hn=45e3,Un=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;chatTimeout;constructor(e){this.chatTimeout=e.chatTimeout??Hn;let t=new jn({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:On(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=Sn();return this.renderers.set(e,new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new cn,i=Sn(),a=new sn,o=new fn({id:i,onError:e=>{n.onError?.(e)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,!(f&&!c.getCurrentValue())&&(await c).close()},c=new cn,l=new Bn(e=>o.updateText(e)),u=n.timeout??this.chatTimeout,d,f=!1,p=()=>{d!==void 0&&clearTimeout(d),d=void 0},m=()=>{f=!0,d=void 0,console.error(`No SSE activity for ${u}ms, giving up on chat request ${i}`),l.clear(),o.pushError(`sse-error`);let e=c.getCurrentValue();if(e){e.close();return}o.finishMessage(),a.resolve()},ee=()=>{p(),u>0&&!f&&(d=setTimeout(m,u))};ee(),(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{p(),l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(ee(),r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:p(),l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u),f&&u.close()})();let h=new hn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(h.id,h),h}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Mn,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Vn(i.map(Nn))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,ie)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=g.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,ae,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},Wn=class{clientPrimitive;constructor(e){this.clientPrimitive=new Un(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new gn(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},Gn=class extends Map{#e=new Map;#t=e(0);#n=e(0);#r=s||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(n){return s===this.#r?e(n):t(n)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return o(this.#t),!1;return o(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{o(this.#t);return}return o(n),super.get(e)}set(e,t){var n=this.#e,i=n.get(e),a=super.get(e),o=super.set(e,t),s=this.#t;if(i===void 0)i=this.#i(0),n.set(e,i),r(this.#n,super.size),c(s);else if(a!==t){c(i);var l=s.reactions===null?null:new Set(s.reactions);(l===null||!i.reactions?.every(e=>l.has(e)))&&c(s)}return o}delete(e){var t=this.#e,n=t.get(e),i=super.delete(e);return n!==void 0&&(t.delete(e),r(n,-1)),i&&(r(this.#n,super.size),c(this.#t)),i}clear(){if(super.size!==0){super.clear();var e=this.#e;r(this.#n,0);for(var t of e.values())r(t,-1);c(this.#t),e.clear()}}#a(){o(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},Kn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},qn=/\(.+\)/,Jn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Yn=class extends Kn{constructor(e,t){let n=qn.test(e)||e.split(/[\s,]+/).some(e=>Jn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}};function Xn(e){return e}function Zn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Qn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function $n(e){return e**4}function er(e){return(e-1)**3*(1-e)+1}function tr(e){return--e*e*e*e*e+1}export{mn as _,er as a,$e as b,Gn as c,zn as d,Rn as f,pn as g,_n as h,Qn as i,Wn as l,bn as m,Xn as n,tr as o,Dn as p,$n as r,Yn as s,Zn as t,Un as u,un as v,an as y};
61
+ `,{error:u,url:i,opts:a,data:s}),s}async postData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,headers:this.getDefaultHeaders(),body:JSON.stringify(t)});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}async postFormData(e,t){let n=await fetch(`${this.options.apiUrl}${e}`,{method:`POST`,body:t});if(!n.ok){let e=await n.text();throw Error(`${n.status} - ${e}`)}return n}},Mn=m({links:u(d([m({url:f(l()),title:f(te()),considered:f(ee()),orgMetadata:f(m({authors:f(u(te()))})),type:f(te()),date:f(re()),similarity:f(h()),content:f(te()),fromFullTextSearch:f(ee()),rerank:f(m({index:f(p()),adjustment:f(h()),score:f(h()),similarityOld:f(h())}))}),oe]))}),Nn=e=>{if(`metadata`in e)return e;console.warn(`Please upgrade your backend you are currently using an old api feature.`);let t=e.orgMetadata??{};e?.fromFullTextSearch&&(t.fromFullTextSearch=e?.fromFullTextSearch),e?.rerank&&(t.rerank=e?.rerank);let n=[],r=e.title??``;if(e.title&&e.title.includes(` > `)){let t=e.title.split(` > `);r=t.pop()??``,n=t}return{url:e.url??``,title:r,score:e.similarity||0,breadcrumbs:n,metadata:t,description:e.content,date:e.date}},Pn=7,Fn=8,In=160,Ln=e=>{let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`<`){let r=e.indexOf(`>`,n);if(r!==-1){t.push({type:`tag`,value:e.slice(n,r+1)}),n=r+1;continue}}if(/\s/.test(r)){let r=n;for(;r<e.length&&/\s/.test(e[r]);)r++;t.push({type:`space`,value:e.slice(n,r)}),n=r;continue}let i=n;for(;i<e.length&&!/\s/.test(e[i])&&e[i]!==`<`;)i++;t.push({type:`word`,value:e.slice(n,i)}),n=i}return t},Rn=e=>{let t=Ln(e),n=[],r=``,i=!1;for(let e of t)e.type===`space`&&i?(n.push(r),r=e.value,i=!1):(r+=e.value,e.type===`word`&&(i=!0));return r&&n.push(r),n},zn=e=>Math.max(Fn,Math.min(In,e.length*Pn)),Bn=class{queue=[];timeoutId=null;isProcessing=!1;constructor(e){this.onText=e}ingestText(e){let t=Rn(e);if(t.length>=5){for(let e of t)this.queue.push({kind:`text`,chunk:e,delayMs:zn(e)});this.kickoff();return}this.runAfterTyping(()=>this.onText(e))}runAfterTyping(e){if(this.queue.length===0&&!this.isProcessing){e();return}this.queue.push({kind:`fn`,fn:e}),this.kickoff()}runWithWarmup(e){this.queue.push({kind:`fn`,fn:e}),this.kickoff()}clear(){this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.queue=[],this.isProcessing=!1}kickoff(){this.isProcessing||this.timeoutId!==null||(this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},750))}processNext(){let e=this.queue.shift();if(!e){this.isProcessing=!1;return}this.isProcessing=!0,e.kind===`text`?(this.onText(e.chunk),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.processNext()},e.delayMs)):(e.fn(),this.processNext())}},Vn=class{constructor(e){this.results=e}},Hn=45e3,Un=class{internalData;renderers=new Map;markedExtensions=[];_newTabSrText;chatTimeout;constructor(e){this.chatTimeout=e.chatTimeout??Hn;let t=new jn({apiUrl:e.apiUrl,apiKey:e.apiKey,speechRecognitionApiKey:e.speechRecognitionApiKey,strict:e.strict??!1,EventSource:e.EventSource??EventSource});this.internalData={restClient:t,metadata:On(t,e.startParameters),searchResponseMap:new Map,chatResponseMap:new Map,conversationMap:new Map}}setMarkedExtensions(...e){this.markedExtensions=e}setNewTabSrText(e){this._newTabSrText=e}getMetadata(){return this.internalData.metadata}createConversationId(){let e=Sn();return this.renderers.set(e,new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText})),e}chat(e,t,n={}){let r=new cn,i=Sn(),a=new sn,o=new fn({id:i,onError:(e,t)=>{n.onError?.(e,t)},onFinish:e=>{r.setValue(e)},markdownRenderer:this.renderers.get(e)??new an({extensions:this.markedExtensions,newTabSrText:this._newTabSrText}),userQuestion:t}),s=async()=>{await a,!(f&&!c.getCurrentValue())&&(await c).close()},c=new cn,l=new Bn(e=>o.updateText(e)),u=n.timeout??this.chatTimeout,d,f=!1,p=()=>{d!==void 0&&clearTimeout(d),d=void 0},m=()=>{f=!0,d=void 0,console.error(`No SSE activity for ${u}ms, giving up on chat request ${i}`),l.clear(),o.pushError(`sse-error`);let e=c.getCurrentValue();if(e){e.close();return}o.finishMessage(),a.resolve()},ee=()=>{p(),u>0&&!f&&(d=setTimeout(m,u))};ee(),(async()=>{let s=await this.internalData.metadata;if(s.mode===`maintenance`)throw Error(`Can not chat in maintenance mode`);let u=await this.internalData.restClient.subscribeSse(`/assistant/sse`,{query:t,uID:s.userId,cID:e,rID:i,lang:n.lang,feature:n.features?.join(`,`),referrer:n.referrer,source:n.source,...n.selectorValues??{},...n.mode?{mode:n.mode}:{},...n.cache?{cache:!0}:{},...n.predefinedQuestionId?{predefinedQuestionId:n.predefinedQuestionId}:{},...n.switchQuestionId?{switchQuestionId:n.switchQuestionId}:{},chat:`true`,version:`2`},{onClose:()=>{p(),l.clear(),o.finishMessage(),a.resolve(),r.cleanup()},onMessage:t=>{let r=t;switch(ee(),r.type){case`error`:l.runAfterTyping(()=>o.pushError(r.error,r.message));break;case`id`:r.for===`request`&&i!==r.id&&console.warn(`Unexpected request id "${r.id}" expected "${i}"`),r.for===`conversation`&&e!==r.id&&console.warn(`Unexpected conversation id "${r.id}" expected "${e}"`);break;case`state`:r.state===`history-entry-initialized`&&a.resolve();break;case`text`:l.ingestText(r.text);break;case`done`:case`answer-done`:p(),l.runAfterTyping(()=>{o.finishMessage(),a.resolve(),c.then(e=>e.close())});break;case`unexpected-call`:l.runAfterTyping(()=>{console.error(`unexpected-call:`,r),o.pushError(`unexpected-call`)});break;case`jsonld-component`:case`mapped-reference`:l.runAfterTyping(()=>o.addMappedReference(r.reference));break;case`reference`:l.runAfterTyping(()=>o.addOldReference(r.reference));break;case`retrieval-question`:l.runAfterTyping(()=>o.updateRetrievalQuestion(r.question));break;case`no-feedback`:l.runAfterTyping(()=>o.setNoFeedback());break;case`component`:l.runWithWarmup(()=>n.onEmbed?.(r));break}l.runAfterTyping(()=>n.onMessage?.(r))},onError:e=>{console.error(` sse-error:`,e),!(`data`in e&&!e.data&&`responseCode`in e&&e.responseCode===0)&&o.pushError(`sse-error`)}});c.setValue(u),f&&u.close()})();let h=new hn({question:t,id:i,content:r,readableStore:o.getReadableStore(),readyForFeedback:a,abort:s,liipgptClientPrimitive:this});return this.internalData.chatResponseMap.set(h.id,h),h}async thumbs(e,t,n){if((await this.internalData.metadata).mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);let r={feedback:n,rID:e,query:t};await this.internalData.restClient.postData(`/quickfeedback`,r)}thumbsUp(e,t){return this.thumbs(e,t,`positive`)}thumbsDown(e,t){return this.thumbs(e,t,`negative`)}async feedback(e,t,n){let r=await this.internalData.metadata;if(r.mode!==`ready`)throw Error(`Can not post feedback unless we are in ready mode`);if(n.message){let i={body:n.message,email:n.email,rID:e,uID:r.userId,query:t};await this.internalData.restClient.postData(`/feedback`,i)}n.classification&&await this.internalData.restClient.postData(`/classification`,{impact:n.classification.impact,quality:n.classification.quality,rID:e})}async submitAnswerForm(e){let t=await this.internalData.metadata;if(t.mode!==`ready`)throw Error(`Can not submit the answer form unless we are in ready mode`);let n={receiverEmail:e.receiverEmail,fields:e.fields,query:e.question,answer:e.answer,rID:e.requestId,uID:t.userId,lang:e.lang};await this.internalData.restClient.postData(`/customform`,n)}async userAction(e,t={}){let n=await this.internalData.metadata;if(n.mode!==`ready`)throw Error(`Can not post user action unless we are in ready mode`);let r={uID:n.userId,cID:t.conversationId,lang:t.lang,userAction:e};await this.internalData.restClient.postData(`/assistant/userAction`,r)}async search(e,t={}){let n=await this.internalData.metadata,r=n.mode===`ready`?n.userId:void 0,{links:i}=await this.internalData.restClient.fetchData(`/assistant/search`,Mn,{modelId:t.model,lang:t.language,query:e,mapResults:`true`,uID:r});return new Vn(i.map(Nn))}async getChatConfig(){return this.internalData.restClient.fetchData(`/chatconfig`,ie)}async getChatHistory(e,t){try{let n=await this.internalData.restClient.postData(`/chathistory`,{cID:e,uID:t}),r=g.safeParse(await n.json());return r.success?r.data:[]}catch(e){return console.error(`Failed to load chat history:`,e),[]}}async getPredefinedQuestions(e){return(await this.internalData.restClient.fetchData(`/topics/questions`,ae,e)).predefinedQuestions}async transcribeAudio(e,t={}){let n=await this.internalData.metadata,r=t.lang||`de-CH`;if(n.mode===`maintenance`)throw Error(`Can not transcribe audio in maintenance mode`);try{let t=(e=>e.includes(`mp4`)?`mp4`:e.includes(`webm`)?`webm`:(e.includes(`wav`),`wav`))(e.type),n=new FormData;return n.append(`file`,e,`audio.${t}`),n.append(`lang`,r),n.append(`type`,e.type),{transcript:await(await this.internalData.restClient.postFormData(`/speech?key=${this.internalData.restClient.speechRecognitionApiKey||``}&lang=${r}`,n)).text()||``,error:void 0}}catch(e){return console.error(`Error transcribing audio:`,e),{transcript:``,error:e instanceof Error?e.message:`Unknown error`}}}},Wn=class{clientPrimitive;constructor(e){this.clientPrimitive=new Un(e)}getMetadata(){return this.clientPrimitive.getMetadata()}createConversation(){return new gn(this.clientPrimitive)}search(e,t={}){return this.clientPrimitive.search(e,t)}getChatConfig(){return this.clientPrimitive.getChatConfig()}getPredefinedQuestions(e){return this.clientPrimitive.getPredefinedQuestions(e)}},Gn=class extends Map{#e=new Map;#t=e(0);#n=e(0);#r=s||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(n){return s===this.#r?e(n):t(n)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return o(this.#t),!1;return o(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{o(this.#t);return}return o(n),super.get(e)}set(e,t){var n=this.#e,i=n.get(e),a=super.get(e),o=super.set(e,t),s=this.#t;if(i===void 0)i=this.#i(0),n.set(e,i),r(this.#n,super.size),c(s);else if(a!==t){c(i);var l=s.reactions===null?null:new Set(s.reactions);(l===null||!i.reactions?.every(e=>l.has(e)))&&c(s)}return o}delete(e){var t=this.#e,n=t.get(e),i=super.delete(e);return n!==void 0&&(t.delete(e),r(n,-1)),i&&(r(this.#n,super.size),c(this.#t)),i}clear(){if(super.size!==0){super.clear();var e=this.#e;r(this.#n,0);for(var t of e.values())r(t,-1);c(this.#t),e.clear()}}#a(){o(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},Kn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=a(t)}get current(){return this.#t(),this.#e()}},qn=/\(.+\)/,Jn=new Set([`all`,`print`,`screen`,`and`,`or`,`not`,`only`]),Yn=class extends Kn{constructor(e,t){let n=qn.test(e)||e.split(/[\s,]+/).some(e=>Jn.has(e.trim()))?e:`(${e})`,r=window.matchMedia(n);super(()=>r.matches,e=>i(r,`change`,e))}};function Xn(e){return e}function Zn(e){return e<.5?4*e*e*e:.5*(2*e-2)**3+1}function Qn(e){return e<.5?8*e**4:-8*(e-1)**4+1}function $n(e){return e**4}function er(e){return(e-1)**3*(1-e)+1}function tr(e){return--e*e*e*e*e+1}export{mn as _,er as a,$e as b,Gn as c,zn as d,Rn as f,pn as g,_n as h,Qn as i,Wn as l,bn as m,Xn as n,tr as o,Dn as p,$n as r,Yn as s,Zn as t,Un as u,un as v,an as y};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.Bi08LRX0.js","../chunks/CibALFW0.js","../chunks/C32fguu7.js","../chunks/rEsbAd0y.js","../chunks/CsGLkWF6.js","../chunks/BaFk5JeE.js","../chunks/CFKVnMbq.js","../chunks/CLWqXHLZ.js","../chunks/BFwiU0IZ.js","../nodes/1.E_trvDMx.js","../chunks/59Qy4pzN.js","../chunks/BZRp1cWz.js","../chunks/CYtlA8cd.js","../chunks/Bo0U8J3e.js","../nodes/2.BNeVNh0R.js","../chunks/DjVmpym-.js","../chunks/DBQyBiSh.js","../chunks/Bzr04ZcD.js","../chunks/CIHHNprL.js","../chunks/6ikKRAEA.js","../chunks/SzunIEqj.js","../chunks/MXZgHzgQ.js","../chunks/hdHt6us6.js","../nodes/3.D1rPht9H.js","../chunks/C1yKSdkL.js","../chunks/CD6_VnKE.js","../chunks/CzUv7c8S.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,Dt as t,Gt as n,I as r,J as i,K as a,Lt as o,Mt as s,Rt as c,St as l,Tt as u,U as d,X as f,Y as p,a as m,bt as h,ct as g,gt as _,ht as v,i as y,kt as b,mt as x,o as S,ot as C,r as w,u as T,xt as E}from"../chunks/rEsbAd0y.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=f(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=f(`<!> <!>`,1);function j(f,m){c(m,!0);let y=S(m,`stores`,7),D=S(m,`page`,7),O=S(m,`constructors`,7),j=S(m,`components`,23,()=>[]),M=S(m,`form`,7),N=S(m,`data_0`,7,null),P=S(m,`data_1`,7,null);_(()=>y().page.set(D())),v(()=>{y(),D(),O(),j(),M(),N(),P(),y().page.notify()});let F=t(!1),I=t(!1),L=t(null);w(()=>{let e=y().page.subscribe(()=>{C(F)&&(u(I,!0),g().then(()=>{u(L,document.title||`untitled page`,!0)}))});return u(F,!0),e});let R=b(()=>O()[1]);var z={get stores(){return y()},set stores(e){y(e),s()},get page(){return D()},set page(e){D(e),s()},get constructors(){return O()},set constructors(e){O(e),s()},get components(){return j()},set components(e=[]){j(e),s()},get form(){return M()},set form(e){M(e),s()},get data_0(){return N()},set data_0(e=null){N(e),s()},get data_1(){return P()},set data_1(e=null){P(e),s()}},B=A(),V=E(B),H=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,t)=>{var n=p();r(E(n),()=>C(R),(e,t)=>{T(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),i(e,n)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)},U=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)};d(V,e=>{O()[1]?e(H):e(U,-1)});var W=l(V,2),G=t=>{var r=k(),o=h(r),s=t=>{var n=e();x(()=>a(n,C(L))),i(t,n)};d(o,e=>{C(I)&&e(s)}),n(r),i(t,r)};return d(W,e=>{C(F)&&e(G)}),i(f,B),o(z)}y(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=m(j),N=[()=>D(()=>import(`../nodes/0.Bi08LRX0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.E_trvDMx.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.BNeVNh0R.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,4,20,21,11,22,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.D1rPht9H.js`),__vite__mapDeps([23,10,3,1,2,16,15,17,5,18,19,4,20,21,11,24,22,25,26,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DwmuWxZI.js","../chunks/CibALFW0.js","../chunks/C7SVO0yB.js","../chunks/DK3lEKRX.js","../chunks/CsGLkWF6.js","../chunks/BaFk5JeE.js","../chunks/CFKVnMbq.js","../chunks/CLWqXHLZ.js","../chunks/BFwiU0IZ.js","../nodes/1.Bjv1gqx4.js","../chunks/BOogcmRI.js","../chunks/CxsmcPPu.js","../chunks/DUHuqsF-.js","../chunks/Bo0U8J3e.js","../nodes/2.CyWhas6h.js","../chunks/DjVmpym-.js","../chunks/CrAgD5Zd.js","../chunks/lj2Jt22R.js","../chunks/BJVrdkuG.js","../chunks/hJTLHSgs.js","../chunks/DHHLckcz.js","../chunks/BzwH5m-K.js","../chunks/I5DxyXWx.js","../nodes/3.BlXQFvKY.js","../chunks/BGriYQSA.js","../chunks/DmZKIk3Y.js","../chunks/MqTIsSeD.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,Dt as t,Gt as n,I as r,J as i,K as a,Lt as o,Mt as s,Rt as c,St as l,Tt as u,U as d,X as f,Y as p,a as m,bt as h,ct as g,gt as _,ht as v,i as y,kt as b,mt as x,o as S,ot as C,r as w,u as T,xt as E}from"../chunks/DK3lEKRX.js";import{t as D}from"../chunks/DjVmpym-.js";import"../chunks/CFKVnMbq.js";var O={},k=f(`<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>`),A=f(`<!> <!>`,1);function j(f,m){c(m,!0);let y=S(m,`stores`,7),D=S(m,`page`,7),O=S(m,`constructors`,7),j=S(m,`components`,23,()=>[]),M=S(m,`form`,7),N=S(m,`data_0`,7,null),P=S(m,`data_1`,7,null);_(()=>y().page.set(D())),v(()=>{y(),D(),O(),j(),M(),N(),P(),y().page.notify()});let F=t(!1),I=t(!1),L=t(null);w(()=>{let e=y().page.subscribe(()=>{C(F)&&(u(I,!0),g().then(()=>{u(L,document.title||`untitled page`,!0)}))});return u(F,!0),e});let R=b(()=>O()[1]);var z={get stores(){return y()},set stores(e){y(e),s()},get page(){return D()},set page(e){D(e),s()},get constructors(){return O()},set constructors(e){O(e),s()},get components(){return j()},set components(e=[]){j(e),s()},get form(){return M()},set form(e){M(e),s()},get data_0(){return N()},set data_0(e=null){N(e),s()},get data_1(){return P()},set data_1(e=null){P(e),s()}},B=A(),V=E(B),H=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params},children:(e,t)=>{var n=p();r(E(n),()=>C(R),(e,t)=>{T(t(e,{get data(){return P()},get form(){return M()},get params(){return D().params}}),e=>j()[1]=e,()=>j()?.[1])}),i(e,n)},$$slots:{default:!0}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)},U=e=>{let t=b(()=>O()[0]);var n=p();r(E(n),()=>C(t),(e,t)=>{T(t(e,{get data(){return N()},get form(){return M()},get params(){return D().params}}),e=>j()[0]=e,()=>j()?.[0])}),i(e,n)};d(V,e=>{O()[1]?e(H):e(U,-1)});var W=l(V,2),G=t=>{var r=k(),o=h(r),s=t=>{var n=e();x(()=>a(n,C(L))),i(t,n)};d(o,e=>{C(I)&&e(s)}),n(r),i(t,r)};return d(W,e=>{C(F)&&e(G)}),i(f,B),o(z)}y(j,{stores:{},page:{},constructors:{},components:{},form:{},data_0:{},data_1:{}},[],[],{mode:`open`});var M=m(j),N=[()=>D(()=>import(`../nodes/0.DwmuWxZI.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>D(()=>import(`../nodes/1.Bjv1gqx4.js`),__vite__mapDeps([9,10,3,1,11,6,12,13]),import.meta.url),()=>D(()=>import(`../nodes/2.CyWhas6h.js`),__vite__mapDeps([14,10,3,1,2,15,16,17,5,18,19,4,20,21,11,22,6,12,13,8]),import.meta.url),()=>D(()=>import(`../nodes/3.BlXQFvKY.js`),__vite__mapDeps([23,10,3,1,2,16,15,17,5,18,19,4,20,21,11,24,22,25,26,6,12,13,7,8]),import.meta.url)],P=[],F={"/":[2],"/sidebar":[3]},I={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},L=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.decode])),R=Object.fromEntries(Object.entries(I.transport).map(([e,t])=>[e,t.encode])),z=!1,B=(e,t)=>L[e](t);export{B as decode,L as decoders,F as dictionary,R as encoders,z as hash,I as hooks,O as matchers,N as nodes,M as root,P as server_loads};
@@ -0,0 +1 @@
1
+ import"../chunks/DK3lEKRX.js";import{n as e,s as t}from"../chunks/BOogcmRI.js";import"../chunks/Bo0U8J3e.js";export{t as load_css,e as start};
@@ -1,4 +1,4 @@
1
- import{n as e}from"../chunks/CibALFW0.js";import{J as t,L as n,Lt as r,Mt as i,Rt as a,Y as o,i as s,o as c,xt as l}from"../chunks/rEsbAd0y.js";import"../chunks/CFKVnMbq.js";import{r as u}from"../chunks/CLWqXHLZ.js";import{n as d,r as f,s as p,t as m,u as h}from"../chunks/C32fguu7.js";import"../chunks/CsGLkWF6.js";import"../chunks/BaFk5JeE.js";import"../chunks/BFwiU0IZ.js";var g=async e=>await(await e(`https://liipgpt.dev.cluster.liipgpt.ch/configurator/api/all-org-names`)).json(),_=[`baselcitygpt`],v=async e=>{let t=await g(e).catch(e=>(console.error(`Error fetching org names:`,e),[]));t.push(`liipgpt`);let n=t.map(e=>_.includes(e)?[e,{dev:`https://${e}-dev-api.gpt.liip.ch/${e}`,prod:`https://${e}-api.gpt.liip.ch/${e}`}]:[e,{dev:`https://${e}.dev.cluster.liipgpt.ch/${e}`,prod:`https://${e}.prod.cluster.liipgpt.ch/${e}`}]);return Object.fromEntries(n)},y=`/**
1
+ import{n as e}from"../chunks/CibALFW0.js";import{J as t,L as n,Lt as r,Mt as i,Rt as a,Y as o,i as s,o as c,xt as l}from"../chunks/DK3lEKRX.js";import"../chunks/CFKVnMbq.js";import{r as u}from"../chunks/CLWqXHLZ.js";import{n as d,r as f,s as p,t as m,u as h}from"../chunks/C7SVO0yB.js";import"../chunks/CsGLkWF6.js";import"../chunks/BaFk5JeE.js";import"../chunks/BFwiU0IZ.js";var g=async e=>await(await e(`https://liipgpt.dev.cluster.liipgpt.ch/configurator/api/all-org-names`)).json(),_=[`baselcitygpt`],v=async e=>{let t=await g(e).catch(e=>(console.error(`Error fetching org names:`,e),[]));t.push(`liipgpt`);let n=t.map(e=>_.includes(e)?[e,{dev:`https://${e}-dev-api.gpt.liip.ch/${e}`,prod:`https://${e}-api.gpt.liip.ch/${e}`}]:[e,{dev:`https://${e}.dev.cluster.liipgpt.ch/${e}`,prod:`https://${e}.prod.cluster.liipgpt.ch/${e}`}]);return Object.fromEntries(n)},y=`/**
2
2
  * @type {import('@liip/liipgpt/config').ChatConfig} ChatConfig
3
3
  */
4
4
  const CHAT_CONFIG_OVERRIDE = {
@@ -9,6 +9,7 @@ const CHAT_CONFIG_OVERRIDE = {
9
9
  // forcePredefinedQuestions: true, // hides the chat-input on the start-page, forcing the user to use predefined questions.
10
10
  // forceChatPage: true, // starts the app directly on the chat-page and hides the "new discussion" button so the user can't go back to the start-page.
11
11
  // showReferencesByDefault: true,
12
+ // referencesLayout: "inline", // renders the references below each answer instead of the sidebar
12
13
  // showExpandedSelectors: true,
13
14
  // showTextFeedback: false,
14
15
  // inlineLayout: true,
@@ -0,0 +1 @@
1
+ import{Gt as e,J as t,K as n,Lt as r,Rt as i,St as a,X as o,bt as s,i as c,l,mt as u,xt as d}from"../chunks/DK3lEKRX.js";import"../chunks/BOogcmRI.js";import"../chunks/Bo0U8J3e.js";import"../chunks/CFKVnMbq.js";import"../chunks/DUHuqsF-.js";import{t as f}from"../chunks/CxsmcPPu.js";var p=o(`<h1> </h1> <p> </p>`,1);function m(o,c){i(c,!1),l();var m=p(),h=d(m),g=s(h,!0);e(h);var _=a(h,2),v=s(_,!0);e(_),u(()=>{n(g,f.status),n(v,f.error?.message)}),t(o,m),r()}c(m,{},[],[],{mode:`open`});export{m as component};