@sy-design/svelte 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,19 +1,19 @@
1
- (function($,H){typeof exports=="object"&&typeof module!="undefined"?H(exports):typeof define=="function"&&define.amd?define(["exports"],H):($=typeof globalThis!="undefined"?globalThis:$||self,H($["@sy-design/svelte"]=$["@sy-design/svelte"]||{}))})(this,function($){"use strict";var ml=Object.defineProperty,wl=Object.defineProperties;var kl=Object.getOwnPropertyDescriptors;var pi=Object.getOwnPropertySymbols;var bl=Object.prototype.hasOwnProperty,_l=Object.prototype.propertyIsEnumerable;var di=$=>{throw TypeError($)};var qn=($,H,le)=>H in $?ml($,H,{enumerable:!0,configurable:!0,writable:!0,value:le}):$[H]=le,se=($,H)=>{for(var le in H||(H={}))bl.call(H,le)&&qn($,le,H[le]);if(pi)for(var le of pi(H))_l.call(H,le)&&qn($,le,H[le]);return $},Te=($,H)=>wl($,kl(H));var oe=($,H,le)=>qn($,typeof H!="symbol"?H+"":H,le),yl=($,H,le)=>H.has($)||di("Cannot "+le);var gi=($,H,le)=>H.has($)?di("Cannot add the same private member more than once"):H instanceof WeakSet?H.add($):H.set($,le);var cn=($,H,le)=>(yl($,H,"access private method"),le);var Le=($,H,le)=>new Promise((Ut,ke)=>{var Et=Qe=>{try{St(le.next(Qe))}catch(ft){ke(ft)}},ut=Qe=>{try{St(le.throw(Qe))}catch(ft){ke(ft)}},St=Qe=>Qe.done?Ut(Qe.value):Promise.resolve(Qe.value).then(Et,ut);St((le=le.apply($,H)).next())});var at,Gn,mi;function H(){}function le(s){return s()}function Ut(){return Object.create(null)}function ke(s){s.forEach(le)}function Et(s){return typeof s=="function"}function ut(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function St(s){return Object.keys(s).length===0}function Qe(s,...e){if(s==null){for(const n of e)n(void 0);return H}const t=s.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const ft=typeof window!="undefined";let Yn=ft?()=>window.performance.now():()=>Date.now(),Zn=ft?s=>requestAnimationFrame(s):H;const ht=new Set;function Xn(s){ht.forEach(e=>{e.c(s)||(ht.delete(e),e.f())}),ht.size!==0&&Zn(Xn)}function wi(s){let e;return ht.size===0&&Zn(Xn),{promise:new Promise(t=>{ht.add(e={c:s,f:t})}),abort(){ht.delete(e)}}}function m(s,e){s.appendChild(e)}function q(s,e,t){s.insertBefore(e,t||null)}function W(s){s.parentNode&&s.parentNode.removeChild(s)}function ki(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function x(s){return document.createElement(s)}function X(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function ve(s){return document.createTextNode(s)}function G(){return ve(" ")}function jt(){return ve("")}function U(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function Vn(s){return function(e){return e.preventDefault(),s.call(this,e)}}function r(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function bi(s){return Array.from(s.childNodes)}function Pe(s,e){e=""+e,s.data!==e&&(s.data=e)}function pt(s,e){s.value=e==null?"":e}function P(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}function J(s,e,t){s.classList.toggle(e,!!t)}let At;function xt(s){At=s}function un(){if(!At)throw new Error("Function called outside component initialization");return At}function Qn(s){un().$$.on_mount.push(s)}function _i(s){un().$$.after_update.push(s)}function yi(s){un().$$.on_destroy.push(s)}const dt=[],gt=[];let mt=[];const Jn=[],Ti=Promise.resolve();let fn=!1;function vi(){fn||(fn=!0,Ti.then(Kn))}function hn(s){mt.push(s)}const pn=new Set;let wt=0;function Kn(){if(wt!==0)return;const s=At;do{try{for(;wt<dt.length;){const e=dt[wt];wt++,xt(e),Ei(e.$$)}}catch(e){throw dt.length=0,wt=0,e}for(xt(null),dt.length=0,wt=0;gt.length;)gt.pop()();for(let e=0;e<mt.length;e+=1){const t=mt[e];pn.has(t)||(pn.add(t),t())}mt.length=0}while(dt.length);for(;Jn.length;)Jn.pop()();fn=!1,pn.clear(),xt(s)}function Ei(s){if(s.fragment!==null){s.update(),ke(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(hn)}}function Si(s){const e=[],t=[];mt.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),mt=e}const Wt=new Set;let it;function dn(){it={r:0,c:[],p:it}}function gn(){it.r||ke(it.c),it=it.p}function Fe(s,e){s&&s.i&&(Wt.delete(s),s.i(e))}function Je(s,e,t,n){if(s&&s.o){if(Wt.has(s))return;Wt.add(s),it.c.push(()=>{Wt.delete(s),n&&(t&&s.d(1),n())}),s.o(e)}else n&&n()}function kt(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function $n(s,e){s.d(1),e.delete(s.key)}function es(s,e,t,n,i,o,l,a,c,u,h,p){let d=s.length,g=o.length,w=d;const S={};for(;w--;)S[s[w].key]=w;const C=[],M=new Map,v=new Map,b=[];for(w=g;w--;){const T=p(i,o,w),z=t(T);let R=l.get(z);R?b.push(()=>R.p(T,e)):(R=u(z,T),R.c()),M.set(z,C[w]=R),z in S&&v.set(z,Math.abs(w-S[z]))}const k=new Set,y=new Set;function A(T){Fe(T,1),T.m(a,h),l.set(T.key,T),h=T.first,g--}for(;d&&g;){const T=C[g-1],z=s[d-1],R=T.key,F=z.key;T===z?(h=T.first,d--,g--):M.has(F)?!l.has(R)||k.has(R)?A(T):y.has(F)?d--:v.get(R)>v.get(F)?(y.add(R),A(T)):(k.add(F),d--):(c(z,l),d--)}for(;d--;){const T=s[d];M.has(T.key)||c(T,l)}for(;g;)A(C[g-1]);return ke(b),C}function mn(s){s&&s.c()}function qt(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),hn(()=>{const o=s.$$.on_mount.map(le).filter(Et);s.$$.on_destroy?s.$$.on_destroy.push(...o):ke(o),s.$$.on_mount=[]}),i.forEach(hn)}function Gt(s,e){const t=s.$$;t.fragment!==null&&(Si(t.after_update),ke(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Ai(s,e){s.$$.dirty[0]===-1&&(dt.push(s),vi(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function wn(s,e,t,n,i,o,l=null,a=[-1]){const c=At;xt(s);const u=s.$$={fragment:null,ctx:[],props:o,update:H,not_equal:i,bound:Ut(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Ut(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let h=!1;if(u.ctx=t?t(s,e.props||{},(p,d,...g)=>{const w=g.length?g[0]:d;return u.ctx&&i(u.ctx[p],u.ctx[p]=w)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](w),h&&Ai(s,p)),d}):[],u.update(),h=!0,ke(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=bi(e.target);u.fragment&&u.fragment.l(p),p.forEach(W)}else u.fragment&&u.fragment.c();e.intro&&Fe(s.$$.fragment),qt(s,e.target,e.anchor),Kn()}xt(c)}class kn{constructor(){oe(this,"$$");oe(this,"$$set")}$destroy(){Gt(this,1),this.$destroy=H}$on(e,t){if(!Et(t))return H;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!St(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const xi="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(xi);const bt=[];function Ri(s,e=H){let t;const n=new Set;function i(a){if(ut(s,a)&&(s=a,t)){const c=!bt.length;for(const u of n)u[1](),bt.push(u,s);if(c){for(let u=0;u<bt.length;u+=2)bt[u][0](bt[u+1]);bt.length=0}}}function o(a){i(a(s))}function l(a,c=H){const u=[a,c];return n.add(u),n.size===1&&(t=e(i,o)||H),a(s),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:i,update:o,subscribe:l}}function ts(s){return Object.prototype.toString.call(s)==="[object Date]"}function bn(s,e,t,n){if(typeof t=="number"||ts(t)){const i=n-t,o=(t-e)/(s.dt||1/60),l=s.opts.stiffness*i,a=s.opts.damping*o,c=(l-a)*s.inv_mass,u=(o+c)*s.dt;return Math.abs(u)<s.opts.precision&&Math.abs(i)<s.opts.precision?n:(s.settled=!1,ts(t)?new Date(t.getTime()+u):t+u)}else{if(Array.isArray(t))return t.map((i,o)=>bn(s,e[o],t[o],n[o]));if(typeof t=="object"){const i={};for(const o in t)i[o]=bn(s,e[o],t[o],n[o]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function Ii(s,e={}){const t=Ri(s),{stiffness:n=.15,damping:i=.8,precision:o=.01}=e;let l,a,c,u=s,h=s,p=1,d=0,g=!1;function w(C,M={}){h=C;const v=c={};return s==null||M.hard||S.stiffness>=1&&S.damping>=1?(g=!0,l=Yn(),u=C,t.set(s=h),Promise.resolve()):(M.soft&&(d=1/((M.soft===!0?.5:+M.soft)*60),p=0),a||(l=Yn(),g=!1,a=wi(b=>{if(g)return g=!1,a=null,!1;p=Math.min(p+d,1);const k={inv_mass:p,opts:S,settled:!0,dt:(b-l)*60/1e3},y=bn(k,u,s,h);return l=b,u=s,t.set(s=y),k.settled&&(a=null),!k.settled})),new Promise(b=>{a.promise.then(()=>{v===c&&b()})}))}const S={set:w,update:(C,M)=>w(C(h,s),M),subscribe:t.subscribe,stiffness:n,damping:i,precision:o};return S}function zi(s,e){return Le(this,null,function*(){const t=s.getReader();let n;for(;!(n=yield t.read()).done;)e(n.value)})}function Ci(s){let e,t,n,i=!1;return function(l){e===void 0?(e=l,t=0,n=-1):e=Mi(e,l);const a=e.length;let c=0;for(;t<a;){i&&(e[t]===10&&(c=++t),i=!1);let u=-1;for(;t<a&&u===-1;++t)switch(e[t]){case 58:n===-1&&(n=t-c);break;case 13:i=!0;case 10:u=t;break}if(u===-1)break;s(e.subarray(c,u),n),c=t,n=-1}c===a?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Li(s,e,t){let n=ns();const i=new TextDecoder;return function(l,a){if(l.length===0)t==null||t(n),n=ns();else if(a>0){const c=i.decode(l.subarray(0,a)),u=a+(l[a+1]===32?2:1),h=i.decode(l.subarray(u));switch(c){case"data":n.data=n.data?n.data+`
2
- `+h:h;break;case"event":n.event=h;break;case"id":s(n.id=h);break;case"retry":const p=parseInt(h,10);isNaN(p)||e(n.retry=p);break}}}}function Mi(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function ns(){return{data:"",event:"",id:"",retry:void 0}}var Oi=function(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t};const _n="text/event-stream",Di=1e3,ss="last-event-id";function Ni(s,e){var{signal:t,headers:n,onopen:i,onmessage:o,onclose:l,onerror:a,openWhenHidden:c,fetch:u}=e,h=Oi(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,d)=>{const g=Object.assign({},n);g.accept||(g.accept=_n);let w;function S(){w.abort(),document.hidden||y()}c||document.addEventListener("visibilitychange",S);let C=Di,M=0;function v(){document.removeEventListener("visibilitychange",S),window.clearTimeout(M),w.abort()}t==null||t.addEventListener("abort",()=>{v(),p()});const b=u!=null?u:window.fetch,k=i!=null?i:Pi;function y(){return Le(this,null,function*(){var A;w=new AbortController;try{const T=yield b(s,Object.assign(Object.assign({},h),{headers:g,signal:w.signal}));yield k(T),yield zi(T.body,Ci(Li(z=>{z?g[ss]=z:delete g[ss]},z=>{C=z},o))),l==null||l(),v(),p()}catch(T){if(!w.signal.aborted)try{const z=(A=a==null?void 0:a(T))!==null&&A!==void 0?A:C;window.clearTimeout(M),M=window.setTimeout(y,z)}catch(z){v(),d(z)}}})}y()})}function Pi(s){const e=s.headers.get("content-type");if(!(e!=null&&e.startsWith(_n)))throw new Error(`Expected content-type to be ${_n}, Actual: ${e}`)}function yn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ot=yn();function is(s){ot=s}const os=/[&<>"']/,Fi=new RegExp(os.source,"g"),ls=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Hi=new RegExp(ls.source,"g"),Bi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},rs=s=>Bi[s];function De(s,e){if(e){if(os.test(s))return s.replace(Fi,rs)}else if(ls.test(s))return s.replace(Hi,rs);return s}const Ui=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ji(s){return s.replace(Ui,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Wi=/(^|[^\[])\^/g;function ne(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(Wi,"$1"),t=t.replace(i,l),n},getRegex:()=>new RegExp(t,e)};return n}function as(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch(e){return null}return s}const Rt={exec:()=>null};function cs(s,e){const t=s.replace(/\|/g,(o,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Yt(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const o=s.charAt(n-i-1);if(o===e&&!t)i++;else if(o!==e&&t)i++;else break}return s.slice(0,n-i)}function qi(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function us(s,e,t,n){const i=e.href,o=e.title?De(e.title):null,l=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const a={type:"link",raw:t,href:i,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:o,text:De(l)}}function Gi(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
1
+ (function(K,B){typeof exports=="object"&&typeof module!="undefined"?B(exports):typeof define=="function"&&define.amd?define(["exports"],B):(K=typeof globalThis!="undefined"?globalThis:K||self,B(K["@sy-design/svelte"]=K["@sy-design/svelte"]||{}))})(this,function(K){"use strict";var ml=Object.defineProperty,wl=Object.defineProperties;var kl=Object.getOwnPropertyDescriptors;var pi=Object.getOwnPropertySymbols;var _l=Object.prototype.hasOwnProperty,bl=Object.prototype.propertyIsEnumerable;var di=K=>{throw TypeError(K)};var qn=(K,B,le)=>B in K?ml(K,B,{enumerable:!0,configurable:!0,writable:!0,value:le}):K[B]=le,se=(K,B)=>{for(var le in B||(B={}))_l.call(B,le)&&qn(K,le,B[le]);if(pi)for(var le of pi(B))bl.call(B,le)&&qn(K,le,B[le]);return K},Se=(K,B)=>wl(K,kl(B));var oe=(K,B,le)=>qn(K,typeof B!="symbol"?B+"":B,le),yl=(K,B,le)=>B.has(K)||di("Cannot "+le);var gi=(K,B,le)=>B.has(K)?di("Cannot add the same private member more than once"):B instanceof WeakSet?B.add(K):B.set(K,le);var cn=(K,B,le)=>(yl(K,B,"access private method"),le);var Oe=(K,B,le)=>new Promise((jt,me)=>{var St=Je=>{try{At(le.next(Je))}catch(ht){me(ht)}},ft=Je=>{try{At(le.throw(Je))}catch(ht){me(ht)}},At=Je=>Je.done?jt(Je.value):Promise.resolve(Je.value).then(St,ft);At((le=le.apply(K,B)).next())});var ct,Gn,mi;function B(){}function le(s){return s()}function jt(){return Object.create(null)}function me(s){s.forEach(le)}function St(s){return typeof s=="function"}function ft(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function At(s){return Object.keys(s).length===0}function Je(s,...e){if(s==null){for(const n of e)n(void 0);return B}const t=s.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const ht=typeof window!="undefined";let Yn=ht?()=>window.performance.now():()=>Date.now(),Zn=ht?s=>requestAnimationFrame(s):B;const pt=new Set;function Xn(s){pt.forEach(e=>{e.c(s)||(pt.delete(e),e.f())}),pt.size!==0&&Zn(Xn)}function wi(s){let e;return pt.size===0&&Zn(Xn),{promise:new Promise(t=>{pt.add(e={c:s,f:t})}),abort(){pt.delete(e)}}}function m(s,e){s.appendChild(e)}function G(s,e,t){s.insertBefore(e,t||null)}function q(s){s.parentNode&&s.parentNode.removeChild(s)}function ki(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function x(s){return document.createElement(s)}function X(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function Ae(s){return document.createTextNode(s)}function Y(){return Ae(" ")}function Wt(){return Ae("")}function U(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function Vn(s){return function(e){return e.preventDefault(),s.call(this,e)}}function r(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function _i(s){return Array.from(s.childNodes)}function Ue(s,e){e=""+e,s.data!==e&&(s.data=e)}function dt(s,e){s.value=e==null?"":e}function D(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}function J(s,e,t){s.classList.toggle(e,!!t)}let xt;function It(s){xt=s}function un(){if(!xt)throw new Error("Function called outside component initialization");return xt}function Qn(s){un().$$.on_mount.push(s)}function bi(s){un().$$.after_update.push(s)}function yi(s){un().$$.on_destroy.push(s)}const gt=[],mt=[];let wt=[];const Jn=[],Ti=Promise.resolve();let fn=!1;function vi(){fn||(fn=!0,Ti.then(Kn))}function hn(s){wt.push(s)}const pn=new Set;let kt=0;function Kn(){if(kt!==0)return;const s=xt;do{try{for(;kt<gt.length;){const e=gt[kt];kt++,It(e),Ei(e.$$)}}catch(e){throw gt.length=0,kt=0,e}for(It(null),gt.length=0,kt=0;mt.length;)mt.pop()();for(let e=0;e<wt.length;e+=1){const t=wt[e];pn.has(t)||(pn.add(t),t())}wt.length=0}while(gt.length);for(;Jn.length;)Jn.pop()();fn=!1,pn.clear(),It(s)}function Ei(s){if(s.fragment!==null){s.update(),me(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(hn)}}function Si(s){const e=[],t=[];wt.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),wt=e}const qt=new Set;let ot;function dn(){ot={r:0,c:[],p:ot}}function gn(){ot.r||me(ot.c),ot=ot.p}function je(s,e){s&&s.i&&(qt.delete(s),s.i(e))}function Ke(s,e,t,n){if(s&&s.o){if(qt.has(s))return;qt.add(s),ot.c.push(()=>{qt.delete(s),n&&(t&&s.d(1),n())}),s.o(e)}else n&&n()}function _t(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function $n(s,e){s.d(1),e.delete(s.key)}function es(s,e,t,n,i,o,l,a,c,u,h,p){let d=s.length,g=o.length,w=d;const S={};for(;w--;)S[s[w].key]=w;const M=[],z=new Map,v=new Map,_=[];for(w=g;w--;){const b=p(i,o,w),C=t(b);let I=l.get(C);I?_.push(()=>I.p(b,e)):(I=u(C,b),I.c()),z.set(C,M[w]=I),C in S&&v.set(C,Math.abs(w-S[C]))}const k=new Set,T=new Set;function A(b){je(b,1),b.m(a,h),l.set(b.key,b),h=b.first,g--}for(;d&&g;){const b=M[g-1],C=s[d-1],I=b.key,F=C.key;b===C?(h=b.first,d--,g--):z.has(F)?!l.has(I)||k.has(I)?A(b):T.has(F)?d--:v.get(I)>v.get(F)?(T.add(I),A(b)):(k.add(F),d--):(c(C,l),d--)}for(;d--;){const b=s[d];z.has(b.key)||c(b,l)}for(;g;)A(M[g-1]);return me(_),M}function mn(s){s&&s.c()}function Gt(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),hn(()=>{const o=s.$$.on_mount.map(le).filter(St);s.$$.on_destroy?s.$$.on_destroy.push(...o):me(o),s.$$.on_mount=[]}),i.forEach(hn)}function Yt(s,e){const t=s.$$;t.fragment!==null&&(Si(t.after_update),me(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Ai(s,e){s.$$.dirty[0]===-1&&(gt.push(s),vi(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function wn(s,e,t,n,i,o,l=null,a=[-1]){const c=xt;It(s);const u=s.$$={fragment:null,ctx:[],props:o,update:B,not_equal:i,bound:jt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:jt(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let h=!1;if(u.ctx=t?t(s,e.props||{},(p,d,...g)=>{const w=g.length?g[0]:d;return u.ctx&&i(u.ctx[p],u.ctx[p]=w)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](w),h&&Ai(s,p)),d}):[],u.update(),h=!0,me(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=_i(e.target);u.fragment&&u.fragment.l(p),p.forEach(q)}else u.fragment&&u.fragment.c();e.intro&&je(s.$$.fragment),Gt(s,e.target,e.anchor),Kn()}It(c)}class kn{constructor(){oe(this,"$$");oe(this,"$$set")}$destroy(){Yt(this,1),this.$destroy=B}$on(e,t){if(!St(t))return B;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!At(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const xi="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(xi);const bt=[];function Ii(s,e=B){let t;const n=new Set;function i(a){if(ft(s,a)&&(s=a,t)){const c=!bt.length;for(const u of n)u[1](),bt.push(u,s);if(c){for(let u=0;u<bt.length;u+=2)bt[u][0](bt[u+1]);bt.length=0}}}function o(a){i(a(s))}function l(a,c=B){const u=[a,c];return n.add(u),n.size===1&&(t=e(i,o)||B),a(s),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:i,update:o,subscribe:l}}function ts(s){return Object.prototype.toString.call(s)==="[object Date]"}function _n(s,e,t,n){if(typeof t=="number"||ts(t)){const i=n-t,o=(t-e)/(s.dt||1/60),l=s.opts.stiffness*i,a=s.opts.damping*o,c=(l-a)*s.inv_mass,u=(o+c)*s.dt;return Math.abs(u)<s.opts.precision&&Math.abs(i)<s.opts.precision?n:(s.settled=!1,ts(t)?new Date(t.getTime()+u):t+u)}else{if(Array.isArray(t))return t.map((i,o)=>_n(s,e[o],t[o],n[o]));if(typeof t=="object"){const i={};for(const o in t)i[o]=_n(s,e[o],t[o],n[o]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function Ri(s,e={}){const t=Ii(s),{stiffness:n=.15,damping:i=.8,precision:o=.01}=e;let l,a,c,u=s,h=s,p=1,d=0,g=!1;function w(M,z={}){h=M;const v=c={};return s==null||z.hard||S.stiffness>=1&&S.damping>=1?(g=!0,l=Yn(),u=M,t.set(s=h),Promise.resolve()):(z.soft&&(d=1/((z.soft===!0?.5:+z.soft)*60),p=0),a||(l=Yn(),g=!1,a=wi(_=>{if(g)return g=!1,a=null,!1;p=Math.min(p+d,1);const k={inv_mass:p,opts:S,settled:!0,dt:(_-l)*60/1e3},T=_n(k,u,s,h);return l=_,u=s,t.set(s=T),k.settled&&(a=null),!k.settled})),new Promise(_=>{a.promise.then(()=>{v===c&&_()})}))}const S={set:w,update:(M,z)=>w(M(h,s),z),subscribe:t.subscribe,stiffness:n,damping:i,precision:o};return S}function Ci(s,e){return Oe(this,null,function*(){const t=s.getReader();let n;for(;!(n=yield t.read()).done;)e(n.value)})}function Mi(s){let e,t,n,i=!1;return function(l){e===void 0?(e=l,t=0,n=-1):e=zi(e,l);const a=e.length;let c=0;for(;t<a;){i&&(e[t]===10&&(c=++t),i=!1);let u=-1;for(;t<a&&u===-1;++t)switch(e[t]){case 58:n===-1&&(n=t-c);break;case 13:i=!0;case 10:u=t;break}if(u===-1)break;s(e.subarray(c,u),n),c=t,n=-1}c===a?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Li(s,e,t){let n=ns();const i=new TextDecoder;return function(l,a){if(l.length===0)t==null||t(n),n=ns();else if(a>0){const c=i.decode(l.subarray(0,a)),u=a+(l[a+1]===32?2:1),h=i.decode(l.subarray(u));switch(c){case"data":n.data=n.data?n.data+`
2
+ `+h:h;break;case"event":n.event=h;break;case"id":s(n.id=h);break;case"retry":const p=parseInt(h,10);isNaN(p)||e(n.retry=p);break}}}}function zi(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function ns(){return{data:"",event:"",id:"",retry:void 0}}var Oi=function(s,e){var t={};for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(s);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(s,n[i])&&(t[n[i]]=s[n[i]]);return t};const bn="text/event-stream",Di=1e3,ss="last-event-id";function Ni(s,e){var{signal:t,headers:n,onopen:i,onmessage:o,onclose:l,onerror:a,openWhenHidden:c,fetch:u}=e,h=Oi(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,d)=>{const g=Object.assign({},n);g.accept||(g.accept=bn);let w;function S(){w.abort(),document.hidden||T()}c||document.addEventListener("visibilitychange",S);let M=Di,z=0;function v(){document.removeEventListener("visibilitychange",S),window.clearTimeout(z),w.abort()}t==null||t.addEventListener("abort",()=>{v(),p()});const _=u!=null?u:window.fetch,k=i!=null?i:Pi;function T(){return Oe(this,null,function*(){var A;w=new AbortController;try{const b=yield _(s,Object.assign(Object.assign({},h),{headers:g,signal:w.signal}));yield k(b),yield Ci(b.body,Mi(Li(C=>{C?g[ss]=C:delete g[ss]},C=>{M=C},o))),l==null||l(),v(),p()}catch(b){if(!w.signal.aborted)try{const C=(A=a==null?void 0:a(b))!==null&&A!==void 0?A:M;window.clearTimeout(z),z=window.setTimeout(T,C)}catch(C){v(),d(C)}}})}T()})}function Pi(s){const e=s.headers.get("content-type");if(!(e!=null&&e.startsWith(bn)))throw new Error(`Expected content-type to be ${bn}, Actual: ${e}`)}function yn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let lt=yn();function is(s){lt=s}const os=/[&<>"']/,Fi=new RegExp(os.source,"g"),ls=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Hi=new RegExp(ls.source,"g"),Bi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},rs=s=>Bi[s];function Fe(s,e){if(e){if(os.test(s))return s.replace(Fi,rs)}else if(ls.test(s))return s.replace(Hi,rs);return s}const Ui=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ji(s){return s.replace(Ui,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Wi=/(^|[^\[])\^/g;function ne(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(Wi,"$1"),t=t.replace(i,l),n},getRegex:()=>new RegExp(t,e)};return n}function as(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch(e){return null}return s}const Rt={exec:()=>null};function cs(s,e){const t=s.replace(/\|/g,(o,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Zt(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const o=s.charAt(n-i-1);if(o===e&&!t)i++;else if(o!==e&&t)i++;else break}return s.slice(0,n-i)}function qi(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function us(s,e,t,n){const i=e.href,o=e.title?Fe(e.title):null,l=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const a={type:"link",raw:t,href:i,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}return{type:"image",raw:t,href:i,title:o,text:Fe(l)}}function Gi(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
3
3
  `).map(i=>{const o=i.match(/^\s+/);if(o===null)return i;const[l]=o;return l.length>=n.length?i.slice(n.length):i}).join(`
4
- `)}class Zt{constructor(e){oe(this,"options");oe(this,"rules");oe(this,"lexer");this.options=e||ot}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Yt(n,`
5
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Gi(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Yt(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const n=Yt(t[0].replace(/^ *>[ \t]?/gm,""),`
4
+ `)}class Xt{constructor(e){oe(this,"options");oe(this,"rules");oe(this,"lexer");this.options=e||lt}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Zt(n,`
5
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Gi(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Zt(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const n=Zt(t[0].replace(/^ *>[ \t]?/gm,""),`
6
6
  `),i=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,o={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const l=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let a="",c="",u=!1;for(;e;){let h=!1;if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let p=t[2].split(`
7
- `,1)[0].replace(/^\t+/,M=>" ".repeat(3*M.length)),d=e.split(`
7
+ `,1)[0].replace(/^\t+/,z=>" ".repeat(3*z.length)),d=e.split(`
8
8
  `,1)[0],g=0;this.options.pedantic?(g=2,c=p.trimStart()):(g=t[2].search(/[^ ]/),g=g>4?1:g,c=p.slice(g),g+=t[1].length);let w=!1;if(!p&&/^ *$/.test(d)&&(a+=d+`
9
- `,e=e.substring(d.length+1),h=!0),!h){const M=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),v=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),b=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;e;){const y=e.split(`
10
- `,1)[0];if(d=y,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),b.test(d)||k.test(d)||M.test(d)||v.test(e))break;if(d.search(/[^ ]/)>=g||!d.trim())c+=`
11
- `+d.slice(g);else{if(w||p.search(/[^ ]/)>=4||b.test(p)||k.test(p)||v.test(p))break;c+=`
12
- `+d}!w&&!d.trim()&&(w=!0),a+=y+`
13
- `,e=e.substring(y.length+1),p=d.slice(g)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(a)&&(u=!0));let S=null,C;this.options.gfm&&(S=/^\[[ xX]\] /.exec(c),S&&(C=S[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!S,checked:C,loose:!1,text:c,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){const p=o.items[h].tokens.filter(g=>g.type==="space"),d=p.length>0&&p.some(g=>/\n.*\n/.test(g.raw));o.loose=d}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=cs(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
9
+ `,e=e.substring(d.length+1),h=!0),!h){const z=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),v=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),_=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),k=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;e;){const T=e.split(`
10
+ `,1)[0];if(d=T,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),_.test(d)||k.test(d)||z.test(d)||v.test(e))break;if(d.search(/[^ ]/)>=g||!d.trim())c+=`
11
+ `+d.slice(g);else{if(w||p.search(/[^ ]/)>=4||_.test(p)||k.test(p)||v.test(p))break;c+=`
12
+ `+d}!w&&!d.trim()&&(w=!0),a+=T+`
13
+ `,e=e.substring(T.length+1),p=d.slice(g)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(a)&&(u=!0));let S=null,M;this.options.gfm&&(S=/^\[[ xX]\] /.exec(c),S&&(M=S[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:a,task:!!S,checked:M,loose:!1,text:c,tokens:[]}),o.raw+=a}o.items[o.items.length-1].raw=a.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){const p=o.items[h].tokens.filter(g=>g.type==="space"),d=p.length>0&&p.some(g=>/\n.*\n/.test(g.raw));o.loose=d}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=cs(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
14
  `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const a of i)/^ *-+: *$/.test(a)?l.align.push("right"):/^ *:-+: *$/.test(a)?l.align.push("center"):/^ *:-+ *$/.test(a)?l.align.push("left"):l.align.push(null);for(const a of n)l.header.push({text:a,tokens:this.lexer.inline(a)});for(const a of o)l.rows.push(cs(a,l.header.length).map(c=>({text:c,tokens:this.lexer.inline(c)})));return l}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
15
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:De(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const l=Yt(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=qi(t[2],"()");if(l>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],o="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);l&&(i=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),us(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),o=t[i.toLowerCase()];if(!o){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return us(n,o,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...i[0]].length-1;let a,c,u=l,h=0;const p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+l);(i=p.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(c=[...a].length,i[3]||i[4]){u+=c;continue}else if((i[5]||i[6])&&l%3&&!((l+c)%3)){h+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+h);const d=[...i[0]][0].length,g=e.slice(0,l+i.index+d+c);if(Math.min(l,c)%2){const S=g.slice(1,-1);return{type:"em",raw:g,text:S,tokens:this.lexer.inlineTokens(S)}}const w=g.slice(2,-2);return{type:"strong",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return i&&o&&(n=n.substring(1,n.length-1)),n=De(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=De(t[1]),i="mailto:"+n):(n=De(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,i;let t;if(t=this.rules.inline.url.exec(e)){let o,l;if(t[2]==="@")o=De(t[0]),l="mailto:"+o;else{let a;do a=t[0],t[0]=(i=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?i:"";while(a!==t[0]);o=De(t[0]),t[1]==="www."?l="http://"+t[0]:l=t[0]}return{type:"link",raw:t[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=De(t[0]),{type:"text",raw:t[0],text:n}}}}const Yi=/^(?: *(?:\n|$))+/,Zi=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Xi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,It=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fs=/(?:[*+-]|\d{1,9}[.)])/,hs=ne(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,fs).getRegex(),Tn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qi=/^[^\n]+/,vn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ji=ne(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",vn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ki=ne(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fs).getRegex(),Xt="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",En=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,$i=ne("^ {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",En).replace("tag",Xt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ps=ne(Tn).replace("hr",It).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",Xt).getRegex(),Sn={blockquote:ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ps).getRegex(),code:Zi,def:Ji,fences:Xi,heading:Vi,hr:It,html:$i,lheading:hs,list:Ki,newline:Yi,paragraph:ps,table:Rt,text:Qi},ds=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",It).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",Xt).getRegex(),eo=Te(se({},Sn),{table:ds,paragraph:ne(Tn).replace("hr",It).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ds).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",Xt).getRegex()}),to=Te(se({},Sn),{html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",En).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:Rt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(Tn).replace("hr",It).replace("heading",` *#{1,6} *[^
16
- ]`).replace("lheading",hs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),gs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,no=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ms=/^( {2,}|\\)\n(?!\s*$)/,so=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,zt="\\p{P}$+<=>`^|~",io=ne(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,zt).getRegex(),oo=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,lo=ne(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,zt).getRegex(),ro=ne("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,zt).getRegex(),ao=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,zt).getRegex(),co=ne(/\\([punct])/,"gu").replace(/punct/g,zt).getRegex(),uo=ne(/^<(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(),fo=ne(En).replace("(?:-->|$)","-->").getRegex(),ho=ne("^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",fo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,po=ne(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Vt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ws=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",Vt).replace("ref",vn).getRegex(),ks=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",vn).getRegex(),go=ne("reflink|nolink(?!\\()","g").replace("reflink",ws).replace("nolink",ks).getRegex(),An={_backpedal:Rt,anyPunctuation:co,autolink:uo,blockSkip:oo,br:ms,code:no,del:Rt,emStrongLDelim:lo,emStrongRDelimAst:ro,emStrongRDelimUnd:ao,escape:gs,link:po,nolink:ks,punctuation:io,reflink:ws,reflinkSearch:go,tag:ho,text:so,url:Rt},mo=Te(se({},An),{link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",Vt).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vt).getRegex()}),xn=Te(se({},An),{escape:ne(gs).replace("])","~|])").getRegex(),url:ne(/^((?: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\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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),wo=Te(se({},xn),{br:ne(ms).replace("{2,}","*").getRegex(),text:ne(xn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),Qt={normal:Sn,gfm:eo,pedantic:to},Ct={normal:An,gfm:xn,breaks:wo,pedantic:mo};class qe{constructor(e){oe(this,"tokens");oe(this,"options");oe(this,"state");oe(this,"tokenizer");oe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ot,this.options.tokenizer=this.options.tokenizer||new Zt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Qt.normal,inline:Ct.normal};this.options.pedantic?(t.block=Qt.pedantic,t.inline=Ct.pedantic):this.options.gfm&&(t.block=Qt.gfm,this.options.breaks?t.inline=Ct.breaks:t.inline=Ct.gfm),this.tokenizer.rules=t}static get rules(){return{block:Qt,inline:Ct}}static lex(e,t){return new qe(t).lex(e)}static lexInline(e,t){return new qe(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
15
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Fe(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const l=Zt(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=qi(t[2],"()");if(l>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let i=t[2],o="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);l&&(i=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),us(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),o=t[i.toLowerCase()];if(!o){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return us(n,o,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...i[0]].length-1;let a,c,u=l,h=0;const p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+l);(i=p.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(c=[...a].length,i[3]||i[4]){u+=c;continue}else if((i[5]||i[6])&&l%3&&!((l+c)%3)){h+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+h);const d=[...i[0]][0].length,g=e.slice(0,l+i.index+d+c);if(Math.min(l,c)%2){const S=g.slice(1,-1);return{type:"em",raw:g,text:S,tokens:this.lexer.inlineTokens(S)}}const w=g.slice(2,-2);return{type:"strong",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return i&&o&&(n=n.substring(1,n.length-1)),n=Fe(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=Fe(t[1]),i="mailto:"+n):(n=Fe(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,i;let t;if(t=this.rules.inline.url.exec(e)){let o,l;if(t[2]==="@")o=Fe(t[0]),l="mailto:"+o;else{let a;do a=t[0],t[0]=(i=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?i:"";while(a!==t[0]);o=Fe(t[0]),t[1]==="www."?l="http://"+t[0]:l=t[0]}return{type:"link",raw:t[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=Fe(t[0]),{type:"text",raw:t[0],text:n}}}}const Yi=/^(?: *(?:\n|$))+/,Zi=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Xi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ct=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fs=/(?:[*+-]|\d{1,9}[.)])/,hs=ne(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,fs).getRegex(),Tn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qi=/^[^\n]+/,vn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ji=ne(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",vn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ki=ne(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fs).getRegex(),Vt="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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",En=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,$i=ne("^ {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",En).replace("tag",Vt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ps=ne(Tn).replace("hr",Ct).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",Vt).getRegex(),Sn={blockquote:ne(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ps).getRegex(),code:Zi,def:Ji,fences:Xi,heading:Vi,hr:Ct,html:$i,lheading:hs,list:Ki,newline:Yi,paragraph:ps,table:Rt,text:Qi},ds=ne("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",Vt).getRegex(),eo=Se(se({},Sn),{table:ds,paragraph:ne(Tn).replace("hr",Ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ds).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",Vt).getRegex()}),to=Se(se({},Sn),{html:ne(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",En).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:Rt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ne(Tn).replace("hr",Ct).replace("heading",` *#{1,6} *[^
16
+ ]`).replace("lheading",hs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),gs=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,no=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ms=/^( {2,}|\\)\n(?!\s*$)/,so=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Mt="\\p{P}$+<=>`^|~",io=ne(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Mt).getRegex(),oo=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,lo=ne(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Mt).getRegex(),ro=ne("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Mt).getRegex(),ao=ne("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Mt).getRegex(),co=ne(/\\([punct])/,"gu").replace(/punct/g,Mt).getRegex(),uo=ne(/^<(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(),fo=ne(En).replace("(?:-->|$)","-->").getRegex(),ho=ne("^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",fo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,po=ne(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Qt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ws=ne(/^!?\[(label)\]\[(ref)\]/).replace("label",Qt).replace("ref",vn).getRegex(),ks=ne(/^!?\[(ref)\](?:\[\])?/).replace("ref",vn).getRegex(),go=ne("reflink|nolink(?!\\()","g").replace("reflink",ws).replace("nolink",ks).getRegex(),An={_backpedal:Rt,anyPunctuation:co,autolink:uo,blockSkip:oo,br:ms,code:no,del:Rt,emStrongLDelim:lo,emStrongRDelimAst:ro,emStrongRDelimUnd:ao,escape:gs,link:po,nolink:ks,punctuation:io,reflink:ws,reflinkSearch:go,tag:ho,text:so,url:Rt},mo=Se(se({},An),{link:ne(/^!?\[(label)\]\((.*?)\)/).replace("label",Qt).getRegex(),reflink:ne(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qt).getRegex()}),xn=Se(se({},An),{escape:ne(gs).replace("])","~|])").getRegex(),url:ne(/^((?: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\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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),wo=Se(se({},xn),{br:ne(ms).replace("{2,}","*").getRegex(),text:ne(xn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),Jt={normal:Sn,gfm:eo,pedantic:to},Lt={normal:An,gfm:xn,breaks:wo,pedantic:mo};class Ye{constructor(e){oe(this,"tokens");oe(this,"options");oe(this,"state");oe(this,"tokenizer");oe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||lt,this.options.tokenizer=this.options.tokenizer||new Xt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Jt.normal,inline:Lt.normal};this.options.pedantic?(t.block=Jt.pedantic,t.inline=Lt.pedantic):this.options.gfm&&(t.block=Jt.gfm,this.options.breaks?t.inline=Lt.breaks:t.inline=Lt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Jt,inline:Lt}}static lex(e,t){return new Ye(t).lex(e)}static lexInline(e,t){return new Ye(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
17
17
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,c,u)=>c+" ".repeat(u.length));let n,i,o,l;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
18
18
  `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
19
19
  `+n.raw,i.text+=`
@@ -23,9 +23,9 @@
23
23
  `+n.raw,i.text+=`
24
24
  `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),l=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
25
25
  `+n.raw,i.text+=`
26
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,o,l=e,a,c,u;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,a.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(u=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,l,u)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const p=e.slice(1);let d;this.options.extensions.startInline.forEach(g=>{d=g.call({lexer:this},p),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(o=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(u=n.raw.slice(-1)),c=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}}class Jt{constructor(e){oe(this,"options");this.options=e||ot}code(e,t,n){var o;const i=(o=(t||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
27
- `,i?'<pre><code class="language-'+De(i)+'">'+(n?e:De(e,!0))+`</code></pre>
28
- `:"<pre><code>"+(n?e:De(e,!0))+`</code></pre>
26
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,o,l=e,a,c,u;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,a.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(u=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,l,u)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const p=e.slice(1);let d;this.options.extensions.startInline.forEach(g=>{d=g.call({lexer:this},p),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(o=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(u=n.raw.slice(-1)),c=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}}class Kt{constructor(e){oe(this,"options");this.options=e||lt}code(e,t,n){var o;const i=(o=(t||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
27
+ `,i?'<pre><code class="language-'+Fe(i)+'">'+(n?e:Fe(e,!0))+`</code></pre>
28
+ `:"<pre><code>"+(n?e:Fe(e,!0))+`</code></pre>
29
29
  `}blockquote(e){return`<blockquote>
30
30
  ${e}</blockquote>
31
31
  `}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
@@ -41,8 +41,8 @@ ${e}</blockquote>
41
41
  `}tablerow(e){return`<tr>
42
42
  ${e}</tr>
43
43
  `}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
44
- `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=as(e);if(i===null)return n;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){const i=as(e);if(i===null)return n;e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class Rn{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Ge{constructor(e){oe(this,"options");oe(this,"renderer");oe(this,"textRenderer");this.options=e||ot,this.options.renderer=this.options.renderer||new Jt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Rn}static parse(e,t){return new Ge(t).parse(e)}static parseInline(e,t){return new Ge(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=o,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=a||"";continue}}switch(o.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const l=o;n+=this.renderer.heading(this.parseInline(l.tokens),l.depth,ji(this.parseInline(l.tokens,this.textRenderer)));continue}case"code":{const l=o;n+=this.renderer.code(l.text,l.lang,!!l.escaped);continue}case"table":{const l=o;let a="",c="";for(let h=0;h<l.header.length;h++)c+=this.renderer.tablecell(this.parseInline(l.header[h].tokens),{header:!0,align:l.align[h]});a+=this.renderer.tablerow(c);let u="";for(let h=0;h<l.rows.length;h++){const p=l.rows[h];c="";for(let d=0;d<p.length;d++)c+=this.renderer.tablecell(this.parseInline(p[d].tokens),{header:!1,align:l.align[d]});u+=this.renderer.tablerow(c)}n+=this.renderer.table(a,u);continue}case"blockquote":{const l=o,a=this.parse(l.tokens);n+=this.renderer.blockquote(a);continue}case"list":{const l=o,a=l.ordered,c=l.start,u=l.loose;let h="";for(let p=0;p<l.items.length;p++){const d=l.items[p],g=d.checked,w=d.task;let S="";if(d.task){const C=this.renderer.checkbox(!!g);u?d.tokens.length>0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=C+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&d.tokens[0].tokens[0].type==="text"&&(d.tokens[0].tokens[0].text=C+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:C+" "}):S+=C+" "}S+=this.parse(d.tokens,u),h+=this.renderer.listitem(S,w,!!g)}n+=this.renderer.list(h,a,c);continue}case"html":{const l=o;n+=this.renderer.html(l.text,l.block);continue}case"paragraph":{const l=o;n+=this.renderer.paragraph(this.parseInline(l.tokens));continue}case"text":{let l=o,a=l.tokens?this.parseInline(l.tokens):l.text;for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],a+=`
45
- `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}switch(o.type){case"escape":{const l=o;n+=t.text(l.text);break}case"html":{const l=o;n+=t.html(l.text);break}case"link":{const l=o;n+=t.link(l.href,l.title,this.parseInline(l.tokens,t));break}case"image":{const l=o;n+=t.image(l.href,l.title,l.text);break}case"strong":{const l=o;n+=t.strong(this.parseInline(l.tokens,t));break}case"em":{const l=o;n+=t.em(this.parseInline(l.tokens,t));break}case"codespan":{const l=o;n+=t.codespan(l.text);break}case"br":{n+=t.br();break}case"del":{const l=o;n+=t.del(this.parseInline(l.tokens,t));break}case"text":{const l=o;n+=t.text(l.text);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class Lt{constructor(e){oe(this,"options");this.options=e||ot}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}oe(Lt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class ko{constructor(...e){gi(this,at);oe(this,"defaults",yn());oe(this,"options",this.setOptions);oe(this,"parse",cn(this,at,Gn).call(this,qe.lex,Ge.parse));oe(this,"parseInline",cn(this,at,Gn).call(this,qe.lexInline,Ge.parseInline));oe(this,"Parser",Ge);oe(this,"Renderer",Jt);oe(this,"TextRenderer",Rn);oe(this,"Lexer",qe);oe(this,"Tokenizer",Zt);oe(this,"Hooks",Lt);this.use(...e)}walkTokens(e,t){var i,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const a=l;for(const c of a.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of a.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const a=l;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=l;(o=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i=se({},n);if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=t.renderers[o.name];l?t.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=l.apply(this,a)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),i.extensions=t),n.renderer){const o=this.defaults.renderer||new Jt(this.defaults);for(const l in n.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.renderer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p||""}}i.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Zt(this.defaults);for(const l in n.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const a=l,c=n.tokenizer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new Lt;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.hooks[a],u=o[a];Lt.passThroughHooks.has(l)?o[a]=h=>{if(this.defaults.async)return Promise.resolve(c.call(o,h)).then(d=>u.call(o,d));const p=c.call(o,h);return u.call(o,p)}:o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(l.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults=se(se({},this.defaults),i)}),this}setOptions(e){return this.defaults=se(se({},this.defaults),e),this}lexer(e,t){return qe.lex(e,t!=null?t:this.defaults)}parser(e,t){return Ge.parse(e,t!=null?t:this.defaults)}}at=new WeakSet,Gn=function(e,t){return(n,i)=>{const o=se({},i),l=se(se({},this.defaults),o);this.defaults.async===!0&&o.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const a=cn(this,at,mi).call(this,!!l.silent,!!l.async);if(typeof n=="undefined"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(c=>e(c,l)).then(c=>l.hooks?l.hooks.processAllTokens(c):c).then(c=>l.walkTokens?Promise.all(this.walkTokens(c,l.walkTokens)).then(()=>c):c).then(c=>t(c,l)).then(c=>l.hooks?l.hooks.postprocess(c):c).catch(a);try{l.hooks&&(n=l.hooks.preprocess(n));let c=e(n,l);l.hooks&&(c=l.hooks.processAllTokens(c)),l.walkTokens&&this.walkTokens(c,l.walkTokens);let u=t(c,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(c){return a(c)}}},mi=function(e,t){return n=>{if(n.message+=`
46
- Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+De(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const lt=new ko;function ee(s,e){return lt.parse(s,e)}ee.options=ee.setOptions=function(s){return lt.setOptions(s),ee.defaults=lt.defaults,is(ee.defaults),ee},ee.getDefaults=yn,ee.defaults=ot,ee.use=function(...s){return lt.use(...s),ee.defaults=lt.defaults,is(ee.defaults),ee},ee.walkTokens=function(s,e){return lt.walkTokens(s,e)},ee.parseInline=lt.parseInline,ee.Parser=Ge,ee.parser=Ge.parse,ee.Renderer=Jt,ee.TextRenderer=Rn,ee.Lexer=qe,ee.lexer=qe.lex,ee.Tokenizer=Zt,ee.Hooks=Lt,ee.parse=ee,ee.options,ee.setOptions,ee.use,ee.walkTokens,ee.parseInline,Ge.parse,qe.lex;/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:bs,setPrototypeOf:_s,isFrozen:bo,getPrototypeOf:_o,getOwnPropertyDescriptor:yo}=Object;let{freeze:Re,seal:He,create:ys}=Object,{apply:In,construct:zn}=typeof Reflect!="undefined"&&Reflect;Re||(Re=function(e){return e}),He||(He=function(e){return e}),In||(In=function(e,t,n){return e.apply(t,n)}),zn||(zn=function(e,t){return new e(...t)});const Kt=Ne(Array.prototype.forEach),Ts=Ne(Array.prototype.pop),Mt=Ne(Array.prototype.push),$t=Ne(String.prototype.toLowerCase),Cn=Ne(String.prototype.toString),vs=Ne(String.prototype.match),Ot=Ne(String.prototype.replace),To=Ne(String.prototype.indexOf),vo=Ne(String.prototype.trim),Ue=Ne(Object.prototype.hasOwnProperty),Ie=Ne(RegExp.prototype.test),Dt=Eo(TypeError);function Ne(s){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return In(s,e,n)}}function Eo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return zn(s,t)}}function Z(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$t;_s&&_s(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(bo(e)||(e[n]=o),i=o)}s[i]=!0}return s}function So(s){for(let e=0;e<s.length;e++)Ue(s,e)||(s[e]=null);return s}function rt(s){const e=ys(null);for(const[t,n]of bs(s))Ue(s,t)&&(Array.isArray(n)?e[t]=So(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=rt(n):e[t]=n);return e}function Nt(s,e){for(;s!==null;){const n=yo(s,e);if(n){if(n.get)return Ne(n.get);if(typeof n.value=="function")return Ne(n.value)}s=_o(s)}function t(){return null}return t}const Es=Re(["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","section","select","shadow","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"]),Ln=Re(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mn=Re(["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"]),Ao=Re(["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"]),On=Re(["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"]),xo=Re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ss=Re(["#text"]),As=Re(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Dn=Re(["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","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"]),xs=Re(["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"]),en=Re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ro=He(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Io=He(/<%[\w\W]*|[\w\W]*%>/gm),zo=He(/\$\{[\w\W]*}/gm),Co=He(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lo=He(/^aria-[\-\w]+$/),Rs=He(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mo=He(/^(?:\w+script|data):/i),Oo=He(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Is=He(/^html$/i),Do=He(/^[a-z][.\w]*(-[.\w]+)+$/i);var zs=Object.freeze({__proto__:null,ARIA_ATTR:Lo,ATTR_WHITESPACE:Oo,CUSTOM_ELEMENT:Do,DATA_ATTR:Co,DOCTYPE_NAME:Is,ERB_EXPR:Io,IS_ALLOWED_URI:Rs,IS_SCRIPT_OR_DATA:Mo,MUSTACHE_EXPR:Ro,TMPLIT_EXPR:zo});const Pt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},No=function(){return typeof window=="undefined"?null:window},Po=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch(l){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Cs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ls(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:No();const e=D=>Ls(D);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==Pt.document)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:g}=s,w=c.prototype,S=Nt(w,"cloneNode"),C=Nt(w,"remove"),M=Nt(w,"nextSibling"),v=Nt(w,"childNodes"),b=Nt(w,"parentNode");if(typeof l=="function"){const D=t.createElement("template");D.content&&D.content.ownerDocument&&(t=D.content.ownerDocument)}let k,y="";const{implementation:A,createNodeIterator:T,createDocumentFragment:z,getElementsByTagName:R}=t,{importNode:F}=n;let I=Cs();e.isSupported=typeof bs=="function"&&typeof b=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:j,ERB_EXPR:V,TMPLIT_EXPR:K,DATA_ATTR:ae,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:de,ATTR_WHITESPACE:je,CUSTOM_ELEMENT:ue}=zs;let{IS_ALLOWED_URI:Ye}=zs,ce=null;const Ke=Z({},[...Es,...Ln,...Mn,...On,...Ss]);let re=null;const ze=Z({},[...As,...Dn,...xs,...en]);let te=Object.seal(ys(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}})),Me=null,Ee=null,$e=!0,O=!0,ie=!1,N=!0,Y=!1,Se=!0,Ae=!1,We=!1,Ze=!1,nt=!1,_t=!1,yt=!1,nn=!0,sn=!1;const Hn="user-content-";let Ft=!0,ct=!1,st={},_=null;const B=Z({},["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"]);let Q=null;const he=Z({},["audio","video","img","source","image","track"]);let pe=null;const Be=Z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),we="http://www.w3.org/1998/Math/MathML",on="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml";let Tt=et,Bn=!1,Un=null;const cl=Z({},[we,on,et],Cn);let ln=Z({},["mi","mo","mn","ms","mtext"]),rn=Z({},["annotation-xml"]);const ul=Z({},["title","style","font","a","script"]);let Ht=null;const fl=["application/xhtml+xml","text/html"],hl="text/html";let _e=null,vt=null;const pl=t.createElement("form"),ti=function(f){return f instanceof RegExp||f instanceof Function},jn=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(vt&&vt===f)){if((!f||typeof f!="object")&&(f={}),f=rt(f),Ht=fl.indexOf(f.PARSER_MEDIA_TYPE)===-1?hl:f.PARSER_MEDIA_TYPE,_e=Ht==="application/xhtml+xml"?Cn:$t,ce=Ue(f,"ALLOWED_TAGS")?Z({},f.ALLOWED_TAGS,_e):Ke,re=Ue(f,"ALLOWED_ATTR")?Z({},f.ALLOWED_ATTR,_e):ze,Un=Ue(f,"ALLOWED_NAMESPACES")?Z({},f.ALLOWED_NAMESPACES,Cn):cl,pe=Ue(f,"ADD_URI_SAFE_ATTR")?Z(rt(Be),f.ADD_URI_SAFE_ATTR,_e):Be,Q=Ue(f,"ADD_DATA_URI_TAGS")?Z(rt(he),f.ADD_DATA_URI_TAGS,_e):he,_=Ue(f,"FORBID_CONTENTS")?Z({},f.FORBID_CONTENTS,_e):B,Me=Ue(f,"FORBID_TAGS")?Z({},f.FORBID_TAGS,_e):{},Ee=Ue(f,"FORBID_ATTR")?Z({},f.FORBID_ATTR,_e):{},st=Ue(f,"USE_PROFILES")?f.USE_PROFILES:!1,$e=f.ALLOW_ARIA_ATTR!==!1,O=f.ALLOW_DATA_ATTR!==!1,ie=f.ALLOW_UNKNOWN_PROTOCOLS||!1,N=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=f.SAFE_FOR_TEMPLATES||!1,Se=f.SAFE_FOR_XML!==!1,Ae=f.WHOLE_DOCUMENT||!1,nt=f.RETURN_DOM||!1,_t=f.RETURN_DOM_FRAGMENT||!1,yt=f.RETURN_TRUSTED_TYPE||!1,Ze=f.FORCE_BODY||!1,nn=f.SANITIZE_DOM!==!1,sn=f.SANITIZE_NAMED_PROPS||!1,Ft=f.KEEP_CONTENT!==!1,ct=f.IN_PLACE||!1,Ye=f.ALLOWED_URI_REGEXP||Rs,Tt=f.NAMESPACE||et,ln=f.MATHML_TEXT_INTEGRATION_POINTS||ln,rn=f.HTML_INTEGRATION_POINTS||rn,te=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&ti(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&ti(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(O=!1),_t&&(nt=!0),st&&(ce=Z({},Ss),re=[],st.html===!0&&(Z(ce,Es),Z(re,As)),st.svg===!0&&(Z(ce,Ln),Z(re,Dn),Z(re,en)),st.svgFilters===!0&&(Z(ce,Mn),Z(re,Dn),Z(re,en)),st.mathMl===!0&&(Z(ce,On),Z(re,xs),Z(re,en))),f.ADD_TAGS&&(ce===Ke&&(ce=rt(ce)),Z(ce,f.ADD_TAGS,_e)),f.ADD_ATTR&&(re===ze&&(re=rt(re)),Z(re,f.ADD_ATTR,_e)),f.ADD_URI_SAFE_ATTR&&Z(pe,f.ADD_URI_SAFE_ATTR,_e),f.FORBID_CONTENTS&&(_===B&&(_=rt(_)),Z(_,f.FORBID_CONTENTS,_e)),Ft&&(ce["#text"]=!0),Ae&&Z(ce,["html","head","body"]),ce.table&&(Z(ce,["tbody"]),delete Me.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,y=k.createHTML("")}else k===void 0&&(k=Po(g,i)),k!==null&&typeof y=="string"&&(y=k.createHTML(""));Re&&Re(f),vt=f}},ni=Z({},[...Ln,...Mn,...Ao]),si=Z({},[...On,...xo]),dl=function(f){let E=b(f);(!E||!E.tagName)&&(E={namespaceURI:Tt,tagName:"template"});const L=$t(f.tagName),fe=$t(E.tagName);return Un[f.namespaceURI]?f.namespaceURI===on?E.namespaceURI===et?L==="svg":E.namespaceURI===we?L==="svg"&&(fe==="annotation-xml"||ln[fe]):!!ni[L]:f.namespaceURI===we?E.namespaceURI===et?L==="math":E.namespaceURI===on?L==="math"&&rn[fe]:!!si[L]:f.namespaceURI===et?E.namespaceURI===on&&!rn[fe]||E.namespaceURI===we&&!ln[fe]?!1:!si[L]&&(ul[L]||!ni[L]):!!(Ht==="application/xhtml+xml"&&Un[f.namespaceURI]):!1},Xe=function(f){Mt(e.removed,{element:f});try{b(f).removeChild(f)}catch(E){C(f)}},an=function(f,E){try{Mt(e.removed,{attribute:E.getAttributeNode(f),from:E})}catch(L){Mt(e.removed,{attribute:null,from:E})}if(E.removeAttribute(f),f==="is")if(nt||_t)try{Xe(E)}catch(L){}else try{E.setAttribute(f,"")}catch(L){}},ii=function(f){let E=null,L=null;if(Ze)f="<remove></remove>"+f;else{const ye=vs(f,/^[\r\n\t ]+/);L=ye&&ye[0]}Ht==="application/xhtml+xml"&&Tt===et&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const fe=k?k.createHTML(f):f;if(Tt===et)try{E=new d().parseFromString(fe,Ht)}catch(ye){}if(!E||!E.documentElement){E=A.createDocument(Tt,"template",null);try{E.documentElement.innerHTML=Bn?y:fe}catch(ye){}}const xe=E.body||E.documentElement;return f&&L&&xe.insertBefore(t.createTextNode(L),xe.childNodes[0]||null),Tt===et?R.call(E,Ae?"html":"body")[0]:Ae?E.documentElement:xe},oi=function(f){return T.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Wn=function(f){return f instanceof p&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof h)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},li=function(f){return typeof a=="function"&&f instanceof a};function tt(D,f,E){Kt(D,L=>{L.call(e,f,E,vt)})}const ri=function(f){let E=null;if(tt(I.beforeSanitizeElements,f,null),Wn(f))return Xe(f),!0;const L=_e(f.nodeName);if(tt(I.uponSanitizeElement,f,{tagName:L,allowedTags:ce}),f.hasChildNodes()&&!li(f.firstElementChild)&&Ie(/<[/\w]/g,f.innerHTML)&&Ie(/<[/\w]/g,f.textContent)||f.nodeType===Pt.progressingInstruction||Se&&f.nodeType===Pt.comment&&Ie(/<[/\w]/g,f.data))return Xe(f),!0;if(!ce[L]||Me[L]){if(!Me[L]&&ci(L)&&(te.tagNameCheck instanceof RegExp&&Ie(te.tagNameCheck,L)||te.tagNameCheck instanceof Function&&te.tagNameCheck(L)))return!1;if(Ft&&!_[L]){const fe=b(f)||f.parentNode,xe=v(f)||f.childNodes;if(xe&&fe){const ye=xe.length;for(let Oe=ye-1;Oe>=0;--Oe){const Ve=S(xe[Oe],!0);Ve.__removalCount=(f.__removalCount||0)+1,fe.insertBefore(Ve,M(f))}}}return Xe(f),!0}return f instanceof c&&!dl(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&Ie(/<\/no(script|embed|frames)/i,f.innerHTML)?(Xe(f),!0):(Y&&f.nodeType===Pt.text&&(E=f.textContent,Kt([j,V,K],fe=>{E=Ot(E,fe," ")}),f.textContent!==E&&(Mt(e.removed,{element:f.cloneNode()}),f.textContent=E)),tt(I.afterSanitizeElements,f,null),!1)},ai=function(f,E,L){if(nn&&(E==="id"||E==="name")&&(L in t||L in pl))return!1;if(!(O&&!Ee[E]&&Ie(ae,E))){if(!($e&&Ie(me,E))){if(!re[E]||Ee[E]){if(!(ci(f)&&(te.tagNameCheck instanceof RegExp&&Ie(te.tagNameCheck,f)||te.tagNameCheck instanceof Function&&te.tagNameCheck(f))&&(te.attributeNameCheck instanceof RegExp&&Ie(te.attributeNameCheck,E)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(E))||E==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&Ie(te.tagNameCheck,L)||te.tagNameCheck instanceof Function&&te.tagNameCheck(L))))return!1}else if(!pe[E]){if(!Ie(Ye,Ot(L,je,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&f!=="script"&&To(L,"data:")===0&&Q[f])){if(!(ie&&!Ie(de,Ot(L,je,"")))){if(L)return!1}}}}}}return!0},ci=function(f){return f!=="annotation-xml"&&vs(f,ue)},ui=function(f){tt(I.beforeSanitizeAttributes,f,null);const{attributes:E}=f;if(!E||Wn(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:re,forceKeepAttr:void 0};let fe=E.length;for(;fe--;){const xe=E[fe],{name:ye,namespaceURI:Oe,value:Ve}=xe,Bt=_e(ye);let Ce=ye==="value"?Ve:vo(Ve);if(L.attrName=Bt,L.attrValue=Ce,L.keepAttr=!0,L.forceKeepAttr=void 0,tt(I.uponSanitizeAttribute,f,L),Ce=L.attrValue,sn&&(Bt==="id"||Bt==="name")&&(an(ye,f),Ce=Hn+Ce),Se&&Ie(/((--!?|])>)|<\/(style|title)/i,Ce)){an(ye,f);continue}if(L.forceKeepAttr||(an(ye,f),!L.keepAttr))continue;if(!N&&Ie(/\/>/i,Ce)){an(ye,f);continue}Y&&Kt([j,V,K],hi=>{Ce=Ot(Ce,hi," ")});const fi=_e(f.nodeName);if(ai(fi,Bt,Ce)){if(k&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Oe)switch(g.getAttributeType(fi,Bt)){case"TrustedHTML":{Ce=k.createHTML(Ce);break}case"TrustedScriptURL":{Ce=k.createScriptURL(Ce);break}}try{Oe?f.setAttributeNS(Oe,ye,Ce):f.setAttribute(ye,Ce),Wn(f)?Xe(f):Ts(e.removed)}catch(hi){}}}tt(I.afterSanitizeAttributes,f,null)},gl=function D(f){let E=null;const L=oi(f);for(tt(I.beforeSanitizeShadowDOM,f,null);E=L.nextNode();)tt(I.uponSanitizeShadowNode,E,null),ri(E),ui(E),E.content instanceof o&&D(E.content);tt(I.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(D){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,fe=null,xe=null;if(Bn=!D,Bn&&(D="<!-->"),typeof D!="string"&&!li(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw Dt("dirty is not a string, aborting")}else throw Dt("toString is not a function");if(!e.isSupported)return D;if(We||jn(f),e.removed=[],typeof D=="string"&&(ct=!1),ct){if(D.nodeName){const Ve=_e(D.nodeName);if(!ce[Ve]||Me[Ve])throw Dt("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof a)E=ii("<!---->"),L=E.ownerDocument.importNode(D,!0),L.nodeType===Pt.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!nt&&!Y&&!Ae&&D.indexOf("<")===-1)return k&&yt?k.createHTML(D):D;if(E=ii(D),!E)return nt?null:yt?y:""}E&&Ze&&Xe(E.firstChild);const ye=oi(ct?D:E);for(;fe=ye.nextNode();)ri(fe),ui(fe),fe.content instanceof o&&gl(fe.content);if(ct)return D;if(nt){if(_t)for(xe=z.call(E.ownerDocument);E.firstChild;)xe.appendChild(E.firstChild);else xe=E;return(re.shadowroot||re.shadowrootmode)&&(xe=F.call(n,xe,!0)),xe}let Oe=Ae?E.outerHTML:E.innerHTML;return Ae&&ce["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&Ie(Is,E.ownerDocument.doctype.name)&&(Oe="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
47
- `+Oe),Y&&Kt([j,V,K],Ve=>{Oe=Ot(Oe,Ve," ")}),k&&yt?k.createHTML(Oe):Oe},e.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jn(D),We=!0},e.clearConfig=function(){vt=null,We=!1},e.isValidAttribute=function(D,f,E){vt||jn({});const L=_e(D),fe=_e(f);return ai(L,fe,E)},e.addHook=function(D,f){typeof f=="function"&&Mt(I[D],f)},e.removeHook=function(D){return Ts(I[D])},e.removeHooks=function(D){I[D]=[]},e.removeAllHooks=function(){I=Cs()},e}var Ms=Ls();function Os(s){var n;if(typeof document=="undefined")return null;const t=`; ${document.cookie}`.split(`; ${s}=`);return t.length===2&&((n=t.pop())==null?void 0:n.split(";").shift())||null}const be=()=>{if(typeof window=="undefined")return null;const s=Os("access_token");if(s)return s;const e=Os("auth_token");if(e)return e;const t=sessionStorage.getItem("vuex");if(t)try{const n=JSON.parse(t);if(n!=null&&n.token)return n.token}catch(n){console.error("Failed to parse vuex data:",n)}return null};function Ds(s,e,t){const n=s.slice();return n[24]=e[t],n}function Ns(s){let e,t=s[9].text+"",n;return{c(){e=x("div"),n=ve(t),r(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),P(e,"left",s[9].x+"px"),P(e,"top",s[9].y+"px"),P(e,"z-index",s[3]+3)},m(i,o){q(i,e,o),m(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&Pe(n,t),o&512&&P(e,"left",i[9].x+"px"),o&512&&P(e,"top",i[9].y+"px"),o&8&&P(e,"z-index",i[3]+3)},d(i){i&&W(e)}}}function Fo(s){let e=[],t=new Map,n,i,o=kt(s[0]);const l=c=>c[24].sessionId;for(let c=0;c<o.length;c+=1){let u=Ds(s,o,c),h=l(u);t.set(h,e[c]=Ps(h,u))}let a=s[5]&&Fs();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=G(),a&&a.c(),i=jt()},m(c,u){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(c,u);q(c,n,u),a&&a.m(c,u),q(c,i,u)},p(c,u){u&8261&&(o=kt(c[0]),e=es(e,u,l,1,c,o,t,n.parentNode,$n,Ps,n,Ds)),c[5]?a||(a=Fs(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},d(c){c&&(W(n),W(i));for(let u=0;u<e.length;u+=1)e[u].d(c);a&&a.d(c)}}}function Ho(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=x("div"),n=ve(t),r(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){q(i,e,o),m(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Pe(n,t)},d(i){i&&W(e)}}}function Ps(s,e){let t,n,i,o,l=e[24].title+"",a,c,u,h=Bs(e[24].timestamp)+"",p,d,g,w,S,C,M,v,b,k,y;function A(){return e[17](e[24])}function T(...z){return e[18](e[24],...z)}return{key:s,first:null,c(){t=x("div"),n=x("button"),i=x("div"),o=x("div"),a=ve(l),c=G(),u=x("div"),p=ve(h),d=G(),g=x("button"),w=X("svg"),S=X("path"),C=X("path"),M=X("path"),r(o,"class","sy-session-title svelte-1g6fj9a"),r(u,"class","sy-session-time svelte-1g6fj9a"),r(i,"class","sy-session-info svelte-1g6fj9a"),r(n,"class","sy-session-select svelte-1g6fj9a"),r(S,"d","M3 6h18"),r(C,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),r(M,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),r(w,"xmlns","http://www.w3.org/2000/svg"),r(w,"width","16"),r(w,"height","16"),r(w,"viewBox","0 0 24 24"),r(w,"fill","none"),r(w,"stroke","currentColor"),r(w,"stroke-width","2"),r(w,"stroke-linecap","round"),r(w,"stroke-linejoin","round"),r(g,"class","sy-session-delete svelte-1g6fj9a"),g.disabled=v=e[6]===e[24].sessionId,r(g,"aria-label","删除会话"),r(t,"class","sy-session-item svelte-1g6fj9a"),r(t,"data-session-id",b=e[24].sessionId),J(t,"deleting",e[24].deleting),this.first=t},m(z,R){q(z,t,R),m(t,n),m(n,i),m(i,o),m(o,a),m(i,c),m(i,u),m(u,p),m(t,d),m(t,g),m(g,w),m(w,S),m(w,C),m(w,M),k||(y=[U(n,"click",A),U(g,"click",T)],k=!0)},p(z,R){e=z,R&1&&l!==(l=e[24].title+"")&&Pe(a,l),R&1&&h!==(h=Bs(e[24].timestamp)+"")&&Pe(p,h),R&65&&v!==(v=e[6]===e[24].sessionId)&&(g.disabled=v),R&1&&b!==(b=e[24].sessionId)&&r(t,"data-session-id",b),R&1&&J(t,"deleting",e[24].deleting)},d(z){z&&W(t),k=!1,ke(y)}}}function Fs(s){let e;return{c(){e=x("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',r(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){q(t,e,n)},d(t){t&&W(e)}}}function Hs(s){let e,t,n,i,o,l,a,c,u;return{c(){e=x("div"),t=x("div"),t.textContent="确认删除此会话?",n=G(),i=x("div"),o=x("button"),o.textContent="取消",l=G(),a=x("button"),a.textContent="删除",r(t,"class","sy-session-confirm-content svelte-1g6fj9a"),r(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),r(a,"class","sy-session-confirm-delete svelte-1g6fj9a"),r(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),r(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),P(e,"left",s[8].x+"px"),P(e,"top",s[8].y+"px"),P(e,"z-index",s[3]+3)},m(h,p){q(h,e,p),m(e,t),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[U(o,"click",s[19]),U(a,"click",s[14])],c=!0)},p(h,p){p&256&&P(e,"left",h[8].x+"px"),p&256&&P(e,"top",h[8].y+"px"),p&8&&P(e,"z-index",h[3]+3)},d(h){h&&W(e),c=!1,ke(u)}}}function Bo(s){let e,t,n,i,o,l,a,c,u,h,p,d,g,w,S,C,M,v,b,k=s[9]&&Ns(s);function y(R,F){return R[0].length===0?Ho:Fo}let A=y(s),T=A(s),z=s[7]&&Hs(s);return{c(){e=x("div"),t=x("div"),n=x("h2"),n.textContent="历史会话",i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',l=G(),a=x("div"),c=x("input"),u=G(),h=X("svg"),p=X("circle"),d=X("line"),g=G(),k&&k.c(),w=G(),S=x("div"),T.c(),C=G(),z&&z.c(),M=jt(),r(n,"class","svelte-1g6fj9a"),r(o,"class","sy-session-close svelte-1g6fj9a"),r(o,"aria-label","关闭历史会话"),r(t,"class","sy-session-header svelte-1g6fj9a"),r(c,"type","text"),r(c,"class","sy-session-search-input svelte-1g6fj9a"),r(c,"placeholder","搜索历史会话..."),r(p,"cx","11"),r(p,"cy","11"),r(p,"r","8"),r(d,"x1","21"),r(d,"y1","21"),r(d,"x2","16.65"),r(d,"y2","16.65"),r(h,"class","sy-session-search-icon svelte-1g6fj9a"),r(h,"xmlns","http://www.w3.org/2000/svg"),r(h,"width","16"),r(h,"height","16"),r(h,"viewBox","0 0 24 24"),r(h,"fill","none"),r(h,"stroke","currentColor"),r(h,"stroke-width","2"),r(h,"stroke-linecap","round"),r(h,"stroke-linejoin","round"),r(a,"class","sy-session-search svelte-1g6fj9a"),r(S,"class","sy-session-list svelte-1g6fj9a"),r(e,"class","sy-session-history svelte-1g6fj9a"),P(e,"z-index",s[3]+2)},m(R,F){q(R,e,F),m(e,t),m(t,n),m(t,i),m(t,o),m(e,l),m(e,a),m(a,c),pt(c,s[4]),m(a,u),m(a,h),m(h,p),m(h,d),m(e,g),k&&k.m(e,null),m(e,w),m(e,S),T.m(S,null),q(R,C,F),z&&z.m(R,F),q(R,M,F),v||(b=[U(o,"click",function(){Et(s[1])&&s[1].apply(this,arguments)}),U(o,"mouseenter",s[15]),U(o,"mouseleave",s[12]),U(c,"input",s[16]),U(S,"scroll",s[10])],v=!0)},p(R,[F]){s=R,F&16&&c.value!==s[4]&&pt(c,s[4]),s[9]?k?k.p(s,F):(k=Ns(s),k.c(),k.m(e,w)):k&&(k.d(1),k=null),A===(A=y(s))&&T?T.p(s,F):(T.d(1),T=A(s),T&&(T.c(),T.m(S,null))),F&8&&P(e,"z-index",s[3]+2),s[7]?z?z.p(s,F):(z=Hs(s),z.c(),z.m(M.parentNode,M)):z&&(z.d(1),z=null)},i:H,o:H,d(R){R&&(W(e),W(C),W(M)),k&&k.d(),T.d(),z&&z.d(R),v=!1,ke(b)}}}const Nn=10;function Bs(s){return new Date(s).toLocaleString()}function Uo(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:o}=e,{zIndex:l}=e,a=!1,c=!0,u=0,h="",p=null,d=null,g={x:0,y:0};function w(){return Le(this,null,function*(){if(!(a||!c)){t(5,a=!0);try{const I=yield fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({start:u,length:Nn,keyword:h})});if(!I.ok)throw new Error("Failed to load sessions");const j=yield I.json();if(j.code===0){const V=j.data.sessionList.map(K=>({sessionId:K.sessionId,title:K.name,timestamp:new Date(K.createDate).getTime()}));t(0,n=[...n,...V]),u+=Nn,c=V.length===Nn}}catch(I){console.error("Failed to load sessions:",I)}finally{t(5,a=!1)}}})}function S(I){const j=I.target,{scrollTop:V,scrollHeight:K,clientHeight:ae}=j;K-V-ae<50&&w()}Qn(()=>{w()});let C=null;function M(I,j){const K=I.currentTarget.getBoundingClientRect();t(9,C={text:j,x:K.left+K.width/2,y:K.bottom+8})}function v(){t(9,C=null)}function b(I,j){const K=I.currentTarget.getBoundingClientRect();t(8,g={x:K.left-16,y:K.top+K.height/2}),t(7,d=j)}function k(I){return Le(this,null,function*(){if(I&&!p)try{t(6,p=I),t(7,d=null);const j=document.querySelector(`[data-session-id="${I}"]`);j&&j.classList.add("deleting"),yield new Promise(ae=>setTimeout(ae,300));const V=yield fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:I})});if(!V.ok)throw new Error("Delete request failed");const K=yield V.json();if(K.code===0&&K.data.respCode===0)t(0,n=n.map(ae=>Te(se({},ae),{deleting:ae.sessionId===I}))),setTimeout(()=>{t(0,n=n.filter(ae=>!ae.deleting))},300);else throw new Error("Delete failed: "+K.message)}catch(j){console.error("Failed to delete session:",j);const V=document.querySelector(`[data-session-id="${I}"]`);V&&V.classList.remove("deleting")}finally{t(6,p=null)}})}function y(){d&&k(d)}const A=I=>M(I,"关闭历史会话");function T(){h=this.value,t(4,h)}const z=I=>o(I.sessionId),R=(I,j)=>b(j,I.sessionId),F=()=>t(7,d=null);return s.$$set=I=>{"sessions"in I&&t(0,n=I.sessions),"onClose"in I&&t(1,i=I.onClose),"onSelect"in I&&t(2,o=I.onSelect),"zIndex"in I&&t(3,l=I.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&h!==void 0&&(t(0,n=[]),u=0,c=!0,w())},[n,i,o,l,h,a,p,d,g,C,S,M,v,b,y,A,T,z,R,F]}class Us extends kn{constructor(e){super(),wn(this,e,Uo,Bo,ut,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function js(s,e,t){const n=s.slice();return n[60]=e[t],n[61]=e,n[62]=t,n}function Ws(s,e,t){const n=s.slice();return n[63]=e[t],n[65]=t,n}function jo(s){let e,t=[],n=new Map,i=kt(s[3]);const o=l=>l[60].id;for(let l=0;l<i.length;l+=1){let a=js(s,i,l),c=o(a);n.set(c,t[l]=Qs(c,a))}return{c(){e=x("div");for(let l=0;l<t.length;l+=1)t[l].c();r(e,"class","sy-assistant-message-list svelte-46wzni")},m(l,a){q(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[47](e)},p(l,a){a[0]&268058361&&(i=kt(l[3]),t=es(t,a,o,1,l,i,n,e,$n,Qs,null,js))},i:H,o:H,d(l){l&&W(e);for(let a=0;a<t.length;a+=1)t[a].d();s[47](null)}}}function Wo(s){let e,t;return e=new Us({props:{sessions:s[28],onClose:s[30],onSelect:s[31],zIndex:s[0]}}),{c(){mn(e.$$.fragment)},m(n,i){qt(e,n,i),t=!0},p(n,i){const o={};i[0]&1&&(o.zIndex=n[0]),e.$set(o)},i(n){t||(Fe(e.$$.fragment,n),t=!0)},o(n){Je(e.$$.fragment,n),t=!1},d(n){Gt(e,n)}}}function qo(s){let e;return{c(){e=x("div"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></svg>',r(e,"class","sy-assistant-avatar user svelte-46wzni")},m(t,n){q(t,e,n)},d(t){t&&W(e)}}}function Go(s){let e;return{c(){e=x("div"),e.innerHTML='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor"><path d="M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z" fill="#6F8698"></path><path d="M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z" fill="#3677FF"></path><path d="M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z" fill="#D0D5F1"></path><path d="M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z" fill="#3677FF"></path><path d="M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z" fill="#8896A4"></path></svg>',r(e,"class","sy-assistant-avatar assistant svelte-46wzni")},m(t,n){q(t,e,n)},d(t){t&&W(e)}}}function Yo(s){let e,t=s[17](s[60].content)+"";return{c(){e=x("div"),r(e,"class","markdown-content svelte-46wzni")},m(n,i){q(n,e,i),e.innerHTML=t},p(n,i){i[0]&8&&t!==(t=n[17](n[60].content)+"")&&(e.innerHTML=t)},d(n){n&&W(e)}}}function Zo(s){let e;return{c(){e=x("span"),e.innerHTML='<span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span> <span class="dot svelte-46wzni">.</span>',r(e,"class","sy-assistant-loading svelte-46wzni")},m(t,n){q(t,e,n)},p:H,d(t){t&&W(e)}}}function qs(s){let e,t=kt(s[60].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=Zs(Ws(s,t,i));return{c(){e=x("div");for(let i=0;i<n.length;i+=1)n[i].c();r(e,"class","sy-assistant-attachments svelte-46wzni")},m(i,o){q(i,e,o);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(e,null)},p(i,o){if(o[0]&3670137){t=kt(i[60].attachments);let l;for(l=0;l<t.length;l+=1){const a=Ws(i,t,l);n[l]?n[l].p(a,o):(n[l]=Zs(a),n[l].c(),n[l].m(e,null))}for(;l<n.length;l+=1)n[l].d(1);n.length=t.length}},d(i){i&&W(e),ki(n,i)}}}function Gs(s){let e,t,n;function i(...o){return s[34](s[63],...o)}return{c(){e=x("button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',r(e,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(e,"aria-label","查看详情")},m(o,l){q(o,e,l),t||(n=[U(e,"mouseenter",i),U(e,"mouseleave",s[20])],t=!0)},p(o,l){s=o},d(o){o&&W(e),t=!1,ke(n)}}}function Ys(s){let e,t=s[4].replace(/\n/g,"<br>")+"",n,i;return{c(){e=x("div"),r(e,"class","sy-assistant-tooltip svelte-46wzni"),r(e,"role","tooltip"),P(e,"left",s[5].x+"px"),P(e,"top",s[5].y+"px"),P(e,"z-index",s[0]+3),J(e,"align-right",s[5].alignRight)},m(o,l){q(o,e,l),e.innerHTML=t,n||(i=[U(e,"mouseenter",s[36]),U(e,"mouseleave",s[37])],n=!0)},p(o,l){l[0]&16&&t!==(t=o[4].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&32&&P(e,"left",o[5].x+"px"),l[0]&32&&P(e,"top",o[5].y+"px"),l[0]&1&&P(e,"z-index",o[0]+3),l[0]&32&&J(e,"align-right",o[5].alignRight)},d(o){o&&W(e),n=!1,ke(i)}}}function Zs(s){let e,t,n,i,o,l,a,c,u,h=tn(s[63].content_title).name+"",p,d,g,w=tn(s[63].content_title).ext+"",S,C,M,v,b,k,y,A,T,z,R=s[63].tips&&Gs(s);function F(){return s[35](s[63])}let I=s[4]&&Ys(s);return{c(){e=x("div"),t=x("div"),n=x("div"),i=X("svg"),o=X("path"),l=X("polyline"),a=G(),c=x("div"),u=x("span"),p=ve(h),d=G(),g=x("span"),S=ve(w),M=G(),v=x("div"),R&&R.c(),b=G(),k=x("button"),k.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-46wzni"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>',y=G(),I&&I.c(),A=G(),r(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),r(l,"points","13 2 13 9 20 9"),r(i,"xmlns","http://www.w3.org/2000/svg"),r(i,"width","16"),r(i,"height","16"),r(i,"viewBox","0 0 24 24"),r(i,"fill","none"),r(i,"stroke","currentColor"),r(i,"stroke-width","2"),r(i,"stroke-linecap","round"),r(i,"stroke-linejoin","round"),r(u,"class","sy-assistant-filename svelte-46wzni"),r(g,"class","sy-assistant-attachment-ext svelte-46wzni"),r(c,"class","sy-assistant-attachment-name svelte-46wzni"),r(c,"title",C=s[63].content_title),r(n,"class","sy-assistant-attachment-title svelte-46wzni"),r(k,"class","sy-assistant-attachment-toggle svelte-46wzni"),r(k,"aria-label","下载文件"),r(v,"class","sy-assistant-attachment-actions svelte-46wzni"),r(t,"class","sy-assistant-attachment-header svelte-46wzni"),r(e,"class","sy-assistant-attachment svelte-46wzni")},m(j,V){q(j,e,V),m(e,t),m(t,n),m(n,i),m(i,o),m(i,l),m(n,a),m(n,c),m(c,u),m(u,p),m(c,d),m(c,g),m(g,S),m(t,M),m(t,v),R&&R.m(v,null),m(v,b),m(v,k),m(e,y),I&&I.m(e,null),m(e,A),T||(z=U(k,"click",F),T=!0)},p(j,V){s=j,V[0]&8&&h!==(h=tn(s[63].content_title).name+"")&&Pe(p,h),V[0]&8&&w!==(w=tn(s[63].content_title).ext+"")&&Pe(S,w),V[0]&8&&C!==(C=s[63].content_title)&&r(c,"title",C),s[63].tips?R?R.p(s,V):(R=Gs(s),R.c(),R.m(v,b)):R&&(R.d(1),R=null),s[4]?I?I.p(s,V):(I=Ys(s),I.c(),I.m(e,A)):I&&(I.d(1),I=null)},d(j){j&&W(e),R&&R.d(),I&&I.d(),T=!1,z()}}}function Xs(s){let e,t,n,i,o,l,a,c,u,h,p;function d(A,T){return A[9][A[60].id]?Vo:Xo}let g=d(s),w=g(s);function S(){return s[38](s[60])}function C(...A){return s[39](s[60],...A)}function M(){return s[40](s[60])}function v(...A){return s[41](s[60],...A)}function b(...A){return s[42](s[60],...A)}function k(...A){return s[43](s[60],...A)}let y=s[12]&&s[10][s[60].id]==="dislike"&&Vs(s);return{c(){e=x("div"),t=x("button"),w.c(),i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',l=G(),a=x("button"),a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h3a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-3"></path></svg>',c=G(),y&&y.c(),u=jt(),r(t,"class","sy-assistant-action-button svelte-46wzni"),r(t,"aria-label",n=s[9][s[60].id]?"已复制":"复制内容"),J(t,"copied",s[9][s[60].id]),r(o,"class","sy-assistant-action-button svelte-46wzni"),r(o,"aria-label","点赞"),J(o,"active",s[10][s[60].id]==="like"),r(a,"class","sy-assistant-action-button svelte-46wzni"),r(a,"aria-label","点踩"),J(a,"active",s[10][s[60].id]==="dislike"),r(e,"class","sy-assistant-message-actions svelte-46wzni")},m(A,T){q(A,e,T),m(e,t),w.m(t,null),m(e,i),m(e,o),m(e,l),m(e,a),q(A,c,T),y&&y.m(A,T),q(A,u,T),h||(p=[U(t,"click",S),U(t,"mouseenter",C),U(t,"mouseleave",s[27]),U(o,"click",M),U(o,"mouseenter",v),U(o,"mouseleave",s[27]),U(a,"click",b),U(a,"mouseenter",k),U(a,"mouseleave",s[27])],h=!0)},p(A,T){s=A,g!==(g=d(s))&&(w.d(1),w=g(s),w&&(w.c(),w.m(t,null))),T[0]&520&&n!==(n=s[9][s[60].id]?"已复制":"复制内容")&&r(t,"aria-label",n),T[0]&520&&J(t,"copied",s[9][s[60].id]),T[0]&1032&&J(o,"active",s[10][s[60].id]==="like"),T[0]&1032&&J(a,"active",s[10][s[60].id]==="dislike"),s[12]&&s[10][s[60].id]==="dislike"?y?y.p(s,T):(y=Vs(s),y.c(),y.m(u.parentNode,u)):y&&(y.d(1),y=null)},d(A){A&&(W(e),W(c),W(u)),w.d(),y&&y.d(A),h=!1,ke(p)}}}function Xo(s){let e,t,n;return{c(){e=X("svg"),t=X("rect"),n=X("path"),r(t,"x","9"),r(t,"y","9"),r(t,"width","13"),r(t,"height","13"),r(t,"rx","2"),r(t,"ry","2"),r(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(i,o){q(i,e,o),m(e,t),m(e,n)},d(i){i&&W(e)}}}function Vo(s){let e,t;return{c(){e=X("svg"),t=X("polyline"),r(t,"points","20 6 9 17 4 12"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(n,i){q(n,e,i),m(e,t)},d(n){n&&W(e)}}}function Vs(s){let e,t,n,i,o,l,a,c,u;function h(){s[44].call(t,s[60])}function p(){return s[45](s[60])}function d(){return s[46](s[60])}return{c(){e=x("div"),t=x("textarea"),n=G(),i=x("div"),o=x("button"),o.textContent="取消",l=G(),a=x("button"),a.textContent="提交",r(t,"class","sy-assistant-dislike-input svelte-46wzni"),r(t,"placeholder","请输入您的反馈意见..."),r(o,"class","sy-assistant-popup-cancel svelte-46wzni"),r(a,"class","sy-assistant-popup-submit svelte-46wzni"),r(i,"class","sy-assistant-popup-actions svelte-46wzni"),r(e,"class","sy-assistant-dislike-popup svelte-46wzni"),P(e,"left",s[13].x+"px"),P(e,"top",s[13].y+"px"),P(e,"z-index",s[0]+3)},m(g,w){q(g,e,w),m(e,t),pt(t,s[11][s[60].id]),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[U(t,"input",h),U(o,"click",p),U(a,"click",d)],c=!0)},p(g,w){s=g,w[0]&2056&&pt(t,s[11][s[60].id]),w[0]&8192&&P(e,"left",s[13].x+"px"),w[0]&8192&&P(e,"top",s[13].y+"px"),w[0]&1&&P(e,"z-index",s[0]+3)},d(g){g&&W(e),c=!1,ke(u)}}}function Qs(s,e){let t,n,i,o,l,a,c,u,h=new Date(e[60].timestamp).toLocaleTimeString()+"",p,d;function g(y,A){return y[60].type==="assistant"?Go:qo}let w=g(e),S=w(e);function C(y,A){return y[7]&&y[60].id===y[3][y[3].length-1].id&&y[60].type==="assistant"&&!y[60].content?Zo:Yo}let M=C(e),v=M(e),b=e[60].attachments&&qs(e),k=e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]&&Xs(e);return{key:s,first:null,c(){t=x("div"),S.c(),n=G(),i=x("div"),o=x("div"),v.c(),l=G(),b&&b.c(),a=G(),k&&k.c(),c=G(),u=x("div"),p=ve(h),d=G(),r(o,"class","sy-assistant-message-content svelte-46wzni"),r(u,"class","sy-assistant-message-time svelte-46wzni"),r(i,"class","sy-assistant-message-bubble svelte-46wzni"),r(t,"class","sy-assistant-message svelte-46wzni"),J(t,"user",e[60].type==="user"),this.first=t},m(y,A){q(y,t,A),S.m(t,null),m(t,n),m(t,i),m(i,o),v.m(o,null),m(o,l),b&&b.m(o,null),m(o,a),k&&k.m(o,null),m(i,c),m(i,u),m(u,p),m(t,d)},p(y,A){e=y,w!==(w=g(e))&&(S.d(1),S=w(e),S&&(S.c(),S.m(t,n))),M===(M=C(e))&&v?v.p(e,A):(v.d(1),v=M(e),v&&(v.c(),v.m(o,l))),e[60].attachments?b?b.p(e,A):(b=qs(e),b.c(),b.m(o,a)):b&&(b.d(1),b=null),e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]?k?k.p(e,A):(k=Xs(e),k.c(),k.m(o,null)):k&&(k.d(1),k=null),A[0]&8&&h!==(h=new Date(e[60].timestamp).toLocaleTimeString()+"")&&Pe(p,h),A[0]&8&&J(t,"user",e[60].type==="user")},d(y){y&&W(t),S.d(),v.d(),b&&b.d(),k&&k.d()}}}function Js(s){let e,t,n,i,o,l,a,c,u,h,p,d,g,w,S,C,M,v,b,k,y,A,T,z;return{c(){e=x("div"),t=x("div"),n=x("button"),n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',i=G(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',l=G(),a=x("div"),c=x("div"),u=x("div"),h=x("div"),p=x("textarea"),d=G(),g=x("div"),w=ve(s[2]),S=ve("/"),C=ve(Pn),M=G(),v=x("button"),b=X("svg"),k=X("line"),y=X("polygon"),r(n,"class","sy-assistant-icon-button svelte-46wzni"),r(n,"aria-label","历史会话"),r(o,"class","sy-assistant-icon-button svelte-46wzni"),r(o,"aria-label","新建会话"),r(t,"class","sy-assistant-chat-actions svelte-46wzni"),r(e,"class","sy-assistant-chat-footer svelte-46wzni"),r(p,"class","sy-assistant-textarea svelte-46wzni"),r(p,"placeholder","输入您的问题..."),r(p,"maxlength",Pn),r(p,"rows","3"),r(g,"class","sy-assistant-char-count svelte-46wzni"),J(g,"over-limit",s[16]),r(h,"class","sy-assistant-textarea-container svelte-46wzni"),r(u,"class","sy-assistant-input-wrapper svelte-46wzni"),r(k,"x1","22"),r(k,"y1","2"),r(k,"x2","11"),r(k,"y2","13"),r(y,"points","22 2 15 22 11 13 2 9 22 2"),r(b,"xmlns","http://www.w3.org/2000/svg"),r(b,"width","20"),r(b,"height","20"),r(b,"viewBox","0 0 24 24"),r(b,"fill","none"),r(b,"stroke","currentColor"),r(b,"stroke-width","2"),r(b,"stroke-linecap","round"),r(b,"stroke-linejoin","round"),r(v,"class","sy-assistant-send-button svelte-46wzni"),v.disabled=A=!s[1].trim()||s[16],r(v,"aria-label","发送消息"),r(c,"class","sy-assistant-input-container svelte-46wzni"),r(a,"class","sy-assistant-input-area svelte-46wzni")},m(R,F){q(R,e,F),m(e,t),m(t,n),m(t,i),m(t,o),q(R,l,F),q(R,a,F),m(a,c),m(c,u),m(u,h),m(h,p),pt(p,s[1]),m(h,d),m(h,g),m(g,w),m(g,S),m(g,C),m(c,M),m(c,v),m(v,b),m(b,k),m(b,y),T||(z=[U(n,"click",s[29]),U(n,"mouseenter",s[48]),U(n,"mouseleave",s[27]),U(n,"blur",s[27]),U(o,"click",s[32]),U(o,"mouseenter",s[49]),U(o,"mouseleave",s[27]),U(p,"input",s[50]),U(p,"keydown",s[51]),U(v,"click",s[18]),U(v,"mouseenter",s[52]),U(v,"mouseleave",s[27])],T=!0)},p(R,F){F[0]&2&&pt(p,R[1]),F[0]&4&&Pe(w,R[2]),F[0]&65536&&J(g,"over-limit",R[16]),F[0]&65538&&A!==(A=!R[1].trim()||R[16])&&(v.disabled=A)},d(R){R&&(W(e),W(l),W(a)),T=!1,ke(z)}}}function Ks(s){let e,t=s[14].text+"",n;return{c(){e=x("div"),n=ve(t),r(e,"class","sy-assistant-button-tooltip svelte-46wzni"),P(e,"left",s[14].x+"px"),P(e,"top",s[14].y+"px")},m(i,o){q(i,e,o),m(e,n)},p(i,o){o[0]&16384&&t!==(t=i[14].text+"")&&Pe(n,t),o[0]&16384&&P(e,"left",i[14].x+"px"),o[0]&16384&&P(e,"top",i[14].y+"px")},d(i){i&&W(e)}}}function Qo(s){let e,t,n,i,o,l,a;const c=[Wo,jo],u=[];function h(g,w){return g[15]?0:1}t=h(s),n=u[t]=c[t](s);let p=!s[15]&&Js(s),d=s[14]&&Ks(s);return{c(){e=x("div"),n.c(),i=G(),p&&p.c(),o=G(),d&&d.c(),l=jt(),r(e,"class","sy-assistant-chat-container svelte-46wzni"),P(e,"z-index",s[0]+2)},m(g,w){q(g,e,w),u[t].m(e,null),m(e,i),p&&p.m(e,null),s[53](e),q(g,o,w),d&&d.m(g,w),q(g,l,w),a=!0},p(g,w){let S=t;t=h(g),t===S?u[t].p(g,w):(dn(),Je(u[S],1,1,()=>{u[S]=null}),gn(),n=u[t],n?n.p(g,w):(n=u[t]=c[t](g),n.c()),Fe(n,1),n.m(e,i)),g[15]?p&&(p.d(1),p=null):p?p.p(g,w):(p=Js(g),p.c(),p.m(e,null)),(!a||w[0]&1)&&P(e,"z-index",g[0]+2),g[14]?d?d.p(g,w):(d=Ks(g),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i(g){a||(Fe(n),a=!0)},o(g){Je(n),a=!1},d(g){g&&(W(e),W(o),W(l)),u[t].d(),p&&p.d(),s[53](null),d&&d.d(g)}}}let Pn=500;function Jo(s){const e=s.match(/source#\[(.*)\]#source/);return e?s.replace(`source#[${e[1]}]#source`,""):s}function $s(s){const e=s.match(/source#\[(.*)\]#source/);if(e)try{return JSON.parse(`[${e[1]}]`)}catch(t){console.error("Failed to parse attachments:",t)}return null}function tn(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}function Ko(s,e,t){let n,i,o="",l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],a="",c=null,u=null,h={x:0,y:0,alignRight:!1},p=null,d=!1;ee.setOptions({breaks:!0,gfm:!0});function g(_){try{const B=ee(_);return Ms.sanitize(B)}catch(B){console.warn("Markdown parsing failed, fallback to HTML:",B);try{const Q=_.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return Ms.sanitize(Q)}catch(Q){return console.error("HTML fallback failed:",Q),_}}}let w;function S(_=!1){w&&w.scrollTo({top:w.scrollHeight,behavior:_?"smooth":"auto"})}_i(()=>{S(!1)});let{sessionId:C}=e;function M(){return Le(this,null,function*(){if(!o.trim()||i)return;if(!C){console.error("No session ID available");return}const _={id:Date.now().toString(),type:"user",content:o.trim(),timestamp:Date.now()};t(3,l=[...l,_]);const B=o.trim();t(1,o="");const Q=(Date.now()+1).toString();a="",t(3,l=[...l,{id:Q,type:"assistant",content:"",timestamp:Date.now()}]),t(7,d=!0),c&&c.abort(),c=new AbortController;try{yield Ni("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:C,requestId:Date.now().toString(),keyword:B,flowId:"1"}),signal:c.signal,onmessage(he){try{const pe=he.data;if(pe){const Be=$s(pe);Be?(t(3,l=l.map(we=>we.id===Q?Te(se({},we),{attachments:Be}):we)),S(!0)):(a+=pe,t(3,l=l.map(we=>we.id===Q?Te(se({},we),{content:a}):we)),S(!1))}}catch(pe){console.error("Failed to process SSE message:",pe)}},onerror(he){console.error("SSE error:",he),c=null,t(7,d=!1)},onclose(){c=null,t(7,d=!1)}})}catch(he){console.error("Failed to send message:",he),t(7,d=!1)}})}function v(_,B,Q){const he=Q.getBoundingClientRect(),pe=w.getBoundingClientRect(),Be=he.left<pe.width/2;t(4,u=B),t(5,h={x:he.left,y:he.top+he.height/2,alignRight:Be})}function b(){t(6,p=setTimeout(()=>{t(4,u=null),t(6,p=null)},200))}yi(()=>{c&&c.abort(),p&&clearTimeout(p)});function k(_,B){return Le(this,null,function*(){try{const Q=yield fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({fileName:_,fileUrl:B})});if(!Q.ok)throw new Error("Download failed");const he=Q.headers.get("content-type")||"application/octet-stream",pe=yield Q.blob(),Be=window.URL.createObjectURL(pe),we=document.createElement("a");we.href=Be,we.download=_,document.body.appendChild(we),we.click(),window.URL.revokeObjectURL(Be),document.body.removeChild(we)}catch(Q){console.error("Failed to download file:",Q)}})}let y={};function A(_,B){return Le(this,null,function*(){try{const Q=B.replace(/<br\s*\/?>/g,`
48
- `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();yield navigator.clipboard.writeText(Q),t(9,y[_]=!0,y),setTimeout(()=>{t(9,y[_]=!1,y),t(9,y)},1500)}catch(Q){console.error("Failed to copy:",Q)}})}let T={},z={},R=!1;function F(_,B){return Le(this,null,function*(){if(T[_]===B){t(10,T[_]=null,T),t(10,T);return}if(t(10,T[_]=B,T),t(10,T),B==="like")try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:C,requestId:_,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(Q){console.error("Failed to send feedback:",Q),t(10,T[_]=null,T),t(10,T)}else t(12,R=!0)})}function I(_){return Le(this,null,function*(){var B;if((B=z[_])!=null&&B.trim())try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:C,requestId:_,feedBackFlag:"0",feedBackContent:z[_]})})).ok)throw new Error("Feedback failed");t(12,R=!1),t(11,z[_]="",z),t(11,z)}catch(Q){console.error("Failed to send feedback:",Q),t(10,T[_]=null,T),t(10,T)}})}let j={x:0,y:0};function V(_,B){const he=_.currentTarget.getBoundingClientRect();t(13,j={x:he.left-290,y:he.top-160}),F(B,"dislike")}let K=null;function ae(_,B){const he=_.currentTarget.getBoundingClientRect();t(14,K={text:B,x:he.left+he.width/2,y:he.top-8})}function me(){t(14,K=null)}let de=!1,je=[],ue=Date.now().toString();function Ye(){me(),t(15,de=!0)}function ce(){me(),t(15,de=!1)}function Ke(_){return Le(this,null,function*(){if(!d){t(7,d=!0);try{const B=yield fetch("/aiops/aigc/chat/record/session/detail/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:_})});if(!B.ok)throw new Error("Failed to load sessions");const Q=yield B.json();if(Q.code===0){ue=_,t(15,de=!1);const he=Q.data.map(pe=>{const Be=$s(pe.answer),we=Jo(pe.answer);return[{sessionId:pe.sessionId,requestId:pe.requestId,type:"user",content:pe.keyword,timestamp:new Date(pe.createDate).getTime()},{sessionId:pe.sessionId,requestId:pe.requestId,type:"assistant",content:we,attachments:Be,timestamp:new Date(pe.createDate).getTime()}]});t(3,l=he.flat())}}catch(B){console.error("Failed to load sessions:",B)}finally{t(7,d=!1)}}})}function re(){return Le(this,null,function*(){const _=yield ze();if(!_){console.error("Failed to create new session");return}ue=_,t(3,l=[{id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")})}function ze(){return Le(this,null,function*(){try{const _=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`}});if(!_.ok)throw new Error("Failed to get session ID");const B=yield _.json();if(B.code===0)return ue=B.data.sessionId,ue;throw new Error(B.message||"Failed to get session ID")}catch(_){return console.error("Failed to get session ID:",_),null}})}let{zIndex:te}=e;const Me=(_,B)=>v(B,_.tips,B.currentTarget),Ee=_=>k(_.content_title,_.link),$e=()=>{p&&(clearTimeout(p),t(6,p=null))},O=()=>{t(4,u=null)},ie=_=>A(_.id,_.content),N=(_,B)=>ae(B,y[_.id]?"已复制":"复制内容"),Y=_=>F(_.id,"like"),Se=(_,B)=>ae(B,T[_.id]==="like"?"取消点赞":"点赞"),Ae=(_,B)=>V(B,_.id),We=(_,B)=>ae(B,T[_.id]==="dislike"?"取消点踩":"点踩");function Ze(_){z[_.id]=this.value,t(11,z)}const nt=_=>{t(12,R=!1),t(10,T[_.id]=null,T),t(10,T)},_t=_=>I(_.id);function yt(_){gt[_?"unshift":"push"](()=>{w=_,t(8,w)})}const nn=_=>ae(_,"历史会话"),sn=_=>ae(_,"新建会话");function Hn(){o=this.value,t(1,o)}const Ft=_=>_.key==="Enter"&&!_.shiftKey&&(M(),_.preventDefault()),ct=_=>ae(_,"发送消息");function st(_){gt[_?"unshift":"push"](()=>{w=_,t(8,w)})}return s.$$set=_=>{"sessionId"in _&&t(33,C=_.sessionId),"zIndex"in _&&t(0,te=_.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(16,i=n>Pn)},[te,o,n,l,u,h,p,d,w,y,T,z,R,j,K,de,i,g,M,v,b,k,A,F,I,V,ae,me,je,Ye,ce,Ke,re,C,Me,Ee,$e,O,ie,N,Y,Se,Ae,We,Ze,nt,_t,yt,nn,sn,Hn,Ft,ct,st]}class $o extends kn{constructor(e){super(),wn(this,e,Ko,Qo,ut,{sessionId:33,zIndex:0},null,[-1,-1,-1])}}function ei(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,h,p,d,g,w,S=s[2]?"退出全屏":"全屏显示",C,M,v,b,k,y,A,T,z=s[7]?"取消吸附":"吸附到边缘",R,F,I,j,V,K,ae,me,de,je=`${s[3].height}px`,ue,Ye,ce;function Ke(N,Y){return N[2]?tl:el}let re=Ke(s),ze=re(s);function te(N,Y){return N[7]?sl:nl}let Me=te(s),Ee=Me(s);const $e=[ol,il],O=[];function ie(N,Y){return N[8]?0:1}return me=ie(s),de=O[me]=$e[me](s),{c(){e=x("div"),t=x("div"),n=x("div"),i=x("h3"),l=ve(o),a=G(),c=x("div"),u=x("div"),h=x("button"),p=X("svg"),ze.c(),g=G(),w=x("span"),C=ve(S),M=G(),v=x("div"),b=x("button"),k=X("svg"),Ee.c(),A=G(),T=x("span"),R=ve(z),F=G(),I=x("div"),j=x("button"),j.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',V=G(),K=x("span"),K.textContent="关闭助手",ae=G(),de.c(),r(i,"class","svelte-1dubpto"),r(p,"xmlns","http://www.w3.org/2000/svg"),r(p,"width","18"),r(p,"height","18"),r(p,"viewBox","0 0 24 24"),r(p,"fill","none"),r(p,"stroke","currentColor"),r(p,"stroke-width","2"),r(p,"stroke-linecap","round"),r(p,"stroke-linejoin","round"),r(h,"class","sy-assistant-action-button svelte-1dubpto"),r(h,"aria-label",d=s[2]?"退出全屏":"全屏显示"),J(h,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1dubpto"),r(u,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(k,"xmlns","http://www.w3.org/2000/svg"),r(k,"width","18"),r(k,"height","18"),r(k,"viewBox","0 0 24 24"),r(k,"fill","none"),r(k,"stroke","currentColor"),r(k,"stroke-width","2"),r(k,"stroke-linecap","round"),r(k,"stroke-linejoin","round"),r(b,"class","sy-assistant-action-button svelte-1dubpto"),r(b,"aria-label",y=s[7]?"取消吸附":"吸附到边缘"),J(b,"active",s[7]),r(T,"class","sy-assistant-tooltip svelte-1dubpto"),r(v,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(j,"class","sy-assistant-close-button svelte-1dubpto"),r(j,"aria-label","关闭助手"),r(K,"class","sy-assistant-tooltip svelte-1dubpto"),r(I,"class","sy-assistant-tooltip-wrapper svelte-1dubpto"),r(c,"class","sy-assistant-header-actions svelte-1dubpto"),r(n,"class","sy-assistant-drawer-header svelte-1dubpto"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),J(n,"dragging",s[6]),J(n,"fullscreen",s[2]),J(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1dubpto"),r(e,"class","sy-assistant-drawer svelte-1dubpto"),J(e,"fullscreen",s[2]),P(e,"height",je)},m(N,Y){q(N,e,Y),m(e,t),m(t,n),m(n,i),m(i,l),m(n,a),m(n,c),m(c,u),m(u,h),m(h,p),ze.m(p,null),m(u,g),m(u,w),m(w,C),m(c,M),m(c,v),m(v,b),m(b,k),Ee.m(k,null),m(v,A),m(v,T),m(T,R),m(c,F),m(c,I),m(I,j),m(I,V),m(I,K),m(t,ae),O[me].m(t,null),ue=!0,Ye||(ce=[U(h,"click",s[16]),U(b,"click",s[18]),U(j,"click",s[15]),U(n,"mousedown",Vn(s[17]))],Ye=!0)},p(N,Y){(!ue||Y[0]&8)&&o!==(o=N[3].title+"")&&Pe(l,o),re!==(re=Ke(N))&&(ze.d(1),ze=re(N),ze&&(ze.c(),ze.m(p,null))),(!ue||Y[0]&4&&d!==(d=N[2]?"退出全屏":"全屏显示"))&&r(h,"aria-label",d),(!ue||Y[0]&4)&&J(h,"active",N[2]),(!ue||Y[0]&4)&&S!==(S=N[2]?"退出全屏":"全屏显示")&&Pe(C,S),Me!==(Me=te(N))&&(Ee.d(1),Ee=Me(N),Ee&&(Ee.c(),Ee.m(k,null))),(!ue||Y[0]&128&&y!==(y=N[7]?"取消吸附":"吸附到边缘"))&&r(b,"aria-label",y),(!ue||Y[0]&128)&&J(b,"active",N[7]),(!ue||Y[0]&128)&&z!==(z=N[7]?"取消吸附":"吸附到边缘")&&Pe(R,z),(!ue||Y[0]&64)&&J(n,"dragging",N[6]),(!ue||Y[0]&4)&&J(n,"fullscreen",N[2]),(!ue||Y[0]&128)&&J(n,"snapped",N[7]);let Se=me;me=ie(N),me===Se?O[me].p(N,Y):(dn(),Je(O[Se],1,1,()=>{O[Se]=null}),gn(),de=O[me],de?de.p(N,Y):(de=O[me]=$e[me](N),de.c()),Fe(de,1),de.m(t,null)),(!ue||Y[0]&4)&&J(e,"fullscreen",N[2]),Y[0]&8&&je!==(je=`${N[3].height}px`)&&P(e,"height",je)},i(N){ue||(Fe(de),ue=!0)},o(N){Je(de),ue=!1},d(N){N&&W(e),ze.d(),Ee.d(),O[me].d(),Ye=!1,ke(ce)}}}function el(s){let e;return{c(){e=X("path"),r(e,"d","M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3")},m(t,n){q(t,e,n)},d(t){t&&W(e)}}}function tl(s){let e;return{c(){e=X("path"),r(e,"d","M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3")},m(t,n){q(t,e,n)},d(t){t&&W(e)}}}function nl(s){let e,t;return{c(){e=X("rect"),t=X("line"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x1","16"),r(t,"y1","6"),r(t,"x2","16"),r(t,"y2","18")},m(n,i){q(n,e,i),q(n,t,i)},d(n){n&&(W(e),W(t))}}}function sl(s){let e,t;return{c(){e=X("rect"),t=X("rect"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x","12"),r(t,"y","10"),r(t,"width","6"),r(t,"height","8"),r(t,"rx","1"),r(t,"ry","1")},m(n,i){q(n,e,i),q(n,t,i)},d(n){n&&(W(e),W(t))}}}function il(s){var n;let e,t;return e=new $o({props:{zIndex:(n=s[3].zIndex)!=null?n:1e3,sessionId:s[9]}}),{c(){mn(e.$$.fragment)},m(i,o){qt(e,i,o),t=!0},p(i,o){var a;const l={};o[0]&8&&(l.zIndex=(a=i[3].zIndex)!=null?a:1e3),o[0]&512&&(l.sessionId=i[9]),e.$set(l)},i(i){t||(Fe(e.$$.fragment,i),t=!0)},o(i){Je(e.$$.fragment,i),t=!1},d(i){Gt(e,i)}}}function ol(s){var n;let e,t;return e=new Us({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:(n=s[3].zIndex)!=null?n:1e3}}),{c(){mn(e.$$.fragment)},m(i,o){qt(e,i,o),t=!0},p(i,o){var a;const l={};o[0]&256&&(l.onClose=i[26]),o[0]&8&&(l.zIndex=(a=i[3].zIndex)!=null?a:1e3),e.$set(l)},i(i){t||(Fe(e.$$.fragment,i),t=!0)},o(i){Je(e.$$.fragment,i),t=!1},d(i){Gt(e,i)}}}function ll(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,h,p,d,g,w,S,C,M,v=s[12]>0&&ei(s);return{c(){var b,k;e=x("div"),t=x("div"),v&&v.c(),i=G(),o=x("button"),l=X("svg"),a=X("path"),c=X("path"),u=X("path"),h=X("path"),p=X("path"),d=X("path"),g=X("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1dubpto"),J(t,"fullscreen",s[2]),P(t,"width",n),r(a,"d","M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"),r(a,"fill","#6F8698"),r(c,"d","M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"),r(c,"fill","#3677FF"),r(u,"d","M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"),r(u,"fill","#D0D5F1"),r(h,"d","M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"),r(h,"fill","#3677FF"),r(p,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(p,"fill","#FFFFFF"),r(d,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(d,"fill","#FFFFFF"),r(g,"d","M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"),r(g,"fill","#8896A4"),r(l,"class","sy-assistant-icon"),r(l,"viewBox","0 0 1024 1024"),r(l,"version","1.1"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"width","32"),r(l,"height","32"),r(l,"fill","currentColor"),r(l,"aria-label","助手图标"),r(o,"class","sy-assistant-floating-button svelte-1dubpto"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+(((b=s[3].zIndex)!=null?b:1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1dubpto"),J(e,"fullscreen",s[2]),J(e,"snapped",s[7]),P(e,"position",s[3].position),P(e,"right",s[7]?0:`${s[0]}px`),P(e,"bottom",s[7]?0:`${s[1]}px`),P(e,"top",s[7]||s[2]?"0":"auto"),P(e,"left",s[2]?"0":"auto"),P(e,"z-index",(k=s[3].zIndex)!=null?k:1e3)},m(b,k){q(b,e,k),m(e,t),v&&v.m(t,null),m(e,i),m(e,o),m(o,l),m(l,a),m(l,c),m(l,u),m(l,h),m(l,p),m(l,d),m(l,g),s[27](o),s[29](e),S=!0,C||(M=[U(o,"click",s[15]),U(o,"mousedown",Vn(s[28]))],C=!0)},p(b,k){var y,A;b[12]>0?v?(v.p(b,k),k[0]&4096&&Fe(v,1)):(v=ei(b),v.c(),Fe(v,1),v.m(t,null)):v&&(dn(),Je(v,1,1,()=>{v=null}),gn()),(!S||k[0]&4)&&J(t,"fullscreen",b[2]),k[0]&4096&&n!==(n=`${b[12]}px`)&&P(t,"width",n),(!S||k[0]&1032&&w!==(w=b[10]+" z-index: "+(((y=b[3].zIndex)!=null?y:1e3)+1)+";"))&&r(o,"style",w),(!S||k[0]&4)&&J(e,"fullscreen",b[2]),(!S||k[0]&128)&&J(e,"snapped",b[7]),k[0]&8&&P(e,"position",b[3].position),k[0]&129&&P(e,"right",b[7]?0:`${b[0]}px`),k[0]&130&&P(e,"bottom",b[7]?0:`${b[1]}px`),k[0]&132&&P(e,"top",b[7]||b[2]?"0":"auto"),k[0]&4&&P(e,"left",b[2]?"0":"auto"),k[0]&8&&P(e,"z-index",(A=b[3].zIndex)!=null?A:1e3)},i(b){S||(Fe(v),S=!0)},o(b){Je(v),S=!1},d(b){b&&W(e),v&&v.d(),s[27](null),s[29](null),C=!1,ke(M)}}}const Fn=48,ge=20;function rl(s,e,t){let n,i,o,l,a=H,c=()=>(a(),a=Qe(i,O=>t(12,l=O)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:ge,bottom:ge},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:h="body"}=e,{options:p={}}=e,d,g=null,w=!1,S,C=!1,M=0,v=0,b=ge,k=20,y=b,A=k,T=!1,z=ge,R=50,F=!1,I={width:0,height:0,right:0,bottom:0},j=!1,V=!1,K=[],ae=null;function me(){return Le(this,null,function*(){try{const O=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`}});if(!O.ok)throw new Error("Failed to get session ID");const ie=yield O.json();if(ie.code===0)return t(9,ae=ie.data.sessionId),ae;throw new Error(ie.message||"Failed to get session ID")}catch(O){return console.error("Failed to get session ID:",O),null}})}function de(O,ie=!1){ie?t(23,T=!0):t(6,C=!0),M=O.clientX,v=O.clientY,b=ie?z:y,k=ie?R:A,O.preventDefault()}function je(O){if(!C&&!T)return;const ie=M-O.clientX,N=v-O.clientY;if(T){const Y=b+ie,Se=O.clientY;t(24,z=Math.max(ge,Math.min(window.innerWidth-Fn-ge,Y)));const Ae=window.innerHeight-Fn-ge,Ze=Math.max(ge,Math.min(Ae,Se));t(25,R=(window.innerHeight-Ze-Fn)/window.innerHeight*100)}else{const Y=n.width||0,Se=n.height||0,Ae=b+ie;t(0,y=Math.max(ge,Math.min(window.innerWidth-Y-ge,Ae)));const We=k+N;t(1,A=Math.max(ge,Math.min(window.innerHeight-Se-ge,We)))}}function ue(){t(6,C=!1),t(23,T=!1)}Qn(()=>{typeof h=="string"?g=document.querySelector(h)||document.body:g=h||document.body;const O=N=>je(N),ie=()=>ue();return document.addEventListener("mousemove",O),document.addEventListener("mouseup",ie),d&&g&&g.appendChild(d),S&&S.getBoundingClientRect().left,t(7,j=n.initialState==="snapped"),t(2,F=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,y=0),t(1,A=0),t(3,n=Te(se({},n),{height:typeof window!="undefined"?window.innerHeight:n.height,width:n.snappedWidth||n.width}))):n.initialState==="fullscreen"&&(t(0,y=0),t(1,A=0),t(3,n=Te(se({},n),{width:typeof window!="undefined"?window.innerWidth:n.width,height:typeof window!="undefined"?window.innerHeight:n.height}))),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",ie),g&&d&&g.removeChild(d)}});function Ye(){return Le(this,null,function*(){w||(yield me()),t(22,w=!w)})}function ce(){var O,ie,N,Y,Se,Ae,We,Ze;t(2,F=!F),F?(I.width||(I={width:u.width,height:u.height,right:(ie=(O=u.defaultPosition)==null?void 0:O.right)!=null?ie:ge,bottom:(Y=(N=u.defaultPosition)==null?void 0:N.bottom)!=null?Y:ge}),j&&t(7,j=!1),t(20,p=Te(se({},n),{width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth})),t(0,y=0),t(1,A=0)):(t(20,p=Te(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,y=(Ae=(Se=u.defaultPosition)==null?void 0:Se.right)!=null?Ae:ge),t(1,A=(Ze=(We=u.defaultPosition)==null?void 0:We.bottom)!=null?Ze:ge))}function Ke(O){F||de(O)}function re(){var O,ie,N,Y;F&&(t(2,F=!1),t(20,p=Te(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth}))),t(7,j=!j),j?(n.height,t(0,y=0),t(1,A=0),t(20,p=Te(se({},n),{height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width}))):(t(20,p=Te(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,y=(ie=(O=u.defaultPosition)==null?void 0:O.right)!=null?ie:ge),t(1,A=(Y=(N=u.defaultPosition)==null?void 0:N.bottom)!=null?Y:ge))}function ze(O){t(8,V=!1)}const te=()=>t(8,V=!1);function Me(O){gt[O?"unshift":"push"](()=>{S=O,t(5,S)})}const Ee=O=>de(O,!0);function $e(O){gt[O?"unshift":"push"](()=>{d=O,t(4,d)})}return s.$$set=O=>{"target"in O&&t(21,h=O.target),"options"in O&&t(20,p=O.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n=Te(se(se({},u),p),{defaultPosition:se(se({},u.defaultPosition),p.defaultPosition)})),s.$$.dirty[0]&4194316&&c(t(11,i=Ii(w?F?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window!="undefined"&&(t(0,y=Math.max(ge,Math.min(window.innerWidth-(n.width||0),y))),t(1,A=Math.max(ge,Math.min(window.innerHeight-(n.height||0),A)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${z}px; bottom: ${R}%; transform: none; cursor: ${T?"grabbing":"grab"};`)},[y,A,F,n,d,S,C,j,V,ae,o,i,l,K,de,Ye,ce,Ke,re,ze,p,h,w,T,z,R,te,Me,Ee,$e]}class al extends kn{constructor(e){super(),wn(this,e,rl,ll,ut,{target:21,options:20},null,[-1,-1])}}$.SyAssistant=al,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
44
+ `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=as(e);if(i===null)return n;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){const i=as(e);if(i===null)return n;e=i;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class In{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Ze{constructor(e){oe(this,"options");oe(this,"renderer");oe(this,"textRenderer");this.options=e||lt,this.options.renderer=this.options.renderer||new Kt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new In}static parse(e,t){return new Ze(t).parse(e)}static parseInline(e,t){return new Ze(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=o,a=this.options.extensions.renderers[l.type].call({parser:this},l);if(a!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=a||"";continue}}switch(o.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const l=o;n+=this.renderer.heading(this.parseInline(l.tokens),l.depth,ji(this.parseInline(l.tokens,this.textRenderer)));continue}case"code":{const l=o;n+=this.renderer.code(l.text,l.lang,!!l.escaped);continue}case"table":{const l=o;let a="",c="";for(let h=0;h<l.header.length;h++)c+=this.renderer.tablecell(this.parseInline(l.header[h].tokens),{header:!0,align:l.align[h]});a+=this.renderer.tablerow(c);let u="";for(let h=0;h<l.rows.length;h++){const p=l.rows[h];c="";for(let d=0;d<p.length;d++)c+=this.renderer.tablecell(this.parseInline(p[d].tokens),{header:!1,align:l.align[d]});u+=this.renderer.tablerow(c)}n+=this.renderer.table(a,u);continue}case"blockquote":{const l=o,a=this.parse(l.tokens);n+=this.renderer.blockquote(a);continue}case"list":{const l=o,a=l.ordered,c=l.start,u=l.loose;let h="";for(let p=0;p<l.items.length;p++){const d=l.items[p],g=d.checked,w=d.task;let S="";if(d.task){const M=this.renderer.checkbox(!!g);u?d.tokens.length>0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=M+" "+d.tokens[0].text,d.tokens[0].tokens&&d.tokens[0].tokens.length>0&&d.tokens[0].tokens[0].type==="text"&&(d.tokens[0].tokens[0].text=M+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:M+" "}):S+=M+" "}S+=this.parse(d.tokens,u),h+=this.renderer.listitem(S,w,!!g)}n+=this.renderer.list(h,a,c);continue}case"html":{const l=o;n+=this.renderer.html(l.text,l.block);continue}case"paragraph":{const l=o;n+=this.renderer.paragraph(this.parseInline(l.tokens));continue}case"text":{let l=o,a=l.tokens?this.parseInline(l.tokens):l.text;for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],a+=`
45
+ `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=l||"";continue}}switch(o.type){case"escape":{const l=o;n+=t.text(l.text);break}case"html":{const l=o;n+=t.html(l.text);break}case"link":{const l=o;n+=t.link(l.href,l.title,this.parseInline(l.tokens,t));break}case"image":{const l=o;n+=t.image(l.href,l.title,l.text);break}case"strong":{const l=o;n+=t.strong(this.parseInline(l.tokens,t));break}case"em":{const l=o;n+=t.em(this.parseInline(l.tokens,t));break}case"codespan":{const l=o;n+=t.codespan(l.text);break}case"br":{n+=t.br();break}case"del":{const l=o;n+=t.del(this.parseInline(l.tokens,t));break}case"text":{const l=o;n+=t.text(l.text);break}default:{const l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}}class zt{constructor(e){oe(this,"options");this.options=e||lt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}oe(zt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class ko{constructor(...e){gi(this,ct);oe(this,"defaults",yn());oe(this,"options",this.setOptions);oe(this,"parse",cn(this,ct,Gn).call(this,Ye.lex,Ze.parse));oe(this,"parseInline",cn(this,ct,Gn).call(this,Ye.lexInline,Ze.parseInline));oe(this,"Parser",Ze);oe(this,"Renderer",Kt);oe(this,"TextRenderer",In);oe(this,"Lexer",Ye);oe(this,"Tokenizer",Xt);oe(this,"Hooks",zt);this.use(...e)}walkTokens(e,t){var i,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const a=l;for(const c of a.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of a.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const a=l;n=n.concat(this.walkTokens(a.items,t));break}default:{const a=l;(o=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(c=>{const u=a[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i=se({},n);if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=t.renderers[o.name];l?t.renderers[o.name]=function(...a){let c=o.renderer.apply(this,a);return c===!1&&(c=l.apply(this,a)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),i.extensions=t),n.renderer){const o=this.defaults.renderer||new Kt(this.defaults);for(const l in n.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.renderer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p||""}}i.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Xt(this.defaults);for(const l in n.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const a=l,c=n.tokenizer[a],u=o[a];o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new zt;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const a=l,c=n.hooks[a],u=o[a];zt.passThroughHooks.has(l)?o[a]=h=>{if(this.defaults.async)return Promise.resolve(c.call(o,h)).then(d=>u.call(o,d));const p=c.call(o,h);return u.call(o,p)}:o[a]=(...h)=>{let p=c.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}i.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;i.walkTokens=function(a){let c=[];return c.push(l.call(this,a)),o&&(c=c.concat(o.call(this,a))),c}}this.defaults=se(se({},this.defaults),i)}),this}setOptions(e){return this.defaults=se(se({},this.defaults),e),this}lexer(e,t){return Ye.lex(e,t!=null?t:this.defaults)}parser(e,t){return Ze.parse(e,t!=null?t:this.defaults)}}ct=new WeakSet,Gn=function(e,t){return(n,i)=>{const o=se({},i),l=se(se({},this.defaults),o);this.defaults.async===!0&&o.async===!1&&(l.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),l.async=!0);const a=cn(this,ct,mi).call(this,!!l.silent,!!l.async);if(typeof n=="undefined"||n===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(l.hooks&&(l.hooks.options=l),l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(c=>e(c,l)).then(c=>l.hooks?l.hooks.processAllTokens(c):c).then(c=>l.walkTokens?Promise.all(this.walkTokens(c,l.walkTokens)).then(()=>c):c).then(c=>t(c,l)).then(c=>l.hooks?l.hooks.postprocess(c):c).catch(a);try{l.hooks&&(n=l.hooks.preprocess(n));let c=e(n,l);l.hooks&&(c=l.hooks.processAllTokens(c)),l.walkTokens&&this.walkTokens(c,l.walkTokens);let u=t(c,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(c){return a(c)}}},mi=function(e,t){return n=>{if(n.message+=`
46
+ Please report this to https://github.com/markedjs/marked.`,e){const i="<p>An error occurred:</p><pre>"+Fe(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const rt=new ko;function ee(s,e){return rt.parse(s,e)}ee.options=ee.setOptions=function(s){return rt.setOptions(s),ee.defaults=rt.defaults,is(ee.defaults),ee},ee.getDefaults=yn,ee.defaults=lt,ee.use=function(...s){return rt.use(...s),ee.defaults=rt.defaults,is(ee.defaults),ee},ee.walkTokens=function(s,e){return rt.walkTokens(s,e)},ee.parseInline=rt.parseInline,ee.Parser=Ze,ee.parser=Ze.parse,ee.Renderer=Kt,ee.TextRenderer=In,ee.Lexer=Ye,ee.lexer=Ye.lex,ee.Tokenizer=Xt,ee.Hooks=zt,ee.parse=ee,ee.options,ee.setOptions,ee.use,ee.walkTokens,ee.parseInline,Ze.parse,Ye.lex;/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:_s,setPrototypeOf:bs,isFrozen:_o,getPrototypeOf:bo,getOwnPropertyDescriptor:yo}=Object;let{freeze:Ce,seal:We,create:ys}=Object,{apply:Rn,construct:Cn}=typeof Reflect!="undefined"&&Reflect;Ce||(Ce=function(e){return e}),We||(We=function(e){return e}),Rn||(Rn=function(e,t,n){return e.apply(t,n)}),Cn||(Cn=function(e,t){return new e(...t)});const $t=He(Array.prototype.forEach),Ts=He(Array.prototype.pop),Ot=He(Array.prototype.push),en=He(String.prototype.toLowerCase),Mn=He(String.prototype.toString),vs=He(String.prototype.match),Dt=He(String.prototype.replace),To=He(String.prototype.indexOf),vo=He(String.prototype.trim),qe=He(Object.prototype.hasOwnProperty),Me=He(RegExp.prototype.test),Nt=Eo(TypeError);function He(s){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Rn(s,e,n)}}function Eo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Cn(s,t)}}function Z(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:en;bs&&bs(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(_o(e)||(e[n]=o),i=o)}s[i]=!0}return s}function So(s){for(let e=0;e<s.length;e++)qe(s,e)||(s[e]=null);return s}function at(s){const e=ys(null);for(const[t,n]of _s(s))qe(s,t)&&(Array.isArray(n)?e[t]=So(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=at(n):e[t]=n);return e}function Pt(s,e){for(;s!==null;){const n=yo(s,e);if(n){if(n.get)return He(n.get);if(typeof n.value=="function")return He(n.value)}s=bo(s)}function t(){return null}return t}const Es=Ce(["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","section","select","shadow","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"]),Ln=Ce(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),zn=Ce(["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"]),Ao=Ce(["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"]),On=Ce(["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"]),xo=Ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ss=Ce(["#text"]),As=Ce(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Dn=Ce(["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","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"]),xs=Ce(["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"]),tn=Ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Io=We(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ro=We(/<%[\w\W]*|[\w\W]*%>/gm),Co=We(/\$\{[\w\W]*}/gm),Mo=We(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lo=We(/^aria-[\-\w]+$/),Is=We(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zo=We(/^(?:\w+script|data):/i),Oo=We(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rs=We(/^html$/i),Do=We(/^[a-z][.\w]*(-[.\w]+)+$/i);var Cs=Object.freeze({__proto__:null,ARIA_ATTR:Lo,ATTR_WHITESPACE:Oo,CUSTOM_ELEMENT:Do,DATA_ATTR:Mo,DOCTYPE_NAME:Rs,ERB_EXPR:Ro,IS_ALLOWED_URI:Is,IS_SCRIPT_OR_DATA:zo,MUSTACHE_EXPR:Io,TMPLIT_EXPR:Co});const Ft={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},No=function(){return typeof window=="undefined"?null:window},Po=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch(l){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Ms=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ls(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:No();const e=P=>Ls(P);if(e.version="3.2.3",e.removed=[],!s||!s.document||s.document.nodeType!==Ft.document)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:a,Element:c,NodeFilter:u,NamedNodeMap:h=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:g}=s,w=c.prototype,S=Pt(w,"cloneNode"),M=Pt(w,"remove"),z=Pt(w,"nextSibling"),v=Pt(w,"childNodes"),_=Pt(w,"parentNode");if(typeof l=="function"){const P=t.createElement("template");P.content&&P.content.ownerDocument&&(t=P.content.ownerDocument)}let k,T="";const{implementation:A,createNodeIterator:b,createDocumentFragment:C,getElementsByTagName:I}=t,{importNode:F}=n;let R=Ms();e.isSupported=typeof _s=="function"&&typeof _=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:V,TMPLIT_EXPR:Q,DATA_ATTR:ae,ARIA_ATTR:ge,IS_SCRIPT_OR_DATA:he,ATTR_WHITESPACE:Ge,CUSTOM_ELEMENT:ce}=Cs;let{IS_ALLOWED_URI:Xe}=Cs,ue=null;const $e=Z({},[...Es,...Ln,...zn,...On,...Ss]);let re=null;const Le=Z({},[...As,...Dn,...xs,...tn]);let te=Object.seal(ys(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}})),De=null,xe=null,et=!0,N=!0,ie=!1,O=!0,j=!1,we=!0,ke=!1,Ne=!1,Be=!1,st=!1,yt=!1,Tt=!1,sn=!0,on=!1;const Hn="user-content-";let Ht=!0,ut=!1,it={},y=null;const H=Z({},["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"]);let $=null;const _e=Z({},["audio","video","img","source","image","track"]);let pe=null;const Ie=Z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ye="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",ve="http://www.w3.org/1999/xhtml";let vt=ve,Bn=!1,Un=null;const cl=Z({},[ye,tt,ve],Mn);let ln=Z({},["mi","mo","mn","ms","mtext"]),rn=Z({},["annotation-xml"]);const ul=Z({},["title","style","font","a","script"]);let Bt=null;const fl=["application/xhtml+xml","text/html"],hl="text/html";let Te=null,Et=null;const pl=t.createElement("form"),ti=function(f){return f instanceof RegExp||f instanceof Function},jn=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Et&&Et===f)){if((!f||typeof f!="object")&&(f={}),f=at(f),Bt=fl.indexOf(f.PARSER_MEDIA_TYPE)===-1?hl:f.PARSER_MEDIA_TYPE,Te=Bt==="application/xhtml+xml"?Mn:en,ue=qe(f,"ALLOWED_TAGS")?Z({},f.ALLOWED_TAGS,Te):$e,re=qe(f,"ALLOWED_ATTR")?Z({},f.ALLOWED_ATTR,Te):Le,Un=qe(f,"ALLOWED_NAMESPACES")?Z({},f.ALLOWED_NAMESPACES,Mn):cl,pe=qe(f,"ADD_URI_SAFE_ATTR")?Z(at(Ie),f.ADD_URI_SAFE_ATTR,Te):Ie,$=qe(f,"ADD_DATA_URI_TAGS")?Z(at(_e),f.ADD_DATA_URI_TAGS,Te):_e,y=qe(f,"FORBID_CONTENTS")?Z({},f.FORBID_CONTENTS,Te):H,De=qe(f,"FORBID_TAGS")?Z({},f.FORBID_TAGS,Te):{},xe=qe(f,"FORBID_ATTR")?Z({},f.FORBID_ATTR,Te):{},it=qe(f,"USE_PROFILES")?f.USE_PROFILES:!1,et=f.ALLOW_ARIA_ATTR!==!1,N=f.ALLOW_DATA_ATTR!==!1,ie=f.ALLOW_UNKNOWN_PROTOCOLS||!1,O=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,j=f.SAFE_FOR_TEMPLATES||!1,we=f.SAFE_FOR_XML!==!1,ke=f.WHOLE_DOCUMENT||!1,st=f.RETURN_DOM||!1,yt=f.RETURN_DOM_FRAGMENT||!1,Tt=f.RETURN_TRUSTED_TYPE||!1,Be=f.FORCE_BODY||!1,sn=f.SANITIZE_DOM!==!1,on=f.SANITIZE_NAMED_PROPS||!1,Ht=f.KEEP_CONTENT!==!1,ut=f.IN_PLACE||!1,Xe=f.ALLOWED_URI_REGEXP||Is,vt=f.NAMESPACE||ve,ln=f.MATHML_TEXT_INTEGRATION_POINTS||ln,rn=f.HTML_INTEGRATION_POINTS||rn,te=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&ti(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(te.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&ti(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(te.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(te.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),j&&(N=!1),yt&&(st=!0),it&&(ue=Z({},Ss),re=[],it.html===!0&&(Z(ue,Es),Z(re,As)),it.svg===!0&&(Z(ue,Ln),Z(re,Dn),Z(re,tn)),it.svgFilters===!0&&(Z(ue,zn),Z(re,Dn),Z(re,tn)),it.mathMl===!0&&(Z(ue,On),Z(re,xs),Z(re,tn))),f.ADD_TAGS&&(ue===$e&&(ue=at(ue)),Z(ue,f.ADD_TAGS,Te)),f.ADD_ATTR&&(re===Le&&(re=at(re)),Z(re,f.ADD_ATTR,Te)),f.ADD_URI_SAFE_ATTR&&Z(pe,f.ADD_URI_SAFE_ATTR,Te),f.FORBID_CONTENTS&&(y===H&&(y=at(y)),Z(y,f.FORBID_CONTENTS,Te)),Ht&&(ue["#text"]=!0),ke&&Z(ue,["html","head","body"]),ue.table&&(Z(ue,["tbody"]),delete De.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=f.TRUSTED_TYPES_POLICY,T=k.createHTML("")}else k===void 0&&(k=Po(g,i)),k!==null&&typeof T=="string"&&(T=k.createHTML(""));Ce&&Ce(f),Et=f}},ni=Z({},[...Ln,...zn,...Ao]),si=Z({},[...On,...xo]),dl=function(f){let E=_(f);(!E||!E.tagName)&&(E={namespaceURI:vt,tagName:"template"});const L=en(f.tagName),fe=en(E.tagName);return Un[f.namespaceURI]?f.namespaceURI===tt?E.namespaceURI===ve?L==="svg":E.namespaceURI===ye?L==="svg"&&(fe==="annotation-xml"||ln[fe]):!!ni[L]:f.namespaceURI===ye?E.namespaceURI===ve?L==="math":E.namespaceURI===tt?L==="math"&&rn[fe]:!!si[L]:f.namespaceURI===ve?E.namespaceURI===tt&&!rn[fe]||E.namespaceURI===ye&&!ln[fe]?!1:!si[L]&&(ul[L]||!ni[L]):!!(Bt==="application/xhtml+xml"&&Un[f.namespaceURI]):!1},Ve=function(f){Ot(e.removed,{element:f});try{_(f).removeChild(f)}catch(E){M(f)}},an=function(f,E){try{Ot(e.removed,{attribute:E.getAttributeNode(f),from:E})}catch(L){Ot(e.removed,{attribute:null,from:E})}if(E.removeAttribute(f),f==="is")if(st||yt)try{Ve(E)}catch(L){}else try{E.setAttribute(f,"")}catch(L){}},ii=function(f){let E=null,L=null;if(Be)f="<remove></remove>"+f;else{const Ee=vs(f,/^[\r\n\t ]+/);L=Ee&&Ee[0]}Bt==="application/xhtml+xml"&&vt===ve&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const fe=k?k.createHTML(f):f;if(vt===ve)try{E=new d().parseFromString(fe,Bt)}catch(Ee){}if(!E||!E.documentElement){E=A.createDocument(vt,"template",null);try{E.documentElement.innerHTML=Bn?T:fe}catch(Ee){}}const Re=E.body||E.documentElement;return f&&L&&Re.insertBefore(t.createTextNode(L),Re.childNodes[0]||null),vt===ve?I.call(E,ke?"html":"body")[0]:ke?E.documentElement:Re},oi=function(f){return b.call(f.ownerDocument||f,f,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Wn=function(f){return f instanceof p&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof h)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},li=function(f){return typeof a=="function"&&f instanceof a};function nt(P,f,E){$t(P,L=>{L.call(e,f,E,Et)})}const ri=function(f){let E=null;if(nt(R.beforeSanitizeElements,f,null),Wn(f))return Ve(f),!0;const L=Te(f.nodeName);if(nt(R.uponSanitizeElement,f,{tagName:L,allowedTags:ue}),f.hasChildNodes()&&!li(f.firstElementChild)&&Me(/<[/\w]/g,f.innerHTML)&&Me(/<[/\w]/g,f.textContent)||f.nodeType===Ft.progressingInstruction||we&&f.nodeType===Ft.comment&&Me(/<[/\w]/g,f.data))return Ve(f),!0;if(!ue[L]||De[L]){if(!De[L]&&ci(L)&&(te.tagNameCheck instanceof RegExp&&Me(te.tagNameCheck,L)||te.tagNameCheck instanceof Function&&te.tagNameCheck(L)))return!1;if(Ht&&!y[L]){const fe=_(f)||f.parentNode,Re=v(f)||f.childNodes;if(Re&&fe){const Ee=Re.length;for(let Pe=Ee-1;Pe>=0;--Pe){const Qe=S(Re[Pe],!0);Qe.__removalCount=(f.__removalCount||0)+1,fe.insertBefore(Qe,z(f))}}}return Ve(f),!0}return f instanceof c&&!dl(f)||(L==="noscript"||L==="noembed"||L==="noframes")&&Me(/<\/no(script|embed|frames)/i,f.innerHTML)?(Ve(f),!0):(j&&f.nodeType===Ft.text&&(E=f.textContent,$t([W,V,Q],fe=>{E=Dt(E,fe," ")}),f.textContent!==E&&(Ot(e.removed,{element:f.cloneNode()}),f.textContent=E)),nt(R.afterSanitizeElements,f,null),!1)},ai=function(f,E,L){if(sn&&(E==="id"||E==="name")&&(L in t||L in pl))return!1;if(!(N&&!xe[E]&&Me(ae,E))){if(!(et&&Me(ge,E))){if(!re[E]||xe[E]){if(!(ci(f)&&(te.tagNameCheck instanceof RegExp&&Me(te.tagNameCheck,f)||te.tagNameCheck instanceof Function&&te.tagNameCheck(f))&&(te.attributeNameCheck instanceof RegExp&&Me(te.attributeNameCheck,E)||te.attributeNameCheck instanceof Function&&te.attributeNameCheck(E))||E==="is"&&te.allowCustomizedBuiltInElements&&(te.tagNameCheck instanceof RegExp&&Me(te.tagNameCheck,L)||te.tagNameCheck instanceof Function&&te.tagNameCheck(L))))return!1}else if(!pe[E]){if(!Me(Xe,Dt(L,Ge,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&f!=="script"&&To(L,"data:")===0&&$[f])){if(!(ie&&!Me(he,Dt(L,Ge,"")))){if(L)return!1}}}}}}return!0},ci=function(f){return f!=="annotation-xml"&&vs(f,ce)},ui=function(f){nt(R.beforeSanitizeAttributes,f,null);const{attributes:E}=f;if(!E||Wn(f))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:re,forceKeepAttr:void 0};let fe=E.length;for(;fe--;){const Re=E[fe],{name:Ee,namespaceURI:Pe,value:Qe}=Re,Ut=Te(Ee);let ze=Ee==="value"?Qe:vo(Qe);if(L.attrName=Ut,L.attrValue=ze,L.keepAttr=!0,L.forceKeepAttr=void 0,nt(R.uponSanitizeAttribute,f,L),ze=L.attrValue,on&&(Ut==="id"||Ut==="name")&&(an(Ee,f),ze=Hn+ze),we&&Me(/((--!?|])>)|<\/(style|title)/i,ze)){an(Ee,f);continue}if(L.forceKeepAttr||(an(Ee,f),!L.keepAttr))continue;if(!O&&Me(/\/>/i,ze)){an(Ee,f);continue}j&&$t([W,V,Q],hi=>{ze=Dt(ze,hi," ")});const fi=Te(f.nodeName);if(ai(fi,Ut,ze)){if(k&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Pe)switch(g.getAttributeType(fi,Ut)){case"TrustedHTML":{ze=k.createHTML(ze);break}case"TrustedScriptURL":{ze=k.createScriptURL(ze);break}}try{Pe?f.setAttributeNS(Pe,Ee,ze):f.setAttribute(Ee,ze),Wn(f)?Ve(f):Ts(e.removed)}catch(hi){}}}nt(R.afterSanitizeAttributes,f,null)},gl=function P(f){let E=null;const L=oi(f);for(nt(R.beforeSanitizeShadowDOM,f,null);E=L.nextNode();)nt(R.uponSanitizeShadowNode,E,null),ri(E),ui(E),E.content instanceof o&&P(E.content);nt(R.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(P){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,fe=null,Re=null;if(Bn=!P,Bn&&(P="<!-->"),typeof P!="string"&&!li(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw Nt("dirty is not a string, aborting")}else throw Nt("toString is not a function");if(!e.isSupported)return P;if(Ne||jn(f),e.removed=[],typeof P=="string"&&(ut=!1),ut){if(P.nodeName){const Qe=Te(P.nodeName);if(!ue[Qe]||De[Qe])throw Nt("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof a)E=ii("<!---->"),L=E.ownerDocument.importNode(P,!0),L.nodeType===Ft.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!st&&!j&&!ke&&P.indexOf("<")===-1)return k&&Tt?k.createHTML(P):P;if(E=ii(P),!E)return st?null:Tt?T:""}E&&Be&&Ve(E.firstChild);const Ee=oi(ut?P:E);for(;fe=Ee.nextNode();)ri(fe),ui(fe),fe.content instanceof o&&gl(fe.content);if(ut)return P;if(st){if(yt)for(Re=C.call(E.ownerDocument);E.firstChild;)Re.appendChild(E.firstChild);else Re=E;return(re.shadowroot||re.shadowrootmode)&&(Re=F.call(n,Re,!0)),Re}let Pe=ke?E.outerHTML:E.innerHTML;return ke&&ue["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&Me(Rs,E.ownerDocument.doctype.name)&&(Pe="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
47
+ `+Pe),j&&$t([W,V,Q],Qe=>{Pe=Dt(Pe,Qe," ")}),k&&Tt?k.createHTML(Pe):Pe},e.setConfig=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jn(P),Ne=!0},e.clearConfig=function(){Et=null,Ne=!1},e.isValidAttribute=function(P,f,E){Et||jn({});const L=Te(P),fe=Te(f);return ai(L,fe,E)},e.addHook=function(P,f){typeof f=="function"&&Ot(R[P],f)},e.removeHook=function(P){return Ts(R[P])},e.removeHooks=function(P){R[P]=[]},e.removeAllHooks=function(){R=Ms()},e}var zs=Ls();function Os(s){var n;if(typeof document=="undefined")return null;const t=`; ${document.cookie}`.split(`; ${s}=`);return t.length===2&&((n=t.pop())==null?void 0:n.split(";").shift())||null}const be=()=>{if(typeof window=="undefined")return null;const s=Os("access_token");if(s)return s;const e=Os("auth_token");if(e)return e;const t=sessionStorage.getItem("vuex");if(t)try{const n=JSON.parse(t);if(n!=null&&n.token)return n.token}catch(n){console.error("Failed to parse vuex data:",n)}return null};function Ds(s,e,t){const n=s.slice();return n[24]=e[t],n}function Ns(s){let e,t=s[9].text+"",n;return{c(){e=x("div"),n=Ae(t),r(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),D(e,"left",s[9].x+"px"),D(e,"top",s[9].y+"px"),D(e,"z-index",s[3]+3)},m(i,o){G(i,e,o),m(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&Ue(n,t),o&512&&D(e,"left",i[9].x+"px"),o&512&&D(e,"top",i[9].y+"px"),o&8&&D(e,"z-index",i[3]+3)},d(i){i&&q(e)}}}function Fo(s){let e=[],t=new Map,n,i,o=_t(s[0]);const l=c=>c[24].sessionId;for(let c=0;c<o.length;c+=1){let u=Ds(s,o,c),h=l(u);t.set(h,e[c]=Ps(h,u))}let a=s[5]&&Fs();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=Y(),a&&a.c(),i=Wt()},m(c,u){for(let h=0;h<e.length;h+=1)e[h]&&e[h].m(c,u);G(c,n,u),a&&a.m(c,u),G(c,i,u)},p(c,u){u&8261&&(o=_t(c[0]),e=es(e,u,l,1,c,o,t,n.parentNode,$n,Ps,n,Ds)),c[5]?a||(a=Fs(),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},d(c){c&&(q(n),q(i));for(let u=0;u<e.length;u+=1)e[u].d(c);a&&a.d(c)}}}function Ho(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=x("div"),n=Ae(t),r(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){G(i,e,o),m(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Ue(n,t)},d(i){i&&q(e)}}}function Ps(s,e){let t,n,i,o,l=e[24].title+"",a,c,u,h=Bs(e[24].timestamp)+"",p,d,g,w,S,M,z,v,_,k,T;function A(){return e[17](e[24])}function b(...C){return e[18](e[24],...C)}return{key:s,first:null,c(){t=x("div"),n=x("button"),i=x("div"),o=x("div"),a=Ae(l),c=Y(),u=x("div"),p=Ae(h),d=Y(),g=x("button"),w=X("svg"),S=X("path"),M=X("path"),z=X("path"),r(o,"class","sy-session-title svelte-1g6fj9a"),r(u,"class","sy-session-time svelte-1g6fj9a"),r(i,"class","sy-session-info svelte-1g6fj9a"),r(n,"class","sy-session-select svelte-1g6fj9a"),r(S,"d","M3 6h18"),r(M,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),r(z,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),r(w,"xmlns","http://www.w3.org/2000/svg"),r(w,"width","16"),r(w,"height","16"),r(w,"viewBox","0 0 24 24"),r(w,"fill","none"),r(w,"stroke","currentColor"),r(w,"stroke-width","2"),r(w,"stroke-linecap","round"),r(w,"stroke-linejoin","round"),r(g,"class","sy-session-delete svelte-1g6fj9a"),g.disabled=v=e[6]===e[24].sessionId,r(g,"aria-label","删除会话"),r(t,"class","sy-session-item svelte-1g6fj9a"),r(t,"data-session-id",_=e[24].sessionId),J(t,"deleting",e[24].deleting),this.first=t},m(C,I){G(C,t,I),m(t,n),m(n,i),m(i,o),m(o,a),m(i,c),m(i,u),m(u,p),m(t,d),m(t,g),m(g,w),m(w,S),m(w,M),m(w,z),k||(T=[U(n,"click",A),U(g,"click",b)],k=!0)},p(C,I){e=C,I&1&&l!==(l=e[24].title+"")&&Ue(a,l),I&1&&h!==(h=Bs(e[24].timestamp)+"")&&Ue(p,h),I&65&&v!==(v=e[6]===e[24].sessionId)&&(g.disabled=v),I&1&&_!==(_=e[24].sessionId)&&r(t,"data-session-id",_),I&1&&J(t,"deleting",e[24].deleting)},d(C){C&&q(t),k=!1,me(T)}}}function Fs(s){let e;return{c(){e=x("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',r(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){G(t,e,n)},d(t){t&&q(e)}}}function Hs(s){let e,t,n,i,o,l,a,c,u;return{c(){e=x("div"),t=x("div"),t.textContent="确认删除此会话?",n=Y(),i=x("div"),o=x("button"),o.textContent="取消",l=Y(),a=x("button"),a.textContent="删除",r(t,"class","sy-session-confirm-content svelte-1g6fj9a"),r(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),r(a,"class","sy-session-confirm-delete svelte-1g6fj9a"),r(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),r(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),D(e,"left",s[8].x+"px"),D(e,"top",s[8].y+"px"),D(e,"z-index",s[3]+3)},m(h,p){G(h,e,p),m(e,t),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[U(o,"click",s[19]),U(a,"click",s[14])],c=!0)},p(h,p){p&256&&D(e,"left",h[8].x+"px"),p&256&&D(e,"top",h[8].y+"px"),p&8&&D(e,"z-index",h[3]+3)},d(h){h&&q(e),c=!1,me(u)}}}function Bo(s){let e,t,n,i,o,l,a,c,u,h,p,d,g,w,S,M,z,v,_,k=s[9]&&Ns(s);function T(I,F){return I[0].length===0?Ho:Fo}let A=T(s),b=A(s),C=s[7]&&Hs(s);return{c(){e=x("div"),t=x("div"),n=x("h2"),n.textContent="历史会话",i=Y(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',l=Y(),a=x("div"),c=x("input"),u=Y(),h=X("svg"),p=X("circle"),d=X("line"),g=Y(),k&&k.c(),w=Y(),S=x("div"),b.c(),M=Y(),C&&C.c(),z=Wt(),r(n,"class","svelte-1g6fj9a"),r(o,"class","sy-session-close svelte-1g6fj9a"),r(o,"aria-label","关闭历史会话"),r(t,"class","sy-session-header svelte-1g6fj9a"),r(c,"type","text"),r(c,"class","sy-session-search-input svelte-1g6fj9a"),r(c,"placeholder","搜索历史会话..."),r(p,"cx","11"),r(p,"cy","11"),r(p,"r","8"),r(d,"x1","21"),r(d,"y1","21"),r(d,"x2","16.65"),r(d,"y2","16.65"),r(h,"class","sy-session-search-icon svelte-1g6fj9a"),r(h,"xmlns","http://www.w3.org/2000/svg"),r(h,"width","16"),r(h,"height","16"),r(h,"viewBox","0 0 24 24"),r(h,"fill","none"),r(h,"stroke","currentColor"),r(h,"stroke-width","2"),r(h,"stroke-linecap","round"),r(h,"stroke-linejoin","round"),r(a,"class","sy-session-search svelte-1g6fj9a"),r(S,"class","sy-session-list svelte-1g6fj9a"),r(e,"class","sy-session-history svelte-1g6fj9a"),D(e,"z-index",s[3]+2)},m(I,F){G(I,e,F),m(e,t),m(t,n),m(t,i),m(t,o),m(e,l),m(e,a),m(a,c),dt(c,s[4]),m(a,u),m(a,h),m(h,p),m(h,d),m(e,g),k&&k.m(e,null),m(e,w),m(e,S),b.m(S,null),G(I,M,F),C&&C.m(I,F),G(I,z,F),v||(_=[U(o,"click",function(){St(s[1])&&s[1].apply(this,arguments)}),U(o,"mouseenter",s[15]),U(o,"mouseleave",s[12]),U(c,"input",s[16]),U(S,"scroll",s[10])],v=!0)},p(I,[F]){s=I,F&16&&c.value!==s[4]&&dt(c,s[4]),s[9]?k?k.p(s,F):(k=Ns(s),k.c(),k.m(e,w)):k&&(k.d(1),k=null),A===(A=T(s))&&b?b.p(s,F):(b.d(1),b=A(s),b&&(b.c(),b.m(S,null))),F&8&&D(e,"z-index",s[3]+2),s[7]?C?C.p(s,F):(C=Hs(s),C.c(),C.m(z.parentNode,z)):C&&(C.d(1),C=null)},i:B,o:B,d(I){I&&(q(e),q(M),q(z)),k&&k.d(),b.d(),C&&C.d(I),v=!1,me(_)}}}const Nn=10;function Bs(s){return new Date(s).toLocaleString()}function Uo(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:o}=e,{zIndex:l}=e,a=!1,c=!0,u=0,h="",p=null,d=null,g={x:0,y:0};function w(){return Oe(this,null,function*(){if(!(a||!c)){t(5,a=!0);try{const R=yield fetch("/aiops/aigc/chat/record/session/list/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({start:u,length:Nn,keyword:h})});if(!R.ok)throw new Error("Failed to load sessions");const W=yield R.json();if(W.code===0){const V=W.data.sessionList.map(Q=>({sessionId:Q.sessionId,title:Q.name,timestamp:new Date(Q.createDate).getTime()}));t(0,n=[...n,...V]),u+=Nn,c=V.length===Nn}}catch(R){console.error("Failed to load sessions:",R)}finally{t(5,a=!1)}}})}function S(R){const W=R.target,{scrollTop:V,scrollHeight:Q,clientHeight:ae}=W;Q-V-ae<50&&w()}Qn(()=>{w()});let M=null;function z(R,W){const Q=R.currentTarget.getBoundingClientRect();t(9,M={text:W,x:Q.left+Q.width/2,y:Q.bottom+8})}function v(){t(9,M=null)}function _(R,W){const Q=R.currentTarget.getBoundingClientRect();t(8,g={x:Q.left-16,y:Q.top+Q.height/2}),t(7,d=W)}function k(R){return Oe(this,null,function*(){if(R&&!p)try{t(6,p=R),t(7,d=null);const W=document.querySelector(`[data-session-id="${R}"]`);W&&W.classList.add("deleting"),yield new Promise(ae=>setTimeout(ae,300));const V=yield fetch("/aiops/aigc/chat/record/session/delete",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:R})});if(!V.ok)throw new Error("Delete request failed");const Q=yield V.json();if(Q.code===0&&Q.data.respCode===0)t(0,n=n.map(ae=>Se(se({},ae),{deleting:ae.sessionId===R}))),setTimeout(()=>{t(0,n=n.filter(ae=>!ae.deleting))},300);else throw new Error("Delete failed: "+Q.message)}catch(W){console.error("Failed to delete session:",W);const V=document.querySelector(`[data-session-id="${R}"]`);V&&V.classList.remove("deleting")}finally{t(6,p=null)}})}function T(){d&&k(d)}const A=R=>z(R,"关闭历史会话");function b(){h=this.value,t(4,h)}const C=R=>o(R.sessionId),I=(R,W)=>_(W,R.sessionId),F=()=>t(7,d=null);return s.$$set=R=>{"sessions"in R&&t(0,n=R.sessions),"onClose"in R&&t(1,i=R.onClose),"onSelect"in R&&t(2,o=R.onSelect),"zIndex"in R&&t(3,l=R.zIndex)},s.$$.update=()=>{s.$$.dirty&16&&h!==void 0&&(t(0,n=[]),u=0,c=!0,w())},[n,i,o,l,h,a,p,d,g,M,S,z,v,_,T,A,b,C,I,F]}class Us extends kn{constructor(e){super(),wn(this,e,Uo,Bo,ft,{sessions:0,onClose:1,onSelect:2,zIndex:3})}}function js(s,e,t){const n=s.slice();return n[60]=e[t],n[61]=e,n[62]=t,n}function Ws(s,e,t){const n=s.slice();return n[63]=e[t],n[65]=t,n}function jo(s){let e,t=[],n=new Map,i=_t(s[3]);const o=l=>l[60].id;for(let l=0;l<i.length;l+=1){let a=js(s,i,l),c=o(a);n.set(c,t[l]=Qs(c,a))}return{c(){e=x("div");for(let l=0;l<t.length;l+=1)t[l].c();r(e,"class","sy-assistant-message-list svelte-1gouv71")},m(l,a){G(l,e,a);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[47](e)},p(l,a){a[0]&268058361&&(i=_t(l[3]),t=es(t,a,o,1,l,i,n,e,$n,Qs,null,js))},i:B,o:B,d(l){l&&q(e);for(let a=0;a<t.length;a+=1)t[a].d();s[47](null)}}}function Wo(s){let e,t;return e=new Us({props:{sessions:s[28],onClose:s[30],onSelect:s[31],zIndex:s[0]}}),{c(){mn(e.$$.fragment)},m(n,i){Gt(e,n,i),t=!0},p(n,i){const o={};i[0]&1&&(o.zIndex=n[0]),e.$set(o)},i(n){t||(je(e.$$.fragment,n),t=!0)},o(n){Ke(e.$$.fragment,n),t=!1},d(n){Yt(e,n)}}}function qo(s){let e;return{c(){e=x("div"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></svg>',r(e,"class","sy-assistant-avatar user svelte-1gouv71")},m(t,n){G(t,e,n)},d(t){t&&q(e)}}}function Go(s){let e;return{c(){e=x("div"),e.innerHTML='<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" fill="currentColor"><path d="M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z" fill="#6F8698"></path><path d="M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z" fill="#3677FF"></path><path d="M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z" fill="#D0D5F1"></path><path d="M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z" fill="#3677FF"></path><path d="M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z" fill="#FFFFFF"></path><path d="M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z" fill="#8896A4"></path></svg>',r(e,"class","sy-assistant-avatar assistant svelte-1gouv71")},m(t,n){G(t,e,n)},d(t){t&&q(e)}}}function Yo(s){let e,t=s[17](s[60].content)+"";return{c(){e=x("div"),r(e,"class","markdown-content svelte-1gouv71")},m(n,i){G(n,e,i),e.innerHTML=t},p(n,i){i[0]&8&&t!==(t=n[17](n[60].content)+"")&&(e.innerHTML=t)},d(n){n&&q(e)}}}function Zo(s){let e;return{c(){e=x("span"),e.innerHTML='<span class="dot svelte-1gouv71">.</span> <span class="dot svelte-1gouv71">.</span> <span class="dot svelte-1gouv71">.</span>',r(e,"class","sy-assistant-loading svelte-1gouv71")},m(t,n){G(t,e,n)},p:B,d(t){t&&q(e)}}}function qs(s){let e,t=_t(s[60].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=Zs(Ws(s,t,i));return{c(){e=x("div");for(let i=0;i<n.length;i+=1)n[i].c();r(e,"class","sy-assistant-attachments svelte-1gouv71")},m(i,o){G(i,e,o);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(e,null)},p(i,o){if(o[0]&3670137){t=_t(i[60].attachments);let l;for(l=0;l<t.length;l+=1){const a=Ws(i,t,l);n[l]?n[l].p(a,o):(n[l]=Zs(a),n[l].c(),n[l].m(e,null))}for(;l<n.length;l+=1)n[l].d(1);n.length=t.length}},d(i){i&&q(e),ki(n,i)}}}function Gs(s){let e,t,n;function i(...o){return s[34](s[63],...o)}return{c(){e=x("button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1gouv71"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',r(e,"class","sy-assistant-attachment-toggle svelte-1gouv71"),r(e,"aria-label","查看详情")},m(o,l){G(o,e,l),t||(n=[U(e,"mouseenter",i),U(e,"mouseleave",s[20])],t=!0)},p(o,l){s=o},d(o){o&&q(e),t=!1,me(n)}}}function Ys(s){let e,t=s[4].replace(/\n/g,"<br>")+"",n,i;return{c(){e=x("div"),r(e,"class","sy-assistant-tooltip svelte-1gouv71"),r(e,"role","tooltip"),D(e,"left",s[5].x+"px"),D(e,"top",s[5].y+"px"),D(e,"z-index",s[0]+3),J(e,"align-right",s[5].alignRight)},m(o,l){G(o,e,l),e.innerHTML=t,n||(i=[U(e,"mouseenter",s[36]),U(e,"mouseleave",s[37])],n=!0)},p(o,l){l[0]&16&&t!==(t=o[4].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&32&&D(e,"left",o[5].x+"px"),l[0]&32&&D(e,"top",o[5].y+"px"),l[0]&1&&D(e,"z-index",o[0]+3),l[0]&32&&J(e,"align-right",o[5].alignRight)},d(o){o&&q(e),n=!1,me(i)}}}function Zs(s){let e,t,n,i,o,l,a,c,u,h=nn(s[63].content_title).name+"",p,d,g,w=nn(s[63].content_title).ext+"",S,M,z,v,_,k,T,A,b,C,I=s[63].tips&&Gs(s);function F(){return s[35](s[63])}let R=s[4]&&Ys(s);return{c(){e=x("div"),t=x("div"),n=x("div"),i=X("svg"),o=X("path"),l=X("polyline"),a=Y(),c=x("div"),u=x("span"),p=Ae(h),d=Y(),g=x("span"),S=Ae(w),z=Y(),v=x("div"),I&&I.c(),_=Y(),k=x("button"),k.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svelte-1gouv71"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>',T=Y(),R&&R.c(),A=Y(),r(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),r(l,"points","13 2 13 9 20 9"),r(i,"xmlns","http://www.w3.org/2000/svg"),r(i,"width","16"),r(i,"height","16"),r(i,"viewBox","0 0 24 24"),r(i,"fill","none"),r(i,"stroke","currentColor"),r(i,"stroke-width","2"),r(i,"stroke-linecap","round"),r(i,"stroke-linejoin","round"),r(u,"class","sy-assistant-filename svelte-1gouv71"),r(g,"class","sy-assistant-attachment-ext svelte-1gouv71"),r(c,"class","sy-assistant-attachment-name svelte-1gouv71"),r(c,"title",M=s[63].content_title),r(n,"class","sy-assistant-attachment-title svelte-1gouv71"),r(k,"class","sy-assistant-attachment-toggle svelte-1gouv71"),r(k,"aria-label","下载文件"),r(v,"class","sy-assistant-attachment-actions svelte-1gouv71"),r(t,"class","sy-assistant-attachment-header svelte-1gouv71"),r(e,"class","sy-assistant-attachment svelte-1gouv71")},m(W,V){G(W,e,V),m(e,t),m(t,n),m(n,i),m(i,o),m(i,l),m(n,a),m(n,c),m(c,u),m(u,p),m(c,d),m(c,g),m(g,S),m(t,z),m(t,v),I&&I.m(v,null),m(v,_),m(v,k),m(e,T),R&&R.m(e,null),m(e,A),b||(C=U(k,"click",F),b=!0)},p(W,V){s=W,V[0]&8&&h!==(h=nn(s[63].content_title).name+"")&&Ue(p,h),V[0]&8&&w!==(w=nn(s[63].content_title).ext+"")&&Ue(S,w),V[0]&8&&M!==(M=s[63].content_title)&&r(c,"title",M),s[63].tips?I?I.p(s,V):(I=Gs(s),I.c(),I.m(v,_)):I&&(I.d(1),I=null),s[4]?R?R.p(s,V):(R=Ys(s),R.c(),R.m(e,A)):R&&(R.d(1),R=null)},d(W){W&&q(e),I&&I.d(),R&&R.d(),b=!1,C()}}}function Xs(s){let e,t,n,i,o,l,a,c,u,h,p;function d(A,b){return A[9][A[60].id]?Vo:Xo}let g=d(s),w=g(s);function S(){return s[38](s[60])}function M(...A){return s[39](s[60],...A)}function z(){return s[40](s[60])}function v(...A){return s[41](s[60],...A)}function _(...A){return s[42](s[60],...A)}function k(...A){return s[43](s[60],...A)}let T=s[12]&&s[10][s[60].id]==="dislike"&&Vs(s);return{c(){e=x("div"),t=x("button"),w.c(),i=Y(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg>',l=Y(),a=x("button"),a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h3a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-3"></path></svg>',c=Y(),T&&T.c(),u=Wt(),r(t,"class","sy-assistant-action-button svelte-1gouv71"),r(t,"aria-label",n=s[9][s[60].id]?"已复制":"复制内容"),J(t,"copied",s[9][s[60].id]),r(o,"class","sy-assistant-action-button svelte-1gouv71"),r(o,"aria-label","点赞"),J(o,"active",s[10][s[60].id]==="like"),r(a,"class","sy-assistant-action-button svelte-1gouv71"),r(a,"aria-label","点踩"),J(a,"active",s[10][s[60].id]==="dislike"),r(e,"class","sy-assistant-message-actions svelte-1gouv71")},m(A,b){G(A,e,b),m(e,t),w.m(t,null),m(e,i),m(e,o),m(e,l),m(e,a),G(A,c,b),T&&T.m(A,b),G(A,u,b),h||(p=[U(t,"click",S),U(t,"mouseenter",M),U(t,"mouseleave",s[27]),U(o,"click",z),U(o,"mouseenter",v),U(o,"mouseleave",s[27]),U(a,"click",_),U(a,"mouseenter",k),U(a,"mouseleave",s[27])],h=!0)},p(A,b){s=A,g!==(g=d(s))&&(w.d(1),w=g(s),w&&(w.c(),w.m(t,null))),b[0]&520&&n!==(n=s[9][s[60].id]?"已复制":"复制内容")&&r(t,"aria-label",n),b[0]&520&&J(t,"copied",s[9][s[60].id]),b[0]&1032&&J(o,"active",s[10][s[60].id]==="like"),b[0]&1032&&J(a,"active",s[10][s[60].id]==="dislike"),s[12]&&s[10][s[60].id]==="dislike"?T?T.p(s,b):(T=Vs(s),T.c(),T.m(u.parentNode,u)):T&&(T.d(1),T=null)},d(A){A&&(q(e),q(c),q(u)),w.d(),T&&T.d(A),h=!1,me(p)}}}function Xo(s){let e,t,n;return{c(){e=X("svg"),t=X("rect"),n=X("path"),r(t,"x","9"),r(t,"y","9"),r(t,"width","13"),r(t,"height","13"),r(t,"rx","2"),r(t,"ry","2"),r(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(i,o){G(i,e,o),m(e,t),m(e,n)},d(i){i&&q(e)}}}function Vo(s){let e,t;return{c(){e=X("svg"),t=X("polyline"),r(t,"points","20 6 9 17 4 12"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"width","14"),r(e,"height","14"),r(e,"viewBox","0 0 24 24"),r(e,"fill","none"),r(e,"stroke","currentColor"),r(e,"stroke-width","2"),r(e,"stroke-linecap","round"),r(e,"stroke-linejoin","round")},m(n,i){G(n,e,i),m(e,t)},d(n){n&&q(e)}}}function Vs(s){let e,t,n,i,o,l,a,c,u;function h(){s[44].call(t,s[60])}function p(){return s[45](s[60])}function d(){return s[46](s[60])}return{c(){e=x("div"),t=x("textarea"),n=Y(),i=x("div"),o=x("button"),o.textContent="取消",l=Y(),a=x("button"),a.textContent="提交",r(t,"class","sy-assistant-dislike-input svelte-1gouv71"),r(t,"placeholder","请输入您的反馈意见..."),r(o,"class","sy-assistant-popup-cancel svelte-1gouv71"),r(a,"class","sy-assistant-popup-submit svelte-1gouv71"),r(i,"class","sy-assistant-popup-actions svelte-1gouv71"),r(e,"class","sy-assistant-dislike-popup svelte-1gouv71"),D(e,"left",s[13].x+"px"),D(e,"top",s[13].y+"px"),D(e,"z-index",s[0]+3)},m(g,w){G(g,e,w),m(e,t),dt(t,s[11][s[60].id]),m(e,n),m(e,i),m(i,o),m(i,l),m(i,a),c||(u=[U(t,"input",h),U(o,"click",p),U(a,"click",d)],c=!0)},p(g,w){s=g,w[0]&2056&&dt(t,s[11][s[60].id]),w[0]&8192&&D(e,"left",s[13].x+"px"),w[0]&8192&&D(e,"top",s[13].y+"px"),w[0]&1&&D(e,"z-index",s[0]+3)},d(g){g&&q(e),c=!1,me(u)}}}function Qs(s,e){let t,n,i,o,l,a,c,u,h=new Date(e[60].timestamp).toLocaleString()+"",p,d;function g(T,A){return T[60].type==="assistant"?Go:qo}let w=g(e),S=w(e);function M(T,A){return T[7]&&T[60].id===T[3][T[3].length-1].id&&T[60].type==="assistant"&&!T[60].content?Zo:Yo}let z=M(e),v=z(e),_=e[60].attachments&&qs(e),k=e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]&&Xs(e);return{key:s,first:null,c(){t=x("div"),S.c(),n=Y(),i=x("div"),o=x("div"),v.c(),l=Y(),_&&_.c(),a=Y(),k&&k.c(),c=Y(),u=x("div"),p=Ae(h),d=Y(),r(o,"class","sy-assistant-message-content svelte-1gouv71"),r(u,"class","sy-assistant-message-time svelte-1gouv71"),r(i,"class","sy-assistant-message-bubble svelte-1gouv71"),r(t,"class","sy-assistant-message svelte-1gouv71"),J(t,"user",e[60].type==="user"),this.first=t},m(T,A){G(T,t,A),S.m(t,null),m(t,n),m(t,i),m(i,o),v.m(o,null),m(o,l),_&&_.m(o,null),m(o,a),k&&k.m(o,null),m(i,c),m(i,u),m(u,p),m(t,d)},p(T,A){e=T,w!==(w=g(e))&&(S.d(1),S=w(e),S&&(S.c(),S.m(t,n))),z===(z=M(e))&&v?v.p(e,A):(v.d(1),v=z(e),v&&(v.c(),v.m(o,l))),e[60].attachments?_?_.p(e,A):(_=qs(e),_.c(),_.m(o,a)):_&&(_.d(1),_=null),e[60].id!=="-1"&&e[60].type==="assistant"&&!e[7]?k?k.p(e,A):(k=Xs(e),k.c(),k.m(o,null)):k&&(k.d(1),k=null),A[0]&8&&h!==(h=new Date(e[60].timestamp).toLocaleString()+"")&&Ue(p,h),A[0]&8&&J(t,"user",e[60].type==="user")},d(T){T&&q(t),S.d(),v.d(),_&&_.d(),k&&k.d()}}}function Js(s){let e,t,n,i,o,l,a,c,u,h,p,d,g,w,S,M,z,v,_,k,T,A,b,C;return{c(){e=x("div"),t=x("div"),n=x("button"),n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',i=Y(),o=x("button"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',l=Y(),a=x("div"),c=x("div"),u=x("div"),h=x("div"),p=x("textarea"),d=Y(),g=x("div"),w=Ae(s[2]),S=Ae("/"),M=Ae(Pn),z=Y(),v=x("button"),_=X("svg"),k=X("line"),T=X("polygon"),r(n,"class","sy-assistant-icon-button svelte-1gouv71"),r(n,"aria-label","历史会话"),r(o,"class","sy-assistant-icon-button svelte-1gouv71"),r(o,"aria-label","新建会话"),r(t,"class","sy-assistant-chat-actions svelte-1gouv71"),r(e,"class","sy-assistant-chat-footer svelte-1gouv71"),r(p,"class","sy-assistant-textarea svelte-1gouv71"),r(p,"placeholder","输入您的问题..."),r(p,"maxlength",Pn),r(p,"rows","3"),r(g,"class","sy-assistant-char-count svelte-1gouv71"),J(g,"over-limit",s[16]),r(h,"class","sy-assistant-textarea-container svelte-1gouv71"),r(u,"class","sy-assistant-input-wrapper svelte-1gouv71"),r(k,"x1","22"),r(k,"y1","2"),r(k,"x2","11"),r(k,"y2","13"),r(T,"points","22 2 15 22 11 13 2 9 22 2"),r(_,"xmlns","http://www.w3.org/2000/svg"),r(_,"width","20"),r(_,"height","20"),r(_,"viewBox","0 0 24 24"),r(_,"fill","none"),r(_,"stroke","currentColor"),r(_,"stroke-width","2"),r(_,"stroke-linecap","round"),r(_,"stroke-linejoin","round"),r(v,"class","sy-assistant-send-button svelte-1gouv71"),v.disabled=A=!s[1].trim()||s[16],r(v,"aria-label","发送消息"),r(c,"class","sy-assistant-input-container svelte-1gouv71"),r(a,"class","sy-assistant-input-area svelte-1gouv71")},m(I,F){G(I,e,F),m(e,t),m(t,n),m(t,i),m(t,o),G(I,l,F),G(I,a,F),m(a,c),m(c,u),m(u,h),m(h,p),dt(p,s[1]),m(h,d),m(h,g),m(g,w),m(g,S),m(g,M),m(c,z),m(c,v),m(v,_),m(_,k),m(_,T),b||(C=[U(n,"click",s[29]),U(n,"mouseenter",s[48]),U(n,"mouseleave",s[27]),U(n,"blur",s[27]),U(o,"click",s[32]),U(o,"mouseenter",s[49]),U(o,"mouseleave",s[27]),U(p,"input",s[50]),U(p,"keydown",s[51]),U(v,"click",s[18]),U(v,"mouseenter",s[52]),U(v,"mouseleave",s[27])],b=!0)},p(I,F){F[0]&2&&dt(p,I[1]),F[0]&4&&Ue(w,I[2]),F[0]&65536&&J(g,"over-limit",I[16]),F[0]&65538&&A!==(A=!I[1].trim()||I[16])&&(v.disabled=A)},d(I){I&&(q(e),q(l),q(a)),b=!1,me(C)}}}function Ks(s){let e,t=s[14].text+"",n;return{c(){e=x("div"),n=Ae(t),r(e,"class","sy-assistant-button-tooltip svelte-1gouv71"),D(e,"left",s[14].x+"px"),D(e,"top",s[14].y+"px")},m(i,o){G(i,e,o),m(e,n)},p(i,o){o[0]&16384&&t!==(t=i[14].text+"")&&Ue(n,t),o[0]&16384&&D(e,"left",i[14].x+"px"),o[0]&16384&&D(e,"top",i[14].y+"px")},d(i){i&&q(e)}}}function Qo(s){let e,t,n,i,o,l,a;const c=[Wo,jo],u=[];function h(g,w){return g[15]?0:1}t=h(s),n=u[t]=c[t](s);let p=!s[15]&&Js(s),d=s[14]&&Ks(s);return{c(){e=x("div"),n.c(),i=Y(),p&&p.c(),o=Y(),d&&d.c(),l=Wt(),r(e,"class","sy-assistant-chat-container svelte-1gouv71"),D(e,"z-index",s[0]+2)},m(g,w){G(g,e,w),u[t].m(e,null),m(e,i),p&&p.m(e,null),s[53](e),G(g,o,w),d&&d.m(g,w),G(g,l,w),a=!0},p(g,w){let S=t;t=h(g),t===S?u[t].p(g,w):(dn(),Ke(u[S],1,1,()=>{u[S]=null}),gn(),n=u[t],n?n.p(g,w):(n=u[t]=c[t](g),n.c()),je(n,1),n.m(e,i)),g[15]?p&&(p.d(1),p=null):p?p.p(g,w):(p=Js(g),p.c(),p.m(e,null)),(!a||w[0]&1)&&D(e,"z-index",g[0]+2),g[14]?d?d.p(g,w):(d=Ks(g),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i(g){a||(je(n),a=!0)},o(g){Ke(n),a=!1},d(g){g&&(q(e),q(o),q(l)),u[t].d(),p&&p.d(),s[53](null),d&&d.d(g)}}}let Pn=500;function Jo(s){const e=s.match(/source#\[(.*)\]#source/);return e?s.replace(`source#[${e[1]}]#source`,""):s}function $s(s){const e=s.match(/source#\[(.*)\]#source/);if(e)try{return JSON.parse(`[${e[1]}]`)}catch(t){console.error("Failed to parse attachments:",t)}return null}function nn(s){const e=s.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:s,ext:""}}function Ko(s,e,t){let n,i,o="",l=[{sessionId:"",requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],a="",c=null,u=null,h={x:0,y:0,alignRight:!1},p=null,d=!1;ee.setOptions({breaks:!0,gfm:!0});function g(y){try{const H=ee(y);return zs.sanitize(H)}catch(H){console.warn("Markdown parsing failed, fallback to HTML:",H);try{const $=y.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return zs.sanitize($)}catch($){return console.error("HTML fallback failed:",$),y}}}let w;function S(y=!1){w&&w.scrollTo({top:w.scrollHeight,behavior:y?"smooth":"auto"})}bi(()=>{S(!1)});let{sessionId:M}=e;function z(){return Oe(this,null,function*(){if(!o.trim()||i)return;if(!M){console.error("No session ID available");return}const y=Date.now().toString(),H=Date.now().toString()+Math.random().toString().slice(2,8),$={sessionId:M,requestId:H,id:y,type:"user",content:o.trim(),timestamp:Date.now()};t(3,l=[...l,$]);const _e=o.trim();t(1,o="");const pe=(Date.now()+1).toString();a="",t(3,l=[...l,{sessionId:M,requestId:H,id:pe,type:"assistant",content:"",timestamp:Date.now()}]),t(7,d=!0),c&&c.abort(),c=new AbortController;try{yield Ni("/aiops/aigc/chat/sse",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:M,requestId:H,keyword:_e,flowId:"1"}),signal:c.signal,onmessage(Ie){try{const ye=Ie.data;if(ye){const tt=$s(ye);tt?(t(3,l=l.map(ve=>ve.id===pe?Se(se({},ve),{attachments:tt}):ve)),S(!0)):(a+=ye,t(3,l=l.map(ve=>ve.id===pe?Se(se({},ve),{content:a}):ve)),S(!1))}}catch(ye){console.error("Failed to process SSE message:",ye)}},onerror(Ie){console.error("SSE error:",Ie),c=null,t(7,d=!1)},onclose(){c=null,t(7,d=!1)}})}catch(Ie){console.error("Failed to send message:",Ie),t(7,d=!1)}})}function v(y,H,$){const _e=$.getBoundingClientRect(),pe=w.getBoundingClientRect(),Ie=_e.left<pe.width/2;t(4,u=H),t(5,h={x:_e.left,y:_e.top+_e.height/2,alignRight:Ie})}function _(){t(6,p=setTimeout(()=>{t(4,u=null),t(6,p=null)},200))}yi(()=>{c&&c.abort(),p&&clearTimeout(p)});function k(y,H){return Oe(this,null,function*(){try{const $=yield fetch("/aiops/aigc/file/downloadFile",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({fileName:y,fileUrl:H})});if(!$.ok)throw new Error("Download failed");const _e=$.headers.get("content-type")||"application/octet-stream",pe=yield $.blob(),Ie=window.URL.createObjectURL(pe),ye=document.createElement("a");ye.href=Ie,ye.download=y,document.body.appendChild(ye),ye.click(),window.URL.revokeObjectURL(Ie),document.body.removeChild(ye)}catch($){console.error("Failed to download file:",$)}})}let T={};function A(y,H){return Oe(this,null,function*(){try{const $=H.replace(/<br\s*\/?>/g,`
48
+ `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();yield navigator.clipboard.writeText($),t(9,T[y]=!0,T),setTimeout(()=>{t(9,T[y]=!1,T),t(9,T)},1500)}catch($){console.error("Failed to copy:",$)}})}let b={},C={},I=!1;function F(y,H){return Oe(this,null,function*(){if(b[y]===H){t(10,b[y]=null,b),t(10,b);return}if(t(10,b[y]=H,b),t(10,b),H==="like")try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:M,requestId:y,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch($){console.error("Failed to send feedback:",$),t(10,b[y]=null,b),t(10,b)}else t(12,I=!0)})}function R(y){return Oe(this,null,function*(){var H;if((H=C[y])!=null&&H.trim())try{if(!(yield fetch("/aiops/aigc/chat/record/feedback",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:M,requestId:y,feedBackFlag:"0",feedBackContent:C[y]})})).ok)throw new Error("Feedback failed");t(12,I=!1),t(11,C[y]="",C),t(11,C)}catch($){console.error("Failed to send feedback:",$),t(10,b[y]=null,b),t(10,b)}})}let W={x:0,y:0};function V(y,H){const _e=y.currentTarget.getBoundingClientRect();t(13,W={x:_e.left-290,y:_e.top-160}),F(H,"dislike")}let Q=null;function ae(y,H){const _e=y.currentTarget.getBoundingClientRect();t(14,Q={text:H,x:_e.left+_e.width/2,y:_e.top-8})}function ge(){t(14,Q=null)}let he=!1,Ge=[],ce=Date.now().toString();function Xe(){ge(),t(15,he=!0)}function ue(){ge(),t(15,he=!1)}function $e(y){return Oe(this,null,function*(){if(!d){t(7,d=!0);try{const H=yield fetch("/aiops/aigc/chat/record/session/detail/query",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`},body:JSON.stringify({sessionId:y})});if(!H.ok)throw new Error("Failed to load sessions");const $=yield H.json();if($.code===0){ce=y,t(15,he=!1);const _e=$.data.map((pe,Ie)=>{const ye=$s(pe.answer),tt=Jo(pe.answer);return[{sessionId:pe.sessionId,requestId:pe.requestId,id:(Date.now()+2*Ie).toString(),type:"user",content:pe.keyword,timestamp:new Date(pe.createDate).getTime()},{sessionId:pe.sessionId,requestId:pe.requestId,id:(Date.now()+2*Ie+1).toString(),type:"assistant",content:tt,attachments:ye,timestamp:new Date(pe.createDate).getTime()}]});t(3,l=_e.flat())}}catch(H){console.error("Failed to load sessions:",H)}finally{t(7,d=!1)}}})}function re(){return Oe(this,null,function*(){const y=yield Le();if(!y){console.error("Failed to create new session");return}ce=y,t(3,l=[{sessionId:ce,requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(1,o="")})}function Le(){return Oe(this,null,function*(){try{const y=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`}});if(!y.ok)throw new Error("Failed to get session ID");const H=yield y.json();if(H.code===0)return ce=H.data.sessionId,ce;throw new Error(H.message||"Failed to get session ID")}catch(y){return console.error("Failed to get session ID:",y),null}})}let{zIndex:te}=e;const De=(y,H)=>v(H,y.tips,H.currentTarget),xe=y=>k(y.content_title,y.link),et=()=>{p&&(clearTimeout(p),t(6,p=null))},N=()=>{t(4,u=null)},ie=y=>A(y.id,y.content),O=(y,H)=>ae(H,T[y.id]?"已复制":"复制内容"),j=y=>F(y.id,"like"),we=(y,H)=>ae(H,b[y.id]==="like"?"取消点赞":"点赞"),ke=(y,H)=>V(H,y.id),Ne=(y,H)=>ae(H,b[y.id]==="dislike"?"取消点踩":"点踩");function Be(y){C[y.id]=this.value,t(11,C)}const st=y=>{t(12,I=!1),t(10,b[y.id]=null,b),t(10,b)},yt=y=>R(y.id);function Tt(y){mt[y?"unshift":"push"](()=>{w=y,t(8,w)})}const sn=y=>ae(y,"历史会话"),on=y=>ae(y,"新建会话");function Hn(){o=this.value,t(1,o)}const Ht=y=>y.key==="Enter"&&!y.shiftKey&&(z(),y.preventDefault()),ut=y=>ae(y,"发送消息");function it(y){mt[y?"unshift":"push"](()=>{w=y,t(8,w)})}return s.$$set=y=>{"sessionId"in y&&t(33,M=y.sessionId),"zIndex"in y&&t(0,te=y.zIndex)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(2,n=o.length),s.$$.dirty[0]&4&&t(16,i=n>Pn)},[te,o,n,l,u,h,p,d,w,T,b,C,I,W,Q,he,i,g,z,v,_,k,A,F,R,V,ae,ge,Ge,Xe,ue,$e,re,M,De,xe,et,N,ie,O,j,we,ke,Ne,Be,st,yt,Tt,sn,on,Hn,Ht,ut,it]}class $o extends kn{constructor(e){super(),wn(this,e,Ko,Qo,ft,{sessionId:33,zIndex:0},null,[-1,-1,-1])}}function ei(s){let e,t,n,i,o=s[3].title+"",l,a,c,u,h,p,d,g,w,S=s[2]?"退出全屏":"全屏显示",M,z,v,_,k,T,A,b,C=s[7]?"取消吸附":"吸附到边缘",I,F,R,W,V,Q,ae,ge,he,Ge=`${s[3].height}px`,ce,Xe,ue;function $e(O,j){return O[2]?tl:el}let re=$e(s),Le=re(s);function te(O,j){return O[7]?sl:nl}let De=te(s),xe=De(s);const et=[ol,il],N=[];function ie(O,j){return O[8]?0:1}return ge=ie(s),he=N[ge]=et[ge](s),{c(){var O,j,we;e=x("div"),t=x("div"),n=x("div"),i=x("h3"),l=Ae(o),a=Y(),c=x("div"),u=x("div"),h=x("button"),p=X("svg"),Le.c(),g=Y(),w=x("span"),M=Ae(S),z=Y(),v=x("div"),_=x("button"),k=X("svg"),xe.c(),A=Y(),b=x("span"),I=Ae(C),F=Y(),R=x("div"),W=x("button"),W.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',V=Y(),Q=x("span"),Q.textContent="关闭助手",ae=Y(),he.c(),r(i,"class","svelte-1427avp"),r(p,"xmlns","http://www.w3.org/2000/svg"),r(p,"width","18"),r(p,"height","18"),r(p,"viewBox","0 0 24 24"),r(p,"fill","none"),r(p,"stroke","currentColor"),r(p,"stroke-width","2"),r(p,"stroke-linecap","round"),r(p,"stroke-linejoin","round"),r(h,"class","sy-assistant-action-button svelte-1427avp"),r(h,"aria-label",d=s[2]?"退出全屏":"全屏显示"),J(h,"active",s[2]),r(w,"class","sy-assistant-tooltip svelte-1427avp"),D(w,"z-index",(O=s[3].zIndex)!=null?O:1e3),r(u,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),r(k,"xmlns","http://www.w3.org/2000/svg"),r(k,"width","18"),r(k,"height","18"),r(k,"viewBox","0 0 24 24"),r(k,"fill","none"),r(k,"stroke","currentColor"),r(k,"stroke-width","2"),r(k,"stroke-linecap","round"),r(k,"stroke-linejoin","round"),r(_,"class","sy-assistant-action-button svelte-1427avp"),r(_,"aria-label",T=s[7]?"取消吸附":"吸附到边缘"),J(_,"active",s[7]),r(b,"class","sy-assistant-tooltip svelte-1427avp"),D(b,"z-index",(j=s[3].zIndex)!=null?j:1e3),r(v,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),r(W,"class","sy-assistant-close-button svelte-1427avp"),r(W,"aria-label","关闭助手"),r(Q,"class","sy-assistant-tooltip svelte-1427avp"),D(Q,"z-index",(we=s[3].zIndex)!=null?we:1e3),r(R,"class","sy-assistant-tooltip-wrapper svelte-1427avp"),r(c,"class","sy-assistant-header-actions svelte-1427avp"),r(n,"class","sy-assistant-drawer-header svelte-1427avp"),r(n,"role","button"),r(n,"tabindex","0"),r(n,"aria-label","拖动助手窗口"),J(n,"dragging",s[6]),J(n,"fullscreen",s[2]),J(n,"snapped",s[7]),r(t,"class","sy-assistant-drawer-content svelte-1427avp"),r(e,"class","sy-assistant-drawer svelte-1427avp"),J(e,"fullscreen",s[2]),D(e,"height",Ge)},m(O,j){G(O,e,j),m(e,t),m(t,n),m(n,i),m(i,l),m(n,a),m(n,c),m(c,u),m(u,h),m(h,p),Le.m(p,null),m(u,g),m(u,w),m(w,M),m(c,z),m(c,v),m(v,_),m(_,k),xe.m(k,null),m(v,A),m(v,b),m(b,I),m(c,F),m(c,R),m(R,W),m(R,V),m(R,Q),m(t,ae),N[ge].m(t,null),ce=!0,Xe||(ue=[U(h,"click",s[16]),U(_,"click",s[18]),U(W,"click",s[15]),U(n,"mousedown",Vn(s[17]))],Xe=!0)},p(O,j){var ke,Ne,Be;(!ce||j[0]&8)&&o!==(o=O[3].title+"")&&Ue(l,o),re!==(re=$e(O))&&(Le.d(1),Le=re(O),Le&&(Le.c(),Le.m(p,null))),(!ce||j[0]&4&&d!==(d=O[2]?"退出全屏":"全屏显示"))&&r(h,"aria-label",d),(!ce||j[0]&4)&&J(h,"active",O[2]),(!ce||j[0]&4)&&S!==(S=O[2]?"退出全屏":"全屏显示")&&Ue(M,S),j[0]&8&&D(w,"z-index",(ke=O[3].zIndex)!=null?ke:1e3),De!==(De=te(O))&&(xe.d(1),xe=De(O),xe&&(xe.c(),xe.m(k,null))),(!ce||j[0]&128&&T!==(T=O[7]?"取消吸附":"吸附到边缘"))&&r(_,"aria-label",T),(!ce||j[0]&128)&&J(_,"active",O[7]),(!ce||j[0]&128)&&C!==(C=O[7]?"取消吸附":"吸附到边缘")&&Ue(I,C),j[0]&8&&D(b,"z-index",(Ne=O[3].zIndex)!=null?Ne:1e3),j[0]&8&&D(Q,"z-index",(Be=O[3].zIndex)!=null?Be:1e3),(!ce||j[0]&64)&&J(n,"dragging",O[6]),(!ce||j[0]&4)&&J(n,"fullscreen",O[2]),(!ce||j[0]&128)&&J(n,"snapped",O[7]);let we=ge;ge=ie(O),ge===we?N[ge].p(O,j):(dn(),Ke(N[we],1,1,()=>{N[we]=null}),gn(),he=N[ge],he?he.p(O,j):(he=N[ge]=et[ge](O),he.c()),je(he,1),he.m(t,null)),(!ce||j[0]&4)&&J(e,"fullscreen",O[2]),j[0]&8&&Ge!==(Ge=`${O[3].height}px`)&&D(e,"height",Ge)},i(O){ce||(je(he),ce=!0)},o(O){Ke(he),ce=!1},d(O){O&&q(e),Le.d(),xe.d(),N[ge].d(),Xe=!1,me(ue)}}}function el(s){let e;return{c(){e=X("path"),r(e,"d","M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3")},m(t,n){G(t,e,n)},d(t){t&&q(e)}}}function tl(s){let e;return{c(){e=X("path"),r(e,"d","M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3")},m(t,n){G(t,e,n)},d(t){t&&q(e)}}}function nl(s){let e,t;return{c(){e=X("rect"),t=X("line"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x1","16"),r(t,"y1","6"),r(t,"x2","16"),r(t,"y2","18")},m(n,i){G(n,e,i),G(n,t,i)},d(n){n&&(q(e),q(t))}}}function sl(s){let e,t;return{c(){e=X("rect"),t=X("rect"),r(e,"x","3"),r(e,"y","3"),r(e,"width","18"),r(e,"height","18"),r(e,"rx","2"),r(e,"ry","2"),r(t,"x","12"),r(t,"y","10"),r(t,"width","6"),r(t,"height","8"),r(t,"rx","1"),r(t,"ry","1")},m(n,i){G(n,e,i),G(n,t,i)},d(n){n&&(q(e),q(t))}}}function il(s){var n;let e,t;return e=new $o({props:{zIndex:(n=s[3].zIndex)!=null?n:1e3,sessionId:s[9]}}),{c(){mn(e.$$.fragment)},m(i,o){Gt(e,i,o),t=!0},p(i,o){var a;const l={};o[0]&8&&(l.zIndex=(a=i[3].zIndex)!=null?a:1e3),o[0]&512&&(l.sessionId=i[9]),e.$set(l)},i(i){t||(je(e.$$.fragment,i),t=!0)},o(i){Ke(e.$$.fragment,i),t=!1},d(i){Yt(e,i)}}}function ol(s){var n;let e,t;return e=new Us({props:{sessions:s[13],onClose:s[26],onSelect:s[19],zIndex:(n=s[3].zIndex)!=null?n:1e3}}),{c(){mn(e.$$.fragment)},m(i,o){Gt(e,i,o),t=!0},p(i,o){var a;const l={};o[0]&256&&(l.onClose=i[26]),o[0]&8&&(l.zIndex=(a=i[3].zIndex)!=null?a:1e3),e.$set(l)},i(i){t||(je(e.$$.fragment,i),t=!0)},o(i){Ke(e.$$.fragment,i),t=!1},d(i){Yt(e,i)}}}function ll(s){let e,t,n=`${s[12]}px`,i,o,l,a,c,u,h,p,d,g,w,S,M,z,v=s[12]>0&&ei(s);return{c(){var _,k;e=x("div"),t=x("div"),v&&v.c(),i=Y(),o=x("button"),l=X("svg"),a=X("path"),c=X("path"),u=X("path"),h=X("path"),p=X("path"),d=X("path"),g=X("path"),r(t,"class","sy-assistant-drawer-wrapper svelte-1427avp"),J(t,"fullscreen",s[2]),D(t,"width",n),r(a,"d","M896.512 698.88H132.608c-58.88 0-107.008-48.128-107.008-107.008v-10.24c0-58.88 48.128-107.008 107.008-107.008h763.904c58.88 0 107.008 48.128 107.008 107.008v10.24c0 58.88-48.128 107.008-107.008 107.008zM496.64 201.728h35.84v117.248h-35.84z"),r(a,"fill","#6F8698"),r(c,"d","M516.608 223.744h-4.608c-37.888 0-68.096-30.72-68.096-68.096v-6.656c0-37.888 30.72-68.096 68.096-68.096h4.608c37.888 0 68.096 30.72 68.096 68.096v6.656c0.512 37.888-30.208 68.096-68.096 68.096z"),r(c,"fill","#3677FF"),r(u,"d","M573.44 944.64H450.56c-181.248 0-327.68-146.432-327.68-327.68v-4.096c0-181.248 146.432-327.68 327.68-327.68h122.88c181.248 0 327.68 146.432 327.68 327.68v4.096c0 180.224-146.432 327.68-327.68 327.68z"),r(u,"fill","#D0D5F1"),r(h,"d","M681.984 715.264H347.136c-72.704 0-131.584-58.88-131.584-131.584s58.88-131.584 131.584-131.584h334.336c72.704 0 131.584 58.88 131.584 131.584 0.512 72.704-58.368 131.584-131.072 131.584z"),r(h,"fill","#3677FF"),r(p,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(p,"fill","#FFFFFF"),r(d,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),r(d,"fill","#FFFFFF"),r(g,"d","M443.392 799.232s2.56 58.88 68.096 58.88c58.88 0 69.632-61.952 69.632-61.952s-27.136 33.28-68.096 33.28c-42.496 0-69.632-30.208-69.632-30.208z"),r(g,"fill","#8896A4"),r(l,"class","sy-assistant-icon"),r(l,"viewBox","0 0 1024 1024"),r(l,"version","1.1"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"width","32"),r(l,"height","32"),r(l,"fill","currentColor"),r(l,"aria-label","助手图标"),r(o,"class","sy-assistant-floating-button svelte-1427avp"),r(o,"aria-label","打开助手"),r(o,"style",w=s[10]+" z-index: "+(((_=s[3].zIndex)!=null?_:1e3)+1)+";"),r(e,"class","sy-assistant-container sy-assistant-theme svelte-1427avp"),J(e,"fullscreen",s[2]),J(e,"snapped",s[7]),D(e,"position",s[3].position),D(e,"right",s[7]?0:`${s[0]}px`),D(e,"bottom",s[7]?0:`${s[1]}px`),D(e,"top",s[7]||s[2]?"0":"auto"),D(e,"left",s[2]?"0":"auto"),D(e,"z-index",(k=s[3].zIndex)!=null?k:1e3)},m(_,k){G(_,e,k),m(e,t),v&&v.m(t,null),m(e,i),m(e,o),m(o,l),m(l,a),m(l,c),m(l,u),m(l,h),m(l,p),m(l,d),m(l,g),s[27](o),s[29](e),S=!0,M||(z=[U(o,"click",s[15]),U(o,"mousedown",Vn(s[28]))],M=!0)},p(_,k){var T,A;_[12]>0?v?(v.p(_,k),k[0]&4096&&je(v,1)):(v=ei(_),v.c(),je(v,1),v.m(t,null)):v&&(dn(),Ke(v,1,1,()=>{v=null}),gn()),(!S||k[0]&4)&&J(t,"fullscreen",_[2]),k[0]&4096&&n!==(n=`${_[12]}px`)&&D(t,"width",n),(!S||k[0]&1032&&w!==(w=_[10]+" z-index: "+(((T=_[3].zIndex)!=null?T:1e3)+1)+";"))&&r(o,"style",w),(!S||k[0]&4)&&J(e,"fullscreen",_[2]),(!S||k[0]&128)&&J(e,"snapped",_[7]),k[0]&8&&D(e,"position",_[3].position),k[0]&129&&D(e,"right",_[7]?0:`${_[0]}px`),k[0]&130&&D(e,"bottom",_[7]?0:`${_[1]}px`),k[0]&132&&D(e,"top",_[7]||_[2]?"0":"auto"),k[0]&4&&D(e,"left",_[2]?"0":"auto"),k[0]&8&&D(e,"z-index",(A=_[3].zIndex)!=null?A:1e3)},i(_){S||(je(v),S=!0)},o(_){Ke(v),S=!1},d(_){_&&q(e),v&&v.d(),s[27](null),s[29](null),M=!1,me(z)}}}const Fn=48,de=20;function rl(s,e,t){let n,i,o,l,a=B,c=()=>(a(),a=Je(i,N=>t(12,l=N)),i);s.$$.on_destroy.push(()=>a());const u={position:"fixed",width:480,height:600,title:"智慧运维助手",initialState:"default",defaultPosition:{right:de,bottom:de},snappedWidth:480,drawerWidth:480,zIndex:1e3};let{target:h="body"}=e,{options:p={}}=e,d,g=null,w=!1,S,M=!1,z=0,v=0,_=de,k=20,T=_,A=k,b=!1,C=de,I=50,F=!1,R={width:0,height:0,right:0,bottom:0},W=!1,V=!1,Q=[],ae=null;function ge(){return Oe(this,null,function*(){try{const N=yield fetch("/aiops/aigc/chat/getSessionId",{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${be()}`,Authorization:`bearer ${be()}`}});if(!N.ok)throw new Error("Failed to get session ID");const ie=yield N.json();if(ie.code===0)return t(9,ae=ie.data.sessionId),ae;throw new Error(ie.message||"Failed to get session ID")}catch(N){return console.error("Failed to get session ID:",N),null}})}function he(N,ie=!1){ie?t(23,b=!0):t(6,M=!0),z=N.clientX,v=N.clientY,_=ie?C:T,k=ie?I:A,N.preventDefault()}function Ge(N){if(!M&&!b)return;const ie=z-N.clientX,O=v-N.clientY;if(b){const j=_+ie,we=N.clientY;t(24,C=Math.max(de,Math.min(window.innerWidth-Fn-de,j)));const ke=window.innerHeight-Fn-de,Be=Math.max(de,Math.min(ke,we));t(25,I=(window.innerHeight-Be-Fn)/window.innerHeight*100)}else{const j=n.width||0,we=n.height||0,ke=_+ie;t(0,T=Math.max(de,Math.min(window.innerWidth-j-de,ke)));const Ne=k+O;t(1,A=Math.max(de,Math.min(window.innerHeight-we-de,Ne)))}}function ce(){t(6,M=!1),t(23,b=!1)}Qn(()=>{typeof h=="string"?g=document.querySelector(h)||document.body:g=h||document.body;const N=O=>Ge(O),ie=()=>ce();return document.addEventListener("mousemove",N),document.addEventListener("mouseup",ie),d&&g&&g.appendChild(d),S&&S.getBoundingClientRect().left,t(7,W=n.initialState==="snapped"),t(2,F=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,T=0),t(1,A=0),t(3,n=Se(se({},n),{height:typeof window!="undefined"?window.innerHeight:n.height,width:n.snappedWidth||n.width}))):n.initialState==="fullscreen"&&(t(0,T=0),t(1,A=0),t(3,n=Se(se({},n),{width:typeof window!="undefined"?window.innerWidth:n.width,height:typeof window!="undefined"?window.innerHeight:n.height}))),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",ie),g&&d&&g.removeChild(d)}});function Xe(){return Oe(this,null,function*(){w||(yield ge()),t(22,w=!w)})}function ue(){var N,ie,O,j,we,ke,Ne,Be;t(2,F=!F),F?(R.width||(R={width:u.width,height:u.height,right:(ie=(N=u.defaultPosition)==null?void 0:N.right)!=null?ie:de,bottom:(j=(O=u.defaultPosition)==null?void 0:O.bottom)!=null?j:de}),W&&t(7,W=!1),t(20,p=Se(se({},n),{width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth})),t(0,T=0),t(1,A=0)):(t(20,p=Se(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,T=(ke=(we=u.defaultPosition)==null?void 0:we.right)!=null?ke:de),t(1,A=(Be=(Ne=u.defaultPosition)==null?void 0:Ne.bottom)!=null?Be:de))}function $e(N){F||he(N)}function re(){var N,ie,O,j;F&&(t(2,F=!1),t(20,p=Se(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth}))),t(7,W=!W),W?(n.height,t(0,T=0),t(1,A=0),t(20,p=Se(se({},n),{height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width}))):(t(20,p=Se(se({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,T=(ie=(N=u.defaultPosition)==null?void 0:N.right)!=null?ie:de),t(1,A=(j=(O=u.defaultPosition)==null?void 0:O.bottom)!=null?j:de))}function Le(N){t(8,V=!1)}const te=()=>t(8,V=!1);function De(N){mt[N?"unshift":"push"](()=>{S=N,t(5,S)})}const xe=N=>he(N,!0);function et(N){mt[N?"unshift":"push"](()=>{d=N,t(4,d)})}return s.$$set=N=>{"target"in N&&t(21,h=N.target),"options"in N&&t(20,p=N.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n=Se(se(se({},u),p),{defaultPosition:se(se({},u.defaultPosition),p.defaultPosition)})),s.$$.dirty[0]&4194316&&c(t(11,i=Ri(w?F?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window!="undefined"&&(t(0,T=Math.max(de,Math.min(window.innerWidth-(n.width||0),T))),t(1,A=Math.max(de,Math.min(window.innerHeight-(n.height||0),A)))),s.$$.dirty[0]&62914560&&t(10,o=w?"display: none;":`position: fixed; right: ${C}px; bottom: ${I}%; transform: none; cursor: ${b?"grabbing":"grab"};`)},[T,A,F,n,d,S,M,W,V,ae,o,i,l,Q,he,Xe,ue,$e,re,Le,p,h,w,b,C,I,te,De,xe,et]}class al extends kn{constructor(e){super(),wn(this,e,rl,ll,ft,{target:21,options:20},null,[-1,-1])}}K.SyAssistant=al,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});