@sy-design/svelte 1.0.18 → 1.0.20

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,37 +1,37 @@
1
- (function(ee,U){typeof exports=="object"&&typeof module!="undefined"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(ee=typeof globalThis!="undefined"?globalThis:ee||self,U(ee["@sy-design/svelte"]=ee["@sy-design/svelte"]||{}))})(this,function(ee){"use strict";var Hl=Object.defineProperty,Bl=Object.defineProperties;var ql=Object.getOwnPropertyDescriptors;var Mi=Object.getOwnPropertySymbols;var jl=Object.prototype.hasOwnProperty,Ul=Object.prototype.propertyIsEnumerable;var xi=ee=>{throw TypeError(ee)};var Kn=(ee,U,he)=>U in ee?Hl(ee,U,{enumerable:!0,configurable:!0,writable:!0,value:he}):ee[U]=he,re=(ee,U)=>{for(var he in U||(U={}))jl.call(U,he)&&Kn(ee,he,U[he]);if(Mi)for(var he of Mi(U))Ul.call(U,he)&&Kn(ee,he,U[he]);return ee},ve=(ee,U)=>Bl(ee,ql(U));var $=(ee,U,he)=>Kn(ee,typeof U!="symbol"?U+"":U,he),Wl=(ee,U,he)=>U.has(ee)||xi("Cannot "+he);var Ci=(ee,U,he)=>U.has(ee)?xi("Cannot add the same private member more than once"):U instanceof WeakSet?U.add(ee):U.set(ee,he);var _n=(ee,U,he)=>(Wl(ee,U,"access private method"),he);var Ce=(ee,U,he)=>new Promise((Vt,ge)=>{var Mt=Ve=>{try{it(he.next(Ve))}catch(xt){ge(xt)}},gt=Ve=>{try{it(he.throw(Ve))}catch(xt){ge(xt)}},it=Ve=>Ve.done?Vt(Ve.value):Promise.resolve(Ve.value).then(Mt,gt);it((he=he.apply(ee,U)).next())});var pt,$n,Li;function U(){}function he(s){return s()}function Vt(){return Object.create(null)}function ge(s){s.forEach(he)}function Mt(s){return typeof s=="function"}function gt(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}let it;function Ve(s,e){return s===e?!0:(it||(it=document.createElement("a")),it.href=e,s===it.href)}function xt(s){return Object.keys(s).length===0}function zi(s,...e){if(s==null){for(const n of e)n(void 0);return U}const t=s.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const es=typeof window!="undefined";let ts=es?()=>window.performance.now():()=>Date.now(),ns=es?s=>requestAnimationFrame(s):U;const wt=new Set;function ss(s){wt.forEach(e=>{e.c(s)||(wt.delete(e),e.f())}),wt.size!==0&&ns(ss)}function Di(s){let e;return wt.size===0&&ns(ss),{promise:new Promise(t=>{wt.add(e={c:s,f:t})}),abort(){wt.delete(e)}}}function w(s,e){s.appendChild(e)}function q(s,e,t){s.insertBefore(e,t||null)}function B(s){s.parentNode&&s.parentNode.removeChild(s)}function is(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function S(s){return document.createElement(s)}function X(s){return document.createElementNS("http://www.w3.org/2000/svg",s)}function Se(s){return document.createTextNode(s)}function W(){return Se(" ")}function _t(){return Se("")}function Z(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function os(s){return function(e){return e.preventDefault(),s.call(this,e)}}function a(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function Oi(s){return Array.from(s.childNodes)}function Fe(s,e){e=""+e,s.data!==e&&(s.data=e)}function ot(s,e){s.value=e==null?"":e}function N(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}function ls(s,e,t){for(let n=0;n<s.options.length;n+=1){const i=s.options[n];if(i.__value===e){i.selected=!0;return}}(!t||e!==void 0)&&(s.selectedIndex=-1)}function Pi(s){const e=s.querySelector(":checked");return e&&e.__value}function F(s,e,t){s.classList.toggle(e,!!t)}function Ni(s,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(s,{detail:e,bubbles:t,cancelable:n})}class Fi{constructor(e=!1){$(this,"is_svg",!1);$(this,"e");$(this,"n");$(this,"t");$(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=X(t.nodeName):this.e=S(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)q(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(B)}}let Ct;function Lt(s){Ct=s}function Qt(){if(!Ct)throw new Error("Function called outside component initialization");return Ct}function kn(s){Qt().$$.on_mount.push(s)}function Hi(s){Qt().$$.after_update.push(s)}function Bi(s){Qt().$$.on_destroy.push(s)}function qi(){const s=Qt();return(e,t,{cancelable:n=!1}={})=>{const i=s.$$.callbacks[e];if(i){const o=Ni(e,t,{cancelable:n});return i.slice().forEach(l=>{l.call(s,o)}),!o.defaultPrevented}return!0}}const kt=[],zt=[];let bt=[];const rs=[],ji=Promise.resolve();let bn=!1;function Ui(){bn||(bn=!0,ji.then(as))}function Jt(s){bt.push(s)}const yn=new Set;let yt=0;function as(){if(yt!==0)return;const s=Ct;do{try{for(;yt<kt.length;){const e=kt[yt];yt++,Lt(e),Wi(e.$$)}}catch(e){throw kt.length=0,yt=0,e}for(Lt(null),kt.length=0,yt=0;zt.length;)zt.pop()();for(let e=0;e<bt.length;e+=1){const t=bt[e];yn.has(t)||(yn.add(t),t())}bt.length=0}while(kt.length);for(;rs.length;)rs.pop()();bn=!1,yn.clear(),Lt(s)}function Wi(s){if(s.fragment!==null){s.update(),ge(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(Jt)}}function Gi(s){const e=[],t=[];bt.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),bt=e}const Kt=new Set;let ft;function Tn(){ft={r:0,c:[],p:ft}}function vn(){ft.r||ge(ft.c),ft=ft.p}function qe(s,e){s&&s.i&&(Kt.delete(s),s.i(e))}function $e(s,e,t,n){if(s&&s.o){if(Kt.has(s))return;Kt.add(s),ft.c.push(()=>{Kt.delete(s),n&&(t&&s.d(1),n())}),s.o(e)}else n&&n()}function lt(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function cs(s,e){s.d(1),e.delete(s.key)}function us(s,e,t,n,i,o,l,r,c,u,f,p){let d=s.length,m=o.length,g=d;const k={};for(;g--;)k[s[g].key]=g;const I=[],x=new Map,A=new Map,y=[];for(g=m;g--;){const R=p(i,o,g),C=t(R);let L=l.get(C);L?y.push(()=>L.p(R,e)):(L=u(C,R),L.c()),x.set(C,I[g]=L),C in k&&A.set(C,Math.abs(g-k[C]))}const _=new Set,T=new Set;function E(R){qe(R,1),R.m(r,f),l.set(R.key,R),f=R.first,m--}for(;d&&m;){const R=I[m-1],C=s[d-1],L=R.key,Q=C.key;R===C?(f=R.first,d--,m--):x.has(Q)?!l.has(L)||_.has(L)?E(R):T.has(Q)?d--:A.get(L)>A.get(Q)?(T.add(L),E(R)):(_.add(Q),d--):(c(C,l),d--)}for(;d--;){const R=s[d];x.has(R.key)||c(R,l)}for(;m;)E(I[m-1]);return ge(y),I}function Sn(s){s&&s.c()}function $t(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),Jt(()=>{const o=s.$$.on_mount.map(he).filter(Mt);s.$$.on_destroy?s.$$.on_destroy.push(...o):ge(o),s.$$.on_mount=[]}),i.forEach(Jt)}function en(s,e){const t=s.$$;t.fragment!==null&&(Gi(t.after_update),ge(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Zi(s,e){s.$$.dirty[0]===-1&&(kt.push(s),Ui(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function En(s,e,t,n,i,o,l=null,r=[-1]){const c=Ct;Lt(s);const u=s.$$={fragment:null,ctx:[],props:o,update:U,not_equal:i,bound:Vt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Vt(),dirty:r,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let f=!1;if(u.ctx=t?t(s,e.props||{},(p,d,...m)=>{const g=m.length?m[0]:d;return u.ctx&&i(u.ctx[p],u.ctx[p]=g)&&(!u.skip_bound&&u.bound[p]&&u.bound[p](g),f&&Zi(s,p)),d}):[],u.update(),f=!0,ge(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const p=Oi(e.target);u.fragment&&u.fragment.l(p),p.forEach(B)}else u.fragment&&u.fragment.c();e.intro&&qe(s.$$.fragment),$t(s,e.target,e.anchor),as()}Lt(c)}class An{constructor(){$(this,"$$");$(this,"$$set")}$destroy(){en(this,1),this.$destroy=U}$on(e,t){if(!Mt(t))return U;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&&!xt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Yi="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Yi);const Tt=[];function Xi(s,e=U){let t;const n=new Set;function i(r){if(gt(s,r)&&(s=r,t)){const c=!Tt.length;for(const u of n)u[1](),Tt.push(u,s);if(c){for(let u=0;u<Tt.length;u+=2)Tt[u][0](Tt[u+1]);Tt.length=0}}}function o(r){i(r(s))}function l(r,c=U){const u=[r,c];return n.add(u),n.size===1&&(t=e(i,o)||U),r(s),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:i,update:o,subscribe:l}}function fs(s){return Object.prototype.toString.call(s)==="[object Date]"}function In(s,e,t,n){if(typeof t=="number"||fs(t)){const i=n-t,o=(t-e)/(s.dt||1/60),l=s.opts.stiffness*i,r=s.opts.damping*o,c=(l-r)*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,fs(t)?new Date(t.getTime()+u):t+u)}else{if(Array.isArray(t))return t.map((i,o)=>In(s,e[o],t[o],n[o]));if(typeof t=="object"){const i={};for(const o in t)i[o]=In(s,e[o],t[o],n[o]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function Vi(s,e={}){const t=Xi(s),{stiffness:n=.15,damping:i=.8,precision:o=.01}=e;let l,r,c,u=s,f=s,p=1,d=0,m=!1;function g(I,x={}){f=I;const A=c={};return s==null||x.hard||k.stiffness>=1&&k.damping>=1?(m=!0,l=ts(),u=I,t.set(s=f),Promise.resolve()):(x.soft&&(d=1/((x.soft===!0?.5:+x.soft)*60),p=0),r||(l=ts(),m=!1,r=Di(y=>{if(m)return m=!1,r=null,!1;p=Math.min(p+d,1);const _={inv_mass:p,opts:k,settled:!0,dt:(y-l)*60/1e3},T=In(_,u,s,f);return l=y,u=s,t.set(s=T),_.settled&&(r=null),!_.settled})),new Promise(y=>{r.promise.then(()=>{A===c&&y()})}))}const k={set:g,update:(I,x)=>g(I(f,s),x),subscribe:t.subscribe,stiffness:n,damping:i,precision:o};return k}function Qi(s,e){return Ce(this,null,function*(){const t=s.getReader();let n;for(;!(n=yield t.read()).done;)e(n.value)})}function Ji(s){let e,t,n,i=!1;return function(l){e===void 0?(e=l,t=0,n=-1):e=$i(e,l);const r=e.length;let c=0;for(;t<r;){i&&(e[t]===10&&(c=++t),i=!1);let u=-1;for(;t<r&&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===r?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Ki(s,e,t){let n=hs();const i=new TextDecoder;return function(l,r){if(l.length===0)t==null||t(n),n=hs();else if(r>0){const c=i.decode(l.subarray(0,r)),u=r+(l[r+1]===32?2:1),f=i.decode(l.subarray(u));switch(c){case"data":n.data=n.data?n.data+`
2
- `+f:f;break;case"event":n.event=f;break;case"id":s(n.id=f);break;case"retry":const p=parseInt(f,10);isNaN(p)||e(n.retry=p);break}}}}function $i(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function hs(){return{data:"",event:"",id:"",retry:void 0}}var eo=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 Rn="text/event-stream",to=1e3,ds="last-event-id";function no(s,e){var{signal:t,headers:n,onopen:i,onmessage:o,onclose:l,onerror:r,openWhenHidden:c,fetch:u}=e,f=eo(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((p,d)=>{const m=Object.assign({},n);m.accept||(m.accept=Rn);let g;function k(){g.abort(),document.hidden||T()}c||document.addEventListener("visibilitychange",k);let I=to,x=0;function A(){document.removeEventListener("visibilitychange",k),window.clearTimeout(x),g.abort()}t==null||t.addEventListener("abort",()=>{A(),p()});const y=u!=null?u:window.fetch,_=i!=null?i:so;function T(){return Ce(this,null,function*(){var E;g=new AbortController;try{const R=yield y(s,Object.assign(Object.assign({},f),{headers:m,signal:g.signal}));yield _(R),yield Qi(R.body,Ji(Ki(C=>{C?m[ds]=C:delete m[ds]},C=>{I=C},o))),l==null||l(),A(),p()}catch(R){if(!g.signal.aborted)try{const C=(E=r==null?void 0:r(R))!==null&&E!==void 0?E:I;window.clearTimeout(x),x=window.setTimeout(T,C)}catch(C){A(),d(C)}}})}T()})}function so(s){const e=s.headers.get("content-type");if(!(e!=null&&e.startsWith(Rn)))throw new Error(`Expected content-type to be ${Rn}, Actual: ${e}`)}function Mn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ht=Mn();function ps(s){ht=s}const ms=/[&<>"']/,io=new RegExp(ms.source,"g"),gs=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,oo=new RegExp(gs.source,"g"),lo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ws=s=>lo[s];function He(s,e){if(e){if(ms.test(s))return s.replace(io,ws)}else if(gs.test(s))return s.replace(oo,ws);return s}const ro=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ao(s){return s.replace(ro,(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 co=/(^|[^\[])\^/g;function ae(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(co,"$1"),t=t.replace(i,l),n},getRegex:()=>new RegExp(t,e)};return n}function _s(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch(e){return null}return s}const Dt={exec:()=>null};function ks(s,e){const t=s.replace(/\|/g,(o,l,r)=>{let c=!1,u=l;for(;--u>=0&&r[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 tn(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n&&s.charAt(n-i-1)===e;)i++;return s.slice(0,n-i)}function uo(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 bs(s,e,t,n){const i=e.href,o=e.title?He(e.title):null,l=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const r={type:"link",raw:t,href:i,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,r}return{type:"image",raw:t,href:i,title:o,text:He(l)}}function fo(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
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 nn{constructor(e){$(this,"options");$(this,"rules");$(this,"lexer");this.options=e||ht}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:tn(n,`
5
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=fo(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=tn(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=tn(t[0].replace(/^ *>[ \t]?/gm,""),`
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 r="",c="",u=!1;for(;e;){let f=!1;if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let p=t[2].split(`
7
- `,1)[0].replace(/^\t+/,x=>" ".repeat(3*x.length)),d=e.split(`
8
- `,1)[0],m=0;this.options.pedantic?(m=2,c=p.trimStart()):(m=t[2].search(/[^ ]/),m=m>4?1:m,c=p.slice(m),m+=t[1].length);let g=!1;if(!p&&/^ *$/.test(d)&&(r+=d+`
9
- `,e=e.substring(d.length+1),f=!0),!f){const x=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),A=new RegExp(`^ {0,${Math.min(3,m-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),y=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:\`\`\`|~~~)`),_=new RegExp(`^ {0,${Math.min(3,m-1)}}#`);for(;e;){const T=e.split(`
10
- `,1)[0];if(d=T,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),y.test(d)||_.test(d)||x.test(d)||A.test(e))break;if(d.search(/[^ ]/)>=m||!d.trim())c+=`
11
- `+d.slice(m);else{if(g||p.search(/[^ ]/)>=4||y.test(p)||_.test(p)||A.test(p))break;c+=`
12
- `+d}!g&&!d.trim()&&(g=!0),r+=T+`
13
- `,e=e.substring(T.length+1),p=d.slice(m)}}o.loose||(u?o.loose=!0:/\n *\n *$/.test(r)&&(u=!0));let k=null,I;this.options.gfm&&(k=/^\[[ xX]\] /.exec(c),k&&(I=k[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:r,task:!!k,checked:I,loose:!1,text:c,tokens:[]}),o.raw+=r}o.items[o.items.length-1].raw=r.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let f=0;f<o.items.length;f++)if(this.lexer.state.top=!1,o.items[f].tokens=this.lexer.blockTokens(o.items[f].text,[]),!o.loose){const p=o.items[f].tokens.filter(m=>m.type==="space"),d=p.length>0&&p.some(m=>/\n.*\n/.test(m.raw));o.loose=d}if(o.loose)for(let f=0;f<o.items.length;f++)o.items[f].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=ks(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
- `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const r of i)/^ *-+: *$/.test(r)?l.align.push("right"):/^ *:-+: *$/.test(r)?l.align.push("center"):/^ *:-+ *$/.test(r)?l.align.push("left"):l.align.push(null);for(const r of n)l.header.push({text:r,tokens:this.lexer.inline(r)});for(const r of o)l.rows.push(ks(r,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:He(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=tn(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=uo(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)),bs(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 bs(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 r,c,u=l,f=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(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(c=[...r].length,i[3]||i[4]){u+=c;continue}else if((i[5]||i[6])&&l%3&&!((l+c)%3)){f+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u+f);const d=[...i[0]][0].length,m=e.slice(0,l+i.index+d+c);if(Math.min(l,c)%2){const k=m.slice(1,-1);return{type:"em",raw:m,text:k,tokens:this.lexer.inlineTokens(k)}}const g=m.slice(2,-2);return{type:"strong",raw:m,text:g,tokens:this.lexer.inlineTokens(g)}}}}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=He(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=He(t[1]),i="mailto:"+n):(n=He(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=He(t[0]),l="mailto:"+o;else{let r;do r=t[0],t[0]=(i=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?i:"";while(r!==t[0]);o=He(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=He(t[0]),{type:"text",raw:t[0],text:n}}}}const ho=/^(?: *(?:\n|$))+/,po=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,mo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ot=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,go=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ys=/(?:[*+-]|\d{1,9}[.)])/,Ts=ae(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ys).getRegex(),xn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wo=/^[^\n]+/,Cn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,_o=ae(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Cn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ko=ae(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ys).getRegex(),sn="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",Ln=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,bo=ae("^ {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",Ln).replace("tag",sn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vs=ae(xn).replace("hr",Ot).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",sn).getRegex(),zn={blockquote:ae(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",vs).getRegex(),code:po,def:_o,fences:mo,heading:go,hr:Ot,html:bo,lheading:Ts,list:ko,newline:ho,paragraph:vs,table:Dt,text:wo},Ss=ae("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ot).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",sn).getRegex(),yo=ve(re({},zn),{table:Ss,paragraph:ae(xn).replace("hr",Ot).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ss).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",sn).getRegex()}),To=ve(re({},zn),{html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ln).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:Dt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ae(xn).replace("hr",Ot).replace("heading",` *#{1,6} *[^
16
- ]`).replace("lheading",Ts).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Es=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,As=/^( {2,}|\\)\n(?!\s*$)/,So=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pt="\\p{P}$+<=>`^|~",Eo=ae(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Pt).getRegex(),Ao=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Io=ae(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Pt).getRegex(),Ro=ae("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Pt).getRegex(),Mo=ae("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Pt).getRegex(),xo=ae(/\\([punct])/,"gu").replace(/punct/g,Pt).getRegex(),Co=ae(/^<(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(),Lo=ae(Ln).replace("(?:-->|$)","-->").getRegex(),zo=ae("^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",Lo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),on=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Do=ae(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",on).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Is=ae(/^!?\[(label)\]\[(ref)\]/).replace("label",on).replace("ref",Cn).getRegex(),Rs=ae(/^!?\[(ref)\](?:\[\])?/).replace("ref",Cn).getRegex(),Oo=ae("reflink|nolink(?!\\()","g").replace("reflink",Is).replace("nolink",Rs).getRegex(),Dn={_backpedal:Dt,anyPunctuation:xo,autolink:Co,blockSkip:Ao,br:As,code:vo,del:Dt,emStrongLDelim:Io,emStrongRDelimAst:Ro,emStrongRDelimUnd:Mo,escape:Es,link:Do,nolink:Rs,punctuation:Eo,reflink:Is,reflinkSearch:Oo,tag:zo,text:So,url:Dt},Po=ve(re({},Dn),{link:ae(/^!?\[(label)\]\((.*?)\)/).replace("label",on).getRegex(),reflink:ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",on).getRegex()}),On=ve(re({},Dn),{escape:ae(Es).replace("])","~|])").getRegex(),url:ae(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),No=ve(re({},On),{br:ae(As).replace("{2,}","*").getRegex(),text:ae(On.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),ln={normal:zn,gfm:yo,pedantic:To},Nt={normal:Dn,gfm:On,breaks:No,pedantic:Po};class Qe{constructor(e){$(this,"tokens");$(this,"options");$(this,"state");$(this,"tokenizer");$(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ht,this.options.tokenizer=this.options.tokenizer||new nn,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:ln.normal,inline:Nt.normal};this.options.pedantic?(t.block=ln.pedantic,t.inline=Nt.pedantic):this.options.gfm&&(t.block=ln.gfm,this.options.breaks?t.inline=Nt.breaks:t.inline=Nt.gfm),this.tokenizer.rules=t}static get rules(){return{block:ln,inline:Nt}}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,`
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,(r,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(r=>(n=r.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
- `: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
- `+n.raw,i.text+=`
20
- `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
21
- `+n.raw,i.text+=`
22
- `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let r=1/0;const c=e.slice(1);let u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),typeof u=="number"&&u>=0&&(r=Math.min(r,u))}),r<1/0&&r>=0&&(o=e.substring(0,r+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){i=t[t.length-1],l&&i.type==="paragraph"?(i.raw+=`
23
- `+n.raw,i.text+=`
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
- `+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 r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}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,r,c,u;if(this.tokens.links){const f=Object.keys(this.tokens.links);if(f.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)f.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,r.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(f=>(n=f.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 f=1/0;const p=e.slice(1);let d;this.options.extensions.startInline.forEach(m=>{d=m.call({lexer:this},p),typeof d=="number"&&d>=0&&(f=Math.min(f,d))}),f<1/0&&f>=0&&(o=e.substring(0,f+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 f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return t}}class rn{constructor(e){$(this,"options");this.options=e||ht}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-'+He(i)+'">'+(n?e:He(e,!0))+`</code></pre>
28
- `:"<pre><code>"+(n?e:He(e,!0))+`</code></pre>
1
+ (function(ie,j){typeof exports=="object"&&typeof module!="undefined"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(ie=typeof globalThis!="undefined"?globalThis:ie||self,j(ie["@sy-design/svelte"]=ie["@sy-design/svelte"]||{}))})(this,function(ie){"use strict";var Hl=Object.defineProperty,ql=Object.defineProperties;var Bl=Object.getOwnPropertyDescriptors;var Cs=Object.getOwnPropertySymbols;var jl=Object.prototype.hasOwnProperty,Ul=Object.prototype.propertyIsEnumerable;var Ls=ie=>{throw TypeError(ie)};var Jn=(ie,j,he)=>j in ie?Hl(ie,j,{enumerable:!0,configurable:!0,writable:!0,value:he}):ie[j]=he,ue=(ie,j)=>{for(var he in j||(j={}))jl.call(j,he)&&Jn(ie,he,j[he]);if(Cs)for(var he of Cs(j))Ul.call(j,he)&&Jn(ie,he,j[he]);return ie},Re=(ie,j)=>ql(ie,Bl(j));var ne=(ie,j,he)=>Jn(ie,typeof j!="symbol"?j+"":j,he),Wl=(ie,j,he)=>j.has(ie)||Ls("Cannot "+he);var xs=(ie,j,he)=>j.has(ie)?Ls("Cannot add the same private member more than once"):j instanceof WeakSet?j.add(ie):j.set(ie,he);var bn=(ie,j,he)=>(Wl(ie,j,"access private method"),he);var Pe=(ie,j,he)=>new Promise((nn,be)=>{var Ft=nt=>{try{gt(he.next(nt))}catch(Nt){be(Nt)}},It=nt=>{try{gt(he.throw(nt))}catch(Nt){be(Nt)}},gt=nt=>nt.done?nn(nt.value):Promise.resolve(nt.value).then(Ft,It);gt((he=he.apply(ie,j)).next())});var Et,Kn,zs;function j(){}function he(i){return i()}function nn(){return Object.create(null)}function be(i){i.forEach(he)}function Ft(i){return typeof i=="function"}function It(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let gt;function nt(i,e){return i===e?!0:(gt||(gt=document.createElement("a")),gt.href=e,i===gt.href)}function Nt(i){return Object.keys(i).length===0}function Ds(i,...e){if(i==null){for(const n of e)n(void 0);return j}const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}const $n=typeof window!="undefined";let ei=$n?()=>window.performance.now():()=>Date.now(),ti=$n?i=>requestAnimationFrame(i):j;const Rt=new Set;function ni(i){Rt.forEach(e=>{e.c(i)||(Rt.delete(e),e.f())}),Rt.size!==0&&ti(ni)}function Os(i){let e;return Rt.size===0&&ti(ni),{promise:new Promise(t=>{Rt.add(e={c:i,f:t})}),abort(){Rt.delete(e)}}}function w(i,e){i.appendChild(e)}function q(i,e,t){i.insertBefore(e,t||null)}function H(i){i.parentNode&&i.parentNode.removeChild(i)}function ii(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function v(i){return document.createElement(i)}function V(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Me(i){return document.createTextNode(i)}function G(){return Me(" ")}function Mt(){return Me("")}function W(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function si(i){return function(e){return e.preventDefault(),i.call(this,e)}}function a(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function Ps(i){return Array.from(i.childNodes)}function Ge(i,e){e=""+e,i.data!==e&&(i.data=e)}function wt(i,e){i.value=e==null?"":e}function F(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function oi(i,e,t){for(let n=0;n<i.options.length;n+=1){const s=i.options[n];if(s.__value===e){s.selected=!0;return}}(!t||e!==void 0)&&(i.selectedIndex=-1)}function Fs(i){const e=i.querySelector(":checked");return e&&e.__value}function D(i,e,t){i.classList.toggle(e,!!t)}function Ns(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}class Hs{constructor(e=!1){ne(this,"is_svg",!1);ne(this,"e");ne(this,"n");ne(this,"t");ne(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=V(t.nodeName):this.e=v(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)q(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(H)}}let Ht;function qt(i){Ht=i}function sn(){if(!Ht)throw new Error("Function called outside component initialization");return Ht}function kn(i){sn().$$.on_mount.push(i)}function qs(i){sn().$$.after_update.push(i)}function Bs(i){sn().$$.on_destroy.push(i)}function li(){const i=sn();return(e,t,{cancelable:n=!1}={})=>{const s=i.$$.callbacks[e];if(s){const o=Ns(e,t,{cancelable:n});return s.slice().forEach(l=>{l.call(i,o)}),!o.defaultPrevented}return!0}}const Ct=[],Bt=[];let Lt=[];const ri=[],js=Promise.resolve();let yn=!1;function Us(){yn||(yn=!0,js.then(ai))}function on(i){Lt.push(i)}const Tn=new Set;let xt=0;function ai(){if(xt!==0)return;const i=Ht;do{try{for(;xt<Ct.length;){const e=Ct[xt];xt++,qt(e),Ws(e.$$)}}catch(e){throw Ct.length=0,xt=0,e}for(qt(null),Ct.length=0,xt=0;Bt.length;)Bt.pop()();for(let e=0;e<Lt.length;e+=1){const t=Lt[e];Tn.has(t)||(Tn.add(t),t())}Lt.length=0}while(Ct.length);for(;ri.length;)ri.pop()();yn=!1,Tn.clear(),qt(i)}function Ws(i){if(i.fragment!==null){i.update(),be(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(on)}}function Gs(i){const e=[],t=[];Lt.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Lt=e}const ln=new Set;let Tt;function vn(){Tt={r:0,c:[],p:Tt}}function Sn(){Tt.r||be(Tt.c),Tt=Tt.p}function Ve(i,e){i&&i.i&&(ln.delete(i),i.i(e))}function ut(i,e,t,n){if(i&&i.o){if(ln.has(i))return;ln.add(i),Tt.c.push(()=>{ln.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function _t(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function ci(i,e){i.d(1),e.delete(i.key)}function ui(i,e,t,n,s,o,l,r,c,f,u,m){let d=i.length,p=o.length,g=d;const _={};for(;g--;)_[i[g].key]=g;const I=[],M=new Map,R=new Map,y=[];for(g=p;g--;){const S=m(s,o,g),C=t(S);let L=l.get(C);L?y.push(()=>L.p(S,e)):(L=f(C,S),L.c()),M.set(C,I[g]=L),C in _&&R.set(C,Math.abs(g-_[C]))}const b=new Set,E=new Set;function A(S){Ve(S,1),S.m(r,u),l.set(S.key,S),u=S.first,p--}for(;d&&p;){const S=I[p-1],C=i[d-1],L=S.key,ee=C.key;S===C?(u=S.first,d--,p--):M.has(ee)?!l.has(L)||b.has(L)?A(S):E.has(ee)?d--:R.get(L)>R.get(ee)?(E.add(L),A(S)):(b.add(ee),d--):(c(C,l),d--)}for(;d--;){const S=i[d];M.has(S.key)||c(S,l)}for(;p;)A(I[p-1]);return be(y),I}function En(i){i&&i.c()}function rn(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),on(()=>{const o=i.$$.on_mount.map(he).filter(Ft);i.$$.on_destroy?i.$$.on_destroy.push(...o):be(o),i.$$.on_mount=[]}),s.forEach(on)}function an(i,e){const t=i.$$;t.fragment!==null&&(Gs(t.after_update),be(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Zs(i,e){i.$$.dirty[0]===-1&&(Ct.push(i),Us(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function An(i,e,t,n,s,o,l=null,r=[-1]){const c=Ht;qt(i);const f=i.$$={fragment:null,ctx:[],props:o,update:j,not_equal:s,bound:nn(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:nn(),dirty:r,skip_bound:!1,root:e.target||c.$$.root};l&&l(f.root);let u=!1;if(f.ctx=t?t(i,e.props||{},(m,d,...p)=>{const g=p.length?p[0]:d;return f.ctx&&s(f.ctx[m],f.ctx[m]=g)&&(!f.skip_bound&&f.bound[m]&&f.bound[m](g),u&&Zs(i,m)),d}):[],f.update(),u=!0,be(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const m=Ps(e.target);f.fragment&&f.fragment.l(m),m.forEach(H)}else f.fragment&&f.fragment.c();e.intro&&Ve(i.$$.fragment),rn(i,e.target,e.anchor),ai()}qt(c)}class In{constructor(){ne(this,"$$");ne(this,"$$set")}$destroy(){an(this,1),this.$destroy=j}$on(e,t){if(!Ft(t))return j;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!Nt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ys="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ys);const zt=[];function Xs(i,e=j){let t;const n=new Set;function s(r){if(It(i,r)&&(i=r,t)){const c=!zt.length;for(const f of n)f[1](),zt.push(f,i);if(c){for(let f=0;f<zt.length;f+=2)zt[f][0](zt[f+1]);zt.length=0}}}function o(r){s(r(i))}function l(r,c=j){const f=[r,c];return n.add(f),n.size===1&&(t=e(s,o)||j),r(i),()=>{n.delete(f),n.size===0&&t&&(t(),t=null)}}return{set:s,update:o,subscribe:l}}function fi(i){return Object.prototype.toString.call(i)==="[object Date]"}function Rn(i,e,t,n){if(typeof t=="number"||fi(t)){const s=n-t,o=(t-e)/(i.dt||1/60),l=i.opts.stiffness*s,r=i.opts.damping*o,c=(l-r)*i.inv_mass,f=(o+c)*i.dt;return Math.abs(f)<i.opts.precision&&Math.abs(s)<i.opts.precision?n:(i.settled=!1,fi(t)?new Date(t.getTime()+f):t+f)}else{if(Array.isArray(t))return t.map((s,o)=>Rn(i,e[o],t[o],n[o]));if(typeof t=="object"){const s={};for(const o in t)s[o]=Rn(i,e[o],t[o],n[o]);return s}else throw new Error(`Cannot spring ${typeof t} values`)}}function Vs(i,e={}){const t=Xs(i),{stiffness:n=.15,damping:s=.8,precision:o=.01}=e;let l,r,c,f=i,u=i,m=1,d=0,p=!1;function g(I,M={}){u=I;const R=c={};return i==null||M.hard||_.stiffness>=1&&_.damping>=1?(p=!0,l=ei(),f=I,t.set(i=u),Promise.resolve()):(M.soft&&(d=1/((M.soft===!0?.5:+M.soft)*60),m=0),r||(l=ei(),p=!1,r=Os(y=>{if(p)return p=!1,r=null,!1;m=Math.min(m+d,1);const b={inv_mass:m,opts:_,settled:!0,dt:(y-l)*60/1e3},E=Rn(b,f,i,u);return l=y,f=i,t.set(i=E),b.settled&&(r=null),!b.settled})),new Promise(y=>{r.promise.then(()=>{R===c&&y()})}))}const _={set:g,update:(I,M)=>g(I(u,i),M),subscribe:t.subscribe,stiffness:n,damping:s,precision:o};return _}function Qs(i,e){return Pe(this,null,function*(){const t=i.getReader();let n;for(;!(n=yield t.read()).done;)e(n.value)})}function Js(i){let e,t,n,s=!1;return function(l){e===void 0?(e=l,t=0,n=-1):e=$s(e,l);const r=e.length;let c=0;for(;t<r;){s&&(e[t]===10&&(c=++t),s=!1);let f=-1;for(;t<r&&f===-1;++t)switch(e[t]){case 58:n===-1&&(n=t-c);break;case 13:s=!0;case 10:f=t;break}if(f===-1)break;i(e.subarray(c,f),n),c=t,n=-1}c===r?e=void 0:c!==0&&(e=e.subarray(c),t-=c)}}function Ks(i,e,t){let n=hi();const s=new TextDecoder;return function(l,r){if(l.length===0)t==null||t(n),n=hi();else if(r>0){const c=s.decode(l.subarray(0,r)),f=r+(l[r+1]===32?2:1),u=s.decode(l.subarray(f));switch(c){case"data":n.data=n.data?n.data+`
2
+ `+u:u;break;case"event":n.event=u;break;case"id":i(n.id=u);break;case"retry":const m=parseInt(u,10);isNaN(m)||e(n.retry=m);break}}}}function $s(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function hi(){return{data:"",event:"",id:"",retry:void 0}}var eo=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(t[n[s]]=i[n[s]]);return t};const Mn="text/event-stream",to=1e3,di="last-event-id";function no(i,e){var{signal:t,headers:n,onopen:s,onmessage:o,onclose:l,onerror:r,openWhenHidden:c,fetch:f}=e,u=eo(e,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((m,d)=>{const p=Object.assign({},n);p.accept||(p.accept=Mn);let g;function _(){g.abort(),document.hidden||E()}c||document.addEventListener("visibilitychange",_);let I=to,M=0;function R(){document.removeEventListener("visibilitychange",_),window.clearTimeout(M),g.abort()}t==null||t.addEventListener("abort",()=>{R(),m()});const y=f!=null?f:window.fetch,b=s!=null?s:io;function E(){return Pe(this,null,function*(){var A;g=new AbortController;try{const S=yield y(i,Object.assign(Object.assign({},u),{headers:p,signal:g.signal}));yield b(S),yield Qs(S.body,Js(Ks(C=>{C?p[di]=C:delete p[di]},C=>{I=C},o))),l==null||l(),R(),m()}catch(S){if(!g.signal.aborted)try{const C=(A=r==null?void 0:r(S))!==null&&A!==void 0?A:I;window.clearTimeout(M),M=window.setTimeout(E,C)}catch(C){R(),d(C)}}})}E()})}function io(i){const e=i.headers.get("content-type");if(!(e!=null&&e.startsWith(Mn)))throw new Error(`Expected content-type to be ${Mn}, Actual: ${e}`)}function Cn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let vt=Cn();function pi(i){vt=i}const mi=/[&<>"']/,so=new RegExp(mi.source,"g"),gi=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,oo=new RegExp(gi.source,"g"),lo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},wi=i=>lo[i];function Ze(i,e){if(e){if(mi.test(i))return i.replace(so,wi)}else if(gi.test(i))return i.replace(oo,wi);return i}const ro=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ao(i){return i.replace(ro,(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 co=/(^|[^\[])\^/g;function fe(i,e){let t=typeof i=="string"?i:i.source;e=e||"";const n={replace:(s,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(co,"$1"),t=t.replace(s,l),n},getRegex:()=>new RegExp(t,e)};return n}function _i(i){try{i=encodeURI(i).replace(/%25/g,"%")}catch(e){return null}return i}const jt={exec:()=>null};function bi(i,e){const t=i.replace(/\|/g,(o,l,r)=>{let c=!1,f=l;for(;--f>=0&&r[f]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let s=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(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function cn(i,e,t){const n=i.length;if(n===0)return"";let s=0;for(;s<n&&i.charAt(n-s-1)===e;)s++;return i.slice(0,n-s)}function uo(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===e[0])t++;else if(i[n]===e[1]&&(t--,t<0))return n;return-1}function ki(i,e,t,n){const s=e.href,o=e.title?Ze(e.title):null,l=i[1].replace(/\\([\[\]])/g,"$1");if(i[0].charAt(0)!=="!"){n.state.inLink=!0;const r={type:"link",raw:t,href:s,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,r}return{type:"image",raw:t,href:s,title:o,text:Ze(l)}}function fo(i,e){const t=i.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
3
+ `).map(s=>{const o=s.match(/^\s+/);if(o===null)return s;const[l]=o;return l.length>=n.length?s.slice(n.length):s}).join(`
4
+ `)}class un{constructor(e){ne(this,"options");ne(this,"rules");ne(this,"lexer");this.options=e||vt}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:cn(n,`
5
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=fo(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const s=cn(n,"#");(this.options.pedantic||!s||/ $/.test(s))&&(n=s.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=cn(t[0].replace(/^ *>[ \t]?/gm,""),`
6
+ `),s=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(n);return this.lexer.state.top=s,{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 s=n.length>1,o={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const l=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let r="",c="",f=!1;for(;e;){let u=!1;if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let m=t[2].split(`
7
+ `,1)[0].replace(/^\t+/,M=>" ".repeat(3*M.length)),d=e.split(`
8
+ `,1)[0],p=0;this.options.pedantic?(p=2,c=m.trimStart()):(p=t[2].search(/[^ ]/),p=p>4?1:p,c=m.slice(p),p+=t[1].length);let g=!1;if(!m&&/^ *$/.test(d)&&(r+=d+`
9
+ `,e=e.substring(d.length+1),u=!0),!u){const M=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),R=new RegExp(`^ {0,${Math.min(3,p-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),y=new RegExp(`^ {0,${Math.min(3,p-1)}}(?:\`\`\`|~~~)`),b=new RegExp(`^ {0,${Math.min(3,p-1)}}#`);for(;e;){const E=e.split(`
10
+ `,1)[0];if(d=E,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),y.test(d)||b.test(d)||M.test(d)||R.test(e))break;if(d.search(/[^ ]/)>=p||!d.trim())c+=`
11
+ `+d.slice(p);else{if(g||m.search(/[^ ]/)>=4||y.test(m)||b.test(m)||R.test(m))break;c+=`
12
+ `+d}!g&&!d.trim()&&(g=!0),r+=E+`
13
+ `,e=e.substring(E.length+1),m=d.slice(p)}}o.loose||(f?o.loose=!0:/\n *\n *$/.test(r)&&(f=!0));let _=null,I;this.options.gfm&&(_=/^\[[ xX]\] /.exec(c),_&&(I=_[0]!=="[ ] ",c=c.replace(/^\[[ xX]\] +/,""))),o.items.push({type:"list_item",raw:r,task:!!_,checked:I,loose:!1,text:c,tokens:[]}),o.raw+=r}o.items[o.items.length-1].raw=r.trimEnd(),o.items[o.items.length-1].text=c.trimEnd(),o.raw=o.raw.trimEnd();for(let u=0;u<o.items.length;u++)if(this.lexer.state.top=!1,o.items[u].tokens=this.lexer.blockTokens(o.items[u].text,[]),!o.loose){const m=o.items[u].tokens.filter(p=>p.type==="space"),d=m.length>0&&m.some(p=>/\n.*\n/.test(p.raw));o.loose=d}if(o.loose)for(let u=0;u<o.items.length;u++)o.items[u].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," "),s=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:s,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=bi(t[1]),s=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
+ `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const r of s)/^ *-+: *$/.test(r)?l.align.push("right"):/^ *:-+: *$/.test(r)?l.align.push("center"):/^ *:-+ *$/.test(r)?l.align.push("left"):l.align.push(null);for(const r of n)l.header.push({text:r,tokens:this.lexer.inline(r)});for(const r of o)l.rows.push(bi(r,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:Ze(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=cn(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=uo(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 s=t[2],o="";if(this.options.pedantic){const l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);l&&(s=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(this.options.pedantic&&!/>$/.test(n)?s=s.slice(1):s=s.slice(1,-1)),ki(t,{href:s&&s.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 s=(n[2]||n[1]).replace(/\s+/g," "),o=t[s.toLowerCase()];if(!o){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return ki(n,o,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...s[0]].length-1;let r,c,f=l,u=0;const m=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+l);(s=m.exec(t))!=null;){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(c=[...r].length,s[3]||s[4]){f+=c;continue}else if((s[5]||s[6])&&l%3&&!((l+c)%3)){u+=c;continue}if(f-=c,f>0)continue;c=Math.min(c,c+f+u);const d=[...s[0]][0].length,p=e.slice(0,l+s.index+d+c);if(Math.min(l,c)%2){const _=p.slice(1,-1);return{type:"em",raw:p,text:_,tokens:this.lexer.inlineTokens(_)}}const g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const s=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return s&&o&&(n=n.substring(1,n.length-1)),n=Ze(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,s;return t[2]==="@"?(n=Ze(t[1]),s="mailto:"+n):(n=Ze(t[1]),s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,s;let t;if(t=this.rules.inline.url.exec(e)){let o,l;if(t[2]==="@")o=Ze(t[0]),l="mailto:"+o;else{let r;do r=t[0],t[0]=(s=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?s:"";while(r!==t[0]);o=Ze(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=Ze(t[0]),{type:"text",raw:t[0],text:n}}}}const ho=/^(?: *(?:\n|$))+/,po=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,mo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ut=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,go=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yi=/(?:[*+-]|\d{1,9}[.)])/,Ti=fe(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,yi).getRegex(),Ln=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wo=/^[^\n]+/,xn=/(?!\s*\])(?:\\.|[^\[\]\\])+/,_o=fe(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",xn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),bo=fe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yi).getRegex(),fn="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",zn=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,ko=fe("^ {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",zn).replace("tag",fn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vi=fe(Ln).replace("hr",Ut).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",fn).getRegex(),Dn={blockquote:fe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",vi).getRegex(),code:po,def:_o,fences:mo,heading:go,hr:Ut,html:ko,lheading:Ti,list:bo,newline:ho,paragraph:vi,table:jt,text:wo},Si=fe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ut).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",fn).getRegex(),yo=Re(ue({},Dn),{table:Si,paragraph:fe(Ln).replace("hr",Ut).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Si).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",fn).getRegex()}),To=Re(ue({},Dn),{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",zn).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:jt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:fe(Ln).replace("hr",Ut).replace("heading",` *#{1,6} *[^
16
+ ]`).replace("lheading",Ti).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Ei=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ai=/^( {2,}|\\)\n(?!\s*$)/,So=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Wt="\\p{P}$+<=>`^|~",Eo=fe(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Wt).getRegex(),Ao=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Io=fe(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Wt).getRegex(),Ro=fe("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Wt).getRegex(),Mo=fe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Wt).getRegex(),Co=fe(/\\([punct])/,"gu").replace(/punct/g,Wt).getRegex(),Lo=fe(/^<(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(),xo=fe(zn).replace("(?:-->|$)","-->").getRegex(),zo=fe("^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",xo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hn=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Do=fe(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",hn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ii=fe(/^!?\[(label)\]\[(ref)\]/).replace("label",hn).replace("ref",xn).getRegex(),Ri=fe(/^!?\[(ref)\](?:\[\])?/).replace("ref",xn).getRegex(),Oo=fe("reflink|nolink(?!\\()","g").replace("reflink",Ii).replace("nolink",Ri).getRegex(),On={_backpedal:jt,anyPunctuation:Co,autolink:Lo,blockSkip:Ao,br:Ai,code:vo,del:jt,emStrongLDelim:Io,emStrongRDelimAst:Ro,emStrongRDelimUnd:Mo,escape:Ei,link:Do,nolink:Ri,punctuation:Eo,reflink:Ii,reflinkSearch:Oo,tag:zo,text:So,url:jt},Po=Re(ue({},On),{link:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",hn).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",hn).getRegex()}),Pn=Re(ue({},On),{escape:fe(Ei).replace("])","~|])").getRegex(),url:fe(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Fo=Re(ue({},Pn),{br:fe(Ai).replace("{2,}","*").getRegex(),text:fe(Pn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),dn={normal:Dn,gfm:yo,pedantic:To},Gt={normal:On,gfm:Pn,breaks:Fo,pedantic:Po};class it{constructor(e){ne(this,"tokens");ne(this,"options");ne(this,"state");ne(this,"tokenizer");ne(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||vt,this.options.tokenizer=this.options.tokenizer||new un,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:dn.normal,inline:Gt.normal};this.options.pedantic?(t.block=dn.pedantic,t.inline=Gt.pedantic):this.options.gfm&&(t.block=dn.gfm,this.options.breaks?t.inline=Gt.breaks:t.inline=Gt.gfm),this.tokenizer.rules=t}static get rules(){return{block:dn,inline:Gt}}static lex(e,t){return new it(t).lex(e)}static lexInline(e,t){return new it(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
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,(r,c,f)=>c+" ".repeat(f.length));let n,s,o,l;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(n=r.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
+ `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
19
+ `+n.raw,s.text+=`
20
+ `+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
21
+ `+n.raw,s.text+=`
22
+ `+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let r=1/0;const c=e.slice(1);let f;this.options.extensions.startBlock.forEach(u=>{f=u.call({lexer:this},c),typeof f=="number"&&f>=0&&(r=Math.min(r,f))}),r<1/0&&r>=0&&(o=e.substring(0,r+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){s=t[t.length-1],l&&s.type==="paragraph"?(s.raw+=`
23
+ `+n.raw,s.text+=`
24
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.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),s=t[t.length-1],s&&s.type==="text"?(s.raw+=`
25
+ `+n.raw,s.text+=`
26
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(e){const r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,o,l=e,r,c,f;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(l))!=null;)u.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(l))!=null;)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(l))!=null;)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(c||(f=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(n=u.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),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.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),s=t[t.length-1],s&&n.type==="text"&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,l,f)){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 u=1/0;const m=e.slice(1);let d;this.options.extensions.startInline.forEach(p=>{d=p.call({lexer:this},m),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(o=e.substring(0,u+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(f=n.raw.slice(-1)),c=!0,s=t[t.length-1],s&&s.type==="text"?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class pn{constructor(e){ne(this,"options");this.options=e||vt}code(e,t,n){var o;const s=(o=(t||"").match(/^\S*/))==null?void 0:o[0];return e=e.replace(/\n$/,"")+`
27
+ `,s?'<pre><code class="language-'+Ze(s)+'">'+(n?e:Ze(e,!0))+`</code></pre>
28
+ `:"<pre><code>"+(n?e:Ze(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}>
32
32
  `}hr(){return`<hr>
33
- `}list(e,t,n){const i=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+i+o+`>
34
- `+e+"</"+i+`>
33
+ `}list(e,t,n){const s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
34
+ `+e+"</"+s+`>
35
35
  `}listitem(e,t,n){return`<li>${e}</li>
36
36
  `}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
37
37
  `}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
@@ -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=_s(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=_s(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 Pn{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 Je{constructor(e){$(this,"options");$(this,"renderer");$(this,"textRenderer");this.options=e||ht,this.options.renderer=this.options.renderer||new rn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pn}static parse(e,t){return new Je(t).parse(e)}static parseInline(e,t){return new Je(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,r=this.options.extensions.renderers[l.type].call({parser:this},l);if(r!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=r||"";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,ao(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 r="",c="";for(let f=0;f<l.header.length;f++)c+=this.renderer.tablecell(this.parseInline(l.header[f].tokens),{header:!0,align:l.align[f]});r+=this.renderer.tablerow(c);let u="";for(let f=0;f<l.rows.length;f++){const p=l.rows[f];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(r,u);continue}case"blockquote":{const l=o,r=this.parse(l.tokens);n+=this.renderer.blockquote(r);continue}case"list":{const l=o,r=l.ordered,c=l.start,u=l.loose;let f="";for(let p=0;p<l.items.length;p++){const d=l.items[p],m=d.checked,g=d.task;let k="";if(d.task){const I=this.renderer.checkbox(!!m);u?d.tokens.length>0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=I+" "+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=I+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:I+" "}):k+=I+" "}k+=this.parse(d.tokens,u),f+=this.renderer.listitem(k,g,!!m)}n+=this.renderer.list(f,r,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,r=l.tokens?this.parseInline(l.tokens):l.text;for(;i+1<e.length&&e[i+1].type==="text";)l=e[++i],r+=`
45
- `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(r):r;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 Ft{constructor(e){$(this,"options");this.options=e||ht}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}$(Ft,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Fo{constructor(...e){Ci(this,pt);$(this,"defaults",Mn());$(this,"options",this.setOptions);$(this,"parse",_n(this,pt,$n).call(this,Qe.lex,Je.parse));$(this,"parseInline",_n(this,pt,$n).call(this,Qe.lexInline,Je.parseInline));$(this,"Parser",Je);$(this,"Renderer",rn);$(this,"TextRenderer",Pn);$(this,"Lexer",Qe);$(this,"Tokenizer",nn);$(this,"Hooks",Ft);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 r=l;for(const c of r.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of r.rows)for(const u of c)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{const r=l;n=n.concat(this.walkTokens(r.items,t));break}default:{const r=l;(o=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&o[r.type]?this.defaults.extensions.childTokens[r.type].forEach(c=>{const u=r[c].flat(1/0);n=n.concat(this.walkTokens(u,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i=re({},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(...r){let c=o.renderer.apply(this,r);return c===!1&&(c=l.apply(this,r)),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 rn(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 r=l,c=n.renderer[r],u=o[r];o[r]=(...f)=>{let p=c.apply(o,f);return p===!1&&(p=u.apply(o,f)),p||""}}i.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new nn(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 r=l,c=n.tokenizer[r],u=o[r];o[r]=(...f)=>{let p=c.apply(o,f);return p===!1&&(p=u.apply(o,f)),p}}i.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new Ft;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(l==="options")continue;const r=l,c=n.hooks[r],u=o[r];Ft.passThroughHooks.has(l)?o[r]=f=>{if(this.defaults.async)return Promise.resolve(c.call(o,f)).then(d=>u.call(o,d));const p=c.call(o,f);return u.call(o,p)}:o[r]=(...f)=>{let p=c.apply(o,f);return p===!1&&(p=u.apply(o,f)),p}}i.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;i.walkTokens=function(r){let c=[];return c.push(l.call(this,r)),o&&(c=c.concat(o.call(this,r))),c}}this.defaults=re(re({},this.defaults),i)}),this}setOptions(e){return this.defaults=re(re({},this.defaults),e),this}lexer(e,t){return Qe.lex(e,t!=null?t:this.defaults)}parser(e,t){return Je.parse(e,t!=null?t:this.defaults)}}pt=new WeakSet,$n=function(e,t){return(n,i)=>{const o=re({},i),l=re(re({},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 r=_n(this,pt,Li).call(this,!!l.silent,!!l.async);if(typeof n=="undefined"||n===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return r(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(r);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 r(c)}}},Li=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>"+He(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}};const dt=new Fo;function te(s,e){return dt.parse(s,e)}te.options=te.setOptions=function(s){return dt.setOptions(s),te.defaults=dt.defaults,ps(te.defaults),te},te.getDefaults=Mn,te.defaults=ht,te.use=function(...s){return dt.use(...s),te.defaults=dt.defaults,ps(te.defaults),te},te.walkTokens=function(s,e){return dt.walkTokens(s,e)},te.parseInline=dt.parseInline,te.Parser=Je,te.parser=Je.parse,te.Renderer=rn,te.TextRenderer=Pn,te.Lexer=Qe,te.lexer=Qe.lex,te.Tokenizer=nn,te.Hooks=Ft,te.parse=te,te.options,te.setOptions,te.use,te.walkTokens,te.parseInline,Je.parse,Qe.lex;/*! @license DOMPurify 3.2.6 | (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.6/LICENSE */const{entries:Ms,setPrototypeOf:xs,isFrozen:Ho,getPrototypeOf:Bo,getOwnPropertyDescriptor:qo}=Object;let{freeze:Le,seal:je,create:Cs}=Object,{apply:Nn,construct:Fn}=typeof Reflect!="undefined"&&Reflect;Le||(Le=function(e){return e}),je||(je=function(e){return e}),Nn||(Nn=function(e,t,n){return e.apply(t,n)}),Fn||(Fn=function(e,t){return new e(...t)});const an=De(Array.prototype.forEach),jo=De(Array.prototype.lastIndexOf),Ls=De(Array.prototype.pop),Ht=De(Array.prototype.push),Uo=De(Array.prototype.splice),cn=De(String.prototype.toLowerCase),Hn=De(String.prototype.toString),zs=De(String.prototype.match),Bt=De(String.prototype.replace),Wo=De(String.prototype.indexOf),Go=De(String.prototype.trim),We=De(Object.prototype.hasOwnProperty),ze=De(RegExp.prototype.test),qt=Zo(TypeError);function De(s){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Nn(s,e,n)}}function Zo(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Fn(s,t)}}function J(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cn;xs&&xs(s,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(Ho(e)||(e[n]=o),i=o)}s[i]=!0}return s}function Yo(s){for(let e=0;e<s.length;e++)We(s,e)||(s[e]=null);return s}function et(s){const e=Cs(null);for(const[t,n]of Ms(s))We(s,t)&&(Array.isArray(n)?e[t]=Yo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=et(n):e[t]=n);return e}function jt(s,e){for(;s!==null;){const n=qo(s,e);if(n){if(n.get)return De(n.get);if(typeof n.value=="function")return De(n.value)}s=Bo(s)}function t(){return null}return t}const Ds=Le(["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"]),Bn=Le(["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"]),qn=Le(["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"]),Xo=Le(["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"]),jn=Le(["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"]),Vo=Le(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Os=Le(["#text"]),Ps=Le(["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"]),Un=Le(["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"]),Ns=Le(["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"]),un=Le(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qo=je(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Jo=je(/<%[\w\W]*|[\w\W]*%>/gm),Ko=je(/\$\{[\w\W]*/gm),$o=je(/^data-[\-\w.\u00B7-\uFFFF]+$/),el=je(/^aria-[\-\w]+$/),Fs=je(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tl=je(/^(?:\w+script|data):/i),nl=je(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Hs=je(/^html$/i),sl=je(/^[a-z][.\w]*(-[.\w]+)+$/i);var Bs=Object.freeze({__proto__:null,ARIA_ATTR:el,ATTR_WHITESPACE:nl,CUSTOM_ELEMENT:sl,DATA_ATTR:$o,DOCTYPE_NAME:Hs,ERB_EXPR:Jo,IS_ALLOWED_URI:Fs,IS_SCRIPT_OR_DATA:tl,MUSTACHE_EXPR:Qo,TMPLIT_EXPR:Ko});const Ut={element:1,text:3,progressingInstruction:7,comment:8,document:9},il=function(){return typeof window=="undefined"?null:window},ol=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}},qs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function js(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:il();const e=P=>js(P);if(e.version="3.2.6",e.removed=[],!s||!s.document||s.document.nodeType!==Ut.document||!s.Element)return e.isSupported=!1,e;let{document:t}=s;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:r,Element:c,NodeFilter:u,NamedNodeMap:f=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:p,DOMParser:d,trustedTypes:m}=s,g=c.prototype,k=jt(g,"cloneNode"),I=jt(g,"remove"),x=jt(g,"nextSibling"),A=jt(g,"childNodes"),y=jt(g,"parentNode");if(typeof l=="function"){const P=t.createElement("template");P.content&&P.content.ownerDocument&&(t=P.content.ownerDocument)}let _,T="";const{implementation:E,createNodeIterator:R,createDocumentFragment:C,getElementsByTagName:L}=t,{importNode:Q}=n;let G=qs();e.isSupported=typeof Ms=="function"&&typeof y=="function"&&E&&E.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:V,TMPLIT_EXPR:fe,DATA_ATTR:se,ARIA_ATTR:ce,IS_SCRIPT_OR_DATA:be,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:ue}=Bs;let{IS_ALLOWED_URI:Ge}=Bs,Y=null;const Ie=J({},[...Ds,...Bn,...qn,...jn,...Os]);let ie=null;const Ee=J({},[...Ps,...Un,...Ns,...un]);let oe=Object.seal(Cs(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}})),Oe=null,Ae=null,Ze=!0,D=!0,le=!1,O=!0,j=!1,pe=!0,ye=!1,Pe=!1,Be=!1,rt=!1,St=!1,Et=!1,hn=!0,dn=!1;const Yn="user-content-";let Wt=!0,mt=!1,at={},ct=null;const pn=J({},["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 mn=null;const gn=J({},["audio","video","img","source","image","track"]);let Gt=null;const wn=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),At="http://www.w3.org/1998/Math/MathML",It="http://www.w3.org/2000/svg",Ye="http://www.w3.org/1999/xhtml";let ut=Ye,Zt=!1,Yt=null;const Xn=J({},[At,It,Ye],Hn);let b=J({},["mi","mo","mn","ms","mtext"]),H=J({},["annotation-xml"]);const ne=J({},["title","style","font","a","script"]);let me=null;const ke=["application/xhtml+xml","text/html"],Re="text/html";let K=null,Xe=null;const tt=t.createElement("form"),wi=function(h){return h instanceof RegExp||h instanceof Function},Vn=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Xe&&Xe===h)){if((!h||typeof h!="object")&&(h={}),h=et(h),me=ke.indexOf(h.PARSER_MEDIA_TYPE)===-1?Re:h.PARSER_MEDIA_TYPE,K=me==="application/xhtml+xml"?Hn:cn,Y=We(h,"ALLOWED_TAGS")?J({},h.ALLOWED_TAGS,K):Ie,ie=We(h,"ALLOWED_ATTR")?J({},h.ALLOWED_ATTR,K):Ee,Yt=We(h,"ALLOWED_NAMESPACES")?J({},h.ALLOWED_NAMESPACES,Hn):Xn,Gt=We(h,"ADD_URI_SAFE_ATTR")?J(et(wn),h.ADD_URI_SAFE_ATTR,K):wn,mn=We(h,"ADD_DATA_URI_TAGS")?J(et(gn),h.ADD_DATA_URI_TAGS,K):gn,ct=We(h,"FORBID_CONTENTS")?J({},h.FORBID_CONTENTS,K):pn,Oe=We(h,"FORBID_TAGS")?J({},h.FORBID_TAGS,K):et({}),Ae=We(h,"FORBID_ATTR")?J({},h.FORBID_ATTR,K):et({}),at=We(h,"USE_PROFILES")?h.USE_PROFILES:!1,Ze=h.ALLOW_ARIA_ATTR!==!1,D=h.ALLOW_DATA_ATTR!==!1,le=h.ALLOW_UNKNOWN_PROTOCOLS||!1,O=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,j=h.SAFE_FOR_TEMPLATES||!1,pe=h.SAFE_FOR_XML!==!1,ye=h.WHOLE_DOCUMENT||!1,rt=h.RETURN_DOM||!1,St=h.RETURN_DOM_FRAGMENT||!1,Et=h.RETURN_TRUSTED_TYPE||!1,Be=h.FORCE_BODY||!1,hn=h.SANITIZE_DOM!==!1,dn=h.SANITIZE_NAMED_PROPS||!1,Wt=h.KEEP_CONTENT!==!1,mt=h.IN_PLACE||!1,Ge=h.ALLOWED_URI_REGEXP||Fs,ut=h.NAMESPACE||Ye,b=h.MATHML_TEXT_INTEGRATION_POINTS||b,H=h.HTML_INTEGRATION_POINTS||H,oe=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&wi(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&wi(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),j&&(D=!1),St&&(rt=!0),at&&(Y=J({},Os),ie=[],at.html===!0&&(J(Y,Ds),J(ie,Ps)),at.svg===!0&&(J(Y,Bn),J(ie,Un),J(ie,un)),at.svgFilters===!0&&(J(Y,qn),J(ie,Un),J(ie,un)),at.mathMl===!0&&(J(Y,jn),J(ie,Ns),J(ie,un))),h.ADD_TAGS&&(Y===Ie&&(Y=et(Y)),J(Y,h.ADD_TAGS,K)),h.ADD_ATTR&&(ie===Ee&&(ie=et(ie)),J(ie,h.ADD_ATTR,K)),h.ADD_URI_SAFE_ATTR&&J(Gt,h.ADD_URI_SAFE_ATTR,K),h.FORBID_CONTENTS&&(ct===pn&&(ct=et(ct)),J(ct,h.FORBID_CONTENTS,K)),Wt&&(Y["#text"]=!0),ye&&J(Y,["html","head","body"]),Y.table&&(J(Y,["tbody"]),delete Oe.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw qt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=h.TRUSTED_TYPES_POLICY,T=_.createHTML("")}else _===void 0&&(_=ol(m,i)),_!==null&&typeof T=="string"&&(T=_.createHTML(""));Le&&Le(h),Xe=h}},_i=J({},[...Bn,...qn,...Xo]),ki=J({},[...jn,...Vo]),Nl=function(h){let v=y(h);(!v||!v.tagName)&&(v={namespaceURI:ut,tagName:"template"});const z=cn(h.tagName),de=cn(v.tagName);return Yt[h.namespaceURI]?h.namespaceURI===It?v.namespaceURI===Ye?z==="svg":v.namespaceURI===At?z==="svg"&&(de==="annotation-xml"||b[de]):!!_i[z]:h.namespaceURI===At?v.namespaceURI===Ye?z==="math":v.namespaceURI===It?z==="math"&&H[de]:!!ki[z]:h.namespaceURI===Ye?v.namespaceURI===It&&!H[de]||v.namespaceURI===At&&!b[de]?!1:!ki[z]&&(ne[z]||!_i[z]):!!(me==="application/xhtml+xml"&&Yt[h.namespaceURI]):!1},Ke=function(h){Ht(e.removed,{element:h});try{y(h).removeChild(h)}catch(v){I(h)}},Rt=function(h,v){try{Ht(e.removed,{attribute:v.getAttributeNode(h),from:v})}catch(z){Ht(e.removed,{attribute:null,from:v})}if(v.removeAttribute(h),h==="is")if(rt||St)try{Ke(v)}catch(z){}else try{v.setAttribute(h,"")}catch(z){}},bi=function(h){let v=null,z=null;if(Be)h="<remove></remove>"+h;else{const Te=zs(h,/^[\r\n\t ]+/);z=Te&&Te[0]}me==="application/xhtml+xml"&&ut===Ye&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const de=_?_.createHTML(h):h;if(ut===Ye)try{v=new d().parseFromString(de,me)}catch(Te){}if(!v||!v.documentElement){v=E.createDocument(ut,"template",null);try{v.documentElement.innerHTML=Zt?T:de}catch(Te){}}const Me=v.body||v.documentElement;return h&&z&&Me.insertBefore(t.createTextNode(z),Me.childNodes[0]||null),ut===Ye?L.call(v,ye?"html":"body")[0]:ye?v.documentElement:Me},yi=function(h){return R.call(h.ownerDocument||h,h,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Qn=function(h){return h instanceof p&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof f)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},Ti=function(h){return typeof r=="function"&&h instanceof r};function nt(P,h,v){an(P,z=>{z.call(e,h,v,Xe)})}const vi=function(h){let v=null;if(nt(G.beforeSanitizeElements,h,null),Qn(h))return Ke(h),!0;const z=K(h.nodeName);if(nt(G.uponSanitizeElement,h,{tagName:z,allowedTags:Y}),pe&&h.hasChildNodes()&&!Ti(h.firstElementChild)&&ze(/<[/\w!]/g,h.innerHTML)&&ze(/<[/\w!]/g,h.textContent)||h.nodeType===Ut.progressingInstruction||pe&&h.nodeType===Ut.comment&&ze(/<[/\w]/g,h.data))return Ke(h),!0;if(!Y[z]||Oe[z]){if(!Oe[z]&&Ei(z)&&(oe.tagNameCheck instanceof RegExp&&ze(oe.tagNameCheck,z)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(z)))return!1;if(Wt&&!ct[z]){const de=y(h)||h.parentNode,Me=A(h)||h.childNodes;if(Me&&de){const Te=Me.length;for(let Ne=Te-1;Ne>=0;--Ne){const st=k(Me[Ne],!0);st.__removalCount=(h.__removalCount||0)+1,de.insertBefore(st,x(h))}}}return Ke(h),!0}return h instanceof c&&!Nl(h)||(z==="noscript"||z==="noembed"||z==="noframes")&&ze(/<\/no(script|embed|frames)/i,h.innerHTML)?(Ke(h),!0):(j&&h.nodeType===Ut.text&&(v=h.textContent,an([M,V,fe],de=>{v=Bt(v,de," ")}),h.textContent!==v&&(Ht(e.removed,{element:h.cloneNode()}),h.textContent=v)),nt(G.afterSanitizeElements,h,null),!1)},Si=function(h,v,z){if(hn&&(v==="id"||v==="name")&&(z in t||z in tt))return!1;if(!(D&&!Ae[v]&&ze(se,v))){if(!(Ze&&ze(ce,v))){if(!ie[v]||Ae[v]){if(!(Ei(h)&&(oe.tagNameCheck instanceof RegExp&&ze(oe.tagNameCheck,h)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(h))&&(oe.attributeNameCheck instanceof RegExp&&ze(oe.attributeNameCheck,v)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(v))||v==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&ze(oe.tagNameCheck,z)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(z))))return!1}else if(!Gt[v]){if(!ze(Ge,Bt(z,Ue,""))){if(!((v==="src"||v==="xlink:href"||v==="href")&&h!=="script"&&Wo(z,"data:")===0&&mn[h])){if(!(le&&!ze(be,Bt(z,Ue,"")))){if(z)return!1}}}}}}return!0},Ei=function(h){return h!=="annotation-xml"&&zs(h,ue)},Ai=function(h){nt(G.beforeSanitizeAttributes,h,null);const{attributes:v}=h;if(!v||Qn(h))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let de=v.length;for(;de--;){const Me=v[de],{name:Te,namespaceURI:Ne,value:st}=Me,Xt=K(Te),Jn=st;let xe=Te==="value"?Jn:Go(Jn);if(z.attrName=Xt,z.attrValue=xe,z.keepAttr=!0,z.forceKeepAttr=void 0,nt(G.uponSanitizeAttribute,h,z),xe=z.attrValue,dn&&(Xt==="id"||Xt==="name")&&(Rt(Te,h),xe=Yn+xe),pe&&ze(/((--!?|])>)|<\/(style|title)/i,xe)){Rt(Te,h);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){Rt(Te,h);continue}if(!O&&ze(/\/>/i,xe)){Rt(Te,h);continue}j&&an([M,V,fe],Ri=>{xe=Bt(xe,Ri," ")});const Ii=K(h.nodeName);if(!Si(Ii,Xt,xe)){Rt(Te,h);continue}if(_&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Ne)switch(m.getAttributeType(Ii,Xt)){case"TrustedHTML":{xe=_.createHTML(xe);break}case"TrustedScriptURL":{xe=_.createScriptURL(xe);break}}if(xe!==Jn)try{Ne?h.setAttributeNS(Ne,Te,xe):h.setAttribute(Te,xe),Qn(h)?Ke(h):Ls(e.removed)}catch(Ri){Rt(Te,h)}}nt(G.afterSanitizeAttributes,h,null)},Fl=function P(h){let v=null;const z=yi(h);for(nt(G.beforeSanitizeShadowDOM,h,null);v=z.nextNode();)nt(G.uponSanitizeShadowNode,v,null),vi(v),Ai(v),v.content instanceof o&&P(v.content);nt(G.afterSanitizeShadowDOM,h,null)};return e.sanitize=function(P){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=null,z=null,de=null,Me=null;if(Zt=!P,Zt&&(P="<!-->"),typeof P!="string"&&!Ti(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw qt("dirty is not a string, aborting")}else throw qt("toString is not a function");if(!e.isSupported)return P;if(Pe||Vn(h),e.removed=[],typeof P=="string"&&(mt=!1),mt){if(P.nodeName){const st=K(P.nodeName);if(!Y[st]||Oe[st])throw qt("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof r)v=bi("<!---->"),z=v.ownerDocument.importNode(P,!0),z.nodeType===Ut.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?v=z:v.appendChild(z);else{if(!rt&&!j&&!ye&&P.indexOf("<")===-1)return _&&Et?_.createHTML(P):P;if(v=bi(P),!v)return rt?null:Et?T:""}v&&Be&&Ke(v.firstChild);const Te=yi(mt?P:v);for(;de=Te.nextNode();)vi(de),Ai(de),de.content instanceof o&&Fl(de.content);if(mt)return P;if(rt){if(St)for(Me=C.call(v.ownerDocument);v.firstChild;)Me.appendChild(v.firstChild);else Me=v;return(ie.shadowroot||ie.shadowrootmode)&&(Me=Q.call(n,Me,!0)),Me}let Ne=ye?v.outerHTML:v.innerHTML;return ye&&Y["!doctype"]&&v.ownerDocument&&v.ownerDocument.doctype&&v.ownerDocument.doctype.name&&ze(Hs,v.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+v.ownerDocument.doctype.name+`>
47
- `+Ne),j&&an([M,V,fe],st=>{Ne=Bt(Ne,st," ")}),_&&Et?_.createHTML(Ne):Ne},e.setConfig=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vn(P),Pe=!0},e.clearConfig=function(){Xe=null,Pe=!1},e.isValidAttribute=function(P,h,v){Xe||Vn({});const z=K(P),de=K(h);return Si(z,de,v)},e.addHook=function(P,h){typeof h=="function"&&Ht(G[P],h)},e.removeHook=function(P,h){if(h!==void 0){const v=jo(G[P],h);return v===-1?void 0:Uo(G[P],v,1)[0]}return Ls(G[P])},e.removeHooks=function(P){G[P]=[]},e.removeAllHooks=function(){G=qs()},e}var Us=js();function Ws(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 we=()=>{if(typeof window=="undefined")return null;const s=Ws("access_token");if(s)return s;const e=Ws("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 Gs(s,e,t){const n=s.slice();return n[25]=e[t],n}function Zs(s){let e,t=s[9].text+"",n;return{c(){e=S("div"),n=Se(t),a(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),N(e,"left",s[9].x+"px"),N(e,"top",s[9].y+"px"),N(e,"z-index",s[3]+3)},m(i,o){q(i,e,o),w(e,n)},p(i,o){o&512&&t!==(t=i[9].text+"")&&Fe(n,t),o&512&&N(e,"left",i[9].x+"px"),o&512&&N(e,"top",i[9].y+"px"),o&8&&N(e,"z-index",i[3]+3)},d(i){i&&B(e)}}}function ll(s){let e=[],t=new Map,n,i,o=lt(s[0]);const l=c=>c[25].sessionId;for(let c=0;c<o.length;c+=1){let u=Gs(s,o,c),f=l(u);t.set(f,e[c]=Ys(f,u))}let r=s[5]&&Xs();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=W(),r&&r.c(),i=_t()},m(c,u){for(let f=0;f<e.length;f+=1)e[f]&&e[f].m(c,u);q(c,n,u),r&&r.m(c,u),q(c,i,u)},p(c,u){u&8261&&(o=lt(c[0]),e=us(e,u,l,1,c,o,t,n.parentNode,cs,Ys,n,Gs)),c[5]?r||(r=Xs(),r.c(),r.m(i.parentNode,i)):r&&(r.d(1),r=null)},d(c){c&&(B(n),B(i));for(let u=0;u<e.length;u+=1)e[u].d(c);r&&r.d(c)}}}function rl(s){let e,t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话",n;return{c(){e=S("div"),n=Se(t),a(e,"class","sy-session-empty svelte-1g6fj9a")},m(i,o){q(i,e,o),w(e,n)},p(i,o){o&48&&t!==(t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话")&&Fe(n,t)},d(i){i&&B(e)}}}function Ys(s,e){let t,n,i,o,l=e[25].title+"",r,c,u,f=Qs(e[25].timestamp)+"",p,d,m,g,k,I,x,A,y,_,T;function E(){return e[18](e[25])}function R(...C){return e[19](e[25],...C)}return{key:s,first:null,c(){t=S("div"),n=S("button"),i=S("div"),o=S("div"),r=Se(l),c=W(),u=S("div"),p=Se(f),d=W(),m=S("button"),g=X("svg"),k=X("path"),I=X("path"),x=X("path"),a(o,"class","sy-session-title svelte-1g6fj9a"),a(u,"class","sy-session-time svelte-1g6fj9a"),a(i,"class","sy-session-info svelte-1g6fj9a"),a(n,"class","sy-session-select svelte-1g6fj9a"),a(k,"d","M3 6h18"),a(I,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),a(x,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),a(g,"xmlns","http://www.w3.org/2000/svg"),a(g,"width","16"),a(g,"height","16"),a(g,"viewBox","0 0 24 24"),a(g,"fill","none"),a(g,"stroke","currentColor"),a(g,"stroke-width","2"),a(g,"stroke-linecap","round"),a(g,"stroke-linejoin","round"),a(m,"class","sy-session-delete svelte-1g6fj9a"),m.disabled=A=e[6]===e[25].sessionId,a(m,"aria-label","删除会话"),a(t,"class","sy-session-item svelte-1g6fj9a"),a(t,"data-session-id",y=e[25].sessionId),F(t,"deleting",e[25].deleting),this.first=t},m(C,L){q(C,t,L),w(t,n),w(n,i),w(i,o),w(o,r),w(i,c),w(i,u),w(u,p),w(t,d),w(t,m),w(m,g),w(g,k),w(g,I),w(g,x),_||(T=[Z(n,"click",E),Z(m,"click",R)],_=!0)},p(C,L){e=C,L&1&&l!==(l=e[25].title+"")&&Fe(r,l),L&1&&f!==(f=Qs(e[25].timestamp)+"")&&Fe(p,f),L&65&&A!==(A=e[6]===e[25].sessionId)&&(m.disabled=A),L&1&&y!==(y=e[25].sessionId)&&a(t,"data-session-id",y),L&1&&F(t,"deleting",e[25].deleting)},d(C){C&&B(t),_=!1,ge(T)}}}function Xs(s){let e;return{c(){e=S("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',a(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){q(t,e,n)},d(t){t&&B(e)}}}function Vs(s){let e,t,n,i,o,l,r,c,u;return{c(){e=S("div"),t=S("div"),t.textContent="确认删除此会话?",n=W(),i=S("div"),o=S("button"),o.textContent="取消",l=W(),r=S("button"),r.textContent="删除",a(t,"class","sy-session-confirm-content svelte-1g6fj9a"),a(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),a(r,"class","sy-session-confirm-delete svelte-1g6fj9a"),a(i,"class","sy-session-confirm-actions svelte-1g6fj9a"),a(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),N(e,"left",s[8].x+"px"),N(e,"top",s[8].y+"px"),N(e,"z-index",s[3]+3)},m(f,p){q(f,e,p),w(e,t),w(e,n),w(e,i),w(i,o),w(i,l),w(i,r),c||(u=[Z(o,"click",s[20]),Z(r,"click",s[14])],c=!0)},p(f,p){p&256&&N(e,"left",f[8].x+"px"),p&256&&N(e,"top",f[8].y+"px"),p&8&&N(e,"z-index",f[3]+3)},d(f){f&&B(e),c=!1,ge(u)}}}function al(s){let e,t,n,i,o,l,r,c,u,f,p,d,m,g,k,I,x,A,y,_=s[9]&&Zs(s);function T(L,Q){return L[0].length===0?rl:ll}let E=T(s),R=E(s),C=s[7]&&Vs(s);return{c(){e=S("div"),t=S("div"),n=S("h2"),n.textContent="历史会话",i=W(),o=S("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=W(),r=S("div"),c=S("input"),u=W(),f=X("svg"),p=X("circle"),d=X("line"),m=W(),_&&_.c(),g=W(),k=S("div"),R.c(),I=W(),C&&C.c(),x=_t(),a(n,"class","svelte-1g6fj9a"),a(o,"class","sy-session-close svelte-1g6fj9a"),a(o,"aria-label","关闭历史会话"),a(t,"class","sy-session-header svelte-1g6fj9a"),a(c,"type","text"),a(c,"class","sy-session-search-input svelte-1g6fj9a"),a(c,"placeholder","搜索历史会话..."),a(p,"cx","11"),a(p,"cy","11"),a(p,"r","8"),a(d,"x1","21"),a(d,"y1","21"),a(d,"x2","16.65"),a(d,"y2","16.65"),a(f,"class","sy-session-search-icon svelte-1g6fj9a"),a(f,"xmlns","http://www.w3.org/2000/svg"),a(f,"width","16"),a(f,"height","16"),a(f,"viewBox","0 0 24 24"),a(f,"fill","none"),a(f,"stroke","currentColor"),a(f,"stroke-width","2"),a(f,"stroke-linecap","round"),a(f,"stroke-linejoin","round"),a(r,"class","sy-session-search svelte-1g6fj9a"),a(k,"class","sy-session-list svelte-1g6fj9a"),a(e,"class","sy-session-history svelte-1g6fj9a"),N(e,"z-index",s[3]+2)},m(L,Q){q(L,e,Q),w(e,t),w(t,n),w(t,i),w(t,o),w(e,l),w(e,r),w(r,c),ot(c,s[4]),w(r,u),w(r,f),w(f,p),w(f,d),w(e,m),_&&_.m(e,null),w(e,g),w(e,k),R.m(k,null),q(L,I,Q),C&&C.m(L,Q),q(L,x,Q),A||(y=[Z(o,"click",function(){Mt(s[1])&&s[1].apply(this,arguments)}),Z(o,"mouseenter",s[16]),Z(o,"mouseleave",s[12]),Z(c,"input",s[17]),Z(k,"scroll",s[10])],A=!0)},p(L,[Q]){s=L,Q&16&&c.value!==s[4]&&ot(c,s[4]),s[9]?_?_.p(s,Q):(_=Zs(s),_.c(),_.m(e,g)):_&&(_.d(1),_=null),E===(E=T(s))&&R?R.p(s,Q):(R.d(1),R=E(s),R&&(R.c(),R.m(k,null))),Q&8&&N(e,"z-index",s[3]+2),s[7]?C?C.p(s,Q):(C=Vs(s),C.c(),C.m(x.parentNode,x)):C&&(C.d(1),C=null)},i:U,o:U,d(L){L&&(B(e),B(I),B(x)),_&&_.d(),R.d(),C&&C.d(L),A=!1,ge(y)}}}const Wn=10;function Qs(s){return new Date(s).toLocaleString()}function cl(s,e,t){let{sessions:n=[]}=e,{onClose:i}=e,{onSelect:o}=e,{zIndex:l}=e,{apiPrefix:r}=e,c=!1,u=!0,f=0,p="",d=null,m=null,g={x:0,y:0};function k(){return Ce(this,null,function*(){if(!(c||!u)){t(5,c=!0);try{const M=yield fetch(`${r}/chat/record/session/list/query`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({start:f,length:Wn,keyword:p})});if(!M.ok)throw new Error("Failed to load sessions");const V=yield M.json();if(V.code===0){const fe=V.data.sessionList.map(se=>({sessionId:se.sessionId,title:se.name,timestamp:new Date(se.createDate).getTime()}));t(0,n=[...n,...fe]),f+=Wn,u=fe.length===Wn}}catch(M){console.error("Failed to load sessions:",M)}finally{t(5,c=!1)}}})}function I(M){const V=M.target,{scrollTop:fe,scrollHeight:se,clientHeight:ce}=V;se-fe-ce<50&&k()}kn(()=>{k()});let x=null;function A(M,V){const se=M.currentTarget.getBoundingClientRect();t(9,x={text:V,x:se.left+se.width/2,y:se.bottom+8})}function y(){t(9,x=null)}function _(M,V){const se=M.currentTarget.getBoundingClientRect();t(8,g={x:se.left-16,y:se.top+se.height/2}),t(7,m=V)}function T(M){return Ce(this,null,function*(){if(M&&!d)try{t(6,d=M),t(7,m=null);const V=document.querySelector(`[data-session-id="${M}"]`);V&&V.classList.add("deleting"),yield new Promise(ce=>setTimeout(ce,300));const fe=yield fetch(`${r}/chat/record/session/delete`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({sessionId:M})});if(!fe.ok)throw new Error("Delete request failed");const se=yield fe.json();if(se.code===0&&se.data.respCode===0)t(0,n=n.map(ce=>ve(re({},ce),{deleting:ce.sessionId===M}))),setTimeout(()=>{t(0,n=n.filter(ce=>!ce.deleting))},300);else throw new Error("Delete failed: "+se.message)}catch(V){console.error("Failed to delete session:",V);const fe=document.querySelector(`[data-session-id="${M}"]`);fe&&fe.classList.remove("deleting")}finally{t(6,d=null)}})}function E(){m&&T(m)}const R=M=>A(M,"关闭历史会话");function C(){p=this.value,t(4,p)}const L=M=>o(M.sessionId),Q=(M,V)=>_(V,M.sessionId),G=()=>t(7,m=null);return s.$$set=M=>{"sessions"in M&&t(0,n=M.sessions),"onClose"in M&&t(1,i=M.onClose),"onSelect"in M&&t(2,o=M.onSelect),"zIndex"in M&&t(3,l=M.zIndex),"apiPrefix"in M&&t(15,r=M.apiPrefix)},s.$$.update=()=>{s.$$.dirty&16&&p!==void 0&&(t(0,n=[]),f=0,u=!0,k())},[n,i,o,l,p,c,d,m,g,x,I,A,y,_,E,r,R,C,L,Q,G]}class Js extends An{constructor(e){super(),En(this,e,cl,al,gt,{sessions:0,onClose:1,onSelect:2,zIndex:3,apiPrefix:15})}}function Ks(s,e,t){const n=s.slice();return n[73]=e[t],n}function $s(s,e,t){const n=s.slice();return n[76]=e[t],n[77]=e,n[78]=t,n}function ei(s,e,t){const n=s.slice();return n[79]=e[t],n[81]=t,n}function ul(s){let e,t=[],n=new Map,i=lt(s[11]);const o=l=>l[76].id;for(let l=0;l<i.length;l+=1){let r=$s(s,i,l),c=o(r);n.set(c,t[l]=ri(c,r))}return{c(){e=S("div");for(let l=0;l<t.length;l+=1)t[l].c();a(e,"class","sy-assistant-message-list svelte-ynwtqm")},m(l,r){q(l,e,r);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);s[57](e)},p(l,r){r[0]&1761147305|r[1]&127&&(i=lt(l[11]),t=us(t,r,o,1,l,i,n,e,cs,ri,null,$s))},i:U,o:U,d(l){l&&B(e);for(let r=0;r<t.length;r+=1)t[r].d();s[57](null)}}}function fl(s){let e,t;return e=new Js({props:{sessions:s[38],onClose:s[40],onSelect:s[41],zIndex:s[0],apiPrefix:s[2]}}),{c(){Sn(e.$$.fragment)},m(n,i){$t(e,n,i),t=!0},p(n,i){const o={};i[0]&1&&(o.zIndex=n[0]),i[0]&4&&(o.apiPrefix=n[2]),e.$set(o)},i(n){t||(qe(e.$$.fragment,n),t=!0)},o(n){$e(e.$$.fragment,n),t=!1},d(n){en(e,n)}}}function hl(s){let e,t=vt(s[8],'<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"/></svg>',"100%","100%")+"";return{c(){e=S("div"),a(e,"class","sy-assistant-avatar user svelte-ynwtqm"),F(e,"screen-theme",s[3]==="screen")},m(n,i){q(n,e,i),e.innerHTML=t},p(n,i){i[0]&256&&t!==(t=vt(n[8],'<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"/></svg>',"100%","100%")+"")&&(e.innerHTML=t),i[0]&8&&F(e,"screen-theme",n[3]==="screen")},d(n){n&&B(e)}}}function dl(s){let e,t=vt(s[7],'<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>',"100%","100%")+"";return{c(){e=S("div"),a(e,"class","sy-assistant-avatar assistant svelte-ynwtqm"),F(e,"screen-theme",s[3]==="screen")},m(n,i){q(n,e,i),e.innerHTML=t},p(n,i){i[0]&128&&t!==(t=vt(n[7],'<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>',"100%","100%")+"")&&(e.innerHTML=t),i[0]&8&&F(e,"screen-theme",n[3]==="screen")},d(n){n&&B(e)}}}function pl(s){let e,t=s[27](s[76].content)+"";return{c(){e=S("div"),a(e,"class","markdown-content svelte-ynwtqm")},m(n,i){q(n,e,i),e.innerHTML=t},p(n,i){i[0]&2048&&t!==(t=n[27](n[76].content)+"")&&(e.innerHTML=t)},d(n){n&&B(e)}}}function ml(s){let e;return{c(){e=S("span"),e.innerHTML='<span class="dot svelte-ynwtqm">.</span> <span class="dot svelte-ynwtqm">.</span> <span class="dot svelte-ynwtqm">.</span>',a(e,"class","sy-assistant-loading svelte-ynwtqm")},m(t,n){q(t,e,n)},p:U,d(t){t&&B(e)}}}function ti(s){let e,t=lt(s[76].attachments),n=[];for(let i=0;i<t.length;i+=1)n[i]=ii(ei(s,t,i));return{c(){e=S("div");for(let i=0;i<n.length;i+=1)n[i].c();a(e,"class","sy-assistant-attachments svelte-ynwtqm")},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]&1610643457|o[1]&1){t=lt(i[76].attachments);let l;for(l=0;l<t.length;l+=1){const r=ei(i,t,l);n[l]?n[l].p(r,o):(n[l]=ii(r),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&&B(e),is(n,i)}}}function ni(s){let e,t,n;function i(...o){return s[44](s[79],...o)}return{c(){e=S("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-ynwtqm"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',a(e,"class","sy-assistant-attachment-toggle svelte-ynwtqm"),a(e,"aria-label","查看详情")},m(o,l){q(o,e,l),t||(n=[Z(e,"mouseenter",i),Z(e,"mouseleave",s[30])],t=!0)},p(o,l){s=o},d(o){o&&B(e),t=!1,ge(n)}}}function si(s){let e,t=s[12].replace(/\n/g,"<br>")+"",n,i;return{c(){e=S("div"),a(e,"class","sy-assistant-tooltip svelte-ynwtqm"),a(e,"role","tooltip"),N(e,"left",s[13].x+"px"),N(e,"top",s[13].y+"px"),N(e,"z-index",s[0]+3),F(e,"align-right",s[13].alignRight)},m(o,l){q(o,e,l),e.innerHTML=t,n||(i=[Z(e,"mouseenter",s[46]),Z(e,"mouseleave",s[47])],n=!0)},p(o,l){l[0]&4096&&t!==(t=o[12].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&8192&&N(e,"left",o[13].x+"px"),l[0]&8192&&N(e,"top",o[13].y+"px"),l[0]&1&&N(e,"z-index",o[0]+3),l[0]&8192&&F(e,"align-right",o[13].alignRight)},d(o){o&&B(e),n=!1,ge(i)}}}function ii(s){let e,t,n,i,o,l,r,c,u,f=fn(s[79].content_title).name+"",p,d,m,g=fn(s[79].content_title).ext+"",k,I,x,A,y,_,T,E,R,C,L=s[79].tips&&ni(s);function Q(){return s[45](s[79])}let G=s[12]&&si(s);return{c(){e=S("div"),t=S("div"),n=S("div"),i=X("svg"),o=X("path"),l=X("polyline"),r=W(),c=S("div"),u=S("span"),p=Se(f),d=W(),m=S("span"),k=Se(g),x=W(),A=S("div"),L&&L.c(),y=W(),_=S("button"),_.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-ynwtqm"><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=W(),G&&G.c(),E=W(),a(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),a(l,"points","13 2 13 9 20 9"),a(i,"xmlns","http://www.w3.org/2000/svg"),a(i,"width","16"),a(i,"height","16"),a(i,"viewBox","0 0 24 24"),a(i,"fill","none"),a(i,"stroke","currentColor"),a(i,"stroke-width","2"),a(i,"stroke-linecap","round"),a(i,"stroke-linejoin","round"),a(u,"class","sy-assistant-filename svelte-ynwtqm"),a(m,"class","sy-assistant-attachment-ext svelte-ynwtqm"),a(c,"class","sy-assistant-attachment-name svelte-ynwtqm"),a(c,"title",I=s[79].content_title),a(n,"class","sy-assistant-attachment-title svelte-ynwtqm"),a(_,"class","sy-assistant-attachment-toggle svelte-ynwtqm"),a(_,"aria-label","下载文件"),a(A,"class","sy-assistant-attachment-actions svelte-ynwtqm"),a(t,"class","sy-assistant-attachment-header svelte-ynwtqm"),a(e,"class","sy-assistant-attachment svelte-ynwtqm")},m(M,V){q(M,e,V),w(e,t),w(t,n),w(n,i),w(i,o),w(i,l),w(n,r),w(n,c),w(c,u),w(u,p),w(c,d),w(c,m),w(m,k),w(t,x),w(t,A),L&&L.m(A,null),w(A,y),w(A,_),w(e,T),G&&G.m(e,null),w(e,E),R||(C=Z(_,"click",Q),R=!0)},p(M,V){s=M,V[0]&2048&&f!==(f=fn(s[79].content_title).name+"")&&Fe(p,f),V[0]&2048&&g!==(g=fn(s[79].content_title).ext+"")&&Fe(k,g),V[0]&2048&&I!==(I=s[79].content_title)&&a(c,"title",I),s[79].tips?L?L.p(s,V):(L=ni(s),L.c(),L.m(A,y)):L&&(L.d(1),L=null),s[12]?G?G.p(s,V):(G=si(s),G.c(),G.m(e,E)):G&&(G.d(1),G=null)},d(M){M&&B(e),L&&L.d(),G&&G.d(),R=!1,C()}}}function oi(s){let e,t,n,i,o,l,r,c,u,f,p;function d(E,R){return E[19][E[76].id]?wl:gl}let m=d(s),g=m(s);function k(){return s[48](s[76])}function I(...E){return s[49](s[76],...E)}function x(){return s[50](s[76])}function A(...E){return s[51](s[76],...E)}function y(...E){return s[52](s[76],...E)}function _(...E){return s[53](s[76],...E)}let T=s[22]&&s[20][s[76].id]==="dislike"&&li(s);return{c(){e=S("div"),t=S("button"),g.c(),i=W(),o=S("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=W(),r=S("button"),r.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=W(),T&&T.c(),u=_t(),a(t,"class","sy-assistant-action-button svelte-ynwtqm"),a(t,"aria-label",n=s[19][s[76].id]?"已复制":"复制内容"),F(t,"copied",s[19][s[76].id]),a(o,"class","sy-assistant-action-button svelte-ynwtqm"),a(o,"aria-label","点赞"),F(o,"active",s[20][s[76].id]==="like"),a(r,"class","sy-assistant-action-button svelte-ynwtqm"),a(r,"aria-label","点踩"),F(r,"active",s[20][s[76].id]==="dislike"),a(e,"class","sy-assistant-message-actions svelte-ynwtqm")},m(E,R){q(E,e,R),w(e,t),g.m(t,null),w(e,i),w(e,o),w(e,l),w(e,r),q(E,c,R),T&&T.m(E,R),q(E,u,R),f||(p=[Z(t,"click",k),Z(t,"mouseenter",I),Z(t,"mouseleave",s[37]),Z(o,"click",x),Z(o,"mouseenter",A),Z(o,"mouseleave",s[37]),Z(r,"click",y),Z(r,"mouseenter",_),Z(r,"mouseleave",s[37])],f=!0)},p(E,R){s=E,m!==(m=d(s))&&(g.d(1),g=m(s),g&&(g.c(),g.m(t,null))),R[0]&526336&&n!==(n=s[19][s[76].id]?"已复制":"复制内容")&&a(t,"aria-label",n),R[0]&526336&&F(t,"copied",s[19][s[76].id]),R[0]&1050624&&F(o,"active",s[20][s[76].id]==="like"),R[0]&1050624&&F(r,"active",s[20][s[76].id]==="dislike"),s[22]&&s[20][s[76].id]==="dislike"?T?T.p(s,R):(T=li(s),T.c(),T.m(u.parentNode,u)):T&&(T.d(1),T=null)},d(E){E&&(B(e),B(c),B(u)),g.d(),T&&T.d(E),f=!1,ge(p)}}}function gl(s){let e,t,n;return{c(){e=X("svg"),t=X("rect"),n=X("path"),a(t,"x","9"),a(t,"y","9"),a(t,"width","13"),a(t,"height","13"),a(t,"rx","2"),a(t,"ry","2"),a(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width","14"),a(e,"height","14"),a(e,"viewBox","0 0 24 24"),a(e,"fill","none"),a(e,"stroke","currentColor"),a(e,"stroke-width","2"),a(e,"stroke-linecap","round"),a(e,"stroke-linejoin","round")},m(i,o){q(i,e,o),w(e,t),w(e,n)},d(i){i&&B(e)}}}function wl(s){let e,t;return{c(){e=X("svg"),t=X("polyline"),a(t,"points","20 6 9 17 4 12"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width","14"),a(e,"height","14"),a(e,"viewBox","0 0 24 24"),a(e,"fill","none"),a(e,"stroke","currentColor"),a(e,"stroke-width","2"),a(e,"stroke-linecap","round"),a(e,"stroke-linejoin","round")},m(n,i){q(n,e,i),w(e,t)},d(n){n&&B(e)}}}function li(s){let e,t,n,i,o,l,r,c,u,f,p;function d(){s[54].call(i,s[76])}function m(){return s[55](s[76])}function g(){return s[56](s[76])}return{c(){e=S("div"),t=S("div"),t.textContent="反馈意见",n=W(),i=S("textarea"),o=W(),l=S("div"),r=S("button"),r.textContent="取消",c=W(),u=S("button"),u.textContent="提交",a(t,"class","sy-assistant-dislike-title svelte-ynwtqm"),a(i,"class","sy-assistant-dislike-input svelte-ynwtqm"),a(i,"placeholder","请输入您的反馈意见..."),a(r,"class","sy-assistant-popup-cancel svelte-ynwtqm"),a(u,"class","sy-assistant-popup-submit svelte-ynwtqm"),a(l,"class","sy-assistant-popup-actions svelte-ynwtqm"),a(e,"class","sy-assistant-dislike-popup svelte-ynwtqm"),N(e,"left",s[23].x+"px"),N(e,"top",s[23].y+"px"),N(e,"z-index",s[0]+3)},m(k,I){q(k,e,I),w(e,t),w(e,n),w(e,i),ot(i,s[21][s[76].id]),w(e,o),w(e,l),w(l,r),w(l,c),w(l,u),f||(p=[Z(i,"input",d),Z(r,"click",m),Z(u,"click",g)],f=!0)},p(k,I){s=k,I[0]&2099200&&ot(i,s[21][s[76].id]),I[0]&8388608&&N(e,"left",s[23].x+"px"),I[0]&8388608&&N(e,"top",s[23].y+"px"),I[0]&1&&N(e,"z-index",s[0]+3)},d(k){k&&B(e),f=!1,ge(p)}}}function ri(s,e){let t,n,i,o,l,r,c,u,f=new Date(e[76].timestamp).toLocaleString()+"",p,d;function m(T,E){return T[76].type==="assistant"?dl:hl}let g=m(e),k=g(e);function I(T,E){return T[15]&&T[76].id===T[11][T[11].length-1].id&&T[76].type==="assistant"&&!T[76].content?ml:pl}let x=I(e),A=x(e),y=e[76].attachments&&ti(e),_=e[76].id!=="-1"&&e[76].type==="assistant"&&!e[15]&&e[5]&&oi(e);return{key:s,first:null,c(){t=S("div"),k.c(),n=W(),i=S("div"),o=S("div"),A.c(),l=W(),y&&y.c(),r=W(),_&&_.c(),c=W(),u=S("div"),p=Se(f),d=W(),a(o,"class","sy-assistant-message-content svelte-ynwtqm"),F(o,"screen-theme",e[3]==="screen"),a(u,"class","sy-assistant-message-time svelte-ynwtqm"),a(i,"class","sy-assistant-message-bubble svelte-ynwtqm"),F(i,"screen-theme",e[3]==="screen"),a(t,"class","sy-assistant-message svelte-ynwtqm"),F(t,"user",e[76].type==="user"),F(t,"screen-theme",e[3]==="screen"),this.first=t},m(T,E){q(T,t,E),k.m(t,null),w(t,n),w(t,i),w(i,o),A.m(o,null),w(o,l),y&&y.m(o,null),w(o,r),_&&_.m(o,null),w(i,c),w(i,u),w(u,p),w(t,d)},p(T,E){e=T,g===(g=m(e))&&k?k.p(e,E):(k.d(1),k=g(e),k&&(k.c(),k.m(t,n))),x===(x=I(e))&&A?A.p(e,E):(A.d(1),A=x(e),A&&(A.c(),A.m(o,l))),e[76].attachments?y?y.p(e,E):(y=ti(e),y.c(),y.m(o,r)):y&&(y.d(1),y=null),e[76].id!=="-1"&&e[76].type==="assistant"&&!e[15]&&e[5]?_?_.p(e,E):(_=oi(e),_.c(),_.m(o,null)):_&&(_.d(1),_=null),E[0]&8&&F(o,"screen-theme",e[3]==="screen"),E[0]&2048&&f!==(f=new Date(e[76].timestamp).toLocaleString()+"")&&Fe(p,f),E[0]&8&&F(i,"screen-theme",e[3]==="screen"),E[0]&2048&&F(t,"user",e[76].type==="user"),E[0]&8&&F(t,"screen-theme",e[3]==="screen")},d(T){T&&B(t),k.d(),A.d(),y&&y.d(),_&&_.d()}}}function ai(s){let e,t,n,i,o,l,r,c,u,f,p,d,m,g=vt(s[6],'<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="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>')+"",k,I,x,A=s[5]&&ci(s);return{c(){A&&A.c(),e=W(),t=S("div"),n=S("div"),i=S("div"),o=S("textarea"),l=W(),r=S("div"),c=S("div"),u=Se(s[10]),f=Se("/"),p=Se(Gn),d=W(),m=S("button"),a(o,"class","sy-assistant-textarea svelte-ynwtqm"),a(o,"placeholder","输入您的问题..."),a(o,"maxlength",Gn),a(o,"rows","3"),F(o,"screen-theme",s[3]==="screen"),a(i,"class","sy-assistant-textarea-container svelte-ynwtqm"),a(c,"class","sy-assistant-char-count svelte-ynwtqm"),F(c,"over-limit",s[26]),a(m,"class","sy-assistant-send-button svelte-ynwtqm"),m.disabled=k=!s[9].trim()||s[26],a(m,"aria-label","发送消息"),a(r,"class","sy-assistant-operation-area svelte-ynwtqm"),a(n,"class","sy-assistant-input-container svelte-ynwtqm"),F(n,"screen-theme",s[3]==="screen"),a(t,"class","sy-assistant-input-area svelte-ynwtqm"),F(t,"screen-theme",s[3]==="screen")},m(y,_){A&&A.m(y,_),q(y,e,_),q(y,t,_),w(t,n),w(n,i),w(i,o),ot(o,s[9]),w(n,l),w(n,r),w(r,c),w(c,u),w(c,f),w(c,p),w(r,d),w(r,m),m.innerHTML=g,I||(x=[Z(o,"input",s[61]),Z(o,"keydown",s[62]),Z(m,"click",s[28]),Z(m,"mouseenter",s[63]),Z(m,"mouseleave",s[37])],I=!0)},p(y,_){y[5]?A?A.p(y,_):(A=ci(y),A.c(),A.m(e.parentNode,e)):A&&(A.d(1),A=null),_[0]&512&&ot(o,y[9]),_[0]&8&&F(o,"screen-theme",y[3]==="screen"),_[0]&1024&&Fe(u,y[10]),_[0]&67108864&&F(c,"over-limit",y[26]),_[0]&64&&g!==(g=vt(y[6],'<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="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>')+"")&&(m.innerHTML=g),_[0]&67109376&&k!==(k=!y[9].trim()||y[26])&&(m.disabled=k),_[0]&8&&F(n,"screen-theme",y[3]==="screen"),_[0]&8&&F(t,"screen-theme",y[3]==="screen")},d(y){y&&(B(e),B(t)),A&&A.d(y),I=!1,ge(x)}}}function ci(s){let e,t,n,i,o,l,r,c,u,f=s[1]&&ui(s),p=!s[1]&&hi(),d=s[4]!==!1&&di(s);return{c(){e=S("div"),t=S("div"),f&&f.c(),n=W(),p&&p.c(),i=W(),o=S("div"),d&&d.c(),l=W(),r=S("button"),r.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>',a(r,"class","sy-assistant-icon-button svelte-ynwtqm"),a(r,"aria-label","新建会话"),a(o,"class","sy-assistant-chat-actions-btns svelte-ynwtqm"),a(t,"class","sy-assistant-chat-actions svelte-ynwtqm"),a(e,"class","sy-assistant-chat-footer svelte-ynwtqm")},m(m,g){q(m,e,g),w(e,t),f&&f.m(t,null),w(t,n),p&&p.m(t,null),w(t,i),w(t,o),d&&d.m(o,null),w(o,l),w(o,r),c||(u=[Z(r,"click",s[42]),Z(r,"mouseenter",s[60]),Z(r,"mouseleave",s[37])],c=!0)},p(m,g){m[1]?f?f.p(m,g):(f=ui(m),f.c(),f.m(t,n)):f&&(f.d(1),f=null),m[1]?p&&(p.d(1),p=null):p||(p=hi(),p.c(),p.m(t,i)),m[4]!==!1?d?d.p(m,g):(d=di(m),d.c(),d.m(o,l)):d&&(d.d(1),d=null)},d(m){m&&B(e),f&&f.d(),p&&p.d(),d&&d.d(),c=!1,ge(u)}}}function ui(s){let e,t,n,i,o=lt(s[17]),l=[];for(let r=0;r<o.length;r+=1)l[r]=fi(Ks(s,o,r));return{c(){e=S("div"),t=S("select");for(let r=0;r<l.length;r+=1)l[r].c();a(t,"class","sy-assistant-select svelte-ynwtqm"),s[18]===void 0&&Jt(()=>s[58].call(t)),a(e,"class","sy-assistant-scene-select svelte-ynwtqm")},m(r,c){q(r,e,c),w(e,t);for(let u=0;u<l.length;u+=1)l[u]&&l[u].m(t,null);ls(t,s[18],!0),n||(i=Z(t,"change",s[58]),n=!0)},p(r,c){if(c[0]&131072){o=lt(r[17]);let u;for(u=0;u<o.length;u+=1){const f=Ks(r,o,u);l[u]?l[u].p(f,c):(l[u]=fi(f),l[u].c(),l[u].m(t,null))}for(;u<l.length;u+=1)l[u].d(1);l.length=o.length}c[0]&393216&&ls(t,r[18])},d(r){r&&B(e),is(l,r),n=!1,i()}}}function fi(s){let e,t=s[73].name+"",n,i,o;return{c(){e=S("option"),n=Se(t),i=W(),e.__value=o=s[73].code,ot(e,e.__value)},m(l,r){q(l,e,r),w(e,n),w(e,i)},p(l,r){r[0]&131072&&t!==(t=l[73].name+"")&&Fe(n,t),r[0]&131072&&o!==(o=l[73].code)&&(e.__value=o,ot(e,e.__value))},d(l){l&&B(e)}}}function hi(s){let e;return{c(){e=S("div"),a(e,"class","sy-assistant-scene-select svelte-ynwtqm")},m(t,n){q(t,e,n)},d(t){t&&B(e)}}}function di(s){let e,t,n;return{c(){e=S("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"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',a(e,"class","sy-assistant-icon-button svelte-ynwtqm"),a(e,"aria-label","历史会话")},m(i,o){q(i,e,o),t||(n=[Z(e,"click",s[39]),Z(e,"mouseenter",s[59]),Z(e,"mouseleave",s[37])],t=!0)},p:U,d(i){i&&B(e),t=!1,ge(n)}}}function pi(s){let e,t=s[24].text+"",n;return{c(){e=S("div"),n=Se(t),a(e,"class","sy-assistant-button-tooltip svelte-ynwtqm"),N(e,"left",s[24].x+"px"),N(e,"top",s[24].y+"px")},m(i,o){q(i,e,o),w(e,n)},p(i,o){o[0]&16777216&&t!==(t=i[24].text+"")&&Fe(n,t),o[0]&16777216&&N(e,"left",i[24].x+"px"),o[0]&16777216&&N(e,"top",i[24].y+"px")},d(i){i&&B(e)}}}function _l(s){let e,t,n,i,o,l,r;const c=[fl,ul],u=[];function f(m,g){return m[25]?0:1}t=f(s),n=u[t]=c[t](s);let p=!s[25]&&ai(s),d=s[24]&&pi(s);return{c(){e=S("div"),n.c(),i=W(),p&&p.c(),o=W(),d&&d.c(),l=_t(),a(e,"class","sy-assistant-chat-container svelte-ynwtqm"),N(e,"z-index",s[0]+2)},m(m,g){q(m,e,g),u[t].m(e,null),w(e,i),p&&p.m(e,null),q(m,o,g),d&&d.m(m,g),q(m,l,g),r=!0},p(m,g){let k=t;t=f(m),t===k?u[t].p(m,g):(Tn(),$e(u[k],1,1,()=>{u[k]=null}),vn(),n=u[t],n?n.p(m,g):(n=u[t]=c[t](m),n.c()),qe(n,1),n.m(e,i)),m[25]?p&&(p.d(1),p=null):p?p.p(m,g):(p=ai(m),p.c(),p.m(e,null)),(!r||g[0]&1)&&N(e,"z-index",m[0]+2),m[24]?d?d.p(m,g):(d=pi(m),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i(m){r||(qe(n),r=!0)},o(m){$e(n),r=!1},d(m){m&&(B(e),B(o),B(l)),u[t].d(),p&&p.d(),d&&d.d(m)}}}let Gn=500;function kl(s){const e=s.match(/source#\[(.*)\]#source/);return e?s.replace(`source#[${e[1]}]#source`,""):s}function mi(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 vt(s,e,t,n){if(!s)return e;if(s.startsWith("data:image")||s.startsWith("data:image/svg+xml"))return`<img src="${s}" alt="图标" style="width: ${t||"100%"}; height: ${n||"100%"};" />`;if(s.includes("<svg")){let i=s;return t&&(i=i.replace(/width="[^"]*"/,`width="${t}"`)),n&&(i=i.replace(/height="[^"]*"/,`height="${n}"`)),i}return e}function fn(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 bl(s,e,t){let n,i;const o=qi();let l="",r=[{sessionId:"",requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],c="",u=null,f=null,p={x:0,y:0,alignRight:!1},d=null,m=!1,g=!1;te.setOptions({breaks:!0,gfm:!0});function k(b){try{const H=te(b);return Us.sanitize(H)}catch(H){console.warn("Markdown parsing failed, fallback to HTML:",H);try{const ne=b.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return Us.sanitize(ne)}catch(ne){return console.error("HTML fallback failed:",ne),b}}}let I;function x(b=!1){I&&I.scrollTo({top:I.scrollHeight,behavior:b?"smooth":"auto"})}Hi(()=>{x(!1)});let{zIndex:A}=e,{sessionId:y}=e,{hasScene:_}=e,{apiPrefix:T}=e,{theme:E="default"}=e,{showHistory:R=!0}=e,{showActions:C=!0}=e,{sendIcon:L=""}=e,{robotIcon:Q=""}=e,{userIcon:G=""}=e,M=[],V="";function fe(){return Ce(this,null,function*(){if(_)try{const b=yield fetch(`${T}/chat/getSceneList`,{headers:{"Auth-Token":`${we()}`,Authorization:`bearer ${we()}`}});if(!b.ok)throw new Error("Failed to fetch scenes");const H=yield b.json();H.code===0&&(t(17,M=H.data.sceneList||[]),M.length>0&&t(18,V=M[0].code))}catch(b){console.error("Failed to fetch scenes:",b)}})}kn(()=>{fe()});function se(){return Ce(this,null,function*(){if(!l.trim()||i)return;if(!y){console.error("No session ID available");return}const b=Date.now().toString(),H=Date.now().toString()+Math.random().toString().slice(2,8),ne={sessionId:y,requestId:H,id:b,type:"user",content:l.trim(),timestamp:Date.now()};t(11,r=[...r,ne]);const me=l.trim();t(9,l="");const ke=(Date.now()+1).toString();c="",t(11,r=[...r,{sessionId:y,requestId:H,id:ke,type:"assistant",content:"",timestamp:Date.now()}]),t(15,m=!0),g=!1,u&&u.abort(),u=new AbortController;try{yield no(`${T}/chat/sse`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({sessionId:y,requestId:H,keyword:me,flowId:"1",extendKeys:_?{sceneCode:V}:void 0}),signal:u.signal,onmessage(Re){try{const K=Re.data;if(K){g||(g=!0,o("firstResponse",{sessionId:y,requestId:H,content:K,timestamp:Date.now()}));const Xe=mi(K);Xe?(t(11,r=r.map(tt=>tt.id===ke?ve(re({},tt),{attachments:Xe}):tt)),x(!0)):(c+=K,t(11,r=r.map(tt=>tt.id===ke?ve(re({},tt),{content:c}):tt)),x(!1))}}catch(K){console.error("Failed to process SSE message:",K)}},onerror(Re){throw c="请求异常,请重试",t(11,r=r.map(K=>K.id===ke?ve(re({},K),{content:c}):K)),x(!1),console.error("SSE error:",Re),u=null,t(15,m=!1),Re},onclose(){u=null,t(15,m=!1)}})}catch(Re){console.error("Failed to send message:",Re),t(15,m=!1)}})}function ce(b,H,ne){const me=ne.getBoundingClientRect(),ke=I.getBoundingClientRect(),Re=me.left<ke.width/2;t(12,f=H),t(13,p={x:me.left,y:me.top+me.height/2,alignRight:Re})}function be(){t(14,d=setTimeout(()=>{t(12,f=null),t(14,d=null)},200))}Bi(()=>{u&&u.abort(),d&&clearTimeout(d)});function Ue(b,H){return Ce(this,null,function*(){try{const ne=yield fetch(`${T}/file/downloadFile`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({fileName:b,fileUrl:H})});if(!ne.ok)throw new Error("Download failed");const me=ne.headers.get("content-type")||"application/octet-stream",ke=yield ne.blob(),Re=window.URL.createObjectURL(ke),K=document.createElement("a");K.href=Re,K.download=b,document.body.appendChild(K),K.click(),window.URL.revokeObjectURL(Re),document.body.removeChild(K)}catch(ne){console.error("Failed to download file:",ne)}})}let ue={};function Ge(b,H){return Ce(this,null,function*(){try{const ne=H.replace(/<br\s*\/?>/g,`
48
- `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();yield navigator.clipboard.writeText(ne),t(19,ue[b]=!0,ue),setTimeout(()=>{t(19,ue[b]=!1,ue),t(19,ue)},1500)}catch(ne){console.error("Failed to copy:",ne)}})}let Y={},Ie={},ie=!1;function Ee(b,H){return Ce(this,null,function*(){if(Y[b]===H){t(20,Y[b]=null,Y),t(20,Y);return}if(t(20,Y[b]=H,Y),t(20,Y),H==="like")try{if(!(yield fetch(`${T}/chat/record/feedback`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({sessionId:y,requestId:b,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(ne){console.error("Failed to send feedback:",ne),t(20,Y[b]=null,Y),t(20,Y)}else t(22,ie=!0)})}function oe(b){return Ce(this,null,function*(){var H;if((H=Ie[b])!=null&&H.trim())try{if(!(yield fetch(`${T}/chat/record/feedback`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({sessionId:y,requestId:b,feedBackFlag:"0",feedBackContent:Ie[b]})})).ok)throw new Error("Feedback failed");t(22,ie=!1),t(21,Ie[b]="",Ie),t(21,Ie)}catch(ne){console.error("Failed to send feedback:",ne),t(20,Y[b]=null,Y),t(20,Y)}})}let Oe={x:0,y:0};function Ae(b,H){const me=b.currentTarget.getBoundingClientRect();t(23,Oe={x:me.left-290,y:me.top-160}),Ee(H,"dislike")}let Ze=null;function D(b,H){const me=b.currentTarget.getBoundingClientRect();t(24,Ze={text:H,x:me.left+me.width/2,y:me.top-8})}function le(){t(24,Ze=null)}let O=[],j=Date.now().toString(),pe=!1;function ye(){le(),t(25,pe=!0)}function Pe(){le(),t(25,pe=!1)}function Be(b){return Ce(this,null,function*(){if(!m){t(15,m=!0);try{const H=yield fetch(`${T}/chat/record/session/detail/query`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`},body:JSON.stringify({sessionId:b})});if(!H.ok)throw new Error("Failed to load sessions");const ne=yield H.json();if(ne.code===0){j=b,t(25,pe=!1);const me=ne.data.map((ke,Re)=>{const K=mi(ke.answer),Xe=kl(ke.answer);return[{sessionId:ke.sessionId,requestId:ke.requestId,id:(Date.now()+2*Re).toString(),type:"user",content:ke.keyword,timestamp:new Date(ke.createDate).getTime()},{sessionId:ke.sessionId,requestId:ke.requestId,id:(Date.now()+2*Re+1).toString(),type:"assistant",content:Xe,attachments:K,timestamp:new Date(ke.createDate).getTime()}]});t(11,r=me.flat())}}catch(H){console.error("Failed to load sessions:",H)}finally{t(15,m=!1)}}})}function rt(){return Ce(this,null,function*(){const b=yield St();if(!b){console.error("Failed to create new session");return}j=b,t(11,r=[{sessionId:j,requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(9,l="")})}function St(){return Ce(this,null,function*(){try{const b=yield fetch(`${T}/chat/getSessionId`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`}});if(!b.ok)throw new Error("Failed to get session ID");const H=yield b.json();if(H.code===0)return j=H.data.sessionId,j;throw new Error(H.message||"Failed to get session ID")}catch(b){return console.error("Failed to get session ID:",b),null}})}const Et=(b,H)=>ce(H,b.tips,H.currentTarget),hn=b=>Ue(b.content_title,b.link),dn=()=>{d&&(clearTimeout(d),t(14,d=null))},Yn=()=>{t(12,f=null)},Wt=b=>Ge(b.id,b.content),mt=(b,H)=>D(H,ue[b.id]?"已复制":"复制内容"),at=b=>Ee(b.id,"like"),ct=(b,H)=>D(H,Y[b.id]==="like"?"取消点赞":"点赞"),pn=(b,H)=>Ae(H,b.id),mn=(b,H)=>D(H,Y[b.id]==="dislike"?"取消点踩":"点踩");function gn(b){Ie[b.id]=this.value,t(21,Ie)}const Gt=b=>{t(22,ie=!1),t(20,Y[b.id]=null,Y),t(20,Y)},wn=b=>oe(b.id);function At(b){zt[b?"unshift":"push"](()=>{I=b,t(16,I)})}function It(){V=Pi(this),t(18,V),t(17,M)}const Ye=b=>D(b,"历史会话"),ut=b=>D(b,"新建会话");function Zt(){l=this.value,t(9,l)}const Yt=b=>b.key==="Enter"&&!b.shiftKey&&(se(),b.preventDefault()),Xn=b=>D(b,"发送消息");return s.$$set=b=>{"zIndex"in b&&t(0,A=b.zIndex),"sessionId"in b&&t(43,y=b.sessionId),"hasScene"in b&&t(1,_=b.hasScene),"apiPrefix"in b&&t(2,T=b.apiPrefix),"theme"in b&&t(3,E=b.theme),"showHistory"in b&&t(4,R=b.showHistory),"showActions"in b&&t(5,C=b.showActions),"sendIcon"in b&&t(6,L=b.sendIcon),"robotIcon"in b&&t(7,Q=b.robotIcon),"userIcon"in b&&t(8,G=b.userIcon)},s.$$.update=()=>{s.$$.dirty[0]&512&&t(10,n=l.length),s.$$.dirty[0]&1024&&t(26,i=n>Gn)},[A,_,T,E,R,C,L,Q,G,l,n,r,f,p,d,m,I,M,V,ue,Y,Ie,ie,Oe,Ze,pe,i,k,se,ce,be,Ue,Ge,Ee,oe,Ae,D,le,O,ye,Pe,Be,rt,y,Et,hn,dn,Yn,Wt,mt,at,ct,pn,mn,gn,Gt,wn,At,It,Ye,ut,Zt,Yt,Xn]}class yl extends An{constructor(e){super(),En(this,e,bl,_l,gt,{zIndex:0,sessionId:43,hasScene:1,apiPrefix:2,theme:3,showHistory:4,showActions:5,sendIcon:6,robotIcon:7,userIcon:8},null,[-1,-1,-1])}}function gi(s){let e,t,n,i,o=s[3].title+"",l,r,c,u,f,p,d,m,g,k=s[2]?"退出全屏":"全屏显示",I,x,A,y,_,T,E,R,C=s[7]?"取消吸附":"吸附到边缘",L,Q,G,M,V,fe,se,ce,be,Ue=`${s[3].height}px`,ue,Ge,Y;function Ie(O,j){return O[2]?vl:Tl}let ie=Ie(s),Ee=ie(s);function oe(O,j){return O[7]?El:Sl}let Oe=oe(s),Ae=Oe(s);const Ze=[Il,Al],D=[];function le(O,j){return O[8]?0:1}return ce=le(s),be=D[ce]=Ze[ce](s),{c(){var O,j,pe;e=S("div"),t=S("div"),n=S("div"),i=S("h3"),l=Se(o),r=W(),c=S("div"),u=S("div"),f=S("button"),p=X("svg"),Ee.c(),m=W(),g=S("span"),I=Se(k),x=W(),A=S("div"),y=S("button"),_=X("svg"),Ae.c(),E=W(),R=S("span"),L=Se(C),Q=W(),G=S("div"),M=S("button"),M.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=W(),fe=S("span"),fe.textContent="关闭助手",se=W(),be.c(),a(i,"class","svelte-mrstki"),a(p,"xmlns","http://www.w3.org/2000/svg"),a(p,"width","18"),a(p,"height","18"),a(p,"viewBox","0 0 24 24"),a(p,"fill","none"),a(p,"stroke","currentColor"),a(p,"stroke-width","2"),a(p,"stroke-linecap","round"),a(p,"stroke-linejoin","round"),a(f,"class","sy-assistant-action-button svelte-mrstki"),a(f,"aria-label",d=s[2]?"退出全屏":"全屏显示"),F(f,"active",s[2]),a(g,"class","sy-assistant-tooltip svelte-mrstki"),N(g,"z-index",((O=s[3].zIndex)!=null?O:1e3)+3),a(u,"class","sy-assistant-tooltip-wrapper svelte-mrstki"),a(_,"xmlns","http://www.w3.org/2000/svg"),a(_,"width","18"),a(_,"height","18"),a(_,"viewBox","0 0 24 24"),a(_,"fill","none"),a(_,"stroke","currentColor"),a(_,"stroke-width","2"),a(_,"stroke-linecap","round"),a(_,"stroke-linejoin","round"),a(y,"class","sy-assistant-action-button svelte-mrstki"),a(y,"aria-label",T=s[7]?"取消吸附":"吸附到边缘"),F(y,"active",s[7]),a(R,"class","sy-assistant-tooltip svelte-mrstki"),N(R,"z-index",((j=s[3].zIndex)!=null?j:1e3)+3),a(A,"class","sy-assistant-tooltip-wrapper svelte-mrstki"),a(M,"class","sy-assistant-close-button svelte-mrstki"),a(M,"aria-label","关闭助手"),a(fe,"class","sy-assistant-tooltip svelte-mrstki"),N(fe,"z-index",((pe=s[3].zIndex)!=null?pe:1e3)+3),a(G,"class","sy-assistant-tooltip-wrapper svelte-mrstki"),a(c,"class","sy-assistant-header-actions svelte-mrstki"),a(n,"class","sy-assistant-drawer-header svelte-mrstki"),a(n,"role","button"),a(n,"tabindex","0"),a(n,"aria-label","拖动助手窗口"),F(n,"dragging",s[6]),F(n,"fullscreen",s[2]),F(n,"snapped",s[7]),a(t,"class","sy-assistant-drawer-content svelte-mrstki"),a(e,"class","sy-assistant-drawer svelte-mrstki"),F(e,"fullscreen",s[2]),F(e,"screen-theme",s[3].theme==="screen"),N(e,"height",Ue)},m(O,j){q(O,e,j),w(e,t),w(t,n),w(n,i),w(i,l),w(n,r),w(n,c),w(c,u),w(u,f),w(f,p),Ee.m(p,null),w(u,m),w(u,g),w(g,I),w(c,x),w(c,A),w(A,y),w(y,_),Ae.m(_,null),w(A,E),w(A,R),w(R,L),w(c,Q),w(c,G),w(G,M),w(G,V),w(G,fe),w(t,se),D[ce].m(t,null),ue=!0,Ge||(Y=[Z(f,"click",s[16]),Z(y,"click",s[18]),Z(M,"click",s[15]),Z(n,"mousedown",os(s[17]))],Ge=!0)},p(O,j){var ye,Pe,Be;(!ue||j[0]&8)&&o!==(o=O[3].title+"")&&Fe(l,o),ie!==(ie=Ie(O))&&(Ee.d(1),Ee=ie(O),Ee&&(Ee.c(),Ee.m(p,null))),(!ue||j[0]&4&&d!==(d=O[2]?"退出全屏":"全屏显示"))&&a(f,"aria-label",d),(!ue||j[0]&4)&&F(f,"active",O[2]),(!ue||j[0]&4)&&k!==(k=O[2]?"退出全屏":"全屏显示")&&Fe(I,k),j[0]&8&&N(g,"z-index",((ye=O[3].zIndex)!=null?ye:1e3)+3),Oe!==(Oe=oe(O))&&(Ae.d(1),Ae=Oe(O),Ae&&(Ae.c(),Ae.m(_,null))),(!ue||j[0]&128&&T!==(T=O[7]?"取消吸附":"吸附到边缘"))&&a(y,"aria-label",T),(!ue||j[0]&128)&&F(y,"active",O[7]),(!ue||j[0]&128)&&C!==(C=O[7]?"取消吸附":"吸附到边缘")&&Fe(L,C),j[0]&8&&N(R,"z-index",((Pe=O[3].zIndex)!=null?Pe:1e3)+3),j[0]&8&&N(fe,"z-index",((Be=O[3].zIndex)!=null?Be:1e3)+3),(!ue||j[0]&64)&&F(n,"dragging",O[6]),(!ue||j[0]&4)&&F(n,"fullscreen",O[2]),(!ue||j[0]&128)&&F(n,"snapped",O[7]);let pe=ce;ce=le(O),ce===pe?D[ce].p(O,j):(Tn(),$e(D[pe],1,1,()=>{D[pe]=null}),vn(),be=D[ce],be?be.p(O,j):(be=D[ce]=Ze[ce](O),be.c()),qe(be,1),be.m(t,null)),(!ue||j[0]&4)&&F(e,"fullscreen",O[2]),(!ue||j[0]&8)&&F(e,"screen-theme",O[3].theme==="screen"),j[0]&8&&Ue!==(Ue=`${O[3].height}px`)&&N(e,"height",Ue)},i(O){ue||(qe(be),ue=!0)},o(O){$e(be),ue=!1},d(O){O&&B(e),Ee.d(),Ae.d(),D[ce].d(),Ge=!1,ge(Y)}}}function Tl(s){let e;return{c(){e=X("path"),a(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&&B(e)}}}function vl(s){let e;return{c(){e=X("path"),a(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&&B(e)}}}function Sl(s){let e,t;return{c(){e=X("rect"),t=X("line"),a(e,"x","3"),a(e,"y","3"),a(e,"width","18"),a(e,"height","18"),a(e,"rx","2"),a(e,"ry","2"),a(t,"x1","16"),a(t,"y1","6"),a(t,"x2","16"),a(t,"y2","18")},m(n,i){q(n,e,i),q(n,t,i)},d(n){n&&(B(e),B(t))}}}function El(s){let e,t;return{c(){e=X("rect"),t=X("rect"),a(e,"x","3"),a(e,"y","3"),a(e,"width","18"),a(e,"height","18"),a(e,"rx","2"),a(e,"ry","2"),a(t,"x","12"),a(t,"y","10"),a(t,"width","6"),a(t,"height","8"),a(t,"rx","1"),a(t,"ry","1")},m(n,i){q(n,e,i),q(n,t,i)},d(n){n&&(B(e),B(t))}}}function Al(s){var n,i,o,l,r,c,u,f,p;let e,t;return e=new yl({props:{zIndex:(n=s[3].zIndex)!=null?n:1e3,sessionId:s[9],hasScene:(i=s[3].hasScene)!=null?i:!1,apiPrefix:(o=s[3].apiPrefix)!=null?o:"/aiops/aigc",theme:(l=s[3].theme)!=null?l:"default",showHistory:(r=s[3].showHistory)!=null?r:!0,showActions:(c=s[3].showActions)!=null?c:!0,sendIcon:(u=s[3].sendIcon)!=null?u:"",robotIcon:(f=s[3].robotIcon)!=null?f:"",userIcon:(p=s[3].userIcon)!=null?p:""}}),{c(){Sn(e.$$.fragment)},m(d,m){$t(e,d,m),t=!0},p(d,m){var k,I,x,A,y,_,T,E,R;const g={};m[0]&8&&(g.zIndex=(k=d[3].zIndex)!=null?k:1e3),m[0]&512&&(g.sessionId=d[9]),m[0]&8&&(g.hasScene=(I=d[3].hasScene)!=null?I:!1),m[0]&8&&(g.apiPrefix=(x=d[3].apiPrefix)!=null?x:"/aiops/aigc"),m[0]&8&&(g.theme=(A=d[3].theme)!=null?A:"default"),m[0]&8&&(g.showHistory=(y=d[3].showHistory)!=null?y:!0),m[0]&8&&(g.showActions=(_=d[3].showActions)!=null?_:!0),m[0]&8&&(g.sendIcon=(T=d[3].sendIcon)!=null?T:""),m[0]&8&&(g.robotIcon=(E=d[3].robotIcon)!=null?E:""),m[0]&8&&(g.userIcon=(R=d[3].userIcon)!=null?R:""),e.$set(g)},i(d){t||(qe(e.$$.fragment,d),t=!0)},o(d){$e(e.$$.fragment,d),t=!1},d(d){en(e,d)}}}function Il(s){var n,i;let e,t;return e=new Js({props:{sessions:s[13],onClose:s[26],onSelect:Dl,zIndex:(n=s[3].zIndex)!=null?n:1e3,apiPrefix:(i=s[3].apiPrefix)!=null?i:"/aiops/aigc"}}),{c(){Sn(e.$$.fragment)},m(o,l){$t(e,o,l),t=!0},p(o,l){var c,u;const r={};l[0]&256&&(r.onClose=o[26]),l[0]&8&&(r.zIndex=(c=o[3].zIndex)!=null?c:1e3),l[0]&8&&(r.apiPrefix=(u=o[3].apiPrefix)!=null?u:"/aiops/aigc"),e.$set(r)},i(o){t||(qe(e.$$.fragment,o),t=!0)},o(o){$e(e.$$.fragment,o),t=!1},d(o){en(e,o)}}}function Rl(s){let e,t,n,i,o,l,r,c,u,f;return{c(){e=X("svg"),t=X("path"),n=X("path"),i=X("path"),o=X("path"),l=X("path"),r=X("path"),c=X("path"),a(t,"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"),a(t,"fill","#6F8698"),a(n,"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"),a(n,"fill","#3677FF"),a(i,"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"),a(i,"fill","#D0D5F1"),a(o,"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"),a(o,"fill","#3677FF"),a(l,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(l,"fill","#FFFFFF"),a(r,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(r,"fill","#FFFFFF"),a(c,"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"),a(c,"fill","#8896A4"),a(e,"class","sy-assistant-icon"),a(e,"viewBox","0 0 1024 1024"),a(e,"version","1.1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width",u=s[3].isSelf?void 0:s[3].iconWidth),a(e,"height",f=s[3].isSelf?void 0:s[3].iconHeight),a(e,"fill","currentColor"),a(e,"aria-label","助手图标")},m(p,d){q(p,e,d),w(e,t),w(e,n),w(e,i),w(e,o),w(e,l),w(e,r),w(e,c)},p(p,d){d[0]&8&&u!==(u=p[3].isSelf?void 0:p[3].iconWidth)&&a(e,"width",u),d[0]&8&&f!==(f=p[3].isSelf?void 0:p[3].iconHeight)&&a(e,"height",f)},d(p){p&&B(e)}}}function Ml(s){let e,t,n;function i(r,c){return c[0]&8&&(e=null),c[0]&8&&(t=null),e==null&&(e=!!(r[3].icon.startsWith("data:image")||r[3].icon.startsWith("data:image/svg+xml"))),e?Ll:(t==null&&(t=!!r[3].icon.includes("<svg")),t?Cl:xl)}let o=i(s,[-1,-1]),l=o(s);return{c(){l.c(),n=_t()},m(r,c){l.m(r,c),q(r,n,c)},p(r,c){o===(o=i(r,c))&&l?l.p(r,c):(l.d(1),l=o(r),l&&(l.c(),l.m(n.parentNode,n)))},d(r){r&&B(n),l.d(r)}}}function xl(s){let e,t,n,i,o,l,r,c,u,f;return{c(){e=X("svg"),t=X("path"),n=X("path"),i=X("path"),o=X("path"),l=X("path"),r=X("path"),c=X("path"),a(t,"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"),a(t,"fill","#6F8698"),a(n,"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"),a(n,"fill","#3677FF"),a(i,"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"),a(i,"fill","#D0D5F1"),a(o,"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"),a(o,"fill","#3677FF"),a(l,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(l,"fill","#FFFFFF"),a(r,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(r,"fill","#FFFFFF"),a(c,"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"),a(c,"fill","#8896A4"),a(e,"class","sy-assistant-icon"),a(e,"viewBox","0 0 1024 1024"),a(e,"version","1.1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width",u=s[3].isSelf?void 0:s[3].iconWidth),a(e,"height",f=s[3].isSelf?void 0:s[3].iconHeight),a(e,"fill","currentColor"),a(e,"aria-label","助手图标")},m(p,d){q(p,e,d),w(e,t),w(e,n),w(e,i),w(e,o),w(e,l),w(e,r),w(e,c)},p(p,d){d[0]&8&&u!==(u=p[3].isSelf?void 0:p[3].iconWidth)&&a(e,"width",u),d[0]&8&&f!==(f=p[3].isSelf?void 0:p[3].iconHeight)&&a(e,"height",f)},d(p){p&&B(e)}}}function Cl(s){let e,t=(s[3].isSelf?s[3].icon:s[3].icon.replace(/width="[^"]*"/,`width="${s[3].iconWidth}"`).replace(/height="[^"]*"/,`height="${s[3].iconHeight}"`))+"",n;return{c(){e=new Fi(!1),n=_t(),e.a=n},m(i,o){e.m(t,i,o),q(i,n,o)},p(i,o){o[0]&8&&t!==(t=(i[3].isSelf?i[3].icon:i[3].icon.replace(/width="[^"]*"/,`width="${i[3].iconWidth}"`).replace(/height="[^"]*"/,`height="${i[3].iconHeight}"`))+"")&&e.p(t)},d(i){i&&(B(n),e.d())}}}function Ll(s){let e,t,n;return{c(){e=S("img"),Ve(e.src,t=s[3].icon)||a(e,"src",t),a(e,"alt","助手图标"),a(e,"style",n=s[3].isSelf?"":`width: ${s[3].iconWidth}px; height: ${s[3].iconHeight}px;`)},m(i,o){q(i,e,o)},p(i,o){o[0]&8&&!Ve(e.src,t=i[3].icon)&&a(e,"src",t),o[0]&8&&n!==(n=i[3].isSelf?"":`width: ${i[3].iconWidth}px; height: ${i[3].iconHeight}px;`)&&a(e,"style",n)},d(i){i&&B(e)}}}function zl(s){let e,t,n=`${s[12]}px`,i,o,l,r,c,u,f=s[12]>0&&gi(s);function p(g,k){return g[3].icon?Ml:Rl}let d=p(s),m=d(s);return{c(){var g,k;e=S("div"),t=S("div"),f&&f.c(),i=W(),o=S("button"),m.c(),a(t,"class","sy-assistant-drawer-wrapper svelte-mrstki"),F(t,"fullscreen",s[2]),N(t,"width",n),a(o,"class","sy-assistant-floating-button svelte-mrstki"),a(o,"aria-label","打开助手"),a(o,"style",l=s[10]+" z-index: "+(((g=s[3].zIndex)!=null?g:1e3)+1)+"; "+s[19]()),F(o,"isSelf",s[3].isSelf),a(e,"class","sy-assistant-container sy-assistant-theme svelte-mrstki"),F(e,"fullscreen",s[2]),F(e,"snapped",s[7]),F(e,"screen-theme",s[3].theme==="screen"),N(e,"position",s[3].position),N(e,"right",s[7]?0:`${s[0]}px`),N(e,"bottom",s[7]?0:`${s[1]}px`),N(e,"top",s[7]||s[2]?"0":"auto"),N(e,"left",s[2]?"0":"auto"),N(e,"z-index",(k=s[3].zIndex)!=null?k:1e3)},m(g,k){q(g,e,k),w(e,t),f&&f.m(t,null),w(e,i),w(e,o),m.m(o,null),s[27](o),s[29](e),r=!0,c||(u=[Z(o,"click",s[15]),Z(o,"mousedown",os(s[28]))],c=!0)},p(g,k){var I,x;g[12]>0?f?(f.p(g,k),k[0]&4096&&qe(f,1)):(f=gi(g),f.c(),qe(f,1),f.m(t,null)):f&&(Tn(),$e(f,1,1,()=>{f=null}),vn()),(!r||k[0]&4)&&F(t,"fullscreen",g[2]),k[0]&4096&&n!==(n=`${g[12]}px`)&&N(t,"width",n),d===(d=p(g))&&m?m.p(g,k):(m.d(1),m=d(g),m&&(m.c(),m.m(o,null))),(!r||k[0]&1032&&l!==(l=g[10]+" z-index: "+(((I=g[3].zIndex)!=null?I:1e3)+1)+"; "+g[19]()))&&a(o,"style",l),(!r||k[0]&8)&&F(o,"isSelf",g[3].isSelf),(!r||k[0]&4)&&F(e,"fullscreen",g[2]),(!r||k[0]&128)&&F(e,"snapped",g[7]),(!r||k[0]&8)&&F(e,"screen-theme",g[3].theme==="screen"),k[0]&8&&N(e,"position",g[3].position),k[0]&129&&N(e,"right",g[7]?0:`${g[0]}px`),k[0]&130&&N(e,"bottom",g[7]?0:`${g[1]}px`),k[0]&132&&N(e,"top",g[7]||g[2]?"0":"auto"),k[0]&4&&N(e,"left",g[2]?"0":"auto"),k[0]&8&&N(e,"z-index",(x=g[3].zIndex)!=null?x:1e3)},i(g){r||(qe(f),r=!0)},o(g){$e(f),r=!1},d(g){g&&B(e),f&&f.d(),m.d(),s[27](null),s[29](null),c=!1,ge(u)}}}const Zn=48,_e=20;function Dl(s){}function Ol(s,e,t){let n,i,o,l,r=U,c=()=>(r(),r=zi(i,D=>t(12,l=D)),i);s.$$.on_destroy.push(()=>r());const u={position:"fixed",width:480,height:800,title:"智慧运维助手",initialState:"default",defaultPosition:{right:_e,bottom:_e},snappedWidth:480,drawerWidth:480,zIndex:1e3,hasScene:!1,apiPrefix:"/aiops/aigc",isSelf:!1,icon:"",iconWidth:void 0,iconHeight:void 0,theme:"default",showHistory:!0,showActions:!0,sendIcon:"",robotIcon:"",userIcon:""};let{target:f="body"}=e,{options:p={}}=e,d,m=null,g=!1,k,I=!1,x=0,A=0,y=_e,_=20,T=y,E=_,R=!1,C=_e,L=50,Q=!1,G={width:0},M=!1,V=!1,fe=[],se=null;function ce(){return Ce(this,null,function*(){try{const D=yield fetch(`${n.apiPrefix}/chat/getSessionId`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${we()}`,Authorization:`bearer ${we()}`}});if(!D.ok)throw new Error("Failed to get session ID");const le=yield D.json();if(le.code===0)return t(9,se=le.data.sessionId),se;throw new Error(le.message||"Failed to get session ID")}catch(D){return console.error("Failed to get session ID:",D),null}})}function be(D,le=!1){le?t(23,R=!0):t(6,I=!0),x=D.clientX,A=D.clientY,y=le?C:T,_=le?L:E,D.preventDefault()}function Ue(D){if(!I&&!R)return;const le=x-D.clientX,O=A-D.clientY;if(R){const j=y+le,pe=D.clientY;t(24,C=Math.max(_e,Math.min(window.innerWidth-Zn-_e,j)));const ye=window.innerHeight-Zn-_e,Be=Math.max(_e,Math.min(ye,pe));t(25,L=(window.innerHeight-Be-Zn)/window.innerHeight*100)}else{const j=n.width||0,pe=n.height||0,ye=y+le;t(0,T=Math.max(_e,Math.min(window.innerWidth-j-_e,ye)));const Pe=_+O;t(1,E=Math.max(_e,Math.min(window.innerHeight-pe-_e,Pe)))}}function ue(){t(6,I=!1),t(23,R=!1)}kn(()=>{typeof f=="string"?m=document.querySelector(f)||document.body:m=f||document.body;const D=O=>Ue(O),le=()=>ue();return document.addEventListener("mousemove",D),document.addEventListener("mouseup",le),d&&m&&m.appendChild(d),k&&k.getBoundingClientRect().left,t(7,M=n.initialState==="snapped"),t(2,Q=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,T=0),t(1,E=0),t(3,n=ve(re({},n),{height:typeof window!="undefined"?window.innerHeight:n.height,width:n.snappedWidth||n.width}))):n.initialState==="fullscreen"&&(t(0,T=0),t(1,E=0),t(3,n=ve(re({},n),{width:typeof window!="undefined"?window.innerWidth:n.width,height:typeof window!="undefined"?window.innerHeight:n.height}))),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",le),m&&d&&m.removeChild(d)}});function Ge(){return Ce(this,null,function*(){g||(yield ce()),t(22,g=!g)})}function Y(){var D,le,O,j,pe,ye,Pe,Be;t(2,Q=!Q),Q?(G.width||(G={width:u.width,height:u.height,right:(le=(D=u.defaultPosition)==null?void 0:D.right)!=null?le:_e,bottom:(j=(O=u.defaultPosition)==null?void 0:O.bottom)!=null?j:_e}),M&&t(7,M=!1),t(20,p=ve(re({},n),{width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth})),t(0,T=0),t(1,E=0)):(t(20,p=ve(re({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,T=(ye=(pe=u.defaultPosition)==null?void 0:pe.right)!=null?ye:_e),t(1,E=(Be=(Pe=u.defaultPosition)==null?void 0:Pe.bottom)!=null?Be:_e))}function Ie(D){Q||be(D)}function ie(){var D,le,O,j;Q&&(t(2,Q=!1),t(20,p=ve(re({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth}))),t(7,M=!M),M?(n.height,t(0,T=0),t(1,E=0),t(20,p=ve(re({},n),{height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width}))):(t(20,p=ve(re({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,T=(le=(D=u.defaultPosition)==null?void 0:D.right)!=null?le:_e),t(1,E=(j=(O=u.defaultPosition)==null?void 0:O.bottom)!=null?j:_e))}function Ee(){return n.isSelf?n.iconWidth!==void 0&&n.iconHeight!==void 0?`width: ${n.iconWidth}px; height: ${n.iconHeight}px;`:"":n.iconWidth!==void 0&&n.iconHeight!==void 0?`width: ${n.iconWidth}px; height: ${n.iconHeight}px;`:"width: 48px; height: 48px;"}const oe=()=>t(8,V=!1);function Oe(D){zt[D?"unshift":"push"](()=>{k=D,t(5,k)})}const Ae=D=>be(D,!0);function Ze(D){zt[D?"unshift":"push"](()=>{d=D,t(4,d)})}return s.$$set=D=>{"target"in D&&t(21,f=D.target),"options"in D&&t(20,p=D.options)},s.$$.update=()=>{s.$$.dirty[0]&1048576&&t(3,n=ve(re(re({},u),p),{defaultPosition:re(re({},u.defaultPosition),p.defaultPosition)})),s.$$.dirty[0]&4194316&&c(t(11,i=Vi(g?Q?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),s.$$.dirty[0]&11&&typeof window!="undefined"&&(t(0,T=Math.max(_e,Math.min(window.innerWidth-(n.width||0),T))),t(1,E=Math.max(_e,Math.min(window.innerHeight-(n.height||0),E)))),s.$$.dirty[0]&62914560&&t(10,o=g?"display: none;":`position: fixed; right: ${C}px; bottom: ${L}%; transform: none; cursor: ${R?"grabbing":"grab"};`)},[T,E,Q,n,d,k,I,M,V,se,o,i,l,fe,be,Ge,Y,Ie,ie,Ee,p,f,g,R,C,L,oe,Oe,Ae,Ze]}class Pl extends An{constructor(e){super(),En(this,e,Ol,zl,gt,{target:21,options:20},null,[-1,-1])}}ee.SyAssistant=Pl,Object.defineProperty(ee,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 s=_i(e);if(s===null)return n;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image(e,t,n){const s=_i(e);if(s===null)return n;e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">",o}text(e){return e}}class Fn{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 st{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||vt,this.options.renderer=this.options.renderer||new pn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Fn}static parse(e,t){return new st(t).parse(e)}static parseInline(e,t){return new st(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const o=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){const l=o,r=this.options.extensions.renderers[l.type].call({parser:this},l);if(r!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){n+=r||"";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,ao(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 r="",c="";for(let u=0;u<l.header.length;u++)c+=this.renderer.tablecell(this.parseInline(l.header[u].tokens),{header:!0,align:l.align[u]});r+=this.renderer.tablerow(c);let f="";for(let u=0;u<l.rows.length;u++){const m=l.rows[u];c="";for(let d=0;d<m.length;d++)c+=this.renderer.tablecell(this.parseInline(m[d].tokens),{header:!1,align:l.align[d]});f+=this.renderer.tablerow(c)}n+=this.renderer.table(r,f);continue}case"blockquote":{const l=o,r=this.parse(l.tokens);n+=this.renderer.blockquote(r);continue}case"list":{const l=o,r=l.ordered,c=l.start,f=l.loose;let u="";for(let m=0;m<l.items.length;m++){const d=l.items[m],p=d.checked,g=d.task;let _="";if(d.task){const I=this.renderer.checkbox(!!p);f?d.tokens.length>0&&d.tokens[0].type==="paragraph"?(d.tokens[0].text=I+" "+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=I+" "+d.tokens[0].tokens[0].text)):d.tokens.unshift({type:"text",text:I+" "}):_+=I+" "}_+=this.parse(d.tokens,f),u+=this.renderer.listitem(_,g,!!p)}n+=this.renderer.list(u,r,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,r=l.tokens?this.parseInline(l.tokens):l.text;for(;s+1<e.length&&e[s+1].type==="text";)l=e[++s],r+=`
45
+ `+(l.tokens?this.parseInline(l.tokens):l.text);n+=t?this.renderer.paragraph(r):r;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 s=0;s<e.length;s++){const o=e[s];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){ne(this,"options");this.options=e||vt}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}ne(Zt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class No{constructor(...e){xs(this,Et);ne(this,"defaults",Cn());ne(this,"options",this.setOptions);ne(this,"parse",bn(this,Et,Kn).call(this,it.lex,st.parse));ne(this,"parseInline",bn(this,Et,Kn).call(this,it.lexInline,st.parseInline));ne(this,"Parser",st);ne(this,"Renderer",pn);ne(this,"TextRenderer",Fn);ne(this,"Lexer",it);ne(this,"Tokenizer",un);ne(this,"Hooks",Zt);this.use(...e)}walkTokens(e,t){var s,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const r=l;for(const c of r.header)n=n.concat(this.walkTokens(c.tokens,t));for(const c of r.rows)for(const f of c)n=n.concat(this.walkTokens(f.tokens,t));break}case"list":{const r=l;n=n.concat(this.walkTokens(r.items,t));break}default:{const r=l;(o=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&o[r.type]?this.defaults.extensions.childTokens[r.type].forEach(c=>{const f=r[c].flat(1/0);n=n.concat(this.walkTokens(f,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s=ue({},n);if(s.async=this.defaults.async||s.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(...r){let c=o.renderer.apply(this,r);return c===!1&&(c=l.apply(this,r)),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)}),s.extensions=t),n.renderer){const o=this.defaults.renderer||new pn(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 r=l,c=n.renderer[r],f=o[r];o[r]=(...u)=>{let m=c.apply(o,u);return m===!1&&(m=f.apply(o,u)),m||""}}s.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new un(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 r=l,c=n.tokenizer[r],f=o[r];o[r]=(...u)=>{let m=c.apply(o,u);return m===!1&&(m=f.apply(o,u)),m}}s.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 r=l,c=n.hooks[r],f=o[r];Zt.passThroughHooks.has(l)?o[r]=u=>{if(this.defaults.async)return Promise.resolve(c.call(o,u)).then(d=>f.call(o,d));const m=c.call(o,u);return f.call(o,m)}:o[r]=(...u)=>{let m=c.apply(o,u);return m===!1&&(m=f.apply(o,u)),m}}s.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;s.walkTokens=function(r){let c=[];return c.push(l.call(this,r)),o&&(c=c.concat(o.call(this,r))),c}}this.defaults=ue(ue({},this.defaults),s)}),this}setOptions(e){return this.defaults=ue(ue({},this.defaults),e),this}lexer(e,t){return it.lex(e,t!=null?t:this.defaults)}parser(e,t){return st.parse(e,t!=null?t:this.defaults)}}Et=new WeakSet,Kn=function(e,t){return(n,s)=>{const o=ue({},s),l=ue(ue({},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 r=bn(this,Et,zs).call(this,!!l.silent,!!l.async);if(typeof n=="undefined"||n===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return r(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(r);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 f=t(c,l);return l.hooks&&(f=l.hooks.postprocess(f)),f}catch(c){return r(c)}}},zs=function(e,t){return n=>{if(n.message+=`
46
+ Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+Ze(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}};const St=new No;function oe(i,e){return St.parse(i,e)}oe.options=oe.setOptions=function(i){return St.setOptions(i),oe.defaults=St.defaults,pi(oe.defaults),oe},oe.getDefaults=Cn,oe.defaults=vt,oe.use=function(...i){return St.use(...i),oe.defaults=St.defaults,pi(oe.defaults),oe},oe.walkTokens=function(i,e){return St.walkTokens(i,e)},oe.parseInline=St.parseInline,oe.Parser=st,oe.parser=st.parse,oe.Renderer=pn,oe.TextRenderer=Fn,oe.Lexer=it,oe.lexer=it.lex,oe.Tokenizer=un,oe.Hooks=Zt,oe.parse=oe,oe.options,oe.setOptions,oe.use,oe.walkTokens,oe.parseInline,st.parse,it.lex;/*! @license DOMPurify 3.2.6 | (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.6/LICENSE */const{entries:Mi,setPrototypeOf:Ci,isFrozen:Ho,getPrototypeOf:qo,getOwnPropertyDescriptor:Bo}=Object;let{freeze:Fe,seal:Qe,create:Li}=Object,{apply:Nn,construct:Hn}=typeof Reflect!="undefined"&&Reflect;Fe||(Fe=function(e){return e}),Qe||(Qe=function(e){return e}),Nn||(Nn=function(e,t,n){return e.apply(t,n)}),Hn||(Hn=function(e,t){return new e(...t)});const mn=He(Array.prototype.forEach),jo=He(Array.prototype.lastIndexOf),xi=He(Array.prototype.pop),Yt=He(Array.prototype.push),Uo=He(Array.prototype.splice),gn=He(String.prototype.toLowerCase),qn=He(String.prototype.toString),zi=He(String.prototype.match),Xt=He(String.prototype.replace),Wo=He(String.prototype.indexOf),Go=He(String.prototype.trim),$e=He(Object.prototype.hasOwnProperty),Ne=He(RegExp.prototype.test),Vt=Zo(TypeError);function He(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Nn(i,e,n)}}function Zo(i){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Hn(i,t)}}function Q(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:gn;Ci&&Ci(i,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const o=t(s);o!==s&&(Ho(e)||(e[n]=o),s=o)}i[s]=!0}return i}function Yo(i){for(let e=0;e<i.length;e++)$e(i,e)||(i[e]=null);return i}function ft(i){const e=Li(null);for(const[t,n]of Mi(i))$e(i,t)&&(Array.isArray(n)?e[t]=Yo(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=ft(n):e[t]=n);return e}function Qt(i,e){for(;i!==null;){const n=Bo(i,e);if(n){if(n.get)return He(n.get);if(typeof n.value=="function")return He(n.value)}i=qo(i)}function t(){return null}return t}const Di=Fe(["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"]),Bn=Fe(["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"]),jn=Fe(["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"]),Xo=Fe(["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"]),Un=Fe(["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"]),Vo=Fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Oi=Fe(["#text"]),Pi=Fe(["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"]),Wn=Fe(["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"]),Fi=Fe(["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"]),wn=Fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Qo=Qe(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Jo=Qe(/<%[\w\W]*|[\w\W]*%>/gm),Ko=Qe(/\$\{[\w\W]*/gm),$o=Qe(/^data-[\-\w.\u00B7-\uFFFF]+$/),el=Qe(/^aria-[\-\w]+$/),Ni=Qe(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tl=Qe(/^(?:\w+script|data):/i),nl=Qe(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Hi=Qe(/^html$/i),il=Qe(/^[a-z][.\w]*(-[.\w]+)+$/i);var qi=Object.freeze({__proto__:null,ARIA_ATTR:el,ATTR_WHITESPACE:nl,CUSTOM_ELEMENT:il,DATA_ATTR:$o,DOCTYPE_NAME:Hi,ERB_EXPR:Jo,IS_ALLOWED_URI:Ni,IS_SCRIPT_OR_DATA:tl,MUSTACHE_EXPR:Qo,TMPLIT_EXPR:Ko});const Jt={element:1,text:3,progressingInstruction:7,comment:8,document:9},sl=function(){return typeof window=="undefined"?null:window},ol=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(n=t.getAttribute(s));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}},Bi=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ji(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sl();const e=P=>ji(P);if(e.version="3.2.6",e.removed=[],!i||!i.document||i.document.nodeType!==Jt.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const n=t,s=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:r,Element:c,NodeFilter:f,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:m,DOMParser:d,trustedTypes:p}=i,g=c.prototype,_=Qt(g,"cloneNode"),I=Qt(g,"remove"),M=Qt(g,"nextSibling"),R=Qt(g,"childNodes"),y=Qt(g,"parentNode");if(typeof l=="function"){const P=t.createElement("template");P.content&&P.content.ownerDocument&&(t=P.content.ownerDocument)}let b,E="";const{implementation:A,createNodeIterator:S,createDocumentFragment:C,getElementsByTagName:L}=t,{importNode:ee}=n;let B=Bi();e.isSupported=typeof Mi=="function"&&typeof y=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:Y,TMPLIT_EXPR:le,DATA_ATTR:se,ARIA_ATTR:K,IS_SCRIPT_OR_DATA:de,ATTR_WHITESPACE:Ye,CUSTOM_ELEMENT:te}=qi;let{IS_ALLOWED_URI:Je}=qi,Z=null;const Ae=Q({},[...Di,...Bn,...jn,...Un,...Oi]);let ae=null;const ve=Q({},[...Pi,...Wn,...Fi,...wn]);let ce=Object.seal(Li(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}})),qe=null,ke=null,Be=!0,we=!0,et=!1,U=!0,X=!1,Ie=!0,Ue=!1,ot=!1,lt=!1,rt=!1,bt=!1,kt=!1,yt=!0,Ot=!1;const Kt="user-content-";let At=!0,ht=!1,at={},x=null;const $=Q({},["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 pe=null;const Se=Q({},["audio","video","img","source","image","track"]);let Ce=null;const Le=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xe="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",je="http://www.w3.org/1999/xhtml";let Ke=je,$t=!1,en=null;const Yn=Q({},[xe,Xe,je],qn);let k=Q({},["mi","mo","mn","ms","mtext"]),N=Q({},["annotation-xml"]);const re=Q({},["title","style","font","a","script"]);let _e=null;const Te=["application/xhtml+xml","text/html"],ze="text/html";let J=null,tt=null;const dt=t.createElement("form"),_s=function(h){return h instanceof RegExp||h instanceof Function},Xn=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(tt&&tt===h)){if((!h||typeof h!="object")&&(h={}),h=ft(h),_e=Te.indexOf(h.PARSER_MEDIA_TYPE)===-1?ze:h.PARSER_MEDIA_TYPE,J=_e==="application/xhtml+xml"?qn:gn,Z=$e(h,"ALLOWED_TAGS")?Q({},h.ALLOWED_TAGS,J):Ae,ae=$e(h,"ALLOWED_ATTR")?Q({},h.ALLOWED_ATTR,J):ve,en=$e(h,"ALLOWED_NAMESPACES")?Q({},h.ALLOWED_NAMESPACES,qn):Yn,Ce=$e(h,"ADD_URI_SAFE_ATTR")?Q(ft(Le),h.ADD_URI_SAFE_ATTR,J):Le,pe=$e(h,"ADD_DATA_URI_TAGS")?Q(ft(Se),h.ADD_DATA_URI_TAGS,J):Se,x=$e(h,"FORBID_CONTENTS")?Q({},h.FORBID_CONTENTS,J):$,qe=$e(h,"FORBID_TAGS")?Q({},h.FORBID_TAGS,J):ft({}),ke=$e(h,"FORBID_ATTR")?Q({},h.FORBID_ATTR,J):ft({}),at=$e(h,"USE_PROFILES")?h.USE_PROFILES:!1,Be=h.ALLOW_ARIA_ATTR!==!1,we=h.ALLOW_DATA_ATTR!==!1,et=h.ALLOW_UNKNOWN_PROTOCOLS||!1,U=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,X=h.SAFE_FOR_TEMPLATES||!1,Ie=h.SAFE_FOR_XML!==!1,Ue=h.WHOLE_DOCUMENT||!1,rt=h.RETURN_DOM||!1,bt=h.RETURN_DOM_FRAGMENT||!1,kt=h.RETURN_TRUSTED_TYPE||!1,lt=h.FORCE_BODY||!1,yt=h.SANITIZE_DOM!==!1,Ot=h.SANITIZE_NAMED_PROPS||!1,At=h.KEEP_CONTENT!==!1,ht=h.IN_PLACE||!1,Je=h.ALLOWED_URI_REGEXP||Ni,Ke=h.NAMESPACE||je,k=h.MATHML_TEXT_INTEGRATION_POINTS||k,N=h.HTML_INTEGRATION_POINTS||N,ce=h.CUSTOM_ELEMENT_HANDLING||{},h.CUSTOM_ELEMENT_HANDLING&&_s(h.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=h.CUSTOM_ELEMENT_HANDLING.tagNameCheck),h.CUSTOM_ELEMENT_HANDLING&&_s(h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=h.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=h.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(we=!1),bt&&(rt=!0),at&&(Z=Q({},Oi),ae=[],at.html===!0&&(Q(Z,Di),Q(ae,Pi)),at.svg===!0&&(Q(Z,Bn),Q(ae,Wn),Q(ae,wn)),at.svgFilters===!0&&(Q(Z,jn),Q(ae,Wn),Q(ae,wn)),at.mathMl===!0&&(Q(Z,Un),Q(ae,Fi),Q(ae,wn))),h.ADD_TAGS&&(Z===Ae&&(Z=ft(Z)),Q(Z,h.ADD_TAGS,J)),h.ADD_ATTR&&(ae===ve&&(ae=ft(ae)),Q(ae,h.ADD_ATTR,J)),h.ADD_URI_SAFE_ATTR&&Q(Ce,h.ADD_URI_SAFE_ATTR,J),h.FORBID_CONTENTS&&(x===$&&(x=ft(x)),Q(x,h.FORBID_CONTENTS,J)),At&&(Z["#text"]=!0),Ue&&Q(Z,["html","head","body"]),Z.table&&(Q(Z,["tbody"]),delete qe.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=h.TRUSTED_TYPES_POLICY,E=b.createHTML("")}else b===void 0&&(b=ol(p,s)),b!==null&&typeof E=="string"&&(E=b.createHTML(""));Fe&&Fe(h),tt=h}},bs=Q({},[...Bn,...jn,...Xo]),ks=Q({},[...Un,...Vo]),Fl=function(h){let T=y(h);(!T||!T.tagName)&&(T={namespaceURI:Ke,tagName:"template"});const O=gn(h.tagName),me=gn(T.tagName);return en[h.namespaceURI]?h.namespaceURI===Xe?T.namespaceURI===je?O==="svg":T.namespaceURI===xe?O==="svg"&&(me==="annotation-xml"||k[me]):!!bs[O]:h.namespaceURI===xe?T.namespaceURI===je?O==="math":T.namespaceURI===Xe?O==="math"&&N[me]:!!ks[O]:h.namespaceURI===je?T.namespaceURI===Xe&&!N[me]||T.namespaceURI===xe&&!k[me]?!1:!ks[O]&&(re[O]||!bs[O]):!!(_e==="application/xhtml+xml"&&en[h.namespaceURI]):!1},ct=function(h){Yt(e.removed,{element:h});try{y(h).removeChild(h)}catch(T){I(h)}},Pt=function(h,T){try{Yt(e.removed,{attribute:T.getAttributeNode(h),from:T})}catch(O){Yt(e.removed,{attribute:null,from:T})}if(T.removeAttribute(h),h==="is")if(rt||bt)try{ct(T)}catch(O){}else try{T.setAttribute(h,"")}catch(O){}},ys=function(h){let T=null,O=null;if(lt)h="<remove></remove>"+h;else{const Ee=zi(h,/^[\r\n\t ]+/);O=Ee&&Ee[0]}_e==="application/xhtml+xml"&&Ke===je&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const me=b?b.createHTML(h):h;if(Ke===je)try{T=new d().parseFromString(me,_e)}catch(Ee){}if(!T||!T.documentElement){T=A.createDocument(Ke,"template",null);try{T.documentElement.innerHTML=$t?E:me}catch(Ee){}}const De=T.body||T.documentElement;return h&&O&&De.insertBefore(t.createTextNode(O),De.childNodes[0]||null),Ke===je?L.call(T,Ue?"html":"body")[0]:Ue?T.documentElement:De},Ts=function(h){return S.call(h.ownerDocument||h,h,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Vn=function(h){return h instanceof m&&(typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||!(h.attributes instanceof u)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function")},vs=function(h){return typeof r=="function"&&h instanceof r};function pt(P,h,T){mn(P,O=>{O.call(e,h,T,tt)})}const Ss=function(h){let T=null;if(pt(B.beforeSanitizeElements,h,null),Vn(h))return ct(h),!0;const O=J(h.nodeName);if(pt(B.uponSanitizeElement,h,{tagName:O,allowedTags:Z}),Ie&&h.hasChildNodes()&&!vs(h.firstElementChild)&&Ne(/<[/\w!]/g,h.innerHTML)&&Ne(/<[/\w!]/g,h.textContent)||h.nodeType===Jt.progressingInstruction||Ie&&h.nodeType===Jt.comment&&Ne(/<[/\w]/g,h.data))return ct(h),!0;if(!Z[O]||qe[O]){if(!qe[O]&&As(O)&&(ce.tagNameCheck instanceof RegExp&&Ne(ce.tagNameCheck,O)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(O)))return!1;if(At&&!x[O]){const me=y(h)||h.parentNode,De=R(h)||h.childNodes;if(De&&me){const Ee=De.length;for(let We=Ee-1;We>=0;--We){const mt=_(De[We],!0);mt.__removalCount=(h.__removalCount||0)+1,me.insertBefore(mt,M(h))}}}return ct(h),!0}return h instanceof c&&!Fl(h)||(O==="noscript"||O==="noembed"||O==="noframes")&&Ne(/<\/no(script|embed|frames)/i,h.innerHTML)?(ct(h),!0):(X&&h.nodeType===Jt.text&&(T=h.textContent,mn([z,Y,le],me=>{T=Xt(T,me," ")}),h.textContent!==T&&(Yt(e.removed,{element:h.cloneNode()}),h.textContent=T)),pt(B.afterSanitizeElements,h,null),!1)},Es=function(h,T,O){if(yt&&(T==="id"||T==="name")&&(O in t||O in dt))return!1;if(!(we&&!ke[T]&&Ne(se,T))){if(!(Be&&Ne(K,T))){if(!ae[T]||ke[T]){if(!(As(h)&&(ce.tagNameCheck instanceof RegExp&&Ne(ce.tagNameCheck,h)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(h))&&(ce.attributeNameCheck instanceof RegExp&&Ne(ce.attributeNameCheck,T)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(T))||T==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Ne(ce.tagNameCheck,O)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(O))))return!1}else if(!Ce[T]){if(!Ne(Je,Xt(O,Ye,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&h!=="script"&&Wo(O,"data:")===0&&pe[h])){if(!(et&&!Ne(de,Xt(O,Ye,"")))){if(O)return!1}}}}}}return!0},As=function(h){return h!=="annotation-xml"&&zi(h,te)},Is=function(h){pt(B.beforeSanitizeAttributes,h,null);const{attributes:T}=h;if(!T||Vn(h))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0};let me=T.length;for(;me--;){const De=T[me],{name:Ee,namespaceURI:We,value:mt}=De,tn=J(Ee),Qn=mt;let Oe=Ee==="value"?Qn:Go(Qn);if(O.attrName=tn,O.attrValue=Oe,O.keepAttr=!0,O.forceKeepAttr=void 0,pt(B.uponSanitizeAttribute,h,O),Oe=O.attrValue,Ot&&(tn==="id"||tn==="name")&&(Pt(Ee,h),Oe=Kt+Oe),Ie&&Ne(/((--!?|])>)|<\/(style|title)/i,Oe)){Pt(Ee,h);continue}if(O.forceKeepAttr)continue;if(!O.keepAttr){Pt(Ee,h);continue}if(!U&&Ne(/\/>/i,Oe)){Pt(Ee,h);continue}X&&mn([z,Y,le],Ms=>{Oe=Xt(Oe,Ms," ")});const Rs=J(h.nodeName);if(!Es(Rs,tn,Oe)){Pt(Ee,h);continue}if(b&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!We)switch(p.getAttributeType(Rs,tn)){case"TrustedHTML":{Oe=b.createHTML(Oe);break}case"TrustedScriptURL":{Oe=b.createScriptURL(Oe);break}}if(Oe!==Qn)try{We?h.setAttributeNS(We,Ee,Oe):h.setAttribute(Ee,Oe),Vn(h)?ct(h):xi(e.removed)}catch(Ms){Pt(Ee,h)}}pt(B.afterSanitizeAttributes,h,null)},Nl=function P(h){let T=null;const O=Ts(h);for(pt(B.beforeSanitizeShadowDOM,h,null);T=O.nextNode();)pt(B.uponSanitizeShadowNode,T,null),Ss(T),Is(T),T.content instanceof o&&P(T.content);pt(B.afterSanitizeShadowDOM,h,null)};return e.sanitize=function(P){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,O=null,me=null,De=null;if($t=!P,$t&&(P="<!-->"),typeof P!="string"&&!vs(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw Vt("dirty is not a string, aborting")}else throw Vt("toString is not a function");if(!e.isSupported)return P;if(ot||Xn(h),e.removed=[],typeof P=="string"&&(ht=!1),ht){if(P.nodeName){const mt=J(P.nodeName);if(!Z[mt]||qe[mt])throw Vt("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof r)T=ys("<!---->"),O=T.ownerDocument.importNode(P,!0),O.nodeType===Jt.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?T=O:T.appendChild(O);else{if(!rt&&!X&&!Ue&&P.indexOf("<")===-1)return b&&kt?b.createHTML(P):P;if(T=ys(P),!T)return rt?null:kt?E:""}T&&lt&&ct(T.firstChild);const Ee=Ts(ht?P:T);for(;me=Ee.nextNode();)Ss(me),Is(me),me.content instanceof o&&Nl(me.content);if(ht)return P;if(rt){if(bt)for(De=C.call(T.ownerDocument);T.firstChild;)De.appendChild(T.firstChild);else De=T;return(ae.shadowroot||ae.shadowrootmode)&&(De=ee.call(n,De,!0)),De}let We=Ue?T.outerHTML:T.innerHTML;return Ue&&Z["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Ne(Hi,T.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
47
+ `+We),X&&mn([z,Y,le],mt=>{We=Xt(We,mt," ")}),b&&kt?b.createHTML(We):We},e.setConfig=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xn(P),ot=!0},e.clearConfig=function(){tt=null,ot=!1},e.isValidAttribute=function(P,h,T){tt||Xn({});const O=J(P),me=J(h);return Es(O,me,T)},e.addHook=function(P,h){typeof h=="function"&&Yt(B[P],h)},e.removeHook=function(P,h){if(h!==void 0){const T=jo(B[P],h);return T===-1?void 0:Uo(B[P],T,1)[0]}return xi(B[P])},e.removeHooks=function(P){B[P]=[]},e.removeAllHooks=function(){B=Bi()},e}var Ui=ji();function Wi(i){var n;if(typeof document=="undefined")return null;const t=`; ${document.cookie}`.split(`; ${i}=`);return t.length===2&&((n=t.pop())==null?void 0:n.split(";").shift())||null}const ye=()=>{if(typeof window=="undefined")return null;const i=Wi("access_token");if(i)return i;const e=Wi("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 Gi(i,e,t){const n=i.slice();return n[25]=e[t],n}function Zi(i){let e,t=i[9].text+"",n;return{c(){e=v("div"),n=Me(t),a(e,"class","sy-assistant-button-tooltip svelte-1g6fj9a"),F(e,"left",i[9].x+"px"),F(e,"top",i[9].y+"px"),F(e,"z-index",i[3]+3)},m(s,o){q(s,e,o),w(e,n)},p(s,o){o&512&&t!==(t=s[9].text+"")&&Ge(n,t),o&512&&F(e,"left",s[9].x+"px"),o&512&&F(e,"top",s[9].y+"px"),o&8&&F(e,"z-index",s[3]+3)},d(s){s&&H(e)}}}function ll(i){let e=[],t=new Map,n,s,o=_t(i[0]);const l=c=>c[25].sessionId;for(let c=0;c<o.length;c+=1){let f=Gi(i,o,c),u=l(f);t.set(u,e[c]=Yi(u,f))}let r=i[5]&&Xi();return{c(){for(let c=0;c<e.length;c+=1)e[c].c();n=G(),r&&r.c(),s=Mt()},m(c,f){for(let u=0;u<e.length;u+=1)e[u]&&e[u].m(c,f);q(c,n,f),r&&r.m(c,f),q(c,s,f)},p(c,f){f&8261&&(o=_t(c[0]),e=ui(e,f,l,1,c,o,t,n.parentNode,ci,Yi,n,Gi)),c[5]?r||(r=Xi(),r.c(),r.m(s.parentNode,s)):r&&(r.d(1),r=null)},d(c){c&&(H(n),H(s));for(let f=0;f<e.length;f+=1)e[f].d(c);r&&r.d(c)}}}function rl(i){let e,t=i[4]?"未找到相关会话":i[5]?"加载中...":"暂无历史会话",n;return{c(){e=v("div"),n=Me(t),a(e,"class","sy-session-empty svelte-1g6fj9a")},m(s,o){q(s,e,o),w(e,n)},p(s,o){o&48&&t!==(t=s[4]?"未找到相关会话":s[5]?"加载中...":"暂无历史会话")&&Ge(n,t)},d(s){s&&H(e)}}}function Yi(i,e){let t,n,s,o,l=e[25].title+"",r,c,f,u=Qi(e[25].timestamp)+"",m,d,p,g,_,I,M,R,y,b,E;function A(){return e[18](e[25])}function S(...C){return e[19](e[25],...C)}return{key:i,first:null,c(){t=v("div"),n=v("button"),s=v("div"),o=v("div"),r=Me(l),c=G(),f=v("div"),m=Me(u),d=G(),p=v("button"),g=V("svg"),_=V("path"),I=V("path"),M=V("path"),a(o,"class","sy-session-title svelte-1g6fj9a"),a(f,"class","sy-session-time svelte-1g6fj9a"),a(s,"class","sy-session-info svelte-1g6fj9a"),a(n,"class","sy-session-select svelte-1g6fj9a"),a(_,"d","M3 6h18"),a(I,"d","M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"),a(M,"d","M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"),a(g,"xmlns","http://www.w3.org/2000/svg"),a(g,"width","16"),a(g,"height","16"),a(g,"viewBox","0 0 24 24"),a(g,"fill","none"),a(g,"stroke","currentColor"),a(g,"stroke-width","2"),a(g,"stroke-linecap","round"),a(g,"stroke-linejoin","round"),a(p,"class","sy-session-delete svelte-1g6fj9a"),p.disabled=R=e[6]===e[25].sessionId,a(p,"aria-label","删除会话"),a(t,"class","sy-session-item svelte-1g6fj9a"),a(t,"data-session-id",y=e[25].sessionId),D(t,"deleting",e[25].deleting),this.first=t},m(C,L){q(C,t,L),w(t,n),w(n,s),w(s,o),w(o,r),w(s,c),w(s,f),w(f,m),w(t,d),w(t,p),w(p,g),w(g,_),w(g,I),w(g,M),b||(E=[W(n,"click",A),W(p,"click",S)],b=!0)},p(C,L){e=C,L&1&&l!==(l=e[25].title+"")&&Ge(r,l),L&1&&u!==(u=Qi(e[25].timestamp)+"")&&Ge(m,u),L&65&&R!==(R=e[6]===e[25].sessionId)&&(p.disabled=R),L&1&&y!==(y=e[25].sessionId)&&a(t,"data-session-id",y),L&1&&D(t,"deleting",e[25].deleting)},d(C){C&&H(t),b=!1,be(E)}}}function Xi(i){let e;return{c(){e=v("div"),e.innerHTML='<span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span> <span class="loading-dot svelte-1g6fj9a"></span>',a(e,"class","sy-session-loading svelte-1g6fj9a")},m(t,n){q(t,e,n)},d(t){t&&H(e)}}}function Vi(i){let e,t,n,s,o,l,r,c,f;return{c(){e=v("div"),t=v("div"),t.textContent="确认删除此会话?",n=G(),s=v("div"),o=v("button"),o.textContent="取消",l=G(),r=v("button"),r.textContent="删除",a(t,"class","sy-session-confirm-content svelte-1g6fj9a"),a(o,"class","sy-session-confirm-cancel svelte-1g6fj9a"),a(r,"class","sy-session-confirm-delete svelte-1g6fj9a"),a(s,"class","sy-session-confirm-actions svelte-1g6fj9a"),a(e,"class","sy-session-confirm-popup svelte-1g6fj9a"),F(e,"left",i[8].x+"px"),F(e,"top",i[8].y+"px"),F(e,"z-index",i[3]+3)},m(u,m){q(u,e,m),w(e,t),w(e,n),w(e,s),w(s,o),w(s,l),w(s,r),c||(f=[W(o,"click",i[20]),W(r,"click",i[14])],c=!0)},p(u,m){m&256&&F(e,"left",u[8].x+"px"),m&256&&F(e,"top",u[8].y+"px"),m&8&&F(e,"z-index",u[3]+3)},d(u){u&&H(e),c=!1,be(f)}}}function al(i){let e,t,n,s,o,l,r,c,f,u,m,d,p,g,_,I,M,R,y,b=i[9]&&Zi(i);function E(L,ee){return L[0].length===0?rl:ll}let A=E(i),S=A(i),C=i[7]&&Vi(i);return{c(){e=v("div"),t=v("div"),n=v("h2"),n.textContent="历史会话",s=G(),o=v("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(),r=v("div"),c=v("input"),f=G(),u=V("svg"),m=V("circle"),d=V("line"),p=G(),b&&b.c(),g=G(),_=v("div"),S.c(),I=G(),C&&C.c(),M=Mt(),a(n,"class","svelte-1g6fj9a"),a(o,"class","sy-session-close svelte-1g6fj9a"),a(o,"aria-label","关闭历史会话"),a(t,"class","sy-session-header svelte-1g6fj9a"),a(c,"type","text"),a(c,"class","sy-session-search-input svelte-1g6fj9a"),a(c,"placeholder","搜索历史会话..."),a(m,"cx","11"),a(m,"cy","11"),a(m,"r","8"),a(d,"x1","21"),a(d,"y1","21"),a(d,"x2","16.65"),a(d,"y2","16.65"),a(u,"class","sy-session-search-icon svelte-1g6fj9a"),a(u,"xmlns","http://www.w3.org/2000/svg"),a(u,"width","16"),a(u,"height","16"),a(u,"viewBox","0 0 24 24"),a(u,"fill","none"),a(u,"stroke","currentColor"),a(u,"stroke-width","2"),a(u,"stroke-linecap","round"),a(u,"stroke-linejoin","round"),a(r,"class","sy-session-search svelte-1g6fj9a"),a(_,"class","sy-session-list svelte-1g6fj9a"),a(e,"class","sy-session-history svelte-1g6fj9a"),F(e,"z-index",i[3]+2)},m(L,ee){q(L,e,ee),w(e,t),w(t,n),w(t,s),w(t,o),w(e,l),w(e,r),w(r,c),wt(c,i[4]),w(r,f),w(r,u),w(u,m),w(u,d),w(e,p),b&&b.m(e,null),w(e,g),w(e,_),S.m(_,null),q(L,I,ee),C&&C.m(L,ee),q(L,M,ee),R||(y=[W(o,"click",function(){Ft(i[1])&&i[1].apply(this,arguments)}),W(o,"mouseenter",i[16]),W(o,"mouseleave",i[12]),W(c,"input",i[17]),W(_,"scroll",i[10])],R=!0)},p(L,[ee]){i=L,ee&16&&c.value!==i[4]&&wt(c,i[4]),i[9]?b?b.p(i,ee):(b=Zi(i),b.c(),b.m(e,g)):b&&(b.d(1),b=null),A===(A=E(i))&&S?S.p(i,ee):(S.d(1),S=A(i),S&&(S.c(),S.m(_,null))),ee&8&&F(e,"z-index",i[3]+2),i[7]?C?C.p(i,ee):(C=Vi(i),C.c(),C.m(M.parentNode,M)):C&&(C.d(1),C=null)},i:j,o:j,d(L){L&&(H(e),H(I),H(M)),b&&b.d(),S.d(),C&&C.d(L),R=!1,be(y)}}}const Gn=10;function Qi(i){return new Date(i).toLocaleString()}function cl(i,e,t){let{sessions:n=[]}=e,{onClose:s}=e,{onSelect:o}=e,{zIndex:l}=e,{apiPrefix:r}=e,c=!1,f=!0,u=0,m="",d=null,p=null,g={x:0,y:0};function _(){return Pe(this,null,function*(){if(!(c||!f)){t(5,c=!0);try{const z=yield fetch(`${r}/chat/record/session/list/query`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({start:u,length:Gn,keyword:m})});if(!z.ok)throw new Error("Failed to load sessions");const Y=yield z.json();if(Y.code===0){const le=Y.data.sessionList.map(se=>({sessionId:se.sessionId,title:se.name,timestamp:new Date(se.createDate).getTime()}));t(0,n=[...n,...le]),u+=Gn,f=le.length===Gn}}catch(z){console.error("Failed to load sessions:",z)}finally{t(5,c=!1)}}})}function I(z){const Y=z.target,{scrollTop:le,scrollHeight:se,clientHeight:K}=Y;se-le-K<50&&_()}kn(()=>{_()});let M=null;function R(z,Y){const se=z.currentTarget.getBoundingClientRect();t(9,M={text:Y,x:se.left+se.width/2,y:se.bottom+8})}function y(){t(9,M=null)}function b(z,Y){const se=z.currentTarget.getBoundingClientRect();t(8,g={x:se.left-16,y:se.top+se.height/2}),t(7,p=Y)}function E(z){return Pe(this,null,function*(){if(z&&!d)try{t(6,d=z),t(7,p=null);const Y=document.querySelector(`[data-session-id="${z}"]`);Y&&Y.classList.add("deleting"),yield new Promise(K=>setTimeout(K,300));const le=yield fetch(`${r}/chat/record/session/delete`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({sessionId:z})});if(!le.ok)throw new Error("Delete request failed");const se=yield le.json();if(se.code===0&&se.data.respCode===0)t(0,n=n.map(K=>Re(ue({},K),{deleting:K.sessionId===z}))),setTimeout(()=>{t(0,n=n.filter(K=>!K.deleting))},300);else throw new Error("Delete failed: "+se.message)}catch(Y){console.error("Failed to delete session:",Y);const le=document.querySelector(`[data-session-id="${z}"]`);le&&le.classList.remove("deleting")}finally{t(6,d=null)}})}function A(){p&&E(p)}const S=z=>R(z,"关闭历史会话");function C(){m=this.value,t(4,m)}const L=z=>o(z.sessionId),ee=(z,Y)=>b(Y,z.sessionId),B=()=>t(7,p=null);return i.$$set=z=>{"sessions"in z&&t(0,n=z.sessions),"onClose"in z&&t(1,s=z.onClose),"onSelect"in z&&t(2,o=z.onSelect),"zIndex"in z&&t(3,l=z.zIndex),"apiPrefix"in z&&t(15,r=z.apiPrefix)},i.$$.update=()=>{i.$$.dirty&16&&m!==void 0&&(t(0,n=[]),u=0,f=!0,_())},[n,s,o,l,m,c,d,p,g,M,I,R,y,b,A,r,S,C,L,ee,B]}class Ji extends In{constructor(e){super(),An(this,e,cl,al,It,{sessions:0,onClose:1,onSelect:2,zIndex:3,apiPrefix:15})}}function Ki(i,e,t){const n=i.slice();return n[73]=e[t],n}function $i(i,e,t){const n=i.slice();return n[76]=e[t],n[77]=e,n[78]=t,n}function es(i,e,t){const n=i.slice();return n[79]=e[t],n[81]=t,n}function ul(i){let e,t=[],n=new Map,s=_t(i[11]);const o=l=>l[76].id;for(let l=0;l<s.length;l+=1){let r=$i(i,s,l),c=o(r);n.set(c,t[l]=rs(c,r))}return{c(){e=v("div");for(let l=0;l<t.length;l+=1)t[l].c();a(e,"class","sy-assistant-message-list svelte-ynwtqm")},m(l,r){q(l,e,r);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(e,null);i[57](e)},p(l,r){r[0]&1761147305|r[1]&127&&(s=_t(l[11]),t=ui(t,r,o,1,l,s,n,e,ci,rs,null,$i))},i:j,o:j,d(l){l&&H(e);for(let r=0;r<t.length;r+=1)t[r].d();i[57](null)}}}function fl(i){let e,t;return e=new Ji({props:{sessions:i[38],onClose:i[40],onSelect:i[41],zIndex:i[0],apiPrefix:i[2]}}),{c(){En(e.$$.fragment)},m(n,s){rn(e,n,s),t=!0},p(n,s){const o={};s[0]&1&&(o.zIndex=n[0]),s[0]&4&&(o.apiPrefix=n[2]),e.$set(o)},i(n){t||(Ve(e.$$.fragment,n),t=!0)},o(n){ut(e.$$.fragment,n),t=!1},d(n){an(e,n)}}}function hl(i){let e,t=Dt(i[8],'<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"/></svg>',"100%","100%")+"";return{c(){e=v("div"),a(e,"class","sy-assistant-avatar user svelte-ynwtqm"),D(e,"screen-theme",i[3]==="screen")},m(n,s){q(n,e,s),e.innerHTML=t},p(n,s){s[0]&256&&t!==(t=Dt(n[8],'<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"/></svg>',"100%","100%")+"")&&(e.innerHTML=t),s[0]&8&&D(e,"screen-theme",n[3]==="screen")},d(n){n&&H(e)}}}function dl(i){let e,t=Dt(i[7],'<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>',"100%","100%")+"";return{c(){e=v("div"),a(e,"class","sy-assistant-avatar assistant svelte-ynwtqm"),D(e,"screen-theme",i[3]==="screen")},m(n,s){q(n,e,s),e.innerHTML=t},p(n,s){s[0]&128&&t!==(t=Dt(n[7],'<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>',"100%","100%")+"")&&(e.innerHTML=t),s[0]&8&&D(e,"screen-theme",n[3]==="screen")},d(n){n&&H(e)}}}function pl(i){let e,t=i[27](i[76].content)+"";return{c(){e=v("div"),a(e,"class","markdown-content svelte-ynwtqm")},m(n,s){q(n,e,s),e.innerHTML=t},p(n,s){s[0]&2048&&t!==(t=n[27](n[76].content)+"")&&(e.innerHTML=t)},d(n){n&&H(e)}}}function ml(i){let e;return{c(){e=v("span"),e.innerHTML='<span class="dot svelte-ynwtqm">.</span> <span class="dot svelte-ynwtqm">.</span> <span class="dot svelte-ynwtqm">.</span>',a(e,"class","sy-assistant-loading svelte-ynwtqm")},m(t,n){q(t,e,n)},p:j,d(t){t&&H(e)}}}function ts(i){let e,t=_t(i[76].attachments),n=[];for(let s=0;s<t.length;s+=1)n[s]=ss(es(i,t,s));return{c(){e=v("div");for(let s=0;s<n.length;s+=1)n[s].c();a(e,"class","sy-assistant-attachments svelte-ynwtqm")},m(s,o){q(s,e,o);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(e,null)},p(s,o){if(o[0]&1610643457|o[1]&1){t=_t(s[76].attachments);let l;for(l=0;l<t.length;l+=1){const r=es(s,t,l);n[l]?n[l].p(r,o):(n[l]=ss(r),n[l].c(),n[l].m(e,null))}for(;l<n.length;l+=1)n[l].d(1);n.length=t.length}},d(s){s&&H(e),ii(n,s)}}}function ns(i){let e,t,n;function s(...o){return i[44](i[79],...o)}return{c(){e=v("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-ynwtqm"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',a(e,"class","sy-assistant-attachment-toggle svelte-ynwtqm"),a(e,"aria-label","查看详情")},m(o,l){q(o,e,l),t||(n=[W(e,"mouseenter",s),W(e,"mouseleave",i[30])],t=!0)},p(o,l){i=o},d(o){o&&H(e),t=!1,be(n)}}}function is(i){let e,t=i[12].replace(/\n/g,"<br>")+"",n,s;return{c(){e=v("div"),a(e,"class","sy-assistant-tooltip svelte-ynwtqm"),a(e,"role","tooltip"),F(e,"left",i[13].x+"px"),F(e,"top",i[13].y+"px"),F(e,"z-index",i[0]+3),D(e,"align-right",i[13].alignRight)},m(o,l){q(o,e,l),e.innerHTML=t,n||(s=[W(e,"mouseenter",i[46]),W(e,"mouseleave",i[47])],n=!0)},p(o,l){l[0]&4096&&t!==(t=o[12].replace(/\n/g,"<br>")+"")&&(e.innerHTML=t),l[0]&8192&&F(e,"left",o[13].x+"px"),l[0]&8192&&F(e,"top",o[13].y+"px"),l[0]&1&&F(e,"z-index",o[0]+3),l[0]&8192&&D(e,"align-right",o[13].alignRight)},d(o){o&&H(e),n=!1,be(s)}}}function ss(i){let e,t,n,s,o,l,r,c,f,u=_n(i[79].content_title).name+"",m,d,p,g=_n(i[79].content_title).ext+"",_,I,M,R,y,b,E,A,S,C,L=i[79].tips&&ns(i);function ee(){return i[45](i[79])}let B=i[12]&&is(i);return{c(){e=v("div"),t=v("div"),n=v("div"),s=V("svg"),o=V("path"),l=V("polyline"),r=G(),c=v("div"),f=v("span"),m=Me(u),d=G(),p=v("span"),_=Me(g),M=G(),R=v("div"),L&&L.c(),y=G(),b=v("button"),b.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-ynwtqm"><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>',E=G(),B&&B.c(),A=G(),a(o,"d","M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"),a(l,"points","13 2 13 9 20 9"),a(s,"xmlns","http://www.w3.org/2000/svg"),a(s,"width","16"),a(s,"height","16"),a(s,"viewBox","0 0 24 24"),a(s,"fill","none"),a(s,"stroke","currentColor"),a(s,"stroke-width","2"),a(s,"stroke-linecap","round"),a(s,"stroke-linejoin","round"),a(f,"class","sy-assistant-filename svelte-ynwtqm"),a(p,"class","sy-assistant-attachment-ext svelte-ynwtqm"),a(c,"class","sy-assistant-attachment-name svelte-ynwtqm"),a(c,"title",I=i[79].content_title),a(n,"class","sy-assistant-attachment-title svelte-ynwtqm"),a(b,"class","sy-assistant-attachment-toggle svelte-ynwtqm"),a(b,"aria-label","下载文件"),a(R,"class","sy-assistant-attachment-actions svelte-ynwtqm"),a(t,"class","sy-assistant-attachment-header svelte-ynwtqm"),a(e,"class","sy-assistant-attachment svelte-ynwtqm")},m(z,Y){q(z,e,Y),w(e,t),w(t,n),w(n,s),w(s,o),w(s,l),w(n,r),w(n,c),w(c,f),w(f,m),w(c,d),w(c,p),w(p,_),w(t,M),w(t,R),L&&L.m(R,null),w(R,y),w(R,b),w(e,E),B&&B.m(e,null),w(e,A),S||(C=W(b,"click",ee),S=!0)},p(z,Y){i=z,Y[0]&2048&&u!==(u=_n(i[79].content_title).name+"")&&Ge(m,u),Y[0]&2048&&g!==(g=_n(i[79].content_title).ext+"")&&Ge(_,g),Y[0]&2048&&I!==(I=i[79].content_title)&&a(c,"title",I),i[79].tips?L?L.p(i,Y):(L=ns(i),L.c(),L.m(R,y)):L&&(L.d(1),L=null),i[12]?B?B.p(i,Y):(B=is(i),B.c(),B.m(e,A)):B&&(B.d(1),B=null)},d(z){z&&H(e),L&&L.d(),B&&B.d(),S=!1,C()}}}function os(i){let e,t,n,s,o,l,r,c,f,u,m;function d(A,S){return A[19][A[76].id]?wl:gl}let p=d(i),g=p(i);function _(){return i[48](i[76])}function I(...A){return i[49](i[76],...A)}function M(){return i[50](i[76])}function R(...A){return i[51](i[76],...A)}function y(...A){return i[52](i[76],...A)}function b(...A){return i[53](i[76],...A)}let E=i[22]&&i[20][i[76].id]==="dislike"&&ls(i);return{c(){e=v("div"),t=v("button"),g.c(),s=G(),o=v("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(),r=v("button"),r.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(),E&&E.c(),f=Mt(),a(t,"class","sy-assistant-action-button svelte-ynwtqm"),a(t,"aria-label",n=i[19][i[76].id]?"已复制":"复制内容"),D(t,"copied",i[19][i[76].id]),a(o,"class","sy-assistant-action-button svelte-ynwtqm"),a(o,"aria-label","点赞"),D(o,"active",i[20][i[76].id]==="like"),a(r,"class","sy-assistant-action-button svelte-ynwtqm"),a(r,"aria-label","点踩"),D(r,"active",i[20][i[76].id]==="dislike"),a(e,"class","sy-assistant-message-actions svelte-ynwtqm")},m(A,S){q(A,e,S),w(e,t),g.m(t,null),w(e,s),w(e,o),w(e,l),w(e,r),q(A,c,S),E&&E.m(A,S),q(A,f,S),u||(m=[W(t,"click",_),W(t,"mouseenter",I),W(t,"mouseleave",i[37]),W(o,"click",M),W(o,"mouseenter",R),W(o,"mouseleave",i[37]),W(r,"click",y),W(r,"mouseenter",b),W(r,"mouseleave",i[37])],u=!0)},p(A,S){i=A,p!==(p=d(i))&&(g.d(1),g=p(i),g&&(g.c(),g.m(t,null))),S[0]&526336&&n!==(n=i[19][i[76].id]?"已复制":"复制内容")&&a(t,"aria-label",n),S[0]&526336&&D(t,"copied",i[19][i[76].id]),S[0]&1050624&&D(o,"active",i[20][i[76].id]==="like"),S[0]&1050624&&D(r,"active",i[20][i[76].id]==="dislike"),i[22]&&i[20][i[76].id]==="dislike"?E?E.p(i,S):(E=ls(i),E.c(),E.m(f.parentNode,f)):E&&(E.d(1),E=null)},d(A){A&&(H(e),H(c),H(f)),g.d(),E&&E.d(A),u=!1,be(m)}}}function gl(i){let e,t,n;return{c(){e=V("svg"),t=V("rect"),n=V("path"),a(t,"x","9"),a(t,"y","9"),a(t,"width","13"),a(t,"height","13"),a(t,"rx","2"),a(t,"ry","2"),a(n,"d","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width","14"),a(e,"height","14"),a(e,"viewBox","0 0 24 24"),a(e,"fill","none"),a(e,"stroke","currentColor"),a(e,"stroke-width","2"),a(e,"stroke-linecap","round"),a(e,"stroke-linejoin","round")},m(s,o){q(s,e,o),w(e,t),w(e,n)},d(s){s&&H(e)}}}function wl(i){let e,t;return{c(){e=V("svg"),t=V("polyline"),a(t,"points","20 6 9 17 4 12"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width","14"),a(e,"height","14"),a(e,"viewBox","0 0 24 24"),a(e,"fill","none"),a(e,"stroke","currentColor"),a(e,"stroke-width","2"),a(e,"stroke-linecap","round"),a(e,"stroke-linejoin","round")},m(n,s){q(n,e,s),w(e,t)},d(n){n&&H(e)}}}function ls(i){let e,t,n,s,o,l,r,c,f,u,m;function d(){i[54].call(s,i[76])}function p(){return i[55](i[76])}function g(){return i[56](i[76])}return{c(){e=v("div"),t=v("div"),t.textContent="反馈意见",n=G(),s=v("textarea"),o=G(),l=v("div"),r=v("button"),r.textContent="取消",c=G(),f=v("button"),f.textContent="提交",a(t,"class","sy-assistant-dislike-title svelte-ynwtqm"),a(s,"class","sy-assistant-dislike-input svelte-ynwtqm"),a(s,"placeholder","请输入您的反馈意见..."),a(r,"class","sy-assistant-popup-cancel svelte-ynwtqm"),a(f,"class","sy-assistant-popup-submit svelte-ynwtqm"),a(l,"class","sy-assistant-popup-actions svelte-ynwtqm"),a(e,"class","sy-assistant-dislike-popup svelte-ynwtqm"),F(e,"left",i[23].x+"px"),F(e,"top",i[23].y+"px"),F(e,"z-index",i[0]+3)},m(_,I){q(_,e,I),w(e,t),w(e,n),w(e,s),wt(s,i[21][i[76].id]),w(e,o),w(e,l),w(l,r),w(l,c),w(l,f),u||(m=[W(s,"input",d),W(r,"click",p),W(f,"click",g)],u=!0)},p(_,I){i=_,I[0]&2099200&&wt(s,i[21][i[76].id]),I[0]&8388608&&F(e,"left",i[23].x+"px"),I[0]&8388608&&F(e,"top",i[23].y+"px"),I[0]&1&&F(e,"z-index",i[0]+3)},d(_){_&&H(e),u=!1,be(m)}}}function rs(i,e){let t,n,s,o,l,r,c,f,u=new Date(e[76].timestamp).toLocaleString()+"",m,d;function p(E,A){return E[76].type==="assistant"?dl:hl}let g=p(e),_=g(e);function I(E,A){return E[15]&&E[76].id===E[11][E[11].length-1].id&&E[76].type==="assistant"&&!E[76].content?ml:pl}let M=I(e),R=M(e),y=e[76].attachments&&ts(e),b=e[76].id!=="-1"&&e[76].type==="assistant"&&!e[15]&&e[5]&&os(e);return{key:i,first:null,c(){t=v("div"),_.c(),n=G(),s=v("div"),o=v("div"),R.c(),l=G(),y&&y.c(),r=G(),b&&b.c(),c=G(),f=v("div"),m=Me(u),d=G(),a(o,"class","sy-assistant-message-content svelte-ynwtqm"),D(o,"screen-theme",e[3]==="screen"),a(f,"class","sy-assistant-message-time svelte-ynwtqm"),a(s,"class","sy-assistant-message-bubble svelte-ynwtqm"),D(s,"screen-theme",e[3]==="screen"),a(t,"class","sy-assistant-message svelte-ynwtqm"),D(t,"user",e[76].type==="user"),D(t,"screen-theme",e[3]==="screen"),this.first=t},m(E,A){q(E,t,A),_.m(t,null),w(t,n),w(t,s),w(s,o),R.m(o,null),w(o,l),y&&y.m(o,null),w(o,r),b&&b.m(o,null),w(s,c),w(s,f),w(f,m),w(t,d)},p(E,A){e=E,g===(g=p(e))&&_?_.p(e,A):(_.d(1),_=g(e),_&&(_.c(),_.m(t,n))),M===(M=I(e))&&R?R.p(e,A):(R.d(1),R=M(e),R&&(R.c(),R.m(o,l))),e[76].attachments?y?y.p(e,A):(y=ts(e),y.c(),y.m(o,r)):y&&(y.d(1),y=null),e[76].id!=="-1"&&e[76].type==="assistant"&&!e[15]&&e[5]?b?b.p(e,A):(b=os(e),b.c(),b.m(o,null)):b&&(b.d(1),b=null),A[0]&8&&D(o,"screen-theme",e[3]==="screen"),A[0]&2048&&u!==(u=new Date(e[76].timestamp).toLocaleString()+"")&&Ge(m,u),A[0]&8&&D(s,"screen-theme",e[3]==="screen"),A[0]&2048&&D(t,"user",e[76].type==="user"),A[0]&8&&D(t,"screen-theme",e[3]==="screen")},d(E){E&&H(t),_.d(),R.d(),y&&y.d(),b&&b.d()}}}function as(i){let e,t,n,s,o,l,r,c,f,u,m,d,p,g=Dt(i[6],'<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="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>')+"",_,I,M,R=i[5]&&cs(i);return{c(){R&&R.c(),e=G(),t=v("div"),n=v("div"),s=v("div"),o=v("textarea"),l=G(),r=v("div"),c=v("div"),f=Me(i[10]),u=Me("/"),m=Me(Zn),d=G(),p=v("button"),a(o,"class","sy-assistant-textarea svelte-ynwtqm"),a(o,"placeholder","输入您的问题..."),a(o,"maxlength",Zn),a(o,"rows","3"),D(o,"screen-theme",i[3]==="screen"),a(s,"class","sy-assistant-textarea-container svelte-ynwtqm"),a(c,"class","sy-assistant-char-count svelte-ynwtqm"),D(c,"over-limit",i[26]),a(p,"class","sy-assistant-send-button svelte-ynwtqm"),p.disabled=_=!i[9].trim()||i[26],a(p,"aria-label","发送消息"),a(r,"class","sy-assistant-operation-area svelte-ynwtqm"),a(n,"class","sy-assistant-input-container svelte-ynwtqm"),D(n,"screen-theme",i[3]==="screen"),a(t,"class","sy-assistant-input-area svelte-ynwtqm"),D(t,"screen-theme",i[3]==="screen")},m(y,b){R&&R.m(y,b),q(y,e,b),q(y,t,b),w(t,n),w(n,s),w(s,o),wt(o,i[9]),w(n,l),w(n,r),w(r,c),w(c,f),w(c,u),w(c,m),w(r,d),w(r,p),p.innerHTML=g,I||(M=[W(o,"input",i[61]),W(o,"keydown",i[62]),W(p,"click",i[28]),W(p,"mouseenter",i[63]),W(p,"mouseleave",i[37])],I=!0)},p(y,b){y[5]?R?R.p(y,b):(R=cs(y),R.c(),R.m(e.parentNode,e)):R&&(R.d(1),R=null),b[0]&512&&wt(o,y[9]),b[0]&8&&D(o,"screen-theme",y[3]==="screen"),b[0]&1024&&Ge(f,y[10]),b[0]&67108864&&D(c,"over-limit",y[26]),b[0]&64&&g!==(g=Dt(y[6],'<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="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>')+"")&&(p.innerHTML=g),b[0]&67109376&&_!==(_=!y[9].trim()||y[26])&&(p.disabled=_),b[0]&8&&D(n,"screen-theme",y[3]==="screen"),b[0]&8&&D(t,"screen-theme",y[3]==="screen")},d(y){y&&(H(e),H(t)),R&&R.d(y),I=!1,be(M)}}}function cs(i){let e,t,n,s,o,l,r,c,f,u=i[1]&&us(i),m=!i[1]&&hs(),d=i[4]!==!1&&ds(i);return{c(){e=v("div"),t=v("div"),u&&u.c(),n=G(),m&&m.c(),s=G(),o=v("div"),d&&d.c(),l=G(),r=v("button"),r.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>',a(r,"class","sy-assistant-icon-button svelte-ynwtqm"),a(r,"aria-label","新建会话"),a(o,"class","sy-assistant-chat-actions-btns svelte-ynwtqm"),a(t,"class","sy-assistant-chat-actions svelte-ynwtqm"),a(e,"class","sy-assistant-chat-footer svelte-ynwtqm")},m(p,g){q(p,e,g),w(e,t),u&&u.m(t,null),w(t,n),m&&m.m(t,null),w(t,s),w(t,o),d&&d.m(o,null),w(o,l),w(o,r),c||(f=[W(r,"click",i[42]),W(r,"mouseenter",i[60]),W(r,"mouseleave",i[37])],c=!0)},p(p,g){p[1]?u?u.p(p,g):(u=us(p),u.c(),u.m(t,n)):u&&(u.d(1),u=null),p[1]?m&&(m.d(1),m=null):m||(m=hs(),m.c(),m.m(t,s)),p[4]!==!1?d?d.p(p,g):(d=ds(p),d.c(),d.m(o,l)):d&&(d.d(1),d=null)},d(p){p&&H(e),u&&u.d(),m&&m.d(),d&&d.d(),c=!1,be(f)}}}function us(i){let e,t,n,s,o=_t(i[17]),l=[];for(let r=0;r<o.length;r+=1)l[r]=fs(Ki(i,o,r));return{c(){e=v("div"),t=v("select");for(let r=0;r<l.length;r+=1)l[r].c();a(t,"class","sy-assistant-select svelte-ynwtqm"),i[18]===void 0&&on(()=>i[58].call(t)),a(e,"class","sy-assistant-scene-select svelte-ynwtqm")},m(r,c){q(r,e,c),w(e,t);for(let f=0;f<l.length;f+=1)l[f]&&l[f].m(t,null);oi(t,i[18],!0),n||(s=W(t,"change",i[58]),n=!0)},p(r,c){if(c[0]&131072){o=_t(r[17]);let f;for(f=0;f<o.length;f+=1){const u=Ki(r,o,f);l[f]?l[f].p(u,c):(l[f]=fs(u),l[f].c(),l[f].m(t,null))}for(;f<l.length;f+=1)l[f].d(1);l.length=o.length}c[0]&393216&&oi(t,r[18])},d(r){r&&H(e),ii(l,r),n=!1,s()}}}function fs(i){let e,t=i[73].name+"",n,s,o;return{c(){e=v("option"),n=Me(t),s=G(),e.__value=o=i[73].code,wt(e,e.__value)},m(l,r){q(l,e,r),w(e,n),w(e,s)},p(l,r){r[0]&131072&&t!==(t=l[73].name+"")&&Ge(n,t),r[0]&131072&&o!==(o=l[73].code)&&(e.__value=o,wt(e,e.__value))},d(l){l&&H(e)}}}function hs(i){let e;return{c(){e=v("div"),a(e,"class","sy-assistant-scene-select svelte-ynwtqm")},m(t,n){q(t,e,n)},d(t){t&&H(e)}}}function ds(i){let e,t,n;return{c(){e=v("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"><path d="M12 8v4l3 3"></path><circle cx="12" cy="12" r="10"></circle></svg>',a(e,"class","sy-assistant-icon-button svelte-ynwtqm"),a(e,"aria-label","历史会话")},m(s,o){q(s,e,o),t||(n=[W(e,"click",i[39]),W(e,"mouseenter",i[59]),W(e,"mouseleave",i[37])],t=!0)},p:j,d(s){s&&H(e),t=!1,be(n)}}}function ps(i){let e,t=i[24].text+"",n;return{c(){e=v("div"),n=Me(t),a(e,"class","sy-assistant-button-tooltip svelte-ynwtqm"),F(e,"left",i[24].x+"px"),F(e,"top",i[24].y+"px")},m(s,o){q(s,e,o),w(e,n)},p(s,o){o[0]&16777216&&t!==(t=s[24].text+"")&&Ge(n,t),o[0]&16777216&&F(e,"left",s[24].x+"px"),o[0]&16777216&&F(e,"top",s[24].y+"px")},d(s){s&&H(e)}}}function _l(i){let e,t,n,s,o,l,r;const c=[fl,ul],f=[];function u(p,g){return p[25]?0:1}t=u(i),n=f[t]=c[t](i);let m=!i[25]&&as(i),d=i[24]&&ps(i);return{c(){e=v("div"),n.c(),s=G(),m&&m.c(),o=G(),d&&d.c(),l=Mt(),a(e,"class","sy-assistant-chat-container svelte-ynwtqm"),F(e,"z-index",i[0]+2)},m(p,g){q(p,e,g),f[t].m(e,null),w(e,s),m&&m.m(e,null),q(p,o,g),d&&d.m(p,g),q(p,l,g),r=!0},p(p,g){let _=t;t=u(p),t===_?f[t].p(p,g):(vn(),ut(f[_],1,1,()=>{f[_]=null}),Sn(),n=f[t],n?n.p(p,g):(n=f[t]=c[t](p),n.c()),Ve(n,1),n.m(e,s)),p[25]?m&&(m.d(1),m=null):m?m.p(p,g):(m=as(p),m.c(),m.m(e,null)),(!r||g[0]&1)&&F(e,"z-index",p[0]+2),p[24]?d?d.p(p,g):(d=ps(p),d.c(),d.m(l.parentNode,l)):d&&(d.d(1),d=null)},i(p){r||(Ve(n),r=!0)},o(p){ut(n),r=!1},d(p){p&&(H(e),H(o),H(l)),f[t].d(),m&&m.d(),d&&d.d(p)}}}let Zn=500;function bl(i){const e=i.match(/source#\[(.*)\]#source/);return e?i.replace(`source#[${e[1]}]#source`,""):i}function ms(i){const e=i.match(/source#\[(.*)\]#source/);if(e)try{return JSON.parse(`[${e[1]}]`)}catch(t){console.error("Failed to parse attachments:",t)}return null}function Dt(i,e,t,n){if(!i)return e;if(i.startsWith("data:image")||i.startsWith("data:image/svg+xml"))return`<img src="${i}" alt="图标" style="width: ${t||"100%"}; height: ${n||"100%"};" />`;if(i.includes("<svg")){let s=i;return t&&(s=s.replace(/width="[^"]*"/,`width="${t}"`)),n&&(s=s.replace(/height="[^"]*"/,`height="${n}"`)),s}return e}function _n(i){const e=i.split(".");if(e.length>1){const t=e.pop()||"";return{name:e.join("."),ext:t?`.${t}`:""}}return{name:i,ext:""}}function kl(i,e,t){let n,s;const o=li();let l="",r=[{sessionId:"",requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}],c="",f=null,u=null,m={x:0,y:0,alignRight:!1},d=null,p=!1,g=!1;oe.setOptions({breaks:!0,gfm:!0});function _(k){try{const N=oe(k);return Ui.sanitize(N)}catch(N){console.warn("Markdown parsing failed, fallback to HTML:",N);try{const re=k.replace(/\n/g,"<br>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>");return Ui.sanitize(re)}catch(re){return console.error("HTML fallback failed:",re),k}}}let I;function M(k=!1){I&&I.scrollTo({top:I.scrollHeight,behavior:k?"smooth":"auto"})}qs(()=>{M(!1)});let{zIndex:R}=e,{sessionId:y}=e,{hasScene:b}=e,{apiPrefix:E}=e,{theme:A="default"}=e,{showHistory:S=!0}=e,{showActions:C=!0}=e,{sendIcon:L=""}=e,{robotIcon:ee=""}=e,{userIcon:B=""}=e,z=[],Y="";function le(){return Pe(this,null,function*(){if(b)try{const k=yield fetch(`${E}/chat/getSceneList`,{headers:{"Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`}});if(!k.ok)throw new Error("Failed to fetch scenes");const N=yield k.json();N.code===0&&(t(17,z=N.data.sceneList||[]),z.length>0&&t(18,Y=z[0].code))}catch(k){console.error("Failed to fetch scenes:",k)}})}kn(()=>{le()});function se(){return Pe(this,null,function*(){if(!l.trim()||s)return;if(!y){console.error("No session ID available");return}const k=Date.now().toString(),N=Date.now().toString()+Math.random().toString().slice(2,8),re={sessionId:y,requestId:N,id:k,type:"user",content:l.trim(),timestamp:Date.now()};t(11,r=[...r,re]);const _e=l.trim();t(9,l="");const Te=(Date.now()+1).toString();c="",t(11,r=[...r,{sessionId:y,requestId:N,id:Te,type:"assistant",content:"",timestamp:Date.now()}]),t(15,p=!0),g=!1,f&&f.abort(),f=new AbortController;try{yield no(`${E}/chat/sse`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({sessionId:y,requestId:N,keyword:_e,flowId:"1",extendKeys:b?{sceneCode:Y}:void 0}),signal:f.signal,onmessage(ze){try{const J=ze.data;if(J){g||(g=!0,o("firstResponse",{sessionId:y,requestId:N,content:J,timestamp:Date.now()}));const tt=ms(J);tt?(t(11,r=r.map(dt=>dt.id===Te?Re(ue({},dt),{attachments:tt}):dt)),M(!0)):(c+=J,t(11,r=r.map(dt=>dt.id===Te?Re(ue({},dt),{content:c}):dt)),M(!1))}}catch(J){console.error("Failed to process SSE message:",J)}},onerror(ze){throw c="请求异常,请重试",t(11,r=r.map(J=>J.id===Te?Re(ue({},J),{content:c}):J)),M(!1),console.error("SSE error:",ze),f=null,t(15,p=!1),ze},onclose(){f=null,t(15,p=!1)}})}catch(ze){console.error("Failed to send message:",ze),t(15,p=!1)}})}function K(k,N,re){const _e=re.getBoundingClientRect(),Te=I.getBoundingClientRect(),ze=_e.left<Te.width/2;t(12,u=N),t(13,m={x:_e.left,y:_e.top+_e.height/2,alignRight:ze})}function de(){t(14,d=setTimeout(()=>{t(12,u=null),t(14,d=null)},200))}Bs(()=>{f&&f.abort(),d&&clearTimeout(d)});function Ye(k,N){return Pe(this,null,function*(){try{const re=yield fetch(`${E}/file/downloadFile`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({fileName:k,fileUrl:N})});if(!re.ok)throw new Error("Download failed");const _e=re.headers.get("content-type")||"application/octet-stream",Te=yield re.blob(),ze=window.URL.createObjectURL(Te),J=document.createElement("a");J.href=ze,J.download=k,document.body.appendChild(J),J.click(),window.URL.revokeObjectURL(ze),document.body.removeChild(J)}catch(re){console.error("Failed to download file:",re)}})}let te={};function Je(k,N){return Pe(this,null,function*(){try{const re=N.replace(/<br\s*\/?>/g,`
48
+ `).replace(/\*\*(.*?)\*\*/g,"$1").replace(/###/g,"").trim();yield navigator.clipboard.writeText(re),t(19,te[k]=!0,te),setTimeout(()=>{t(19,te[k]=!1,te),t(19,te)},1500)}catch(re){console.error("Failed to copy:",re)}})}let Z={},Ae={},ae=!1;function ve(k,N){return Pe(this,null,function*(){if(Z[k]===N){t(20,Z[k]=null,Z),t(20,Z);return}if(t(20,Z[k]=N,Z),t(20,Z),N==="like")try{if(!(yield fetch(`${E}/chat/record/feedback`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({sessionId:y,requestId:k,feedBackFlag:"1",feedBackContent:"点赞"})})).ok)throw new Error("Feedback failed")}catch(re){console.error("Failed to send feedback:",re),t(20,Z[k]=null,Z),t(20,Z)}else t(22,ae=!0)})}function ce(k){return Pe(this,null,function*(){var N;if((N=Ae[k])!=null&&N.trim())try{if(!(yield fetch(`${E}/chat/record/feedback`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({sessionId:y,requestId:k,feedBackFlag:"0",feedBackContent:Ae[k]})})).ok)throw new Error("Feedback failed");t(22,ae=!1),t(21,Ae[k]="",Ae),t(21,Ae)}catch(re){console.error("Failed to send feedback:",re),t(20,Z[k]=null,Z),t(20,Z)}})}let qe={x:0,y:0};function ke(k,N){const _e=k.currentTarget.getBoundingClientRect();t(23,qe={x:_e.left-290,y:_e.top-160}),ve(N,"dislike")}let Be=null;function we(k,N){const _e=k.currentTarget.getBoundingClientRect();t(24,Be={text:N,x:_e.left+_e.width/2,y:_e.top-8})}function et(){t(24,Be=null)}let U=[],X=Date.now().toString(),Ie=!1;function Ue(){et(),t(25,Ie=!0)}function ot(){et(),t(25,Ie=!1)}function lt(k){return Pe(this,null,function*(){if(!p){t(15,p=!0);try{const N=yield fetch(`${E}/chat/record/session/detail/query`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`},body:JSON.stringify({sessionId:k})});if(!N.ok)throw new Error("Failed to load sessions");const re=yield N.json();if(re.code===0){X=k,t(25,Ie=!1);const _e=re.data.map((Te,ze)=>{const J=ms(Te.answer),tt=bl(Te.answer);return[{sessionId:Te.sessionId,requestId:Te.requestId,id:(Date.now()+2*ze).toString(),type:"user",content:Te.keyword,timestamp:new Date(Te.createDate).getTime()},{sessionId:Te.sessionId,requestId:Te.requestId,id:(Date.now()+2*ze+1).toString(),type:"assistant",content:tt,attachments:J,timestamp:new Date(Te.createDate).getTime()}]});t(11,r=_e.flat())}}catch(N){console.error("Failed to load sessions:",N)}finally{t(15,p=!1)}}})}function rt(){return Pe(this,null,function*(){const k=yield bt();if(!k){console.error("Failed to create new session");return}X=k,t(11,r=[{sessionId:X,requestId:"",id:"-1",type:"assistant",content:"您好!我是您的AI助手,有什么可以帮您的吗?",timestamp:Date.now()}]),t(9,l="")})}function bt(){return Pe(this,null,function*(){try{const k=yield fetch(`${E}/chat/getSessionId`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`}});if(!k.ok)throw new Error("Failed to get session ID");const N=yield k.json();if(N.code===0)return X=N.data.sessionId,X;throw new Error(N.message||"Failed to get session ID")}catch(k){return console.error("Failed to get session ID:",k),null}})}const kt=(k,N)=>K(N,k.tips,N.currentTarget),yt=k=>Ye(k.content_title,k.link),Ot=()=>{d&&(clearTimeout(d),t(14,d=null))},Kt=()=>{t(12,u=null)},At=k=>Je(k.id,k.content),ht=(k,N)=>we(N,te[k.id]?"已复制":"复制内容"),at=k=>ve(k.id,"like"),x=(k,N)=>we(N,Z[k.id]==="like"?"取消点赞":"点赞"),$=(k,N)=>ke(N,k.id),pe=(k,N)=>we(N,Z[k.id]==="dislike"?"取消点踩":"点踩");function Se(k){Ae[k.id]=this.value,t(21,Ae)}const Ce=k=>{t(22,ae=!1),t(20,Z[k.id]=null,Z),t(20,Z)},Le=k=>ce(k.id);function xe(k){Bt[k?"unshift":"push"](()=>{I=k,t(16,I)})}function Xe(){Y=Fs(this),t(18,Y),t(17,z)}const je=k=>we(k,"历史会话"),Ke=k=>we(k,"新建会话");function $t(){l=this.value,t(9,l)}const en=k=>k.key==="Enter"&&!k.shiftKey&&(se(),k.preventDefault()),Yn=k=>we(k,"发送消息");return i.$$set=k=>{"zIndex"in k&&t(0,R=k.zIndex),"sessionId"in k&&t(43,y=k.sessionId),"hasScene"in k&&t(1,b=k.hasScene),"apiPrefix"in k&&t(2,E=k.apiPrefix),"theme"in k&&t(3,A=k.theme),"showHistory"in k&&t(4,S=k.showHistory),"showActions"in k&&t(5,C=k.showActions),"sendIcon"in k&&t(6,L=k.sendIcon),"robotIcon"in k&&t(7,ee=k.robotIcon),"userIcon"in k&&t(8,B=k.userIcon)},i.$$.update=()=>{i.$$.dirty[0]&512&&t(10,n=l.length),i.$$.dirty[0]&1024&&t(26,s=n>Zn)},[R,b,E,A,S,C,L,ee,B,l,n,r,u,m,d,p,I,z,Y,te,Z,Ae,ae,qe,Be,Ie,s,_,se,K,de,Ye,Je,ve,ce,ke,we,et,U,Ue,ot,lt,rt,y,kt,yt,Ot,Kt,At,ht,at,x,$,pe,Se,Ce,Le,xe,Xe,je,Ke,$t,en,Yn]}class yl extends In{constructor(e){super(),An(this,e,kl,_l,It,{zIndex:0,sessionId:43,hasScene:1,apiPrefix:2,theme:3,showHistory:4,showActions:5,sendIcon:6,robotIcon:7,userIcon:8},null,[-1,-1,-1])}}function gs(i){let e,t,n,s,o=i[3].title+"",l,r,c,f,u,m,d,p,g,_=i[2]?"退出全屏":"全屏显示",I,M,R,y,b,E,A,S,C=i[8]?"取消吸附":"吸附到边缘",L,ee,B,z,Y,le,se,K,de,Ye=`${i[3].height}px`,te,Je,Z;function Ae(U,X){return U[2]?vl:Tl}let ae=Ae(i),ve=ae(i);function ce(U,X){return U[8]?El:Sl}let qe=ce(i),ke=qe(i);const Be=[Il,Al],we=[];function et(U,X){return U[9]?0:1}return K=et(i),de=we[K]=Be[K](i),{c(){var U,X,Ie;e=v("div"),t=v("div"),n=v("div"),s=v("h3"),l=Me(o),r=G(),c=v("div"),f=v("div"),u=v("button"),m=V("svg"),ve.c(),p=G(),g=v("span"),I=Me(_),M=G(),R=v("div"),y=v("button"),b=V("svg"),ke.c(),A=G(),S=v("span"),L=Me(C),ee=G(),B=v("div"),z=v("button"),z.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>',Y=G(),le=v("span"),le.textContent="关闭助手",se=G(),de.c(),a(s,"class","svelte-1h7dpbq"),a(m,"xmlns","http://www.w3.org/2000/svg"),a(m,"width","18"),a(m,"height","18"),a(m,"viewBox","0 0 24 24"),a(m,"fill","none"),a(m,"stroke","currentColor"),a(m,"stroke-width","2"),a(m,"stroke-linecap","round"),a(m,"stroke-linejoin","round"),a(u,"class","sy-assistant-action-button svelte-1h7dpbq"),a(u,"aria-label",d=i[2]?"退出全屏":"全屏显示"),D(u,"active",i[2]),a(g,"class","sy-assistant-tooltip svelte-1h7dpbq"),F(g,"z-index",((U=i[3].zIndex)!=null?U:1e3)+3),a(f,"class","sy-assistant-tooltip-wrapper svelte-1h7dpbq"),a(b,"xmlns","http://www.w3.org/2000/svg"),a(b,"width","18"),a(b,"height","18"),a(b,"viewBox","0 0 24 24"),a(b,"fill","none"),a(b,"stroke","currentColor"),a(b,"stroke-width","2"),a(b,"stroke-linecap","round"),a(b,"stroke-linejoin","round"),a(y,"class","sy-assistant-action-button svelte-1h7dpbq"),a(y,"aria-label",E=i[8]?"取消吸附":"吸附到边缘"),D(y,"active",i[8]),a(S,"class","sy-assistant-tooltip svelte-1h7dpbq"),F(S,"z-index",((X=i[3].zIndex)!=null?X:1e3)+3),a(R,"class","sy-assistant-tooltip-wrapper svelte-1h7dpbq"),a(z,"class","sy-assistant-close-button svelte-1h7dpbq"),a(z,"aria-label","关闭助手"),a(le,"class","sy-assistant-tooltip svelte-1h7dpbq"),F(le,"z-index",((Ie=i[3].zIndex)!=null?Ie:1e3)+3),a(B,"class","sy-assistant-tooltip-wrapper svelte-1h7dpbq"),a(c,"class","sy-assistant-header-actions svelte-1h7dpbq"),a(n,"class","sy-assistant-drawer-header svelte-1h7dpbq"),a(n,"role","button"),a(n,"tabindex","0"),a(n,"aria-label","拖动助手窗口"),D(n,"dragging",i[6]),D(n,"fullscreen",i[2]),D(n,"snapped",i[8]),a(t,"class","sy-assistant-drawer-content svelte-1h7dpbq"),a(e,"class","sy-assistant-drawer svelte-1h7dpbq"),D(e,"fullscreen",i[2]),D(e,"screen-theme",i[3].theme==="screen"),F(e,"height",Ye)},m(U,X){q(U,e,X),w(e,t),w(t,n),w(n,s),w(s,l),w(n,r),w(n,c),w(c,f),w(f,u),w(u,m),ve.m(m,null),w(f,p),w(f,g),w(g,I),w(c,M),w(c,R),w(R,y),w(y,b),ke.m(b,null),w(R,A),w(R,S),w(S,L),w(c,ee),w(c,B),w(B,z),w(B,Y),w(B,le),w(t,se),we[K].m(t,null),te=!0,Je||(Z=[W(u,"click",i[18]),W(y,"click",i[20]),W(z,"click",i[17]),W(n,"mousedown",si(i[19]))],Je=!0)},p(U,X){var Ue,ot,lt;(!te||X[0]&8)&&o!==(o=U[3].title+"")&&Ge(l,o),ae!==(ae=Ae(U))&&(ve.d(1),ve=ae(U),ve&&(ve.c(),ve.m(m,null))),(!te||X[0]&4&&d!==(d=U[2]?"退出全屏":"全屏显示"))&&a(u,"aria-label",d),(!te||X[0]&4)&&D(u,"active",U[2]),(!te||X[0]&4)&&_!==(_=U[2]?"退出全屏":"全屏显示")&&Ge(I,_),X[0]&8&&F(g,"z-index",((Ue=U[3].zIndex)!=null?Ue:1e3)+3),qe!==(qe=ce(U))&&(ke.d(1),ke=qe(U),ke&&(ke.c(),ke.m(b,null))),(!te||X[0]&256&&E!==(E=U[8]?"取消吸附":"吸附到边缘"))&&a(y,"aria-label",E),(!te||X[0]&256)&&D(y,"active",U[8]),(!te||X[0]&256)&&C!==(C=U[8]?"取消吸附":"吸附到边缘")&&Ge(L,C),X[0]&8&&F(S,"z-index",((ot=U[3].zIndex)!=null?ot:1e3)+3),X[0]&8&&F(le,"z-index",((lt=U[3].zIndex)!=null?lt:1e3)+3),(!te||X[0]&64)&&D(n,"dragging",U[6]),(!te||X[0]&4)&&D(n,"fullscreen",U[2]),(!te||X[0]&256)&&D(n,"snapped",U[8]);let Ie=K;K=et(U),K===Ie?we[K].p(U,X):(vn(),ut(we[Ie],1,1,()=>{we[Ie]=null}),Sn(),de=we[K],de?de.p(U,X):(de=we[K]=Be[K](U),de.c()),Ve(de,1),de.m(t,null)),(!te||X[0]&4)&&D(e,"fullscreen",U[2]),(!te||X[0]&8)&&D(e,"screen-theme",U[3].theme==="screen"),X[0]&8&&Ye!==(Ye=`${U[3].height}px`)&&F(e,"height",Ye)},i(U){te||(Ve(de),te=!0)},o(U){ut(de),te=!1},d(U){U&&H(e),ve.d(),ke.d(),we[K].d(),Je=!1,be(Z)}}}function Tl(i){let e;return{c(){e=V("path"),a(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&&H(e)}}}function vl(i){let e;return{c(){e=V("path"),a(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&&H(e)}}}function Sl(i){let e,t;return{c(){e=V("rect"),t=V("line"),a(e,"x","3"),a(e,"y","3"),a(e,"width","18"),a(e,"height","18"),a(e,"rx","2"),a(e,"ry","2"),a(t,"x1","16"),a(t,"y1","6"),a(t,"x2","16"),a(t,"y2","18")},m(n,s){q(n,e,s),q(n,t,s)},d(n){n&&(H(e),H(t))}}}function El(i){let e,t;return{c(){e=V("rect"),t=V("rect"),a(e,"x","3"),a(e,"y","3"),a(e,"width","18"),a(e,"height","18"),a(e,"rx","2"),a(e,"ry","2"),a(t,"x","12"),a(t,"y","10"),a(t,"width","6"),a(t,"height","8"),a(t,"rx","1"),a(t,"ry","1")},m(n,s){q(n,e,s),q(n,t,s)},d(n){n&&(H(e),H(t))}}}function Al(i){var n,s,o,l,r,c,f,u,m;let e,t;return e=new yl({props:{zIndex:(n=i[3].zIndex)!=null?n:1e3,sessionId:i[10],hasScene:(s=i[3].hasScene)!=null?s:!1,apiPrefix:(o=i[3].apiPrefix)!=null?o:"/aiops/aigc",theme:(l=i[3].theme)!=null?l:"default",showHistory:(r=i[3].showHistory)!=null?r:!0,showActions:(c=i[3].showActions)!=null?c:!0,sendIcon:(f=i[3].sendIcon)!=null?f:"",robotIcon:(u=i[3].robotIcon)!=null?u:"",userIcon:(m=i[3].userIcon)!=null?m:""}}),e.$on("firstResponse",i[33]),{c(){En(e.$$.fragment)},m(d,p){rn(e,d,p),t=!0},p(d,p){var _,I,M,R,y,b,E,A,S;const g={};p[0]&8&&(g.zIndex=(_=d[3].zIndex)!=null?_:1e3),p[0]&1024&&(g.sessionId=d[10]),p[0]&8&&(g.hasScene=(I=d[3].hasScene)!=null?I:!1),p[0]&8&&(g.apiPrefix=(M=d[3].apiPrefix)!=null?M:"/aiops/aigc"),p[0]&8&&(g.theme=(R=d[3].theme)!=null?R:"default"),p[0]&8&&(g.showHistory=(y=d[3].showHistory)!=null?y:!0),p[0]&8&&(g.showActions=(b=d[3].showActions)!=null?b:!0),p[0]&8&&(g.sendIcon=(E=d[3].sendIcon)!=null?E:""),p[0]&8&&(g.robotIcon=(A=d[3].robotIcon)!=null?A:""),p[0]&8&&(g.userIcon=(S=d[3].userIcon)!=null?S:""),e.$set(g)},i(d){t||(Ve(e.$$.fragment,d),t=!0)},o(d){ut(e.$$.fragment,d),t=!1},d(d){an(e,d)}}}function Il(i){var n,s;let e,t;return e=new Ji({props:{sessions:i[15],onClose:i[32],onSelect:Dl,zIndex:(n=i[3].zIndex)!=null?n:1e3,apiPrefix:(s=i[3].apiPrefix)!=null?s:"/aiops/aigc"}}),{c(){En(e.$$.fragment)},m(o,l){rn(e,o,l),t=!0},p(o,l){var c,f;const r={};l[0]&512&&(r.onClose=o[32]),l[0]&8&&(r.zIndex=(c=o[3].zIndex)!=null?c:1e3),l[0]&8&&(r.apiPrefix=(f=o[3].apiPrefix)!=null?f:"/aiops/aigc"),e.$set(r)},i(o){t||(Ve(e.$$.fragment,o),t=!0)},o(o){ut(e.$$.fragment,o),t=!1},d(o){an(e,o)}}}function Rl(i){let e,t,n,s,o,l,r,c,f,u;return{c(){e=V("svg"),t=V("path"),n=V("path"),s=V("path"),o=V("path"),l=V("path"),r=V("path"),c=V("path"),a(t,"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"),a(t,"fill","#6F8698"),a(n,"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"),a(n,"fill","#3677FF"),a(s,"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"),a(s,"fill","#D0D5F1"),a(o,"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"),a(o,"fill","#3677FF"),a(l,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(l,"fill","#FFFFFF"),a(r,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(r,"fill","#FFFFFF"),a(c,"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"),a(c,"fill","#8896A4"),a(e,"class","sy-assistant-icon"),a(e,"viewBox","0 0 1024 1024"),a(e,"version","1.1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width",f=i[3].isSelf?void 0:i[3].iconWidth),a(e,"height",u=i[3].isSelf?void 0:i[3].iconHeight),a(e,"fill","currentColor"),a(e,"aria-label","助手图标")},m(m,d){q(m,e,d),w(e,t),w(e,n),w(e,s),w(e,o),w(e,l),w(e,r),w(e,c)},p(m,d){d[0]&8&&f!==(f=m[3].isSelf?void 0:m[3].iconWidth)&&a(e,"width",f),d[0]&8&&u!==(u=m[3].isSelf?void 0:m[3].iconHeight)&&a(e,"height",u)},d(m){m&&H(e)}}}function Ml(i){let e,t,n;function s(r,c){return c[0]&8&&(e=null),c[0]&8&&(t=null),e==null&&(e=!!(r[3].icon.startsWith("data:image")||r[3].icon.startsWith("data:image/svg+xml"))),e?xl:(t==null&&(t=!!r[3].icon.includes("<svg")),t?Ll:Cl)}let o=s(i,[-1,-1]),l=o(i);return{c(){l.c(),n=Mt()},m(r,c){l.m(r,c),q(r,n,c)},p(r,c){o===(o=s(r,c))&&l?l.p(r,c):(l.d(1),l=o(r),l&&(l.c(),l.m(n.parentNode,n)))},d(r){r&&H(n),l.d(r)}}}function Cl(i){let e,t,n,s,o,l,r,c,f,u;return{c(){e=V("svg"),t=V("path"),n=V("path"),s=V("path"),o=V("path"),l=V("path"),r=V("path"),c=V("path"),a(t,"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"),a(t,"fill","#6F8698"),a(n,"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"),a(n,"fill","#3677FF"),a(s,"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"),a(s,"fill","#D0D5F1"),a(o,"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"),a(o,"fill","#3677FF"),a(l,"d","M286.72 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(l,"fill","#FFFFFF"),a(r,"d","M608.256 583.68a78.336 70.144 90 1 0 140.288 0 78.336 70.144 90 1 0-140.288 0Z"),a(r,"fill","#FFFFFF"),a(c,"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"),a(c,"fill","#8896A4"),a(e,"class","sy-assistant-icon"),a(e,"viewBox","0 0 1024 1024"),a(e,"version","1.1"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width",f=i[3].isSelf?void 0:i[3].iconWidth),a(e,"height",u=i[3].isSelf?void 0:i[3].iconHeight),a(e,"fill","currentColor"),a(e,"aria-label","助手图标")},m(m,d){q(m,e,d),w(e,t),w(e,n),w(e,s),w(e,o),w(e,l),w(e,r),w(e,c)},p(m,d){d[0]&8&&f!==(f=m[3].isSelf?void 0:m[3].iconWidth)&&a(e,"width",f),d[0]&8&&u!==(u=m[3].isSelf?void 0:m[3].iconHeight)&&a(e,"height",u)},d(m){m&&H(e)}}}function Ll(i){let e,t=(i[3].isSelf?i[3].icon:i[3].icon.replace(/width="[^"]*"/,`width="${i[3].iconWidth}"`).replace(/height="[^"]*"/,`height="${i[3].iconHeight}"`))+"",n;return{c(){e=new Hs(!1),n=Mt(),e.a=n},m(s,o){e.m(t,s,o),q(s,n,o)},p(s,o){o[0]&8&&t!==(t=(s[3].isSelf?s[3].icon:s[3].icon.replace(/width="[^"]*"/,`width="${s[3].iconWidth}"`).replace(/height="[^"]*"/,`height="${s[3].iconHeight}"`))+"")&&e.p(t)},d(s){s&&(H(n),e.d())}}}function xl(i){let e,t,n;return{c(){e=v("img"),nt(e.src,t=i[3].icon)||a(e,"src",t),a(e,"alt","助手图标"),a(e,"style",n=i[3].isSelf?"":`width: ${i[3].iconWidth}px; height: ${i[3].iconHeight}px;`)},m(s,o){q(s,e,o)},p(s,o){o[0]&8&&!nt(e.src,t=s[3].icon)&&a(e,"src",t),o[0]&8&&n!==(n=s[3].isSelf?"":`width: ${s[3].iconWidth}px; height: ${s[3].iconHeight}px;`)&&a(e,"style",n)},d(s){s&&H(e)}}}function zl(i){let e,t,n=`${i[13]}px`,s,o,l,r,c,f,u=i[13]>0&&gs(i);function m(g,_){return g[3].icon?Ml:Rl}let d=m(i),p=d(i);return{c(){var g,_;e=v("div"),t=v("div"),u&&u.c(),s=G(),o=v("button"),p.c(),a(t,"class","sy-assistant-drawer-wrapper svelte-1h7dpbq"),D(t,"fullscreen",i[2]),F(t,"width",n),a(o,"class","sy-assistant-floating-button svelte-1h7dpbq"),a(o,"aria-label","打开助手"),a(o,"style",l=i[11]+" z-index: "+(((g=i[3].zIndex)!=null?g:1e3)+1)+"; "+i[21]()),D(o,"isSelf",i[3].isSelf),D(o,"hidden-left",i[7]==="left"),D(o,"hidden-right",i[7]==="right"),D(o,"hidden-top",i[7]==="top"),D(o,"hidden-bottom",i[7]==="bottom"),a(e,"class","sy-assistant-container sy-assistant-theme svelte-1h7dpbq"),D(e,"fullscreen",i[2]),D(e,"snapped",i[8]),D(e,"screen-theme",i[3].theme==="screen"),F(e,"position",i[3].position),F(e,"right",i[8]?0:`${i[0]}px`),F(e,"bottom",i[8]?0:`${i[1]}px`),F(e,"top",i[8]||i[2]?"0":"auto"),F(e,"left",i[2]?"0":"auto"),F(e,"z-index",(_=i[3].zIndex)!=null?_:1e3)},m(g,_){q(g,e,_),w(e,t),u&&u.m(t,null),w(e,s),w(e,o),p.m(o,null),i[34](o),i[36](e),r=!0,c||(f=[W(o,"click",i[17]),W(o,"mousedown",si(i[35])),W(o,"mouseenter",i[22]),W(o,"mouseleave",i[23])],c=!0)},p(g,_){var I,M;g[13]>0?u?(u.p(g,_),_[0]&8192&&Ve(u,1)):(u=gs(g),u.c(),Ve(u,1),u.m(t,null)):u&&(vn(),ut(u,1,1,()=>{u=null}),Sn()),(!r||_[0]&4)&&D(t,"fullscreen",g[2]),_[0]&8192&&n!==(n=`${g[13]}px`)&&F(t,"width",n),d===(d=m(g))&&p?p.p(g,_):(p.d(1),p=d(g),p&&(p.c(),p.m(o,null))),(!r||_[0]&2056&&l!==(l=g[11]+" z-index: "+(((I=g[3].zIndex)!=null?I:1e3)+1)+"; "+g[21]()))&&a(o,"style",l),(!r||_[0]&8)&&D(o,"isSelf",g[3].isSelf),(!r||_[0]&128)&&D(o,"hidden-left",g[7]==="left"),(!r||_[0]&128)&&D(o,"hidden-right",g[7]==="right"),(!r||_[0]&128)&&D(o,"hidden-top",g[7]==="top"),(!r||_[0]&128)&&D(o,"hidden-bottom",g[7]==="bottom"),(!r||_[0]&4)&&D(e,"fullscreen",g[2]),(!r||_[0]&256)&&D(e,"snapped",g[8]),(!r||_[0]&8)&&D(e,"screen-theme",g[3].theme==="screen"),_[0]&8&&F(e,"position",g[3].position),_[0]&257&&F(e,"right",g[8]?0:`${g[0]}px`),_[0]&258&&F(e,"bottom",g[8]?0:`${g[1]}px`),_[0]&260&&F(e,"top",g[8]||g[2]?"0":"auto"),_[0]&4&&F(e,"left",g[2]?"0":"auto"),_[0]&8&&F(e,"z-index",(M=g[3].zIndex)!=null?M:1e3)},i(g){r||(Ve(u),r=!0)},o(g){ut(u),r=!1},d(g){g&&H(e),u&&u.d(),p.d(),i[34](null),i[36](null),c=!1,be(f)}}}const ws=48,ge=20;function Dl(i){}function Ol(i,e,t){let n,s,o,l,r=j,c=()=>(r(),r=Ds(s,x=>t(13,l=x)),s);i.$$.on_destroy.push(()=>r());const f=li(),u={position:"fixed",width:480,height:800,title:"智慧运维助手",initialState:"default",defaultPosition:{right:ge,bottom:ge},snappedWidth:480,drawerWidth:480,zIndex:1e3,hasScene:!1,apiPrefix:"/aiops/aigc",isSelf:!1,icon:"",iconWidth:void 0,iconHeight:void 0,theme:"default",showHistory:!0,showActions:!0,sendIcon:"",robotIcon:"",userIcon:"",hideEnabled:!1,hideDelay:5e3};let{target:m="body"}=e,{options:d={}}=e,p,g=null,_=!1,I,M=!1,R=0,y=0,b=ge,E=20,A=b,S=E,C=!1,L=ge,ee=50,B=!1,z=!1,Y=null,le=null,se="",K={left:"auto",right:`${ge}px`,top:"auto",bottom:"50%"},de=!1,Ye={width:0},te=!1,Je=!1,Z=[],Ae=null;function ae(){return Pe(this,null,function*(){try{const x=yield fetch(`${n.apiPrefix}/chat/getSessionId`,{method:"POST",headers:{"Content-Type":"application/json","Auth-Token":`${ye()}`,Authorization:`bearer ${ye()}`}});if(!x.ok)throw new Error("Failed to get session ID");const $=yield x.json();if($.code===0)return t(10,Ae=$.data.sessionId),Ae;throw new Error($.message||"Failed to get session ID")}catch(x){return console.error("Failed to get session ID:",x),null}})}function ve(x,$=!1){$?t(27,C=!0):t(6,M=!0),R=x.clientX,y=x.clientY,b=$?L:A,E=$?ee:S,x.preventDefault()}function ce(x){if(!M&&!C)return;const $=R-x.clientX,pe=y-x.clientY;if(C){const Se=b+$,Ce=x.clientY,Le=yt();t(28,L=Math.max(ge,Math.min(window.innerWidth-Le-ge,Se)));const xe=window.innerHeight-Le-ge,je=Math.max(ge,Math.min(xe,Ce));ee=(window.innerHeight-je-Le)/window.innerHeight*100,t(31,K={left:"auto",right:`${L}px`,top:"auto",bottom:`${ee}%`}),t(30,se=""),t(7,le=null)}else{const Se=n.width||0,Ce=n.height||0,Le=b+$;t(0,A=Math.max(ge,Math.min(window.innerWidth-Se-ge,Le)));const xe=E+pe;t(1,S=Math.max(ge,Math.min(window.innerHeight-Ce-ge,xe)))}}function qe(){const x=C;t(6,M=!1),t(27,C=!1),x&&n.hideEnabled&&!_&&!B&&ke()}function ke(){!n.hideEnabled||_||B||(Be(),Y=setTimeout(()=>{et()},n.hideDelay))}function Be(){Y&&(clearTimeout(Y),Y=null)}function we(){const x=window.innerWidth,$=window.innerHeight,pe=yt(),Se=x-L-pe,Ce=$-ee/100*$-pe,Le=Se,xe=x-Se-pe,Xe=Ce,je=$-Ce-pe,Ke=Math.min(Le,xe,Xe,je);return Ke===Le?{direction:"left",position:{left:`${-pe/2}px`,right:"auto",top:`${Ce}px`,bottom:"auto"},transform:"rotate(45deg) scale(0.8)"}:Ke===xe?{direction:"right",position:{left:"auto",right:`${-pe/2}px`,top:`${Ce}px`,bottom:"auto"},transform:"rotate(-45deg) scale(0.8)"}:Ke===Xe?{direction:"top",position:{left:`${Se}px`,right:"auto",top:`${-pe/2}px`,bottom:"auto"},transform:"rotate(180deg) scale(0.7)"}:{direction:"bottom",position:{left:`${Se}px`,right:"auto",top:"auto",bottom:`${-pe/2}px`},transform:"scale(0.7)"}}function et(){if(_||B)return;const x=we();t(7,le=x.direction),t(31,K=x.position),t(30,se=x.transform),z=!0}function U(){z&&(t(7,le=null),t(31,K={left:"auto",right:`${L}px`,top:"auto",bottom:`${ee}%`}),t(30,se=""),z=!1)}kn(()=>{typeof m=="string"?g=document.querySelector(m)||document.body:g=m||document.body;const x=pe=>ce(pe),$=()=>qe();return document.addEventListener("mousemove",x),document.addEventListener("mouseup",$),p&&g&&g.appendChild(p),I&&I.getBoundingClientRect().left,t(8,te=n.initialState==="snapped"),t(2,de=n.initialState==="fullscreen"),n.initialState==="snapped"?(t(0,A=0),t(1,S=0),t(3,n=Re(ue({},n),{height:typeof window!="undefined"?window.innerHeight:n.height,width:n.snappedWidth||n.width}))):n.initialState==="fullscreen"&&(t(0,A=0),t(1,S=0),t(3,n=Re(ue({},n),{width:typeof window!="undefined"?window.innerWidth:n.width,height:typeof window!="undefined"?window.innerHeight:n.height}))),n.hideEnabled&&ke(),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",$),Be(),g&&p&&g.removeChild(p)}});function X(){return Pe(this,null,function*(){_?n.hideEnabled&&ke():(yield ae(),Be(),z&&U()),t(26,_=!_)})}function Ie(){var x,$,pe,Se,Ce,Le,xe,Xe;t(2,de=!de),de?(Ye.width||(Ye={width:u.width,height:u.height,right:($=(x=u.defaultPosition)==null?void 0:x.right)!=null?$:ge,bottom:(Se=(pe=u.defaultPosition)==null?void 0:pe.bottom)!=null?Se:ge}),te&&t(8,te=!1),t(24,d=Re(ue({},n),{width:window.innerWidth,height:window.innerHeight,drawerWidth:window.innerWidth})),t(0,A=0),t(1,S=0)):(t(24,d=Re(ue({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,A=(Le=(Ce=u.defaultPosition)==null?void 0:Ce.right)!=null?Le:ge),t(1,S=(Xe=(xe=u.defaultPosition)==null?void 0:xe.bottom)!=null?Xe:ge))}function Ue(x){de||ve(x)}function ot(){var x,$,pe,Se;de&&(t(2,de=!1),t(24,d=Re(ue({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth}))),t(8,te=!te),te?(n.height,t(0,A=0),t(1,S=0),t(24,d=Re(ue({},n),{height:window.innerHeight,width:n.snappedWidth||u.width,drawerWidth:n.snappedWidth||u.width}))):(t(24,d=Re(ue({},n),{width:u.width,height:u.height,drawerWidth:u.drawerWidth})),t(0,A=($=(x=u.defaultPosition)==null?void 0:x.right)!=null?$:ge),t(1,S=(Se=(pe=u.defaultPosition)==null?void 0:pe.bottom)!=null?Se:ge))}function lt(){return n.isSelf?n.iconWidth!==void 0&&n.iconHeight!==void 0?`width: ${n.iconWidth}px; height: ${n.iconHeight}px;`:"":n.iconWidth!==void 0&&n.iconHeight!==void 0?`width: ${n.iconWidth}px; height: ${n.iconHeight}px;`:"width: 48px; height: 48px;"}function rt(){t(29,B=!0),Be(),z&&U()}function bt(){t(29,B=!1),n.hideEnabled&&!_&&ke()}function kt(){if(n.isSelf&&I){const x=I.querySelector("img, svg");if(x){const $=x.getBoundingClientRect();if($.width>0&&$.height>0)return{width:$.width,height:$.height}}}return n.iconWidth&&n.iconHeight?{width:n.iconWidth,height:n.iconHeight}:{width:ws,height:ws}}function yt(){const{width:x,height:$}=kt();return Math.max(x,$)}const Ot=()=>t(9,Je=!1),Kt=x=>f("firstResponse",x.detail);function At(x){Bt[x?"unshift":"push"](()=>{I=x,t(5,I)})}const ht=x=>ve(x,!0);function at(x){Bt[x?"unshift":"push"](()=>{p=x,t(4,p)})}return i.$$set=x=>{"target"in x&&t(25,m=x.target),"options"in x&&t(24,d=x.options)},i.$$.update=()=>{if(i.$$.dirty[0]&16777216&&t(3,n=Re(ue(ue({},u),d),{defaultPosition:ue(ue({},u.defaultPosition),d.defaultPosition)})),i.$$.dirty[0]&67108876&&c(t(12,s=Vs(_?de?window.innerWidth:n.drawerWidth:0,{stiffness:.1,damping:.6}))),i.$$.dirty[0]&268435467&&typeof window!="undefined"){t(0,A=Math.max(ge,Math.min(window.innerWidth-(n.width||0),A))),t(1,S=Math.max(ge,Math.min(window.innerHeight-(n.height||0),S)));const x=yt();t(28,L=Math.max(ge,Math.min(window.innerWidth-x-ge,L)))}i.$$.dirty[0]&603979784&&(n.hideEnabled&&!_&&!B?ke():Be()),i.$$.dirty[0]&1275068416|i.$$.dirty[1]&1&&t(11,o=_?"display: none;":`position: fixed; left: ${K.left}; right: ${K.right}; top: ${K.top}; bottom: ${K.bottom}; transform: ${se}; cursor: ${C?"grabbing":"grab"};`)},[A,S,de,n,p,I,M,le,te,Je,Ae,o,s,l,f,Z,ve,X,Ie,Ue,ot,lt,rt,bt,d,m,_,C,L,B,se,K,Ot,Kt,At,ht,at]}class Pl extends In{constructor(e){super(),An(this,e,Ol,zl,It,{target:25,options:24},null,[-1,-1])}}ie.SyAssistant=Pl,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});