diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index df517beb..04a4bf79 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1504,7 +1504,9 @@ export default function App() { return; } - setTurnsFor(sid, optimisticTurns); + setTurnsFor(sid, (current) => + createsSession ? optimisticTurns : [...current, ...optimisticTurns], + ); if (createsSession) { viewSidRef.current = sid; setSessionId(sid); diff --git a/frontend/tests/composerPresentation.test.mjs b/frontend/tests/composerPresentation.test.mjs index 81fdd02c..44571066 100644 --- a/frontend/tests/composerPresentation.test.mjs +++ b/frontend/tests/composerPresentation.test.mjs @@ -35,12 +35,20 @@ test("first message renders before session creation finishes", () => { assert.match(appSource, /sid = await ensureSession\(!createsSession\)/); assert.match( appSource, - /setTurnsFor\(sid, optimisticTurns\);[\s\S]*?setSessionId\(sid\);[\s\S]*?setInitializingSession\(false\);/, + /setTurnsFor\(sid,\s*\(current\)\s*=>\s*createsSession\s*\?\s*optimisticTurns\s*:\s*\[\.\.\.current,\s*\.\.\.optimisticTurns\],\s*\);[\s\S]*?setSessionId\(sid\);[\s\S]*?setInitializingSession\(false\);/, ); assert.match(appSource, /const conversationBusy = busy \|\| initializingSession/); assert.match(composerSource, /sessionInitializing \? "初始化中" : sessionId \|\| "—"/); }); +test("subsequent messages append to the active session transcript", () => { + assert.match( + appSource, + /createsSession\s*\?\s*optimisticTurns\s*:\s*\[\.\.\.current,\s*\.\.\.optimisticTurns\]/, + ); + assert.doesNotMatch(appSource, /setTurnsFor\(sid, optimisticTurns\);/); +}); + test("new-session failure restores the submitted text", () => { assert.match( appSource, diff --git a/veadk/webui/assets/CodeEditor-B47Yc-gR.js b/veadk/webui/assets/CodeEditor-C7VckftE.js similarity index 99% rename from veadk/webui/assets/CodeEditor-B47Yc-gR.js rename to veadk/webui/assets/CodeEditor-C7VckftE.js index 4ae43344..8d4785b1 100644 --- a/veadk/webui/assets/CodeEditor-B47Yc-gR.js +++ b/veadk/webui/assets/CodeEditor-C7VckftE.js @@ -1,4 +1,4 @@ -import{A as xe,t as sf}from"./index-NDcH-KLD.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` +import{A as xe,t as sf}from"./index-u-pg5XfV.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;s<=t&&oe&&o&&(r+=n),es&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new le(n,r)),n=[],r=-1);return r>-1&&t.push(new le(n,r)),t}}class Ot extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?n.push(l):l.decompose(e-o,t-o,n,h)}o=a+1}}replace(e,t,n){if([e,t]=Vi(this,e,t),n.lines=s&&t<=l){let a=o.replace(e-s,t-s,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new Ot(c,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;se&&s&&(r+=n),eo&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ot))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let u of e)n+=u.lines;if(n<32){let u=[];for(let d of e)d.flatten(u);return new le(u,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function O(u){let d;if(u.lines>s&&u instanceof Ot)for(let m of u.children)O(m);else u.lines>o&&(a>o||!a)?(f(),l.push(u)):u instanceof le&&a&&(d=c[c.length-1])instanceof le&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new le(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>r&&f(),a+=u.lines,h+=u.length+1,c.push(u))}function f(){a!=0&&(l.push(c.length==1?c[0]:Ot.from(c,h)),h=-1,a=c.length=0)}for(let u of e)O(u);return f(),l.length==1?l[0]:new Ot(l,t)}}D.empty=new le([""],0);function Vg(i){let e=-1;for(let t of i)e+=t.length+1;return e}function zr(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s=t&&(a>n&&(l=l.slice(0,n-r)),r0?1:(e instanceof le?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof le?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof le){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof le?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Sf{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new gn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},gn.prototype[Symbol.iterator]=Sf.prototype[Symbol.iterator]=bf.prototype[Symbol.iterator]=function(){return this});let Yg=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Vi(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function de(i,e,t=!0,n=!0){return Eg(i,e,t,n)}function Lg(i){return i>=56320&&i<57344}function Dg(i){return i>=55296&&i<56320}function Re(i,e){let t=i.charCodeAt(e);if(!Dg(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Lg(n)?(t-55296<<10)+(n-56320)+65536:t}function oa(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ft(i){return i<65536?1:2}const Jo=/\r\n?|\n/;var Se=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(Se||(Se={}));class Qt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-r);s+=l}else{if(n!=Se.Simple&&h>=e&&(n==Se.TrackDel&&re||n==Se.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&l>=e)return rt?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Qt(e)}static create(e){return new Qt(e)}}class ce extends Qt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return el(this,(t,n,r,s,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return tl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length0&&Bt(n,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;of||O<0||f>t)throw new RangeError(`Invalid change range ${O} to ${f} (in doc of length ${t})`);let d=u?typeof u=="string"?D.of(u.split(n||Jo)):u:D.empty,m=d.length;if(O==f&&m==0)return;Oo&&ke(r,O-o,-1),ke(r,f-O,m),Bt(s,r,d),o=f}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length=0&&t<=0&&t==i[r+1]?i[r]+=e:r>=0&&e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function Bt(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(r,h,s,c,O),r=h,s=c}}}function tl(i,e,t,n=!1){let r=[],s=n?[]:null,o=new Xn(i),l=new Xn(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ke(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let O=Math.min(c,l.len);h+=O,c-=O,l.forward(O)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||n.length>h),s.forward2(a),o.forward(a)}}}}class Xn{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?D.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Lt(n,r,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,n,r){return new Lt(e,t,n,r)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;rr.from-s.from),t=e.indexOf(n);for(let r=1;rs.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function xf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let la=0;class C{constructor(e,t,n,r,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=la++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new C(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:aa),!!e.static,e.enables)}of(e){return new _r([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function aa(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class _r{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=la++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let O of this.dependencies)O=="doc"?a=!0:O=="selection"?h=!0:((t=e[O.id])!==null&&t!==void 0?t:1)&1||c.push(e[O.id]);return{create(O){return O.values[o]=n(O),1},update(O,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||il(O,c)){let u=n(O);if(l?!Zh(u,O.values[o],r):!r(u,O.values[o]))return O.values[o]=u,1}return 0},reconfigure:(O,f)=>{let u,d=f.config.address[s];if(d!=null){let m=es(f,d);if(this.dependencies.every(g=>g instanceof C?f.facet(g)===O.facet(g):g instanceof ye?f.field(g,!1)==O.field(g,!1):!0)||(l?Zh(u=n(O),m,r):r(u=n(O),m)))return O.values[o]=m,0}else u=n(O);return O.values[o]=u,1}}}get extension(){return this}}function Zh(i,e,t){if(i.length!=e.length)return!1;for(let n=0;ni[a.id]),r=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let h=[];for(let c=0;cn===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ur).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let s=n.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>{let s=n.facet(ur),o=r.facet(ur),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(n.values[t]=l.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,ur.of({field:this,create:e})]}get extension(){return this}}const ai={lowest:4,low:3,default:2,high:1,highest:0};function on(i){return e=>new kf(e,i)}const _t={highest:on(ai.highest),high:on(ai.high),default:on(ai.default),low:on(ai.low),lowest:on(ai.lowest)};class kf{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Xs{of(e){return new nl(this,e)}reconfigure(e){return Xs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class nl{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class Jr{constructor(e,t,n,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r=[],s=Object.create(null),o=new Map;for(let f of Gg(e,t,o))f instanceof ye?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of r)l[f.id]=h.length<<1,h.push(u=>f.slot(u));let c=n==null?void 0:n.config.facets;for(let f in s){let u=s[f],d=u[0].facet,m=c&&c[f]||[];if(u.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,aa(m,u))a.push(n.facet(d));else{let g=d.combine(u.map(Q=>Q.value));a.push(n&&d.compare(g,n.facet(d))?n.facet(d):g)}else{for(let g of u)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(Q=>g.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(g=>Bg(g,d,u))}}let O=h.map(f=>f(l));return new Jr(e,o,O,l,a,s)}}function Gg(i,e,t){let n=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=n[a].indexOf(o);h>-1&&n[a].splice(h,1),o instanceof nl&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof nl){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof kf)s(o.inner,o.prec);else if(o instanceof ye)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof _r)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,ai.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ai.default),n.reduce((o,l)=>o.concat(l))}function Qn(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function es(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Pf=C.define(),rl=C.define({combine:i=>i.some(e=>e),static:!0}),$f=C.define({combine:i=>i.length?i[0]:void 0,static:!0}),wf=C.define(),vf=C.define(),Tf=C.define(),Xf=C.define({combine:i=>i.length?i[0]:!1});class bt{constructor(e,t){this.type=e,this.value=t}static define(){return new Ig}}class Ig{of(e){return new bt(this,e)}}class Ug{constructor(e){this.map=e}of(e){return new W(this,e)}}class W{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new W(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ug(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(t);s&&n.push(s)}return n}}W.reconfigure=W.define();W.appendConfig=W.define();class he{constructor(e,t,n,r,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xf(n,t.newLength),s.some(l=>l.type==he.time)||(this.annotations=s.concat(he.time.of(Date.now())))}static create(e,t,n,r,s,o){return new he(e,t,n,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(he.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}he.time=bt.define();he.userEvent=bt.define();he.addToHistory=bt.define();he.remote=bt.define();function Ng(i,e){let t=[];for(let n=0,r=0;;){let s,o;if(n=i[n]))s=i[n++],o=i[n++];else if(r=0;r--){let s=n[r](i);s instanceof he?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof he?i=s[0]:i=Rf(e,Ai(s),!1)}return i}function Hg(i){let e=i.startState,t=e.facet(Tf),n=i;for(let r=t.length-1;r>=0;r--){let s=t[r](i);s&&Object.keys(s).length&&(n=Cf(n,sl(e,s,i.changes.newLength),!0))}return n==i?i:he.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const Kg=[];function Ai(i){return i==null?Kg:Array.isArray(i)?i:[i]}var te=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(te||(te={}));const Jg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ol;try{ol=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function e0(i){if(ol)return ol.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Jg.test(t)))return!0}return!1}function t0(i){return e=>{if(!/\S/.test(e))return te.Space;if(e0(e))return te.Word;for(let t=0;t-1)return te.Word;return te.Other}}class Y{constructor(e,t,n,r,s,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(W.reconfigure)?(t=null,n=l.value):l.is(W.appendConfig)&&(t=null,n=Ai(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=Jr.resolve(n,r,this),s=new Y(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(rl)?e.newSelection:e.newSelection.asSingle();new Y(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),s=[n.range],o=Ai(n.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return Y.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Jr.resolve(e.extensions||[],new Map),n=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(Y.lineSeparator)||Jo)),r=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return xf(r,n.length),t.staticFacet(rl)||(r=r.asSingle()),new Y(t,n,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Y.tabSize)}get lineBreak(){return this.facet(Y.lineSeparator)||` diff --git a/veadk/webui/assets/MarkdownPromptEditor-CvbLdIOO.js b/veadk/webui/assets/MarkdownPromptEditor--dxbgBhm.js similarity index 75% rename from veadk/webui/assets/MarkdownPromptEditor-CvbLdIOO.js rename to veadk/webui/assets/MarkdownPromptEditor--dxbgBhm.js index 3df1755d..f3d3310d 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-CvbLdIOO.js +++ b/veadk/webui/assets/MarkdownPromptEditor--dxbgBhm.js @@ -1,54 +1,54 @@ -var s2=Object.defineProperty;var l2=(t,e,n)=>e in t?s2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>l2(t,typeof e!="symbol"?e+"":e,n);import{i as Dd,j as a2,f as c2,g as Fc,y as u2,s as f2,A as C,a as N,e as Fd,c as Hd,V as it,x as mn,E as Ns,C as Za,B as d2,b as Vd,u as rn,w as pl,h as tf,v as xr,F as Un,D as zt,d as fi,k as h2,t as L,z as nr,o as g2,m as p2,n as m2,l as y2,r as x2,p as _2,q as v2,R as qo}from"./index-NDcH-KLD.js";const Bd={}.hasOwnProperty;function C2(t,e){const n=e||{};function r(o,...i){let s=r.invalid;const l=r.handlers;if(o&&Bd.call(o,t)){const a=String(o[t]);s=Bd.call(l,a)?l[a]:r.unknown}if(s)return s.call(this,o,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const b2={}.hasOwnProperty;function cm(t,e){let n=-1,r;if(e.extensions)for(;++ne in t?i2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>s2(t,typeof e!="symbol"?e+"":e,n);import{i as Dd,j as l2,f as a2,g as Fc,y as c2,G as u2,s as f2,A as C,a as N,e as Fd,c as Hd,V as it,x as mn,E as Ns,C as Za,B as d2,b as Vd,u as rn,w as pl,h as tf,v as xr,F as Un,D as zt,d as fi,k as h2,t as L,z as nr,o as g2,m as p2,n as m2,l as y2,r as x2,p as _2,q as v2,R as qo}from"./index-u-pg5XfV.js";const C2={}.hasOwnProperty;function am(t,e){let n=-1,r;if(e.extensions)for(;++n"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:_r},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:_r},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:_r},{atBreak:!0,character:"~"}];function k2(t){return t.label||!t.identifier?t.label||"":c2(t.identifier)}function N2(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function M2(t,e,n){const r=e.indexStack,o=t.children||[],i=[];let s=-1,l=n.before,a;r.push(-1);let c=e.createTracker(n);for(;++s0&&(l==="\r"||l===` -`)&&u.type==="html"&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=e.createTracker(n),c.move(i.join("")));let d=e.handle(u,t,e,{...c.current(),after:f,before:l});a&&a===d.slice(0,1)&&(d=Fc(a.charCodeAt(0))+d.slice(1));const g=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,a=void 0,g&&(i.length>0&&g.before&&l===i[i.length-1].slice(-1)&&(i[i.length-1]=i[i.length-1].slice(0,-1)+Fc(l.charCodeAt(0))),g.after&&(a=f)),c.move(d),i.push(d),l=d.slice(-1)}return r.pop(),i.join("")}function O2(t,e,n){const r=e.indexStack,o=t.children||[],i=e.createTracker(n),s=[];let l=-1;for(r.push(-1);++l"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:_r},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:_r},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:_r},{atBreak:!0,character:"~"}];function T2(t){return t.label||!t.identifier?t.label||"":a2(t.identifier)}function k2(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function N2(t,e,n){const r=e.indexStack,o=t.children||[],i=[];let s=-1,l=n.before,a;r.push(-1);let c=e.createTracker(n);for(;++s0&&(l==="\r"||l===` +`)&&u.type==="html"&&(i[i.length-1]=i[i.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=e.createTracker(n),c.move(i.join("")));let d=e.handle(u,t,e,{...c.current(),after:f,before:l});a&&a===d.slice(0,1)&&(d=Fc(a.charCodeAt(0))+d.slice(1));const g=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,a=void 0,g&&(i.length>0&&g.before&&l===i[i.length-1].slice(-1)&&(i[i.length-1]=i[i.length-1].slice(0,-1)+Fc(l.charCodeAt(0))),g.after&&(a=f)),c.move(d),i.push(d),l=d.slice(-1)}return r.pop(),i.join("")}function M2(t,e,n){const r=e.indexStack,o=t.children||[],i=e.createTracker(n),s=[];let l=-1;for(r.push(-1);++l `}return` -`}const P2=/\r?\n|\r/g;function L2(t,e){const n=[];let r=0,o=0,i;for(;i=P2.exec(t);)s(t.slice(r,i.index)),n.push(i[0]),r=i.index+i[0].length,o++;return s(t.slice(r)),n.join("");function s(l){n.push(e(l,o,!l))}}function $2(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),o=[],i=[],s={};let l=-1;for(;++l=c||u+1=c||u+1e in t?W2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vn=(t,e,n)=>z2(t,typeof e!="symbol"?e+"":e,n);let K2=class fm{constructor(e=new Map){this.map=e}clone(){return new fm(new Map(this.map))}increment(e){const n=this.map.get(e)??0;this.map.set(e,n+1)}decrement(e,n){let r=this.map.get(e);r!==void 0&&(r-=1,this.map.set(e,r),r===0&&n())}};class Ms{constructor(){vn(this,"map",new Map)}getOrCreate(e){let n=this.map.get(e);return n===void 0&&(n=new Set,this.map.set(e,n)),n}get(e){return this.map.get(e)}use(e,n){const r=this.get(e);r!==void 0&&n(r)}delete(e){return this.map.delete(e)}}function wi(t,e){return e(t),t}function dm(){}const hm="cell";function zd(t,e){return t===e}const nf=new Map;let J2=class{constructor(e={}){vn(this,"subscriptions",new Ms),vn(this,"singletonSubscriptions",new Map),vn(this,"graph",new Ms),vn(this,"state",new Map),vn(this,"distinctNodes",new Map),vn(this,"executionMaps",new Map),vn(this,"definitionRegistry",new Set),vn(this,"combinedCells",[]);for(const n of Object.getOwnPropertySymbols(e))this.state.set(n,e[n])}cellInstance(e,n=!0,r=Symbol()){return this.state.has(r)||this.state.set(r,e),n!==!1&&!this.distinctNodes.has(r)&&this.distinctNodes.set(r,n===!0?zd:n),r}signalInstance(e=!0,n=Symbol()){return e!==!1&&this.distinctNodes.set(n,e===!0?zd:e),n}sub(e,n){this.register(e);const r=this.subscriptions.getOrCreate(e);return r.add(n),()=>r.delete(n)}singletonSub(e,n){return this.register(e),n===void 0?this.singletonSubscriptions.delete(e):this.singletonSubscriptions.set(e,n),()=>this.singletonSubscriptions.delete(e)}resetSingletonSubs(){this.singletonSubscriptions.clear()}subMultiple(e,n){const r=this.signalInstance();return this.connect({map:o=>(...i)=>{o(i)},sink:r,sources:e}),this.sub(r,n)}pubIn(e){var n;const r=Reflect.ownKeys(e),o=this.getExecutionMap(r),i=o.refCount.clone(),s=o.participatingNodes.slice(),l=new Map(this.state),a=c=>{this.graph.use(c,u=>{for(const{sources:f,sink:d}of u)f.has(c)&&i.decrement(d,()=>{s.splice(s.indexOf(d),1),a(d)})})};for(;;){const c=s.shift();if(c===void 0)break;const u=c;let f=!1;const d=g=>{const h=this.distinctNodes.get(u);if(h!=null&&h(l.get(u),g)){f=!1;return}f=!0,l.set(u,g),this.state.has(u)&&this.state.set(u,g)};if(Object.prototype.hasOwnProperty.call(e,u)?d(e[u]):o.projections.use(u,g=>{for(const h of g){const p=[...Array.from(h.sources),...Array.from(h.pulls)].map(y=>l.get(y));h.map(d)(...p)}}),f){const g=l.get(u);this.inContext(()=>{this.subscriptions.use(u,h=>{for(const p of h)p(g)})}),(n=this.singletonSubscriptions.get(u))==null||n(g)}else a(u)}}connect({sources:e,pulls:n=[],map:r,sink:o}){const i={map:r,pulls:new Set(n),sink:this.register(o),sources:new Set(e)};for(const s of[...e,...n])this.register(s),this.graph.getOrCreate(s).add(i);this.executionMaps.clear()}pub(e,n){this.pubIn({[e]:n})}pipe(e,...n){return this.combineOperators(...n)(e)}transformer(...e){return n=>wi(this.signalInstance(),r=>(this.link(this.pipe(r,...e),n),r))}link(e,n){this.connect({map:r=>o=>{r(o)},sink:n,sources:[e]})}combine(...e){return wi(this.signalInstance(),n=>{this.connect({map:r=>(...o)=>{r(o)},sink:n,sources:e})})}combineCells(...e){const n=this.combinedCells.find(o=>e.length===o.sources.length&&e.every((i,s)=>i===o.sources[s]));if(n)return n.cell;const r=this.cellInstance(e.map(o=>this.getValue(o)),!0);return this.connect({map:o=>(...i)=>{o(i)},sink:r,sources:e}),this.combinedCells.push({sources:e,cell:r}),r}getValue(e){return this.register(e),this.state.get(e)}getValues(e){return e.map(n=>this.getValue(n))}register(e){const n=nf.get(e);return n===void 0||this.definitionRegistry.has(e)?e:(this.definitionRegistry.add(e),wi(n.type===hm?this.cellInstance(n.initial,n.distinct,e):this.signalInstance(n.distinct,e),r=>{this.inContext(()=>{n.init(this,r)})}))}inContext(e){return e()}changeWith(e,n,r){this.connect({sources:[n],pulls:[e],sink:e,map:o=>(i,s)=>{o(r(s,i))}})}calculateExecutionMap(e){const n=[],r=new Set,o=new Ms,i=new K2,s=new Ms,l=(a,c=0)=>{i.increment(a),!r.has(a)&&(this.register(a),o.use(a,u=>{c=Math.max(...Array.from(u).map(f=>n.indexOf(f)))+1}),this.graph.use(a,u=>{for(const f of u)f.sources.has(a)?(s.getOrCreate(f.sink).add(f),l(f.sink,c)):o.getOrCreate(f.sink).add(a)}),r.add(a),n.splice(c,0,a))};return e.forEach(l),{participatingNodes:n,pendingPulls:o,projections:s,refCount:i}}getExecutionMap(e){let n=e;if(e.length===1){n=e[0];const o=this.executionMaps.get(n);if(o!==void 0)return o}else for(const[o,i]of this.executionMaps.entries())if(Array.isArray(o)&&o.length===e.length&&o.every(s=>e.includes(s)))return i;const r=this.calculateExecutionMap(e);return this.executionMaps.set(n,r),r}combineOperators(...e){return n=>{for(const r of e)n=r(n,this);return n}}};function Y(t,e=dm,n=!0){return wi(Symbol(),r=>{nf.set(r,{type:hm,distinct:n,initial:t,init:e})})}function jt(t=dm,e=!1){return wi(Symbol(),n=>{nf.set(n,{type:"signal",distinct:e,init:t})})}const gm=C.createContext(null);function ea(){const t=C.useContext(gm);if(t===null)throw new Error("useRealm must be used within a RealmContextProvider");return t}function ln(t){const e=ea();e.register(t);const n=C.useCallback(r=>e.sub(t,r),[e,t]);return C.useSyncExternalStore(n,()=>e.getValue(t),()=>e.getValue(t))}function Yo(...t){const e=ea(),n=C.useMemo(()=>e.combineCells.apply(e,t),[e,...t]);return ln(n)}function $r(t){const e=ea();return e.register(t),C.useCallback(n=>{e.pub(t,n)},[e,t])}function pm(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:o=>i=>{o(t(i))},sink:r,sources:[e]}),r}}function Ft(...t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:o=>(...i)=>{o(i)},pulls:t,sink:r,sources:[e]}),r}}function ta(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:o=>i=>{t(i)&&o(i)},sink:r,sources:[e]}),r}}function mm(t,e){return(n,r)=>{const o=r.signalInstance();return r.connect({map:i=>s=>{i(e=t(e,s))},sink:o,sources:[n]}),o}}const ml=new WeakMap;function Kd(t,e){let n=ml.get(t);return n||(n=new Set,ml.set(t,n)),n.add(e),()=>{n.delete(e)}}function Jd(t){const e=ml.get(t);if(ml.delete(t),!e)return;let n=!1,r;for(const o of[...e].reverse())try{o()}catch(i){n||(n=!0,r=i)}if(n)throw r instanceof Error?r:new Error("Realm cleanup failed with a non-Error value")}function Xo(t){return function(e){return{init:n=>{var r;return(r=t.init)==null?void 0:r.call(t,n,e)},postInit:n=>{var r;return(r=t.postInit)==null?void 0:r.call(t,n,e)},update:n=>{var r;return(r=t.update)==null?void 0:r.call(t,n,e)}}}}function U2({children:t,plugins:e}){const[n,r]=N.useState(null);return N.useEffect(()=>{var o,i;const s=new J2;try{for(const l of e)(o=l.init)==null||o.call(l,s);for(const l of e)(i=l.postInit)==null||i.call(l,s)}catch(l){try{Jd(s)}catch(a){throw new AggregateError([l,a],"Realm plugin initialization and cleanup both failed")}throw l}return r(s),()=>{Jd(s)}},[]),N.useEffect(()=>{var o;if(n)for(const i of e)(o=i.update)==null||o.call(i,n)}),n?N.createElement(gm.Provider,{value:n},t):null}function I(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ym(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const dt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,G2=dt&&"documentMode"in document?document.documentMode:null,Ut=dt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ln=dt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),jo=!(!dt||!("InputEvent"in window)||G2)&&"getTargetRanges"in new window.InputEvent("input"),rr=dt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,xm=dt&&/Android/.test(navigator.userAgent),as=dt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!xm,_m=dt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yl=dt&&xm&&_m,cs=dt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ut&&!_m,Z2=0,q2=1,Y2=2,Ud=1,Gd=2,Zd=4,qd=8,X2=16,qa=32,Ya=64,rf=128,Q2=1,e_=2,t_=3,n_=4,r_=5,o_=6,$i=as||rr||cs?" ":"​",Tr=` +`),o;function i(s){return r.stack.push(s),l;function l(){r.stack.pop()}}}function R2(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function D2(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function F2(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function H2(t,e){return N2(t,this,e)}function V2(t,e){return M2(t,this,e)}function B2(t,e){return L2(this,t,e)}var j2=Object.defineProperty,W2=(t,e,n)=>e in t?j2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vn=(t,e,n)=>W2(t,typeof e!="symbol"?e+"":e,n);let z2=class um{constructor(e=new Map){this.map=e}clone(){return new um(new Map(this.map))}increment(e){const n=this.map.get(e)??0;this.map.set(e,n+1)}decrement(e,n){let r=this.map.get(e);r!==void 0&&(r-=1,this.map.set(e,r),r===0&&n())}};class Ms{constructor(){vn(this,"map",new Map)}getOrCreate(e){let n=this.map.get(e);return n===void 0&&(n=new Set,this.map.set(e,n)),n}get(e){return this.map.get(e)}use(e,n){const r=this.get(e);r!==void 0&&n(r)}delete(e){return this.map.delete(e)}}function wi(t,e){return e(t),t}function fm(){}const dm="cell";function Wd(t,e){return t===e}const nf=new Map;let K2=class{constructor(e={}){vn(this,"subscriptions",new Ms),vn(this,"singletonSubscriptions",new Map),vn(this,"graph",new Ms),vn(this,"state",new Map),vn(this,"distinctNodes",new Map),vn(this,"executionMaps",new Map),vn(this,"definitionRegistry",new Set),vn(this,"combinedCells",[]);for(const n of Object.getOwnPropertySymbols(e))this.state.set(n,e[n])}cellInstance(e,n=!0,r=Symbol()){return this.state.has(r)||this.state.set(r,e),n!==!1&&!this.distinctNodes.has(r)&&this.distinctNodes.set(r,n===!0?Wd:n),r}signalInstance(e=!0,n=Symbol()){return e!==!1&&this.distinctNodes.set(n,e===!0?Wd:e),n}sub(e,n){this.register(e);const r=this.subscriptions.getOrCreate(e);return r.add(n),()=>r.delete(n)}singletonSub(e,n){return this.register(e),n===void 0?this.singletonSubscriptions.delete(e):this.singletonSubscriptions.set(e,n),()=>this.singletonSubscriptions.delete(e)}resetSingletonSubs(){this.singletonSubscriptions.clear()}subMultiple(e,n){const r=this.signalInstance();return this.connect({map:o=>(...i)=>{o(i)},sink:r,sources:e}),this.sub(r,n)}pubIn(e){var n;const r=Reflect.ownKeys(e),o=this.getExecutionMap(r),i=o.refCount.clone(),s=o.participatingNodes.slice(),l=new Map(this.state),a=c=>{this.graph.use(c,u=>{for(const{sources:f,sink:d}of u)f.has(c)&&i.decrement(d,()=>{s.splice(s.indexOf(d),1),a(d)})})};for(;;){const c=s.shift();if(c===void 0)break;const u=c;let f=!1;const d=g=>{const h=this.distinctNodes.get(u);if(h!=null&&h(l.get(u),g)){f=!1;return}f=!0,l.set(u,g),this.state.has(u)&&this.state.set(u,g)};if(Object.prototype.hasOwnProperty.call(e,u)?d(e[u]):o.projections.use(u,g=>{for(const h of g){const p=[...Array.from(h.sources),...Array.from(h.pulls)].map(y=>l.get(y));h.map(d)(...p)}}),f){const g=l.get(u);this.inContext(()=>{this.subscriptions.use(u,h=>{for(const p of h)p(g)})}),(n=this.singletonSubscriptions.get(u))==null||n(g)}else a(u)}}connect({sources:e,pulls:n=[],map:r,sink:o}){const i={map:r,pulls:new Set(n),sink:this.register(o),sources:new Set(e)};for(const s of[...e,...n])this.register(s),this.graph.getOrCreate(s).add(i);this.executionMaps.clear()}pub(e,n){this.pubIn({[e]:n})}pipe(e,...n){return this.combineOperators(...n)(e)}transformer(...e){return n=>wi(this.signalInstance(),r=>(this.link(this.pipe(r,...e),n),r))}link(e,n){this.connect({map:r=>o=>{r(o)},sink:n,sources:[e]})}combine(...e){return wi(this.signalInstance(),n=>{this.connect({map:r=>(...o)=>{r(o)},sink:n,sources:e})})}combineCells(...e){const n=this.combinedCells.find(o=>e.length===o.sources.length&&e.every((i,s)=>i===o.sources[s]));if(n)return n.cell;const r=this.cellInstance(e.map(o=>this.getValue(o)),!0);return this.connect({map:o=>(...i)=>{o(i)},sink:r,sources:e}),this.combinedCells.push({sources:e,cell:r}),r}getValue(e){return this.register(e),this.state.get(e)}getValues(e){return e.map(n=>this.getValue(n))}register(e){const n=nf.get(e);return n===void 0||this.definitionRegistry.has(e)?e:(this.definitionRegistry.add(e),wi(n.type===dm?this.cellInstance(n.initial,n.distinct,e):this.signalInstance(n.distinct,e),r=>{this.inContext(()=>{n.init(this,r)})}))}inContext(e){return e()}changeWith(e,n,r){this.connect({sources:[n],pulls:[e],sink:e,map:o=>(i,s)=>{o(r(s,i))}})}calculateExecutionMap(e){const n=[],r=new Set,o=new Ms,i=new z2,s=new Ms,l=(a,c=0)=>{i.increment(a),!r.has(a)&&(this.register(a),o.use(a,u=>{c=Math.max(...Array.from(u).map(f=>n.indexOf(f)))+1}),this.graph.use(a,u=>{for(const f of u)f.sources.has(a)?(s.getOrCreate(f.sink).add(f),l(f.sink,c)):o.getOrCreate(f.sink).add(a)}),r.add(a),n.splice(c,0,a))};return e.forEach(l),{participatingNodes:n,pendingPulls:o,projections:s,refCount:i}}getExecutionMap(e){let n=e;if(e.length===1){n=e[0];const o=this.executionMaps.get(n);if(o!==void 0)return o}else for(const[o,i]of this.executionMaps.entries())if(Array.isArray(o)&&o.length===e.length&&o.every(s=>e.includes(s)))return i;const r=this.calculateExecutionMap(e);return this.executionMaps.set(n,r),r}combineOperators(...e){return n=>{for(const r of e)n=r(n,this);return n}}};function Y(t,e=fm,n=!0){return wi(Symbol(),r=>{nf.set(r,{type:dm,distinct:n,initial:t,init:e})})}function jt(t=fm,e=!1){return wi(Symbol(),n=>{nf.set(n,{type:"signal",distinct:e,init:t})})}const hm=C.createContext(null);function ea(){const t=C.useContext(hm);if(t===null)throw new Error("useRealm must be used within a RealmContextProvider");return t}function ln(t){const e=ea();e.register(t);const n=C.useCallback(r=>e.sub(t,r),[e,t]);return C.useSyncExternalStore(n,()=>e.getValue(t),()=>e.getValue(t))}function Yo(...t){const e=ea(),n=C.useMemo(()=>e.combineCells.apply(e,t),[e,...t]);return ln(n)}function $r(t){const e=ea();return e.register(t),C.useCallback(n=>{e.pub(t,n)},[e,t])}function gm(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:o=>i=>{o(t(i))},sink:r,sources:[e]}),r}}function Ft(...t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:o=>(...i)=>{o(i)},pulls:t,sink:r,sources:[e]}),r}}function ta(t){return(e,n)=>{const r=n.signalInstance();return n.connect({map:o=>i=>{t(i)&&o(i)},sink:r,sources:[e]}),r}}function pm(t,e){return(n,r)=>{const o=r.signalInstance();return r.connect({map:i=>s=>{i(e=t(e,s))},sink:o,sources:[n]}),o}}const ml=new WeakMap;function zd(t,e){let n=ml.get(t);return n||(n=new Set,ml.set(t,n)),n.add(e),()=>{n.delete(e)}}function Kd(t){const e=ml.get(t);if(ml.delete(t),!e)return;let n=!1,r;for(const o of[...e].reverse())try{o()}catch(i){n||(n=!0,r=i)}if(n)throw r instanceof Error?r:new Error("Realm cleanup failed with a non-Error value")}function Xo(t){return function(e){return{init:n=>{var r;return(r=t.init)==null?void 0:r.call(t,n,e)},postInit:n=>{var r;return(r=t.postInit)==null?void 0:r.call(t,n,e)},update:n=>{var r;return(r=t.update)==null?void 0:r.call(t,n,e)}}}}function J2({children:t,plugins:e}){const[n,r]=N.useState(null);return N.useEffect(()=>{var o,i;const s=new K2;try{for(const l of e)(o=l.init)==null||o.call(l,s);for(const l of e)(i=l.postInit)==null||i.call(l,s)}catch(l){try{Kd(s)}catch(a){throw new AggregateError([l,a],"Realm plugin initialization and cleanup both failed")}throw l}return r(s),()=>{Kd(s)}},[]),N.useEffect(()=>{var o;if(n)for(const i of e)(o=i.update)==null||o.call(i,n)}),n?N.createElement(hm.Provider,{value:n},t):null}function I(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function mm(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const dt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,U2=dt&&"documentMode"in document?document.documentMode:null,Ut=dt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ln=dt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),jo=!(!dt||!("InputEvent"in window)||U2)&&"getTargetRanges"in new window.InputEvent("input"),rr=dt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,ym=dt&&/Android/.test(navigator.userAgent),as=dt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!ym,xm=dt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yl=dt&&ym&&xm,cs=dt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ut&&!xm,G2=0,Z2=1,q2=2,Jd=1,Ud=2,Gd=4,Zd=8,Y2=16,qa=32,Ya=64,rf=128,X2=1,Q2=2,e_=3,t_=4,n_=5,r_=6,$i=as||rr||cs?" ":"​",Tr=` -`,of=Ln?" ":$i,$n={bold:1,capitalize:1024,code:16,highlight:rf,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},i_={directionless:1,unmergeable:2},xl={center:2,end:6,justify:4,left:1,right:3,start:5},s_={[e_]:"center",[o_]:"end",[n_]:"justify",[Q2]:"left",[t_]:"right",[r_]:"start"},l_={normal:0,segmented:2,token:1},a_={[Z2]:"normal",[Y2]:"segmented",[q2]:"token"},Yd="$config";function Xd(){return Me()._blockCursorElement}function c_(t){return t!==null&&t.nodeType===1&&t.hasAttribute("data-lexical-slot")}let vm=class Ys{constructor(e,n,r){P(this,"element");P(this,"before");P(this,"after");this.element=e,this.before=n||null,this.after=r||null}withBefore(e){return new Ys(this.element,e,this.after)}withAfter(e){return new Ys(this.element,this.before,e)}withElement(e){return this.element===e?this:new Ys(e,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return n!==null&&n.parentElement!==this.element&&I(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&I(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&I(359),this.element.replaceChild(e,n),this}getFirstChild(){const e=this.getFirstChildAnchor(),n=e?e.nextSibling:this.element.firstChild;return n===this.getInsertionAnchor()?null:n}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,n,r){if(this.element===e)return n===e&&r===0?"before":"after";const o=Qd(e,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(e.childNodes,o);if(i<0)return"after";if(n===e)return r<=i?"before":"after";const s=Qd(e,n);if(s===null)return"after";const l=Array.prototype.indexOf.call(e.childNodes,s);return l>=0&&l<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Qd(t,e){let n=e;for(;n!==null&&n.parentNode!==t;)n=n.parentNode;return n}class Mo extends vm{withBefore(e){return new Mo(this.element,e,this.after)}withAfter(e){return new Mo(this.element,this.before,e)}withElement(e){return this.element===e?this:new Mo(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),n=e?e.nextSibling:this.element.firstChild;for(;c_(n);)e=n,n=n.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===Xd()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const n=e==="decorator"&&(cs||rr||as);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const n=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&n.removeChild(r),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=Te().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=Te().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),n=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==n;o=o.nextSibling)r++;return r}resolveChildIndex(e,n,r,o){if(r===this.element){const a=this.getFirstChildOffset(),c=Xd(),u=this.element.childNodes,f=Math.min(o,u.length);let d=0;for(let g=a;gu){l+=1;break}}return[e.getParentOrThrow(),l]}}function eh(t,e){const n=[];let r=e;for(;r!==t&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;n.push(o)}return r!==t&&I(225),n.reverse()}let Cm;try{Cm="0.48.0+prod.esm"}catch{}const bm=Cm??'"+source"';let di=class{constructor(){P(this,"_front",new Set);P(this,"_back",new Set);P(this,"_cache")}get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const n of this._back)e.push(n);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const vr=null;function wm(t,e=1e3){return t instanceof Hc?t.clone():t.sizethis._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const n=new Map(this._old);for(const[r,o]of this._nursery)o!==vr?n.set(r,o):n.delete(r);this._old=n,this._nursery=void 0}return this._mutable=!1,this}set(e,n){const r=this.getWithTombstone(e);if(r===n)return this;const o=this.getNursery();return r!==vr&&r!==void 0||(this._size++,r===vr&&o.delete(e)),o.set(e,n),this}delete(e){const n=this.has(e);return n&&(this.getNursery().set(e,vr),this._size--),n}getOrInsert(e,n){const r=this.get(e);return r!==void 0?r:(this.set(e,n),n)}getOrInsertComputed(e,n){const r=this.get(e);if(r!==void 0)return r;const o=n(e);return this.set(e,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,n=this._old;if(n)for(const r of n){const o=r[0],i=e?e.get(o):void 0;i!==vr&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===vr||n&&n.has(r[0])||(yield r)}forEach(e,n){n!==void 0&&(e=e.bind(n));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function _l(t,e,n,r,o,i){if(O(t)){let s=t.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&((O(s)||kn(s)&&s.__slots!==null)&&_l(s,l,n,r,o,i),n.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of kn(t)&&t.__slots!==null?t.__slots.values():[]){const l=r.get(s);l!==void 0&&Br(l)&&l.__slotHost===e&&((O(l)||kn(l)&&l.__slots!==null)&&_l(l,s,n,r,o,i),n.has(s)||i.delete(s),o.push(s))}}let Vc=!1,sf=0;function u_(t){sf=t.timeStamp}function Xa(t,e,n){const r=t.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&ti(t,n)!==void 0}function f_(t,e,n){const r=ht(Ct(n)),o=r&&Ht(r,n._rootElement);let i=null,s=null;o!==null&&o.anchorNode===t&&(i=o.anchorOffset,s=o.focusOffset);const l=t.nodeValue;l!==null&&Af(e,l,i,s,!1)}function d_(t,e,n){if($(t)){const r=t.anchor.getNode();if(r.is(n)&&t.format!==r.getFormat())return!1}return vt(e)&&n.isAttached()}function h_(t,e,n){for(let r=t;r&&!X1(r);r=dr(r)){const o=ti(r,e);if(o!==void 0){const i=Se(o,n);if(i)return te(i)||!q(r)?void 0:[r,i]}}}function Em(t,e,n){Vc=!0;const r=performance.now()-sf>100;try{Pt(t,()=>{const o=V()||function(f){return f.read("latest",()=>{const d=V();return d!==null?d.clone():null})}(t),i=new Map,s=t._editorState,l=t._blockCursorElement;let a=!1,c="";for(let f=0;f0){let S=0;for(let E=0;E<_;E++){const b=v[E];(Xa(b,h,t)||l===b)&&(h.appendChild(b),S++)}_!==S&&i.set(y,m)}}}if(i.size>0)for(const[f,d]of i)d.reconcileObservedMutation(f,t);const u=n.takeRecords();if(u.length>0){for(let f=0;f{Em(t,e,n)})}const th="latest";let g_=class{constructor(e,n){P(this,"key");P(this,"parse");P(this,"unparse");P(this,"isEqual");P(this,"defaultValue");P(this,"resetOnCopyNode");this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||y_).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=n.resetOnCopyNode||!1}};function us(t,e){return new g_(t,e)}function na(t,e,n=th){const r=(n===th?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function Oo(t,e,n){let r;if(ze(),typeof n=="function"){const i=t.getLatest(),s=na(i,e);if(r=n(s),e.isEqual(s,r))return i}else r=n;const o=t.getWritable();return Mm(o).updateFromKnown(e,r),o}function p_(t){const e=new Map,n=new Set;for(const{ownNodeConfig:r}of Df(typeof t=="function"?t:t.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&n.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:n,sharedConfigMap:e}}const nh=new Set(["__proto__","constructor","prototype"]);let m_=class Nm{constructor(e,n,r=void 0,o=new Map,i=void 0){P(this,"node");P(this,"knownState");P(this,"unknownState");P(this,"sharedNodeState");P(this,"size");this.node=e,this.sharedNodeState=n,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:function(a,c,u){let f=u.size;if(c)for(const d in c){const g=a.get(d);g&&u.has(g)||f++}return f}(s,r,o);this.size=l}getValue(e){const n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},n={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(n[r]=e[r],delete e[r]);return rh(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;const{sharedNodeState:n,unknownState:r}=this,o=new Map(this.knownState);return new Nm(e,n,function(i,s,l){let a;if(l)for(const[c,u]of Object.entries(l)){if(nh.has(c))continue;const f=i.get(c);f?s.has(f)||s.set(f,f.parse(u)):(a=a||{},a[c]=u)}return a}(n.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,n){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=rh(i)),this.size++),o.set(e,n)}updateFromUnknown(e,n){if(nh.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){const{knownState:n}=this;for(const r of n.keys())n.set(r,r.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function Mm(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new m_(e,Om(e));return e.__state=n,n}function Om(t){return t.__state?t.__state.sharedNodeState:R1(Me(),t.getType()).sharedNodeState}function rh(t){if(t)for(const e in t)return t}function y_(t){return t}function oh(t,e,n){for(const[r,o]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const i=n?n.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function ih(t,e,n){const{unknownState:r}=e,o=n?n.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!t.has(i)&&(t.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function sh(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function lh(t,e){const n=t.__mode,r=t.__format,o=t.__style,i=e.__mode,s=e.__format,l=e.__style,a=t.__state,c=e.__state;return(n===null||n===i)&&(r===null||r===s)&&(o===null||o===l)&&(t.__state===null||a===c||function(u,f){if(u===f)return!0;const d=new Set;return!(u&&oh(d,u,f)||f&&oh(d,f,u)||u&&ih(d,u,f)||f&&ih(d,f,u))}(a,c))}function ah(t,e){const n=t.mergeWithSibling(e),r=he()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function ch(t){let e,n,r=t;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(lh(e,r)){r=ah(e,r);break}break}e.remove()}for(;(n=r.getNextSibling())!==null&&D(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(lh(r,n)){r=ah(r,n);break}break}n.remove()}}else r.remove()}function kr(t){return uh(t.anchor),uh(t.focus),t}function uh(t){for(;t.type==="element";){const e=t.getNode(),n=t.offset;let r,o;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),o=!0):(r=e.getChildAtIndex(n),o=!1),D(r)){t.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!O(r))break;t.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const Ii=Symbol.for("@lexical/CachedTextSize");function fh(t,e){return jc.read(()=>{let n=0,r=t;for(let o=0;o0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${__}))`)}function Lm(t,e){const n=t.style;e===0?Cr(n,""):e===1?Cr(n,"left"):e===2?Cr(n,"center"):e===3?Cr(n,"right"):e===4?Cr(n,"justify"):e===5?Cr(n,"start"):e===6&&Cr(n,"end")}function Kc(t,e){const n=function(r){const o=r.__dir;if(o!==null)return o;if($e(r))return null;const i=r.getParent();return i===null||ve(i)&&i.__dir===null?"auto":null}(e);n!==null?t.dir=n:t.removeAttribute("dir")}function $m(t){const e=Te().createElement("div");return e.setAttribute("data-lexical-slot",t),e.style.display="none",e}function Im(t,e,n){e||t.contentEditable==="false"?Nv(n,ce):n.removeAttribute("contenteditable")}function dh(t,e,n){const r=ne,o=on();ne="";let i="";const s=te(t);for(const[l,a]of n){const c=$m(l);Im(e,s,c),e.appendChild(c),ne="";const u=on();Qn(a,Vt(t,c,ce)),Ot(u),Rm(t,l,e,c),i+=ne}return Ot(o),ne=r,i}function wt(t){return kn(t)&&t.__slots!==null?t.__slots:t0}function Rm(t,e,n,r){const o=Rr.$getSlotTargetElement(t,e,n,ce);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function Jc(t){const e=Ir.get(t);return e!==void 0?e.parentElement:null}function hh(t,e,n){const r=wt(t),o=wt(e);for(const[u,f]of r)if(!o.has(u)){const d=Jc(f);Xn(f,null),d!==null&&d.remove()}const i=ne,s=on();let l="",a=null;const c=te(e);for(const[u,f]of o){const d=r.get(u);let g=d!==void 0?Jc(d):null;ne="";const h=on();if(g===null){g=$m(u);let p=null;for(const y of n.children)if(!y.hasAttribute("data-lexical-slot")){p=y;break}n.insertBefore(g,p),Qn(f,Vt(e,g,ce))}else d===f?bn(f,g):(d!==void 0&&Xn(d,g),Qn(f,Vt(e,g,ce)));if(Ot(h),Im(n,c,g),Rm(e,u,n,g),l+=ne,g.parentElement===n){const p=a===null?n.firstChild:a.nextSibling;p!==g&&n.insertBefore(g,p),a=g}}return Ot(s),ne=i,l}function Qn(t,e){const n=Ae.get(t);if(n===void 0&&I(60),e!==null){const o=Gt.get(t);if(o!==void 0){const i=Ir.get(t);if(i!==void 0){const s=Br(o)?o.__slotHost:null,l=Br(n)?n.__slotHost:null,a=o.__parent!==n.__parent||s!==l,c=l!==null&&i.parentElement!==e.element;if(a||c)return e.insertChild(i),bn(t,e.element)}}}const r=Rr.$createDOM(n,ce);if(function(o,i,s){const l=s._keyToDOMMap;V1(i,s,o),l.set(o,i)}(t,r,ce),D(n)?r.setAttribute("data-lexical-text","true"):te(n)&&(r.setAttribute("data-lexical-decorator","true"),kv(r,{captureSelection:!0})),O(n)){const o=n.__indent,i=n.__size;Kc(r,n),o!==0&&Pm(r,o);const s=wt(n),l=s.size>0?dh(n,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,ne+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const c=ne,u=i-1;if(Uc(Dl(n,Ae),n,0,u,Vt(n,r,ce)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,ne=c+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const a=n.__format;a!==0&&Lm(r,a),n.isInline()||Dm(null,n,r)}else{const o=n.getTextContent();if(te(n)){const i=n.decorate(ce,Ri);i!==null&&Fm(t,i),r.contentEditable="false";const s=wt(n);s.size>0&&dh(n,r,s)}ne+=o}return e!==null&&e.insertChild(r),Rr.$decorateDOM(n,null,r,ce),Am(n),Pf(Fi,Di,ra,n,"created"),r}function Uc(t,e,n,r,o){const i=ne,s=on();ne="",Re=null,nt=null,Ye=null;let l=n;for(;l<=r;++l){const c=on();Qn(t[l],o);const u=Ae.get(t[l]);u!==null&&D(u)?Re===null&&(Re=u.getFormat(),nt=u.getStyle(),Ye=u.__key):O(u)&&l0?null:"empty"}return null}(e,Ae);o!==i&&r.setManagedLineBreak(i)}function v_(t,e,n){var r;Re=null,nt=null,Ye=null,function(o,i,s){const l=ne,a=o.__size,c=i.__size;ne="";const u=s.element,f=ce._keyToDOMMap.get(i.__key);f===void 0&&I(351,i.__key);const d=c-a;if(!wn&&Math.abs(d)<=1&&a>=x_&&o.__first===i.__first&&(d!==0||!ce._cloneNotNeeded.has(o.__key))){const g=f.__lexicalTextContent,h=Wc.get(o.__key);if(!wn&&typeof g=="string"&&h!==void 0){const p=function(y,m){const x=m.size;if(x===0||x>=y.__size)return null;let v=y.__last,_=null,S=0;for(;v!==null&&S0?g.slice(S):g,b=E.slice(0,E.length-m)+_;return f.__lexicalTextContent=b,ne=l+b,void gh(i,f,h)}if(function(m,x,v,_,S,E,b,w){if(w!==1&&w!==-1||b!==(w===1?2:1))return!1;const M=b-w;let A=m.__last;for(let oe=0;oe0?S.slice(Ve):S;return _.__lexicalTextContent=qe.slice(0,qe.length-xe)+de,!0}(o,0,s,f,g,p,y,d)){const m=f.__lexicalTextContent;return typeof m!="string"&&I(353),ne=l+m,void gh(i,f,h)}}}if(d===0){let p=o.__first,y=0;for(;p!==null;){const m=Ae.get(p);if(m===void 0)break;const x=wn||Ei.has(p)||Si.has(p),v=on();if(x)bn(p,u);else{let _,S;if(O(m)){S=Ir.get(p);const E=S&&S.__lexicalTextContent;typeof E!="string"&&I(354,m.getType()),_=E}else _=m.getTextContent();ne+=_,S!==void 0&&Bc(S)}D(m)?Re===null&&(Re=m.getFormat(),nt=m.getStyle(),Ye=m.__key):O(m)&&yS,F=A>E;if(R&&!F){const H=m[E+1],W=H===void 0?null:ce.getElementByKey(H);Uc(m,p,A,E,_.withBefore(W??_.before))}else F&&!R&&zc(y,M,S,_.element)})(i,g,h,a,c,s)}f.__lexicalTextContent=ne,f.__lexicalFirstTextKey=Ye,ne=l+ne}(t,e,Vt(e,n,ce)),ve(e)||(r=e,Re==null||Re===r.__textFormat||vl||r.setTextFormat(Re),function(o){nt==null||nt===o.__textStyle||vl||o.setTextStyle(nt)}(e))}function gh(t,e,n){const r=e.__lexicalFirstTextKey;if(r!=null){const o=t.__key;let i=r;for(;i!==null;){const s=Ae.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!n.has(i)){const s=Ae.get(r);if(D(s))return Re=s.getFormat(),void(nt=s.getStyle())}}e.__lexicalFirstTextKey=Ye}function bn(t,e){const n=Gt.get(t);let r=Ae.get(t);n!==void 0&&r!==void 0||I(61);const o=wn||Ei.has(t)||Si.has(t),i=zo(ce,t);if(n===r&&!o){let s;if(O(n)){const l=i.__lexicalTextContent;typeof l!="string"&&I(355,n.getType()),s=l,Bc(i)}else s=n.getTextContent();return ne+=s,i}if(n!==r&&o&&Pf(Fi,Di,ra,r,"updated"),Rr.$updateDOM(r,n,i,ce)){const s=Qn(t,null);return e===null&&I(62),e.replaceChild(s,i),Xn(t,null),s}if(O(n)){O(r)||I(334,t);const s=r.__indent;(wn||s!==n.__indent)&&Pm(i,s);const l=r.__format;(wn||l!==n.__format)&&Lm(i,l);const a=o&&(wt(r).size>0||wt(n).size>0)?hh(n,r,i):"";if(o){const c=ne;if(v_(n,r,i),$e(r)||r.isInline()||Dm(0,r,i),a!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=a+u,ne=c+a+u,i.__lexicalSlotTextLength=a.length}else(wt(r).size>0||wt(n).size>0)&&(i.__lexicalSlotTextLength=0)}else{const c=i.__lexicalTextContent;typeof c!="string"&&I(356,n.getType()),ne+=c,Bc(i)}if((wn||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(Kc(i,r),$e(r)&&!wn))for(const c of r.getChildren())O(c)&&Kc(zo(ce,c.getKey()),c)}else{const s=r.getTextContent();if(te(r)){const l=r.decorate(ce,Ri);l!==null&&Fm(t,l),o&&(wt(r).size>0||wt(n).size>0)&&hh(n,r,i)}ne+=s}if(!vl&&$e(r)){const s=r.getLatest();if(s.__cachedText!==ne){const l=s.getWritable();l.__cachedText=ne,r=l}}return Rr.$decorateDOM(r,n,i,ce),Am(r),i}function Fm(t,e){let n=ce._pendingDecorators;const r=ce._decorators;if(n===null){if(r[t]===e)return;n=B1(ce)}n[t]=e}function Qa(t){let e=t.nextSibling;return e!==null&&e===ce._blockCursorElement&&(e=e.nextSibling),e}function ph(t,e){const n=new Set;for(let r=e;r{for(const u of c){const f=Ae.get(u);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let g=l.get(d);g===void 0&&(g=new Set,l.set(d,g)),g.add(u)}};return a(Si.keys()),a(Ei),l}();const s=new Map;return Fi=s,bn("root",null),ce=void 0,Di=void 0,Si=void 0,Ei=void 0,Gt=void 0,jc=void 0,Ae=void 0,Ri=void 0,Ir=void 0,Wc=void 0,Fi=void 0,Rr=Pl,s}function Gc(t){const e=Ir.get(t);return e===void 0&&I(75,t),e}function U(t){return{type:t}}const lf=U("SELECTION_CHANGE_COMMAND"),b_=U("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),af=U("CLICK_COMMAND"),Hm=U("BEFORE_INPUT_COMMAND"),Vm=U("INPUT_COMMAND"),Bm=U("COMPOSITION_START_COMMAND"),jm=U("COMPOSITION_END_COMMAND"),Or=U("DELETE_CHARACTER_COMMAND"),Ao=U("INSERT_LINE_BREAK_COMMAND"),Hi=U("INSERT_PARAGRAPH_COMMAND"),Po=U("CONTROLLED_TEXT_INSERTION_COMMAND"),cf=U("PASTE_COMMAND"),Xs=U("REMOVE_TEXT_COMMAND"),Vi=U("DELETE_WORD_COMMAND"),Bi=U("DELETE_LINE_COMMAND"),Sn=U("FORMAT_TEXT_COMMAND"),w_=U("SET_TEXT_FORMAT_COMMAND"),oa=U("UNDO_COMMAND"),ia=U("REDO_COMMAND"),uf=U("KEYDOWN_COMMAND"),Wm=U("KEY_ARROW_RIGHT_COMMAND"),zm=U("MOVE_TO_END"),ff=U("KEY_ARROW_LEFT_COMMAND"),Km=U("MOVE_TO_START"),df=U("KEY_ARROW_UP_COMMAND"),hf=U("KEY_ARROW_DOWN_COMMAND"),ji=U("KEY_ENTER_COMMAND"),gf=U("KEY_SPACE_COMMAND"),pf=U("KEY_BACKSPACE_COMMAND"),mf=U("KEY_ESCAPE_COMMAND"),Jm=U("KEY_DELETE_COMMAND"),yf=U("KEY_TAB_COMMAND"),Um=U("INSERT_TAB_COMMAND"),Cl=U("INDENT_CONTENT_COMMAND"),Zc=U("OUTDENT_CONTENT_COMMAND"),Gm=U("DROP_COMMAND"),S_=U("FORMAT_ELEMENT_COMMAND"),Zm=U("DRAGSTART_COMMAND"),qm=U("DRAGOVER_COMMAND"),E_=U("DRAGEND_COMMAND"),sa=U("COPY_COMMAND"),xf=U("CUT_COMMAND"),Ym=U("SELECT_ALL_COMMAND"),T_=U("CLEAR_EDITOR_COMMAND"),k_=U("CLEAR_HISTORY_COMMAND"),Nr=U("CAN_REDO_COMMAND"),Mr=U("CAN_UNDO_COMMAND"),_f=U("FOCUS_COMMAND"),Xm=U("BLUR_COMMAND"),N_=U("KEY_MODIFIER_COMMAND");function M_(t){const e=new Map;return{dispose(){for(const n of e.values())n.dispose();e.clear()},register(n,r){let o=e.get(n);o===void 0&&(o={dispose:t(n,r),holders:new Set},e.set(n,o));const i=()=>{const s=e.get(n);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(n),s.dispose())};return o.holders.add(i),i}}}function vf(t,e,n,r){return t.addEventListener(e,n,r),t.removeEventListener.bind(t,e,n,r)}const yn=Object.freeze({}),qc=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,t.key!=="Backspace"&&Wi(n),!e.isComposing()&&j(e,uf,t)}],["pointerdown",function(t,e){const n=If(t),r=t.pointerType;ni(n)&&r!=="touch"&&r!=="pen"&&t.button===0&&Pt(e,()=>{Rl(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){j(e,Bm,t)}],["compositionend",function(t,e){const n=e._inputState;Ln?n.compositionPhase="ending-firefox":rr||!as&&!cs?j(e,jm,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;Wi(n),Pt(e,()=>{n1(t,e)||e.dispatchCommand(Vm,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){Pt(e,()=>{const n=V(),r=ht(Ct(e)),o=Qr();if(r){if($(n)){const i=n.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&n.isCollapsed()&&!$e(s)&&Ce().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&n.is(o)&&(r.removeAllRanges(),n.dirty=!0)}else if(t.pointerType==="touch"||t.pointerType==="pen"){const i=Ht(r,e._rootElement).anchorNode;(q(i)||vt(i))&&He(bf(o,r,e,t))}}j(e,af,t)})}],["cut",yn],["copy",yn],["dragstart",yn],["dragover",yn],["dragend",yn],["paste",yn],["focus",yn],["blur",yn],["drop",yn]];jo&&qc.push(["beforeinput",(t,e)=>function(n,r){const o=n.inputType;o==="deleteCompositionText"||Ln&&K1(r)||o!=="insertCompositionText"&&Pt(r,()=>{n1(n,r)||j(r,Hm,n)},{event:n})}(t,e)]);const Yc=new WeakMap,bl=new WeakMap,O_=M_(t=>(t.addEventListener("selectionchange",vh),()=>t.removeEventListener("selectionchange",vh)));function Qm(t,e,n,r,o,i){const s=t.anchor,l=t.focus,a=s.getNode(),c=he();let u;if(i!==void 0)u=i;else{const p=ht(Ct(c));u=p!==null?Ht(p,c._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,g=c.getElementByKey(d),h=n.length;return d!==l.key||!D(a)||(!o&&(!jo||c._inputState.lastBeforeInputInsertTextTimeStamp1||(o||!jo)&&g!==null&&!a.isComposing()&&f!==er(a,g,c)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!a.isComposing()&&(a.getFormat()!==t.format||a.getStyle()!==t.style)||function(p,y){if(y.isSegmented())return!0;if(!p.isCollapsed())return!1;const m=p.anchor.offset,x=y.getParentOrThrow(),v=Lr(y);return m===0?!y.canInsertTextBefore()||!x.canInsertTextBefore()&&!y.isComposing()||v||function(_){const S=_.getPreviousSibling();return(D(S)||O(S)&&S.isInline())&&!S.canInsertTextAfter()}(y):m===y.getTextContentSize()&&(!y.canInsertTextAfter()||!x.canInsertTextAfter()&&!y.isComposing()||v)}(t,a)}function mh(t,e){return vt(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function yh(t,e,n){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=Ht(t,e._rootElement),l=e._inputState;l.isSelectionChangeFromDOMUpdate&&(l.isSelectionChangeFromDOMUpdate=!1,mh(r,o)&&mh(i,s)&&!l.postDeleteSelectionToRestore)||Pt(e,()=>{if(!n)return void He(null);if(!gs(e,r,i))return;let a=V();if(l.postDeleteSelectionToRestore&&$(a)&&a.isCollapsed()){const c=a.anchor,u=l.postDeleteSelectionToRestore.anchor;(c.key===u.key&&c.offset===u.offset+1||c.offset===1&&u.getNode().is(c.getNode().getPreviousSibling()))&&(a=l.postDeleteSelectionToRestore.clone(),He(a))}if(l.postDeleteSelectionToRestore=null,$(a)){const c=a.anchor,u=c.getNode();if(a.isCollapsed()){t.type==="Range"&&r===i&&(a.dirty=!0);const f=Ct(e).event,d=f?f.timeStamp:performance.now(),{format:g,style:h,offset:p,key:y,timeStamp:m}=l.collapsedSelectionFormat,x=Ce(),v=e.isComposing()===!1&&x.getTextContent()==="";if(d=0&&l<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Xd(t,e){let n=e;for(;n!==null&&n.parentNode!==t;)n=n.parentNode;return n}class Mo extends _m{withBefore(e){return new Mo(this.element,e,this.after)}withAfter(e){return new Mo(this.element,this.before,e)}withElement(e){return this.element===e?this:new Mo(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),n=e?e.nextSibling:this.element.firstChild;for(;a_(n);)e=n,n=n.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===Yd()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const n=e==="decorator"&&(cs||rr||as);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const n=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&n.removeChild(r),n.removeChild(e),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const n=this.getManagedLineBreak();if(n){if(e===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=Te().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=Te().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),n=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==n;o=o.nextSibling)r++;return r}resolveChildIndex(e,n,r,o){if(r===this.element){const a=this.getFirstChildOffset(),c=Yd(),u=this.element.childNodes,f=Math.min(o,u.length);let d=0;for(let g=a;gu){l+=1;break}}return[e.getParentOrThrow(),l]}}function Qd(t,e){const n=[];let r=e;for(;r!==t&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;n.push(o)}return r!==t&&I(225),n.reverse()}let vm;try{vm="0.48.0+prod.esm"}catch{}const Cm=vm??'"+source"';let di=class{constructor(){P(this,"_front",new Set);P(this,"_back",new Set);P(this,"_cache")}get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const n of this._back)e.push(n);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const vr=null;function bm(t,e=1e3){return t instanceof Hc?t.clone():t.sizethis._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const n=new Map(this._old);for(const[r,o]of this._nursery)o!==vr?n.set(r,o):n.delete(r);this._old=n,this._nursery=void 0}return this._mutable=!1,this}set(e,n){const r=this.getWithTombstone(e);if(r===n)return this;const o=this.getNursery();return r!==vr&&r!==void 0||(this._size++,r===vr&&o.delete(e)),o.set(e,n),this}delete(e){const n=this.has(e);return n&&(this.getNursery().set(e,vr),this._size--),n}getOrInsert(e,n){const r=this.get(e);return r!==void 0?r:(this.set(e,n),n)}getOrInsertComputed(e,n){const r=this.get(e);if(r!==void 0)return r;const o=n(e);return this.set(e,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,n=this._old;if(n)for(const r of n){const o=r[0],i=e?e.get(o):void 0;i!==vr&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===vr||n&&n.has(r[0])||(yield r)}forEach(e,n){n!==void 0&&(e=e.bind(n));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function _l(t,e,n,r,o,i){if(O(t)){let s=t.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&((O(s)||kn(s)&&s.__slots!==null)&&_l(s,l,n,r,o,i),n.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of kn(t)&&t.__slots!==null?t.__slots.values():[]){const l=r.get(s);l!==void 0&&Br(l)&&l.__slotHost===e&&((O(l)||kn(l)&&l.__slots!==null)&&_l(l,s,n,r,o,i),n.has(s)||i.delete(s),o.push(s))}}let Vc=!1,sf=0;function c_(t){sf=t.timeStamp}function Xa(t,e,n){const r=t.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(t===o||r&&t.previousSibling===o)||r&&ti(t,n)!==void 0}function u_(t,e,n){const r=ht(Ct(n)),o=r&&Ht(r,n._rootElement);let i=null,s=null;o!==null&&o.anchorNode===t&&(i=o.anchorOffset,s=o.focusOffset);const l=t.nodeValue;l!==null&&Af(e,l,i,s,!1)}function f_(t,e,n){if($(t)){const r=t.anchor.getNode();if(r.is(n)&&t.format!==r.getFormat())return!1}return vt(e)&&n.isAttached()}function d_(t,e,n){for(let r=t;r&&!Y1(r);r=dr(r)){const o=ti(r,e);if(o!==void 0){const i=Se(o,n);if(i)return te(i)||!q(r)?void 0:[r,i]}}}function Sm(t,e,n){Vc=!0;const r=performance.now()-sf>100;try{Pt(t,()=>{const o=V()||function(f){return f.read("latest",()=>{const d=V();return d!==null?d.clone():null})}(t),i=new Map,s=t._editorState,l=t._blockCursorElement;let a=!1,c="";for(let f=0;f0){let S=0;for(let E=0;E<_;E++){const b=v[E];(Xa(b,h,t)||l===b)&&(h.appendChild(b),S++)}_!==S&&i.set(y,m)}}}if(i.size>0)for(const[f,d]of i)d.reconcileObservedMutation(f,t);const u=n.takeRecords();if(u.length>0){for(let f=0;f{Sm(t,e,n)})}const eh="latest";let h_=class{constructor(e,n){P(this,"key");P(this,"parse");P(this,"unparse");P(this,"isEqual");P(this,"defaultValue");P(this,"resetOnCopyNode");this.key=e,this.parse=n.parse.bind(n),this.unparse=(n.unparse||m_).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=n.resetOnCopyNode||!1}};function us(t,e){return new h_(t,e)}function na(t,e,n=eh){const r=(n===eh?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function Oo(t,e,n){let r;if(ze(),typeof n=="function"){const i=t.getLatest(),s=na(i,e);if(r=n(s),e.isEqual(s,r))return i}else r=n;const o=t.getWritable();return Nm(o).updateFromKnown(e,r),o}function g_(t){const e=new Map,n=new Set;for(const{ownNodeConfig:r}of Df(typeof t=="function"?t:t.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&n.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:n,sharedConfigMap:e}}const th=new Set(["__proto__","constructor","prototype"]);let p_=class km{constructor(e,n,r=void 0,o=new Map,i=void 0){P(this,"node");P(this,"knownState");P(this,"unknownState");P(this,"sharedNodeState");P(this,"size");this.node=e,this.sharedNodeState=n,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:function(a,c,u){let f=u.size;if(c)for(const d in c){const g=a.get(d);g&&u.has(g)||f++}return f}(s,r,o);this.size=l}getValue(e){const n=this.knownState.get(e);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},n={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(n[r]=e[r],delete e[r]);return nh(e)&&(n.$=e),n}getWritable(e){if(this.node===e)return this;const{sharedNodeState:n,unknownState:r}=this,o=new Map(this.knownState);return new km(e,n,function(i,s,l){let a;if(l)for(const[c,u]of Object.entries(l)){if(th.has(c))continue;const f=i.get(c);f?s.has(f)||s.set(f,f.parse(u)):(a=a||{},a[c]=u)}return a}(n.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,n){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=nh(i)),this.size++),o.set(e,n)}updateFromUnknown(e,n){if(th.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(n)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=n)}updateFromJSON(e){const{knownState:n}=this;for(const r of n.keys())n.set(r,r.defaultValue);if(this.size=n.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function Nm(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new p_(e,Mm(e));return e.__state=n,n}function Mm(t){return t.__state?t.__state.sharedNodeState:I1(Me(),t.getType()).sharedNodeState}function nh(t){if(t)for(const e in t)return t}function m_(t){return t}function rh(t,e,n){for(const[r,o]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const i=n?n.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function oh(t,e,n){const{unknownState:r}=e,o=n?n.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!t.has(i)&&(t.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function ih(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function sh(t,e){const n=t.__mode,r=t.__format,o=t.__style,i=e.__mode,s=e.__format,l=e.__style,a=t.__state,c=e.__state;return(n===null||n===i)&&(r===null||r===s)&&(o===null||o===l)&&(t.__state===null||a===c||function(u,f){if(u===f)return!0;const d=new Set;return!(u&&rh(d,u,f)||f&&rh(d,f,u)||u&&oh(d,u,f)||f&&oh(d,f,u))}(a,c))}function lh(t,e){const n=t.mergeWithSibling(e),r=he()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function ah(t){let e,n,r=t;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(sh(e,r)){r=lh(e,r);break}break}e.remove()}for(;(n=r.getNextSibling())!==null&&D(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(sh(r,n)){r=lh(r,n);break}break}n.remove()}}else r.remove()}function kr(t){return ch(t.anchor),ch(t.focus),t}function ch(t){for(;t.type==="element";){const e=t.getNode(),n=t.offset;let r,o;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),o=!0):(r=e.getChildAtIndex(n),o=!1),D(r)){t.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!O(r))break;t.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const Ii=Symbol.for("@lexical/CachedTextSize");function uh(t,e){return jc.read(()=>{let n=0,r=t;for(let o=0;o0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n)}t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${x_}))`)}function Pm(t,e){const n=t.style;e===0?Cr(n,""):e===1?Cr(n,"left"):e===2?Cr(n,"center"):e===3?Cr(n,"right"):e===4?Cr(n,"justify"):e===5?Cr(n,"start"):e===6&&Cr(n,"end")}function Kc(t,e){const n=function(r){const o=r.__dir;if(o!==null)return o;if($e(r))return null;const i=r.getParent();return i===null||ve(i)&&i.__dir===null?"auto":null}(e);n!==null?t.dir=n:t.removeAttribute("dir")}function Lm(t){const e=Te().createElement("div");return e.setAttribute("data-lexical-slot",t),e.style.display="none",e}function $m(t,e,n){e||t.contentEditable==="false"?kv(n,ce):n.removeAttribute("contenteditable")}function fh(t,e,n){const r=ne,o=on();ne="";let i="";const s=te(t);for(const[l,a]of n){const c=Lm(l);$m(e,s,c),e.appendChild(c),ne="";const u=on();Qn(a,Vt(t,c,ce)),Ot(u),Im(t,l,e,c),i+=ne}return Ot(o),ne=r,i}function wt(t){return kn(t)&&t.__slots!==null?t.__slots:e0}function Im(t,e,n,r){const o=Rr.$getSlotTargetElement(t,e,n,ce);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function Jc(t){const e=Ir.get(t);return e!==void 0?e.parentElement:null}function dh(t,e,n){const r=wt(t),o=wt(e);for(const[u,f]of r)if(!o.has(u)){const d=Jc(f);Xn(f,null),d!==null&&d.remove()}const i=ne,s=on();let l="",a=null;const c=te(e);for(const[u,f]of o){const d=r.get(u);let g=d!==void 0?Jc(d):null;ne="";const h=on();if(g===null){g=Lm(u);let p=null;for(const y of n.children)if(!y.hasAttribute("data-lexical-slot")){p=y;break}n.insertBefore(g,p),Qn(f,Vt(e,g,ce))}else d===f?bn(f,g):(d!==void 0&&Xn(d,g),Qn(f,Vt(e,g,ce)));if(Ot(h),$m(n,c,g),Im(e,u,n,g),l+=ne,g.parentElement===n){const p=a===null?n.firstChild:a.nextSibling;p!==g&&n.insertBefore(g,p),a=g}}return Ot(s),ne=i,l}function Qn(t,e){const n=Ae.get(t);if(n===void 0&&I(60),e!==null){const o=Gt.get(t);if(o!==void 0){const i=Ir.get(t);if(i!==void 0){const s=Br(o)?o.__slotHost:null,l=Br(n)?n.__slotHost:null,a=o.__parent!==n.__parent||s!==l,c=l!==null&&i.parentElement!==e.element;if(a||c)return e.insertChild(i),bn(t,e.element)}}}const r=Rr.$createDOM(n,ce);if(function(o,i,s){const l=s._keyToDOMMap;H1(i,s,o),l.set(o,i)}(t,r,ce),D(n)?r.setAttribute("data-lexical-text","true"):te(n)&&(r.setAttribute("data-lexical-decorator","true"),Tv(r,{captureSelection:!0})),O(n)){const o=n.__indent,i=n.__size;Kc(r,n),o!==0&&Am(r,o);const s=wt(n),l=s.size>0?fh(n,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,ne+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const c=ne,u=i-1;if(Uc(Dl(n,Ae),n,0,u,Vt(n,r,ce)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,ne=c+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const a=n.__format;a!==0&&Pm(r,a),n.isInline()||Rm(null,n,r)}else{const o=n.getTextContent();if(te(n)){const i=n.decorate(ce,Ri);i!==null&&Dm(t,i),r.contentEditable="false";const s=wt(n);s.size>0&&fh(n,r,s)}ne+=o}return e!==null&&e.insertChild(r),Rr.$decorateDOM(n,null,r,ce),Om(n),Pf(Fi,Di,ra,n,"created"),r}function Uc(t,e,n,r,o){const i=ne,s=on();ne="",Re=null,nt=null,Ye=null;let l=n;for(;l<=r;++l){const c=on();Qn(t[l],o);const u=Ae.get(t[l]);u!==null&&D(u)?Re===null&&(Re=u.getFormat(),nt=u.getStyle(),Ye=u.__key):O(u)&&l0?null:"empty"}return null}(e,Ae);o!==i&&r.setManagedLineBreak(i)}function __(t,e,n){var r;Re=null,nt=null,Ye=null,function(o,i,s){const l=ne,a=o.__size,c=i.__size;ne="";const u=s.element,f=ce._keyToDOMMap.get(i.__key);f===void 0&&I(351,i.__key);const d=c-a;if(!wn&&Math.abs(d)<=1&&a>=y_&&o.__first===i.__first&&(d!==0||!ce._cloneNotNeeded.has(o.__key))){const g=f.__lexicalTextContent,h=Wc.get(o.__key);if(!wn&&typeof g=="string"&&h!==void 0){const p=function(y,m){const x=m.size;if(x===0||x>=y.__size)return null;let v=y.__last,_=null,S=0;for(;v!==null&&S0?g.slice(S):g,b=E.slice(0,E.length-m)+_;return f.__lexicalTextContent=b,ne=l+b,void hh(i,f,h)}if(function(m,x,v,_,S,E,b,w){if(w!==1&&w!==-1||b!==(w===1?2:1))return!1;const M=b-w;let A=m.__last;for(let oe=0;oe0?S.slice(Ve):S;return _.__lexicalTextContent=qe.slice(0,qe.length-xe)+de,!0}(o,0,s,f,g,p,y,d)){const m=f.__lexicalTextContent;return typeof m!="string"&&I(353),ne=l+m,void hh(i,f,h)}}}if(d===0){let p=o.__first,y=0;for(;p!==null;){const m=Ae.get(p);if(m===void 0)break;const x=wn||Ei.has(p)||Si.has(p),v=on();if(x)bn(p,u);else{let _,S;if(O(m)){S=Ir.get(p);const E=S&&S.__lexicalTextContent;typeof E!="string"&&I(354,m.getType()),_=E}else _=m.getTextContent();ne+=_,S!==void 0&&Bc(S)}D(m)?Re===null&&(Re=m.getFormat(),nt=m.getStyle(),Ye=m.__key):O(m)&&yS,F=A>E;if(R&&!F){const H=m[E+1],W=H===void 0?null:ce.getElementByKey(H);Uc(m,p,A,E,_.withBefore(W??_.before))}else F&&!R&&zc(y,M,S,_.element)})(i,g,h,a,c,s)}f.__lexicalTextContent=ne,f.__lexicalFirstTextKey=Ye,ne=l+ne}(t,e,Vt(e,n,ce)),ve(e)||(r=e,Re==null||Re===r.__textFormat||vl||r.setTextFormat(Re),function(o){nt==null||nt===o.__textStyle||vl||o.setTextStyle(nt)}(e))}function hh(t,e,n){const r=e.__lexicalFirstTextKey;if(r!=null){const o=t.__key;let i=r;for(;i!==null;){const s=Ae.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!n.has(i)){const s=Ae.get(r);if(D(s))return Re=s.getFormat(),void(nt=s.getStyle())}}e.__lexicalFirstTextKey=Ye}function bn(t,e){const n=Gt.get(t);let r=Ae.get(t);n!==void 0&&r!==void 0||I(61);const o=wn||Ei.has(t)||Si.has(t),i=zo(ce,t);if(n===r&&!o){let s;if(O(n)){const l=i.__lexicalTextContent;typeof l!="string"&&I(355,n.getType()),s=l,Bc(i)}else s=n.getTextContent();return ne+=s,i}if(n!==r&&o&&Pf(Fi,Di,ra,r,"updated"),Rr.$updateDOM(r,n,i,ce)){const s=Qn(t,null);return e===null&&I(62),e.replaceChild(s,i),Xn(t,null),s}if(O(n)){O(r)||I(334,t);const s=r.__indent;(wn||s!==n.__indent)&&Am(i,s);const l=r.__format;(wn||l!==n.__format)&&Pm(i,l);const a=o&&(wt(r).size>0||wt(n).size>0)?dh(n,r,i):"";if(o){const c=ne;if(__(n,r,i),$e(r)||r.isInline()||Rm(0,r,i),a!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=a+u,ne=c+a+u,i.__lexicalSlotTextLength=a.length}else(wt(r).size>0||wt(n).size>0)&&(i.__lexicalSlotTextLength=0)}else{const c=i.__lexicalTextContent;typeof c!="string"&&I(356,n.getType()),ne+=c,Bc(i)}if((wn||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(Kc(i,r),$e(r)&&!wn))for(const c of r.getChildren())O(c)&&Kc(zo(ce,c.getKey()),c)}else{const s=r.getTextContent();if(te(r)){const l=r.decorate(ce,Ri);l!==null&&Dm(t,l),o&&(wt(r).size>0||wt(n).size>0)&&dh(n,r,i)}ne+=s}if(!vl&&$e(r)){const s=r.getLatest();if(s.__cachedText!==ne){const l=s.getWritable();l.__cachedText=ne,r=l}}return Rr.$decorateDOM(r,n,i,ce),Om(r),i}function Dm(t,e){let n=ce._pendingDecorators;const r=ce._decorators;if(n===null){if(r[t]===e)return;n=V1(ce)}n[t]=e}function Qa(t){let e=t.nextSibling;return e!==null&&e===ce._blockCursorElement&&(e=e.nextSibling),e}function gh(t,e){const n=new Set;for(let r=e;r{for(const u of c){const f=Ae.get(u);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let g=l.get(d);g===void 0&&(g=new Set,l.set(d,g)),g.add(u)}};return a(Si.keys()),a(Ei),l}();const s=new Map;return Fi=s,bn("root",null),ce=void 0,Di=void 0,Si=void 0,Ei=void 0,Gt=void 0,jc=void 0,Ae=void 0,Ri=void 0,Ir=void 0,Wc=void 0,Fi=void 0,Rr=Pl,s}function Gc(t){const e=Ir.get(t);return e===void 0&&I(75,t),e}function U(t){return{type:t}}const lf=U("SELECTION_CHANGE_COMMAND"),C_=U("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),af=U("CLICK_COMMAND"),Fm=U("BEFORE_INPUT_COMMAND"),Hm=U("INPUT_COMMAND"),Vm=U("COMPOSITION_START_COMMAND"),Bm=U("COMPOSITION_END_COMMAND"),Or=U("DELETE_CHARACTER_COMMAND"),Ao=U("INSERT_LINE_BREAK_COMMAND"),Hi=U("INSERT_PARAGRAPH_COMMAND"),Po=U("CONTROLLED_TEXT_INSERTION_COMMAND"),cf=U("PASTE_COMMAND"),Xs=U("REMOVE_TEXT_COMMAND"),Vi=U("DELETE_WORD_COMMAND"),Bi=U("DELETE_LINE_COMMAND"),Sn=U("FORMAT_TEXT_COMMAND"),b_=U("SET_TEXT_FORMAT_COMMAND"),oa=U("UNDO_COMMAND"),ia=U("REDO_COMMAND"),uf=U("KEYDOWN_COMMAND"),jm=U("KEY_ARROW_RIGHT_COMMAND"),Wm=U("MOVE_TO_END"),ff=U("KEY_ARROW_LEFT_COMMAND"),zm=U("MOVE_TO_START"),df=U("KEY_ARROW_UP_COMMAND"),hf=U("KEY_ARROW_DOWN_COMMAND"),ji=U("KEY_ENTER_COMMAND"),gf=U("KEY_SPACE_COMMAND"),pf=U("KEY_BACKSPACE_COMMAND"),mf=U("KEY_ESCAPE_COMMAND"),Km=U("KEY_DELETE_COMMAND"),yf=U("KEY_TAB_COMMAND"),Jm=U("INSERT_TAB_COMMAND"),Cl=U("INDENT_CONTENT_COMMAND"),Zc=U("OUTDENT_CONTENT_COMMAND"),Um=U("DROP_COMMAND"),w_=U("FORMAT_ELEMENT_COMMAND"),Gm=U("DRAGSTART_COMMAND"),Zm=U("DRAGOVER_COMMAND"),S_=U("DRAGEND_COMMAND"),sa=U("COPY_COMMAND"),xf=U("CUT_COMMAND"),qm=U("SELECT_ALL_COMMAND"),E_=U("CLEAR_EDITOR_COMMAND"),T_=U("CLEAR_HISTORY_COMMAND"),Nr=U("CAN_REDO_COMMAND"),Mr=U("CAN_UNDO_COMMAND"),_f=U("FOCUS_COMMAND"),Ym=U("BLUR_COMMAND"),k_=U("KEY_MODIFIER_COMMAND");function N_(t){const e=new Map;return{dispose(){for(const n of e.values())n.dispose();e.clear()},register(n,r){let o=e.get(n);o===void 0&&(o={dispose:t(n,r),holders:new Set},e.set(n,o));const i=()=>{const s=e.get(n);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(n),s.dispose())};return o.holders.add(i),i}}}function vf(t,e,n,r){return t.addEventListener(e,n,r),t.removeEventListener.bind(t,e,n,r)}const yn=Object.freeze({}),qc=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,t.key!=="Backspace"&&Wi(n),!e.isComposing()&&j(e,uf,t)}],["pointerdown",function(t,e){const n=If(t),r=t.pointerType;ni(n)&&r!=="touch"&&r!=="pen"&&t.button===0&&Pt(e,()=>{Rl(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){j(e,Vm,t)}],["compositionend",function(t,e){const n=e._inputState;Ln?n.compositionPhase="ending-firefox":rr||!as&&!cs?j(e,Bm,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;Wi(n),Pt(e,()=>{t1(t,e)||e.dispatchCommand(Hm,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){Pt(e,()=>{const n=V(),r=ht(Ct(e)),o=Qr();if(r){if($(n)){const i=n.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&n.isCollapsed()&&!$e(s)&&Ce().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&n.is(o)&&(r.removeAllRanges(),n.dirty=!0)}else if(t.pointerType==="touch"||t.pointerType==="pen"){const i=Ht(r,e._rootElement).anchorNode;(q(i)||vt(i))&&He(bf(o,r,e,t))}}j(e,af,t)})}],["cut",yn],["copy",yn],["dragstart",yn],["dragover",yn],["dragend",yn],["paste",yn],["focus",yn],["blur",yn],["drop",yn]];jo&&qc.push(["beforeinput",(t,e)=>function(n,r){const o=n.inputType;o==="deleteCompositionText"||Ln&&z1(r)||o!=="insertCompositionText"&&Pt(r,()=>{t1(n,r)||j(r,Fm,n)},{event:n})}(t,e)]);const Yc=new WeakMap,bl=new WeakMap,M_=N_(t=>(t.addEventListener("selectionchange",_h),()=>t.removeEventListener("selectionchange",_h)));function Xm(t,e,n,r,o,i){const s=t.anchor,l=t.focus,a=s.getNode(),c=he();let u;if(i!==void 0)u=i;else{const p=ht(Ct(c));u=p!==null?Ht(p,c._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,g=c.getElementByKey(d),h=n.length;return d!==l.key||!D(a)||(!o&&(!jo||c._inputState.lastBeforeInputInsertTextTimeStamp1||(o||!jo)&&g!==null&&!a.isComposing()&&f!==er(a,g,c)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!a.isComposing()&&(a.getFormat()!==t.format||a.getStyle()!==t.style)||function(p,y){if(y.isSegmented())return!0;if(!p.isCollapsed())return!1;const m=p.anchor.offset,x=y.getParentOrThrow(),v=Lr(y);return m===0?!y.canInsertTextBefore()||!x.canInsertTextBefore()&&!y.isComposing()||v||function(_){const S=_.getPreviousSibling();return(D(S)||O(S)&&S.isInline())&&!S.canInsertTextAfter()}(y):m===y.getTextContentSize()&&(!y.canInsertTextAfter()||!x.canInsertTextAfter()&&!y.isComposing()||v)}(t,a)}function ph(t,e){return vt(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function mh(t,e,n){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=Ht(t,e._rootElement),l=e._inputState;l.isSelectionChangeFromDOMUpdate&&(l.isSelectionChangeFromDOMUpdate=!1,ph(r,o)&&ph(i,s)&&!l.postDeleteSelectionToRestore)||Pt(e,()=>{if(!n)return void He(null);if(!gs(e,r,i))return;let a=V();if(l.postDeleteSelectionToRestore&&$(a)&&a.isCollapsed()){const c=a.anchor,u=l.postDeleteSelectionToRestore.anchor;(c.key===u.key&&c.offset===u.offset+1||c.offset===1&&u.getNode().is(c.getNode().getPreviousSibling()))&&(a=l.postDeleteSelectionToRestore.clone(),He(a))}if(l.postDeleteSelectionToRestore=null,$(a)){const c=a.anchor,u=c.getNode();if(a.isCollapsed()){t.type==="Range"&&r===i&&(a.dirty=!0);const f=Ct(e).event,d=f?f.timeStamp:performance.now(),{format:g,style:h,offset:p,key:y,timeStamp:m}=l.collapsedSelectionFormat,x=Ce(),v=e.isComposing()===!1&&x.getTextContent()==="";if(dWi(t),0)}function n1(t,e){const n=If(t);if(q(n)&&Rl(n,e))return!0;const r=e.getRootElement();if(r===null)return!1;const o=Jo(r.ownerDocument);return o!==null&&r.contains(o)&&Rl(o,e)}function A_(t){const e=t.inputType,n=t1(t),r=he(),o=r._inputState,i=V();if(e==="insertText"&&t.data&&o.isInsertTextAfterHandledSelectionCommand){if(Wi(o),t.preventDefault(),$(i)&&!i.isCollapsed()){const f=i.isBackward()?i.anchor:i.focus;i.anchor.set(f.key,f.offset,f.type),i.focus.set(f.key,f.offset,f.type)}return!0}if(e==="deleteContentBackward"){if(i===null){const f=Qr();if(!$(f))return!0;He(f.clone())}if($(i)){const f=i.anchor.key===i.focus.key;if(function(d,g){return d.lastKeyCode==="MediaLast"&&g{Pt(r,()=>{Ke(null)})},30),$(i)){const d=i.anchor.getNode();d.markDirty(),D(d)||I(142),e1(i,d)}}else{if(Ke(null),rr&&n!==null&&!n.collapsed&&(i.applyDOMRange(n),!i.isCollapsed()))return t.preventDefault(),i.removeText(),!0;t.preventDefault();const d=i.anchor.getNode(),g=d.getTextContent(),h=d.canInsertTextAfter(),p=i.anchor.offset===0&&i.focus.offset===g.length;let y=yl&&f&&!p&&h;if(y&&i.isCollapsed()&&(y=!te(dv(i.anchor,!0))),!y){j(r,Or,!0);const m=V();yl&&$(m)&&m.isCollapsed()&&(o.postDeleteSelectionToRestore=m,setTimeout(()=>o.postDeleteSelectionToRestore=null))}}return!0}}if(!$(i))return!0;const s=t.data;o.unprocessedBeforeInputData!==null&&Of(!1,r,o.unprocessedBeforeInputData),i.dirty&&o.unprocessedBeforeInputData===null||!i.isCollapsed()||$e(i.anchor.getNode())||n===null||i.applyDOMRange(n),o.unprocessedBeforeInputData=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if(e==="insertText"||e==="insertTranspose"){if(s===` -`)t.preventDefault(),j(r,Ao,!1);else if(s===Tr)t.preventDefault(),j(r,Hi,void 0);else if(s==null&&t.dataTransfer){const f=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(f)}else s!=null&&Qm(i,n,s,t.timeStamp,!0)?(t.preventDefault(),j(r,Po,s),xh(s)):o.unprocessedBeforeInputData=s;return o.lastBeforeInputInsertTextTimeStamp=t.timeStamp,!0}switch(t.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":j(r,Po,t),xh((t.dataTransfer?t.dataTransfer.getData("text/plain"):null)??t.data);break;case"insertFromComposition":{const f=o.hadOrphanedCompositionEvents;o.hadOrphanedCompositionEvents=!1;const d=r._compositionKey;Ke(null),f||j(r,Po,t),el(d);break}case"insertLineBreak":Ke(null),j(r,Ao,!1);break;case"insertParagraph":Ke(null),o.isInsertLineBreak&&!rr?(o.isInsertLineBreak=!1,j(r,Ao,!1)):j(r,Hi,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":j(r,cf,t);break;case"deleteByComposition":(function(f,d){return f!==d||O(f)||O(d)||!Lr(f)||!Lr(d)})(c,u)&&j(r,Xs,t);break;case"deleteByDrag":In(El),j(r,Xs,t);break;case"deleteByCut":j(r,Xs,t);break;case"deleteContent":j(r,Or,!1);break;case"deleteWordBackward":j(r,Vi,!0);break;case"deleteWordForward":j(r,Vi,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":j(r,Bi,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":j(r,Bi,!1);break;case"formatStrikeThrough":j(r,Sn,"strikethrough");break;case"formatBold":j(r,Sn,"bold");break;case"formatItalic":j(r,Sn,"italic");break;case"formatUnderline":j(r,Sn,"underline");break;case"historyUndo":j(r,oa,void 0);break;case"historyRedo":j(r,ia,void 0)}return!0}function P_(t){const e=he(),n=e._inputState,r=V(),o=t.data,i=t1(t);let s=!1;if(o!=null&&$(r)){const l=ht(Ct(e)),a=l!==null?Ht(l,e._rootElement):null,c=t.inputType==="insertCompositionText"&&n.compositionPhase!=="ending-firefox"&&!e.isComposing();c&&(n.hadOrphanedCompositionEvents=!0);const u=r.anchor.getNode(),f=t.inputType==="insertCompositionText"&&n.compositionPhase!=="ending-firefox"&&e.isComposing()&&D(u)&&St(u);if(!c&&!f&&Qm(r,i,o,t.timeStamp,!1,a)){if(s=!0,n.compositionPhase==="ending-firefox"){const m=wl(e,o);if(n.compositionPhase="idle",m)return In(zi),Kh(),!0}const d=r.anchor.getNode();if(l===null||a===null)return!0;const g=r.isBackward(),h=g?r.anchor.offset:r.focus.offset,p=g?r.focus.offset:r.anchor.offset;jo&&!r.isCollapsed()&&D(d)&&a.anchorNode!==null&&d.getTextContent().slice(0,h)+o+d.getTextContent().slice(h+p)===z1(a.anchorNode)||j(e,Po,o);const y=o.length;Ln&&y>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=y,r._cachedNodes=null,r._cachedIsBackward=null),yl&&e.isComposing()&&(n.lastKeyDownTimeStamp=0,Ke(null))}}return s||(Of(!1,e,o!==null?o:void 0),n.compositionPhase==="ending-firefox"&&(wl(e,o||void 0),In(zi),n.compositionPhase="idle")),Kh(),!0}function L_(t){const e=he(),n=e._inputState,r=V();if($(r)&&!e.isComposing()){n.compositionPhase="composing",n.hadOrphanedCompositionEvents=!1;const o=r.anchor,i=r.anchor.getNode();if(Ke(o.key),In(f1),t.timeStamp{wl(e,n.compositionEndData)}),n.compositionPhase="idle",n.compositionEndData="",r)return!0}if(function(r){return _e(r,"ArrowRight",{shiftKey:"any"})}(t))j(e,Wm,t);else if(function(r){return _e(r,"ArrowRight",{..._n,shiftKey:"any"})}(t))j(e,zm,t);else if(function(r){return _e(r,"ArrowLeft",{shiftKey:"any"})}(t))j(e,ff,t);else if(function(r){return _e(r,"ArrowLeft",{..._n,shiftKey:"any"})}(t))j(e,Km,t);else if(function(r){return _e(r,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))j(e,df,t);else if(function(r){return _e(r,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))j(e,hf,t);else if(function(r){return _e(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))n.isInsertLineBreak=!0,j(e,ji,t);else if(function(r){return r.key===" "}(t))j(e,gf,t);else if(function(r){return Ut&&_e(r,"o",{ctrlKey:!0})}(t))t.preventDefault(),n.isInsertLineBreak=!0,j(e,Ao,!0);else if(function(r){return _e(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))n.isInsertLineBreak=!1,j(e,ji,t);else if(function(r){return _e(r,"Backspace",{shiftKey:"any"})||Ut&&_e(r,"h",{ctrlKey:!0})}(t))Uh(t)?j(e,pf,t)&&_h(n):(t.preventDefault(),j(e,Or,!0));else if(function(r){return r.key==="Escape"}(t))j(e,mf,t);else if(function(r){return _e(r,"Delete",{})||Ut&&_e(r,"d",{ctrlKey:!0})}(t))(function(r){return r.key==="Delete"})(t)?j(e,Jm,t):(t.preventDefault(),j(e,Or,!1));else if(function(r){return _e(r,"Backspace",Jh)}(t))t.preventDefault(),j(e,Vi,!0);else if(function(r){return _e(r,"Delete",Jh)}(t))t.preventDefault(),j(e,Vi,!1);else if(function(r){return Ut&&_e(r,"Backspace",{metaKey:!0})}(t))t.preventDefault(),j(e,Bi,!0);else if(function(r){return Ut&&(_e(r,"Delete",{metaKey:!0})||_e(r,"k",{ctrlKey:!0}))}(t))t.preventDefault(),j(e,Bi,!1);else if(function(r){return _e(r,"b",_n)}(t))t.preventDefault(),j(e,Sn,"bold");else if(function(r){return _e(r,"u",_n)}(t))t.preventDefault(),j(e,Sn,"underline");else if(function(r){return _e(r,"i",_n)}(t))t.preventDefault(),j(e,Sn,"italic");else if(function(r){return _e(r,"Tab",{shiftKey:"any"})}(t))j(e,yf,t);else if(function(r){return _e(r,"z",_n)}(t))t.preventDefault(),j(e,oa,void 0);else if(function(r){return Ut?_e(r,"z",{metaKey:!0,shiftKey:!0}):_e(r,"y",{ctrlKey:!0})||_e(r,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),j(e,ia,void 0);else{const r=e._editorState._selection;(function(o){return _e(o,"a",_n)})(t)?(t.preventDefault(),j(e,Ym,t)&&_h(n)):r===null||$(r)||(function(o){return _e(o,"c",_n)}(t)?(t.preventDefault(),j(e,sa,t)):function(o){return _e(o,"x",_n)}(t)&&(t.preventDefault(),j(e,xf,t)))}return function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey}(t)&&e.dispatchCommand(N_,t),!0}function r1(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}const Lo=new Map;function vh(t){const e=mv(t.target);if(e===null)return;const n=Lf(t.target);let r=null,o=null;const i=n!==null?bl.get(n):void 0;if(n!==null){if(i!==void 0){const f=i.editors;let d=i.hasShadowEditor;if(d===void 0){d=!1;for(const g of f)if(g._rootElement!==null&&Rn(g._rootElement.getRootNode())){d=!0;break}i.hasShadowEditor=d}if(d){let g=null,h=null;for(const p of f){const y=p._rootElement;if(y===null)continue;const m=Ht(e,y).anchorNode;if(m!==null&&Pr(m)===p){if(Rn(y.getRootNode())){r=p,o=m;break}g===null&&(g=p,h=m)}}r===null&&g!==null&&(r=g,o=h)}else{const g=e.anchorNode;g===null||q(g)&&g.shadowRoot!==null||(r=Pr(g),r!==null&&(o=g))}}if(r===null){const f=Jo(n);r=f!==null?Pr(f):null}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(i!==void 0)for(const f of i.editors)f._inputState.isSelectionChangeFromMouseDown=!1;Pt(r,()=>{const f=Qr(),d=o??Ht(e,r._rootElement).anchorNode;(q(d)||vt(d))&&He(bf(f,e,r,t))})}const s=Mf(r),l=s[s.length-1],a=l._key,c=Lo.get(a),u=c||l;u!==r&&yh(e,u,!1),yh(e,r,!0),r!==l?Lo.set(a,r):c&&Lo.delete(a)}function Ch(t){t._lexicalHandled=!0}function bh(t){return t._lexicalHandled===!0}function R_(t){const e=Yc.get(t);if(e===void 0)return;const n=bl.get(e);if(n===void 0)return;Yc.delete(t);const r=ei(t);ps(r)?(function(i){if(i._parentEditor!==null){const s=Mf(i),l=s[s.length-1]._key;Lo.get(l)===i&&Lo.delete(l)}else Lo.delete(i._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,t.__lexicalEditor=null):r&&I(198);const o=r1(t);for(let i=0;io.__key===this.__key);if(D(this))return r;if($(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;const o=this.getParent();if(te(this)&&this.isInline()&&o){const i=n.isBackward()?n.focus:n.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let n=e.getFirstChild(),r=0;for(;n!==null;){if(this.is(n))return r;r++,n=n.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Se(e)}getParentOrThrow(){const e=this.getParent();return e===null&&I(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const n=e.getParent();if(ve(n)||Qe(e)!==null)return O(e)||e===this&&te(e)||I(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&I(67,this.__key),e}getParents(){const e=[];let n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){const e=[];let n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Se(e)}getPreviousSiblings(){const e=[],n=this.getParent();if(n===null)return e;let r=n.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Se(e)}getNextSiblings(){const e=[];let n=this.getNextSibling();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getCommonAncestor(e){const n=O(this)?this:this.getParent(),r=O(e)?e:e.getParent(),o=n&&r?lu(n,r):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const n=lu(this,e);return n!==null&&(n.type==="descendant"||(n.type==="branch"?s0(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&I(279),!1)))}isParentOf(e){return Ko(e,this)}getNodesBetween(e){const n=this.isBefore(e),r=[],o=new Set;let i=this;for(;i!==null;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=O(i)?n?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const a=n?i.getNextSibling():i.getPreviousSibling();if(a!==null){i=a;continue}const c=i.getParentOrThrow();if(o.has(c.__key)||r.push(c),c===e)break;let u=null,f=c;do{if(f===null&&I(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;u!==null||o.has(f.__key)||r.push(f)}while(u===null);i=u}return n||r.reverse(),r}isDirty(){const e=he()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Sl(this))return this;const e=Se(this.__key);return e===null&&I(113),e}getWritable(){if(Sl(this))return this;ze();const e=Bn(),n=he(),r=e._nodeMap,o=this.__key,i=this.getLatest(),s=n._cloneNotNeeded,l=V();if(l!==null&&l.setCachedNodes(null),s.has(o))return Ll(i),i;const a=Y1(i);return s.add(o),Ll(a),r.set(o,a),a}getTextContent(){return n0(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){I(70)}updateDOM(e,n,r){I(71)}getDOMSlot(e){return new vm(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){I(18,this.name)}updateFromJSON(e){return function(n,r){const o=n.getWritable(),i=r.$;let s=i;for(const l of Om(o).flatKeys)l in r&&(s!==void 0&&s!==i||(s={...i}),s[l]=r[l]);return(o.__state||s)&&Mm(n).updateFromJSON(s),o}(this,e)}static transform(){return null}remove(e){Xc(this,!0,e)}replace(e,n){ze();let r=V();r!==null&&(r=r.clone()),ac(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size,u=l.getParent(),f=u!==null?l.getIndexWithinParent():-1;En(l),u!==null&&$(r)&&Er(r,u,f,-1);const d=o.getPreviousSibling(),g=o.getNextSibling(),h=o.__prev,p=o.__next,y=o.__parent;Xc(o,!1,!0),d===null?a.__first=s:d.getWritable().__next=s,l.__prev=h,g===null?a.__last=s:g.getWritable().__prev=s,l.__next=p,l.__parent=y,a.__size=c;let m=0;n&&(O(this)&&O(l)||I(139),m=l.getChildrenSize(),l.splice(m,0,this.getChildren()));const x=Lt(this);if(x.length>0){kn(this)&&kn(l)||I(368,this.__key,l.__key);for(const v of x){const _=jr(this,v);_!==null&&($v(this,v),r0(l,v,_))}}if($(r)){He(r);const v=r.anchor,_=r.focus;v.key===i&&(n&&v.type==="element"?v.set(l.__key,m+v.offset,"element"):kh(v,l)),_.key===i&&(n&&_.type==="element"?_.set(l.__key,m+_.offset,"element"):kh(_,l))}return Tn()===i&&Ke(s),l}insertAfter(e,n=!0){ze(),ac(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.getParent(),s=V();let l=!1,a=!1;if(i!==null){const g=e.getIndexWithinParent();if($(s)){const h=i.__key,p=s.anchor,y=s.focus;l=p.type==="element"&&p.key===h&&p.offset===g+1,a=y.type==="element"&&y.key===h&&y.offset===g+1}En(o),n&&$(s)&&Er(s,i,g,-1)}else En(o);const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),f=o.__key,d=r.__next;if(c===null?u.__last=f:c.getWritable().__prev=f,u.__size++,r.__next=f,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,n&&$(s)){const g=this.getIndexWithinParent();Er(s,u,g+1);const h=u.__key;l&&s.anchor.set(h,g+2,"element"),a&&s.focus.set(h,g+2,"element")}return e}insertBefore(e,n=!0){ze(),ac(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.__key,s=V(),l=o.getParent(),a=l!==null?o.getIndexWithinParent():-1;En(o),l!==null&&n&&$(s)&&Er(s,l,a,-1);const c=this.getPreviousSibling(),u=this.getParentOrThrow().getWritable(),f=r.__prev,d=this.getIndexWithinParent();return c===null?u.__first=i:c.getWritable().__next=i,u.__size++,r.__prev=i,o.__prev=f,o.__next=r.__key,o.__parent=r.__parent,n&&$(s)&&Er(s,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return re()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,n){ze();const r=Zt(this);if(r!==null)return r.selectPrevious(e,n);const o=this.getPreviousSibling(),i=this.getParentOrThrow();if(o===null)return i.select(0,0);if(O(o))return o.select();if(!D(o)){const s=o.getIndexWithinParent()+1;return i.select(s,s)}return o.select(e,n)}selectNext(e,n){ze();const r=Zt(this);if(r!==null)return r.selectNext(e,n);const o=this.getNextSibling(),i=this.getParentOrThrow();if(o===null)return i.select();if(O(o))return o.select(0,0);if(!D(o)){const s=o.getIndexWithinParent();return i.select(s,s)}return o.select(e,n)}markDirty(){this.getWritable()}reconcileObservedMutation(e,n){this.markDirty()}}P(mt,"importDOM");function i1(t){return t instanceof mt}const Ar="historic",s1="history-push",Ti="history-merge",l1="paste",a1="cut",c1="collaboration",D_="skip-scroll-into-view",u1="skip-dom-selection",El="skip-selection-focus",f1="composition-start",zi="composition-end",F_="!important";function Tl(t){const e={};if(!t)return e;let n="",r="",o=null,i=!1,s=!1,l=!1,a=0;const c=t.length;let u=-1;for(let g=0;g=0&&r.slice(o).toLowerCase()===F_?t.setProperty(e,r.slice(0,o).trim(),"important"):t.setProperty(e,n,"")}function $o(t,e,n=""){if(e===n)return;const r=Tl(n),o=Tl(e);for(const i in o)delete r[i],H_(t,i,o[i]);for(const i in r)t.removeProperty(i)}function ec(t,e){return 16&e?"code":e&rf?"mark":32&e?"sub":64&e?"sup":null}function tc(t,e){return 1&e?"strong":2&e?"em":"span"}function d1(t,e,n,r,o){const i=r.classList;let s=Io(o,"base");s!==void 0&&i.add(...s),s=Io(o,"underlineStrikethrough");let l=!1;const a=8&e&&4&e;s!==void 0&&(8&n&&4&n?(l=!0,a||i.add(...s)):a&&i.remove(...s));for(const c in $n){const u=$n[c];if(s=Io(o,c),s!==void 0)if(n&u){if(l&&(c==="underline"||c==="strikethrough")){e&u&&i.remove(...s);continue}(!(e&u)||a&&c==="underline"||c==="strikethrough")&&i.add(...s)}else e&u&&i.remove(...s)}}function h1(t,e,n){const r=n.isComposing(),o=t+(r?$i:""),i=Me(),s=fa(i).$getDOMSlot(n,e,i),l=s.getFirstChild();if(l===null||l.nodeType!==Node.TEXT_NODE)return void s.insertChild(Te().createTextNode(o));const a=l,c=a.nodeValue;if(c!==o)if(r||Ln){const[u,f,d]=function(g,h){const p=g.length,y=h.length;let m=0,x=0;for(;m({conversion:W_,priority:0}),b:()=>({conversion:B_,priority:0}),code:()=>({conversion:xn,priority:0}),em:()=>({conversion:xn,priority:0}),i:()=>({conversion:xn,priority:0}),mark:()=>({conversion:xn,priority:0}),s:()=>({conversion:xn,priority:0}),span:()=>({conversion:V_,priority:0}),strong:()=>({conversion:xn,priority:0}),sub:()=>({conversion:xn,priority:0}),sup:()=>({conversion:xn,priority:0}),u:()=>({conversion:xn,priority:0})}}static importJSON(n){return Pe().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setTextContent(n.text).setFormat(n.format).setDetail(n.detail).setMode(n.mode).setStyle(n.style)}exportDOM(n){let{element:r}=super.exportDOM(n);return q(r)||I(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=Os(r,"b")),this.hasFormat("italic")&&(r=Os(r,"i")),this.hasFormat("strikethrough")&&(r=Os(r,"s")),this.hasFormat("underline")&&(r=Os(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(n,r){}setFormat(n){const r=this.getWritable();return r.__format=typeof n=="string"?$n[n]:n,r}setDetail(n){const r=this.getWritable();return r.__detail=typeof n=="string"?i_[n]:n,r}setStyle(n){const r=this.getWritable();return r.__style=n,r}toggleFormat(n){const r=Vr(this.getFormat(),n,null);return this.setFormat(r)}toggleDirectionless(){const n=this.getWritable();return n.__detail^=1,n}toggleUnmergeable(){const n=this.getWritable();return n.__detail^=2,n}setMode(n){const r=l_[n];if(this.__mode===r)return this;const o=this.getWritable();return o.__mode=r,o}setTextContent(n){if(this.__text===n)return this;const r=this.getWritable();return r.__text=n,r}select(n,r){ze();let o=n,i=r;const s=V(),l=this.getTextContent(),a=this.__key;if(typeof l=="string"){const c=l.length;o===void 0&&(o=c),i===void 0&&(i=c)}else o=0,i=0;if(!$(s))return S1(a,o,a,i,"text","text");{const c=Tn();c!==s.anchor.key&&c!==s.focus.key||Ke(a),s.setTextNodeRange(this,o,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const n=this.getTextContentSize();return this.select(n,n)}spliceText(n,r,o,i){const s=this.getWritable(),l=s.__text,a=o.length;let c=n;c<0&&(c=a+c,c<0&&(c=0));const u=V();if(i&&$(u)){const d=n+a;u.setTextNodeRange(s,d,s,d)}const f=l.slice(0,c)+o+l.slice(c+r);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...n){ze();const r=this.getLatest(),o=r.getTextContent();if(o==="")return[];const i=r.__key,s=Tn(),l=o.length;n.sort((k,M)=>k-M),n.push(l);const a=[],c=n.length;for(let k=0,M=0;kk&&(a.push(o.slice(k,A)),k=A)}const u=a.length;if(u===1)return[r];const f=a[0],d=r.getParent();let g;const h=r.getFormat(),p=r.getStyle(),y=r.__detail;let m=!1,x=null,v=null;const _=V();if($(_)){const[k,M]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];k.type==="text"&&k.key===i&&(x=k),M.type==="text"&&M.key===i&&(v=M)}r.isSegmented()?(g=Pe(f),g.__format=h,g.__style=p,g.__detail=y,g.__state=sh(r,g),m=!0):g=r.setTextContent(f);const S=[g];for(let k=1;k=w&&(x.set(k.getKey(),E-w,"text"),E=w){v.set(k.getKey(),b-w,"text");break}w=M}if(d!==null){(function(A){const R=A.getPreviousSibling(),F=A.getNextSibling();R!==null&&Ll(R),F!==null&&Ll(F)})(this);const k=d.getWritable(),M=this.getIndexWithinParent();m?(k.splice(M,0,S),this.remove()):k.splice(M,1,S),$(_)&&Er(_,d,M,u-1)}return S}mergeWithSibling(n){const r=n===this.getPreviousSibling();r||n===this.getNextSibling()||I(50);const o=this.__key,i=n.__key,s=this.__text,l=s.length;Tn()===i&&Ke(o);const a=V();if($(a)){const d=a.anchor,g=a.focus;d!==null&&d.key===i&&$h(d,r,o,n,l),g!==null&&g.key===i&&$h(g,r,o,n,l)}const c=n.__text,u=r?c+s:s+c;this.setTextContent(u);const f=this.getWritable();return n.remove(),f}isTextEntity(){return!1}}function V_(t){return{forChild:Cf(t.style),node:null}}function B_(t){const e=t,n=e.style.fontWeight==="normal";return{forChild:Cf(e.style,n?void 0:"bold"),node:null}}const Eh=new WeakMap;function j_(t){if(!q(t))return!1;if(t.nodeName==="PRE")return!0;const e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function W_(t){const e=t;t.parentElement===null&&I(129);let n=e.textContent||"";if(function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=Eh.get(i))===void 0&&!j_(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let a=0;a0){/[ \t\n]$/.test(i)&&(n=n.slice(1)),o=!1;break}}o&&(n=n.slice(1))}if(n[n.length-1]===" "){let r=e,o=!0;for(;r!==null&&(r=Th(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Pe(n)}}function Th(t,e){let n=t;for(;;){let r;for(;(r=e?n.nextSibling:n.previousSibling)===null;){const i=n.parentElement;if(i===null)return null;n=i}if(n=r,q(n)){const i=n.style.display;if(i===""&&!Il(n)||i!==""&&!i.startsWith("inline"))return null}let o=n;for(;(o=e?n.firstChild:n.lastChild)!==null;)n=o;if(vt(n))return n;if(n.nodeName==="BR")return null}}const z_={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function xn(t){const e=z_[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Cf(t.style,e),node:null}}function Pe(t=""){return kt(new Qt(t))}function D(t){return t instanceof Qt}function Cf(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),o=n==="700"||n==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),a=t.verticalAlign;return c=>((D(c)||Qc(c))&&(o&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),l&&!c.hasFormat("underline")&&c.toggleFormat("underline"),a!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),a!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}class Yr extends Qt{static getType(){return"tab"}static clone(e){return new Yr(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){const n=super.createDOM(e),r=Io(e.theme,"tab");return r!==void 0&&n.classList.add(...r),n}static importJSON(e){return fs().updateFromJSON(e)}setTextContent(e){return super.setTextContent(" ")}spliceText(e,n,r,o){return r===""&&n===0||r===" "&&n===1||I(286),this}setDetail(e){return e!==2&&I(127),this}setMode(e){return e!=="normal"&&I(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function fs(){return kt(new Yr)}function Dr(t){return t instanceof Yr}class K_{constructor(e,n,r){P(this,"key");P(this,"offset");P(this,"type");P(this,"_selection");this._selection=null,this.key=e,this.offset=n,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offseti&&(r=i)}else if(!O(e)){const i=e.getNextSibling();if(D(i))n=i.__key,r=0,o="text";else{const s=e.getParent();s&&(n=s.__key,r=e.getIndexWithinParent()+1)}}t.set(n,r,o)}function kh(t,e){if(O(e)){const n=e.getLastDescendant();O(n)||D(n)?nc(t,n):nc(t,e)}else nc(t,e)}class la{constructor(e){P(this,"_nodes");P(this,"_cachedNodes");P(this,"dirty");this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!be(e))return!1;const n=this._nodes,r=e._nodes;return n.size===r.size&&Array.from(n).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new la(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const n=this.getNodes().filter(s=>Qe(s)===null),r=n.length;if(r===0)return;const o=n[r-1];let i;if(D(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;sQe(n)===null);if((V()||Qr())===this&&e[0]){const n=fe(e[0],"next");Go(qt(n,n))}for(const n of e)n.remove();g1()}}function g1(){const t=Ce();if(t.isEmpty()){const e=re();t.append(e),e.select()}}function $(t){return t instanceof Xr}class Xr{constructor(e,n,r,o){P(this,"format");P(this,"style");P(this,"anchor");P(this,"focus");P(this,"_cachedNodes");P(this,"_cachedIsBackward");P(this,"dirty");this.anchor=e,this.focus=n,e._selection=this,n._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!$(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const n=function(r){const o=[],[i,s]=r.getTextSlices();i&&o.push(i.caret.origin);const l=new Set,a=new Set;for(const c of r)if(Et(c)){const{origin:u}=c;o.length===0?l.add(u):(a.add(u),o.push(u))}else{const{origin:u}=c;O(u)&&a.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),ir(r.focus)&&O(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let c=Tt(r.focus.origin,"previous");Et(c)&&l.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(o[o.length-1]);c=ga(c))l.delete(c.origin),o.pop();for(;o.length>1;){const c=o[o.length-1];if(!O(c)||a.has(c)||c.isEmpty()||l.has(c))break;o.pop()}if(o.length===0&&r.isCollapsed()){const c=pt(r.anchor),u=pt(r.anchor.getFlipped()),f=g=>$t(g)?g.origin:g.getNodeAtCaret(),d=f(c)||f(u)||(r.anchor.getNodeAtCaret()?c.origin:u.origin);o.push(d)}return o}(jf(au(this),"next"));return Wo()||(this._cachedNodes=n),n}setTextNodeRange(e,n,r,o){return this.anchor.set(e.__key,n,"text"),this.focus.set(r.__key,o,"text"),this}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const n=e[0],r=e[e.length-1],o=this.anchor,i=this.focus,s=o.isBefore(i),[l,a]=eu(this);let c="",u=!0;for(let f=0;f=0;w--){const k=_[w];if(k.is(d)||O(k)&&k.isParentOf(d))break;k.isAttached()&&(!S.has(k)||k.is(v)?E||b.insertAfter(k,!1):k.remove())}if(!E){let w=x,k=null;for(;w!==null;){const M=w.getChildren(),A=M.length;(A===0||M[A-1].is(k))&&(y.delete(w.__key),k=w),w=w.getParent()}}if(Lr(d))if(a===g)d.select();else{const w=Pe(e);w.select(),d.replace(w)}else d=d.spliceText(a,g-a,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let w=1;w(O(p)||te(p))&&!p.isInline())){O(o)||I(211,r.constructor.name,r.getType());const p=hi(this);return o.splice(p,0,e),void i.selectEnd()}if(O(o)&&Qe(o)!==null){const p=hi(this),y=nu(e);o.splice(p,0,y);const m=y[y.length-1];return void(m!==void 0?m.selectEnd():o.select(p,p))}if(o===null){const p=oc(e),y=p.getLastDescendant();let m=ut(this.anchor,"next");for(const x of p.getChildren())m=Wf(x,m);return void(y!==null&&y.selectEnd())}if(O(o)&&!o.isParentRequired()&&!ve(o.getParentOrThrow())){const p=hi(this),y=nu(e);o.splice(p,0,y);const m=y[y.length-1];return void(m!==void 0?m.selectEnd():o.select(p,p))}const s=oc(e),l=s.getLastDescendant(),a=s.getChildren(),c=!O(o)||!o.isEmpty()?this.insertParagraph():null;c&&!o.isAttached()&&(r=this.anchor.getNode(),o=Ne(r,Xe));const u=a[a.length-1];let f=a[0];var d;O(d=f)&&Xe(d)&&!d.isEmpty()&&O(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(O(o)||I(211,r.constructor.name,r.getType()),o.append(...f.getChildren()),f=a[1]),f&&(o===null&&I(212,r.constructor.name,r.getType()),function(p,y){const m=y.getParentOrThrow().getLastChild();let x=y;const v=[y];for(;x!==m;)x.getNextSibling()||I(140),x=x.getNextSibling(),v.push(x);let _=p;for(const S of v)_=_.insertAfter(S)}(o,f));const g=Ne(l,Xe);c&&O(g)&&(c.canMergeWhenEmpty()||Xe(u))&&(g.append(...c.getChildren()),c.remove()),O(o)&&o.isEmpty()&&o.remove(),l.selectEnd();const h=O(o)?o.getLastChild():null;rt(h)&&g!==o&&h.remove()}insertParagraph(){const e=this.anchor.getNode();if(this.anchor.type==="element"&&ve(e)){const l=re();return e.splice(this.anchor.offset,0,[l]),l.select(),l}const n=hi(this),r=Ne(this.anchor.getNode(),Xe);if(r!==null&&Qe(r)!==null)return null;O(r)||I(213);const o=r.getChildAtIndex(n),i=o?[o,...o.getNextSiblings()]:[],s=r.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const n=_t();if(this.insertNodes([n]),e){const r=n.getParentOrThrow(),o=n.getIndexWithinParent();r.select(o,o)}}extract(){const e=[...this.getNodes()],n=e.length;let r=e[0],o=e[n-1];const[i,s]=eu(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[s,i]:[i,s];if(n===0)return[];if(n===1){if(D(r)&&!this.isCollapsed()){const d=r.splitText(u,f),g=u===0?d[0]:d[1];return g?(a.set(g.getKey(),0,"text"),c.set(g.getKey(),g.getTextContentSize(),"text"),[g]):[]}return[r]}if(D(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,a.set(r.getKey(),0,"text"))),D(o)){const d=o.getTextContent().length;f===0?e.pop():f!==d&&([o]=o.splitText(f),e[e.length-1]=o,c.set(o.getKey(),o.getTextContentSize(),"text"))}return e}modify(e,n,r){if(Ml(this,e,n,r))return;const o=e==="move",i=he(),s=ht(Ct(i));if(!s)return;const l=i._blockCursorElement,a=i._rootElement,c=this.focus.getNode();a===null||l===null||!O(c)||c.isInline()||c.canBeEmpty()||$l(l,i,a);const u=zo(i,this.focus.key);let f=u;if(this.focus.type==="text"&&(f=D(c)?er(c,u,i):null),this.dirty){const d=zo(i,this.anchor.key);let g=d;if(this.anchor.type==="text"){const h=this.anchor.getNode();g=D(h)?er(h,d,i):null}g&&f&&Nl(s,g,this.anchor.offset,f,this.focus.offset)}if(r==="character"&&D(c)&&c.isUnmergeable()&&(n?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){const d=fe(c,n?"previous":"next").getNodeAtCaret();if(D(d)){if(!o){const g=d.getTextContentSize();return n?this.focus.set(d.__key,g-1,"text"):this.focus.set(d.__key,1,"text"),void(this.dirty=!0)}{const g=i.getElementByKey(d.getKey()),h=g?er(d,g,i):null;if(h){const p=n?h.length:0;Nl(s,h,p,h,p)}}}}if(x1(s,e,n?"backward":"forward",r),s.rangeCount>0){const d=ua(s,i._rootElement),g=d||s.getRangeAt(0),h=this.anchor.getNode(),p=$e(h)?h:J1(h);this.applyDOMRange(g),this.dirty=!0,!o&&(_1(this,n,p),(d?s.direction!=="backward":s.anchorNode===g.startContainer&&s.anchorOffset===g.startOffset)||y1(this))}r==="lineboundary"&&Ml(this,e,n,r,"decorators")}forwardDeletion(e,n,r){if(!r&&(e.type==="element"&&O(n)&&e.offset===n.getChildrenSize()||e.type==="text"&&e.offset===n.getTextContentSize())){const o=n.getParent(),i=n.getNextSibling()||(o===null?null:o.getNextSibling());if(O(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const n=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,e))return;const i=pa(ut(r,e?"previous":"next"));if(i.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of i.iterNodeCarets("shadowRoot"))if(Et(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(O(i.anchor.origin)&&i.anchor.origin.isEmpty()){const c=pt(a);ol(this,qt(c,c)),i.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(ir(a)){if(O(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(i.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(te(a.origin)){if(!a.origin.isIsolated())if(Lt(a.origin).length>0){if(O(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const c=Ki();c.add(a.origin.getKey()),He(c)}}else if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&O(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const c=Ki();c.add(a.origin.getKey()),He(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return Lt(c).length>0?void 0:a.origin.isEmpty()&&!c.isEmpty()&&a.origin.getParent()===c.getParent()?void a.origin.remove(!0):(ol(this,qt(!a.origin.isEmpty()&&c.isEmpty()?oo(fe(c,a.direction)):i.anchor,a)),this.removeText())}for(let a=r.getNode();a!==null;){if(Qe(a)!==null)return;if(O(a)&&a.isShadowRoot())break;a=a.getParent()}}const s=this.focus;if(rc(this,e,"character"),this.isCollapsed()){if(e&&r.offset===0&&Mh(this,r.getNode()))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=s.offset,c=l.getTextContentSize();if(l.is(o)||e&&a!==c||!e&&a!==0)return void Oh(l,e,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,c=o.getTextContentSize();if(o.is(l)||e&&a!==0||!e&&a!==c)return void Oh(o,e,a)}(function(a,c){const u=a.anchor,f=a.focus,d=u.getNode(),g=f.getNode();if(d===g&&u.type==="text"&&f.type==="text"){const h=u.offset,p=f.offset,y=h0&&(h===g.getTextContentSize()||St(g)||([g]=g.splitText(h)),g.setFormat(y));for(let m=c+1;m{for(const[o,i]of n)r=Vr(r,o,i?$n[o]:0);return r})}function m1(t,e,n=null){const r=n===null&&$(t)?Vr(t.format,e,null):n;p1(t,o=>Vr(o,e,r))}function Nh(t){const e=t.offset;if(t.type==="text")return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function eu(t){const e=t.getStartEndPoints();if(e===null)return[0,0];const[n,r]=e;return n.type==="element"&&r.type==="element"&&n.key===r.key&&n.offset===r.offset?[0,0]:[Nh(n),Nh(r)]}function Mh(t,e){for(let n=e;n;n=n.getParent()){if(O(n)){if(n.collapseAtStart(t))return!0;if(ve(n))break}if(n.getPreviousSibling())break}return!1}function y1(t){const e=t.focus,n=t.anchor,r=n.key,o=n.offset,i=n.type;n.set(e.key,e.offset,e.type,!0),e.set(r,o,i,!0)}function x1(t,e,n,r){t.modify(e,n,r)}function _1(t,e,n){const r=t.getNodes(),o=r.filter(l=>Ko(l,n));if(o.length===0||o.length===r.length)return!1;const i=e?o[0]:o[o.length-1],s=O(i)?i:i.getParentOrThrow();return e?s.selectStart():s.selectEnd(),!0}function rc(t,e,n){if(Ml(t,"extend",e,n))return;const r=he(),o=ht(Ct(r));if(!o||typeof o.modify!="function")return;const i=r._blockCursorElement,s=r._rootElement,l=t.anchor,a=t.focus.getNode();s===null||i===null||!O(a)||a.isInline()||a.canBeEmpty()||$l(i,r,s);const c=k=>{const M=k.getNode(),A=r.getElementByKey(k.key);return A!==null&&k.type==="text"&&D(M)?er(M,A,r):A},u=l.getNode(),f=c(l);if(f===null)return;const d=l.offset,g=t.isCollapsed(),h=t.focus,p=g?f:c(h);if(p===null)return;const y=h.offset;if(Nl(o,p,y,p,y),x1(o,"move",e?"backward":"forward",n),o.rangeCount===0)return;const m=ua(o,s)||o.getRangeAt(0),x=m.startContainer,v=m.startOffset;if(g&&n==="character"&&l.type==="text"&&D(u)&&u.isUnmergeable()&&d===(e?0:u.getTextContentSize())){const k=fe(u,e?"previous":"next").getNodeAtCaret();if(D(k)){const M=e?k.getTextContentSize()-1:1;return t.focus.set(k.__key,M,"text"),void(t.dirty=!0)}}if(g&&n==="character"&&l.type==="text"){const k=e?0:u.getTextContentSize(),M=x===f?v:d!==k?k:-1;if(M>=0)return void(M!==d&&(t.focus.set(l.key,M,"text"),t.dirty=!0))}const[_,S,E,b]=e?[x,v,f,d]:[f,d,x,v],w=$e(u)?u:J1(u);t.applyDOMRange({collapsed:!1,endContainer:E,endOffset:b,startContainer:_,startOffset:S}),t.dirty=!0,!_1(t,e,w)&&e&&y1(t),n==="lineboundary"&&Ml(t,"extend",e,n,"decorators")}const U_=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function Oh(t,e,n){const r=t,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let c=0;cn||u){o.splice(c,1),u&&(l=void 0);break}}const a=o.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Ah(t,e,n,r){let o,i=e,s=!1;if(q(t)){let l=!1;const a=t.childNodes,c=a.length,u=r._blockCursorElement;i===c&&c>0&&(l=!0,i=c-1),ti(t,r)!==void 0||Rl(t,r)||(s=!0);let f=a[i],d=!1;if(f===u)f=a[i+1],d=!0;else if(u!==null){const g=u.parentNode;t===g&&e>Array.prototype.indexOf.call(g.children,u)&&i--}if(o=So(f),D(o))i=an(o,l?"next":"previous");else{let g=So(t);if(g===null)return null;if(O(g)){const h=r.getElementByKey(g.getKey());h===null&&I(214),[g,i]=Vt(g,h,r).resolveChildIndex(g,h,t,e),O(g)||I(215),l&&i>=g.getChildrenSize()&&(i=Math.max(0,g.getChildrenSize()-1));let y=g.getChildAtIndex(i);if(O(y)&&function(m,x,v){const _=m.getParent();return v===null||_===null||!_.canBeEmpty()||_!==v.getNode()}(y,0,n)){const m=l?y.getLastDescendant():y.getFirstDescendant();m===null?g=y:(y=m,g=O(y)?y:y.getParentOrThrow()),i=0}D(y)?(o=y,g=null,i=an(y,l?"next":"previous")):y!==g&&l&&!d&&(O(g)||I(216),i=Math.min(g.getChildrenSize(),i+1))}else{const h=Zt(g),p=h!==null?h:g,y=p.getIndexWithinParent(),m=r.getElementByKey(g.getKey());let x="after";if(m!==null&&So(t)===g){const v=Vt(g,m,r);v.element!==m?x=v.resolveLeafPosition(m,t,e):e===0&&te(g)&&(x="before")}i=x==="before"?y:y+1,g=p.getParentOrThrow()}if(O(g))return[cn(g.__key,i,"element"),s]}}else o=So(t);return D(o)?[cn(o.__key,an(o,i,"clamp"),"text"),s]:null}function Ph(t,e,n){const r=t.offset,o=t.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(e){if((n||!e)&&i===null&&O(s)&&s.isInline()){const l=s.getPreviousSibling();D(l)&&t.set(l.__key,l.getTextContent().length,"text")}}else O(i)&&!n&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):D(i)&&!o.isUnmergeable()&&t.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(e&&O(i)&&i.isInline())t.set(i.__key,0,"element");else if((n||e)&&i===null&&O(s)&&s.isInline()&&!s.canInsertTextAfter()&&s.getTextContentSize()>1){const l=s.getNextSibling();D(l)&&t.set(l.__key,0,"text")}}}function v1(t,e,n){if(t.type==="text"&&e.type==="text"){const r=t.isBefore(e),o=t.is(e);Ph(t,r,o),Ph(e,!r,o),o&&e.set(t.key,t.offset,t.type)}}function tu(t){const e=Se(t.key);return e===null?null:da(e)}function C1(t,e,n){const r=tu(t),o=tu(e);if(r===o||r!==null&&o!==null&&r.is(o))return!1;const i=n(r,o);if(r!==null)return O(r)?e.set(r.getKey(),i?r.getChildrenSize():0,"element"):e.set(r.getKey(),i?r.getTextContentSize():0,"text"),!0;const s=Zt(o);if(s===null)return!1;const l=s.getParent();if(l===null)return!1;const a=s.getIndexWithinParent();return e.set(l.getKey(),i?a+1:a,"element"),!0}function b1(t){const e=C1(t.anchor,t.focus,(n,r)=>function(o,i,s,l){if(s!==null&&l!==null){const u=Zt(s),f=Zt(l);if(u!==null&&u.is(f)){for(const d of ha(u).values()){if(d===s.getKey())return!0;if(d===l.getKey())return!1}return!0}return u===null||f===null||u.isBefore(f)}if(s!==null){const u=Zt(s),f=Se(i.key);return u===null||f===null||!(!u.is(f)&&!u.isParentOf(f))||u.isBefore(f)}const a=Zt(l),c=Se(o.key);return a!==null&&c!==null&&!a.is(c)&&!a.isParentOf(c)&&c.isBefore(a)}(t.anchor,t.focus,n,r));return e&&(t.dirty=!0),e}function w1(t,e,n,r,o,i){if(t===null||n===null||!gs(o,t,n))return null;const s=Ah(t,e,$(i)?i.anchor:null,o);if(s===null)return null;const l=Ah(n,r,$(i)?i.focus:null,o);if(l===null)return null;const[a,c]=s,[u,f]=l;if(a.type==="element"&&u.type==="element"){const g=So(t),h=So(n);if(te(g)&&te(h))return null}const d=o._slotsUsed&&C1(a,u,()=>(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return v1(a,u),[a,u,c||f||d]}function Fr(t){return O(t)&&!t.isInline()}function S1(t,e,n,r,o,i){const s=Bn(),l=new Xr(cn(t,e,o),cn(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function aa(){const t=cn("root",0,"element"),e=cn("root",0,"element");return new Xr(t,e,0,"")}function Ki(){return new la(new Set)}function bf(t,e,n,r){const o=n._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",a=!Vc&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let c,u,f,d;if($(t)&&!a)return t.clone();{if(e===null)return null;const _=Ht(e,n._rootElement);if(c=_.anchorNode,u=_.focusNode,f=_.anchorOffset,d=_.focusOffset,(l||s===void 0)&&$(t)&&!gs(n,c,u))return t.clone()}const g=w1(c,f,u,d,n,t);if(g===null)return null;const[h,p,y]=g;let m=0,x="";if($(t)){const _=t.anchor;if(h.key===_.key)m=t.format,x=t.style;else{const S=h.getNode();D(S)?(m=S.getFormat(),x=S.getStyle()):O(S)&&(m=S.getTextFormat(),x=S.getTextStyle())}}const v=new Xr(h,p,m,x);return y&&(v.dirty=!0),v}function V(){return Bn()._selection}function Qr(){return he()._editorState._selection}function Er(t,e,n,r=1){const o=t.anchor,i=t.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const a=e.__key;if(t.isCollapsed()){const c=o.offset;if(n<=c&&r>0||n0||n0||n=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(n);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(O(i)){const l=i.getChildrenSize(),a=n>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(n);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(O(s)){const l=s.getChildrenSize(),a=o>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function kl(t,e,n,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,D(r)?(s=r.getTextContentSize(),l="text"):O(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,D(o)?l="text":O(o)&&(l="element")),i!==null&&l!==null?t.set(i,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function $h(t,e,n,r,o){t.type==="text"?t.set(n,t.offset+(e?0:o),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function Nl(t,e,n,r,o){try{t.setBaseAndExtent(e,n,r,o)}catch{}}function Ih(t,e,n){const r=zo(t,e.getKey());if(O(e)){const o=Vt(e,r,t);return[o.element,n+o.getFirstChildOffset()]}return[r,n]}function G_(t,e,n,r,o,i){const s=i.getRootNode(),l=no(s)||Rn(s)?Jo(s):null;if(o.has(c1)&&l!==i||l!==null&&Nf(l,l))return;const a=Ht(r,i);let c;if(!$(e))return void(t!==null&&gs(n,a.anchorNode,a.focusNode)&&r.removeAllRanges());const u=e.anchor,f=e.focus,d=u.getNode(),g=f.getNode(),[h,p]=Ih(n,d,u.offset),[y,m]=Ih(n,g,f.offset),x=e.format,v=e.style,_=e.isCollapsed();let S=h,E=y,b=!1;if(u.type==="text"?(S=D(d)?er(d,h,n):null,b=d.getFormat()!==x||d.getStyle()!==v):$(t)&&t.anchor.type==="text"&&(b=!0),f.type==="text"&&(E=D(g)?er(g,y,n):null),S!==null&&E!==null){if(_&&(t===null||b||$(t)&&(t.format!==x||t.style!==v))&&function(w,k,M,A,R,F){w._inputState.collapsedSelectionFormat={format:k,key:R,offset:A,style:M,timeStamp:F}}(n,x,v,p,u.key,performance.now()),(r.type!=="Range"||!_)&&a.anchorOffset===p&&a.focusOffset===m&&a.anchorNode===S&&a.focusNode===E){if(l===null||!i.contains(l)){const w=l!==null?Pr(l):null;w!==null&&w!==n||o.has(El)||i.focus({preventScroll:!0})}if(u.type!=="element")return}if(Nl(r,S,p,E,m),Ln&&e.isCollapsed()&&i!==null&&!o.has(El)){const w=Ui(i);if(w===null||!i.contains(w)){const k=Jo(i.ownerDocument),M=k!==null?Pr(k):null;M!==null&&M!==n||i.focus({preventScroll:!0})}}if(!o.has(D_)&&e.isCollapsed()&&i!==null&&i===Ui(i)){const w=$(e)&&e.anchor.type==="element"?S.childNodes[p]||null:(c===void 0&&(c=xv(r,i)),c);if(w!==null){let k;if(vt(w)){const M=w.ownerDocument.createRange();M.selectNode(w),k=M.getBoundingClientRect()}else k=w.getBoundingClientRect();(function(M,A,R){const F=Lf(R),H=$f(F);if(F===null||H===null)return;const W=R.getBoundingClientRect();if(A.bottomJ&&(xe=B-J),xe!==0)if(ie)H.scrollBy(0,xe);else{const de=X.scrollTop;X.scrollTop+=xe;const Ve=X.scrollTop-de;z-=Ve,B-=Ve}if(ie)break;X=dr(X)}})(n,k,i)}}(function(w){w._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function wf(t){let e=V()||Qr();e===null&&(e=Ce().selectEnd()),e.insertNodes(t)}function E1(t,e){for(const n of t.split(/(\r?\n|\t)/))n===` +`){if(rt(s))s.selectEnd();else if(!s){const l=Ne(o,Fr),a=l&&l.getNextSibling();O(a)&&a.selectStart()}}else n===" "?Dr(s)&&s.selectEnd():D(s)&&s.getTextContent()[0]===n&&s.select(1,1)}else o.getTextContent()[i]===n&&o.select(i+1,i+1)}function Wi(t){t.isInsertTextAfterHandledSelectionCommand=!1,t.handledSelectionCommandTimeoutId!==null&&(clearTimeout(t.handledSelectionCommandTimeoutId),t.handledSelectionCommandTimeoutId=null)}function xh(t){Wi(t),t.isInsertTextAfterHandledSelectionCommand=!0,t.handledSelectionCommandTimeoutId=setTimeout(()=>Wi(t),0)}function t1(t,e){const n=If(t);if(q(n)&&Rl(n,e))return!0;const r=e.getRootElement();if(r===null)return!1;const o=Jo(r.ownerDocument);return o!==null&&r.contains(o)&&Rl(o,e)}function O_(t){const e=t.inputType,n=e1(t),r=he(),o=r._inputState,i=V();if(e==="insertText"&&t.data&&o.isInsertTextAfterHandledSelectionCommand){if(Wi(o),t.preventDefault(),$(i)&&!i.isCollapsed()){const f=i.isBackward()?i.anchor:i.focus;i.anchor.set(f.key,f.offset,f.type),i.focus.set(f.key,f.offset,f.type)}return!0}if(e==="deleteContentBackward"){if(i===null){const f=Qr();if(!$(f))return!0;He(f.clone())}if($(i)){const f=i.anchor.key===i.focus.key;if(function(d,g){return d.lastKeyCode==="MediaLast"&&g{Pt(r,()=>{Ke(null)})},30),$(i)){const d=i.anchor.getNode();d.markDirty(),D(d)||I(142),Qm(i,d)}}else{if(Ke(null),rr&&n!==null&&!n.collapsed&&(i.applyDOMRange(n),!i.isCollapsed()))return t.preventDefault(),i.removeText(),!0;t.preventDefault();const d=i.anchor.getNode(),g=d.getTextContent(),h=d.canInsertTextAfter(),p=i.anchor.offset===0&&i.focus.offset===g.length;let y=yl&&f&&!p&&h;if(y&&i.isCollapsed()&&(y=!te(fv(i.anchor,!0))),!y){j(r,Or,!0);const m=V();yl&&$(m)&&m.isCollapsed()&&(o.postDeleteSelectionToRestore=m,setTimeout(()=>o.postDeleteSelectionToRestore=null))}}return!0}}if(!$(i))return!0;const s=t.data;o.unprocessedBeforeInputData!==null&&Of(!1,r,o.unprocessedBeforeInputData),i.dirty&&o.unprocessedBeforeInputData===null||!i.isCollapsed()||$e(i.anchor.getNode())||n===null||i.applyDOMRange(n),o.unprocessedBeforeInputData=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if(e==="insertText"||e==="insertTranspose"){if(s===` +`)t.preventDefault(),j(r,Ao,!1);else if(s===Tr)t.preventDefault(),j(r,Hi,void 0);else if(s==null&&t.dataTransfer){const f=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(f)}else s!=null&&Xm(i,n,s,t.timeStamp,!0)?(t.preventDefault(),j(r,Po,s),yh(s)):o.unprocessedBeforeInputData=s;return o.lastBeforeInputInsertTextTimeStamp=t.timeStamp,!0}switch(t.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":j(r,Po,t),yh((t.dataTransfer?t.dataTransfer.getData("text/plain"):null)??t.data);break;case"insertFromComposition":{const f=o.hadOrphanedCompositionEvents;o.hadOrphanedCompositionEvents=!1;const d=r._compositionKey;Ke(null),f||j(r,Po,t),el(d);break}case"insertLineBreak":Ke(null),j(r,Ao,!1);break;case"insertParagraph":Ke(null),o.isInsertLineBreak&&!rr?(o.isInsertLineBreak=!1,j(r,Ao,!1)):j(r,Hi,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":j(r,cf,t);break;case"deleteByComposition":(function(f,d){return f!==d||O(f)||O(d)||!Lr(f)||!Lr(d)})(c,u)&&j(r,Xs,t);break;case"deleteByDrag":In(El),j(r,Xs,t);break;case"deleteByCut":j(r,Xs,t);break;case"deleteContent":j(r,Or,!1);break;case"deleteWordBackward":j(r,Vi,!0);break;case"deleteWordForward":j(r,Vi,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":j(r,Bi,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":j(r,Bi,!1);break;case"formatStrikeThrough":j(r,Sn,"strikethrough");break;case"formatBold":j(r,Sn,"bold");break;case"formatItalic":j(r,Sn,"italic");break;case"formatUnderline":j(r,Sn,"underline");break;case"historyUndo":j(r,oa,void 0);break;case"historyRedo":j(r,ia,void 0)}return!0}function A_(t){const e=he(),n=e._inputState,r=V(),o=t.data,i=e1(t);let s=!1;if(o!=null&&$(r)){const l=ht(Ct(e)),a=l!==null?Ht(l,e._rootElement):null,c=t.inputType==="insertCompositionText"&&n.compositionPhase!=="ending-firefox"&&!e.isComposing();c&&(n.hadOrphanedCompositionEvents=!0);const u=r.anchor.getNode(),f=t.inputType==="insertCompositionText"&&n.compositionPhase!=="ending-firefox"&&e.isComposing()&&D(u)&&St(u);if(!c&&!f&&Xm(r,i,o,t.timeStamp,!1,a)){if(s=!0,n.compositionPhase==="ending-firefox"){const m=wl(e,o);if(n.compositionPhase="idle",m)return In(zi),zh(),!0}const d=r.anchor.getNode();if(l===null||a===null)return!0;const g=r.isBackward(),h=g?r.anchor.offset:r.focus.offset,p=g?r.focus.offset:r.anchor.offset;jo&&!r.isCollapsed()&&D(d)&&a.anchorNode!==null&&d.getTextContent().slice(0,h)+o+d.getTextContent().slice(h+p)===W1(a.anchorNode)||j(e,Po,o);const y=o.length;Ln&&y>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=y,r._cachedNodes=null,r._cachedIsBackward=null),yl&&e.isComposing()&&(n.lastKeyDownTimeStamp=0,Ke(null))}}return s||(Of(!1,e,o!==null?o:void 0),n.compositionPhase==="ending-firefox"&&(wl(e,o||void 0),In(zi),n.compositionPhase="idle")),zh(),!0}function P_(t){const e=he(),n=e._inputState,r=V();if($(r)&&!e.isComposing()){n.compositionPhase="composing",n.hadOrphanedCompositionEvents=!1;const o=r.anchor,i=r.anchor.getNode();if(Ke(o.key),In(u1),t.timeStamp{wl(e,n.compositionEndData)}),n.compositionPhase="idle",n.compositionEndData="",r)return!0}if(function(r){return _e(r,"ArrowRight",{shiftKey:"any"})}(t))j(e,jm,t);else if(function(r){return _e(r,"ArrowRight",{..._n,shiftKey:"any"})}(t))j(e,Wm,t);else if(function(r){return _e(r,"ArrowLeft",{shiftKey:"any"})}(t))j(e,ff,t);else if(function(r){return _e(r,"ArrowLeft",{..._n,shiftKey:"any"})}(t))j(e,zm,t);else if(function(r){return _e(r,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))j(e,df,t);else if(function(r){return _e(r,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))j(e,hf,t);else if(function(r){return _e(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))n.isInsertLineBreak=!0,j(e,ji,t);else if(function(r){return r.key===" "}(t))j(e,gf,t);else if(function(r){return Ut&&_e(r,"o",{ctrlKey:!0})}(t))t.preventDefault(),n.isInsertLineBreak=!0,j(e,Ao,!0);else if(function(r){return _e(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))n.isInsertLineBreak=!1,j(e,ji,t);else if(function(r){return _e(r,"Backspace",{shiftKey:"any"})||Ut&&_e(r,"h",{ctrlKey:!0})}(t))Jh(t)?j(e,pf,t)&&xh(n):(t.preventDefault(),j(e,Or,!0));else if(function(r){return r.key==="Escape"}(t))j(e,mf,t);else if(function(r){return _e(r,"Delete",{})||Ut&&_e(r,"d",{ctrlKey:!0})}(t))(function(r){return r.key==="Delete"})(t)?j(e,Km,t):(t.preventDefault(),j(e,Or,!1));else if(function(r){return _e(r,"Backspace",Kh)}(t))t.preventDefault(),j(e,Vi,!0);else if(function(r){return _e(r,"Delete",Kh)}(t))t.preventDefault(),j(e,Vi,!1);else if(function(r){return Ut&&_e(r,"Backspace",{metaKey:!0})}(t))t.preventDefault(),j(e,Bi,!0);else if(function(r){return Ut&&(_e(r,"Delete",{metaKey:!0})||_e(r,"k",{ctrlKey:!0}))}(t))t.preventDefault(),j(e,Bi,!1);else if(function(r){return _e(r,"b",_n)}(t))t.preventDefault(),j(e,Sn,"bold");else if(function(r){return _e(r,"u",_n)}(t))t.preventDefault(),j(e,Sn,"underline");else if(function(r){return _e(r,"i",_n)}(t))t.preventDefault(),j(e,Sn,"italic");else if(function(r){return _e(r,"Tab",{shiftKey:"any"})}(t))j(e,yf,t);else if(function(r){return _e(r,"z",_n)}(t))t.preventDefault(),j(e,oa,void 0);else if(function(r){return Ut?_e(r,"z",{metaKey:!0,shiftKey:!0}):_e(r,"y",{ctrlKey:!0})||_e(r,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),j(e,ia,void 0);else{const r=e._editorState._selection;(function(o){return _e(o,"a",_n)})(t)?(t.preventDefault(),j(e,qm,t)&&xh(n)):r===null||$(r)||(function(o){return _e(o,"c",_n)}(t)?(t.preventDefault(),j(e,sa,t)):function(o){return _e(o,"x",_n)}(t)&&(t.preventDefault(),j(e,xf,t)))}return function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey}(t)&&e.dispatchCommand(k_,t),!0}function n1(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}const Lo=new Map;function _h(t){const e=pv(t.target);if(e===null)return;const n=Lf(t.target);let r=null,o=null;const i=n!==null?bl.get(n):void 0;if(n!==null){if(i!==void 0){const f=i.editors;let d=i.hasShadowEditor;if(d===void 0){d=!1;for(const g of f)if(g._rootElement!==null&&Rn(g._rootElement.getRootNode())){d=!0;break}i.hasShadowEditor=d}if(d){let g=null,h=null;for(const p of f){const y=p._rootElement;if(y===null)continue;const m=Ht(e,y).anchorNode;if(m!==null&&Pr(m)===p){if(Rn(y.getRootNode())){r=p,o=m;break}g===null&&(g=p,h=m)}}r===null&&g!==null&&(r=g,o=h)}else{const g=e.anchorNode;g===null||q(g)&&g.shadowRoot!==null||(r=Pr(g),r!==null&&(o=g))}}if(r===null){const f=Jo(n);r=f!==null?Pr(f):null}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(i!==void 0)for(const f of i.editors)f._inputState.isSelectionChangeFromMouseDown=!1;Pt(r,()=>{const f=Qr(),d=o??Ht(e,r._rootElement).anchorNode;(q(d)||vt(d))&&He(bf(f,e,r,t))})}const s=Mf(r),l=s[s.length-1],a=l._key,c=Lo.get(a),u=c||l;u!==r&&mh(e,u,!1),mh(e,r,!0),r!==l?Lo.set(a,r):c&&Lo.delete(a)}function vh(t){t._lexicalHandled=!0}function Ch(t){return t._lexicalHandled===!0}function I_(t){const e=Yc.get(t);if(e===void 0)return;const n=bl.get(e);if(n===void 0)return;Yc.delete(t);const r=ei(t);ps(r)?(function(i){if(i._parentEditor!==null){const s=Mf(i),l=s[s.length-1]._key;Lo.get(l)===i&&Lo.delete(l)}else Lo.delete(i._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,t.__lexicalEditor=null):r&&I(198);const o=n1(t);for(let i=0;io.__key===this.__key);if(D(this))return r;if($(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;const o=this.getParent();if(te(this)&&this.isInline()&&o){const i=n.isBackward()?n.focus:n.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let n=e.getFirstChild(),r=0;for(;n!==null;){if(this.is(n))return r;r++,n=n.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Se(e)}getParentOrThrow(){const e=this.getParent();return e===null&&I(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const n=e.getParent();if(ve(n)||Qe(e)!==null)return O(e)||e===this&&te(e)||I(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&I(67,this.__key),e}getParents(){const e=[];let n=this.getParent();for(;n!==null;)e.push(n),n=n.getParent();return e}getParentKeys(){const e=[];let n=this.getParent();for(;n!==null;)e.push(n.__key),n=n.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Se(e)}getPreviousSiblings(){const e=[],n=this.getParent();if(n===null)return e;let r=n.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:Se(e)}getNextSiblings(){const e=[];let n=this.getNextSibling();for(;n!==null;)e.push(n),n=n.getNextSibling();return e}getCommonAncestor(e){const n=O(this)?this:this.getParent(),r=O(e)?e:e.getParent(),o=n&&r?lu(n,r):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const n=lu(this,e);return n!==null&&(n.type==="descendant"||(n.type==="branch"?i0(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&I(279),!1)))}isParentOf(e){return Ko(e,this)}getNodesBetween(e){const n=this.isBefore(e),r=[],o=new Set;let i=this;for(;i!==null;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=O(i)?n?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const a=n?i.getNextSibling():i.getPreviousSibling();if(a!==null){i=a;continue}const c=i.getParentOrThrow();if(o.has(c.__key)||r.push(c),c===e)break;let u=null,f=c;do{if(f===null&&I(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;u!==null||o.has(f.__key)||r.push(f)}while(u===null);i=u}return n||r.reverse(),r}isDirty(){const e=he()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Sl(this))return this;const e=Se(this.__key);return e===null&&I(113),e}getWritable(){if(Sl(this))return this;ze();const e=Bn(),n=he(),r=e._nodeMap,o=this.__key,i=this.getLatest(),s=n._cloneNotNeeded,l=V();if(l!==null&&l.setCachedNodes(null),s.has(o))return Ll(i),i;const a=q1(i);return s.add(o),Ll(a),r.set(o,a),a}getTextContent(){return t0(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){I(70)}updateDOM(e,n,r){I(71)}getDOMSlot(e){return new _m(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){I(18,this.name)}updateFromJSON(e){return function(n,r){const o=n.getWritable(),i=r.$;let s=i;for(const l of Mm(o).flatKeys)l in r&&(s!==void 0&&s!==i||(s={...i}),s[l]=r[l]);return(o.__state||s)&&Nm(n).updateFromJSON(s),o}(this,e)}static transform(){return null}remove(e){Xc(this,!0,e)}replace(e,n){ze();let r=V();r!==null&&(r=r.clone()),ac(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size,u=l.getParent(),f=u!==null?l.getIndexWithinParent():-1;En(l),u!==null&&$(r)&&Er(r,u,f,-1);const d=o.getPreviousSibling(),g=o.getNextSibling(),h=o.__prev,p=o.__next,y=o.__parent;Xc(o,!1,!0),d===null?a.__first=s:d.getWritable().__next=s,l.__prev=h,g===null?a.__last=s:g.getWritable().__prev=s,l.__next=p,l.__parent=y,a.__size=c;let m=0;n&&(O(this)&&O(l)||I(139),m=l.getChildrenSize(),l.splice(m,0,this.getChildren()));const x=Lt(this);if(x.length>0){kn(this)&&kn(l)||I(368,this.__key,l.__key);for(const v of x){const _=jr(this,v);_!==null&&(Lv(this,v),n0(l,v,_))}}if($(r)){He(r);const v=r.anchor,_=r.focus;v.key===i&&(n&&v.type==="element"?v.set(l.__key,m+v.offset,"element"):Th(v,l)),_.key===i&&(n&&_.type==="element"?_.set(l.__key,m+_.offset,"element"):Th(_,l))}return Tn()===i&&Ke(s),l}insertAfter(e,n=!0){ze(),ac(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.getParent(),s=V();let l=!1,a=!1;if(i!==null){const g=e.getIndexWithinParent();if($(s)){const h=i.__key,p=s.anchor,y=s.focus;l=p.type==="element"&&p.key===h&&p.offset===g+1,a=y.type==="element"&&y.key===h&&y.offset===g+1}En(o),n&&$(s)&&Er(s,i,g,-1)}else En(o);const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),f=o.__key,d=r.__next;if(c===null?u.__last=f:c.getWritable().__prev=f,u.__size++,r.__next=f,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,n&&$(s)){const g=this.getIndexWithinParent();Er(s,u,g+1);const h=u.__key;l&&s.anchor.set(h,g+2,"element"),a&&s.focus.set(h,g+2,"element")}return e}insertBefore(e,n=!0){ze(),ac(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.__key,s=V(),l=o.getParent(),a=l!==null?o.getIndexWithinParent():-1;En(o),l!==null&&n&&$(s)&&Er(s,l,a,-1);const c=this.getPreviousSibling(),u=this.getParentOrThrow().getWritable(),f=r.__prev,d=this.getIndexWithinParent();return c===null?u.__first=i:c.getWritable().__next=i,u.__size++,r.__prev=i,o.__prev=f,o.__next=r.__key,o.__parent=r.__parent,n&&$(s)&&Er(s,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return re()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,n){ze();const r=Zt(this);if(r!==null)return r.selectPrevious(e,n);const o=this.getPreviousSibling(),i=this.getParentOrThrow();if(o===null)return i.select(0,0);if(O(o))return o.select();if(!D(o)){const s=o.getIndexWithinParent()+1;return i.select(s,s)}return o.select(e,n)}selectNext(e,n){ze();const r=Zt(this);if(r!==null)return r.selectNext(e,n);const o=this.getNextSibling(),i=this.getParentOrThrow();if(o===null)return i.select();if(O(o))return o.select(0,0);if(!D(o)){const s=o.getIndexWithinParent();return i.select(s,s)}return o.select(e,n)}markDirty(){this.getWritable()}reconcileObservedMutation(e,n){this.markDirty()}}P(mt,"importDOM");function o1(t){return t instanceof mt}const Ar="historic",i1="history-push",Ti="history-merge",s1="paste",l1="cut",a1="collaboration",R_="skip-scroll-into-view",c1="skip-dom-selection",El="skip-selection-focus",u1="composition-start",zi="composition-end",D_="!important";function Tl(t){const e={};if(!t)return e;let n="",r="",o=null,i=!1,s=!1,l=!1,a=0;const c=t.length;let u=-1;for(let g=0;g=0&&r.slice(o).toLowerCase()===D_?t.setProperty(e,r.slice(0,o).trim(),"important"):t.setProperty(e,n,"")}function $o(t,e,n=""){if(e===n)return;const r=Tl(n),o=Tl(e);for(const i in o)delete r[i],F_(t,i,o[i]);for(const i in r)t.removeProperty(i)}function ec(t,e){return 16&e?"code":e&rf?"mark":32&e?"sub":64&e?"sup":null}function tc(t,e){return 1&e?"strong":2&e?"em":"span"}function f1(t,e,n,r,o){const i=r.classList;let s=Io(o,"base");s!==void 0&&i.add(...s),s=Io(o,"underlineStrikethrough");let l=!1;const a=8&e&&4&e;s!==void 0&&(8&n&&4&n?(l=!0,a||i.add(...s)):a&&i.remove(...s));for(const c in $n){const u=$n[c];if(s=Io(o,c),s!==void 0)if(n&u){if(l&&(c==="underline"||c==="strikethrough")){e&u&&i.remove(...s);continue}(!(e&u)||a&&c==="underline"||c==="strikethrough")&&i.add(...s)}else e&u&&i.remove(...s)}}function d1(t,e,n){const r=n.isComposing(),o=t+(r?$i:""),i=Me(),s=fa(i).$getDOMSlot(n,e,i),l=s.getFirstChild();if(l===null||l.nodeType!==Node.TEXT_NODE)return void s.insertChild(Te().createTextNode(o));const a=l,c=a.nodeValue;if(c!==o)if(r||Ln){const[u,f,d]=function(g,h){const p=g.length,y=h.length;let m=0,x=0;for(;m({conversion:j_,priority:0}),b:()=>({conversion:V_,priority:0}),code:()=>({conversion:xn,priority:0}),em:()=>({conversion:xn,priority:0}),i:()=>({conversion:xn,priority:0}),mark:()=>({conversion:xn,priority:0}),s:()=>({conversion:xn,priority:0}),span:()=>({conversion:H_,priority:0}),strong:()=>({conversion:xn,priority:0}),sub:()=>({conversion:xn,priority:0}),sup:()=>({conversion:xn,priority:0}),u:()=>({conversion:xn,priority:0})}}static importJSON(n){return Pe().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setTextContent(n.text).setFormat(n.format).setDetail(n.detail).setMode(n.mode).setStyle(n.style)}exportDOM(n){let{element:r}=super.exportDOM(n);return q(r)||I(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=Os(r,"b")),this.hasFormat("italic")&&(r=Os(r,"i")),this.hasFormat("strikethrough")&&(r=Os(r,"s")),this.hasFormat("underline")&&(r=Os(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(n,r){}setFormat(n){const r=this.getWritable();return r.__format=typeof n=="string"?$n[n]:n,r}setDetail(n){const r=this.getWritable();return r.__detail=typeof n=="string"?o_[n]:n,r}setStyle(n){const r=this.getWritable();return r.__style=n,r}toggleFormat(n){const r=Vr(this.getFormat(),n,null);return this.setFormat(r)}toggleDirectionless(){const n=this.getWritable();return n.__detail^=1,n}toggleUnmergeable(){const n=this.getWritable();return n.__detail^=2,n}setMode(n){const r=s_[n];if(this.__mode===r)return this;const o=this.getWritable();return o.__mode=r,o}setTextContent(n){if(this.__text===n)return this;const r=this.getWritable();return r.__text=n,r}select(n,r){ze();let o=n,i=r;const s=V(),l=this.getTextContent(),a=this.__key;if(typeof l=="string"){const c=l.length;o===void 0&&(o=c),i===void 0&&(i=c)}else o=0,i=0;if(!$(s))return w1(a,o,a,i,"text","text");{const c=Tn();c!==s.anchor.key&&c!==s.focus.key||Ke(a),s.setTextNodeRange(this,o,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const n=this.getTextContentSize();return this.select(n,n)}spliceText(n,r,o,i){const s=this.getWritable(),l=s.__text,a=o.length;let c=n;c<0&&(c=a+c,c<0&&(c=0));const u=V();if(i&&$(u)){const d=n+a;u.setTextNodeRange(s,d,s,d)}const f=l.slice(0,c)+o+l.slice(c+r);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...n){ze();const r=this.getLatest(),o=r.getTextContent();if(o==="")return[];const i=r.__key,s=Tn(),l=o.length;n.sort((k,M)=>k-M),n.push(l);const a=[],c=n.length;for(let k=0,M=0;kk&&(a.push(o.slice(k,A)),k=A)}const u=a.length;if(u===1)return[r];const f=a[0],d=r.getParent();let g;const h=r.getFormat(),p=r.getStyle(),y=r.__detail;let m=!1,x=null,v=null;const _=V();if($(_)){const[k,M]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];k.type==="text"&&k.key===i&&(x=k),M.type==="text"&&M.key===i&&(v=M)}r.isSegmented()?(g=Pe(f),g.__format=h,g.__style=p,g.__detail=y,g.__state=ih(r,g),m=!0):g=r.setTextContent(f);const S=[g];for(let k=1;k=w&&(x.set(k.getKey(),E-w,"text"),E=w){v.set(k.getKey(),b-w,"text");break}w=M}if(d!==null){(function(A){const R=A.getPreviousSibling(),F=A.getNextSibling();R!==null&&Ll(R),F!==null&&Ll(F)})(this);const k=d.getWritable(),M=this.getIndexWithinParent();m?(k.splice(M,0,S),this.remove()):k.splice(M,1,S),$(_)&&Er(_,d,M,u-1)}return S}mergeWithSibling(n){const r=n===this.getPreviousSibling();r||n===this.getNextSibling()||I(50);const o=this.__key,i=n.__key,s=this.__text,l=s.length;Tn()===i&&Ke(o);const a=V();if($(a)){const d=a.anchor,g=a.focus;d!==null&&d.key===i&&Lh(d,r,o,n,l),g!==null&&g.key===i&&Lh(g,r,o,n,l)}const c=n.__text,u=r?c+s:s+c;this.setTextContent(u);const f=this.getWritable();return n.remove(),f}isTextEntity(){return!1}}function H_(t){return{forChild:Cf(t.style),node:null}}function V_(t){const e=t,n=e.style.fontWeight==="normal";return{forChild:Cf(e.style,n?void 0:"bold"),node:null}}const Sh=new WeakMap;function B_(t){if(!q(t))return!1;if(t.nodeName==="PRE")return!0;const e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function j_(t){const e=t;t.parentElement===null&&I(129);let n=e.textContent||"";if(function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=Sh.get(i))===void 0&&!B_(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let a=0;a0){/[ \t\n]$/.test(i)&&(n=n.slice(1)),o=!1;break}}o&&(n=n.slice(1))}if(n[n.length-1]===" "){let r=e,o=!0;for(;r!==null&&(r=Eh(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Pe(n)}}function Eh(t,e){let n=t;for(;;){let r;for(;(r=e?n.nextSibling:n.previousSibling)===null;){const i=n.parentElement;if(i===null)return null;n=i}if(n=r,q(n)){const i=n.style.display;if(i===""&&!Il(n)||i!==""&&!i.startsWith("inline"))return null}let o=n;for(;(o=e?n.firstChild:n.lastChild)!==null;)n=o;if(vt(n))return n;if(n.nodeName==="BR")return null}}const W_={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function xn(t){const e=W_[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Cf(t.style,e),node:null}}function Pe(t=""){return kt(new Qt(t))}function D(t){return t instanceof Qt}function Cf(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),o=n==="700"||n==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),a=t.verticalAlign;return c=>((D(c)||Qc(c))&&(o&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),l&&!c.hasFormat("underline")&&c.toggleFormat("underline"),a!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),a!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}class Yr extends Qt{static getType(){return"tab"}static clone(e){return new Yr(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){const n=super.createDOM(e),r=Io(e.theme,"tab");return r!==void 0&&n.classList.add(...r),n}static importJSON(e){return fs().updateFromJSON(e)}setTextContent(e){return super.setTextContent(" ")}spliceText(e,n,r,o){return r===""&&n===0||r===" "&&n===1||I(286),this}setDetail(e){return e!==2&&I(127),this}setMode(e){return e!=="normal"&&I(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function fs(){return kt(new Yr)}function Dr(t){return t instanceof Yr}class z_{constructor(e,n,r){P(this,"key");P(this,"offset");P(this,"type");P(this,"_selection");this._selection=null,this.key=e,this.offset=n,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offseti&&(r=i)}else if(!O(e)){const i=e.getNextSibling();if(D(i))n=i.__key,r=0,o="text";else{const s=e.getParent();s&&(n=s.__key,r=e.getIndexWithinParent()+1)}}t.set(n,r,o)}function Th(t,e){if(O(e)){const n=e.getLastDescendant();O(n)||D(n)?nc(t,n):nc(t,e)}else nc(t,e)}class la{constructor(e){P(this,"_nodes");P(this,"_cachedNodes");P(this,"dirty");this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!be(e))return!1;const n=this._nodes,r=e._nodes;return n.size===r.size&&Array.from(n).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new la(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const n=this.getNodes().filter(s=>Qe(s)===null),r=n.length;if(r===0)return;const o=n[r-1];let i;if(D(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;sQe(n)===null);if((V()||Qr())===this&&e[0]){const n=fe(e[0],"next");Go(qt(n,n))}for(const n of e)n.remove();h1()}}function h1(){const t=Ce();if(t.isEmpty()){const e=re();t.append(e),e.select()}}function $(t){return t instanceof Xr}class Xr{constructor(e,n,r,o){P(this,"format");P(this,"style");P(this,"anchor");P(this,"focus");P(this,"_cachedNodes");P(this,"_cachedIsBackward");P(this,"dirty");this.anchor=e,this.focus=n,e._selection=this,n._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!$(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const n=function(r){const o=[],[i,s]=r.getTextSlices();i&&o.push(i.caret.origin);const l=new Set,a=new Set;for(const c of r)if(Et(c)){const{origin:u}=c;o.length===0?l.add(u):(a.add(u),o.push(u))}else{const{origin:u}=c;O(u)&&a.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),ir(r.focus)&&O(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let c=Tt(r.focus.origin,"previous");Et(c)&&l.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(o[o.length-1]);c=ga(c))l.delete(c.origin),o.pop();for(;o.length>1;){const c=o[o.length-1];if(!O(c)||a.has(c)||c.isEmpty()||l.has(c))break;o.pop()}if(o.length===0&&r.isCollapsed()){const c=pt(r.anchor),u=pt(r.anchor.getFlipped()),f=g=>$t(g)?g.origin:g.getNodeAtCaret(),d=f(c)||f(u)||(r.anchor.getNodeAtCaret()?c.origin:u.origin);o.push(d)}return o}(jf(au(this),"next"));return Wo()||(this._cachedNodes=n),n}setTextNodeRange(e,n,r,o){return this.anchor.set(e.__key,n,"text"),this.focus.set(r.__key,o,"text"),this}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const n=e[0],r=e[e.length-1],o=this.anchor,i=this.focus,s=o.isBefore(i),[l,a]=eu(this);let c="",u=!0;for(let f=0;f=0;w--){const k=_[w];if(k.is(d)||O(k)&&k.isParentOf(d))break;k.isAttached()&&(!S.has(k)||k.is(v)?E||b.insertAfter(k,!1):k.remove())}if(!E){let w=x,k=null;for(;w!==null;){const M=w.getChildren(),A=M.length;(A===0||M[A-1].is(k))&&(y.delete(w.__key),k=w),w=w.getParent()}}if(Lr(d))if(a===g)d.select();else{const w=Pe(e);w.select(),d.replace(w)}else d=d.spliceText(a,g-a,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length,this._cachedNodes=null,this._cachedIsBackward=null));for(let w=1;w(O(p)||te(p))&&!p.isInline())){O(o)||I(211,r.constructor.name,r.getType());const p=hi(this);return o.splice(p,0,e),void i.selectEnd()}if(O(o)&&Qe(o)!==null){const p=hi(this),y=nu(e);o.splice(p,0,y);const m=y[y.length-1];return void(m!==void 0?m.selectEnd():o.select(p,p))}if(o===null){const p=oc(e),y=p.getLastDescendant();let m=ut(this.anchor,"next");for(const x of p.getChildren())m=Wf(x,m);return void(y!==null&&y.selectEnd())}if(O(o)&&!o.isParentRequired()&&!ve(o.getParentOrThrow())){const p=hi(this),y=nu(e);o.splice(p,0,y);const m=y[y.length-1];return void(m!==void 0?m.selectEnd():o.select(p,p))}const s=oc(e),l=s.getLastDescendant(),a=s.getChildren(),c=!O(o)||!o.isEmpty()?this.insertParagraph():null;c&&!o.isAttached()&&(r=this.anchor.getNode(),o=Ne(r,Xe));const u=a[a.length-1];let f=a[0];var d;O(d=f)&&Xe(d)&&!d.isEmpty()&&O(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(O(o)||I(211,r.constructor.name,r.getType()),o.append(...f.getChildren()),f=a[1]),f&&(o===null&&I(212,r.constructor.name,r.getType()),function(p,y){const m=y.getParentOrThrow().getLastChild();let x=y;const v=[y];for(;x!==m;)x.getNextSibling()||I(140),x=x.getNextSibling(),v.push(x);let _=p;for(const S of v)_=_.insertAfter(S)}(o,f));const g=Ne(l,Xe);c&&O(g)&&(c.canMergeWhenEmpty()||Xe(u))&&(g.append(...c.getChildren()),c.remove()),O(o)&&o.isEmpty()&&o.remove(),l.selectEnd();const h=O(o)?o.getLastChild():null;rt(h)&&g!==o&&h.remove()}insertParagraph(){const e=this.anchor.getNode();if(this.anchor.type==="element"&&ve(e)){const l=re();return e.splice(this.anchor.offset,0,[l]),l.select(),l}const n=hi(this),r=Ne(this.anchor.getNode(),Xe);if(r!==null&&Qe(r)!==null)return null;O(r)||I(213);const o=r.getChildAtIndex(n),i=o?[o,...o.getNextSiblings()]:[],s=r.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const n=_t();if(this.insertNodes([n]),e){const r=n.getParentOrThrow(),o=n.getIndexWithinParent();r.select(o,o)}}extract(){const e=[...this.getNodes()],n=e.length;let r=e[0],o=e[n-1];const[i,s]=eu(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[s,i]:[i,s];if(n===0)return[];if(n===1){if(D(r)&&!this.isCollapsed()){const d=r.splitText(u,f),g=u===0?d[0]:d[1];return g?(a.set(g.getKey(),0,"text"),c.set(g.getKey(),g.getTextContentSize(),"text"),[g]):[]}return[r]}if(D(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,a.set(r.getKey(),0,"text"))),D(o)){const d=o.getTextContent().length;f===0?e.pop():f!==d&&([o]=o.splitText(f),e[e.length-1]=o,c.set(o.getKey(),o.getTextContentSize(),"text"))}return e}modify(e,n,r){if(Ml(this,e,n,r))return;const o=e==="move",i=he(),s=ht(Ct(i));if(!s)return;const l=i._blockCursorElement,a=i._rootElement,c=this.focus.getNode();a===null||l===null||!O(c)||c.isInline()||c.canBeEmpty()||$l(l,i,a);const u=zo(i,this.focus.key);let f=u;if(this.focus.type==="text"&&(f=D(c)?er(c,u,i):null),this.dirty){const d=zo(i,this.anchor.key);let g=d;if(this.anchor.type==="text"){const h=this.anchor.getNode();g=D(h)?er(h,d,i):null}g&&f&&Nl(s,g,this.anchor.offset,f,this.focus.offset)}if(r==="character"&&D(c)&&c.isUnmergeable()&&(n?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){const d=fe(c,n?"previous":"next").getNodeAtCaret();if(D(d)){if(!o){const g=d.getTextContentSize();return n?this.focus.set(d.__key,g-1,"text"):this.focus.set(d.__key,1,"text"),void(this.dirty=!0)}{const g=i.getElementByKey(d.getKey()),h=g?er(d,g,i):null;if(h){const p=n?h.length:0;Nl(s,h,p,h,p)}}}}if(y1(s,e,n?"backward":"forward",r),s.rangeCount>0){const d=ua(s,i._rootElement),g=d||s.getRangeAt(0),h=this.anchor.getNode(),p=$e(h)?h:K1(h);this.applyDOMRange(g),this.dirty=!0,!o&&(x1(this,n,p),(d?s.direction!=="backward":s.anchorNode===g.startContainer&&s.anchorOffset===g.startOffset)||m1(this))}r==="lineboundary"&&Ml(this,e,n,r,"decorators")}forwardDeletion(e,n,r){if(!r&&(e.type==="element"&&O(n)&&e.offset===n.getChildrenSize()||e.type==="text"&&e.offset===n.getTextContentSize())){const o=n.getParent(),i=n.getNextSibling()||(o===null?null:o.getNextSibling());if(O(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const n=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,e))return;const i=pa(ut(r,e?"previous":"next"));if(i.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of i.iterNodeCarets("shadowRoot"))if(Et(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(O(i.anchor.origin)&&i.anchor.origin.isEmpty()){const c=pt(a);ol(this,qt(c,c)),i.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(ir(a)){if(O(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(i.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(te(a.origin)){if(!a.origin.isIsolated())if(Lt(a.origin).length>0){if(O(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const c=Ki();c.add(a.origin.getKey()),He(c)}}else if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&O(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const c=Ki();c.add(a.origin.getKey()),He(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return Lt(c).length>0?void 0:a.origin.isEmpty()&&!c.isEmpty()&&a.origin.getParent()===c.getParent()?void a.origin.remove(!0):(ol(this,qt(!a.origin.isEmpty()&&c.isEmpty()?oo(fe(c,a.direction)):i.anchor,a)),this.removeText())}for(let a=r.getNode();a!==null;){if(Qe(a)!==null)return;if(O(a)&&a.isShadowRoot())break;a=a.getParent()}}const s=this.focus;if(rc(this,e,"character"),this.isCollapsed()){if(e&&r.offset===0&&Nh(this,r.getNode()))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=s.offset,c=l.getTextContentSize();if(l.is(o)||e&&a!==c||!e&&a!==0)return void Mh(l,e,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,c=o.getTextContentSize();if(o.is(l)||e&&a!==0||!e&&a!==c)return void Mh(o,e,a)}(function(a,c){const u=a.anchor,f=a.focus,d=u.getNode(),g=f.getNode();if(d===g&&u.type==="text"&&f.type==="text"){const h=u.offset,p=f.offset,y=h0&&(h===g.getTextContentSize()||St(g)||([g]=g.splitText(h)),g.setFormat(y));for(let m=c+1;m{for(const[o,i]of n)r=Vr(r,o,i?$n[o]:0);return r})}function p1(t,e,n=null){const r=n===null&&$(t)?Vr(t.format,e,null):n;g1(t,o=>Vr(o,e,r))}function kh(t){const e=t.offset;if(t.type==="text")return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function eu(t){const e=t.getStartEndPoints();if(e===null)return[0,0];const[n,r]=e;return n.type==="element"&&r.type==="element"&&n.key===r.key&&n.offset===r.offset?[0,0]:[kh(n),kh(r)]}function Nh(t,e){for(let n=e;n;n=n.getParent()){if(O(n)){if(n.collapseAtStart(t))return!0;if(ve(n))break}if(n.getPreviousSibling())break}return!1}function m1(t){const e=t.focus,n=t.anchor,r=n.key,o=n.offset,i=n.type;n.set(e.key,e.offset,e.type,!0),e.set(r,o,i,!0)}function y1(t,e,n,r){t.modify(e,n,r)}function x1(t,e,n){const r=t.getNodes(),o=r.filter(l=>Ko(l,n));if(o.length===0||o.length===r.length)return!1;const i=e?o[0]:o[o.length-1],s=O(i)?i:i.getParentOrThrow();return e?s.selectStart():s.selectEnd(),!0}function rc(t,e,n){if(Ml(t,"extend",e,n))return;const r=he(),o=ht(Ct(r));if(!o||typeof o.modify!="function")return;const i=r._blockCursorElement,s=r._rootElement,l=t.anchor,a=t.focus.getNode();s===null||i===null||!O(a)||a.isInline()||a.canBeEmpty()||$l(i,r,s);const c=k=>{const M=k.getNode(),A=r.getElementByKey(k.key);return A!==null&&k.type==="text"&&D(M)?er(M,A,r):A},u=l.getNode(),f=c(l);if(f===null)return;const d=l.offset,g=t.isCollapsed(),h=t.focus,p=g?f:c(h);if(p===null)return;const y=h.offset;if(Nl(o,p,y,p,y),y1(o,"move",e?"backward":"forward",n),o.rangeCount===0)return;const m=ua(o,s)||o.getRangeAt(0),x=m.startContainer,v=m.startOffset;if(g&&n==="character"&&l.type==="text"&&D(u)&&u.isUnmergeable()&&d===(e?0:u.getTextContentSize())){const k=fe(u,e?"previous":"next").getNodeAtCaret();if(D(k)){const M=e?k.getTextContentSize()-1:1;return t.focus.set(k.__key,M,"text"),void(t.dirty=!0)}}if(g&&n==="character"&&l.type==="text"){const k=e?0:u.getTextContentSize(),M=x===f?v:d!==k?k:-1;if(M>=0)return void(M!==d&&(t.focus.set(l.key,M,"text"),t.dirty=!0))}const[_,S,E,b]=e?[x,v,f,d]:[f,d,x,v],w=$e(u)?u:K1(u);t.applyDOMRange({collapsed:!1,endContainer:E,endOffset:b,startContainer:_,startOffset:S}),t.dirty=!0,!x1(t,e,w)&&e&&m1(t),n==="lineboundary"&&Ml(t,"extend",e,n,"decorators")}const J_=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function Mh(t,e,n){const r=t,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let c=0;cn||u){o.splice(c,1),u&&(l=void 0);break}}const a=o.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Oh(t,e,n,r){let o,i=e,s=!1;if(q(t)){let l=!1;const a=t.childNodes,c=a.length,u=r._blockCursorElement;i===c&&c>0&&(l=!0,i=c-1),ti(t,r)!==void 0||Rl(t,r)||(s=!0);let f=a[i],d=!1;if(f===u)f=a[i+1],d=!0;else if(u!==null){const g=u.parentNode;t===g&&e>Array.prototype.indexOf.call(g.children,u)&&i--}if(o=So(f),D(o))i=an(o,l?"next":"previous");else{let g=So(t);if(g===null)return null;if(O(g)){const h=r.getElementByKey(g.getKey());h===null&&I(214),[g,i]=Vt(g,h,r).resolveChildIndex(g,h,t,e),O(g)||I(215),l&&i>=g.getChildrenSize()&&(i=Math.max(0,g.getChildrenSize()-1));let y=g.getChildAtIndex(i);if(O(y)&&function(m,x,v){const _=m.getParent();return v===null||_===null||!_.canBeEmpty()||_!==v.getNode()}(y,0,n)){const m=l?y.getLastDescendant():y.getFirstDescendant();m===null?g=y:(y=m,g=O(y)?y:y.getParentOrThrow()),i=0}D(y)?(o=y,g=null,i=an(y,l?"next":"previous")):y!==g&&l&&!d&&(O(g)||I(216),i=Math.min(g.getChildrenSize(),i+1))}else{const h=Zt(g),p=h!==null?h:g,y=p.getIndexWithinParent(),m=r.getElementByKey(g.getKey());let x="after";if(m!==null&&So(t)===g){const v=Vt(g,m,r);v.element!==m?x=v.resolveLeafPosition(m,t,e):e===0&&te(g)&&(x="before")}i=x==="before"?y:y+1,g=p.getParentOrThrow()}if(O(g))return[cn(g.__key,i,"element"),s]}}else o=So(t);return D(o)?[cn(o.__key,an(o,i,"clamp"),"text"),s]:null}function Ah(t,e,n){const r=t.offset,o=t.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(e){if((n||!e)&&i===null&&O(s)&&s.isInline()){const l=s.getPreviousSibling();D(l)&&t.set(l.__key,l.getTextContent().length,"text")}}else O(i)&&!n&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):D(i)&&!o.isUnmergeable()&&t.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(e&&O(i)&&i.isInline())t.set(i.__key,0,"element");else if((n||e)&&i===null&&O(s)&&s.isInline()&&!s.canInsertTextAfter()&&s.getTextContentSize()>1){const l=s.getNextSibling();D(l)&&t.set(l.__key,0,"text")}}}function _1(t,e,n){if(t.type==="text"&&e.type==="text"){const r=t.isBefore(e),o=t.is(e);Ah(t,r,o),Ah(e,!r,o),o&&e.set(t.key,t.offset,t.type)}}function tu(t){const e=Se(t.key);return e===null?null:da(e)}function v1(t,e,n){const r=tu(t),o=tu(e);if(r===o||r!==null&&o!==null&&r.is(o))return!1;const i=n(r,o);if(r!==null)return O(r)?e.set(r.getKey(),i?r.getChildrenSize():0,"element"):e.set(r.getKey(),i?r.getTextContentSize():0,"text"),!0;const s=Zt(o);if(s===null)return!1;const l=s.getParent();if(l===null)return!1;const a=s.getIndexWithinParent();return e.set(l.getKey(),i?a+1:a,"element"),!0}function C1(t){const e=v1(t.anchor,t.focus,(n,r)=>function(o,i,s,l){if(s!==null&&l!==null){const u=Zt(s),f=Zt(l);if(u!==null&&u.is(f)){for(const d of ha(u).values()){if(d===s.getKey())return!0;if(d===l.getKey())return!1}return!0}return u===null||f===null||u.isBefore(f)}if(s!==null){const u=Zt(s),f=Se(i.key);return u===null||f===null||!(!u.is(f)&&!u.isParentOf(f))||u.isBefore(f)}const a=Zt(l),c=Se(o.key);return a!==null&&c!==null&&!a.is(c)&&!a.isParentOf(c)&&c.isBefore(a)}(t.anchor,t.focus,n,r));return e&&(t.dirty=!0),e}function b1(t,e,n,r,o,i){if(t===null||n===null||!gs(o,t,n))return null;const s=Oh(t,e,$(i)?i.anchor:null,o);if(s===null)return null;const l=Oh(n,r,$(i)?i.focus:null,o);if(l===null)return null;const[a,c]=s,[u,f]=l;if(a.type==="element"&&u.type==="element"){const g=So(t),h=So(n);if(te(g)&&te(h))return null}const d=o._slotsUsed&&v1(a,u,()=>(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return _1(a,u),[a,u,c||f||d]}function Fr(t){return O(t)&&!t.isInline()}function w1(t,e,n,r,o,i){const s=Bn(),l=new Xr(cn(t,e,o),cn(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function aa(){const t=cn("root",0,"element"),e=cn("root",0,"element");return new Xr(t,e,0,"")}function Ki(){return new la(new Set)}function bf(t,e,n,r){const o=n._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",a=!Vc&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let c,u,f,d;if($(t)&&!a)return t.clone();{if(e===null)return null;const _=Ht(e,n._rootElement);if(c=_.anchorNode,u=_.focusNode,f=_.anchorOffset,d=_.focusOffset,(l||s===void 0)&&$(t)&&!gs(n,c,u))return t.clone()}const g=b1(c,f,u,d,n,t);if(g===null)return null;const[h,p,y]=g;let m=0,x="";if($(t)){const _=t.anchor;if(h.key===_.key)m=t.format,x=t.style;else{const S=h.getNode();D(S)?(m=S.getFormat(),x=S.getStyle()):O(S)&&(m=S.getTextFormat(),x=S.getTextStyle())}}const v=new Xr(h,p,m,x);return y&&(v.dirty=!0),v}function V(){return Bn()._selection}function Qr(){return he()._editorState._selection}function Er(t,e,n,r=1){const o=t.anchor,i=t.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const a=e.__key;if(t.isCollapsed()){const c=o.offset;if(n<=c&&r>0||n0||n0||n=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(n);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(O(i)){const l=i.getChildrenSize(),a=n>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(n);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(O(s)){const l=s.getChildrenSize(),a=o>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(D(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function kl(t,e,n,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,D(r)?(s=r.getTextContentSize(),l="text"):O(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,D(o)?l="text":O(o)&&(l="element")),i!==null&&l!==null?t.set(i,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"))}function Lh(t,e,n,r,o){t.type==="text"?t.set(n,t.offset+(e?0:o),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function Nl(t,e,n,r,o){try{t.setBaseAndExtent(e,n,r,o)}catch{}}function $h(t,e,n){const r=zo(t,e.getKey());if(O(e)){const o=Vt(e,r,t);return[o.element,n+o.getFirstChildOffset()]}return[r,n]}function U_(t,e,n,r,o,i){const s=i.getRootNode(),l=no(s)||Rn(s)?Jo(s):null;if(o.has(a1)&&l!==i||l!==null&&Nf(l,l))return;const a=Ht(r,i);let c;if(!$(e))return void(t!==null&&gs(n,a.anchorNode,a.focusNode)&&r.removeAllRanges());const u=e.anchor,f=e.focus,d=u.getNode(),g=f.getNode(),[h,p]=$h(n,d,u.offset),[y,m]=$h(n,g,f.offset),x=e.format,v=e.style,_=e.isCollapsed();let S=h,E=y,b=!1;if(u.type==="text"?(S=D(d)?er(d,h,n):null,b=d.getFormat()!==x||d.getStyle()!==v):$(t)&&t.anchor.type==="text"&&(b=!0),f.type==="text"&&(E=D(g)?er(g,y,n):null),S!==null&&E!==null){if(_&&(t===null||b||$(t)&&(t.format!==x||t.style!==v))&&function(w,k,M,A,R,F){w._inputState.collapsedSelectionFormat={format:k,key:R,offset:A,style:M,timeStamp:F}}(n,x,v,p,u.key,performance.now()),(r.type!=="Range"||!_)&&a.anchorOffset===p&&a.focusOffset===m&&a.anchorNode===S&&a.focusNode===E){if(l===null||!i.contains(l)){const w=l!==null?Pr(l):null;w!==null&&w!==n||o.has(El)||i.focus({preventScroll:!0})}if(u.type!=="element")return}if(Nl(r,S,p,E,m),Ln&&e.isCollapsed()&&i!==null&&!o.has(El)){const w=Ui(i);if(w===null||!i.contains(w)){const k=Jo(i.ownerDocument),M=k!==null?Pr(k):null;M!==null&&M!==n||i.focus({preventScroll:!0})}}if(!o.has(R_)&&e.isCollapsed()&&i!==null&&i===Ui(i)){const w=$(e)&&e.anchor.type==="element"?S.childNodes[p]||null:(c===void 0&&(c=yv(r,i)),c);if(w!==null){let k;if(vt(w)){const M=w.ownerDocument.createRange();M.selectNode(w),k=M.getBoundingClientRect()}else k=w.getBoundingClientRect();(function(M,A,R){const F=Lf(R),H=$f(F);if(F===null||H===null)return;const W=R.getBoundingClientRect();if(A.bottomJ&&(xe=B-J),xe!==0)if(ie)H.scrollBy(0,xe);else{const de=X.scrollTop;X.scrollTop+=xe;const Ve=X.scrollTop-de;z-=Ve,B-=Ve}if(ie)break;X=dr(X)}})(n,k,i)}}(function(w){w._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function wf(t){let e=V()||Qr();e===null&&(e=Ce().selectEnd()),e.insertNodes(t)}function S1(t,e){for(const n of t.split(/(\r?\n|\t)/))n===` `||n===`\r -`?e.linebreak():n===" "?e.tab():n!==""&&e.text(n)}function Ji(t){const e=[];return E1(t,{linebreak:()=>e.push(_t()),tab:()=>e.push(fs()),text:n=>e.push(Pe(n))}),e}function nu(t){const e=[];for(const n of t)rt(n)||(!O(n)&&!te(n)||n.isInline()?e.push(n):O(n)&&e.push(...nu(n.getChildren())));return e}function hi(t){let e=t;t.isCollapsed()||e.removeText();const n=V();$(n)&&(e=n),$(e)||I(161);const r=e.anchor;let o=r.getNode(),i=r.offset;for(;!Xe(o)&&Qe(o)===null;){const s=o;if([o,i]=Z_(o,i),s.is(o))break}return i}function Z_(t,e){const n=t.getParent();if(!n){const o=re();return Ce().append(o),o.select(),[Ce(),0]}if(D(t)){const o=t.splitText(e);if(o.length===0)return[n,t.getIndexWithinParent()];const i=e===0?0:1;return[n,o[0].getIndexWithinParent()+i]}if(!O(t)||e===0)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const o=new Xr(cn(t.__key,e,"element"),cn(t.__key,e,"element"),0,""),i=t.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Rh(t){return rt(t)||gv(t)||D(t)||t.isParentRequired()}function oc(t){const e=re();let n=null;for(let r=0;r99&&I(14)}function Bn(){return Je===null&&I(195,k1()),Je}function q_(t){Bn()!==null&&Fe===null&&(Fe=t),Fe!==t&&ym(378)}function he(){return Fe===null&&I(337,k1()),Fe}function Y_(){he()._dirtyType=2}function k1(){let t=0;const e=new Set,n=Hr.version;if(typeof window<"u")for(const o of G1(document)){const i=ei(o);if(ps(i))t++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function N1(){return Fe}function Fh(t,e,n){const r=e.__type,o=R1(t,r);let i=n.get(r);i===void 0&&(i=Array.from(o.transforms),n.set(r,i));const s=i.length;for(let l=0;l0&&Bh(r,r._deferred));const a=r._editorState,c=a._selection,u=i._selection,f=r._dirtyType!==0,d=Je,g=yt,h=Fe,p=r._updating,y=r._observer;let m=null;if(r._pendingEditorState=null,r._editorState=i,!l&&f&&y!==null){Fe=r,Je=i,yt=!1,r._updating=!0;try{const w=r._dirtyType,k=r._dirtyElements,M=r._dirtyLeaves;y.disconnect(),m=C_(a,i,r,w,k,M)}catch(w){if(w instanceof Error&&r._onError(w),ic)throw w;return $1(r,null,s,i),km(r),r._dirtyType=2,ic=!0,qn(r,a),void(ic=!1)}finally{y.observe(s,Dh),r._updating=p,Je=d,yt=g,Fe=h}}i._readOnly||(i._readOnly=!0);const x=r._dirtyLeaves,v=r._dirtyElements,_=r._normalizedNodes,S=r._updateTags;f&&(r._dirtyType=0,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set),r._updateTags=new Set,function(w,k){const M=w._decorators;let A=w._pendingDecorators||M;const R=k._nodeMap;let F;for(F in A)R.has(F)||(A===M&&(A=B1(w)),delete A[F])}(r,i);const E=l?null:ht(Ct(r));if(r._editable&&E!==null&&(f||u===null||u.dirty||!u.is(c))&&s!==null&&!S.has(u1)){Fe=r,Je=i;try{if(y!==null&&y.disconnect(),f||u===null||u.dirty){const w=r._blockCursorElement;w!==null&&$l(w,r,s),G_(c,u,r,E,S,s)}(function(w,k,M){let A=w._blockCursorElement;if($(M)&&M.isCollapsed()&&M.anchor.type==="element"&&k.contains(Ui(k))){const R=M.anchor,F=R.getNode(),H=R.offset;let W=!1,z=null;if(H===F.getChildrenSize())rl(F.getChildAtIndex(H-1))&&(W=!0);else{const B=F.getChildAtIndex(H);if(B!==null&&rl(B)){const K=B.getPreviousSibling();(K===null||rl(K))&&(W=!0,z=w.getElementByKey(B.__key))}}if(W){const B=Vt(F,w.getElementByKey(F.__key),w).element;return A===null&&(w._blockCursorElement=A=function(K){const J=K.theme,X=Te().createElement("div");X.contentEditable="false",X.setAttribute("data-lexical-cursor","true");let ie=J.blockCursor;if(ie!==void 0){if(typeof ie=="string"){const xe=Nn(ie);ie=J.blockCursor=xe}ie!==void 0&&X.classList.add(...ie)}return X}(w._config)),k.style.caretColor="transparent",void(z===null?B.appendChild(A):B.insertBefore(A,z))}}A!==null&&$l(A,w,k)})(r,s,u)}finally{y!==null&&y.observe(s,Dh),Fe=h,Je=d}}m!==null&&function(w,k,M,A,R){const F=Array.from(w._listeners.mutation),H=F.length;for(let W=0;W{sc.delete(A),A._cascadeCount=0},0))}(w),w._cascadeCount++>99)return w._updates=[],w._cascadeCount=0,void w._onWarn(new Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${w._config.namespace}`));const M=k.shift();if(M){const[A,R]=M;ca(w,A,R)}}(r)})(t,e)}finally{tl=n}}function ki(t,e,n,...r){const o=e._updating;e._updating=n;try{const i=e._listeners[t],s=Array.from(i);for(const[l,a]of s){a&&a();const c=l(...r);i.has(l)?i.set(l,c):c&&c()}}finally{e._updating=o}}function O1(t,e,n,r){const o=Mf(t);let i;if(!tl)for(let s=0;s=0;s--)for(let l=0;l0&&a._updating){i=a;break}const c=a._commands.get(e);if(c!==void 0){const u=c[s];if(u.size>0){let f=!1;if(Pt(a,()=>{for(const d of u)if(d(n,r))return void(f=!0)}),f)return f}}}return i&&i.update(()=>{O1(i,e,n,r)}),!1}function Bh(t,e){if(t._deferred=[],e.length!==0){const n=t._updating;t._updating=!0;try{for(let r=0;r0||R>0;){if(M>0){v._dirtyLeaves=new Set;for(const F of k){const H=E.get(F);D(H)&&H.isAttached()&&H.isSimpleText()&&!H.isUnmergeable()&&ch(H),H!==void 0&&Hh(H,b)&&Fh(v,H,w),_.add(F)}if(k=v._dirtyLeaves,M=k.size,M>0){nl++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(const F of A){const H=F[0],W=F[1];if(S.set(H,W),!W)continue;const z=E.get(H);z!==void 0&&Hh(z,b)&&Fh(v,z,w)}k=v._dirtyLeaves,M=k.size,A=v._dirtyElements,R=A.size,nl++}v._dirtyLeaves=_,v._dirtyElements=S}(a,t),jh(t),function(x,v,_,S){const E=x._nodeMap,b=v._nodeMap,w=[];for(const[A]of S){const R=b.get(A);R!==void 0&&(R.isAttached()||(O(R)&&_l(R,A,E,b,w,S),E.has(A)||S.delete(A),w.push(A)))}for(const A of _){const R=b.get(A);R===void 0||R.isAttached()||(kn(R)&&R.__slots!==null&&_l(R,A,E,b,w,_),E.has(A)||_.delete(A),w.push(A))}for(const A of w)b.delete(A);const k=he(),M=k._compositionKey;M===null||b.has(M)||(k._compositionKey=null)}(l,a,t._dirtyLeaves,t._dirtyElements)),y!==t._compositionKey&&(a._flushSync=!0);const m=a._selection;if($(m)){t._slotsUsed&&b1(m);const x=a._nodeMap,v=m.anchor.key,_=m.focus.key;x.get(v)!==void 0&&x.get(_)!==void 0||I(19)}else be(m)&&m._nodes.size===0&&(a._selection=null)}catch(y){return y instanceof Error&&t._onError(y),t._pendingEditorState=l,t._dirtyType=2,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void qn(t)}finally{Je=u,yt=f,Fe=d,t._updating=g,nl=0}t._dirtyType!==0||t._deferred.length>0||function(y,m){const x=m.getEditorState()._selection,v=y._selection;if(v!==null){if(v.dirty||!v.is(x))return!0}else if(x!==null)return!0;return!1}(a,t)?a._flushSync?(a._flushSync=!1,qn(t)):c&&av(()=>{qn(t)}):(a._flushSync=!1,c&&(r.clear(),t._deferred=[],t._pendingEditorState=null))}function Pt(t,e,n){Fe===t&&n===void 0?e():ca(t,e,n)}function Q_(t){if(ve(t)){let e=null;for(const n of t.getChildren())e=n.isInline()?(e||n.replace(n.createParentElementNode())).append(n):null}}class ft extends mt{constructor(n){super(n);P(this,"__first");P(this,"__last");P(this,"__size");P(this,"__format");P(this,"__style");P(this,"__indent");P(this,"__dir");P(this,"__textFormat");P(this,"__textStyle");P(this,"__slotHost");P(this,"__slots");this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="",this.__slotHost=null,this.__slots=null}$config(){return this.config(Symbol.for("ElementNode"),{$transform:Q_,extends:mt})}afterCloneFrom(n){super.afterCloneFrom(n),this.__key===n.__key&&(this.__first=n.__first,this.__last=n.__last,this.__size=n.__size,this.__slotHost=n.__slotHost,this.__slotHost!==null&&this.__parent!==null&&I(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=n.__slots),this.__indent=n.__indent,this.__format=n.__format,this.__style=n.__style,this.__dir=n.__dir,this.__textFormat=n.__textFormat,this.__textStyle=n.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const n=this.getFormat();return s_[n]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const n=[];let r=this.getFirstChild();for(;r!==null;)n.push(r),r=r.getNextSibling();return n}getChildrenKeys(){const n=[];let r=this.getFirstChild();for(;r!==null;)n.push(r.__key),r=r.getNextSibling();return n}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&Lt(this).length===0}isDirty(){const n=he()._dirtyElements;return n!==null&&n.has(this.__key)}isLastChild(){const n=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(n)}getAllTextNodes(){const n=[];for(const o of Lt(this)){const i=jr(this,o);O(i)&&n.push(...i.getAllTextNodes())}let r=this.getFirstChild();for(;r!==null;){if(D(r)&&n.push(r),O(r)){const o=r.getAllTextNodes();n.push(...o)}r=r.getNextSibling()}return n}getFirstDescendant(){let n=this.getFirstChild();for(;O(n);){const r=n.getFirstChild();if(r===null)break;n=r}return n}getLastDescendant(){let n=this.getLastChild();for(;O(n);){const r=n.getLastChild();if(r===null)break;n=r}return n}getDescendantByIndex(n){const r=this.getChildren(),o=r.length;if(n>=o){const s=r[o-1];return O(s)&&s.getLastDescendant()||s||null}const i=r[n];return O(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const n=this.getLatest().__first;return n===null?null:Se(n)}getFirstChildOrThrow(){const n=this.getFirstChild();return n===null&&I(45,this.__key),n}getLastChild(){const n=this.getLatest().__last;return n===null?null:Se(n)}getLastChildOrThrow(){const n=this.getLastChild();return n===null&&I(96,this.__key),n}getChildAtIndex(n){const r=this.getChildrenSize();let o,i;if(n=n;){if(i===n)return o;o=o.getPreviousSibling(),i--}return null}getTextContent(){let n=n0(this);const r=this.getChildren(),o=r.length;for(let i=0;ir.remove()),n}append(...n){return this.splice(this.getChildrenSize(),0,n)}setDirection(n){const r=this.getWritable();return r.__dir=n,r}setFormat(n){return this.getWritable().__format=n!==""&&xl[n]||0,this}setStyle(n){return this.getWritable().__style=n||"",this}setTextFormat(n){const r=this.getWritable();return r.__textFormat=n,r}setTextStyle(n){const r=this.getWritable();return r.__textStyle=n,r}setIndent(n){return this.getWritable().__indent=n,this}splice(n,r,o){Sl(this)&&I(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();n+r<=i||I(226,String(n),String(r),String(i));for(const h of o);const l=s.__key,a=[],c=[],u=this.getChildAtIndex(n+r);let f=null,d=i-r+o.length;if(n!==0)if(n===i)f=this.getLastChild();else{const h=this.getChildAtIndex(n);h!==null&&(f=h.getPreviousSibling())}if(r>0){let h=f===null?this.getFirstChild():f.getNextSibling();for(let p=0;p0&&(r.style.paddingInlineStart=40*o+"px",r.setAttribute("data-lexical-indent",String(o)));const i=this.getDirection();i&&(r.dir=i)}return{element:r}}exportJSON(){const n={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),o=this.getTextStyle();return r===0&&o===""||ve(this)||this.getChildren().some(D)||(r!==0&&(n.textFormat=r),o!==""&&(n.textStyle=o)),n}updateFromJSON(n){return super.updateFromJSON(n).setFormat(n.format).setIndent(n.indent).setDirection(n.direction).setTextFormat(n.textFormat||0).setTextStyle(n.textStyle||"")}insertNewAfter(n,r){return null}canIndent(){return!0}collapseAtStart(n){return!1}excludeFromCopy(n){return!1}canReplaceWith(n){return!0}canInsertAfter(n){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(n){return!1}extractWithChild(n,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(n,r){const o=Vt(this,n,r);let i=o.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const l=r.getElementByKey(s.getKey());l!==null&&(i==null?(o.insertChild(l),i=l):i!==l&&o.replaceChild(l,i),i=i.nextSibling)}}}function O(t){return t instanceof ft}function Wh(t,e,n){let r=t.getNode();for(;r;){const o=r.__key;if(e.has(o)&&!n.has(o))return!0;r=r.getParent()}return!1}class ds extends mt{constructor(n){super(n);P(this,"__slotHost");P(this,"__slots");this.__slotHost=null,this.__slots=null}afterCloneFrom(n){super.afterCloneFrom(n),this.__key===n.__key&&(this.__slotHost=n.__slotHost,this.__slotHost!==null&&this.__parent!==null&&I(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=n.__slots)}decorate(n,r){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function te(t){return t instanceof ds}class eo extends ft{constructor(){super("root");P(this,"__cachedText");this.__cachedText=null}static getType(){return"root"}static clone(){return new eo}getTopLevelElementOrThrow(){I(51)}getTextContent(){const n=this.__cachedText;return n===null||!Wo()&&he()._dirtyType!==0?super.getTextContent():n}remove(){I(52)}replace(n){I(53)}insertBefore(n){I(54)}insertAfter(n){I(55)}updateDOM(n,r){return!1}splice(n,r,o){for(const i of o)O(i)||te(i)||I(282);return super.splice(n,r,o)}static importJSON(n){return Ce().updateFromJSON(n)}collapseAtStart(){return!0}}function $e(t){return t instanceof eo}function A1(t){return new hs(wm(t._nodeMap),null,t._slotsUsed)}function Sf(){return new hs(new Map([["root",new eo]]),null,!1)}function ru(t){const e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&I(130,n.name),O(t)){const o=e.children;Array.isArray(o)||I(59,n.name);const i=t.getChildren();for(let s=0;s0){const o={};for(const i of r){const s=jr(t,i);s===null&&I(366,n.name,i),o[i]=ru(s)}e.$slots=o}return e}function ev(t){return t instanceof hs}class hs{constructor(e,n=null,r=!1){P(this,"_nodeMap");P(this,"_selection");P(this,"_flushSync");P(this,"_readOnly");P(this,"_parsed");P(this,"_slotsUsed");this._nodeMap=e,this._selection=n||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=r}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,n){return Vh(n&&n.editor||null,this,e)}clone(e){const n=new hs(this._nodeMap,e===void 0?this._selection:e,this._slotsUsed);return n._readOnly=!0,n}toJSON(){return Vh(null,this,()=>({root:ru(Ce())}))}}class Ef extends ft{static getType(){return"artificial"}createDOM(e){return Te().createElement("div")}}class to extends mt{static getType(){return"linebreak"}static clone(e){return new to(e.__key)}constructor(e){super(e)}getTextContent(){return` -`}createDOM(){return Te().createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>P1(e)||L1(e)?null:{conversion:tv,priority:0}}}static importJSON(e){return _t().updateFromJSON(e)}}function tv(t){return{node:_t()}}function _t(){return kt(new to)}function rt(t){return t instanceof to}function P1(t){const e=t.parentElement;if(e!==null&&Uo(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Al(n)){const r=e.lastChild;if(r===t||r.previousSibling===t&&Al(r))return!0}}return!1}function L1(t){const e=t.parentElement;if(e!==null&&Uo(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Al(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&Al(r))return!0}return!1}function Al(t){return vt(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}class fr extends ft{static getType(){return"paragraph"}static clone(e){return new fr(e.__key)}createDOM(e){const n=Te().createElement("p"),r=Io(e.theme,"paragraph");return r!==void 0&&n.classList.add(...r),n}updateDOM(e,n,r){return!1}static importDOM(){return{p:e=>({conversion:nv,priority:0})}}exportDOM(e){const{element:n}=super.exportDOM(e);if(q(n)){this.isEmpty()&&n.append(Te().createElement("br"));const r=this.getFormatType();r&&(n.style.textAlign=r)}return{element:n}}static importJSON(e){return re().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const n=this.getChildren().find(D);n?(e.textFormat=n.getFormat(),e.textStyle=n.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,n){const r=re();r.setTextFormat(e.format),r.setTextStyle(e.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,n),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||D(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function nv(t){const e=re();if(gn(e,t),ro(t,e),e.getFormatType()===""){const n=t.getAttribute("align");n&&n&&n in xl&&e.setFormat(n)}return Wt(e,t),{node:e}}function re(){return kt(new fr)}function Qo(t){return t instanceof fr}function rv(t){console.warn(t)}const ee=0,st=1,or=4,ov=-8;function $1(t,e,n,r,o){const i=t._keyToDOMMap;i.clear(),t._editorState=Sf(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(t._updateTags=new Set,t._updates=[],t._cascadeCount=0),t._blockCursorElement=null,t._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(t._inputState.handledSelectionCommandTimeoutId),t._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};const s=t._observer;s!==null&&(s.disconnect(),t._observer=null),e!==null&&(e.textContent="",function(l,a){const c=`__lexicalKey_${a._key}`;delete l[c]}(e,t)),n!==null&&(n.textContent="",i.set("root",n),V1(n,t,"root"))}function iv(t){const e=new Set,n=new Set;for(const{klass:r,ownNodeConfig:o}of Df(t)){const i=r.transform;if(!n.has(i)){n.add(i);const s=r.transform();s&&e.add(s)}if(o){const s=o.$transform;s&&e.add(s)}}return e}const Pl={$createDOM:(t,e)=>t.createDOM(e._config,e),$decorateDOM:(t,e,n,r)=>{},$exportDOM:(t,e)=>{const n=kf(e,t.getType());return n&&n.exportDOM!==void 0?n.exportDOM(e,t):t.exportDOM(e)},$extractWithChild:(t,e,n,r,o)=>O(t)&&t.extractWithChild(e,n,r),$getDOMSlot:(t,e,n)=>t.getDOMSlot(e),$getSlotTargetElement:(t,e,n,r)=>null,$shouldExclude:(t,e,n)=>O(t)&&t.excludeFromCopy("html"),$shouldInclude:(t,e,n)=>!e||t.isSelected(e),$updateDOM:(t,e,n,r)=>t.updateDOM(e,n,r._config)};function I1(t){const e=t||{},n=N1(),r=e.theme||{},o=t===void 0?n:e.parentEditor||null,i=e.disableEvents||!1,s=Sf(),l=e.namespace||(o!==null?o._config.namespace:W1()),a=e.editorState,c=[eo,Qt,to,Yr,fr,Ef,...e.nodes||[]],{onError:u,onWarn:f,html:d}=e,g=e.editable===void 0||e.editable;let h;if(t===void 0&&n!==null)h=n._nodes;else{h=new Map;for(let y=0;y{Object.keys(S).forEach(E=>{let b=x.get(E);b===void 0&&(b=[],x.set(E,b)),b.push(S[E])})};return y.forEach(S=>{const E=S.klass.importDOM;if(E==null||v.has(E))return;v.add(E);const b=E.call(S.klass);b!==null&&_(b)}),m&&_(m),x}(h,d?d.import:void 0),g,t);return a!==void 0&&(p._pendingEditorState=a,p._dirtyType=2),function(y){y.registerCommand(Hm,A_,ee),y.registerCommand(Vm,P_,ee),y.registerCommand(Bm,L_,ee),y.registerCommand(jm,$_,ee),y.registerCommand(uf,I_,ee)}(p),p}function sv(t,e){const n=t.get(e);t.delete(e),n&&n()}function gi(t,e,n){return t.set(e,n),sv.bind(null,t,e)}class Hr{constructor(e,n,r,o,i,s,l,a,c){P(this,"_headless");P(this,"_parentEditor");P(this,"_rootElement");P(this,"_editorState");P(this,"_pendingEditorState");P(this,"_compositionKey");P(this,"_deferred");P(this,"_keyToDOMMap");P(this,"_updates");P(this,"_updating");P(this,"_cascadeCount");P(this,"_listeners");P(this,"_commands");P(this,"_nodes");P(this,"_decorators");P(this,"_pendingDecorators");P(this,"_config");P(this,"_dirtyType");P(this,"_cloneNotNeeded");P(this,"_dirtyLeaves");P(this,"_dirtyElements");P(this,"_normalizedNodes");P(this,"_updateTags");P(this,"_observer");P(this,"_key");P(this,"_onError");P(this,"_onWarn");P(this,"_htmlConversions");P(this,"_window");P(this,"_editable");P(this,"_blockCursorElement");P(this,"_slotsUsed");P(this,"_inputState");P(this,"_createEditorArgs");this._createEditorArgs=c,this._parentEditor=n,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Hc,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=W1(),this._onError=i,this._onWarn=s,this._htmlConversions=l,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return gi(this._listeners.update,e)}registerEditableListener(e){return gi(this._listeners.editable,e)}registerDecoratorListener(e){return gi(this._listeners.decorator,e)}registerTextContentListener(e){return gi(this._listeners.textcontent,e)}registerRootListener(e){const n=this._listeners.root;return tt(gi(n,e,e(this._rootElement,null)||void 0),()=>function(r,o,i){const s=r.get(o);s&&s(),r.set(o,o(...i)||void 0)}(n,e,[null,this._rootElement]))}registerCommand(e,n,r){r===void 0&&I(35);const o=this._commands;o.has(e)||o.set(e,[new di,new di,new di,new di,new di]);const i=o.get(e);i===void 0&&I(36,String(e));const s=function(a){return 7&a}(r),l=i[s];return s!==r?l.addFront(n):l.addBack(n),()=>{l.delete(n),i.every(a=>a.size===0)&&o.delete(e)}}registerMutationListener(e,n,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(n,o),()=>{s.delete(o),s.size===0&&i.delete(n)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return n===void 0&&I(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,n){const r=this._editorState,o=qh(r).get(n.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,n){const r=this.getRegisteredNode(e);return r.transforms.add(n),r}registerNodeTransform(e,n){const r=this.registerNodeTransformToKlass(e,n),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,n);o.push(s)}return function(s,l){const a=qh(s.getEditorState()),c=[];for(const u of l){const f=a.get(u);f&&c.push(f)}c.length!==0&&s.update(()=>{for(const u of c)for(const f of u.keys()){const d=Se(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:Ti}:void 0)}(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(n))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,n){return j(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const n=this._rootElement;if(e!==n){const r=Io(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,$1(this,n,e,o,{preserveUpdateQueue:!0}),n!==null&&(this._config.disableEvents||R_(n),r!=null&&n.classList.remove(...r)),e!==null){const i=$f(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,km(this),this._updateTags.add(Ti),qn(this),this._config.disableEvents||function(l,a){const c=l.ownerDocument;Yc.set(l,c);let u=bl.get(c);u===void 0&&(u={editors:new Set,hasShadowEditor:void 0},bl.set(c,u)),u.editors.add(a),u.hasShadowEditor=void 0,l.__lexicalEditor=a;const f=r1(l);f.push(O_.register(c));for(let d=0;d{bh(y)||(Ch(y),(a.isEditable()||g==="click")&&h(y,a))}:y=>{if(bh(y))return;Ch(y);const m=a.isEditable();switch(g){case"cut":return m&&j(a,xf,y);case"copy":return j(a,sa,y);case"paste":return m&&j(a,cf,y);case"dragstart":return m&&j(a,Zm,y);case"dragover":return m&&j(a,qm,y);case"dragend":return m&&j(a,E_,y);case"focus":return m&&j(a,_f,y);case"blur":return m&&j(a,Xm,y);case"drop":return m&&j(a,Gm,y)}};f.push(vf(l,g,p))}}(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Ti),qn(this);ki("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&I(38);let r=e;r._readOnly&&(r=A1(e),r._selection=e._selection?e._selection.clone():null),Tm(this);const o=this._pendingEditorState,i=n!==void 0?n.tag:null;o===null||o.isEmpty()||(i!=null&&this._updateTags.add(i),qn(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,Pt(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(const[s,l]of r._nodeMap.entries())O(l)?this._dirtyElements.set(s,!0):this._dirtyLeaves.add(s)},{discrete:!this._updating||void 0})}parseEditorState(e,n){return function(r,o,i){const s=Sf(),l=Je,a=yt,c=Fe,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,g=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Je=s,yt=!1,Fe=o,Tf(null);try{const h=o._nodes;Ol(r.root,h),i&&i(),s._readOnly=!0,s._parsed=!0}catch(h){h instanceof Error&&o._onError(h)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=g,Je=l,yt=a,Fe=c}return s}(typeof e=="string"?JSON.parse(e):e,this,n)}read(...e){const[n,r]=e.length===1?["force-commit",e[0]]:e;return n==="force-commit"&&qn(this),(n==="pending"?this._pendingEditorState||this._editorState:this.getEditorState()).read(r,{editor:this})}update(e,n){(function(r,o,i){r._updating?r._updates.push([o,i]):ca(r,o,i)})(this,e,n)}focus(e,n={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Pt(this,()=>{const o=V(),i=Ce();o!==null?o.dirty||He(o.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),In("focus"),hv(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const n=ht(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ki("editable",this,!0,e),this._slotsUsed&&this.update(()=>Y_()))}toJSON(){return{editorState:this._editorState.toJSON()}}}P(Hr,"version");Hr.version=bm;let ou=null;function Tf(t){ou=t}let lv=1;function R1(t,e){const n=kf(t,e);return n===void 0&&I(30,e),n}function kf(t,e){return t._nodes.get(e)}const av=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function Nf(t,e){const n=e!==void 0?e:(()=>{const i=t.getRootNode();return no(i)||Rn(i)?Jo(i):null})();if(!q(n)||n.hasAttribute("data-lexical-slot"))return!1;const r=un(n),o=n.nodeName;return i1(r)&&(o==="INPUT"||o==="TEXTAREA"||n.contentEditable==="true"&&ei(n)==null)}function gs(t,e,n){const r=t.getRootElement();if(!r)return!1;try{if(!e||!r.contains(e)||!r.contains(n))return!1}catch{return!1}return Pr(e)===t&&t.read("latest",()=>!Nf(e))}function ps(t){return t instanceof Hr}function Pr(t){let e=t;for(;e!=null;){const n=ei(e);if(ps(n))return n;e=dr(e)}return null}function ei(t){return t?t.__lexicalEditor:null}function Lr(t){return Dr(t)||t.isToken()}function St(t){return Lr(t)||t.isSegmented()}function vt(t){return ni(t)&&t.nodeType===3}function no(t){return ni(t)&&t.nodeType===9}function cv(t){let e=t;for(;e!=null;){if(vt(e))return e;e=e.firstChild}return null}function Vr(t,e,n){const r=$n[e];if(n!==null&&(t&r)===(n&r))return t;let o=t^r;return e==="subscript"?o&=-65:e==="superscript"?o&=-33:e==="lowercase"?(o&=-513,o&=-1025):e==="uppercase"?(o&=-257,o&=-1025):e==="capitalize"&&(o&=-257,o&=-513),o}function D1(t){return D(t)||rt(t)||te(t)}function F1(t,e){const n=function(){const s=ou;return ou=null,s}();if((e=e||n&&n.__key)!=null)return void(t.__key=e);ze(),T1();const r=he(),o=Bn(),i=""+lv++;o._nodeMap.set(i,t),O(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType===0&&(r._dirtyType=1),t.__key=i}function En(t){Qe(t)!==null&&I(380,t.__key,String(Qe(t)));const e=t.getParent();if(e!==null){const n=t.getWritable(),r=e.getWritable(),o=t.getPreviousSibling(),i=t.getNextSibling(),s=i!==null?i.__key:null,l=o!==null?o.__key:null,a=o!==null?o.getWritable():null,c=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=l),a!==null&&(a.__next=s),c!==null&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Ll(t){T1(),Sl(t)&&I(323,t.__key,t.__type);const e=t.getLatest(),n=e.__parent!==null?e.__parent:Br(e)?e.__slotHost:null,r=Bn(),o=he(),i=r._nodeMap,s=o._dirtyElements;n!==null&&function(a,c,u){let f=a;for(;f!==null;){if(u.has(f))return;const d=c.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent!==null?d.__parent:Br(d)?d.__slotHost:null}}(n,i,s);const l=e.__key;o._dirtyType===0&&(o._dirtyType=1),O(t)?s.set(l,!0):o._dirtyLeaves.add(l)}function Ke(t){ze();const e=he(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,n!==null){const r=Se(n);r!==null&&r.getWritable()}if(t!==null){const r=Se(t);r!==null&&r.getWritable()}}}function Tn(){return Wo()?null:he()._compositionKey}function Se(t,e){const n=(e||Bn())._nodeMap.get(t);return n===void 0?null:n}function H1(t,e){const n=ti(t,he());return n!==void 0?Se(n,e):null}function V1(t,e,n){t[`__lexicalKey_${e._key}`]=n}function ti(t,e){return t[`__lexicalKey_${e._key}`]}function un(t,e){let n=t;for(;n!=null;){const r=H1(n,e);if(r!==null)return r;n=dr(n)}return null}function B1(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function zh(t){return t.read(()=>Ce().getTextContent())}function Ce(){return Bn()._nodeMap.get("root")}function He(t){ze();const e=Bn();t!==null&&(t.dirty=!0,t.setCachedNodes(null),$(t)&&he()._slotsUsed&&b1(t)),e._selection=t}function Kh(){ze(),Tm(he())}function So(t){const e=function(n,r){let o=n;for(;o!=null;){const i=ti(o,r);if(i!==void 0)return i;o=dr(o)}return null}(t,he());return e===null?null:Se(e)}function j1(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Mf(t){const e=[];for(let n=t;n!==null;n=n._parentEditor)e.push(n);return e}function W1(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function z1(t){return vt(t)?t.nodeValue:null}function Of(t,e,n){const r=ht(Ct(e));if(r===null)return;const o=Ht(r,e._rootElement),i=o.anchorNode;let{anchorOffset:s,focusOffset:l}=o;if(i!==null){let a=z1(i);const c=un(i);if(a!==null&&D(c)){if((a===$i||a===of)&&n){const u=n.length;a=n,s=u,l=u}a!==null&&Af(c,a,s,l,t)}}}function Af(t,e,n,r,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();if(i.isToken()&&s)return;let l=e;if((s||o)&&(e.endsWith($i)&&(l=e.slice(0,-$i.length)),o)){const c=of;let u;for(;(u=l.indexOf(c))!==-1;)l=l.slice(0,u)+l.slice(u+c.length),n!==null&&n>u&&(n=Math.max(u,n-c.length)),r!==null&&r>u&&(r=Math.max(u,r-c.length))}const a=i.getTextContent();if(o||l!==a){const c=V();if(l===""){if(Ke(null),as||rr||cs)i.remove();else{const p=he();lc(i,"",c),setTimeout(()=>{p.update(()=>{i.isAttached()&&i.getTextContent()===""&&i.remove()})},20)}return}const u=i.getParent(),f=Qr(),d=i.getTextContentSize(),g=Tn(),h=i.getKey();if(i.isToken()&&!s||g!==null&&h===g&&!s||$(f)&&(u!==null&&!u.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===t.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===t.__key&&f.focus.offset===d&&!i.canInsertTextAfter()&&!s))return void i.markDirty();if(!$(c)||n===null||r===null)return void lc(i,l,c);if(c.setTextNodeRange(i,n,i,r),i.isSegmented()){const p=Pe(i.getTextContent());i.replace(p),i=p}lc(i,l,c)}}}function lc(t,e,n){if(t.setTextContent(e),$(n)){const r=t.getKey();let o=!1;for(const i of["anchor","focus"]){const s=n[i];s.type==="text"&&s.key===r&&(s.offset=an(t,s.offset,"clamp"),o=!0)}o&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function As(t,e,n){const r=e[n]||!1;return r==="any"||r===t[n]}function uv(t,e){return As(t,e,"altKey")&&As(t,e,"ctrlKey")&&As(t,e,"shiftKey")&&As(t,e,"metaKey")}function _e(t,e,n){if(!uv(t,n))return!1;if(t.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1||t.key.length===1&&t.key.charCodeAt(0)<=127)return!1;if(t.code.startsWith("Digit")&&/^\d$/.test(e))return t.code===`Digit${e}`;const r="Key"+e.toUpperCase();return t.code===r}const _n={ctrlKey:!Ut,metaKey:Ut},Jh={altKey:Ut,ctrlKey:!Ut};function Uh(t){return t.key==="Backspace"}function fv(t){const e=Ce();if($(t)){const n=t.anchor,r=t.focus,o=n.getNode();if($e(o))return n.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),kr(t),t;const i=o.getTopLevelElementOrThrow(),s=i.getParent();if(s===null)return O(i)&&(n.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),kr(t)),t;const l=s;return n.set(l.getKey(),0,"element"),r.set(l.getKey(),l.getChildrenSize(),"element"),kr(t),t}{const n=e.select(0,e.getChildrenSize());return He(kr(n)),n}}function Io(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(r!==void 0)return r;const o=t[e];if(typeof o=="string"){const i=Nn(o);return n[e]=i,i}return o}function Pf(t,e,n,r,o){if(n.size===0)return;const i=r.__type,s=r.__key,l=e.get(i);l===void 0&&I(33,i);const a=l.klass;let c=t.get(a);c===void 0&&(c=new Map,t.set(a,c));const u=c.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&c.set(s,f?"updated":o)}function Gh(t,e,n){const r=t.getParent();let o=n,i=t;return r!==null&&(n===0&&(o=i.getIndexWithinParent(),i=r)),i.getChildAtIndex(o-1)}function dv(t,e){const n=t.offset;if(t.type==="element")return Gh(t.getNode(),e,n);{const r=t.getNode();if(n===0||!e){const o=r.getPreviousSibling();return o===null?Gh(r.getParentOrThrow(),e,r.getIndexWithinParent()+0):o}}return null}function K1(t){const e=Ct(t).event,n=e&&e.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function j(t,e,n){return O1(t,e,n,t)}function zo(t,e){const n=t._keyToDOMMap.get(e);return n===void 0&&I(75,e),n}function dr(t){const e=t.assignedSlot||t.parentElement;if(e!==null)return e;const n=t.parentNode;return Rn(n)?n.host:null}function Lf(t){return no(t)?t:q(t)?t.ownerDocument:null}function In(t){ze(),he()._updateTags.add(t)}function hv(t){ze(),he()._deferred.push(t)}function Ko(t,e){let n=t.getParent();for(;n!==null;){if(n.is(e))return!0;n=n.getParent()}return!1}function $f(t){const e=Lf(t);return e?e.defaultView:null}function Ct(t){const e=t._window;return e===null&&I(78),e}function gv(t){return O(t)&&t.isInline()||te(t)&&t.isInline()}function J1(t){let e=t.getLatest();for(;e!==null;){if(Qe(e)!==null&&O(e))return e;const n=e.getParentOrThrow();if(ve(n))return n;e=n}return e}function Ro(t){return O(t)&&t.isShadowRoot()}function ve(t){return $e(t)||Ro(t)}function lt(t,e=!1){const n=t.constructor.clone(t);return F1(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function kt(t){const e=he(),n=t.getType(),r=kf(e,n);r===void 0&&I(200,t.constructor.name,n);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(t),l=s.constructor;return i!==null?s instanceof i||I(201,i.name,i.getType(),l.name,l.getType(),t.constructor.name,n):s instanceof t.constructor&&l!==t.constructor||I(202,l.name,l.getType(),t.constructor.name,n),s.__key===t.__key&&I(203,t.constructor.name,n,l.name,l.getType()),s}return t}function ac(t,e){!$e(t.getParent())||O(e)||te(e)||I(99)}function pv(t){const e=Se(t);return e===null&&I(63,t),e}function rl(t){if(!t||t.isInline())return!1;if(te(t))return!0;if(O(t)){if(t.isShadowRoot()){const e=t.getParent();return!(O(e)&&e.isShadowRoot())}return!t.canBeEmpty()}return!1}function $l(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;r!==null&&r.removeChild(t)}function ht(t){return dt?(t||window).getSelection():null}function mv(t){const e=$f(t);return e?e.getSelection():null}function Rn(t){return iu(t)&&"host"in t}const yv=[];function U1(t){const e=t.getRootNode();if(e===t||!Rn(e))return yv;const n=[e];let r=e.host;for(;;){const o=r.getRootNode();if(o===r||!Rn(o))break;n.push(o),r=o.host}return n}function*G1(t){const e=[t];let n;for(;n=e.pop();){yield*n.querySelectorAll('[data-lexical-editor="true"]');const r=(no(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();)o.shadowRoot&&e.push(o.shadowRoot)}}function Z1(t){return t!==null?t.ownerDocument:document}function Te(){const t=N1();return Z1(t!==null?t._rootElement:null)}function ua(t,e){if(e===null||typeof t.getComposedRanges!="function")return null;const n=U1(e);if(n.length===0)return null;const r=t.getComposedRanges;try{const o=r.call(t,{shadowRoots:n})[0];if(o!==void 0)return o}catch{}try{const o=r.apply(t,n)[0];if(o!==void 0)return o}catch{}return null}function xv(t,e){const n=ua(t,e);if(n!==null){const r=_v(n);if(r!==null)return r}return t.rangeCount>0?t.getRangeAt(0):null}function Ht(t,e){const n=ua(t,e);return n===null?t:vv(n,Cv(t))}function _v(t){const e=t.startContainer.ownerDocument;if(e===null)return null;const n=e.createRange();try{return n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset),n}catch{return null}}function vv(t,e){const{startContainer:n,startOffset:r,endContainer:o,endOffset:i}=t;return e==="backward"?{anchorNode:o,anchorOffset:i,direction:e,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:e,focusNode:o,focusOffset:i}}function Cv(t){return t.direction}function Ui(t){const e=t.getRootNode();return no(e)||Rn(e)?e.activeElement:null}function Jo(t){let e=t.activeElement;for(;e!==null&&e.shadowRoot!==null;){const n=e.shadowRoot.activeElement;if(n===null)break;e=n}return e}function If(t){const e=t.target;if(e!==null&&q(e)&&e.shadowRoot!==null&&typeof t.composedPath=="function"){const n=t.composedPath();if(n.length>0)return n[0]}return e}function q1(t){return q(t)&&t.tagName==="A"}function q(t){return ni(t)&&t.nodeType===1}function ni(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function iu(t){return ni(t)&&t.nodeType===11}const bv=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function Il(t){return!(!q(t)||!t.style.display.startsWith("inline"))||bv.test(t.nodeName)}const wv=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function Uo(t){return(!q(t)||!t.style.display.startsWith("inline"))&&wv.test(t.nodeName)}function Xe(t){if(te(t)&&!t.isInline())return!0;if(!O(t)||ve(t))return!1;const e=t.getFirstChild(),n=e===null||rt(e)||D(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&n}function Me(){return he()}function fa(t=Me()){return t._config.dom||Pl}function Vt(t,e,n=Me()){const r=fa(n).$getDOMSlot(t,e,n);return O(t)&&(Sv(r)||I(344,t.getKey(),t.getType())),r}function Sv(t){return t instanceof Mo}function er(t,e,n=Me()){return cv(Vt(t,e,n).element)}const Zh=new WeakMap,Ev=new Map;function qh(t){if(!t._readOnly&&t.isEmpty())return Ev;t._readOnly||I(192);let e=Zh.get(t);return e||(e=function(n){const r=new Map;for(const[o,i]of n._nodeMap){const s=i.__type;let l=r.get(s);l||(l=new Map,r.set(s,l)),l.set(o,i)}return r}(t),Zh.set(t,e)),e}function Y1(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Tv(t){return(e=Y1(t))[o1]=!0,e;var e}function ro(t,e){const n=t.getAttribute("data-lexical-indent");if(n!==null){const i=parseInt(n,10);if(Number.isFinite(i)&&i>=0)return void e.setIndent(i)}const r=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(r/40);e.setIndent(o)}function Wt(t,e){const n=e.getAttribute("dir");return n==="ltr"||n==="rtl"?t.setDirection(n):t}function gn(t,e){const n=e.style.textAlign;return n&&n in xl?t.setFormat(n):t}function kv(t,e){t.__lexicalUnmanaged=!0,e&&e.captureSelection!==void 0&&(t.__lexicalCapturedSelection=e.captureSelection)}function X1(t){return t.__lexicalUnmanaged===!0}function Nv(t,e=Me()){const n=e.isEditable();t.contentEditable=n?"true":"false",n?t.__lexicalEditor=e:delete t.__lexicalEditor}function Rl(t,e){let n=t;for(;n!=null;){if(n.__lexicalCapturedSelection===!0)return!0;if(q(n)&&n.hasAttribute("data-lexical-slot")||ti(n,e)!==void 0)return!1;n=dr(n)}return!1}function pi(t,e){return function(n,r){return Object.prototype.hasOwnProperty.call(n,r)}(t,e)&&t[e]!==mt[e]}const Yh=new WeakMap;function Rf(t){const e=Yh.get(t);if(e)return e;const n=t.prototype!=null&&Yd in t.prototype?t.prototype[Yd]():void 0,r=function(a){if(!(a===mt||a.prototype instanceof mt)){let c="",u="";try{c=a.getType()}catch{}try{Hr.version&&(u=JSON.parse(Hr.version))}catch{}I(290,a.name,c,u)}return a===ds||a===ft||a===mt}(t),o=!r&&pi(t,"getType")?t.getType():void 0;let i,s=o;if(n)if(o)i=n[o];else{for(const[a,c]of Object.entries(n))s=a,i=c;if(!i)for(const a of Object.getOwnPropertySymbols(n)){const c=n[a];if(c){i=c;break}}}if(!r&&s&&(pi(t,"getType")||(t.getType=()=>s),pi(t,"clone")||(t.clone=a=>(Tf(a),new t)),pi(t,"importJSON")||(t.importJSON=i&&i.$importJSON||(a=>new t().updateFromJSON(a))),!pi(t,"importDOM")&&i)){const{importDOM:a}=i;a&&(t.importDOM=()=>a)}const l={klass:t,ownNodeConfig:i,ownNodeType:s};return Yh.set(t,l),l}function*Df(t){for(let e=t;e&&(e===mt||i1(e.prototype));){const n=Rf(e);yield n,e=n.ownNodeConfig&&n.ownNodeConfig.extends||e0(e)}}function Q1(t){const e=Me();return ze(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}const Ne=(t,e)=>{let n=t;for(;n!=null&&!$e(n);){if(e(n))return n;n=n.getParent()}return null};function Dl(t,e){const n=[];let r=t.__first;for(;r!==null;){const o=e===null?Se(r):e.get(r);o==null&&I(174),n.push(r),r=o.__next}return n}function e0(t){const e=Object.getPrototypeOf(t);if(typeof e=="function"&&e!==Function.prototype)return e;const n=t.prototype&&Object.getPrototypeOf(t.prototype);return n?n.constructor:null}const t0=new Map;function kn(t){return O(t)||te(t)}function Br(t){return O(t)||te(t)}function Qe(t){const e=t.getLatest();return Br(e)?e.__slotHost:null}function Zt(t){const e=Qe(t);if(e===null)return null;const n=Se(e);return O(n)||te(n)||I(370),n}function Mv(t){const e=Zt(t);if(e===null)return null;const n=t.getLatest().__key;for(const[r,o]of ha(e))if(o===n)return r;return null}function da(t){let e=t.getLatest();for(;e!==null;){if(Qe(e)!==null)return e;e=e.getParent()}return null}function ha(t){const e=t.getLatest();return kn(e)&&e.__slots!==null?e.__slots:t0}function Lt(t){return Array.from(ha(t).keys())}function jr(t,e){const n=ha(t).get(e);return n===void 0?null:Se(n)}const Ov=["__proto__","constructor","prototype"],Xh=Symbol("slotMapOwner");function su(t){let e=t.__slots;return e!==null&&e[Xh]===t||(e=new Map(e),e[Xh]=t,t.__slots=e),e}const Qh=new WeakMap,Av=[];function Pv(t){for(const{ownNodeConfig:e}of Df(t)){const n=e&&e.slots;if(n)return n}return Av}function n0(t){let e="";for(const n of Lt(t)){const r=jr(t,n);r!==null&&(e+=r.getTextContent())}return e}function eg(t,e,n){const r=n.get(t),o=n.get(e);return r!==void 0?o!==void 0?r-o:-1:o!==void 0?1:te?1:0}function Lv(t){const e=t.__slots;if(e===null||e.size<2)return;const n=function(s){let l=Qh.get(s);if(l===void 0){const a=Pv(s),c=new Map;for(const u of a)Ov.includes(u)&&I(371,s.name,u),c.has(u)&&I(372,s.name,u),c.set(u,c.size);l=c,Qh.set(s,l)}return l}(t.constructor);let r=null,o=!0;for(const s of e.keys()){if(r!==null&&eg(r,s,n)>0){o=!1;break}r=s}if(o)return;const i=Array.from(e).sort(([s],[l])=>eg(s,l,n));e.clear();for(const[s,l]of i)e.set(s,l)}function r0(t,e,n){e!=="__proto__"&&e!=="constructor"&&e!=="prototype"||I(373,e);const r=t.getLatest();if(r.__slots!==null&&r.__slots.get(e)===n.getLatest().__key)return r;(!O(n)&&!te(n)||n.isInline())&&I(374,n.__key);const o=t.getWritable(),i=su(o),s=i.get(e);s!==void 0&&o0(s);const l=n.getWritable(),a=Zt(l);if(a!==null){const c=Mv(l);c!==null&&su(a.getWritable()).delete(c),l.__slotHost=null}return En(l),l.__slotHost=o.__key,i.set(e,l.__key),Lv(o),function(){const c=Me();c._slotsUsed=!0,c._pendingEditorState&&(c._pendingEditorState._slotsUsed=!0)}(),o}function $v(t,e){const n=t.getWritable();if(n.__slots===null)return n;const r=n.__slots.get(e);return r!==void 0&&(o0(r),su(n).delete(e)),n}function o0(t){const e=Se(t);if(e===null)return;const n=e.getWritable();Br(n)||I(377,t),n.__slotHost=null,n.remove()}const Iv={next:"previous",previous:"next"};class Ff{constructor(e){P(this,"origin");this.origin=e}[Symbol.iterator](){return i0({hasNext:ir,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return fe(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return fe(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,n){const r=this.getNodeAtCaret();return e.is(this.origin)||e.is(r)||(r===null?this.insert(e):r.replace(e,n)),this}splice(e,n,r="next"){const o=r===this.direction?n:Array.from(n).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let a=i.getAdjacentCaret();a!==null&&l.size0){const c=i.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||i.origin.is(a))){const u=a.getParent();u&&u.is(s)&&a.remove(),c.replace(a)}}else c===null&&I(263,Array.from(l).join(" "))}else i.insert(a);i=fe(a,this.direction)}for(const a of l.values())a.remove();return this}}class Gi extends Ff{constructor(){super(...arguments);P(this,"type","child")}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:Tt(n,this.direction)}getParentCaret(n="root"){return fe(Hf(this.getParentAtCaret(),n),this.direction)}getFlipped(){const n=hr(this.direction);return fe(this.getNodeAtCaret(),n)||Tt(this.origin,n)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(n){return n instanceof Gi&&this.direction===n.direction&&this.origin.is(n.origin)}isSamePointCaret(n){return this.isSameNodeCaret(n)}}const Rv={root:$e,shadowRoot:ve};function hr(t){return Iv[t]}function Hf(t,e="root"){return t===null||Rv[e](t)?null:Qe(t)===null?t:null}class Wr extends Ff{constructor(){super(...arguments);P(this,"type","sibling")}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:fe(n,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return O(this.origin)?Tt(this.origin,this.direction):null}getParentCaret(n="root"){return fe(Hf(this.getParentAtCaret(),n),this.direction)}getFlipped(){const n=hr(this.direction);return fe(this.getNodeAtCaret(),n)||Tt(this.origin.getParentOrThrow(),n)}isSamePointCaret(n){return n instanceof Wr&&this.direction===n.direction&&this.origin.is(n.origin)}isSameNodeCaret(n){return(n instanceof Wr||n instanceof zr)&&this.direction===n.direction&&this.origin.is(n.origin)}}class zr extends Ff{constructor(n,r){super(n);P(this,"type","text");P(this,"offset");this.offset=r}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:sr(n,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(n="root"){return fe(Hf(this.getParentAtCaret(),n),this.direction)}getFlipped(){return sr(this.origin,hr(this.direction),this.offset)}isSamePointCaret(n){return n instanceof zr&&this.direction===n.direction&&this.origin.is(n.origin)&&this.offset===n.offset}isSameNodeCaret(n){return(n instanceof Wr||n instanceof zr)&&this.direction===n.direction&&this.origin.is(n.origin)}getSiblingCaret(){return fe(this.origin,this.direction)}}function $t(t){return t instanceof zr}function ir(t){return t instanceof Wr}function Et(t){return t instanceof Gi}const Dv={next:class extends zr{constructor(){super(...arguments);P(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends zr{constructor(){super(...arguments);P(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Fv={next:class extends Wr{constructor(){super(...arguments);P(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Wr{constructor(){super(...arguments);P(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Hv={next:class extends Gi{constructor(){super(...arguments);P(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Gi{constructor(){super(...arguments);P(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function fe(t,e){return t?new Fv[e](t):null}function sr(t,e,n){return t?new Dv[e](t,an(t,n)):null}function an(t,e,n="error"){const r=t.getTextContentSize();let o=e==="next"?r:e==="previous"?0:e;return(o<0||o>r)&&(n!=="clamp"&&ym(284,String(e),String(r),t.getKey()),o=o<0?0:r),o}function tg(t,e){return new Bv(t,e)}function Tt(t,e){return O(t)?new Hv[e](t):null}function Vv(t){return t&&t.getChildCaret()||t}function ga(t){return t&&Vv(t.getAdjacentCaret())}class Vf{constructor(e,n,r){P(this,"type","node-caret-range");P(this,"direction");P(this,"anchor");P(this,"focus");this.anchor=e,this.focus=n,this.direction=r}getLatest(){const e=this.anchor.getLatest(),n=this.focus.getLatest();return e===this.anchor&&n===this.focus?this:new Vf(e,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=o=>{const i=this[o].getLatest();return $t(i)?function(s,l){const{direction:a,origin:c}=s,u=an(c,l==="focus"?hr(a):a);return tg(s,u-s.offset)}(i,o):null},n=e("anchor"),r=e("focus");if(n&&r){const{caret:o}=n,{caret:i}=r;if(o.isSameNodeCaret(i))return[tg(o,i.offset-o.offset),null]}return[n,r]}iterNodeCarets(e="root"){const n=$t(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=$t(r),i=s=>s.isSameNodeCaret(r)?null:ga(s)||s.getParentCaret(e);return i0({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:n.isSameNodeCaret(r)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Bv{constructor(e,n){P(this,"type","slice");P(this,"caret");P(this,"distance");this.caret=e,this.distance=n}getSliceIndices(){const{distance:e,caret:{offset:n}}=this,r=n+e;return r{let R;for(let F=E;Fy.has(M.getKey())&&Xe(M));return k&&Lt(k).length>0?null:w&&k?[w,k]:null}(u,f,a);if(d){const[h,p]=d;Tt(h,"previous").splice(0,p.getChildren());let y=p.getParent();for(p.remove(!0);y&&y.isEmpty();){const m=y;y=y.getParent(),m.remove(!0)}}else if(f){const h=function(m){if(Et(m)){const x=m.origin;if(Xe(x))return x}else{const x=m.getParentAtCaret();if(x&&Xe(x))return x}return null}(f),p=h&&h.getParent(),y=h&&h.getParents().findLast(Ro);if(h&&p&&!$e(p)&&h.isEmpty()&&a.has(h.getKey())&&Lt(h).length===0&&(!y||a.has(y.getKey()))){h.remove(!0);let m=p;for(;m&&!$e(m)&&m.isEmpty();){const x=m.getParent();if(x&&$e(x)&&x.getChildrenSize()<=1)break;const v=m;m=x,v.remove(!0)}}}const g=[u,f,...s,...l].find(cc);if(g)return ms(Dn(pt(g),t.direction));I(269,JSON.stringify(s.map(h=>h.origin.__key)))}function pt(t){const e=function(o){let i=o;for(;Et(i);){const s=ga(i);if(!Et(s))break;i=s}return i}(t.getLatest()),{direction:n}=e;if(D(e.origin))return $t(e)?e:sr(e.origin,n,n);const r=e.getAdjacentCaret();return ir(r)&&D(r.origin)?sr(r.origin,n,hr(n)):e}function Bf(t){return $t(t)&&t.offset!==an(t.origin,t.direction)}function Dn(t,e){return t.direction===e?t:t.getFlipped()}function jf(t,e){return t.direction===e?t:qt(Dn(t.focus,e),Dn(t.anchor,e))}function cu(t,e,n){let r=Tt(t,"next");for(let o=0;o0||!i&&l.canBeEmpty()&&o(l,"last"))&&s.insert(e(l).splice(0,0,a))}return s}function Wf(t,e,n){let r=Dn(e,"next");$t(r)&&(r.offset===0?r=fe(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=fe(r.origin,"next"))),r.origin.is(t)&&(ir(r)||I(342,t.getKey(),t.getType()),r=oo(r)),(t.is(r.getNodeAtCaret())||t.is(r.getFlipped().getNodeAtCaret()))&&t.remove(!0);for(let o=r;o;o=l0(o,n))r=o;return $t(r)&&I(283),r.insert(t.isInline()?re().append(t):t),Dn(fe(t.getLatest(),"next"),e.direction)}function Eo(...t){return t}function Kv(t,e){return[t,e]}function ma(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return{...t,...e};return t}function Nn(...t){const e=[];for(const n of t)if(n&&typeof n=="string")for(const[r]of n.matchAll(/\S+/g))e.push(r);return e}function Xt(t,...e){const n=Nn(...e);n.length>0&&t.classList.add(...n)}function ya(t,...e){const n=Nn(...e);n.length>0&&t.classList.remove(...n)}function tt(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function og(t,e,n){return tt(...Object.entries(e).map(([r,o])=>vf(t,r,o,n)))}function a0(t){const e=Me().getElementByKey(t.getKey());if(e===null)return null;const n=e.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(e)}function c0(t){return a0($e(t)?t:t.getParentOrThrow())}function Ls(t){const e=c0(t);return e!==null&&e.direction==="rtl"}function u0(t,e,n="self"){const r=t.getStartEndPoints();if(e.isSelected(t)&&!St(e)&&r!==null){const[o,i]=r,s=t.isBackward(),l=o.getNode(),a=i.getNode(),c=e.is(l),u=e.is(a);if(c||u){const[f,d]=eu(t),g=l.is(a),h=e.is(s?a:l),p=e.is(s?l:a);let y,m=0;g?(m=f>d?d:f,y=f>d?f:d):h?(m=s?d:f,y=void 0):p&&(m=0,y=s?f:d);const x=e.__text.slice(m,y);x!==e.__text&&(n==="clone"&&(e=Tv(e)),e.__text=x)}}return e}function Jv(t,e){const n=t.getFormatType(),r=t.getIndent();n!==e.getFormatType()&&e.setFormat(n),r!==e.getIndent()&&e.setIndent(r)}function Uv(t,e,n){let r=ut(t,n);if(Bf(r))return!1;for(;r;r=r.getParentCaret()){const o=r.getParentAtCaret();if(!o||r.getNodeAtCaret())return!1;if(e.is(o))return!0}return!1}function Gv(t,e,n=Jv){if(!t)return;const r=t.getStartEndPoints();let o=!1,i=null;const s=new Map;if(r){const[l,a]=r,c=Ne(l.getNode(),Xe);i=Ne(a.getNode(),Xe);const u=t.isBackward()?"previous":"next";o=O(i)&&!i.is(c)&&function(f,d,g){const h=f.getNode();return(!O(h)||!h.isEmpty())&&Uv(f,d,g)}(a,i,hr(u)),O(c)&&s.set(c.getKey(),c),O(i)&&!o&&s.set(i.getKey(),i)}for(const l of t.getNodes())if(O(l)&&Xe(l)){if(o&&l.is(i))continue;s.set(l.getKey(),l)}else if(!r){const a=Ne(l,Xe);O(a)&&s.set(a.getKey(),a)}for(const l of s.values()){const a=e();n(l,a),l.replace(a,!0)}}function f0(t){const e=d0(t);return e!==null&&e.writingMode==="vertical-rl"}function d0(t){const e=t.anchor.getNode();return O(e)?a0(e):c0(e)}function ig(t,e){let n=f0(t)?!e:e;h0(t)&&(n=!n);const r=ut(t.focus,n?"previous":"next");if(Bf(r))return!1;if($t(r)&&!Dr(r.origin)&&r.origin.isUnmergeable()){const o=r.getNodeAtCaret();if(D(o)&&!Dr(o))return!0}for(const o of pa(r)){if(Et(o))return!o.origin.isInline();if(!O(o.origin)){if(te(o.origin))return!0;break}}return!1}function Zv(t,e,n,r){t.modify(e?"extend":"move",n,r)}function h0(t){const e=d0(t);return e!==null&&e.direction==="rtl"}function sg(t,e,n){const r=h0(t);let o;o=f0(t)||r?!n:n,Zv(t,e,o,"character")}function qv(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function g0(t,e){let n=t;for(;n!=null;){if(n instanceof e)return n;n=n.getParent()}return null}function p0(t){const e=Ne(t,n=>O(n)&&!n.isInline());return O(e)||qv(4,t.__key),e}function Yv(t){const e=V()||Qr();let n;if($(e))n=ut(e.focus,"next");else{if(e!=null){const s=e.getNodes(),l=s[s.length-1];l&&(n=fe(l,"next"))}n=n||Tt(Ce(),"previous").getFlipped().insert(re())}const r=Wf(t,n),o=ga(r),i=Et(o)?pt(o):r;return Go(ms(i)),t.getLatest()}function Xv(t,e){const n=e();return t.replace(n),n.append(t),n}function Yn(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function $s(t){let e=null;if(Yn(t,DragEvent)?e=t.dataTransfer:Yn(t,ClipboardEvent)&&(e=t.clipboardData),e===null)return[!1,[],!1];const n=e.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(e.files),o]}function uu(t){const e=V();if(!$(e))return!1;const n=new Set,r=e.getNodes();for(let o=0;oO(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!n.has(a)&&(n.add(a),t(l))}return n.size>0}let uc=!(Ln||!dt)&&void 0;function Qv(t,e=!1){let n=1;if(function(){if(uc===void 0){const r=document.createElement("div");r.style.position="absolute",r.style.opacity="0",r.style.width="100px",r.style.left="-1000px",document.body.appendChild(r);const o=r.getBoundingClientRect();r.style.setProperty("zoom","2"),uc=r.getBoundingClientRect().width===o.width,document.body.removeChild(r)}return uc}()||e){const r=t&&t.ownerDocument.defaultView||window;for(;t;)n*=Number(r.getComputedStyle(t).getPropertyValue("zoom")),t=dr(t)}return n}const eC=Symbol.for("preact-signals");function xa(){if(Mn>1)return void Mn--;let t,e=!1;for(!function(){let n=Fl;for(Fl=void 0;n!==void 0;)n.S.v===n.v&&(n.S.i=n.i),n=n.o}();Ni!==void 0;){let n=Ni;for(Ni=void 0,Hl++;n!==void 0;){const r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&y0(n))try{n.c()}catch(o){e||(t=o,e=!0)}n=r}}if(Hl=0,Mn--,e)throw t}function m0(t){if(Mn>0)return t();fu=++tC,Mn++;try{return t()}finally{xa()}}let ye,Ni;function lg(t){const e=ye;ye=void 0;try{return t()}finally{ye=e}}let Fl,Mn=0,Hl=0,tC=0,fu=0,il=0;function ag(t){if(ye===void 0)return;let e=t.n;return e===void 0||e.t!==ye?(e={i:0,S:t,p:ye.s,n:void 0,t:ye,e:void 0,x:void 0,r:e},ye.s!==void 0&&(ye.s.n=e),ye.s=e,t.n=e,32&ye.f&&t.S(e),e):e.i===-1?(e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=ye.s,e.n=void 0,ye.s.n=e,ye.s=e),e):void 0}function ot(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function qi(t,e){return new ot(t,e)}function y0(t){for(let e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function cg(t){for(let e=t.s;e!==void 0;e=e.n){const n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function x0(t){let e,n=t.s;for(;n!==void 0;){const r=n.p;n.i===-1?(n.S.U(n),r!==void 0&&(r.n=n.n),n.n!==void 0&&(n.n.p=r)):e=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=r}t.s=e}function go(t,e){ot.call(this,void 0),this.x=t,this.s=void 0,this.g=il-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function _0(t){const e=t.m;if(t.m=void 0,typeof e=="function"){Mn++;const n=ye;ye=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,zf(t),r}finally{ye=n,xa()}}}function zf(t){for(let e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,_0(t)}function nC(t){if(ye!==this)throw new Error("Out-of-order effect");x0(this),ye=t,this.f&=-2,8&this.f&&zf(this),xa()}function bo(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e==null?void 0:e.name}function ys(t,e){const n=new bo(t,e);try{n.c()}catch(o){throw n.d(),o}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Kf(t,e={}){const n={};for(const r in t){const o=e[r],i=qi(o===void 0?t[r]:o);n[r]=i}return n}ot.prototype.brand=eC,ot.prototype.h=function(){return!0},ot.prototype.S=function(t){const e=this.t;e!==t&&t.e===void 0&&(t.x=e,this.t=t,e!==void 0?e.e=t:lg(()=>{var n;(n=this.W)==null||n.call(this)}))},ot.prototype.U=function(t){if(this.t!==void 0){const e=t.e,n=t.x;e!==void 0&&(e.x=n,t.e=void 0),n!==void 0&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,n===void 0&&lg(()=>{var r;(r=this.Z)==null||r.call(this)}))}},ot.prototype.subscribe=function(t){return ys(()=>{const e=this.value,n=ye;ye=void 0;try{t(e)}finally{ye=n}},{name:"sub"})},ot.prototype.valueOf=function(){return this.value},ot.prototype.toString=function(){return this.value+""},ot.prototype.toJSON=function(){return this.value},ot.prototype.peek=function(){const t=ye;ye=void 0;try{return this.value}finally{ye=t}},Object.defineProperty(ot.prototype,"value",{get(){const t=ag(this);return t!==void 0&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Hl>100)throw new Error("Cycle detected");(function(e){Mn!==0&&Hl===0&&e.l!==fu&&(e.l=fu,Fl={S:e,v:e.v,i:e.i,o:Fl})})(this),this.v=t,this.i++,il++,Mn++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{xa()}}}}),go.prototype=new ot,go.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===il))return!0;if(this.g=il,this.f|=1,this.i>0&&!y0(this))return this.f&=-2,!0;const t=ye;try{cg(this),ye=this;const e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ye=t,x0(this),this.f&=-2,!0},go.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}ot.prototype.S.call(this,t)},go.prototype.U=function(t){if(this.t!==void 0&&(ot.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},go.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;t!==void 0;t=t.x)t.t.N()}},Object.defineProperty(go.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=ag(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),bo.prototype.c=function(){const t=this.S();try{if(8&this.f||this.x===void 0)return;const e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}},bo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,_0(this),cg(this),Mn++;const t=ye;return ye=this,nC.bind(this,t)},bo.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ni,Ni=this)},bo.prototype.d=function(){this.f|=8,1&this.f||zf(this)},bo.prototype.dispose=function(){this.d()};function rC(t){return(typeof t.nodes=="function"?t.nodes():t.nodes)||[]}function oC(t,e){let n;return qi(t(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=t(),n=e(this)}})}function we(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let v0;try{v0="0.48.0+prod.esm"}catch{}const iC=v0??'"+source"',sC=new Set(["__proto__","constructor","prototype"]);function C0(t,e){if(t&&e&&!Array.isArray(e)&&typeof t=="object"&&typeof e=="object"){const n=t,r=e;for(const o in r)!sC.has(o)&&Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=C0(n[o],r[o]));return t}return e}const Jf=0,du=1,b0=2,fc=3,Is=4,po=5,dc=6,mi=7;function hc(t){return t.id===Jf}function w0(t){return t.id===b0}function lC(t){return function(e){return e.id===du}(t)||we(305,String(t.id),String(du)),Object.assign(t,{id:b0})}const aC=new Set;let cC=class{constructor(e,n){P(this,"builder");P(this,"configs");P(this,"_dependency");P(this,"_peerNameSet");P(this,"extension");P(this,"state");P(this,"_signal");this.builder=e,this.extension=n,this.configs=new Set,this.state={id:Jf}}mergeConfigs(){let e=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):ma;for(const r of this.configs)e=n(e,r);return e}init(e){const n=this.state;w0(n)||we(306,String(n.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(l,a,c){return Object.assign(l,{config:a,id:fc,registerState:c})}(n,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(e,i.config,r)),this.state=function(l,a,c){return Object.assign(l,{id:Is,initResult:a,registerState:c})}(i,s,o)}build(e){const n=this.state;let r;n.id!==Is&&we(307,String(n.id),String(po)),this.extension.build&&(r=this.extension.build(e,n.config,n.registerState));const o={...n.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=function(i,s,l){return Object.assign(i,{id:po,output:s,registerState:l})}(n,r,o)}register(e,n){this._signal=n;const r=this.state;r.id!==po&&we(308,String(r.id),String(po));const o=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=function(i){return Object.assign(i,{id:dc})}(r),()=>{const i=this.state;i.id!==mi&&we(309,String(r.id),String(mi)),this.state=function(s){return Object.assign(s,{id:po})}(i),o&&o()}}afterRegistration(e){const n=this.state;let r;return n.id!==dc&&we(310,String(n.id),String(dc)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,n.config,n.registerState)),this.state=function(o){return Object.assign(o,{id:mi})}(n),r}getSignal(){return this._signal===void 0&&we(311),this._signal}getInitResult(){this.extension.init===void 0&&we(312,this.extension.name);const e=this.state;return function(n){return n.id>=Is}(e)||we(313,String(e.id),String(Is)),e.initResult}getInitPeer(e){const n=this.builder.extensionNameMap.get(e);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(n){return n.id>=fc}(e)||we(314,String(e.id),String(fc)),{config:e.config}}getPeer(e){const n=this.builder.extensionNameMap.get(e);return n?n.getExtensionDependency():void 0}getInitDependency(e){const n=this.builder.getExtensionRep(e);return n===void 0&&we(315,this.extension.name,e.name),n.getExtensionInitDependency()}getDependency(e){const n=this.builder.getExtensionRep(e);return n===void 0&&we(315,this.extension.name,e.name),n.getExtensionDependency()}getState(){const e=this.state;return function(n){return n.id>=mi}(e)||we(316,String(e.id),String(mi)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||aC}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(n){return n.id>=po})(e)||we(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const ug={tag:Ti};function uC(){const t=Ce();t.isEmpty()&&t.append(re())}const S0={config:{setOptions:ug,updateOptions:ug},init:({$initialEditorState:t=uC})=>({$initialEditorState:t,initialized:!1}),afterRegistration(t,{updateOptions:e,setOptions:n},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(ev(i))t.setEditorState(i,n);else if(typeof i=="function")t.update(()=>{i(t)},e);else if(i&&(typeof i=="string"||typeof i=="object")){const s=t.parseEditorState(i);t.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[eo,Qt,to,Yr,fr]},fg=Symbol.for("@lexical/extension/LexicalBuilder");function fC(...t){return On.fromExtensions(t).buildEditor()}function dg(){}function dC(t){throw t}function Rs(t){return Array.isArray(t)?t:[t]}const gc=iC;class On{constructor(e){P(this,"roots");P(this,"extensionNameMap");P(this,"outgoingConfigEdges");P(this,"incomingEdges");P(this,"conflicts");P(this,"_sortedExtensionReps");P(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=gc,this.roots=e;for(const n of e)this.addExtension(n)}static fromExtensions(e){const n=[Rs(S0)];for(const r of e)n.push(Rs(r));return new On(n)}static maybeFromEditor(e){const n=e[fg];return n&&(n.PACKAGE_VERSION!==gc&&we(292,n.PACKAGE_VERSION,gc),n instanceof On||we(293)),n}static fromEditor(e){const n=On.maybeFromEditor(e);return n===void 0&&we(294),n}constructEditor(){const{$initialEditorState:e,onError:n,onWarn:r,...o}=this.buildCreateEditorArgs(),i=Object.assign(I1({...o,...n?{onError:s=>{n(s,i)}}:{},...r?{onWarn:s=>{r(s,i)}}:{}}),{[fg]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=dg;function n(){try{e()}finally{e=dg}}const r=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return e=tt(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const n=this.extensionNameMap.get(e.name);if(n)return n.extension!==e&&we(295,e.name),n}addEdge(e,n,r){const o=this.outgoingConfigEdges.get(e);o?o.set(n,r):this.outgoingConfigEdges.set(e,new Map([[n,r]]));const i=this.incomingEdges.get(n);i?i.add(e):this.incomingEdges.set(n,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&we(296);const n=Rs(e),[r]=n;typeof r.name!="string"&&we(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&we(298,r.name),!o){o=new cC(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&we(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&we(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=Rs(s);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[s,l]of r.peerDependencies||[])this.addEdge(r.name,s,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],n=(r,o)=>{let i=r.state;if(w0(i))return;const s=r.extension.name;var l;hc(i)||we(300,s,o||"[unknown]"),hc(l=i)||we(304,String(l.id),String(Jf)),i=Object.assign(l,{id:du}),r.state=i;const a=this.outgoingConfigEdges.get(s);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&n(u,s)}i=lC(i),r.state=i,e.push(r)};for(const r of this.extensionNameMap.values())hc(r.state)&&n(r);for(const r of e)for(const[o,i]of this.outgoingConfigEdges.get(r.extension.name)||[])if(i.length>0){const s=this.extensionNameMap.get(o);if(s)for(const l of i)s.configs.add(l)}for(const[r,...o]of this.roots)if(o.length>0){const i=this.extensionNameMap.get(r.name);i===void 0&&we(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const n=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of n){const l=s.register(e,i);l&&o.push(l)}for(const s of n){const l=s.afterRegistration(e);l&&o.push(l)}return tt(...o)}buildCreateEditorArgs(){const e={},n=new Set,r=new Map,o=new Map,i={},s={},l=this.sortedExtensionReps();for(const u of l){const{extension:f}=u;if(f.onError!==void 0&&(e.onError=f.onError),f.onWarn!==void 0&&(e.onWarn=f.onWarn),f.disableEvents!==void 0&&(e.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(e.parentEditor=f.parentEditor),f.editable!==void 0&&(e.editable=f.editable),f.namespace!==void 0&&(e.namespace=f.namespace),f.$initialEditorState!==void 0&&(e.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of rC(f)){if(typeof d!="function"){const g=r.get(d.replace);g&&we(302,f.name,d.replace.name,g.extension.name),r.set(d.replace,u)}n.add(d)}if(f.html){if(f.html.export)for(const[d,g]of f.html.export.entries())o.set(d,g);f.html.import&&Object.assign(i,f.html.import)}f.theme&&C0(s,f.theme)}Object.keys(s).length>0&&(e.theme=s),n.size&&(e.nodes=[...n]);const a=Object.keys(i).length>0,c=o.size>0;(a||c)&&(e.html={},a&&(e.html.import=i),c&&(e.html.export=o));for(const u of l)u.init(e);return e.onError||(e.onError=dC),e}}function hC(t,e){const n=On.fromEditor(t).getExtensionRep(e);return n===void 0&&we(303,e.name),n.getExtensionDependency()}function io(t,e){const n=On.maybeFromEditor(t);if(!n)return;const r=n.extensionNameMap.get(e);return r?r.getExtensionDependency():void 0}function gC(t){return io(Me(),t)}class so extends ds{static getType(){return"horizontalrule"}static clone(e){return new so(e.__key)}static importJSON(e){return _a().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:pC,priority:0})}}exportDOM(){return{element:Te().createElement("hr")}}createDOM(e){const n=Te().createElement("hr");return Xt(n,e.theme.hr),n}getTextContent(){return` -`}isInline(){return!1}updateDOM(){return!1}}function pC(){return{node:_a()}}function _a(){return Q1(so)}function E0(t){return t instanceof so}const mC={build:(t,e)=>Kf({inheritEditableFromParent:e.inheritEditableFromParent}),config:{$getParentEditor:function(){const t=Me();return On.fromEditor(t),t},inheritEditableFromParent:!1},init:(t,e,n)=>{const r=e.$getParentEditor();t.parentEditor=r,t.theme=t.theme||r._config.theme},name:"@lexical/extension/NestedEditor",register:(t,e,n)=>ys(()=>{const r=t._parentEditor;if(r&&n.getOutput().inheritEditableFromParent.value)return t.setEditable(r.isEditable()),r.registerEditableListener(t.setEditable.bind(t))})};function yC(t){return t.canIndent()}function xC(t,e,n=yC){return tt(t.registerCommand(yf,r=>{const o=V();if(!$(o))return!1;r.preventDefault();const i=function(s){if(s.getNodes().filter(d=>Fr(d)&&d.canIndent()).length>0)return!0;const l=s.anchor,a=s.focus,c=a.isBefore(l)?a:l,u=c.getNode(),f=p0(u);if(f.canIndent()){const d=f.getKey();let g=aa();if(g.anchor.set(d,0,"element"),g.focus.set(d,0,"element"),g=kr(g),g.anchor.is(c))return!0}return!1}(o)?r.shiftKey?Zc:Cl:Um;return t.dispatchCommand(i,void 0)},ee),t.registerCommand(Cl,()=>{const r=typeof e=="number"?e:e?e.peek():null,o=V();if(!$(o))return!1;const i=typeof n=="function"?n:n.peek();return uu(s=>{if(i(s)){const l=s.getIndent()+1;(!r||l1){const m=e._nodeMap,x=m.get(i.anchor.key),v=m.get(s.anchor.key);return x&&v&&!t._nodeMap.has(x.__key)&&D(x)&&x.__text.length===1&&i.anchor.offset===1?2:0}const a=l[0],c=t._nodeMap.get(a.__key);if(!D(c)||!D(a)||c.__mode!==a.__mode)return 0;const u=c.__text,f=a.__text;if(u===f)return 0;const d=i.anchor,g=s.anchor;if(d.key!==g.key||d.type!=="text")return 0;const h=d.offset,p=g.offset,y=f.length-u.length;return y===1&&p===h-1?2:y===-1&&p===h+1?3:y===-1&&p===h?4:0}function vC(t,e,n){let r=n(),o=0,i=r,s=0,l=null;return(a,c,u,f,d,g)=>{const h=n();if(g.has(f1)&&(i=r,s=o,l=a),g.has(Ar))return o=0,r=h,2;g.has(zi)&&l&&(r=i,o=s,a=l);const p=g.has(l1)||g.has(a1)?0:_C(a,c,f,d,t.isComposing()),y=(()=>{const m=u===null||u.editor===t,x=g.has(s1);if(!x&&m&&g.has(Ti))return 0;if(p===1)return 2;if(a===null)return 1;const v=c._selection;if(!(f.size>0||d.size>0))return v!==null?0:2;const _=typeof e=="number"?e:e.peek();return x===!1&&p!==0&&p===o&&hw.exportJSON()))===JSON.stringify(b.read(()=>k.exportJSON()))}(Array.from(f)[0],a,c)?0:1})();return r=h,o=p,y}}function hg(t,e){t.undoStack=[],t.redoStack=[],t.current=null,e&&e(t)}function CC(t,e,n,r=Date.now,o,i=null){const s=vC(t,n,r),l=()=>{o&&o(e)};return l(),tt(t.registerCommand(oa,()=>(function(a,c,u){const f=c.redoStack,d=c.undoStack;if(d.length!==0){const g=c.current,h=d.pop();g!==null&&(f.push(g),a.dispatchCommand(Nr,!0)),d.length===0&&a.dispatchCommand(Mr,!1),c.current=h||null,u&&u(c),h&&h.editor.setEditorState(h.editorState,{tag:Ar})}}(t,e,o),!0),ee),t.registerCommand(ia,()=>(function(a,c,u){const f=c.redoStack,d=c.undoStack;if(f.length!==0){const g=c.current;g!==null&&(d.push(g),a.dispatchCommand(Mr,!0));const h=f.pop();f.length===0&&a.dispatchCommand(Nr,!1),c.current=h||null,u&&u(c),h&&h.editor.setEditorState(h.editorState,{tag:Ar})}}(t,e,o),!0),ee),t.registerCommand(T_,()=>(hg(e,o),!1),ee),t.registerCommand(k_,()=>(hg(e,o),t.dispatchCommand(Nr,!1),t.dispatchCommand(Mr,!1),!0),ee),t.registerUpdateListener(({editorState:a,prevEditorState:c,dirtyLeaves:u,dirtyElements:f,tags:d})=>{const g=e.current,h=e.redoStack,p=e.undoStack,y=g===null?null:g.editorState;if(g!==null&&a===y)return;const m=s(c,a,g,u,f,d);if(m===1){if(h.length!==0&&(e.redoStack=[],t.dispatchCommand(Nr,!1)),g!==null){p.push({...g});const x=typeof i=="number"||i===null?i:i.peek();x!==null&&p.length>x&&p.splice(0,p.length-x),t.dispatchCommand(Mr,!0)}}else if(m===2)return;e.current={editor:t,editorState:a},l()}))}function Uf(){return{current:null,redoStack:[],undoStack:[]}}const Do={build:(t,{delay:e,createInitialHistoryState:n,disabled:r,maxDepth:o,now:i},s)=>({...Kf({delay:e,disabled:r,historyState:n(t),maxDepth:o,now:i}),...s.getInitResult()}),config:{createInitialHistoryState:Uf,delay:300,disabled:typeof window>"u",maxDepth:null,now:Date.now},init:()=>({canRedo:qi(!1),canUndo:qi(!1)}),name:"@lexical/history/History",register:(t,e,n)=>{const{canUndo:r,canRedo:o}=n.getInitResult(),i=n.getOutput(),s=l=>m0(()=>{r.value=l!=null&&l.undoStack.length>0,o.value=l!=null&&l.redoStack.length>0});return ys(()=>{if(!i.disabled.value)return CC(t,i.historyState.value,i.delay,()=>i.now.peek()(),s,i.maxDepth);s(null)})}},bC={build:(t,{disabled:e,parentEditor:n})=>Kf({disabled:e,parentEditor:n||t._parentEditor}),config:{disabled:!1,parentEditor:null},dependencies:[Eo(Do,{disabled:!0})],name:"@lexical/history/SharedHistory",register:(t,e,n)=>ys(()=>{const{disabled:r,parentEditor:o}=n.getOutput();if(!r.value){const{output:i}=n.getDependency(Do),s=function(a){return a?io(a,Do.name):null}(o.value);if(!s)return;const l=s.output;m0(()=>{i.delay.value=l.delay.value,i.historyState.value=l.historyState.value,i.now.value=l.now.value,i.disabled.value=l.disabled.value})}})};function ri(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Fo;function T0(t,e){const{key:n}=e;return t&&n in t?t[n]:e.defaultValue}function k0(t){return Fo&&Fo.editor===t?Fo:void 0}function wC(t,e){if("cfg"in e){const{cfg:n,updater:r}=e;return[n,r(T0(t,n))]}return e}function SC(t,e){let n=e;for(const r of t){const[o,i]=wC(n,r),s=o.key;if(n===e&&T0(n,o)===i)continue;const l=n===e||n===void 0?EC(e):n;l[s]=i,n=l}return n}function EC(t){return Object.create(t||null)}function N0(t,e){return[t,e]}function TC(t,e,n,r=Me()){const o=Fo,i=k0(r);try{return Fo={...i,editor:r,[t]:e},n()}finally{Fo=o}}function kC(t,e=()=>{}){return(n,r=Me())=>o=>{const i=k0(r),s=i&&i[t],l=SC(n,s||e(r));return l&&l!==s?TC(t,l,o,r):o()}}function M0(t,e,n,r){return Object.assign(us(Symbol(e),{isEqual:r,parse:n}),{[t]:!0})}function NC(t){if(!no(t))return;const e=t;if(e.querySelector("style")===null)return;const n=new Map;function r(o){let i=n.get(o);if(i===void 0){i=new Set;for(let s=0;s{for(const l of r)if(!l(i,s))return!1;return!0}),tags:t};var r;const o=i=>Yi(t,[...e,i]);return{[va]:n,attr:(i,s,l)=>o(hu(i,s,l)),classAll:(...i)=>o(L0(i)),classAny:(...i)=>o(function(s){const l=P0(s);return l.length===0?()=>!1:a=>{if(!q(a))return!1;const c=a.classList;for(const u of l)if(c.contains(u))return!0;return!1}}(i)),styleAny:(i,s,l)=>o(function(a,c,u){if(typeof c=="string")return f=>q(f)&&f.style.getPropertyValue(a)===c;if(c instanceof RegExp){const f=u&&u.capture,d=c;return(g,h)=>{if(!q(g))return!1;const p=g.style.getPropertyValue(a);if(!p)return!1;const y=p.match(d);return y!==null&&(f!==void 0&&(h[f]=y),!0)}}ri(362,JSON.stringify(a))}(i,s,l))}}function P0(t){const e=[];for(const n of t)n&&e.push(n);return e}function L0(t){const e=P0(t);return e.length===0?()=>!0:n=>{if(!q(n))return!1;const r=n.classList;for(const o of e)if(!r.contains(o))return!1;return!0}}function hu(t,e,n){if(e===!0)return r=>q(r)&&r.hasAttribute(t);if(typeof e=="string")return r=>q(r)&&r.getAttribute(t)===e;if(e instanceof RegExp){const r=n&&n.capture,o=e;return(i,s)=>{if(!q(i))return!1;const l=i.getAttribute(t);if(l==null)return!1;const a=l.match(o);return a!==null&&(r!==void 0&&(s[r]=a),!0)}}ri(361,JSON.stringify(t))}const RC={kind:"text",predicate:vt,tags:new Set},DC={[va]:RC},FC={kind:"comment",predicate:t=>t.nodeType===8,tags:new Set},HC={[va]:FC},To={any:()=>Yi(new Set,[]),comment:()=>HC,tag(...t){t.length>0||ri(363);const e=new Set;for(const n of t)e.add(n.toUpperCase());return Yi(e,[])},text:()=>DC};function $0(t,e){return q(t)&&t.nodeName===e.toUpperCase()}const I0=/[A-Za-z0-9_-]/;let VC=class{constructor(e,n){this.source=e,this.pos=n}peek(e=0){return this.source[this.pos+e]||""}consume(){return this.source[this.pos++]||""}eof(){return this.pos>=this.source.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}readIdent(){const e=this.pos;for(;!this.eof()&&I0.test(this.peek());)this.pos++;return this.source.slice(e,this.pos)}readQuoted(){const e=this.consume();this.assert(e==='"'||e==="'","expected quote");const n=this.pos;for(;!this.eof()&&this.peek()!==e;)this.peek()==="\\"?this.pos+=2:this.pos++;this.assert(!this.eof(),"unterminated string");const r=this.source.slice(n,this.pos);return this.pos++,r.replace(/\\(.)/g,"$1")}assert(e,n){e||ri(364,String(this.pos+1),n,this.source)}};function BC(t){const e=new Set,n=[],r=[];if(t.skipWhitespace(),t.peek()==="*")t.consume();else if(I0.test(t.peek())){const o=t.readIdent();o&&e.add(o.toUpperCase())}for(;!t.eof();){const o=t.peek();if(o==="."){t.consume();const i=t.readIdent();t.assert(i!=="",'expected class name after "."'),r.push(i)}else if(o==="#"){t.consume();const i=t.readIdent();t.assert(i!=="",'expected id after "#"'),n.push(hu("id",i))}else{if(o!=="[")break;{t.consume(),t.skipWhitespace();const i=t.readIdent();t.assert(i!=="",'expected attribute name after "["'),t.skipWhitespace();let s=!0;if(t.peek()==="="){t.consume(),t.skipWhitespace();const l=t.peek();l==='"'||l==="'"?s=t.readQuoted():(s=t.readIdent(),t.assert(s!=="","expected attribute value")),t.skipWhitespace()}t.assert(t.peek()==="]",'expected "]"'),t.consume(),n.push(hu(i,s))}}}return r.length>0&&n.push(L0(r)),{predicates:n,tags:e}}function jC(t){const e=new VC(t,0),n=[];for(;;){const o=BC(e);if(n.push(o),e.skipWhitespace(),e.eof())break;e.assert(e.peek()===",",'expected "," (selector lists are the only supported combinator)'),e.consume(),e.skipWhitespace()}if(n.length===1)return Yi(n[0].tags,n[0].predicates);const r=new Set;for(const o of n)for(const i of o.tags)r.add(i);return Yi(r,[(o,i)=>{for(const s of n){const l=o.nodeName;if(s.tags.size>0&&!s.tags.has(l))continue;let a=!0;for(const c of s.predicates)if(!c(o,i)){a=!1;break}if(a)return!0}return!1}])}function Gf(t,e,n){return M0(MC,t,e,n)}const gu=Gf("textFormat",()=>0),WC=Gf("textStyle",()=>({}));function zC(t){if(!q(t))return!1;if(t.nodeName==="PRE")return!0;const e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function KC(t){if(vt(t))return!0;if(!q(t))return!1;const e=t.style.display;return e?e.startsWith("inline"):!Uo(t)&&Il(t)}const JC=Gf("whitespaceConfig",()=>({isInline:KC,preservesWhitespace:zC}));function Zf(t){return Fr(t)||te(t)&&!t.isInline()}function R0(t,e){const n=[];let r=[];const o=()=>{r.length!==0&&(n.push(e().splice(0,0,r)),r=[])};for(const i of t)if(Zf(i)){if(o(),O(i)){const s=R0(i.getChildren(),e);i.splice(0,i.getChildrenSize(),s)}n.push(i)}else r.push(i);return o(),n}function D0(t,e){if(!q(e))return t;const n=e.style.textAlign;if(!qf(n))return t;for(const r of t)Fr(r)&&r.getFormatType()===""&&r.setFormat(n);return t}function UC(t,e,n){t.length===1&&rt(t[0])&&(t=[]);const r=re();if(q(n)){const o=n.style.textAlign;qf(o)&&r.setFormat(o)}return[r.splice(0,0,t)]}const F0={$accepts:Zf,$packageRun:UC,name:"BlockSchema"},lo=To,GC=new Set(["center","end","justify","left","right","start"]);function qf(t){return GC.has(t)}const ZC={B:{fontWeight:"bold"},EM:{fontStyle:"italic"},I:{fontStyle:"italic"},S:{textDecoration:"line-through"},STRONG:{fontWeight:"bold"},SUB:{verticalAlign:"sub"},SUP:{verticalAlign:"super"},U:{textDecoration:"underline"}},qC={CODE:X2,MARK:rf},YC=new Set(["font-weight","font-style","text-decoration","vertical-align"]),XC={$import:(t,e)=>{const n=t.get(gu),r=ZC[e.nodeName],o=function(d){return{fontStyle:d.style.fontStyle,fontWeight:d.style.fontWeight,textDecoration:d.style.textDecoration,verticalAlign:d.style.verticalAlign}}(e),i=r?(s=r,{fontStyle:(l=o).fontStyle||s.fontStyle,fontWeight:l.fontWeight||s.fontWeight,textDecoration:l.textDecoration||s.textDecoration,verticalAlign:l.verticalAlign||s.verticalAlign}):o;var s,l;let a=(c=n,u=function(d){let g=0,h=0;const{fontWeight:p,fontStyle:y,textDecoration:m,verticalAlign:x}=d;if(p==="700"||p==="bold"?g|=Ud:p!=="normal"&&p!=="400"||(h|=Ud),y==="italic"?g|=Gd:y==="normal"&&(h|=Gd),m){const v=m.split(" ");v.includes("underline")&&(g|=qd),v.includes("line-through")&&(g|=Zd),v.includes("none")&&(h|=qd|Zd)}return x==="sub"?(g|=qa,h|=Ya):x==="super"?(g|=Ya,h|=qa):x==="baseline"&&(h|=qa|Ya),{clear:h,set:g}}(i),c&~u.clear|u.set);var c,u;const f=qC[e.nodeName];return f&&(a|=f),a===n?t.$importChildren(e):t.$importChildren(e,{context:[N0(gu,a)]})},match:lo.tag("b","strong","em","i","code","mark","s","sub","sup","u","span"),name:"@lexical/html/inline-format"};function gg(t,e,n){let r=t;for(;;){let o=null;for(;(o=e?r.nextSibling:r.previousSibling)===null;){const s=r.parentNode;if(s===null)return null;r=s}if(r=o,!n.isInline(r))return null;let i=r;for(;(i=e?r.firstChild:r.lastChild)!==null;)r=i;if(vt(r))return r;if(r.nodeName==="BR")return null}}function pg(t,e){return e!==0&&D(t)?t.setFormat(e):t}function mg(t,e){if(D(t)){const n=function(r){let o="";for(const i in r)YC.has(i)||(o+=`${i}: ${r[i]}; `);return o.trimEnd()}(e);n!==""&&t.setStyle(n)}return t}const QC={$import:(t,e)=>{const n=t.get(gu),r=t.get(WC),o=t.get(JC);if(function(l,a){let c=l.parentNode;for(;c!==null;){if(a.preservesWhitespace(c))return!0;c=c.parentNode}return!1}(e,o)){const l=Ji(e.textContent||"");for(const a of l)pg(a,n),mg(a,r);return l}const i=function(l,a){let c=(l.textContent||"").replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(c.length===0)return"";if(c[0]===" "){let u=l,f=!0;for(;u!==null&&(u=gg(u,!1,a))!==null;){const d=u.textContent||"";if(d.length>0){/[ \t\n]$/.test(d)&&(c=c.slice(1)),f=!1;break}}f&&(c=c.slice(1))}if(c.length>0&&c[c.length-1]===" "){let u=l,f=!0;for(;u!==null&&(u=gg(u,!0,a))!==null;)if((u.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){f=!1;break}f&&(c=c.slice(0,-1))}return c}(e,o);if(i==="")return[];const s=Pe(i);return pg(s,n),mg(s,r),[s]},match:lo.text(),name:"@lexical/html/#text"},eb={$import:()=>[],match:lo.tag("script","style"),name:"@lexical/html/script-style-ignore"},tb={$import:(t,e)=>P1(e)||L1(e)?[]:[_t()],match:lo.tag("br"),name:"@lexical/html/br"},nb={$import:(t,e)=>{const n=re();if(gn(n,e),ro(e,n),n.getFormatType()===""){const r=e.getAttribute("align");r&&qf(r)&&n.setFormat(r)}return Wt(n,e),[n.splice(0,0,t.$importChildren(e))]},match:lo.tag("p"),name:"@lexical/html/p"},rb={$import:(t,e,n)=>Me().hasNode(so)?[_a()]:n(),match:lo.tag("hr"),name:"@lexical/html/hr"};lo.any();function ob(t,e){const n=[];let r=0,o=0;for(;r{const u=function(d){const g=d[va];return g===void 0&&ri(360),g}(a.match),f=a.name||function(d,g){return d.kind==="text"?`#text@${g}`:d.kind==="comment"?`#comment@${g}`:d.tags.size===0?`*@${g}`:`${Array.from(d.tags).join(",").toLowerCase()}@${g}`}(u,c);if(a.name&&s.add(a.name),e.push({$import:a.$import,name:f,predicate:u.predicate}),u.kind==="text")o.push(c);else if(u.kind==="comment")i.push(c);else if(u.tags.size===0)r.push(c);else for(const d of u.tags){let g=n.get(d);g||(g=[],n.set(d,g)),g.push(c)}});const l=new Map;if(r.length===0)for(const[a,c]of n)l.set(a,c);else for(const[a,c]of n)l.set(a,ob(c,r));return{byTag:l,commentIndices:i,rules:e,textIndices:o,wildcardIndices:r}}function sb(t){const e=[];for(const n of t)if(lb(n))for(const r of n.rules)e.push(r);else e.push(n);return e}function lb(t){return typeof t=="object"&&t!==null&&"__type"in t&&t.__type==="CompiledOverlayRules"}function H0(t){const e=sb(t);return{__type:"CompiledOverlayRules",dispatch:ib(e),rules:e}}To.any();const Ge={any:To.any,comment:To.comment,css:jC,tag:To.tag,text:To.text},V0=new Set(["STYLE","SCRIPT"]);function ab(t,e){NC(e);const n=no(e)?e.body.childNodes:e.childNodes,r=[],o=[];for(const i of n)if(!V0.has(i.nodeName)){const s=j0(i,t,o,!1);if(s!==null)for(const l of s)r.push(l)}return function(i){for(const s of i)s.getParent()&&s.getNextSibling()instanceof Ef&&s.insertAfter(_t());for(const s of i){const l=s.getParent();l&&l.splice(s.getIndexWithinParent(),1,s.getChildren())}}(o),r}function cb(t,e=null,n=Me()){return IC([N0(AC,!0)],n)(()=>{const r=Ce(),o=$C(n),i=$(e)?da(e.anchor.getNode()):null,s=t.append.bind(t);for(const l of(O(i)?i:r).getChildren())B0(n,l,s,e,o);return t})}function ub(t,e=null){return(typeof document>"u"||typeof window>"u"&&global.window===void 0)&&ri(338),q_(t),cb(Te().createElement("div"),e,t).innerHTML}function B0(t,e,n,r=null,o=fa(t)){let i=o.$shouldInclude(e,r,t);const s=o.$shouldExclude(e,r,t);let l=e;r!==null&&D(e)&&(l=u0(r,e,"clone"));const a=o.$exportDOM(l,t),{element:c,after:u,append:f,$getChildNodes:d}=a;if(!c)return!1;const g=Te().createDocumentFragment(),h=d?d():O(l)?l.getChildren():[],p=i&&be(r)&&O(e)?null:r,y=g.append.bind(g);for(const m of h){const x=B0(t,m,y,p,o);!i&&x&&o.$extractWithChild(e,m,r,"html",t)&&(i=!0)}if(i&&!s){if((q(c)||iu(c))&&(f?f(g):c.append(g)),n(c),u){const m=u.call(l,c);m&&(iu(c)?c.replaceChildren(m):c.replaceWith(m))}}else n(g);return i}function j0(t,e,n,r,o=new Map,i){const s=[];if(V0.has(t.nodeName))return s;let l=null;const a=function(h,p){const{nodeName:y}=h,m=p._htmlConversions.get(y.toLowerCase());let x=null;if(m!==void 0)for(const v of m){const _=v(h);_!==null&&(x===null||(x.priority||0)<=(_.priority||0))&&(x=_)}return x!==null?x.conversion:null}(t,e),c=a?a(t):null;let u=null;if(c!==null){u=c.after;const h=c.node;if(l=Array.isArray(h)?h[h.length-1]:h,l!==null){for(const[,p]of o)if(l=p(l,i),!l)break;l&&s.push(...Array.isArray(h)?h:[l])}c.forChild!=null&&o.set(t.nodeName,c.forChild)}const f=t.childNodes;let d=[];const g=(l==null||!ve(l))&&(l!=null&&Fr(l)||r);for(let h=0;h{const h=new Ef;return n.push(h),h}:re)),l==null)if(d.length>0)for(const h of d)s.push(h);else Uo(t)&&function(h){return h.nextSibling==null||h.previousSibling==null?!1:Il(h.nextSibling)&&Il(h.previousSibling)}(t)&&s.push(_t());else O(l)&&l.append(...d);return s}function fb(t,e,n){const r=t.style.textAlign,o=[];let i=[];for(let s=0;s0;if(i&&typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(t,e,{shadowRoots:o});if(s!==null&&function(l,a){for(let c=l;c!==null;){if(c===a)return!0;c=dr(c)}return!1}(s.offsetNode,n))return{node:s.offsetNode,offset:s.offset}}if(i){const s=n.getRootNode();if(Rn(s)){const l=s.elementFromPoint(t,e);if(l!==null&&n.contains(l)){const a=function(c,u,f,d){const g=d.createRange(),h=b=>ub.bottom?u-b.bottom:0,p=b=>cb.right?c-b.right:0,y=d.createTreeWalker(f,NodeFilter.SHOW_TEXT);let m=null,x=1/0,v=1/0;for(let b=y.nextNode();b;b=y.nextNode()){g.selectNodeContents(b);for(const w of g.getClientRects()){const k=h(w),M=p(w);(ke}).createHTML(t):t}const yg=(t,e)=>{if(!$(e))return e.insertRawText(t),!0;const n=r=>{const o=V();$(o)&&r(o)};return E1(t,{linebreak:()=>n(r=>r.insertParagraph()),tab:()=>n(r=>r.insertNodes([fs()])),text:r=>n(o=>o.insertText(r))}),!0},mu={"application/x-lexical-editor":[(t,e,n)=>{try{const r=Me(),o=JSON.parse(t);if(o&&o.namespace===r._config.namespace&&Array.isArray(o.nodes))return xg(r,G0(o.nodes),e),!0}catch(r){console.error(r)}return n()}],"text/html":[(t,e,n)=>{try{const r=Me(),o=new DOMParser().parseFromString(db(t),"text/html");return xg(r,ab(r,o),e),!0}catch(r){return console.error(r),n()}}],"text/plain":[yg],"text/uri-list":[yg]};function hb(t,e,n,r){if(!t)return!1;const o=i=>!!t[i]&&t[i](e,n,o.bind(null,i-1),r);return o(t.length-1)}function W0(t,e,n){const r=e.getData("text/plain");for(const o of function(i){return Object.keys(i.$importMimeType).filter(s=>i.$importMimeType[s]!==void 0).sort((s,l)=>{const a=i.priority[s],c=i.priority[l];return a===void 0&&c===void 0?sl?1:0:a===void 0?1:c===void 0?-1:a-c})}(t)){const i=e.getData(o);if(i&&(o!=="text/html"||i!==r)&&hb(t.$importMimeType[o],i,n,e))return!0}return!1}const gb={$importMimeType:mu,$insertDataTransfer:(t,e)=>W0({$importMimeType:mu,priority:pu},t,e),priority:pu},pb={build:(t,e)=>({$importMimeType:e.$importMimeType,$insertDataTransfer:(n,r)=>W0(e,n,r),priority:e.priority}),config:{$importMimeType:mu,priority:pu},mergeConfig(t,e){const n=ma(t,e);if(e.$importMimeType){const r={...t.$importMimeType};for(const[o,i]of Object.entries(e.$importMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}n.$importMimeType=r}return e.priority&&(n.priority={...t.priority,...e.priority}),n},name:"@lexical/clipboard/Import"};function z0(t,e=V()){return e==null&&ko(166),$(e)&&e.isCollapsed()||e.getNodes().length===0?"":ub(t,e)}function K0(t,e=V()){return e==null&&ko(166),$(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(U0(t,e))}function yu(t,e,n){(function(){const r=gC(pb.name);return r?r.output:gb})().$insertDataTransfer(t,e)}const J0="application/x-lexical-drag";function mb(t,e){const n={editorKey:e.getKey()};t.setData(J0,JSON.stringify(n))}function yb(t,e,n){const r=t.dataTransfer;if(r===null)return!1;const o=function(c){const u=c.getData(J0);if(!u)return null;let f;try{f=JSON.parse(u)}catch{return null}return(d=f)!==null&&typeof d=="object"&&"editorKey"in d&&typeof d.editorKey=="string"?f:null;var d}(r);if(o===null)return!1;const i=function(c,u){const f=Vl(c.clientX,c.clientY,u.getRootElement());if(f===null)return null;const d=un(f.node);if(d===null)return null;if(D(d))return sr(d,"next",f.offset);if(O(d))return cu(d,f.offset,"next");const g=d.getParent();return g===null?null:cu(g,d.getIndexWithinParent()+1,"next")}(t,e);if(i===null)return!1;const s=l0(i);if(s===null)return!1;const l=o.editorKey===e.getKey(),a=V();if(l){if(!$(a)||a.isCollapsed())return!1;if(function(c,u){const{anchor:f,focus:d}=jf(au(u),"next");return Zi(f,c)<0&&Zi(c,d)<0}(i,a))return t.preventDefault(),!0;a.removeText()}if(!s.origin.isAttached())return t.preventDefault(),!0;if(n(r,Go(ms(s)),e),!l){const c=e.getRootElement(),u=c?c.ownerDocument:null,f=u?function(d,g){for(const h of G1(g)){const p=ei(h);if(ps(p)&&p.getKey()===d&&q(h))return h}return null}(o.editorKey,u):null;f!==null&&f.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return t.preventDefault(),!0}function xb(t,e){return yb(t,e,yu)}function xg(t,e,n){t.dispatchCommand(b_,{nodes:e,selection:n})||(n.insertNodes(e),function(r){if($(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=ut(o,"previous");if(s)if($t(s))i=s.origin;else{const l=qt(s,Tt(Ce(),"next").getFlipped());for(const a of l){if(D(a.origin)){i=a.origin;break}if(O(a.origin)&&!a.origin.isInline())break}}if(i&&D(i)){const l=i.getFormat(),a=i.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}}(n))}function xu(t,e,n,r=[]){let o=e===null||n.isSelected(e);const i=O(n)&&n.excludeFromCopy("html");let s=n;e!==null&&D(s)&&(s=u0(e,s,"clone"));const l=O(s)?s.getChildren():[],a=function(u){const f=u.exportJSON(),d=u.constructor;if(f.type!==d.getType()&&ko(58,d.name),O(u)){const g=f.children;Array.isArray(g)||ko(59,d.name)}return f}(s);D(s)&&s.getTextContentSize()===0&&(o=!1);const c=o&&be(e)&&O(n)?null:e;for(let u=0;u0){const f={};for(const d of u){const g=jr(s,d);g===null&&ko(366,s.constructor.name,d);const h=[];xu(t,null,g,h),h.length===1&&h[0].type===g.getType()||ko(385,d,s.constructor.name,String(h.length),String(h.length>0?h[0].type:"none")),f[d]=h[0]}a.$slots=f}}if(o&&!i)r.push(a);else if(Array.isArray(a.children))for(let u=0;u{t.update(()=>{c(vg(t,e,n))})});const r=t.getRootElement(),o=t._window||window,i=o.document,s=ht(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(i.createTextNode("#")),r.append(l);const a=i.createRange();return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise((c,u)=>{const f=t.registerCommand(sa,d=>(Yn(d,ClipboardEvent)&&(f(),mo!==null&&(o.clearTimeout(mo),mo=null),c(vg(t,d,n))),!0),or);mo=o.setTimeout(()=>{f(),mo=null,c(!1)},50),i.execCommand("copy"),l.remove()})}function vg(t,e,n){if(n===void 0){const o=ht(t._window),i=V();if(!i||i.isCollapsed()||!o)return!1;const s=Ht(o,t.getRootElement()),l=s.anchorNode,a=s.focusNode;if(l!==null&&a!==null&&!gs(t,l,a))return!1;n=Z0(i)}e.preventDefault();const r=e.clipboardData;return r!==null&&(q0(r,n),!0)}const _b=[["text/html",z0],["application/x-lexical-editor",K0]];function Z0(t=V()){return function(e,n){const r={"text/plain":""};for(const[o,i]of Object.entries(e))if(i){const s=Cb(i,n);s!==null&&(r[o]=s)}return r}(vb(),t)}function q0(t,e){for(const[n]of _b)e[n]===void 0&&t.setData(n,"");for(const n in e){const r=e[n];r!==void 0&&t.setData(n,r)}}function vb(t=Me()){const e=io(t,bb.name);return e?e.output:Y0}const Y0={"application/x-lexical-editor":[(t,e)=>t?K0(Me(),t):e()],"text/html":[(t,e)=>t?z0(Me(),t):e()],"text/plain":[(t,e)=>t?t.getTextContent():e()]};function Cb(t,e){const n=r=>t[r]?t[r](e,n.bind(null,r-1)):null;return n(t.length-1)}const bb={build:(t,e,n)=>e.$exportMimeType,config:{$exportMimeType:Y0},mergeConfig(t,e){const n=ma(t,e);if(e.$exportMimeType){const r={...t.$exportMimeType};for(const[o,i]of Object.entries(e.$exportMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}n.$exportMimeType=r}return n},name:"@lexical/clipboard/GetClipboardData"},wb={bold:"bold",italic:"italic",strikeThrough:"strikethrough",subscript:"subscript",superscript:"superscript",underline:"underline"},Bl=Symbol.for("@lexical/dragon/WindowState");function Sb(t,e,n){const r=function(o){let i=o[Bl];return i===void 0&&(i={dispose:()=>{},editors:new Map,installs:new Set},o[Bl]=i),i}(t);if(r.installs.size===0){const o=kb.bind(t);t.addEventListener("message",o,!0),r.dispose=()=>{t.removeEventListener("message",o,!0)}}if(r.installs.add(e),n){const o=r.editors.get(n)||new Set;o.add(e),r.editors.set(n,o)}return Eb.bind(null,t,r,e,n)}function Eb(t,e,n,r){if(r){const o=e.editors.get(r);o&&o.delete(n)&&o.size===0&&e.editors.delete(r)}e.installs.delete(n)&&e.installs.size===0&&(e.dispose(),delete t[Bl])}function Cg(t){return t&&t.ownerDocument.defaultView}function Tb(t){const e=oC(()=>Cg(t.getRootElement()),n=>t.registerRootListener(r=>{n.value=Cg(r)}));return ys(()=>{const n=e.value;if(n)return Sb(n,Symbol("@lexical/dragon/editorInstall"),t)})}function kb(t){if(t.origin!==this.location.origin)return;const e=function(r){const o=r[Bl];if(o===void 0)return null;const i=ei(Jo(r.document));return ps(i)&&o.editors.has(i)?i:null}(this);if(e===null)return;const n=t.data;if(typeof n=="string"){let r;try{r=JSON.parse(n)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const o=r.payload;if(o&&o.functionId==="makeChanges"){const i=o.args;if(Array.isArray(i)){const[s,l,a,c,u,f]=i;if(![s,l,c,u].every(Number.isFinite)||typeof a!="string"&&a!==-1)return;e.update(()=>{const d=V();if($(d)){const g=d.anchor;let h=g.getNode(),p=0,y=0;if(D(h)&&s>=0&&l>=0&&(p=s,y=s+l,d.setTextNodeRange(h,p,h,y)),typeof a!="string"||p===y&&a===""||(d.insertRawText(a),h=g.getNode()),D(h)){const m=h.getTextContentSize();p=Math.min(Math.max(c,0),m),y=c<0||u<0?p:Math.min(c+u,m),d.setTextNodeRange(h,p,h,y)}if(typeof f=="string"&&u>0&&!d.isCollapsed()){const m=wb[f];m!==void 0&&d.formatText(m)}t.stopImmediatePropagation()}})}}}}}const Nb={$import:(t,e)=>{const n=Yt(e.nodeName.toLowerCase());return ro(e,n),gn(n,e),Wt(n,e),[n.splice(0,0,t.$importChildren(e))]},match:Ge.tag("h1","h2","h3","h4","h5","h6"),name:"@lexical/rich-text/heading"},Mb={$import:(t,e)=>{const n=ao();return gn(n,e),ro(e,n),Wt(n,e),[n.splice(0,0,t.$importChildren(e))]},match:Ge.tag("blockquote"),name:"@lexical/rich-text/blockquote"};Ge.tag("blockquote");Ge.tag("p"),Ge.tag("span");const bg=U("DRAG_DROP_PASTE_FILE"),pc=us("shadowRoot",{parse:Boolean});let Ca=class X0 extends ft{static getType(){return"quote"}static clone(e){return new X0(e.__key)}$config(){return this.config("quote",{extends:ft,stateConfigs:[{flat:!0,stateConfig:pc}]})}isShadowRoot(){return na(this,pc)}setIsShadowRoot(e){return Oo(this,pc,e)}createDOM(e){const n=Te().createElement("blockquote");return Xt(n,e.theme.quote),n}updateDOM(e,n){return!1}static importDOM(){return{blockquote:e=>({conversion:Ob,priority:0})}}exportDOM(e){const{element:n}=super.exportDOM(e);if(q(n)){this.isEmpty()&&n.append(Te().createElement("br"));const r=this.getFormatType();r&&(n.style.textAlign=r);const o=this.getDirection();o&&(n.dir=o)}return{element:n}}static importJSON(e){return ao().updateFromJSON(e)}exportJSON(){return super.exportJSON()}insertNewAfter(e,n){const r=re(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,n),r}collapseAtStart(){if(this.isShadowRoot()){for(const n of this.getChildren())this.insertBefore(n);return this.remove(),!0}const e=re();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function ao(t){const e=kt(new Ca);return t&&t.shadowRoot?e.setIsShadowRoot(!0):e}function _u(t){return t instanceof Ca}let xs=class Q0 extends ft{constructor(n="h1",r){super(r);P(this,"__tag");this.__tag=n}static getType(){return"heading"}static clone(n){return new Q0(n.__tag,n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__tag=n.__tag}getTag(){return this.getLatest().__tag}setTag(n){const r=this.getWritable();return r.__tag=n,r}createDOM(n){const r=this.__tag,o=Te().createElement(r),i=n.theme.heading;if(i!==void 0){const s=i[r];Xt(o,s)}return o}updateDOM(n,r,o){return n.__tag!==this.__tag}static importDOM(){return{h1:n=>({conversion:yo,priority:0}),h2:n=>({conversion:yo,priority:0}),h3:n=>({conversion:yo,priority:0}),h4:n=>({conversion:yo,priority:0}),h5:n=>({conversion:yo,priority:0}),h6:n=>({conversion:yo,priority:0}),p:n=>{const r=n.firstChild;return r!==null&&wg(r)?{conversion:()=>({node:null}),priority:3}:null},span:n=>wg(n)?{conversion:r=>({node:Yt("h1")}),priority:3}:null}}exportDOM(n){const{element:r}=super.exportDOM(n);if(q(r)){this.isEmpty()&&r.append(Te().createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();i&&(r.dir=i)}return{element:r}}static importJSON(n){return Yt(n.tag).updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setTag(n.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(n,r=!0){const o=n?n.anchor.offset:0,i=this.getLastDescendant(),s=!i||n&&n.anchor.key===i.getKey()&&o===i.getTextContentSize()||!n?re():Yt(this.getTag()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,r),o===0&&!this.isEmpty()&&n){const a=re();a.select(),this.replace(a,!0)}return s}collapseAtStart(){if(this.isEmpty()){const n=re();this.getChildren().forEach(r=>n.append(r)),this.replace(n)}return!0}extractWithChild(){return!0}};function wg(t){return t.nodeName.toLowerCase()==="span"&&t.style.fontSize==="26pt"}function yo(t){const e=t.nodeName.toLowerCase();let n=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(n=Yt(e),ro(t,n),gn(n,t),Wt(n,t)),{node:n}}function Ob(t){const e=ao();return gn(e,t),ro(t,e),Wt(e,t),{node:e}}function Yt(t="h1"){return kt(new xs(t))}function ba(t){return t instanceof xs}function Sg(t){const e=un(t);return te(e)}function xo(t,e,n,r){let o=!1,i=null;if(t.isCollapsed()&&t.anchor.type==="text"){const l=t.anchor.getNode();if(D(l)){i=l;const a=t.anchor.offset,c=a===l.getTextContentSize()&&l.getNextSibling()===null,u=a===0&&l.getPreviousSibling()===null;o=n==="end"&&c||n==="start"&&u||n==="both"&&(c||u)}}let s=!1;for(const[l,a]of Object.entries(r)){if(a==null||!a[e])continue;const c=l;if(a.onlyAtBoundary){if(!(o&&i&&D(i)&&i.hasFormat(c)))continue;s=!0}t.hasFormat(c)&&t.toggleFormat(c)}s&&t.setStyle("")}const Ab={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function Ds(t,e){return function(n,r){if(!n.isCollapsed())return!1;const o=ut(n.focus,r),i=Ne(o.origin,Ro);if(!i)return!1;const s=n.focus.getNode();if(!i.is(s)&&!Ko(s,i))return!1;const l=qt(o,fe(i,r));if(l.getTextSlices().some(f=>f&&f.getTextContentSize()>0))return!1;const a=qt(l.anchor.getSiblingCaret(),l.focus);let c=a.anchor.origin;for(const f of a){if(!ir(f)||!f.origin.is(c.getParent()))return!1;c=f.origin}let u=i;for(const f of pa(fe(i,r))){if(!f.origin.is(u.getParent())){if(rl(f.origin)){const d=fe(u,r);return Go(qt(d,d)),!0}break}if(!Ro(f.origin))break;u=f.origin}return!1}(t,e)||function(n,r){if(!n.isCollapsed()||n.anchor.type!=="element")return!1;const o=ut(n.anchor,r).getNodeAtCaret();return!(!Ro(o)||o.isInline()||(Go(ms(pt(Tt(o,r)))),0))}(t,e)}function Eg(t){return te(t)&&!t.isInline()&&!t.isIsolated()&&t.isKeyboardSelectable()}function Fs(t){const e=Ki();e.add(t),He(e)}function Tg(t,e){if(!t.isCollapsed())return!1;const n=t.focus,r=n.getNode(),o=e?"previous":"next",i=ut(n,o);if(n.type==="element"&&O(r)&&($e(r)||Ro(r))){const m=i.getNodeAtCaret();return!(m===null||!Eg(m))&&(Fs(m.__key),!0)}const s=Ne(O(r)?r:r.getParentOrThrow(),m=>O(m)&&!m.isInline()&&ve(m.getParent()));if(s===null)return!1;const l=fe(s,o).getNodeAtCaret();if(l===null||!Eg(l))return!1;if(s.getTextContentSize()===0)return Fs(l.__key),!0;const a=Me().getRootElement();if(a===null)return!1;const c=ht(a.ownerDocument.defaultView);if(c===null||c.rangeCount===0)return!1;const u=c.anchorNode,f=c.anchorOffset,d=c.focusNode,g=c.focusOffset;c.modify("move",e?"backward":"forward","line");const h=c.anchorNode,p=c.anchorOffset;if(h===null)return kg(c,u,f,d,g),!1;const y=un(h);return kg(c,u,f,d,g),y===null?!1:(h===u&&p===f||!y.is(s)&&!Ko(y,s))&&(Fs(l.__key),!0)}function kg(t,e,n,r,o){e!==null&&r!==null&&t.setBaseAndExtent(e,n,r,o)}function Ng(t,e){if(!t.isCollapsed())return!1;const n=t.focus.getNode(),r=Ne(O(n)?n:n.getParentOrThrow(),y=>O(y)&&!y.isInline());if(r===null)return!1;const o=Me(),i=o.getRootElement();if(i===null)return!1;const s=i.ownerDocument.defaultView;if(s===null)return!1;let l=!1;for(const y of r.getChildren())if(O(y)&&y.isInline()){const m=o.getElementByKey(y.getKey());if(m!==null){const x=s.getComputedStyle(m).display;if(x==="inline-grid"||x==="inline-flex"){l=!0;break}}}if(!l)return!1;const a=fe(r,e?"previous":"next").getNodeAtCaret();if(a===null||!O(a)){if(e){const y=r.getFirstDescendant();D(y)?y.select(0,0):r.select(0,0)}else{const y=r.getLastDescendant();if(D(y)){const m=y.getTextContentSize();y.select(m,m)}else{const m=r.getChildrenSize();r.select(m,m)}}return!0}const c=o.getElementByKey(a.getKey());if(c===null)return!1;const u=ht(s);if(u===null||u.rangeCount===0)return!1;const f=u.getRangeAt(0).cloneRange();f.collapse(!0);const d=f.getBoundingClientRect(),g=c.getBoundingClientRect(),h=g.top+g.height/2;if(d.height>0){const y=Vl(d.left,h,i);if(y!==null&&c.contains(y.node)){const m=i.ownerDocument.createRange();return m.setStart(y.node,y.offset),m.collapse(!0),t.applyDOMRange(m),t.dirty=!0,!0}}const p=e?a.getLastDescendant():a.getFirstDescendant();if(D(p)){const y=e?p.getTextContentSize():0;p.select(y,y)}else{const y=a.getChildrenSize();a.select(e?y:0,e?y:0)}return!0}function Hs(t,e){const n=fe(t,e),r=n.getAdjacentCaret();r!==null&&O(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?Go(ms(n)):e==="next"?t.selectNext(0,0):t.selectPrevious()}function Mg(t,e,n){n.preventDefault(),n.stopPropagation();const r=t.getNodes();if(r.length===0)return!0;const o=r.map(a=>fe(a,"next")).sort(Zi),i=(e?o[0]:o[o.length-1]).origin,s=Ne(i,a=>a!==i&&O(a)&&!a.isInline())??Ce(),l=e?0:s.getChildrenSize();return s.select(l,l),!0}function Pb(t,e=qi(Ab)){return tt(t.registerCommand(af,()=>{const n=V();return be(n)?(n.clear(),!0):($(n)&&xo(n,"click","both",e.peek()),!1)},ee),t.registerCommand(Or,n=>{const r=V();return $(r)?(r.deleteCharacter(n),!0):!!be(r)&&(r.deleteNodes(),!0)},ee),t.registerCommand(Vi,n=>{const r=V();return!!$(r)&&(r.deleteWord(n),!0)},ee),t.registerCommand(Bi,n=>{const r=V();return!!$(r)&&(r.deleteLine(n),!0)},ee),t.registerCommand(Po,n=>{const r=V();if(typeof n=="string")r!==null&&r.insertText(n);else{if(r===null)return!1;const o=n.dataTransfer;if(o!=null)yu(o,r);else if($(r)){const i=n.data;return i&&r.insertText(i),!0}}return!0},ee),t.registerCommand(Xs,()=>{const n=V();return!!$(n)&&(n.removeText(),!0)},ee),t.registerCommand(Sn,n=>{const r=V();return!(!$(r)&&!be(r))&&(m1(r,n),!0)},ee),t.registerCommand(w_,n=>{const r=V();return!(!$(r)&&!be(r))&&(J_(r,n),!0)},ee),t.registerCommand(S_,n=>{const r=V();if(!$(r)&&!be(r))return!1;const o=r.getNodes();for(const i of o){const s=Ne(i,l=>O(l)&&!l.isInline());s!==null&&s.setFormat(n)}return!0},ee),t.registerCommand(Ao,n=>{const r=V();return!!$(r)&&(r.insertLineBreak(n),!0)},ee),t.registerCommand(Hi,()=>{const n=V();return!!$(n)&&(n.insertParagraph(),!0)},ee),t.registerCommand(Um,()=>{const n=fs(),r=V();return $(r)&&(n.setFormat(r.format),n.setStyle(r.style)),wf([n]),!0},ee),t.registerCommand(Cl,()=>uu(n=>{const r=n.getIndent();n.setIndent(r+1)}),ee),t.registerCommand(Zc,()=>uu(n=>{const r=n.getIndent();r>0&&n.setIndent(Math.max(0,r-1))}),ee),t.registerCommand(df,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],"previous"),!0}else if($(r)&&(!n.shiftKey&&Ds(r,"previous")||!n.shiftKey&&Tg(r,!0)||!n.shiftKey&&Ng(r,!0)))return n.preventDefault(),!0;return!1},ee),t.registerCommand(hf,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],"next"),!0}else if($(r)&&(function(o){const i=o.focus;return i.key==="root"&&i.offset===Ce().getChildrenSize()}(r)||!n.shiftKey&&Ds(r,"next")||!n.shiftKey&&Tg(r,!1)||!n.shiftKey&&Ng(r,!1)))return n.preventDefault(),!0;return!1},ee),t.registerCommand(ff,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],Ls(o[0])?"next":"previous"),!0}if(!$(r))return!1;if(!n.shiftKey&&Ds(r,Ls(r.anchor.getNode())?"next":"previous"))return n.preventDefault(),!0;if(n.shiftKey||xo(r,"arrow","start",e.peek()),ig(r,!0)){const o=n.shiftKey;return n.preventDefault(),sg(r,o,!0),!0}return!1},ee),t.registerCommand(Wm,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],Ls(o[0])?"previous":"next"),!0}if(!$(r))return!1;if(!n.shiftKey&&Ds(r,Ls(r.anchor.getNode())?"previous":"next"))return n.preventDefault(),!0;if(n.shiftKey||xo(r,"arrow","end",e.peek()),ig(r,!1)){const o=n.shiftKey;return n.preventDefault(),sg(r,o,!1),!0}return!1},ee),t.registerCommand(pf,n=>{const r=V();if(!be(r)&&Sg(n.target))return!1;if($(r)){if(function(o){if(!o.isCollapsed())return!1;const{anchor:i}=o;if(i.offset!==0)return!1;const s=i.getNode();if($e(s))return!1;const l=p0(s);return l.getIndent()>0&&(l.is(s)||s.is(l.getFirstDescendant()))}(r))return n.preventDefault(),t.dispatchCommand(Zc,void 0);if(rr&&jo)return!1}else if(!be(r))return!1;return n.preventDefault(),t.dispatchCommand(Or,!0)},ee),t.registerCommand(Jm,n=>{const r=V();return!(!be(r)&&Sg(n.target))&&!(!$(r)&&!be(r))&&(n.preventDefault(),t.dispatchCommand(Or,!1))},ee),t.registerCommand(ji,n=>{let r=V();if(be(r)){const o=r.getNodes();o.length===1&&te(o[0])&&!o[0].isInline()&&(r=o[0].selectNext())}if(!$(r))return!1;if(xo(r,"enter","both",e.peek()),n!==null){if((rr||as||cs)&&jo)return!1;if(n.preventDefault(),n.shiftKey)return t.dispatchCommand(Ao,!1)}return t.dispatchCommand(Hi,void 0)},ee),t.registerCommand(mf,()=>{const n=V();return!!$(n)&&(t.blur(),!0)},ee),t.registerCommand(Gm,n=>{const[,r]=$s(n);if(r.length>0){const o=n.clientX,i=n.clientY,s=Vl(o,i,t.getRootElement());if(s!==null){const{offset:l,node:a}=s,c=un(a);if(c!==null){const u=aa();if(D(c))u.anchor.set(c.getKey(),l,"text"),u.focus.set(c.getKey(),l,"text");else{const d=c.getParentOrThrow().getKey(),g=c.getIndexWithinParent()+1;u.anchor.set(d,g,"element"),u.focus.set(d,g,"element")}const f=kr(u);He(f)}t.dispatchCommand(bg,r)}return n.preventDefault(),!0}return xb(n,t)},ee),t.registerCommand(Zm,n=>{const[r]=$s(n),o=V();return!(r&&!$(o))&&($(o)&&!o.isCollapsed()&&n.dataTransfer!==null&&(q0(n.dataTransfer,Z0(o)),mb(n.dataTransfer,t)),!0)},ee),t.registerCommand(qm,n=>{const[r]=$s(n),o=V();if(r&&!$(o))return!1;const i=n.clientX,s=n.clientY,l=Vl(i,s,t.getRootElement());if(l!==null){const a=un(l.node);te(a)&&n.preventDefault()}return!0},ee),t.registerCommand(Ym,()=>{const n=V();return fv($(n)&&da(n.anchor.getNode())!==null?n:null),!0},ee),t.registerCommand(sa,n=>(_g(t,Yn(n,ClipboardEvent)?n:null),!0),ee),t.registerCommand(xf,n=>(async function(r,o){await _g(o,Yn(r,ClipboardEvent)?r:null),o.update(()=>{const i=V();$(i)?i.removeText():be(i)&&i.getNodes().forEach(s=>s.remove())},{tag:a1})}(n,t),!0),ee),t.registerCommand(cf,n=>{const[,r,o]=$s(n);return r.length>0&&!o?(t.dispatchCommand(bg,r),!0):ni(n.target)&&Nf(n.target)?!1:V()!==null&&(function(i,s){i.preventDefault(),s.update(()=>{const l=V(),a=Yn(i,InputEvent)||Yn(i,KeyboardEvent)?null:i.clipboardData;a!=null&&l!==null&&yu(a,l)},{tag:l1})}(n,t),!0)},ee),t.registerCommand(gf,()=>{const n=V();return $(n)&&xo(n,"space","both",e.peek()),!1},ee),t.registerCommand(yf,()=>{const n=V();return $(n)&&xo(n,"tab","both",e.peek()),!1},ee),t.registerCommand(zm,n=>{const r=V();if(be(r))return Mg(r,!1,n);if(!$(r))return!1;const{anchor:o}=r;if(o.type!=="element"||o.offset!==0)return!1;const i=o.getNode();if(!O(i))return!1;const s=i.getFirstChild();if(!te(s)||!s.isInline())return!1;const l=i.getKey(),a=i.selectEnd();return n.shiftKey&&a.anchor.set(l,0,"element"),n.preventDefault(),n.stopPropagation(),!0},ee),t.registerCommand(Km,n=>{const r=V();if(be(r))return Mg(r,!0,n);if(!$(r))return!1;const{anchor:o,focus:i}=r,s=Ne(i.getNode(),c=>O(c)&&!c.isInline());if(s===null)return!1;const l=s.getFirstChild();if(!te(l)||!l.isInline()||Ne(o.getNode(),c=>O(c)&&!c.isInline())!==s)return!1;const a=s.getKey();return(i.type!=="element"||i.key!==a||i.offset!==0)&&(r.focus.set(a,0,"element"),n.shiftKey||r.anchor.set(a,0,"element"),n.preventDefault(),n.stopPropagation(),!0)},ee))}ey.peek=Fb;var Lb=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],$b={canContainEols:["highlight"],enter:{highlight:Ib},exit:{highlight:Rb}};function Ib(t){this.enter({type:"highlight",children:[]},t)}function Rb(t){this.exit(t)}var Db={unsafe:[{character:"=",inConstruct:"phrasing",notInConstruct:Lb}],handlers:{highlight:ey}};function ey(t,e,n,r){const o="=",i=n.createTracker(r),s=n.enter("highlight");let l=i.move(o+o);return l+=i.move(n.containerPhrasing(t,{before:l,after:o,...i.current()})),l+=i.move(o+o),s(),l}function Fb(){return"="}const Hb=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Og={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function ty(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function Vb(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function Bb(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function Ag(t){return Bb(t)||ty(t)}const jb=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function Wb(t,e){const n=e||{},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,o=[];let i=0,s=-1,l="",a,c;n.position&&("start"in n.position||"indent"in n.position?(c=n.position.indent,a=n.position.start):a=n.position);let u=(a?a.line:0)||1,f=(a?a.column:0)||1,d=h(),g;for(i--;++i<=t.length;)if(g===10&&(f=(c?c[s]:0)||1),g=t.charCodeAt(i),g===38){const m=t.charCodeAt(i+1);if(m===9||m===10||m===12||m===32||m===38||m===60||Number.isNaN(m)||r&&m===r){l+=String.fromCharCode(g),f++;continue}const x=i+1;let v=x,_=x,S;if(m===35){_=++v;const F=t.charCodeAt(_);F===88||F===120?(S="hexadecimal",_=++v):S="decimal"}else S="named";let E="",b="",w="";const k=S==="named"?Ag:S==="decimal"?ty:Vb;for(_--;++_<=t.length;){const F=t.charCodeAt(_);if(!k(F))break;w+=String.fromCharCode(F),S==="named"&&Hb.includes(w)&&(E=w,b=Fd(w))}let M=t.charCodeAt(_)===59;if(M){_++;const F=S==="named"?Fd(w):!1;F&&(E=w,b=F)}let A=1+_-x,R="";if(!(!M&&n.nonTerminated===!1))if(!w)S!=="named"&&p(4,A);else if(S==="named"){if(M&&!b)p(5,1);else if(E!==w&&(_=v+E.length,A=1+_-v,M=!1),!M){const F=E?1:3;if(n.attribute){const H=t.charCodeAt(_);H===61?(p(F,A),b=""):Ag(H)?b="":p(F,A)}else p(F,A)}R=b}else{M||p(2,A);let F=Number.parseInt(w,S==="hexadecimal"?16:10);if(zb(F))p(7,A),R="�";else if(F in Og)p(6,A),R=Og[F];else{let H="";Kb(F)&&p(6,A),F>65535&&(F-=65536,H+=String.fromCharCode(F>>>10|55296),F=56320|F&1023),R=H+String.fromCharCode(F)}}if(R){y(),d=h(),i=_-1,f+=_-x+1,o.push(R);const F=h();F.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,R,{start:d,end:F},t.slice(x-1,_)),d=F}else w=t.slice(x-1,_),l+=w,f+=w.length,i=_-1}else g===10&&(u++,s++,f=0),Number.isNaN(g)?y():(l+=String.fromCharCode(g),f++);return o.join("");function h(){return{line:u,column:f,offset:i+((a?a.offset:0)||0)}}function p(m,x){let v;n.warning&&(v=h(),v.column+=x,v.offset+=x,n.warning.call(n.warningContext||void 0,jb[m],v,m))}function y(){l&&(o.push(l),n.text&&n.text.call(n.textContext||void 0,l,{start:d,end:h()}),l="")}}function zb(t){return t>=55296&&t<=57343||t>1114111}function Kb(t){return t>=1&&t<=8||t===11||t>=13&&t<=31||t>=127&&t<=159||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534}const Jb=/["&'<>`]/g,Ub=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Gb=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zb=/[|\\{}()[\]^$+*?.]/g,Pg=new WeakMap;function qb(t,e){if(t=t.replace(e.subset?Yb(e.subset):Jb,r),e.subset||e.escapeOnly)return t;return t.replace(Ub,n).replace(Gb,r);function n(o,i,s){return e.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,s.charCodeAt(i+2),e)}function r(o,i,s){return e.format(o.charCodeAt(0),s.charCodeAt(i+1),e)}}function Yb(t){let e=Pg.get(t);return e||(e=Xb(t),Pg.set(t,e)),e}function Xb(t){const e=[];let n=-1;for(;++n"}}function n9(t){const e={},n=e.quote||'"',r=e.quoteSmart||!1,o=e.tightSelfClosing||!1,i=e.printWidth||Number.POSITIVE_INFINITY,s=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize attribute values with `"+n+"` for `options.quote`, expected `\"`, or `'`");return l.peek=o9,{handlers:{mdxJsxFlowElement:l,mdxJsxTextElement:l},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function l(a,c,u,f){const d=a.type==="mdxJsxFlowElement",g=a.name?!a.children||a.children.length===0:!1,h=ry(u),p=oy(h),y=u.createTracker(f),m=u.createTracker(f),x=[],v=(d?p:"")+"<"+(a.name||""),_=u.enter(a.type);if(y.move(v),m.move(v),a.attributes&&a.attributes.length>0){if(!a.name)throw new Error("Cannot serialize fragment w/ attributes");let k=-1;for(;++kHd(R,s)?s:n;H=W+e9(R,{subset:[W]})+W}A=F+(H?"=":"")+H}x.push(A)}}let S=!1;const E=x.join(" ");d&&(/\r?\n|\r/.test(E)||y.current().now.column+E.length+(g?o?2:3:1)>i)&&(S=!0);let b=y,w=v;if(S){b=m;let k=-1;for(;++ke.push(_t()),tab:()=>e.push(fs()),text:n=>e.push(Pe(n))}),e}function nu(t){const e=[];for(const n of t)rt(n)||(!O(n)&&!te(n)||n.isInline()?e.push(n):O(n)&&e.push(...nu(n.getChildren())));return e}function hi(t){let e=t;t.isCollapsed()||e.removeText();const n=V();$(n)&&(e=n),$(e)||I(161);const r=e.anchor;let o=r.getNode(),i=r.offset;for(;!Xe(o)&&Qe(o)===null;){const s=o;if([o,i]=G_(o,i),s.is(o))break}return i}function G_(t,e){const n=t.getParent();if(!n){const o=re();return Ce().append(o),o.select(),[Ce(),0]}if(D(t)){const o=t.splitText(e);if(o.length===0)return[n,t.getIndexWithinParent()];const i=e===0?0:1;return[n,o[0].getIndexWithinParent()+i]}if(!O(t)||e===0)return[n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const o=new Xr(cn(t.__key,e,"element"),cn(t.__key,e,"element"),0,""),i=t.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[n,t.getIndexWithinParent()+1]}function Ih(t){return rt(t)||hv(t)||D(t)||t.isParentRequired()}function oc(t){const e=re();let n=null;for(let r=0;r99&&I(14)}function Bn(){return Je===null&&I(195,T1()),Je}function Z_(t){Bn()!==null&&Fe===null&&(Fe=t),Fe!==t&&mm(378)}function he(){return Fe===null&&I(337,T1()),Fe}function q_(){he()._dirtyType=2}function T1(){let t=0;const e=new Set,n=Hr.version;if(typeof window<"u")for(const o of U1(document)){const i=ei(o);if(ps(i))t++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function k1(){return Fe}function Dh(t,e,n){const r=e.__type,o=I1(t,r);let i=n.get(r);i===void 0&&(i=Array.from(o.transforms),n.set(r,i));const s=i.length;for(let l=0;l0&&Vh(r,r._deferred));const a=r._editorState,c=a._selection,u=i._selection,f=r._dirtyType!==0,d=Je,g=yt,h=Fe,p=r._updating,y=r._observer;let m=null;if(r._pendingEditorState=null,r._editorState=i,!l&&f&&y!==null){Fe=r,Je=i,yt=!1,r._updating=!0;try{const w=r._dirtyType,k=r._dirtyElements,M=r._dirtyLeaves;y.disconnect(),m=v_(a,i,r,w,k,M)}catch(w){if(w instanceof Error&&r._onError(w),ic)throw w;return L1(r,null,s,i),Tm(r),r._dirtyType=2,ic=!0,qn(r,a),void(ic=!1)}finally{y.observe(s,Rh),r._updating=p,Je=d,yt=g,Fe=h}}i._readOnly||(i._readOnly=!0);const x=r._dirtyLeaves,v=r._dirtyElements,_=r._normalizedNodes,S=r._updateTags;f&&(r._dirtyType=0,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set),r._updateTags=new Set,function(w,k){const M=w._decorators;let A=w._pendingDecorators||M;const R=k._nodeMap;let F;for(F in A)R.has(F)||(A===M&&(A=V1(w)),delete A[F])}(r,i);const E=l?null:ht(Ct(r));if(r._editable&&E!==null&&(f||u===null||u.dirty||!u.is(c))&&s!==null&&!S.has(c1)){Fe=r,Je=i;try{if(y!==null&&y.disconnect(),f||u===null||u.dirty){const w=r._blockCursorElement;w!==null&&$l(w,r,s),U_(c,u,r,E,S,s)}(function(w,k,M){let A=w._blockCursorElement;if($(M)&&M.isCollapsed()&&M.anchor.type==="element"&&k.contains(Ui(k))){const R=M.anchor,F=R.getNode(),H=R.offset;let W=!1,z=null;if(H===F.getChildrenSize())rl(F.getChildAtIndex(H-1))&&(W=!0);else{const B=F.getChildAtIndex(H);if(B!==null&&rl(B)){const K=B.getPreviousSibling();(K===null||rl(K))&&(W=!0,z=w.getElementByKey(B.__key))}}if(W){const B=Vt(F,w.getElementByKey(F.__key),w).element;return A===null&&(w._blockCursorElement=A=function(K){const J=K.theme,X=Te().createElement("div");X.contentEditable="false",X.setAttribute("data-lexical-cursor","true");let ie=J.blockCursor;if(ie!==void 0){if(typeof ie=="string"){const xe=Nn(ie);ie=J.blockCursor=xe}ie!==void 0&&X.classList.add(...ie)}return X}(w._config)),k.style.caretColor="transparent",void(z===null?B.appendChild(A):B.insertBefore(A,z))}}A!==null&&$l(A,w,k)})(r,s,u)}finally{y!==null&&y.observe(s,Rh),Fe=h,Je=d}}m!==null&&function(w,k,M,A,R){const F=Array.from(w._listeners.mutation),H=F.length;for(let W=0;W{sc.delete(A),A._cascadeCount=0},0))}(w),w._cascadeCount++>99)return w._updates=[],w._cascadeCount=0,void w._onWarn(new Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${w._config.namespace}`));const M=k.shift();if(M){const[A,R]=M;ca(w,A,R)}}(r)})(t,e)}finally{tl=n}}function ki(t,e,n,...r){const o=e._updating;e._updating=n;try{const i=e._listeners[t],s=Array.from(i);for(const[l,a]of s){a&&a();const c=l(...r);i.has(l)?i.set(l,c):c&&c()}}finally{e._updating=o}}function M1(t,e,n,r){const o=Mf(t);let i;if(!tl)for(let s=0;s=0;s--)for(let l=0;l0&&a._updating){i=a;break}const c=a._commands.get(e);if(c!==void 0){const u=c[s];if(u.size>0){let f=!1;if(Pt(a,()=>{for(const d of u)if(d(n,r))return void(f=!0)}),f)return f}}}return i&&i.update(()=>{M1(i,e,n,r)}),!1}function Vh(t,e){if(t._deferred=[],e.length!==0){const n=t._updating;t._updating=!0;try{for(let r=0;r0||R>0;){if(M>0){v._dirtyLeaves=new Set;for(const F of k){const H=E.get(F);D(H)&&H.isAttached()&&H.isSimpleText()&&!H.isUnmergeable()&&ah(H),H!==void 0&&Fh(H,b)&&Dh(v,H,w),_.add(F)}if(k=v._dirtyLeaves,M=k.size,M>0){nl++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(const F of A){const H=F[0],W=F[1];if(S.set(H,W),!W)continue;const z=E.get(H);z!==void 0&&Fh(z,b)&&Dh(v,z,w)}k=v._dirtyLeaves,M=k.size,A=v._dirtyElements,R=A.size,nl++}v._dirtyLeaves=_,v._dirtyElements=S}(a,t),Bh(t),function(x,v,_,S){const E=x._nodeMap,b=v._nodeMap,w=[];for(const[A]of S){const R=b.get(A);R!==void 0&&(R.isAttached()||(O(R)&&_l(R,A,E,b,w,S),E.has(A)||S.delete(A),w.push(A)))}for(const A of _){const R=b.get(A);R===void 0||R.isAttached()||(kn(R)&&R.__slots!==null&&_l(R,A,E,b,w,_),E.has(A)||_.delete(A),w.push(A))}for(const A of w)b.delete(A);const k=he(),M=k._compositionKey;M===null||b.has(M)||(k._compositionKey=null)}(l,a,t._dirtyLeaves,t._dirtyElements)),y!==t._compositionKey&&(a._flushSync=!0);const m=a._selection;if($(m)){t._slotsUsed&&C1(m);const x=a._nodeMap,v=m.anchor.key,_=m.focus.key;x.get(v)!==void 0&&x.get(_)!==void 0||I(19)}else be(m)&&m._nodes.size===0&&(a._selection=null)}catch(y){return y instanceof Error&&t._onError(y),t._pendingEditorState=l,t._dirtyType=2,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void qn(t)}finally{Je=u,yt=f,Fe=d,t._updating=g,nl=0}t._dirtyType!==0||t._deferred.length>0||function(y,m){const x=m.getEditorState()._selection,v=y._selection;if(v!==null){if(v.dirty||!v.is(x))return!0}else if(x!==null)return!0;return!1}(a,t)?a._flushSync?(a._flushSync=!1,qn(t)):c&&lv(()=>{qn(t)}):(a._flushSync=!1,c&&(r.clear(),t._deferred=[],t._pendingEditorState=null))}function Pt(t,e,n){Fe===t&&n===void 0?e():ca(t,e,n)}function X_(t){if(ve(t)){let e=null;for(const n of t.getChildren())e=n.isInline()?(e||n.replace(n.createParentElementNode())).append(n):null}}class ft extends mt{constructor(n){super(n);P(this,"__first");P(this,"__last");P(this,"__size");P(this,"__format");P(this,"__style");P(this,"__indent");P(this,"__dir");P(this,"__textFormat");P(this,"__textStyle");P(this,"__slotHost");P(this,"__slots");this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="",this.__slotHost=null,this.__slots=null}$config(){return this.config(Symbol.for("ElementNode"),{$transform:X_,extends:mt})}afterCloneFrom(n){super.afterCloneFrom(n),this.__key===n.__key&&(this.__first=n.__first,this.__last=n.__last,this.__size=n.__size,this.__slotHost=n.__slotHost,this.__slotHost!==null&&this.__parent!==null&&I(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=n.__slots),this.__indent=n.__indent,this.__format=n.__format,this.__style=n.__style,this.__dir=n.__dir,this.__textFormat=n.__textFormat,this.__textStyle=n.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const n=this.getFormat();return i_[n]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const n=[];let r=this.getFirstChild();for(;r!==null;)n.push(r),r=r.getNextSibling();return n}getChildrenKeys(){const n=[];let r=this.getFirstChild();for(;r!==null;)n.push(r.__key),r=r.getNextSibling();return n}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&Lt(this).length===0}isDirty(){const n=he()._dirtyElements;return n!==null&&n.has(this.__key)}isLastChild(){const n=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(n)}getAllTextNodes(){const n=[];for(const o of Lt(this)){const i=jr(this,o);O(i)&&n.push(...i.getAllTextNodes())}let r=this.getFirstChild();for(;r!==null;){if(D(r)&&n.push(r),O(r)){const o=r.getAllTextNodes();n.push(...o)}r=r.getNextSibling()}return n}getFirstDescendant(){let n=this.getFirstChild();for(;O(n);){const r=n.getFirstChild();if(r===null)break;n=r}return n}getLastDescendant(){let n=this.getLastChild();for(;O(n);){const r=n.getLastChild();if(r===null)break;n=r}return n}getDescendantByIndex(n){const r=this.getChildren(),o=r.length;if(n>=o){const s=r[o-1];return O(s)&&s.getLastDescendant()||s||null}const i=r[n];return O(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const n=this.getLatest().__first;return n===null?null:Se(n)}getFirstChildOrThrow(){const n=this.getFirstChild();return n===null&&I(45,this.__key),n}getLastChild(){const n=this.getLatest().__last;return n===null?null:Se(n)}getLastChildOrThrow(){const n=this.getLastChild();return n===null&&I(96,this.__key),n}getChildAtIndex(n){const r=this.getChildrenSize();let o,i;if(n=n;){if(i===n)return o;o=o.getPreviousSibling(),i--}return null}getTextContent(){let n=t0(this);const r=this.getChildren(),o=r.length;for(let i=0;ir.remove()),n}append(...n){return this.splice(this.getChildrenSize(),0,n)}setDirection(n){const r=this.getWritable();return r.__dir=n,r}setFormat(n){return this.getWritable().__format=n!==""&&xl[n]||0,this}setStyle(n){return this.getWritable().__style=n||"",this}setTextFormat(n){const r=this.getWritable();return r.__textFormat=n,r}setTextStyle(n){const r=this.getWritable();return r.__textStyle=n,r}setIndent(n){return this.getWritable().__indent=n,this}splice(n,r,o){Sl(this)&&I(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();n+r<=i||I(226,String(n),String(r),String(i));for(const h of o);const l=s.__key,a=[],c=[],u=this.getChildAtIndex(n+r);let f=null,d=i-r+o.length;if(n!==0)if(n===i)f=this.getLastChild();else{const h=this.getChildAtIndex(n);h!==null&&(f=h.getPreviousSibling())}if(r>0){let h=f===null?this.getFirstChild():f.getNextSibling();for(let p=0;p0&&(r.style.paddingInlineStart=40*o+"px",r.setAttribute("data-lexical-indent",String(o)));const i=this.getDirection();i&&(r.dir=i)}return{element:r}}exportJSON(){const n={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),o=this.getTextStyle();return r===0&&o===""||ve(this)||this.getChildren().some(D)||(r!==0&&(n.textFormat=r),o!==""&&(n.textStyle=o)),n}updateFromJSON(n){return super.updateFromJSON(n).setFormat(n.format).setIndent(n.indent).setDirection(n.direction).setTextFormat(n.textFormat||0).setTextStyle(n.textStyle||"")}insertNewAfter(n,r){return null}canIndent(){return!0}collapseAtStart(n){return!1}excludeFromCopy(n){return!1}canReplaceWith(n){return!0}canInsertAfter(n){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(n){return!1}extractWithChild(n,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(n,r){const o=Vt(this,n,r);let i=o.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const l=r.getElementByKey(s.getKey());l!==null&&(i==null?(o.insertChild(l),i=l):i!==l&&o.replaceChild(l,i),i=i.nextSibling)}}}function O(t){return t instanceof ft}function jh(t,e,n){let r=t.getNode();for(;r;){const o=r.__key;if(e.has(o)&&!n.has(o))return!0;r=r.getParent()}return!1}class ds extends mt{constructor(n){super(n);P(this,"__slotHost");P(this,"__slots");this.__slotHost=null,this.__slots=null}afterCloneFrom(n){super.afterCloneFrom(n),this.__key===n.__key&&(this.__slotHost=n.__slotHost,this.__slotHost!==null&&this.__parent!==null&&I(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=n.__slots)}decorate(n,r){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function te(t){return t instanceof ds}class eo extends ft{constructor(){super("root");P(this,"__cachedText");this.__cachedText=null}static getType(){return"root"}static clone(){return new eo}getTopLevelElementOrThrow(){I(51)}getTextContent(){const n=this.__cachedText;return n===null||!Wo()&&he()._dirtyType!==0?super.getTextContent():n}remove(){I(52)}replace(n){I(53)}insertBefore(n){I(54)}insertAfter(n){I(55)}updateDOM(n,r){return!1}splice(n,r,o){for(const i of o)O(i)||te(i)||I(282);return super.splice(n,r,o)}static importJSON(n){return Ce().updateFromJSON(n)}collapseAtStart(){return!0}}function $e(t){return t instanceof eo}function O1(t){return new hs(bm(t._nodeMap),null,t._slotsUsed)}function Sf(){return new hs(new Map([["root",new eo]]),null,!1)}function ru(t){const e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&I(130,n.name),O(t)){const o=e.children;Array.isArray(o)||I(59,n.name);const i=t.getChildren();for(let s=0;s0){const o={};for(const i of r){const s=jr(t,i);s===null&&I(366,n.name,i),o[i]=ru(s)}e.$slots=o}return e}function Q_(t){return t instanceof hs}class hs{constructor(e,n=null,r=!1){P(this,"_nodeMap");P(this,"_selection");P(this,"_flushSync");P(this,"_readOnly");P(this,"_parsed");P(this,"_slotsUsed");this._nodeMap=e,this._selection=n||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=r}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,n){return Hh(n&&n.editor||null,this,e)}clone(e){const n=new hs(this._nodeMap,e===void 0?this._selection:e,this._slotsUsed);return n._readOnly=!0,n}toJSON(){return Hh(null,this,()=>({root:ru(Ce())}))}}class Ef extends ft{static getType(){return"artificial"}createDOM(e){return Te().createElement("div")}}class to extends mt{static getType(){return"linebreak"}static clone(e){return new to(e.__key)}constructor(e){super(e)}getTextContent(){return` +`}createDOM(){return Te().createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>A1(e)||P1(e)?null:{conversion:ev,priority:0}}}static importJSON(e){return _t().updateFromJSON(e)}}function ev(t){return{node:_t()}}function _t(){return kt(new to)}function rt(t){return t instanceof to}function A1(t){const e=t.parentElement;if(e!==null&&Uo(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Al(n)){const r=e.lastChild;if(r===t||r.previousSibling===t&&Al(r))return!0}}return!1}function P1(t){const e=t.parentElement;if(e!==null&&Uo(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Al(n))return!1;const r=e.lastChild;if(r===t||r.previousSibling===t&&Al(r))return!0}return!1}function Al(t){return vt(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}class fr extends ft{static getType(){return"paragraph"}static clone(e){return new fr(e.__key)}createDOM(e){const n=Te().createElement("p"),r=Io(e.theme,"paragraph");return r!==void 0&&n.classList.add(...r),n}updateDOM(e,n,r){return!1}static importDOM(){return{p:e=>({conversion:tv,priority:0})}}exportDOM(e){const{element:n}=super.exportDOM(e);if(q(n)){this.isEmpty()&&n.append(Te().createElement("br"));const r=this.getFormatType();r&&(n.style.textAlign=r)}return{element:n}}static importJSON(e){return re().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const n=this.getChildren().find(D);n?(e.textFormat=n.getFormat(),e.textStyle=n.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,n){const r=re();r.setTextFormat(e.format),r.setTextStyle(e.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,n),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||D(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function tv(t){const e=re();if(gn(e,t),ro(t,e),e.getFormatType()===""){const n=t.getAttribute("align");n&&n&&n in xl&&e.setFormat(n)}return Wt(e,t),{node:e}}function re(){return kt(new fr)}function Qo(t){return t instanceof fr}function nv(t){console.warn(t)}const ee=0,st=1,or=4,rv=-8;function L1(t,e,n,r,o){const i=t._keyToDOMMap;i.clear(),t._editorState=Sf(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(t._updateTags=new Set,t._updates=[],t._cascadeCount=0),t._blockCursorElement=null,t._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(t._inputState.handledSelectionCommandTimeoutId),t._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};const s=t._observer;s!==null&&(s.disconnect(),t._observer=null),e!==null&&(e.textContent="",function(l,a){const c=`__lexicalKey_${a._key}`;delete l[c]}(e,t)),n!==null&&(n.textContent="",i.set("root",n),H1(n,t,"root"))}function ov(t){const e=new Set,n=new Set;for(const{klass:r,ownNodeConfig:o}of Df(t)){const i=r.transform;if(!n.has(i)){n.add(i);const s=r.transform();s&&e.add(s)}if(o){const s=o.$transform;s&&e.add(s)}}return e}const Pl={$createDOM:(t,e)=>t.createDOM(e._config,e),$decorateDOM:(t,e,n,r)=>{},$exportDOM:(t,e)=>{const n=kf(e,t.getType());return n&&n.exportDOM!==void 0?n.exportDOM(e,t):t.exportDOM(e)},$extractWithChild:(t,e,n,r,o)=>O(t)&&t.extractWithChild(e,n,r),$getDOMSlot:(t,e,n)=>t.getDOMSlot(e),$getSlotTargetElement:(t,e,n,r)=>null,$shouldExclude:(t,e,n)=>O(t)&&t.excludeFromCopy("html"),$shouldInclude:(t,e,n)=>!e||t.isSelected(e),$updateDOM:(t,e,n,r)=>t.updateDOM(e,n,r._config)};function $1(t){const e=t||{},n=k1(),r=e.theme||{},o=t===void 0?n:e.parentEditor||null,i=e.disableEvents||!1,s=Sf(),l=e.namespace||(o!==null?o._config.namespace:j1()),a=e.editorState,c=[eo,Qt,to,Yr,fr,Ef,...e.nodes||[]],{onError:u,onWarn:f,html:d}=e,g=e.editable===void 0||e.editable;let h;if(t===void 0&&n!==null)h=n._nodes;else{h=new Map;for(let y=0;y{Object.keys(S).forEach(E=>{let b=x.get(E);b===void 0&&(b=[],x.set(E,b)),b.push(S[E])})};return y.forEach(S=>{const E=S.klass.importDOM;if(E==null||v.has(E))return;v.add(E);const b=E.call(S.klass);b!==null&&_(b)}),m&&_(m),x}(h,d?d.import:void 0),g,t);return a!==void 0&&(p._pendingEditorState=a,p._dirtyType=2),function(y){y.registerCommand(Fm,O_,ee),y.registerCommand(Hm,A_,ee),y.registerCommand(Vm,P_,ee),y.registerCommand(Bm,L_,ee),y.registerCommand(uf,$_,ee)}(p),p}function iv(t,e){const n=t.get(e);t.delete(e),n&&n()}function gi(t,e,n){return t.set(e,n),iv.bind(null,t,e)}class Hr{constructor(e,n,r,o,i,s,l,a,c){P(this,"_headless");P(this,"_parentEditor");P(this,"_rootElement");P(this,"_editorState");P(this,"_pendingEditorState");P(this,"_compositionKey");P(this,"_deferred");P(this,"_keyToDOMMap");P(this,"_updates");P(this,"_updating");P(this,"_cascadeCount");P(this,"_listeners");P(this,"_commands");P(this,"_nodes");P(this,"_decorators");P(this,"_pendingDecorators");P(this,"_config");P(this,"_dirtyType");P(this,"_cloneNotNeeded");P(this,"_dirtyLeaves");P(this,"_dirtyElements");P(this,"_normalizedNodes");P(this,"_updateTags");P(this,"_observer");P(this,"_key");P(this,"_onError");P(this,"_onWarn");P(this,"_htmlConversions");P(this,"_window");P(this,"_editable");P(this,"_blockCursorElement");P(this,"_slotsUsed");P(this,"_inputState");P(this,"_createEditorArgs");this._createEditorArgs=c,this._parentEditor=n,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Hc,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=j1(),this._onError=i,this._onWarn=s,this._htmlConversions=l,this._editable=a,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return gi(this._listeners.update,e)}registerEditableListener(e){return gi(this._listeners.editable,e)}registerDecoratorListener(e){return gi(this._listeners.decorator,e)}registerTextContentListener(e){return gi(this._listeners.textcontent,e)}registerRootListener(e){const n=this._listeners.root;return tt(gi(n,e,e(this._rootElement,null)||void 0),()=>function(r,o,i){const s=r.get(o);s&&s(),r.set(o,o(...i)||void 0)}(n,e,[null,this._rootElement]))}registerCommand(e,n,r){r===void 0&&I(35);const o=this._commands;o.has(e)||o.set(e,[new di,new di,new di,new di,new di]);const i=o.get(e);i===void 0&&I(36,String(e));const s=function(a){return 7&a}(r),l=i[s];return s!==r?l.addFront(n):l.addBack(n),()=>{l.delete(n),i.every(a=>a.size===0)&&o.delete(e)}}registerMutationListener(e,n,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let s=i.get(n);s===void 0&&(s=new Set,i.set(n,s)),s.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(n,o),()=>{s.delete(o),s.size===0&&i.delete(n)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return n===void 0&&I(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,n){const r=this._editorState,o=Zh(r).get(n.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,n){const r=this.getRegisteredNode(e);return r.transforms.add(n),r}registerNodeTransform(e,n){const r=this.registerNodeTransformToKlass(e,n),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,n);o.push(s)}return function(s,l){const a=Zh(s.getEditorState()),c=[];for(const u of l){const f=a.get(u);f&&c.push(f)}c.length!==0&&s.update(()=>{for(const u of c)for(const f of u.keys()){const d=Se(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:Ti}:void 0)}(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(n))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,n){return j(this,e,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const n=this._rootElement;if(e!==n){const r=Io(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,L1(this,n,e,o,{preserveUpdateQueue:!0}),n!==null&&(this._config.disableEvents||I_(n),r!=null&&n.classList.remove(...r)),e!==null){const i=$f(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,Tm(this),this._updateTags.add(Ti),qn(this),this._config.disableEvents||function(l,a){const c=l.ownerDocument;Yc.set(l,c);let u=bl.get(c);u===void 0&&(u={editors:new Set,hasShadowEditor:void 0},bl.set(c,u)),u.editors.add(a),u.hasShadowEditor=void 0,l.__lexicalEditor=a;const f=n1(l);f.push(M_.register(c));for(let d=0;d{Ch(y)||(vh(y),(a.isEditable()||g==="click")&&h(y,a))}:y=>{if(Ch(y))return;vh(y);const m=a.isEditable();switch(g){case"cut":return m&&j(a,xf,y);case"copy":return j(a,sa,y);case"paste":return m&&j(a,cf,y);case"dragstart":return m&&j(a,Gm,y);case"dragover":return m&&j(a,Zm,y);case"dragend":return m&&j(a,S_,y);case"focus":return m&&j(a,_f,y);case"blur":return m&&j(a,Ym,y);case"drop":return m&&j(a,Um,y)}};f.push(vf(l,g,p))}}(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Ti),qn(this);ki("root",this,!1,e,n)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&I(38);let r=e;r._readOnly&&(r=O1(e),r._selection=e._selection?e._selection.clone():null),Em(this);const o=this._pendingEditorState,i=n!==void 0?n.tag:null;o===null||o.isEmpty()||(i!=null&&this._updateTags.add(i),qn(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,Pt(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(const[s,l]of r._nodeMap.entries())O(l)?this._dirtyElements.set(s,!0):this._dirtyLeaves.add(s)},{discrete:!this._updating||void 0})}parseEditorState(e,n){return function(r,o,i){const s=Sf(),l=Je,a=yt,c=Fe,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,g=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Je=s,yt=!1,Fe=o,Tf(null);try{const h=o._nodes;Ol(r.root,h),i&&i(),s._readOnly=!0,s._parsed=!0}catch(h){h instanceof Error&&o._onError(h)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=g,Je=l,yt=a,Fe=c}return s}(typeof e=="string"?JSON.parse(e):e,this,n)}read(...e){const[n,r]=e.length===1?["force-commit",e[0]]:e;return n==="force-commit"&&qn(this),(n==="pending"?this._pendingEditorState||this._editorState:this.getEditorState()).read(r,{editor:this})}update(e,n){(function(r,o,i){r._updating?r._updates.push([o,i]):ca(r,o,i)})(this,e,n)}focus(e,n={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Pt(this,()=>{const o=V(),i=Ce();o!==null?o.dirty||He(o.clone()):i.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),In("focus"),dv(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const n=ht(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ki("editable",this,!0,e),this._slotsUsed&&this.update(()=>q_()))}toJSON(){return{editorState:this._editorState.toJSON()}}}P(Hr,"version");Hr.version=Cm;let ou=null;function Tf(t){ou=t}let sv=1;function I1(t,e){const n=kf(t,e);return n===void 0&&I(30,e),n}function kf(t,e){return t._nodes.get(e)}const lv=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function Nf(t,e){const n=e!==void 0?e:(()=>{const i=t.getRootNode();return no(i)||Rn(i)?Jo(i):null})();if(!q(n)||n.hasAttribute("data-lexical-slot"))return!1;const r=un(n),o=n.nodeName;return o1(r)&&(o==="INPUT"||o==="TEXTAREA"||n.contentEditable==="true"&&ei(n)==null)}function gs(t,e,n){const r=t.getRootElement();if(!r)return!1;try{if(!e||!r.contains(e)||!r.contains(n))return!1}catch{return!1}return Pr(e)===t&&t.read("latest",()=>!Nf(e))}function ps(t){return t instanceof Hr}function Pr(t){let e=t;for(;e!=null;){const n=ei(e);if(ps(n))return n;e=dr(e)}return null}function ei(t){return t?t.__lexicalEditor:null}function Lr(t){return Dr(t)||t.isToken()}function St(t){return Lr(t)||t.isSegmented()}function vt(t){return ni(t)&&t.nodeType===3}function no(t){return ni(t)&&t.nodeType===9}function av(t){let e=t;for(;e!=null;){if(vt(e))return e;e=e.firstChild}return null}function Vr(t,e,n){const r=$n[e];if(n!==null&&(t&r)===(n&r))return t;let o=t^r;return e==="subscript"?o&=-65:e==="superscript"?o&=-33:e==="lowercase"?(o&=-513,o&=-1025):e==="uppercase"?(o&=-257,o&=-1025):e==="capitalize"&&(o&=-257,o&=-513),o}function R1(t){return D(t)||rt(t)||te(t)}function D1(t,e){const n=function(){const s=ou;return ou=null,s}();if((e=e||n&&n.__key)!=null)return void(t.__key=e);ze(),E1();const r=he(),o=Bn(),i=""+sv++;o._nodeMap.set(i,t),O(t)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType===0&&(r._dirtyType=1),t.__key=i}function En(t){Qe(t)!==null&&I(380,t.__key,String(Qe(t)));const e=t.getParent();if(e!==null){const n=t.getWritable(),r=e.getWritable(),o=t.getPreviousSibling(),i=t.getNextSibling(),s=i!==null?i.__key:null,l=o!==null?o.__key:null,a=o!==null?o.getWritable():null,c=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=l),a!==null&&(a.__next=s),c!==null&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Ll(t){E1(),Sl(t)&&I(323,t.__key,t.__type);const e=t.getLatest(),n=e.__parent!==null?e.__parent:Br(e)?e.__slotHost:null,r=Bn(),o=he(),i=r._nodeMap,s=o._dirtyElements;n!==null&&function(a,c,u){let f=a;for(;f!==null;){if(u.has(f))return;const d=c.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent!==null?d.__parent:Br(d)?d.__slotHost:null}}(n,i,s);const l=e.__key;o._dirtyType===0&&(o._dirtyType=1),O(t)?s.set(l,!0):o._dirtyLeaves.add(l)}function Ke(t){ze();const e=he(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,n!==null){const r=Se(n);r!==null&&r.getWritable()}if(t!==null){const r=Se(t);r!==null&&r.getWritable()}}}function Tn(){return Wo()?null:he()._compositionKey}function Se(t,e){const n=(e||Bn())._nodeMap.get(t);return n===void 0?null:n}function F1(t,e){const n=ti(t,he());return n!==void 0?Se(n,e):null}function H1(t,e,n){t[`__lexicalKey_${e._key}`]=n}function ti(t,e){return t[`__lexicalKey_${e._key}`]}function un(t,e){let n=t;for(;n!=null;){const r=F1(n,e);if(r!==null)return r;n=dr(n)}return null}function V1(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function Wh(t){return t.read(()=>Ce().getTextContent())}function Ce(){return Bn()._nodeMap.get("root")}function He(t){ze();const e=Bn();t!==null&&(t.dirty=!0,t.setCachedNodes(null),$(t)&&he()._slotsUsed&&C1(t)),e._selection=t}function zh(){ze(),Em(he())}function So(t){const e=function(n,r){let o=n;for(;o!=null;){const i=ti(o,r);if(i!==void 0)return i;o=dr(o)}return null}(t,he());return e===null?null:Se(e)}function B1(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Mf(t){const e=[];for(let n=t;n!==null;n=n._parentEditor)e.push(n);return e}function j1(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function W1(t){return vt(t)?t.nodeValue:null}function Of(t,e,n){const r=ht(Ct(e));if(r===null)return;const o=Ht(r,e._rootElement),i=o.anchorNode;let{anchorOffset:s,focusOffset:l}=o;if(i!==null){let a=W1(i);const c=un(i);if(a!==null&&D(c)){if((a===$i||a===of)&&n){const u=n.length;a=n,s=u,l=u}a!==null&&Af(c,a,s,l,t)}}}function Af(t,e,n,r,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();if(i.isToken()&&s)return;let l=e;if((s||o)&&(e.endsWith($i)&&(l=e.slice(0,-$i.length)),o)){const c=of;let u;for(;(u=l.indexOf(c))!==-1;)l=l.slice(0,u)+l.slice(u+c.length),n!==null&&n>u&&(n=Math.max(u,n-c.length)),r!==null&&r>u&&(r=Math.max(u,r-c.length))}const a=i.getTextContent();if(o||l!==a){const c=V();if(l===""){if(Ke(null),as||rr||cs)i.remove();else{const p=he();lc(i,"",c),setTimeout(()=>{p.update(()=>{i.isAttached()&&i.getTextContent()===""&&i.remove()})},20)}return}const u=i.getParent(),f=Qr(),d=i.getTextContentSize(),g=Tn(),h=i.getKey();if(i.isToken()&&!s||g!==null&&h===g&&!s||$(f)&&(u!==null&&!u.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===t.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===t.__key&&f.focus.offset===d&&!i.canInsertTextAfter()&&!s))return void i.markDirty();if(!$(c)||n===null||r===null)return void lc(i,l,c);if(c.setTextNodeRange(i,n,i,r),i.isSegmented()){const p=Pe(i.getTextContent());i.replace(p),i=p}lc(i,l,c)}}}function lc(t,e,n){if(t.setTextContent(e),$(n)){const r=t.getKey();let o=!1;for(const i of["anchor","focus"]){const s=n[i];s.type==="text"&&s.key===r&&(s.offset=an(t,s.offset,"clamp"),o=!0)}o&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function As(t,e,n){const r=e[n]||!1;return r==="any"||r===t[n]}function cv(t,e){return As(t,e,"altKey")&&As(t,e,"ctrlKey")&&As(t,e,"shiftKey")&&As(t,e,"metaKey")}function _e(t,e,n){if(!cv(t,n))return!1;if(t.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1||t.key.length===1&&t.key.charCodeAt(0)<=127)return!1;if(t.code.startsWith("Digit")&&/^\d$/.test(e))return t.code===`Digit${e}`;const r="Key"+e.toUpperCase();return t.code===r}const _n={ctrlKey:!Ut,metaKey:Ut},Kh={altKey:Ut,ctrlKey:!Ut};function Jh(t){return t.key==="Backspace"}function uv(t){const e=Ce();if($(t)){const n=t.anchor,r=t.focus,o=n.getNode();if($e(o))return n.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),kr(t),t;const i=o.getTopLevelElementOrThrow(),s=i.getParent();if(s===null)return O(i)&&(n.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),kr(t)),t;const l=s;return n.set(l.getKey(),0,"element"),r.set(l.getKey(),l.getChildrenSize(),"element"),kr(t),t}{const n=e.select(0,e.getChildrenSize());return He(kr(n)),n}}function Io(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(r!==void 0)return r;const o=t[e];if(typeof o=="string"){const i=Nn(o);return n[e]=i,i}return o}function Pf(t,e,n,r,o){if(n.size===0)return;const i=r.__type,s=r.__key,l=e.get(i);l===void 0&&I(33,i);const a=l.klass;let c=t.get(a);c===void 0&&(c=new Map,t.set(a,c));const u=c.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&c.set(s,f?"updated":o)}function Uh(t,e,n){const r=t.getParent();let o=n,i=t;return r!==null&&(n===0&&(o=i.getIndexWithinParent(),i=r)),i.getChildAtIndex(o-1)}function fv(t,e){const n=t.offset;if(t.type==="element")return Uh(t.getNode(),e,n);{const r=t.getNode();if(n===0||!e){const o=r.getPreviousSibling();return o===null?Uh(r.getParentOrThrow(),e,r.getIndexWithinParent()+0):o}}return null}function z1(t){const e=Ct(t).event,n=e&&e.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function j(t,e,n){return M1(t,e,n,t)}function zo(t,e){const n=t._keyToDOMMap.get(e);return n===void 0&&I(75,e),n}function dr(t){const e=t.assignedSlot||t.parentElement;if(e!==null)return e;const n=t.parentNode;return Rn(n)?n.host:null}function Lf(t){return no(t)?t:q(t)?t.ownerDocument:null}function In(t){ze(),he()._updateTags.add(t)}function dv(t){ze(),he()._deferred.push(t)}function Ko(t,e){let n=t.getParent();for(;n!==null;){if(n.is(e))return!0;n=n.getParent()}return!1}function $f(t){const e=Lf(t);return e?e.defaultView:null}function Ct(t){const e=t._window;return e===null&&I(78),e}function hv(t){return O(t)&&t.isInline()||te(t)&&t.isInline()}function K1(t){let e=t.getLatest();for(;e!==null;){if(Qe(e)!==null&&O(e))return e;const n=e.getParentOrThrow();if(ve(n))return n;e=n}return e}function Ro(t){return O(t)&&t.isShadowRoot()}function ve(t){return $e(t)||Ro(t)}function lt(t,e=!1){const n=t.constructor.clone(t);return D1(n,null),n.afterCloneFrom(t),e||n.resetOnCopyNodeFrom(t),n}function kt(t){const e=he(),n=t.getType(),r=kf(e,n);r===void 0&&I(200,t.constructor.name,n);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(t),l=s.constructor;return i!==null?s instanceof i||I(201,i.name,i.getType(),l.name,l.getType(),t.constructor.name,n):s instanceof t.constructor&&l!==t.constructor||I(202,l.name,l.getType(),t.constructor.name,n),s.__key===t.__key&&I(203,t.constructor.name,n,l.name,l.getType()),s}return t}function ac(t,e){!$e(t.getParent())||O(e)||te(e)||I(99)}function gv(t){const e=Se(t);return e===null&&I(63,t),e}function rl(t){if(!t||t.isInline())return!1;if(te(t))return!0;if(O(t)){if(t.isShadowRoot()){const e=t.getParent();return!(O(e)&&e.isShadowRoot())}return!t.canBeEmpty()}return!1}function $l(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;r!==null&&r.removeChild(t)}function ht(t){return dt?(t||window).getSelection():null}function pv(t){const e=$f(t);return e?e.getSelection():null}function Rn(t){return iu(t)&&"host"in t}const mv=[];function J1(t){const e=t.getRootNode();if(e===t||!Rn(e))return mv;const n=[e];let r=e.host;for(;;){const o=r.getRootNode();if(o===r||!Rn(o))break;n.push(o),r=o.host}return n}function*U1(t){const e=[t];let n;for(;n=e.pop();){yield*n.querySelectorAll('[data-lexical-editor="true"]');const r=(no(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();)o.shadowRoot&&e.push(o.shadowRoot)}}function G1(t){return t!==null?t.ownerDocument:document}function Te(){const t=k1();return G1(t!==null?t._rootElement:null)}function ua(t,e){if(e===null||typeof t.getComposedRanges!="function")return null;const n=J1(e);if(n.length===0)return null;const r=t.getComposedRanges;try{const o=r.call(t,{shadowRoots:n})[0];if(o!==void 0)return o}catch{}try{const o=r.apply(t,n)[0];if(o!==void 0)return o}catch{}return null}function yv(t,e){const n=ua(t,e);if(n!==null){const r=xv(n);if(r!==null)return r}return t.rangeCount>0?t.getRangeAt(0):null}function Ht(t,e){const n=ua(t,e);return n===null?t:_v(n,vv(t))}function xv(t){const e=t.startContainer.ownerDocument;if(e===null)return null;const n=e.createRange();try{return n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset),n}catch{return null}}function _v(t,e){const{startContainer:n,startOffset:r,endContainer:o,endOffset:i}=t;return e==="backward"?{anchorNode:o,anchorOffset:i,direction:e,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:e,focusNode:o,focusOffset:i}}function vv(t){return t.direction}function Ui(t){const e=t.getRootNode();return no(e)||Rn(e)?e.activeElement:null}function Jo(t){let e=t.activeElement;for(;e!==null&&e.shadowRoot!==null;){const n=e.shadowRoot.activeElement;if(n===null)break;e=n}return e}function If(t){const e=t.target;if(e!==null&&q(e)&&e.shadowRoot!==null&&typeof t.composedPath=="function"){const n=t.composedPath();if(n.length>0)return n[0]}return e}function Z1(t){return q(t)&&t.tagName==="A"}function q(t){return ni(t)&&t.nodeType===1}function ni(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function iu(t){return ni(t)&&t.nodeType===11}const Cv=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function Il(t){return!(!q(t)||!t.style.display.startsWith("inline"))||Cv.test(t.nodeName)}const bv=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function Uo(t){return(!q(t)||!t.style.display.startsWith("inline"))&&bv.test(t.nodeName)}function Xe(t){if(te(t)&&!t.isInline())return!0;if(!O(t)||ve(t))return!1;const e=t.getFirstChild(),n=e===null||rt(e)||D(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&n}function Me(){return he()}function fa(t=Me()){return t._config.dom||Pl}function Vt(t,e,n=Me()){const r=fa(n).$getDOMSlot(t,e,n);return O(t)&&(wv(r)||I(344,t.getKey(),t.getType())),r}function wv(t){return t instanceof Mo}function er(t,e,n=Me()){return av(Vt(t,e,n).element)}const Gh=new WeakMap,Sv=new Map;function Zh(t){if(!t._readOnly&&t.isEmpty())return Sv;t._readOnly||I(192);let e=Gh.get(t);return e||(e=function(n){const r=new Map;for(const[o,i]of n._nodeMap){const s=i.__type;let l=r.get(s);l||(l=new Map,r.set(s,l)),l.set(o,i)}return r}(t),Gh.set(t,e)),e}function q1(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function Ev(t){return(e=q1(t))[r1]=!0,e;var e}function ro(t,e){const n=t.getAttribute("data-lexical-indent");if(n!==null){const i=parseInt(n,10);if(Number.isFinite(i)&&i>=0)return void e.setIndent(i)}const r=parseInt(t.style.paddingInlineStart,10)||0,o=Math.round(r/40);e.setIndent(o)}function Wt(t,e){const n=e.getAttribute("dir");return n==="ltr"||n==="rtl"?t.setDirection(n):t}function gn(t,e){const n=e.style.textAlign;return n&&n in xl?t.setFormat(n):t}function Tv(t,e){t.__lexicalUnmanaged=!0,e&&e.captureSelection!==void 0&&(t.__lexicalCapturedSelection=e.captureSelection)}function Y1(t){return t.__lexicalUnmanaged===!0}function kv(t,e=Me()){const n=e.isEditable();t.contentEditable=n?"true":"false",n?t.__lexicalEditor=e:delete t.__lexicalEditor}function Rl(t,e){let n=t;for(;n!=null;){if(n.__lexicalCapturedSelection===!0)return!0;if(q(n)&&n.hasAttribute("data-lexical-slot")||ti(n,e)!==void 0)return!1;n=dr(n)}return!1}function pi(t,e){return function(n,r){return Object.prototype.hasOwnProperty.call(n,r)}(t,e)&&t[e]!==mt[e]}const qh=new WeakMap;function Rf(t){const e=qh.get(t);if(e)return e;const n=t.prototype!=null&&qd in t.prototype?t.prototype[qd]():void 0,r=function(a){if(!(a===mt||a.prototype instanceof mt)){let c="",u="";try{c=a.getType()}catch{}try{Hr.version&&(u=JSON.parse(Hr.version))}catch{}I(290,a.name,c,u)}return a===ds||a===ft||a===mt}(t),o=!r&&pi(t,"getType")?t.getType():void 0;let i,s=o;if(n)if(o)i=n[o];else{for(const[a,c]of Object.entries(n))s=a,i=c;if(!i)for(const a of Object.getOwnPropertySymbols(n)){const c=n[a];if(c){i=c;break}}}if(!r&&s&&(pi(t,"getType")||(t.getType=()=>s),pi(t,"clone")||(t.clone=a=>(Tf(a),new t)),pi(t,"importJSON")||(t.importJSON=i&&i.$importJSON||(a=>new t().updateFromJSON(a))),!pi(t,"importDOM")&&i)){const{importDOM:a}=i;a&&(t.importDOM=()=>a)}const l={klass:t,ownNodeConfig:i,ownNodeType:s};return qh.set(t,l),l}function*Df(t){for(let e=t;e&&(e===mt||o1(e.prototype));){const n=Rf(e);yield n,e=n.ownNodeConfig&&n.ownNodeConfig.extends||Q1(e)}}function X1(t){const e=Me();return ze(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}const Ne=(t,e)=>{let n=t;for(;n!=null&&!$e(n);){if(e(n))return n;n=n.getParent()}return null};function Dl(t,e){const n=[];let r=t.__first;for(;r!==null;){const o=e===null?Se(r):e.get(r);o==null&&I(174),n.push(r),r=o.__next}return n}function Q1(t){const e=Object.getPrototypeOf(t);if(typeof e=="function"&&e!==Function.prototype)return e;const n=t.prototype&&Object.getPrototypeOf(t.prototype);return n?n.constructor:null}const e0=new Map;function kn(t){return O(t)||te(t)}function Br(t){return O(t)||te(t)}function Qe(t){const e=t.getLatest();return Br(e)?e.__slotHost:null}function Zt(t){const e=Qe(t);if(e===null)return null;const n=Se(e);return O(n)||te(n)||I(370),n}function Nv(t){const e=Zt(t);if(e===null)return null;const n=t.getLatest().__key;for(const[r,o]of ha(e))if(o===n)return r;return null}function da(t){let e=t.getLatest();for(;e!==null;){if(Qe(e)!==null)return e;e=e.getParent()}return null}function ha(t){const e=t.getLatest();return kn(e)&&e.__slots!==null?e.__slots:e0}function Lt(t){return Array.from(ha(t).keys())}function jr(t,e){const n=ha(t).get(e);return n===void 0?null:Se(n)}const Mv=["__proto__","constructor","prototype"],Yh=Symbol("slotMapOwner");function su(t){let e=t.__slots;return e!==null&&e[Yh]===t||(e=new Map(e),e[Yh]=t,t.__slots=e),e}const Xh=new WeakMap,Ov=[];function Av(t){for(const{ownNodeConfig:e}of Df(t)){const n=e&&e.slots;if(n)return n}return Ov}function t0(t){let e="";for(const n of Lt(t)){const r=jr(t,n);r!==null&&(e+=r.getTextContent())}return e}function Qh(t,e,n){const r=n.get(t),o=n.get(e);return r!==void 0?o!==void 0?r-o:-1:o!==void 0?1:te?1:0}function Pv(t){const e=t.__slots;if(e===null||e.size<2)return;const n=function(s){let l=Xh.get(s);if(l===void 0){const a=Av(s),c=new Map;for(const u of a)Mv.includes(u)&&I(371,s.name,u),c.has(u)&&I(372,s.name,u),c.set(u,c.size);l=c,Xh.set(s,l)}return l}(t.constructor);let r=null,o=!0;for(const s of e.keys()){if(r!==null&&Qh(r,s,n)>0){o=!1;break}r=s}if(o)return;const i=Array.from(e).sort(([s],[l])=>Qh(s,l,n));e.clear();for(const[s,l]of i)e.set(s,l)}function n0(t,e,n){e!=="__proto__"&&e!=="constructor"&&e!=="prototype"||I(373,e);const r=t.getLatest();if(r.__slots!==null&&r.__slots.get(e)===n.getLatest().__key)return r;(!O(n)&&!te(n)||n.isInline())&&I(374,n.__key);const o=t.getWritable(),i=su(o),s=i.get(e);s!==void 0&&r0(s);const l=n.getWritable(),a=Zt(l);if(a!==null){const c=Nv(l);c!==null&&su(a.getWritable()).delete(c),l.__slotHost=null}return En(l),l.__slotHost=o.__key,i.set(e,l.__key),Pv(o),function(){const c=Me();c._slotsUsed=!0,c._pendingEditorState&&(c._pendingEditorState._slotsUsed=!0)}(),o}function Lv(t,e){const n=t.getWritable();if(n.__slots===null)return n;const r=n.__slots.get(e);return r!==void 0&&(r0(r),su(n).delete(e)),n}function r0(t){const e=Se(t);if(e===null)return;const n=e.getWritable();Br(n)||I(377,t),n.__slotHost=null,n.remove()}const $v={next:"previous",previous:"next"};class Ff{constructor(e){P(this,"origin");this.origin=e}[Symbol.iterator](){return o0({hasNext:ir,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return fe(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return fe(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,n){const r=this.getNodeAtCaret();return e.is(this.origin)||e.is(r)||(r===null?this.insert(e):r.replace(e,n)),this}splice(e,n,r="next"){const o=r===this.direction?n:Array.from(n).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let a=i.getAdjacentCaret();a!==null&&l.size0){const c=i.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||i.origin.is(a))){const u=a.getParent();u&&u.is(s)&&a.remove(),c.replace(a)}}else c===null&&I(263,Array.from(l).join(" "))}else i.insert(a);i=fe(a,this.direction)}for(const a of l.values())a.remove();return this}}class Gi extends Ff{constructor(){super(...arguments);P(this,"type","child")}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:Tt(n,this.direction)}getParentCaret(n="root"){return fe(Hf(this.getParentAtCaret(),n),this.direction)}getFlipped(){const n=hr(this.direction);return fe(this.getNodeAtCaret(),n)||Tt(this.origin,n)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(n){return n instanceof Gi&&this.direction===n.direction&&this.origin.is(n.origin)}isSamePointCaret(n){return this.isSameNodeCaret(n)}}const Iv={root:$e,shadowRoot:ve};function hr(t){return $v[t]}function Hf(t,e="root"){return t===null||Iv[e](t)?null:Qe(t)===null?t:null}class Wr extends Ff{constructor(){super(...arguments);P(this,"type","sibling")}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:fe(n,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return O(this.origin)?Tt(this.origin,this.direction):null}getParentCaret(n="root"){return fe(Hf(this.getParentAtCaret(),n),this.direction)}getFlipped(){const n=hr(this.direction);return fe(this.getNodeAtCaret(),n)||Tt(this.origin.getParentOrThrow(),n)}isSamePointCaret(n){return n instanceof Wr&&this.direction===n.direction&&this.origin.is(n.origin)}isSameNodeCaret(n){return(n instanceof Wr||n instanceof zr)&&this.direction===n.direction&&this.origin.is(n.origin)}}class zr extends Ff{constructor(n,r){super(n);P(this,"type","text");P(this,"offset");this.offset=r}getLatest(){const n=this.origin.getLatest();return n===this.origin?this:sr(n,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(n="root"){return fe(Hf(this.getParentAtCaret(),n),this.direction)}getFlipped(){return sr(this.origin,hr(this.direction),this.offset)}isSamePointCaret(n){return n instanceof zr&&this.direction===n.direction&&this.origin.is(n.origin)&&this.offset===n.offset}isSameNodeCaret(n){return(n instanceof Wr||n instanceof zr)&&this.direction===n.direction&&this.origin.is(n.origin)}getSiblingCaret(){return fe(this.origin,this.direction)}}function $t(t){return t instanceof zr}function ir(t){return t instanceof Wr}function Et(t){return t instanceof Gi}const Rv={next:class extends zr{constructor(){super(...arguments);P(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends zr{constructor(){super(...arguments);P(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Dv={next:class extends Wr{constructor(){super(...arguments);P(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Wr{constructor(){super(...arguments);P(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Fv={next:class extends Gi{constructor(){super(...arguments);P(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Gi{constructor(){super(...arguments);P(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function fe(t,e){return t?new Dv[e](t):null}function sr(t,e,n){return t?new Rv[e](t,an(t,n)):null}function an(t,e,n="error"){const r=t.getTextContentSize();let o=e==="next"?r:e==="previous"?0:e;return(o<0||o>r)&&(n!=="clamp"&&mm(284,String(e),String(r),t.getKey()),o=o<0?0:r),o}function eg(t,e){return new Vv(t,e)}function Tt(t,e){return O(t)?new Fv[e](t):null}function Hv(t){return t&&t.getChildCaret()||t}function ga(t){return t&&Hv(t.getAdjacentCaret())}class Vf{constructor(e,n,r){P(this,"type","node-caret-range");P(this,"direction");P(this,"anchor");P(this,"focus");this.anchor=e,this.focus=n,this.direction=r}getLatest(){const e=this.anchor.getLatest(),n=this.focus.getLatest();return e===this.anchor&&n===this.focus?this:new Vf(e,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=o=>{const i=this[o].getLatest();return $t(i)?function(s,l){const{direction:a,origin:c}=s,u=an(c,l==="focus"?hr(a):a);return eg(s,u-s.offset)}(i,o):null},n=e("anchor"),r=e("focus");if(n&&r){const{caret:o}=n,{caret:i}=r;if(o.isSameNodeCaret(i))return[eg(o,i.offset-o.offset),null]}return[n,r]}iterNodeCarets(e="root"){const n=$t(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=$t(r),i=s=>s.isSameNodeCaret(r)?null:ga(s)||s.getParentCaret(e);return o0({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:n.isSameNodeCaret(r)?null:i(n),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Vv{constructor(e,n){P(this,"type","slice");P(this,"caret");P(this,"distance");this.caret=e,this.distance=n}getSliceIndices(){const{distance:e,caret:{offset:n}}=this,r=n+e;return r{let R;for(let F=E;Fy.has(M.getKey())&&Xe(M));return k&&Lt(k).length>0?null:w&&k?[w,k]:null}(u,f,a);if(d){const[h,p]=d;Tt(h,"previous").splice(0,p.getChildren());let y=p.getParent();for(p.remove(!0);y&&y.isEmpty();){const m=y;y=y.getParent(),m.remove(!0)}}else if(f){const h=function(m){if(Et(m)){const x=m.origin;if(Xe(x))return x}else{const x=m.getParentAtCaret();if(x&&Xe(x))return x}return null}(f),p=h&&h.getParent(),y=h&&h.getParents().findLast(Ro);if(h&&p&&!$e(p)&&h.isEmpty()&&a.has(h.getKey())&&Lt(h).length===0&&(!y||a.has(y.getKey()))){h.remove(!0);let m=p;for(;m&&!$e(m)&&m.isEmpty();){const x=m.getParent();if(x&&$e(x)&&x.getChildrenSize()<=1)break;const v=m;m=x,v.remove(!0)}}}const g=[u,f,...s,...l].find(cc);if(g)return ms(Dn(pt(g),t.direction));I(269,JSON.stringify(s.map(h=>h.origin.__key)))}function pt(t){const e=function(o){let i=o;for(;Et(i);){const s=ga(i);if(!Et(s))break;i=s}return i}(t.getLatest()),{direction:n}=e;if(D(e.origin))return $t(e)?e:sr(e.origin,n,n);const r=e.getAdjacentCaret();return ir(r)&&D(r.origin)?sr(r.origin,n,hr(n)):e}function Bf(t){return $t(t)&&t.offset!==an(t.origin,t.direction)}function Dn(t,e){return t.direction===e?t:t.getFlipped()}function jf(t,e){return t.direction===e?t:qt(Dn(t.focus,e),Dn(t.anchor,e))}function cu(t,e,n){let r=Tt(t,"next");for(let o=0;o0||!i&&l.canBeEmpty()&&o(l,"last"))&&s.insert(e(l).splice(0,0,a))}return s}function Wf(t,e,n){let r=Dn(e,"next");$t(r)&&(r.offset===0?r=fe(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=fe(r.origin,"next"))),r.origin.is(t)&&(ir(r)||I(342,t.getKey(),t.getType()),r=oo(r)),(t.is(r.getNodeAtCaret())||t.is(r.getFlipped().getNodeAtCaret()))&&t.remove(!0);for(let o=r;o;o=s0(o,n))r=o;return $t(r)&&I(283),r.insert(t.isInline()?re().append(t):t),Dn(fe(t.getLatest(),"next"),e.direction)}function Eo(...t){return t}function zv(t,e){return[t,e]}function ma(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return{...t,...e};return t}function Nn(...t){const e=[];for(const n of t)if(n&&typeof n=="string")for(const[r]of n.matchAll(/\S+/g))e.push(r);return e}function Xt(t,...e){const n=Nn(...e);n.length>0&&t.classList.add(...n)}function ya(t,...e){const n=Nn(...e);n.length>0&&t.classList.remove(...n)}function tt(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function rg(t,e,n){return tt(...Object.entries(e).map(([r,o])=>vf(t,r,o,n)))}function l0(t){const e=Me().getElementByKey(t.getKey());if(e===null)return null;const n=e.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(e)}function a0(t){return l0($e(t)?t:t.getParentOrThrow())}function Ls(t){const e=a0(t);return e!==null&&e.direction==="rtl"}function c0(t,e,n="self"){const r=t.getStartEndPoints();if(e.isSelected(t)&&!St(e)&&r!==null){const[o,i]=r,s=t.isBackward(),l=o.getNode(),a=i.getNode(),c=e.is(l),u=e.is(a);if(c||u){const[f,d]=eu(t),g=l.is(a),h=e.is(s?a:l),p=e.is(s?l:a);let y,m=0;g?(m=f>d?d:f,y=f>d?f:d):h?(m=s?d:f,y=void 0):p&&(m=0,y=s?f:d);const x=e.__text.slice(m,y);x!==e.__text&&(n==="clone"&&(e=Ev(e)),e.__text=x)}}return e}function Kv(t,e){const n=t.getFormatType(),r=t.getIndent();n!==e.getFormatType()&&e.setFormat(n),r!==e.getIndent()&&e.setIndent(r)}function Jv(t,e,n){let r=ut(t,n);if(Bf(r))return!1;for(;r;r=r.getParentCaret()){const o=r.getParentAtCaret();if(!o||r.getNodeAtCaret())return!1;if(e.is(o))return!0}return!1}function Uv(t,e,n=Kv){if(!t)return;const r=t.getStartEndPoints();let o=!1,i=null;const s=new Map;if(r){const[l,a]=r,c=Ne(l.getNode(),Xe);i=Ne(a.getNode(),Xe);const u=t.isBackward()?"previous":"next";o=O(i)&&!i.is(c)&&function(f,d,g){const h=f.getNode();return(!O(h)||!h.isEmpty())&&Jv(f,d,g)}(a,i,hr(u)),O(c)&&s.set(c.getKey(),c),O(i)&&!o&&s.set(i.getKey(),i)}for(const l of t.getNodes())if(O(l)&&Xe(l)){if(o&&l.is(i))continue;s.set(l.getKey(),l)}else if(!r){const a=Ne(l,Xe);O(a)&&s.set(a.getKey(),a)}for(const l of s.values()){const a=e();n(l,a),l.replace(a,!0)}}function u0(t){const e=f0(t);return e!==null&&e.writingMode==="vertical-rl"}function f0(t){const e=t.anchor.getNode();return O(e)?l0(e):a0(e)}function og(t,e){let n=u0(t)?!e:e;d0(t)&&(n=!n);const r=ut(t.focus,n?"previous":"next");if(Bf(r))return!1;if($t(r)&&!Dr(r.origin)&&r.origin.isUnmergeable()){const o=r.getNodeAtCaret();if(D(o)&&!Dr(o))return!0}for(const o of pa(r)){if(Et(o))return!o.origin.isInline();if(!O(o.origin)){if(te(o.origin))return!0;break}}return!1}function Gv(t,e,n,r){t.modify(e?"extend":"move",n,r)}function d0(t){const e=f0(t);return e!==null&&e.direction==="rtl"}function ig(t,e,n){const r=d0(t);let o;o=u0(t)||r?!n:n,Gv(t,e,o,"character")}function Zv(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function h0(t,e){let n=t;for(;n!=null;){if(n instanceof e)return n;n=n.getParent()}return null}function g0(t){const e=Ne(t,n=>O(n)&&!n.isInline());return O(e)||Zv(4,t.__key),e}function qv(t){const e=V()||Qr();let n;if($(e))n=ut(e.focus,"next");else{if(e!=null){const s=e.getNodes(),l=s[s.length-1];l&&(n=fe(l,"next"))}n=n||Tt(Ce(),"previous").getFlipped().insert(re())}const r=Wf(t,n),o=ga(r),i=Et(o)?pt(o):r;return Go(ms(i)),t.getLatest()}function Yv(t,e){const n=e();return t.replace(n),n.append(t),n}function Yn(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function $s(t){let e=null;if(Yn(t,DragEvent)?e=t.dataTransfer:Yn(t,ClipboardEvent)&&(e=t.clipboardData),e===null)return[!1,[],!1];const n=e.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(e.files),o]}function uu(t){const e=V();if(!$(e))return!1;const n=new Set,r=e.getNodes();for(let o=0;oO(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!n.has(a)&&(n.add(a),t(l))}return n.size>0}let uc=!(Ln||!dt)&&void 0;function Xv(t,e=!1){let n=1;if(function(){if(uc===void 0){const r=document.createElement("div");r.style.position="absolute",r.style.opacity="0",r.style.width="100px",r.style.left="-1000px",document.body.appendChild(r);const o=r.getBoundingClientRect();r.style.setProperty("zoom","2"),uc=r.getBoundingClientRect().width===o.width,document.body.removeChild(r)}return uc}()||e){const r=t&&t.ownerDocument.defaultView||window;for(;t;)n*=Number(r.getComputedStyle(t).getPropertyValue("zoom")),t=dr(t)}return n}const Qv=Symbol.for("preact-signals");function xa(){if(Mn>1)return void Mn--;let t,e=!1;for(!function(){let n=Fl;for(Fl=void 0;n!==void 0;)n.S.v===n.v&&(n.S.i=n.i),n=n.o}();Ni!==void 0;){let n=Ni;for(Ni=void 0,Hl++;n!==void 0;){const r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&m0(n))try{n.c()}catch(o){e||(t=o,e=!0)}n=r}}if(Hl=0,Mn--,e)throw t}function p0(t){if(Mn>0)return t();fu=++eC,Mn++;try{return t()}finally{xa()}}let ye,Ni;function sg(t){const e=ye;ye=void 0;try{return t()}finally{ye=e}}let Fl,Mn=0,Hl=0,eC=0,fu=0,il=0;function lg(t){if(ye===void 0)return;let e=t.n;return e===void 0||e.t!==ye?(e={i:0,S:t,p:ye.s,n:void 0,t:ye,e:void 0,x:void 0,r:e},ye.s!==void 0&&(ye.s.n=e),ye.s=e,t.n=e,32&ye.f&&t.S(e),e):e.i===-1?(e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=ye.s,e.n=void 0,ye.s.n=e,ye.s=e),e):void 0}function ot(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function qi(t,e){return new ot(t,e)}function m0(t){for(let e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function ag(t){for(let e=t.s;e!==void 0;e=e.n){const n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function y0(t){let e,n=t.s;for(;n!==void 0;){const r=n.p;n.i===-1?(n.S.U(n),r!==void 0&&(r.n=n.n),n.n!==void 0&&(n.n.p=r)):e=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=r}t.s=e}function go(t,e){ot.call(this,void 0),this.x=t,this.s=void 0,this.g=il-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function x0(t){const e=t.m;if(t.m=void 0,typeof e=="function"){Mn++;const n=ye;ye=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,zf(t),r}finally{ye=n,xa()}}}function zf(t){for(let e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,x0(t)}function tC(t){if(ye!==this)throw new Error("Out-of-order effect");y0(this),ye=t,this.f&=-2,8&this.f&&zf(this),xa()}function bo(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e==null?void 0:e.name}function ys(t,e){const n=new bo(t,e);try{n.c()}catch(o){throw n.d(),o}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Kf(t,e={}){const n={};for(const r in t){const o=e[r],i=qi(o===void 0?t[r]:o);n[r]=i}return n}ot.prototype.brand=Qv,ot.prototype.h=function(){return!0},ot.prototype.S=function(t){const e=this.t;e!==t&&t.e===void 0&&(t.x=e,this.t=t,e!==void 0?e.e=t:sg(()=>{var n;(n=this.W)==null||n.call(this)}))},ot.prototype.U=function(t){if(this.t!==void 0){const e=t.e,n=t.x;e!==void 0&&(e.x=n,t.e=void 0),n!==void 0&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,n===void 0&&sg(()=>{var r;(r=this.Z)==null||r.call(this)}))}},ot.prototype.subscribe=function(t){return ys(()=>{const e=this.value,n=ye;ye=void 0;try{t(e)}finally{ye=n}},{name:"sub"})},ot.prototype.valueOf=function(){return this.value},ot.prototype.toString=function(){return this.value+""},ot.prototype.toJSON=function(){return this.value},ot.prototype.peek=function(){const t=ye;ye=void 0;try{return this.value}finally{ye=t}},Object.defineProperty(ot.prototype,"value",{get(){const t=lg(this);return t!==void 0&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Hl>100)throw new Error("Cycle detected");(function(e){Mn!==0&&Hl===0&&e.l!==fu&&(e.l=fu,Fl={S:e,v:e.v,i:e.i,o:Fl})})(this),this.v=t,this.i++,il++,Mn++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{xa()}}}}),go.prototype=new ot,go.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===il))return!0;if(this.g=il,this.f|=1,this.i>0&&!m0(this))return this.f&=-2,!0;const t=ye;try{ag(this),ye=this;const e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ye=t,y0(this),this.f&=-2,!0},go.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}ot.prototype.S.call(this,t)},go.prototype.U=function(t){if(this.t!==void 0&&(ot.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},go.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;t!==void 0;t=t.x)t.t.N()}},Object.defineProperty(go.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=lg(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),bo.prototype.c=function(){const t=this.S();try{if(8&this.f||this.x===void 0)return;const e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}},bo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,x0(this),ag(this),Mn++;const t=ye;return ye=this,tC.bind(this,t)},bo.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ni,Ni=this)},bo.prototype.d=function(){this.f|=8,1&this.f||zf(this)},bo.prototype.dispose=function(){this.d()};function nC(t){return(typeof t.nodes=="function"?t.nodes():t.nodes)||[]}function rC(t,e){let n;return qi(t(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=t(),n=e(this)}})}function we(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let _0;try{_0="0.48.0+prod.esm"}catch{}const oC=_0??'"+source"',iC=new Set(["__proto__","constructor","prototype"]);function v0(t,e){if(t&&e&&!Array.isArray(e)&&typeof t=="object"&&typeof e=="object"){const n=t,r=e;for(const o in r)!iC.has(o)&&Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=v0(n[o],r[o]));return t}return e}const Jf=0,du=1,C0=2,fc=3,Is=4,po=5,dc=6,mi=7;function hc(t){return t.id===Jf}function b0(t){return t.id===C0}function sC(t){return function(e){return e.id===du}(t)||we(305,String(t.id),String(du)),Object.assign(t,{id:C0})}const lC=new Set;let aC=class{constructor(e,n){P(this,"builder");P(this,"configs");P(this,"_dependency");P(this,"_peerNameSet");P(this,"extension");P(this,"state");P(this,"_signal");this.builder=e,this.extension=n,this.configs=new Set,this.state={id:Jf}}mergeConfigs(){let e=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):ma;for(const r of this.configs)e=n(e,r);return e}init(e){const n=this.state;b0(n)||we(306,String(n.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(l,a,c){return Object.assign(l,{config:a,id:fc,registerState:c})}(n,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(e,i.config,r)),this.state=function(l,a,c){return Object.assign(l,{id:Is,initResult:a,registerState:c})}(i,s,o)}build(e){const n=this.state;let r;n.id!==Is&&we(307,String(n.id),String(po)),this.extension.build&&(r=this.extension.build(e,n.config,n.registerState));const o={...n.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=function(i,s,l){return Object.assign(i,{id:po,output:s,registerState:l})}(n,r,o)}register(e,n){this._signal=n;const r=this.state;r.id!==po&&we(308,String(r.id),String(po));const o=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=function(i){return Object.assign(i,{id:dc})}(r),()=>{const i=this.state;i.id!==mi&&we(309,String(r.id),String(mi)),this.state=function(s){return Object.assign(s,{id:po})}(i),o&&o()}}afterRegistration(e){const n=this.state;let r;return n.id!==dc&&we(310,String(n.id),String(dc)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,n.config,n.registerState)),this.state=function(o){return Object.assign(o,{id:mi})}(n),r}getSignal(){return this._signal===void 0&&we(311),this._signal}getInitResult(){this.extension.init===void 0&&we(312,this.extension.name);const e=this.state;return function(n){return n.id>=Is}(e)||we(313,String(e.id),String(Is)),e.initResult}getInitPeer(e){const n=this.builder.extensionNameMap.get(e);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(n){return n.id>=fc}(e)||we(314,String(e.id),String(fc)),{config:e.config}}getPeer(e){const n=this.builder.extensionNameMap.get(e);return n?n.getExtensionDependency():void 0}getInitDependency(e){const n=this.builder.getExtensionRep(e);return n===void 0&&we(315,this.extension.name,e.name),n.getExtensionInitDependency()}getDependency(e){const n=this.builder.getExtensionRep(e);return n===void 0&&we(315,this.extension.name,e.name),n.getExtensionDependency()}getState(){const e=this.state;return function(n){return n.id>=mi}(e)||we(316,String(e.id),String(mi)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||lC}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(n){return n.id>=po})(e)||we(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const cg={tag:Ti};function cC(){const t=Ce();t.isEmpty()&&t.append(re())}const w0={config:{setOptions:cg,updateOptions:cg},init:({$initialEditorState:t=cC})=>({$initialEditorState:t,initialized:!1}),afterRegistration(t,{updateOptions:e,setOptions:n},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(Q_(i))t.setEditorState(i,n);else if(typeof i=="function")t.update(()=>{i(t)},e);else if(i&&(typeof i=="string"||typeof i=="object")){const s=t.parseEditorState(i);t.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[eo,Qt,to,Yr,fr]},ug=Symbol.for("@lexical/extension/LexicalBuilder");function uC(...t){return On.fromExtensions(t).buildEditor()}function fg(){}function fC(t){throw t}function Rs(t){return Array.isArray(t)?t:[t]}const gc=oC;class On{constructor(e){P(this,"roots");P(this,"extensionNameMap");P(this,"outgoingConfigEdges");P(this,"incomingEdges");P(this,"conflicts");P(this,"_sortedExtensionReps");P(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=gc,this.roots=e;for(const n of e)this.addExtension(n)}static fromExtensions(e){const n=[Rs(w0)];for(const r of e)n.push(Rs(r));return new On(n)}static maybeFromEditor(e){const n=e[ug];return n&&(n.PACKAGE_VERSION!==gc&&we(292,n.PACKAGE_VERSION,gc),n instanceof On||we(293)),n}static fromEditor(e){const n=On.maybeFromEditor(e);return n===void 0&&we(294),n}constructEditor(){const{$initialEditorState:e,onError:n,onWarn:r,...o}=this.buildCreateEditorArgs(),i=Object.assign($1({...o,...n?{onError:s=>{n(s,i)}}:{},...r?{onWarn:s=>{r(s,i)}}:{}}),{[ug]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=fg;function n(){try{e()}finally{e=fg}}const r=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return e=tt(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const n=this.extensionNameMap.get(e.name);if(n)return n.extension!==e&&we(295,e.name),n}addEdge(e,n,r){const o=this.outgoingConfigEdges.get(e);o?o.set(n,r):this.outgoingConfigEdges.set(e,new Map([[n,r]]));const i=this.incomingEdges.get(n);i?i.add(e):this.incomingEdges.set(n,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&we(296);const n=Rs(e),[r]=n;typeof r.name!="string"&&we(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&we(298,r.name),!o){o=new aC(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&we(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&we(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=Rs(s);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[s,l]of r.peerDependencies||[])this.addEdge(r.name,s,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],n=(r,o)=>{let i=r.state;if(b0(i))return;const s=r.extension.name;var l;hc(i)||we(300,s,o||"[unknown]"),hc(l=i)||we(304,String(l.id),String(Jf)),i=Object.assign(l,{id:du}),r.state=i;const a=this.outgoingConfigEdges.get(s);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&n(u,s)}i=sC(i),r.state=i,e.push(r)};for(const r of this.extensionNameMap.values())hc(r.state)&&n(r);for(const r of e)for(const[o,i]of this.outgoingConfigEdges.get(r.extension.name)||[])if(i.length>0){const s=this.extensionNameMap.get(o);if(s)for(const l of i)s.configs.add(l)}for(const[r,...o]of this.roots)if(o.length>0){const i=this.extensionNameMap.get(r.name);i===void 0&&we(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const n=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of n){const l=s.register(e,i);l&&o.push(l)}for(const s of n){const l=s.afterRegistration(e);l&&o.push(l)}return tt(...o)}buildCreateEditorArgs(){const e={},n=new Set,r=new Map,o=new Map,i={},s={},l=this.sortedExtensionReps();for(const u of l){const{extension:f}=u;if(f.onError!==void 0&&(e.onError=f.onError),f.onWarn!==void 0&&(e.onWarn=f.onWarn),f.disableEvents!==void 0&&(e.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(e.parentEditor=f.parentEditor),f.editable!==void 0&&(e.editable=f.editable),f.namespace!==void 0&&(e.namespace=f.namespace),f.$initialEditorState!==void 0&&(e.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of nC(f)){if(typeof d!="function"){const g=r.get(d.replace);g&&we(302,f.name,d.replace.name,g.extension.name),r.set(d.replace,u)}n.add(d)}if(f.html){if(f.html.export)for(const[d,g]of f.html.export.entries())o.set(d,g);f.html.import&&Object.assign(i,f.html.import)}f.theme&&v0(s,f.theme)}Object.keys(s).length>0&&(e.theme=s),n.size&&(e.nodes=[...n]);const a=Object.keys(i).length>0,c=o.size>0;(a||c)&&(e.html={},a&&(e.html.import=i),c&&(e.html.export=o));for(const u of l)u.init(e);return e.onError||(e.onError=fC),e}}function dC(t,e){const n=On.fromEditor(t).getExtensionRep(e);return n===void 0&&we(303,e.name),n.getExtensionDependency()}function io(t,e){const n=On.maybeFromEditor(t);if(!n)return;const r=n.extensionNameMap.get(e);return r?r.getExtensionDependency():void 0}function hC(t){return io(Me(),t)}class so extends ds{static getType(){return"horizontalrule"}static clone(e){return new so(e.__key)}static importJSON(e){return _a().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:gC,priority:0})}}exportDOM(){return{element:Te().createElement("hr")}}createDOM(e){const n=Te().createElement("hr");return Xt(n,e.theme.hr),n}getTextContent(){return` +`}isInline(){return!1}updateDOM(){return!1}}function gC(){return{node:_a()}}function _a(){return X1(so)}function S0(t){return t instanceof so}const pC={build:(t,e)=>Kf({inheritEditableFromParent:e.inheritEditableFromParent}),config:{$getParentEditor:function(){const t=Me();return On.fromEditor(t),t},inheritEditableFromParent:!1},init:(t,e,n)=>{const r=e.$getParentEditor();t.parentEditor=r,t.theme=t.theme||r._config.theme},name:"@lexical/extension/NestedEditor",register:(t,e,n)=>ys(()=>{const r=t._parentEditor;if(r&&n.getOutput().inheritEditableFromParent.value)return t.setEditable(r.isEditable()),r.registerEditableListener(t.setEditable.bind(t))})};function mC(t){return t.canIndent()}function yC(t,e,n=mC){return tt(t.registerCommand(yf,r=>{const o=V();if(!$(o))return!1;r.preventDefault();const i=function(s){if(s.getNodes().filter(d=>Fr(d)&&d.canIndent()).length>0)return!0;const l=s.anchor,a=s.focus,c=a.isBefore(l)?a:l,u=c.getNode(),f=g0(u);if(f.canIndent()){const d=f.getKey();let g=aa();if(g.anchor.set(d,0,"element"),g.focus.set(d,0,"element"),g=kr(g),g.anchor.is(c))return!0}return!1}(o)?r.shiftKey?Zc:Cl:Jm;return t.dispatchCommand(i,void 0)},ee),t.registerCommand(Cl,()=>{const r=typeof e=="number"?e:e?e.peek():null,o=V();if(!$(o))return!1;const i=typeof n=="function"?n:n.peek();return uu(s=>{if(i(s)){const l=s.getIndent()+1;(!r||l1){const m=e._nodeMap,x=m.get(i.anchor.key),v=m.get(s.anchor.key);return x&&v&&!t._nodeMap.has(x.__key)&&D(x)&&x.__text.length===1&&i.anchor.offset===1?2:0}const a=l[0],c=t._nodeMap.get(a.__key);if(!D(c)||!D(a)||c.__mode!==a.__mode)return 0;const u=c.__text,f=a.__text;if(u===f)return 0;const d=i.anchor,g=s.anchor;if(d.key!==g.key||d.type!=="text")return 0;const h=d.offset,p=g.offset,y=f.length-u.length;return y===1&&p===h-1?2:y===-1&&p===h+1?3:y===-1&&p===h?4:0}function _C(t,e,n){let r=n(),o=0,i=r,s=0,l=null;return(a,c,u,f,d,g)=>{const h=n();if(g.has(u1)&&(i=r,s=o,l=a),g.has(Ar))return o=0,r=h,2;g.has(zi)&&l&&(r=i,o=s,a=l);const p=g.has(s1)||g.has(l1)?0:xC(a,c,f,d,t.isComposing()),y=(()=>{const m=u===null||u.editor===t,x=g.has(i1);if(!x&&m&&g.has(Ti))return 0;if(p===1)return 2;if(a===null)return 1;const v=c._selection;if(!(f.size>0||d.size>0))return v!==null?0:2;const _=typeof e=="number"?e:e.peek();return x===!1&&p!==0&&p===o&&hw.exportJSON()))===JSON.stringify(b.read(()=>k.exportJSON()))}(Array.from(f)[0],a,c)?0:1})();return r=h,o=p,y}}function dg(t,e){t.undoStack=[],t.redoStack=[],t.current=null,e&&e(t)}function vC(t,e,n,r=Date.now,o,i=null){const s=_C(t,n,r),l=()=>{o&&o(e)};return l(),tt(t.registerCommand(oa,()=>(function(a,c,u){const f=c.redoStack,d=c.undoStack;if(d.length!==0){const g=c.current,h=d.pop();g!==null&&(f.push(g),a.dispatchCommand(Nr,!0)),d.length===0&&a.dispatchCommand(Mr,!1),c.current=h||null,u&&u(c),h&&h.editor.setEditorState(h.editorState,{tag:Ar})}}(t,e,o),!0),ee),t.registerCommand(ia,()=>(function(a,c,u){const f=c.redoStack,d=c.undoStack;if(f.length!==0){const g=c.current;g!==null&&(d.push(g),a.dispatchCommand(Mr,!0));const h=f.pop();f.length===0&&a.dispatchCommand(Nr,!1),c.current=h||null,u&&u(c),h&&h.editor.setEditorState(h.editorState,{tag:Ar})}}(t,e,o),!0),ee),t.registerCommand(E_,()=>(dg(e,o),!1),ee),t.registerCommand(T_,()=>(dg(e,o),t.dispatchCommand(Nr,!1),t.dispatchCommand(Mr,!1),!0),ee),t.registerUpdateListener(({editorState:a,prevEditorState:c,dirtyLeaves:u,dirtyElements:f,tags:d})=>{const g=e.current,h=e.redoStack,p=e.undoStack,y=g===null?null:g.editorState;if(g!==null&&a===y)return;const m=s(c,a,g,u,f,d);if(m===1){if(h.length!==0&&(e.redoStack=[],t.dispatchCommand(Nr,!1)),g!==null){p.push({...g});const x=typeof i=="number"||i===null?i:i.peek();x!==null&&p.length>x&&p.splice(0,p.length-x),t.dispatchCommand(Mr,!0)}}else if(m===2)return;e.current={editor:t,editorState:a},l()}))}function Uf(){return{current:null,redoStack:[],undoStack:[]}}const Do={build:(t,{delay:e,createInitialHistoryState:n,disabled:r,maxDepth:o,now:i},s)=>({...Kf({delay:e,disabled:r,historyState:n(t),maxDepth:o,now:i}),...s.getInitResult()}),config:{createInitialHistoryState:Uf,delay:300,disabled:typeof window>"u",maxDepth:null,now:Date.now},init:()=>({canRedo:qi(!1),canUndo:qi(!1)}),name:"@lexical/history/History",register:(t,e,n)=>{const{canUndo:r,canRedo:o}=n.getInitResult(),i=n.getOutput(),s=l=>p0(()=>{r.value=l!=null&&l.undoStack.length>0,o.value=l!=null&&l.redoStack.length>0});return ys(()=>{if(!i.disabled.value)return vC(t,i.historyState.value,i.delay,()=>i.now.peek()(),s,i.maxDepth);s(null)})}},CC={build:(t,{disabled:e,parentEditor:n})=>Kf({disabled:e,parentEditor:n||t._parentEditor}),config:{disabled:!1,parentEditor:null},dependencies:[Eo(Do,{disabled:!0})],name:"@lexical/history/SharedHistory",register:(t,e,n)=>ys(()=>{const{disabled:r,parentEditor:o}=n.getOutput();if(!r.value){const{output:i}=n.getDependency(Do),s=function(a){return a?io(a,Do.name):null}(o.value);if(!s)return;const l=s.output;p0(()=>{i.delay.value=l.delay.value,i.historyState.value=l.historyState.value,i.now.value=l.now.value,i.disabled.value=l.disabled.value})}})};function ri(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Fo;function E0(t,e){const{key:n}=e;return t&&n in t?t[n]:e.defaultValue}function T0(t){return Fo&&Fo.editor===t?Fo:void 0}function bC(t,e){if("cfg"in e){const{cfg:n,updater:r}=e;return[n,r(E0(t,n))]}return e}function wC(t,e){let n=e;for(const r of t){const[o,i]=bC(n,r),s=o.key;if(n===e&&E0(n,o)===i)continue;const l=n===e||n===void 0?SC(e):n;l[s]=i,n=l}return n}function SC(t){return Object.create(t||null)}function k0(t,e){return[t,e]}function EC(t,e,n,r=Me()){const o=Fo,i=T0(r);try{return Fo={...i,editor:r,[t]:e},n()}finally{Fo=o}}function TC(t,e=()=>{}){return(n,r=Me())=>o=>{const i=T0(r),s=i&&i[t],l=wC(n,s||e(r));return l&&l!==s?EC(t,l,o,r):o()}}function N0(t,e,n,r){return Object.assign(us(Symbol(e),{isEqual:r,parse:n}),{[t]:!0})}function kC(t){if(!no(t))return;const e=t;if(e.querySelector("style")===null)return;const n=new Map;function r(o){let i=n.get(o);if(i===void 0){i=new Set;for(let s=0;s{for(const l of r)if(!l(i,s))return!1;return!0}),tags:t};var r;const o=i=>Yi(t,[...e,i]);return{[va]:n,attr:(i,s,l)=>o(hu(i,s,l)),classAll:(...i)=>o(P0(i)),classAny:(...i)=>o(function(s){const l=A0(s);return l.length===0?()=>!1:a=>{if(!q(a))return!1;const c=a.classList;for(const u of l)if(c.contains(u))return!0;return!1}}(i)),styleAny:(i,s,l)=>o(function(a,c,u){if(typeof c=="string")return f=>q(f)&&f.style.getPropertyValue(a)===c;if(c instanceof RegExp){const f=u&&u.capture,d=c;return(g,h)=>{if(!q(g))return!1;const p=g.style.getPropertyValue(a);if(!p)return!1;const y=p.match(d);return y!==null&&(f!==void 0&&(h[f]=y),!0)}}ri(362,JSON.stringify(a))}(i,s,l))}}function A0(t){const e=[];for(const n of t)n&&e.push(n);return e}function P0(t){const e=A0(t);return e.length===0?()=>!0:n=>{if(!q(n))return!1;const r=n.classList;for(const o of e)if(!r.contains(o))return!1;return!0}}function hu(t,e,n){if(e===!0)return r=>q(r)&&r.hasAttribute(t);if(typeof e=="string")return r=>q(r)&&r.getAttribute(t)===e;if(e instanceof RegExp){const r=n&&n.capture,o=e;return(i,s)=>{if(!q(i))return!1;const l=i.getAttribute(t);if(l==null)return!1;const a=l.match(o);return a!==null&&(r!==void 0&&(s[r]=a),!0)}}ri(361,JSON.stringify(t))}const IC={kind:"text",predicate:vt,tags:new Set},RC={[va]:IC},DC={kind:"comment",predicate:t=>t.nodeType===8,tags:new Set},FC={[va]:DC},To={any:()=>Yi(new Set,[]),comment:()=>FC,tag(...t){t.length>0||ri(363);const e=new Set;for(const n of t)e.add(n.toUpperCase());return Yi(e,[])},text:()=>RC};function L0(t,e){return q(t)&&t.nodeName===e.toUpperCase()}const $0=/[A-Za-z0-9_-]/;let HC=class{constructor(e,n){this.source=e,this.pos=n}peek(e=0){return this.source[this.pos+e]||""}consume(){return this.source[this.pos++]||""}eof(){return this.pos>=this.source.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}readIdent(){const e=this.pos;for(;!this.eof()&&$0.test(this.peek());)this.pos++;return this.source.slice(e,this.pos)}readQuoted(){const e=this.consume();this.assert(e==='"'||e==="'","expected quote");const n=this.pos;for(;!this.eof()&&this.peek()!==e;)this.peek()==="\\"?this.pos+=2:this.pos++;this.assert(!this.eof(),"unterminated string");const r=this.source.slice(n,this.pos);return this.pos++,r.replace(/\\(.)/g,"$1")}assert(e,n){e||ri(364,String(this.pos+1),n,this.source)}};function VC(t){const e=new Set,n=[],r=[];if(t.skipWhitespace(),t.peek()==="*")t.consume();else if($0.test(t.peek())){const o=t.readIdent();o&&e.add(o.toUpperCase())}for(;!t.eof();){const o=t.peek();if(o==="."){t.consume();const i=t.readIdent();t.assert(i!=="",'expected class name after "."'),r.push(i)}else if(o==="#"){t.consume();const i=t.readIdent();t.assert(i!=="",'expected id after "#"'),n.push(hu("id",i))}else{if(o!=="[")break;{t.consume(),t.skipWhitespace();const i=t.readIdent();t.assert(i!=="",'expected attribute name after "["'),t.skipWhitespace();let s=!0;if(t.peek()==="="){t.consume(),t.skipWhitespace();const l=t.peek();l==='"'||l==="'"?s=t.readQuoted():(s=t.readIdent(),t.assert(s!=="","expected attribute value")),t.skipWhitespace()}t.assert(t.peek()==="]",'expected "]"'),t.consume(),n.push(hu(i,s))}}}return r.length>0&&n.push(P0(r)),{predicates:n,tags:e}}function BC(t){const e=new HC(t,0),n=[];for(;;){const o=VC(e);if(n.push(o),e.skipWhitespace(),e.eof())break;e.assert(e.peek()===",",'expected "," (selector lists are the only supported combinator)'),e.consume(),e.skipWhitespace()}if(n.length===1)return Yi(n[0].tags,n[0].predicates);const r=new Set;for(const o of n)for(const i of o.tags)r.add(i);return Yi(r,[(o,i)=>{for(const s of n){const l=o.nodeName;if(s.tags.size>0&&!s.tags.has(l))continue;let a=!0;for(const c of s.predicates)if(!c(o,i)){a=!1;break}if(a)return!0}return!1}])}function Gf(t,e,n){return N0(NC,t,e,n)}const gu=Gf("textFormat",()=>0),jC=Gf("textStyle",()=>({}));function WC(t){if(!q(t))return!1;if(t.nodeName==="PRE")return!0;const e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function zC(t){if(vt(t))return!0;if(!q(t))return!1;const e=t.style.display;return e?e.startsWith("inline"):!Uo(t)&&Il(t)}const KC=Gf("whitespaceConfig",()=>({isInline:zC,preservesWhitespace:WC}));function Zf(t){return Fr(t)||te(t)&&!t.isInline()}function I0(t,e){const n=[];let r=[];const o=()=>{r.length!==0&&(n.push(e().splice(0,0,r)),r=[])};for(const i of t)if(Zf(i)){if(o(),O(i)){const s=I0(i.getChildren(),e);i.splice(0,i.getChildrenSize(),s)}n.push(i)}else r.push(i);return o(),n}function R0(t,e){if(!q(e))return t;const n=e.style.textAlign;if(!qf(n))return t;for(const r of t)Fr(r)&&r.getFormatType()===""&&r.setFormat(n);return t}function JC(t,e,n){t.length===1&&rt(t[0])&&(t=[]);const r=re();if(q(n)){const o=n.style.textAlign;qf(o)&&r.setFormat(o)}return[r.splice(0,0,t)]}const D0={$accepts:Zf,$packageRun:JC,name:"BlockSchema"},lo=To,UC=new Set(["center","end","justify","left","right","start"]);function qf(t){return UC.has(t)}const GC={B:{fontWeight:"bold"},EM:{fontStyle:"italic"},I:{fontStyle:"italic"},S:{textDecoration:"line-through"},STRONG:{fontWeight:"bold"},SUB:{verticalAlign:"sub"},SUP:{verticalAlign:"super"},U:{textDecoration:"underline"}},ZC={CODE:Y2,MARK:rf},qC=new Set(["font-weight","font-style","text-decoration","vertical-align"]),YC={$import:(t,e)=>{const n=t.get(gu),r=GC[e.nodeName],o=function(d){return{fontStyle:d.style.fontStyle,fontWeight:d.style.fontWeight,textDecoration:d.style.textDecoration,verticalAlign:d.style.verticalAlign}}(e),i=r?(s=r,{fontStyle:(l=o).fontStyle||s.fontStyle,fontWeight:l.fontWeight||s.fontWeight,textDecoration:l.textDecoration||s.textDecoration,verticalAlign:l.verticalAlign||s.verticalAlign}):o;var s,l;let a=(c=n,u=function(d){let g=0,h=0;const{fontWeight:p,fontStyle:y,textDecoration:m,verticalAlign:x}=d;if(p==="700"||p==="bold"?g|=Jd:p!=="normal"&&p!=="400"||(h|=Jd),y==="italic"?g|=Ud:y==="normal"&&(h|=Ud),m){const v=m.split(" ");v.includes("underline")&&(g|=Zd),v.includes("line-through")&&(g|=Gd),v.includes("none")&&(h|=Zd|Gd)}return x==="sub"?(g|=qa,h|=Ya):x==="super"?(g|=Ya,h|=qa):x==="baseline"&&(h|=qa|Ya),{clear:h,set:g}}(i),c&~u.clear|u.set);var c,u;const f=ZC[e.nodeName];return f&&(a|=f),a===n?t.$importChildren(e):t.$importChildren(e,{context:[k0(gu,a)]})},match:lo.tag("b","strong","em","i","code","mark","s","sub","sup","u","span"),name:"@lexical/html/inline-format"};function hg(t,e,n){let r=t;for(;;){let o=null;for(;(o=e?r.nextSibling:r.previousSibling)===null;){const s=r.parentNode;if(s===null)return null;r=s}if(r=o,!n.isInline(r))return null;let i=r;for(;(i=e?r.firstChild:r.lastChild)!==null;)r=i;if(vt(r))return r;if(r.nodeName==="BR")return null}}function gg(t,e){return e!==0&&D(t)?t.setFormat(e):t}function pg(t,e){if(D(t)){const n=function(r){let o="";for(const i in r)qC.has(i)||(o+=`${i}: ${r[i]}; `);return o.trimEnd()}(e);n!==""&&t.setStyle(n)}return t}const XC={$import:(t,e)=>{const n=t.get(gu),r=t.get(jC),o=t.get(KC);if(function(l,a){let c=l.parentNode;for(;c!==null;){if(a.preservesWhitespace(c))return!0;c=c.parentNode}return!1}(e,o)){const l=Ji(e.textContent||"");for(const a of l)gg(a,n),pg(a,r);return l}const i=function(l,a){let c=(l.textContent||"").replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(c.length===0)return"";if(c[0]===" "){let u=l,f=!0;for(;u!==null&&(u=hg(u,!1,a))!==null;){const d=u.textContent||"";if(d.length>0){/[ \t\n]$/.test(d)&&(c=c.slice(1)),f=!1;break}}f&&(c=c.slice(1))}if(c.length>0&&c[c.length-1]===" "){let u=l,f=!0;for(;u!==null&&(u=hg(u,!0,a))!==null;)if((u.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){f=!1;break}f&&(c=c.slice(0,-1))}return c}(e,o);if(i==="")return[];const s=Pe(i);return gg(s,n),pg(s,r),[s]},match:lo.text(),name:"@lexical/html/#text"},QC={$import:()=>[],match:lo.tag("script","style"),name:"@lexical/html/script-style-ignore"},eb={$import:(t,e)=>A1(e)||P1(e)?[]:[_t()],match:lo.tag("br"),name:"@lexical/html/br"},tb={$import:(t,e)=>{const n=re();if(gn(n,e),ro(e,n),n.getFormatType()===""){const r=e.getAttribute("align");r&&qf(r)&&n.setFormat(r)}return Wt(n,e),[n.splice(0,0,t.$importChildren(e))]},match:lo.tag("p"),name:"@lexical/html/p"},nb={$import:(t,e,n)=>Me().hasNode(so)?[_a()]:n(),match:lo.tag("hr"),name:"@lexical/html/hr"};lo.any();function rb(t,e){const n=[];let r=0,o=0;for(;r{const u=function(d){const g=d[va];return g===void 0&&ri(360),g}(a.match),f=a.name||function(d,g){return d.kind==="text"?`#text@${g}`:d.kind==="comment"?`#comment@${g}`:d.tags.size===0?`*@${g}`:`${Array.from(d.tags).join(",").toLowerCase()}@${g}`}(u,c);if(a.name&&s.add(a.name),e.push({$import:a.$import,name:f,predicate:u.predicate}),u.kind==="text")o.push(c);else if(u.kind==="comment")i.push(c);else if(u.tags.size===0)r.push(c);else for(const d of u.tags){let g=n.get(d);g||(g=[],n.set(d,g)),g.push(c)}});const l=new Map;if(r.length===0)for(const[a,c]of n)l.set(a,c);else for(const[a,c]of n)l.set(a,rb(c,r));return{byTag:l,commentIndices:i,rules:e,textIndices:o,wildcardIndices:r}}function ib(t){const e=[];for(const n of t)if(sb(n))for(const r of n.rules)e.push(r);else e.push(n);return e}function sb(t){return typeof t=="object"&&t!==null&&"__type"in t&&t.__type==="CompiledOverlayRules"}function F0(t){const e=ib(t);return{__type:"CompiledOverlayRules",dispatch:ob(e),rules:e}}To.any();const Ge={any:To.any,comment:To.comment,css:BC,tag:To.tag,text:To.text},H0=new Set(["STYLE","SCRIPT"]);function lb(t,e){kC(e);const n=no(e)?e.body.childNodes:e.childNodes,r=[],o=[];for(const i of n)if(!H0.has(i.nodeName)){const s=B0(i,t,o,!1);if(s!==null)for(const l of s)r.push(l)}return function(i){for(const s of i)s.getParent()&&s.getNextSibling()instanceof Ef&&s.insertAfter(_t());for(const s of i){const l=s.getParent();l&&l.splice(s.getIndexWithinParent(),1,s.getChildren())}}(o),r}function ab(t,e=null,n=Me()){return $C([k0(OC,!0)],n)(()=>{const r=Ce(),o=LC(n),i=$(e)?da(e.anchor.getNode()):null,s=t.append.bind(t);for(const l of(O(i)?i:r).getChildren())V0(n,l,s,e,o);return t})}function cb(t,e=null){return(typeof document>"u"||typeof window>"u"&&global.window===void 0)&&ri(338),Z_(t),ab(Te().createElement("div"),e,t).innerHTML}function V0(t,e,n,r=null,o=fa(t)){let i=o.$shouldInclude(e,r,t);const s=o.$shouldExclude(e,r,t);let l=e;r!==null&&D(e)&&(l=c0(r,e,"clone"));const a=o.$exportDOM(l,t),{element:c,after:u,append:f,$getChildNodes:d}=a;if(!c)return!1;const g=Te().createDocumentFragment(),h=d?d():O(l)?l.getChildren():[],p=i&&be(r)&&O(e)?null:r,y=g.append.bind(g);for(const m of h){const x=V0(t,m,y,p,o);!i&&x&&o.$extractWithChild(e,m,r,"html",t)&&(i=!0)}if(i&&!s){if((q(c)||iu(c))&&(f?f(g):c.append(g)),n(c),u){const m=u.call(l,c);m&&(iu(c)?c.replaceChildren(m):c.replaceWith(m))}}else n(g);return i}function B0(t,e,n,r,o=new Map,i){const s=[];if(H0.has(t.nodeName))return s;let l=null;const a=function(h,p){const{nodeName:y}=h,m=p._htmlConversions.get(y.toLowerCase());let x=null;if(m!==void 0)for(const v of m){const _=v(h);_!==null&&(x===null||(x.priority||0)<=(_.priority||0))&&(x=_)}return x!==null?x.conversion:null}(t,e),c=a?a(t):null;let u=null;if(c!==null){u=c.after;const h=c.node;if(l=Array.isArray(h)?h[h.length-1]:h,l!==null){for(const[,p]of o)if(l=p(l,i),!l)break;l&&s.push(...Array.isArray(h)?h:[l])}c.forChild!=null&&o.set(t.nodeName,c.forChild)}const f=t.childNodes;let d=[];const g=(l==null||!ve(l))&&(l!=null&&Fr(l)||r);for(let h=0;h{const h=new Ef;return n.push(h),h}:re)),l==null)if(d.length>0)for(const h of d)s.push(h);else Uo(t)&&function(h){return h.nextSibling==null||h.previousSibling==null?!1:Il(h.nextSibling)&&Il(h.previousSibling)}(t)&&s.push(_t());else O(l)&&l.append(...d);return s}function ub(t,e,n){const r=t.style.textAlign,o=[];let i=[];for(let s=0;s0;if(i&&typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(t,e,{shadowRoots:o});if(s!==null&&function(l,a){for(let c=l;c!==null;){if(c===a)return!0;c=dr(c)}return!1}(s.offsetNode,n))return{node:s.offsetNode,offset:s.offset}}if(i){const s=n.getRootNode();if(Rn(s)){const l=s.elementFromPoint(t,e);if(l!==null&&n.contains(l)){const a=function(c,u,f,d){const g=d.createRange(),h=b=>ub.bottom?u-b.bottom:0,p=b=>cb.right?c-b.right:0,y=d.createTreeWalker(f,NodeFilter.SHOW_TEXT);let m=null,x=1/0,v=1/0;for(let b=y.nextNode();b;b=y.nextNode()){g.selectNodeContents(b);for(const w of g.getClientRects()){const k=h(w),M=p(w);(ke}).createHTML(t):t}const mg=(t,e)=>{if(!$(e))return e.insertRawText(t),!0;const n=r=>{const o=V();$(o)&&r(o)};return S1(t,{linebreak:()=>n(r=>r.insertParagraph()),tab:()=>n(r=>r.insertNodes([fs()])),text:r=>n(o=>o.insertText(r))}),!0},mu={"application/x-lexical-editor":[(t,e,n)=>{try{const r=Me(),o=JSON.parse(t);if(o&&o.namespace===r._config.namespace&&Array.isArray(o.nodes))return yg(r,U0(o.nodes),e),!0}catch(r){console.error(r)}return n()}],"text/html":[(t,e,n)=>{try{const r=Me(),o=new DOMParser().parseFromString(fb(t),"text/html");return yg(r,lb(r,o),e),!0}catch(r){return console.error(r),n()}}],"text/plain":[mg],"text/uri-list":[mg]};function db(t,e,n,r){if(!t)return!1;const o=i=>!!t[i]&&t[i](e,n,o.bind(null,i-1),r);return o(t.length-1)}function j0(t,e,n){const r=e.getData("text/plain");for(const o of function(i){return Object.keys(i.$importMimeType).filter(s=>i.$importMimeType[s]!==void 0).sort((s,l)=>{const a=i.priority[s],c=i.priority[l];return a===void 0&&c===void 0?sl?1:0:a===void 0?1:c===void 0?-1:a-c})}(t)){const i=e.getData(o);if(i&&(o!=="text/html"||i!==r)&&db(t.$importMimeType[o],i,n,e))return!0}return!1}const hb={$importMimeType:mu,$insertDataTransfer:(t,e)=>j0({$importMimeType:mu,priority:pu},t,e),priority:pu},gb={build:(t,e)=>({$importMimeType:e.$importMimeType,$insertDataTransfer:(n,r)=>j0(e,n,r),priority:e.priority}),config:{$importMimeType:mu,priority:pu},mergeConfig(t,e){const n=ma(t,e);if(e.$importMimeType){const r={...t.$importMimeType};for(const[o,i]of Object.entries(e.$importMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}n.$importMimeType=r}return e.priority&&(n.priority={...t.priority,...e.priority}),n},name:"@lexical/clipboard/Import"};function W0(t,e=V()){return e==null&&ko(166),$(e)&&e.isCollapsed()||e.getNodes().length===0?"":cb(t,e)}function z0(t,e=V()){return e==null&&ko(166),$(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(J0(t,e))}function yu(t,e,n){(function(){const r=hC(gb.name);return r?r.output:hb})().$insertDataTransfer(t,e)}const K0="application/x-lexical-drag";function pb(t,e){const n={editorKey:e.getKey()};t.setData(K0,JSON.stringify(n))}function mb(t,e,n){const r=t.dataTransfer;if(r===null)return!1;const o=function(c){const u=c.getData(K0);if(!u)return null;let f;try{f=JSON.parse(u)}catch{return null}return(d=f)!==null&&typeof d=="object"&&"editorKey"in d&&typeof d.editorKey=="string"?f:null;var d}(r);if(o===null)return!1;const i=function(c,u){const f=Vl(c.clientX,c.clientY,u.getRootElement());if(f===null)return null;const d=un(f.node);if(d===null)return null;if(D(d))return sr(d,"next",f.offset);if(O(d))return cu(d,f.offset,"next");const g=d.getParent();return g===null?null:cu(g,d.getIndexWithinParent()+1,"next")}(t,e);if(i===null)return!1;const s=s0(i);if(s===null)return!1;const l=o.editorKey===e.getKey(),a=V();if(l){if(!$(a)||a.isCollapsed())return!1;if(function(c,u){const{anchor:f,focus:d}=jf(au(u),"next");return Zi(f,c)<0&&Zi(c,d)<0}(i,a))return t.preventDefault(),!0;a.removeText()}if(!s.origin.isAttached())return t.preventDefault(),!0;if(n(r,Go(ms(s)),e),!l){const c=e.getRootElement(),u=c?c.ownerDocument:null,f=u?function(d,g){for(const h of U1(g)){const p=ei(h);if(ps(p)&&p.getKey()===d&&q(h))return h}return null}(o.editorKey,u):null;f!==null&&f.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return t.preventDefault(),!0}function yb(t,e){return mb(t,e,yu)}function yg(t,e,n){t.dispatchCommand(C_,{nodes:e,selection:n})||(n.insertNodes(e),function(r){if($(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=ut(o,"previous");if(s)if($t(s))i=s.origin;else{const l=qt(s,Tt(Ce(),"next").getFlipped());for(const a of l){if(D(a.origin)){i=a.origin;break}if(O(a.origin)&&!a.origin.isInline())break}}if(i&&D(i)){const l=i.getFormat(),a=i.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}}(n))}function xu(t,e,n,r=[]){let o=e===null||n.isSelected(e);const i=O(n)&&n.excludeFromCopy("html");let s=n;e!==null&&D(s)&&(s=c0(e,s,"clone"));const l=O(s)?s.getChildren():[],a=function(u){const f=u.exportJSON(),d=u.constructor;if(f.type!==d.getType()&&ko(58,d.name),O(u)){const g=f.children;Array.isArray(g)||ko(59,d.name)}return f}(s);D(s)&&s.getTextContentSize()===0&&(o=!1);const c=o&&be(e)&&O(n)?null:e;for(let u=0;u0){const f={};for(const d of u){const g=jr(s,d);g===null&&ko(366,s.constructor.name,d);const h=[];xu(t,null,g,h),h.length===1&&h[0].type===g.getType()||ko(385,d,s.constructor.name,String(h.length),String(h.length>0?h[0].type:"none")),f[d]=h[0]}a.$slots=f}}if(o&&!i)r.push(a);else if(Array.isArray(a.children))for(let u=0;u{t.update(()=>{c(_g(t,e,n))})});const r=t.getRootElement(),o=t._window||window,i=o.document,s=ht(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(i.createTextNode("#")),r.append(l);const a=i.createRange();return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise((c,u)=>{const f=t.registerCommand(sa,d=>(Yn(d,ClipboardEvent)&&(f(),mo!==null&&(o.clearTimeout(mo),mo=null),c(_g(t,d,n))),!0),or);mo=o.setTimeout(()=>{f(),mo=null,c(!1)},50),i.execCommand("copy"),l.remove()})}function _g(t,e,n){if(n===void 0){const o=ht(t._window),i=V();if(!i||i.isCollapsed()||!o)return!1;const s=Ht(o,t.getRootElement()),l=s.anchorNode,a=s.focusNode;if(l!==null&&a!==null&&!gs(t,l,a))return!1;n=G0(i)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Z0(r,n),!0)}const xb=[["text/html",W0],["application/x-lexical-editor",z0]];function G0(t=V()){return function(e,n){const r={"text/plain":""};for(const[o,i]of Object.entries(e))if(i){const s=vb(i,n);s!==null&&(r[o]=s)}return r}(_b(),t)}function Z0(t,e){for(const[n]of xb)e[n]===void 0&&t.setData(n,"");for(const n in e){const r=e[n];r!==void 0&&t.setData(n,r)}}function _b(t=Me()){const e=io(t,Cb.name);return e?e.output:q0}const q0={"application/x-lexical-editor":[(t,e)=>t?z0(Me(),t):e()],"text/html":[(t,e)=>t?W0(Me(),t):e()],"text/plain":[(t,e)=>t?t.getTextContent():e()]};function vb(t,e){const n=r=>t[r]?t[r](e,n.bind(null,r-1)):null;return n(t.length-1)}const Cb={build:(t,e,n)=>e.$exportMimeType,config:{$exportMimeType:q0},mergeConfig(t,e){const n=ma(t,e);if(e.$exportMimeType){const r={...t.$exportMimeType};for(const[o,i]of Object.entries(e.$exportMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}n.$exportMimeType=r}return n},name:"@lexical/clipboard/GetClipboardData"},bb={bold:"bold",italic:"italic",strikeThrough:"strikethrough",subscript:"subscript",superscript:"superscript",underline:"underline"},Bl=Symbol.for("@lexical/dragon/WindowState");function wb(t,e,n){const r=function(o){let i=o[Bl];return i===void 0&&(i={dispose:()=>{},editors:new Map,installs:new Set},o[Bl]=i),i}(t);if(r.installs.size===0){const o=Tb.bind(t);t.addEventListener("message",o,!0),r.dispose=()=>{t.removeEventListener("message",o,!0)}}if(r.installs.add(e),n){const o=r.editors.get(n)||new Set;o.add(e),r.editors.set(n,o)}return Sb.bind(null,t,r,e,n)}function Sb(t,e,n,r){if(r){const o=e.editors.get(r);o&&o.delete(n)&&o.size===0&&e.editors.delete(r)}e.installs.delete(n)&&e.installs.size===0&&(e.dispose(),delete t[Bl])}function vg(t){return t&&t.ownerDocument.defaultView}function Eb(t){const e=rC(()=>vg(t.getRootElement()),n=>t.registerRootListener(r=>{n.value=vg(r)}));return ys(()=>{const n=e.value;if(n)return wb(n,Symbol("@lexical/dragon/editorInstall"),t)})}function Tb(t){if(t.origin!==this.location.origin)return;const e=function(r){const o=r[Bl];if(o===void 0)return null;const i=ei(Jo(r.document));return ps(i)&&o.editors.has(i)?i:null}(this);if(e===null)return;const n=t.data;if(typeof n=="string"){let r;try{r=JSON.parse(n)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const o=r.payload;if(o&&o.functionId==="makeChanges"){const i=o.args;if(Array.isArray(i)){const[s,l,a,c,u,f]=i;if(![s,l,c,u].every(Number.isFinite)||typeof a!="string"&&a!==-1)return;e.update(()=>{const d=V();if($(d)){const g=d.anchor;let h=g.getNode(),p=0,y=0;if(D(h)&&s>=0&&l>=0&&(p=s,y=s+l,d.setTextNodeRange(h,p,h,y)),typeof a!="string"||p===y&&a===""||(d.insertRawText(a),h=g.getNode()),D(h)){const m=h.getTextContentSize();p=Math.min(Math.max(c,0),m),y=c<0||u<0?p:Math.min(c+u,m),d.setTextNodeRange(h,p,h,y)}if(typeof f=="string"&&u>0&&!d.isCollapsed()){const m=bb[f];m!==void 0&&d.formatText(m)}t.stopImmediatePropagation()}})}}}}}const kb={$import:(t,e)=>{const n=Yt(e.nodeName.toLowerCase());return ro(e,n),gn(n,e),Wt(n,e),[n.splice(0,0,t.$importChildren(e))]},match:Ge.tag("h1","h2","h3","h4","h5","h6"),name:"@lexical/rich-text/heading"},Nb={$import:(t,e)=>{const n=ao();return gn(n,e),ro(e,n),Wt(n,e),[n.splice(0,0,t.$importChildren(e))]},match:Ge.tag("blockquote"),name:"@lexical/rich-text/blockquote"};Ge.tag("blockquote");Ge.tag("p"),Ge.tag("span");const Cg=U("DRAG_DROP_PASTE_FILE"),pc=us("shadowRoot",{parse:Boolean});let Ca=class Y0 extends ft{static getType(){return"quote"}static clone(e){return new Y0(e.__key)}$config(){return this.config("quote",{extends:ft,stateConfigs:[{flat:!0,stateConfig:pc}]})}isShadowRoot(){return na(this,pc)}setIsShadowRoot(e){return Oo(this,pc,e)}createDOM(e){const n=Te().createElement("blockquote");return Xt(n,e.theme.quote),n}updateDOM(e,n){return!1}static importDOM(){return{blockquote:e=>({conversion:Mb,priority:0})}}exportDOM(e){const{element:n}=super.exportDOM(e);if(q(n)){this.isEmpty()&&n.append(Te().createElement("br"));const r=this.getFormatType();r&&(n.style.textAlign=r);const o=this.getDirection();o&&(n.dir=o)}return{element:n}}static importJSON(e){return ao().updateFromJSON(e)}exportJSON(){return super.exportJSON()}insertNewAfter(e,n){const r=re(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,n),r}collapseAtStart(){if(this.isShadowRoot()){for(const n of this.getChildren())this.insertBefore(n);return this.remove(),!0}const e=re();return this.getChildren().forEach(n=>e.append(n)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function ao(t){const e=kt(new Ca);return t&&t.shadowRoot?e.setIsShadowRoot(!0):e}function _u(t){return t instanceof Ca}let xs=class X0 extends ft{constructor(n="h1",r){super(r);P(this,"__tag");this.__tag=n}static getType(){return"heading"}static clone(n){return new X0(n.__tag,n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__tag=n.__tag}getTag(){return this.getLatest().__tag}setTag(n){const r=this.getWritable();return r.__tag=n,r}createDOM(n){const r=this.__tag,o=Te().createElement(r),i=n.theme.heading;if(i!==void 0){const s=i[r];Xt(o,s)}return o}updateDOM(n,r,o){return n.__tag!==this.__tag}static importDOM(){return{h1:n=>({conversion:yo,priority:0}),h2:n=>({conversion:yo,priority:0}),h3:n=>({conversion:yo,priority:0}),h4:n=>({conversion:yo,priority:0}),h5:n=>({conversion:yo,priority:0}),h6:n=>({conversion:yo,priority:0}),p:n=>{const r=n.firstChild;return r!==null&&bg(r)?{conversion:()=>({node:null}),priority:3}:null},span:n=>bg(n)?{conversion:r=>({node:Yt("h1")}),priority:3}:null}}exportDOM(n){const{element:r}=super.exportDOM(n);if(q(r)){this.isEmpty()&&r.append(Te().createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();i&&(r.dir=i)}return{element:r}}static importJSON(n){return Yt(n.tag).updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setTag(n.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(n,r=!0){const o=n?n.anchor.offset:0,i=this.getLastDescendant(),s=!i||n&&n.anchor.key===i.getKey()&&o===i.getTextContentSize()||!n?re():Yt(this.getTag()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,r),o===0&&!this.isEmpty()&&n){const a=re();a.select(),this.replace(a,!0)}return s}collapseAtStart(){if(this.isEmpty()){const n=re();this.getChildren().forEach(r=>n.append(r)),this.replace(n)}return!0}extractWithChild(){return!0}};function bg(t){return t.nodeName.toLowerCase()==="span"&&t.style.fontSize==="26pt"}function yo(t){const e=t.nodeName.toLowerCase();let n=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(n=Yt(e),ro(t,n),gn(n,t),Wt(n,t)),{node:n}}function Mb(t){const e=ao();return gn(e,t),ro(t,e),Wt(e,t),{node:e}}function Yt(t="h1"){return kt(new xs(t))}function ba(t){return t instanceof xs}function wg(t){const e=un(t);return te(e)}function xo(t,e,n,r){let o=!1,i=null;if(t.isCollapsed()&&t.anchor.type==="text"){const l=t.anchor.getNode();if(D(l)){i=l;const a=t.anchor.offset,c=a===l.getTextContentSize()&&l.getNextSibling()===null,u=a===0&&l.getPreviousSibling()===null;o=n==="end"&&c||n==="start"&&u||n==="both"&&(c||u)}}let s=!1;for(const[l,a]of Object.entries(r)){if(a==null||!a[e])continue;const c=l;if(a.onlyAtBoundary){if(!(o&&i&&D(i)&&i.hasFormat(c)))continue;s=!0}t.hasFormat(c)&&t.toggleFormat(c)}s&&t.setStyle("")}const Ob={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function Ds(t,e){return function(n,r){if(!n.isCollapsed())return!1;const o=ut(n.focus,r),i=Ne(o.origin,Ro);if(!i)return!1;const s=n.focus.getNode();if(!i.is(s)&&!Ko(s,i))return!1;const l=qt(o,fe(i,r));if(l.getTextSlices().some(f=>f&&f.getTextContentSize()>0))return!1;const a=qt(l.anchor.getSiblingCaret(),l.focus);let c=a.anchor.origin;for(const f of a){if(!ir(f)||!f.origin.is(c.getParent()))return!1;c=f.origin}let u=i;for(const f of pa(fe(i,r))){if(!f.origin.is(u.getParent())){if(rl(f.origin)){const d=fe(u,r);return Go(qt(d,d)),!0}break}if(!Ro(f.origin))break;u=f.origin}return!1}(t,e)||function(n,r){if(!n.isCollapsed()||n.anchor.type!=="element")return!1;const o=ut(n.anchor,r).getNodeAtCaret();return!(!Ro(o)||o.isInline()||(Go(ms(pt(Tt(o,r)))),0))}(t,e)}function Sg(t){return te(t)&&!t.isInline()&&!t.isIsolated()&&t.isKeyboardSelectable()}function Fs(t){const e=Ki();e.add(t),He(e)}function Eg(t,e){if(!t.isCollapsed())return!1;const n=t.focus,r=n.getNode(),o=e?"previous":"next",i=ut(n,o);if(n.type==="element"&&O(r)&&($e(r)||Ro(r))){const m=i.getNodeAtCaret();return!(m===null||!Sg(m))&&(Fs(m.__key),!0)}const s=Ne(O(r)?r:r.getParentOrThrow(),m=>O(m)&&!m.isInline()&&ve(m.getParent()));if(s===null)return!1;const l=fe(s,o).getNodeAtCaret();if(l===null||!Sg(l))return!1;if(s.getTextContentSize()===0)return Fs(l.__key),!0;const a=Me().getRootElement();if(a===null)return!1;const c=ht(a.ownerDocument.defaultView);if(c===null||c.rangeCount===0)return!1;const u=c.anchorNode,f=c.anchorOffset,d=c.focusNode,g=c.focusOffset;c.modify("move",e?"backward":"forward","line");const h=c.anchorNode,p=c.anchorOffset;if(h===null)return Tg(c,u,f,d,g),!1;const y=un(h);return Tg(c,u,f,d,g),y===null?!1:(h===u&&p===f||!y.is(s)&&!Ko(y,s))&&(Fs(l.__key),!0)}function Tg(t,e,n,r,o){e!==null&&r!==null&&t.setBaseAndExtent(e,n,r,o)}function kg(t,e){if(!t.isCollapsed())return!1;const n=t.focus.getNode(),r=Ne(O(n)?n:n.getParentOrThrow(),y=>O(y)&&!y.isInline());if(r===null)return!1;const o=Me(),i=o.getRootElement();if(i===null)return!1;const s=i.ownerDocument.defaultView;if(s===null)return!1;let l=!1;for(const y of r.getChildren())if(O(y)&&y.isInline()){const m=o.getElementByKey(y.getKey());if(m!==null){const x=s.getComputedStyle(m).display;if(x==="inline-grid"||x==="inline-flex"){l=!0;break}}}if(!l)return!1;const a=fe(r,e?"previous":"next").getNodeAtCaret();if(a===null||!O(a)){if(e){const y=r.getFirstDescendant();D(y)?y.select(0,0):r.select(0,0)}else{const y=r.getLastDescendant();if(D(y)){const m=y.getTextContentSize();y.select(m,m)}else{const m=r.getChildrenSize();r.select(m,m)}}return!0}const c=o.getElementByKey(a.getKey());if(c===null)return!1;const u=ht(s);if(u===null||u.rangeCount===0)return!1;const f=u.getRangeAt(0).cloneRange();f.collapse(!0);const d=f.getBoundingClientRect(),g=c.getBoundingClientRect(),h=g.top+g.height/2;if(d.height>0){const y=Vl(d.left,h,i);if(y!==null&&c.contains(y.node)){const m=i.ownerDocument.createRange();return m.setStart(y.node,y.offset),m.collapse(!0),t.applyDOMRange(m),t.dirty=!0,!0}}const p=e?a.getLastDescendant():a.getFirstDescendant();if(D(p)){const y=e?p.getTextContentSize():0;p.select(y,y)}else{const y=a.getChildrenSize();a.select(e?y:0,e?y:0)}return!0}function Hs(t,e){const n=fe(t,e),r=n.getAdjacentCaret();r!==null&&O(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?Go(ms(n)):e==="next"?t.selectNext(0,0):t.selectPrevious()}function Ng(t,e,n){n.preventDefault(),n.stopPropagation();const r=t.getNodes();if(r.length===0)return!0;const o=r.map(a=>fe(a,"next")).sort(Zi),i=(e?o[0]:o[o.length-1]).origin,s=Ne(i,a=>a!==i&&O(a)&&!a.isInline())??Ce(),l=e?0:s.getChildrenSize();return s.select(l,l),!0}function Ab(t,e=qi(Ob)){return tt(t.registerCommand(af,()=>{const n=V();return be(n)?(n.clear(),!0):($(n)&&xo(n,"click","both",e.peek()),!1)},ee),t.registerCommand(Or,n=>{const r=V();return $(r)?(r.deleteCharacter(n),!0):!!be(r)&&(r.deleteNodes(),!0)},ee),t.registerCommand(Vi,n=>{const r=V();return!!$(r)&&(r.deleteWord(n),!0)},ee),t.registerCommand(Bi,n=>{const r=V();return!!$(r)&&(r.deleteLine(n),!0)},ee),t.registerCommand(Po,n=>{const r=V();if(typeof n=="string")r!==null&&r.insertText(n);else{if(r===null)return!1;const o=n.dataTransfer;if(o!=null)yu(o,r);else if($(r)){const i=n.data;return i&&r.insertText(i),!0}}return!0},ee),t.registerCommand(Xs,()=>{const n=V();return!!$(n)&&(n.removeText(),!0)},ee),t.registerCommand(Sn,n=>{const r=V();return!(!$(r)&&!be(r))&&(p1(r,n),!0)},ee),t.registerCommand(b_,n=>{const r=V();return!(!$(r)&&!be(r))&&(K_(r,n),!0)},ee),t.registerCommand(w_,n=>{const r=V();if(!$(r)&&!be(r))return!1;const o=r.getNodes();for(const i of o){const s=Ne(i,l=>O(l)&&!l.isInline());s!==null&&s.setFormat(n)}return!0},ee),t.registerCommand(Ao,n=>{const r=V();return!!$(r)&&(r.insertLineBreak(n),!0)},ee),t.registerCommand(Hi,()=>{const n=V();return!!$(n)&&(n.insertParagraph(),!0)},ee),t.registerCommand(Jm,()=>{const n=fs(),r=V();return $(r)&&(n.setFormat(r.format),n.setStyle(r.style)),wf([n]),!0},ee),t.registerCommand(Cl,()=>uu(n=>{const r=n.getIndent();n.setIndent(r+1)}),ee),t.registerCommand(Zc,()=>uu(n=>{const r=n.getIndent();r>0&&n.setIndent(Math.max(0,r-1))}),ee),t.registerCommand(df,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],"previous"),!0}else if($(r)&&(!n.shiftKey&&Ds(r,"previous")||!n.shiftKey&&Eg(r,!0)||!n.shiftKey&&kg(r,!0)))return n.preventDefault(),!0;return!1},ee),t.registerCommand(hf,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],"next"),!0}else if($(r)&&(function(o){const i=o.focus;return i.key==="root"&&i.offset===Ce().getChildrenSize()}(r)||!n.shiftKey&&Ds(r,"next")||!n.shiftKey&&Eg(r,!1)||!n.shiftKey&&kg(r,!1)))return n.preventDefault(),!0;return!1},ee),t.registerCommand(ff,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],Ls(o[0])?"next":"previous"),!0}if(!$(r))return!1;if(!n.shiftKey&&Ds(r,Ls(r.anchor.getNode())?"next":"previous"))return n.preventDefault(),!0;if(n.shiftKey||xo(r,"arrow","start",e.peek()),og(r,!0)){const o=n.shiftKey;return n.preventDefault(),ig(r,o,!0),!0}return!1},ee),t.registerCommand(jm,n=>{const r=V();if(be(r)){const o=r.getNodes();if(o.length>0)return n.preventDefault(),Hs(o[0],Ls(o[0])?"previous":"next"),!0}if(!$(r))return!1;if(!n.shiftKey&&Ds(r,Ls(r.anchor.getNode())?"previous":"next"))return n.preventDefault(),!0;if(n.shiftKey||xo(r,"arrow","end",e.peek()),og(r,!1)){const o=n.shiftKey;return n.preventDefault(),ig(r,o,!1),!0}return!1},ee),t.registerCommand(pf,n=>{const r=V();if(!be(r)&&wg(n.target))return!1;if($(r)){if(function(o){if(!o.isCollapsed())return!1;const{anchor:i}=o;if(i.offset!==0)return!1;const s=i.getNode();if($e(s))return!1;const l=g0(s);return l.getIndent()>0&&(l.is(s)||s.is(l.getFirstDescendant()))}(r))return n.preventDefault(),t.dispatchCommand(Zc,void 0);if(rr&&jo)return!1}else if(!be(r))return!1;return n.preventDefault(),t.dispatchCommand(Or,!0)},ee),t.registerCommand(Km,n=>{const r=V();return!(!be(r)&&wg(n.target))&&!(!$(r)&&!be(r))&&(n.preventDefault(),t.dispatchCommand(Or,!1))},ee),t.registerCommand(ji,n=>{let r=V();if(be(r)){const o=r.getNodes();o.length===1&&te(o[0])&&!o[0].isInline()&&(r=o[0].selectNext())}if(!$(r))return!1;if(xo(r,"enter","both",e.peek()),n!==null){if((rr||as||cs)&&jo)return!1;if(n.preventDefault(),n.shiftKey)return t.dispatchCommand(Ao,!1)}return t.dispatchCommand(Hi,void 0)},ee),t.registerCommand(mf,()=>{const n=V();return!!$(n)&&(t.blur(),!0)},ee),t.registerCommand(Um,n=>{const[,r]=$s(n);if(r.length>0){const o=n.clientX,i=n.clientY,s=Vl(o,i,t.getRootElement());if(s!==null){const{offset:l,node:a}=s,c=un(a);if(c!==null){const u=aa();if(D(c))u.anchor.set(c.getKey(),l,"text"),u.focus.set(c.getKey(),l,"text");else{const d=c.getParentOrThrow().getKey(),g=c.getIndexWithinParent()+1;u.anchor.set(d,g,"element"),u.focus.set(d,g,"element")}const f=kr(u);He(f)}t.dispatchCommand(Cg,r)}return n.preventDefault(),!0}return yb(n,t)},ee),t.registerCommand(Gm,n=>{const[r]=$s(n),o=V();return!(r&&!$(o))&&($(o)&&!o.isCollapsed()&&n.dataTransfer!==null&&(Z0(n.dataTransfer,G0(o)),pb(n.dataTransfer,t)),!0)},ee),t.registerCommand(Zm,n=>{const[r]=$s(n),o=V();if(r&&!$(o))return!1;const i=n.clientX,s=n.clientY,l=Vl(i,s,t.getRootElement());if(l!==null){const a=un(l.node);te(a)&&n.preventDefault()}return!0},ee),t.registerCommand(qm,()=>{const n=V();return uv($(n)&&da(n.anchor.getNode())!==null?n:null),!0},ee),t.registerCommand(sa,n=>(xg(t,Yn(n,ClipboardEvent)?n:null),!0),ee),t.registerCommand(xf,n=>(async function(r,o){await xg(o,Yn(r,ClipboardEvent)?r:null),o.update(()=>{const i=V();$(i)?i.removeText():be(i)&&i.getNodes().forEach(s=>s.remove())},{tag:l1})}(n,t),!0),ee),t.registerCommand(cf,n=>{const[,r,o]=$s(n);return r.length>0&&!o?(t.dispatchCommand(Cg,r),!0):ni(n.target)&&Nf(n.target)?!1:V()!==null&&(function(i,s){i.preventDefault(),s.update(()=>{const l=V(),a=Yn(i,InputEvent)||Yn(i,KeyboardEvent)?null:i.clipboardData;a!=null&&l!==null&&yu(a,l)},{tag:s1})}(n,t),!0)},ee),t.registerCommand(gf,()=>{const n=V();return $(n)&&xo(n,"space","both",e.peek()),!1},ee),t.registerCommand(yf,()=>{const n=V();return $(n)&&xo(n,"tab","both",e.peek()),!1},ee),t.registerCommand(Wm,n=>{const r=V();if(be(r))return Ng(r,!1,n);if(!$(r))return!1;const{anchor:o}=r;if(o.type!=="element"||o.offset!==0)return!1;const i=o.getNode();if(!O(i))return!1;const s=i.getFirstChild();if(!te(s)||!s.isInline())return!1;const l=i.getKey(),a=i.selectEnd();return n.shiftKey&&a.anchor.set(l,0,"element"),n.preventDefault(),n.stopPropagation(),!0},ee),t.registerCommand(zm,n=>{const r=V();if(be(r))return Ng(r,!0,n);if(!$(r))return!1;const{anchor:o,focus:i}=r,s=Ne(i.getNode(),c=>O(c)&&!c.isInline());if(s===null)return!1;const l=s.getFirstChild();if(!te(l)||!l.isInline()||Ne(o.getNode(),c=>O(c)&&!c.isInline())!==s)return!1;const a=s.getKey();return(i.type!=="element"||i.key!==a||i.offset!==0)&&(r.focus.set(a,0,"element"),n.shiftKey||r.anchor.set(a,0,"element"),n.preventDefault(),n.stopPropagation(),!0)},ee))}Q0.peek=Db;var Pb=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Lb={canContainEols:["highlight"],enter:{highlight:$b},exit:{highlight:Ib}};function $b(t){this.enter({type:"highlight",children:[]},t)}function Ib(t){this.exit(t)}var Rb={unsafe:[{character:"=",inConstruct:"phrasing",notInConstruct:Pb}],handlers:{highlight:Q0}};function Q0(t,e,n,r){const o="=",i=n.createTracker(r),s=n.enter("highlight");let l=i.move(o+o);return l+=i.move(n.containerPhrasing(t,{before:l,after:o,...i.current()})),l+=i.move(o+o),s(),l}function Db(){return"="}const Fb=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Mg={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function ey(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=48&&e<=57}function Hb(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function Vb(t){const e=typeof t=="string"?t.charCodeAt(0):t;return e>=97&&e<=122||e>=65&&e<=90}function Og(t){return Vb(t)||ey(t)}const Bb=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function jb(t,e){const n=e||{},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,o=[];let i=0,s=-1,l="",a,c;n.position&&("start"in n.position||"indent"in n.position?(c=n.position.indent,a=n.position.start):a=n.position);let u=(a?a.line:0)||1,f=(a?a.column:0)||1,d=h(),g;for(i--;++i<=t.length;)if(g===10&&(f=(c?c[s]:0)||1),g=t.charCodeAt(i),g===38){const m=t.charCodeAt(i+1);if(m===9||m===10||m===12||m===32||m===38||m===60||Number.isNaN(m)||r&&m===r){l+=String.fromCharCode(g),f++;continue}const x=i+1;let v=x,_=x,S;if(m===35){_=++v;const F=t.charCodeAt(_);F===88||F===120?(S="hexadecimal",_=++v):S="decimal"}else S="named";let E="",b="",w="";const k=S==="named"?Og:S==="decimal"?ey:Hb;for(_--;++_<=t.length;){const F=t.charCodeAt(_);if(!k(F))break;w+=String.fromCharCode(F),S==="named"&&Fb.includes(w)&&(E=w,b=Fd(w))}let M=t.charCodeAt(_)===59;if(M){_++;const F=S==="named"?Fd(w):!1;F&&(E=w,b=F)}let A=1+_-x,R="";if(!(!M&&n.nonTerminated===!1))if(!w)S!=="named"&&p(4,A);else if(S==="named"){if(M&&!b)p(5,1);else if(E!==w&&(_=v+E.length,A=1+_-v,M=!1),!M){const F=E?1:3;if(n.attribute){const H=t.charCodeAt(_);H===61?(p(F,A),b=""):Og(H)?b="":p(F,A)}else p(F,A)}R=b}else{M||p(2,A);let F=Number.parseInt(w,S==="hexadecimal"?16:10);if(Wb(F))p(7,A),R="�";else if(F in Mg)p(6,A),R=Mg[F];else{let H="";zb(F)&&p(6,A),F>65535&&(F-=65536,H+=String.fromCharCode(F>>>10|55296),F=56320|F&1023),R=H+String.fromCharCode(F)}}if(R){y(),d=h(),i=_-1,f+=_-x+1,o.push(R);const F=h();F.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,R,{start:d,end:F},t.slice(x-1,_)),d=F}else w=t.slice(x-1,_),l+=w,f+=w.length,i=_-1}else g===10&&(u++,s++,f=0),Number.isNaN(g)?y():(l+=String.fromCharCode(g),f++);return o.join("");function h(){return{line:u,column:f,offset:i+((a?a.offset:0)||0)}}function p(m,x){let v;n.warning&&(v=h(),v.column+=x,v.offset+=x,n.warning.call(n.warningContext||void 0,Bb[m],v,m))}function y(){l&&(o.push(l),n.text&&n.text.call(n.textContext||void 0,l,{start:d,end:h()}),l="")}}function Wb(t){return t>=55296&&t<=57343||t>1114111}function zb(t){return t>=1&&t<=8||t===11||t>=13&&t<=31||t>=127&&t<=159||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534}const Kb=/["&'<>`]/g,Jb=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ub=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Gb=/[|\\{}()[\]^$+*?.]/g,Ag=new WeakMap;function Zb(t,e){if(t=t.replace(e.subset?qb(e.subset):Kb,r),e.subset||e.escapeOnly)return t;return t.replace(Jb,n).replace(Ub,r);function n(o,i,s){return e.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,s.charCodeAt(i+2),e)}function r(o,i,s){return e.format(o.charCodeAt(0),s.charCodeAt(i+1),e)}}function qb(t){let e=Ag.get(t);return e||(e=Yb(t),Ag.set(t,e)),e}function Yb(t){const e=[];let n=-1;for(;++n"}}function t9(t){const e={},n=e.quote||'"',r=e.quoteSmart||!1,o=e.tightSelfClosing||!1,i=e.printWidth||Number.POSITIVE_INFINITY,s=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize attribute values with `"+n+"` for `options.quote`, expected `\"`, or `'`");return l.peek=r9,{handlers:{mdxJsxFlowElement:l,mdxJsxTextElement:l},unsafe:[{character:"<",inConstruct:["phrasing"]},{atBreak:!0,character:"<"}],fences:!0,resourceLink:!0};function l(a,c,u,f){const d=a.type==="mdxJsxFlowElement",g=a.name?!a.children||a.children.length===0:!1,h=ny(u),p=ry(h),y=u.createTracker(f),m=u.createTracker(f),x=[],v=(d?p:"")+"<"+(a.name||""),_=u.enter(a.type);if(y.move(v),m.move(v),a.attributes&&a.attributes.length>0){if(!a.name)throw new Error("Cannot serialize fragment w/ attributes");let k=-1;for(;++kHd(R,s)?s:n;H=W+Qb(R,{subset:[W]})+W}A=F+(H?"=":"")+H}x.push(A)}}let S=!1;const E=x.join(" ");d&&(/\r?\n|\r/.test(E)||y.current().now.column+E.length+(g?o?2:3:1)>i)&&(S=!0);let b=y,w=v;if(S){b=m;let k=-1;for(;++k"),a.children&&a.children.length>0&&(a.type==="mdxJsxTextElement"?w+=b.move(u.containerPhrasing(a,{...b.current(),before:">",after:"<"})):(b.shift(2),w+=b.move(` -`),w+=b.move(r9(a,u,b.current())),w+=b.move(` -`))),g||(w+=b.move((d?p:"")+"")),_(),w}}function r9(t,e,n){const r=e.indexStack,o=t.children,i=e.createTracker(n),s=oy(ry(e)),l=[];let a=-1;for(r.push(-1);++a")),_(),w}}function n9(t,e,n){const r=e.indexStack,o=t.children,i=e.createTracker(n),s=ry(ny(e)),l=[];let a=-1;for(r.push(-1);++a-1;){const r=t.stack[n];if(r==="blockquote"||r==="listItem")break;r==="mdxJsxFlowElement"&&e++}return e}function oy(t){return ny.repeat(t)}function o9(){return"<"}var Lg=Object.prototype.hasOwnProperty;function $g(t,e,n){for(n of t.keys())if(Mi(n,e))return n}function Mi(t,e){var n,r,o;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Mi(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(o=r,o&&typeof o=="object"&&(o=$g(e,o),!o)||!e.has(o))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(o=r[0],o&&typeof o=="object"&&(o=$g(e,o),!o)||!Mi(r[1],e.get(o)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Lg.call(t,n)&&++r&&!Lg.call(e,n)||!(n in e)||!Mi(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var i9={};let vu,iy,sy,ly,ay=!0;typeof process<"u"&&({FORCE_COLOR:vu,NODE_DISABLE_COLORS:iy,NO_COLOR:sy,TERM:ly}=i9||{},ay=process.stdout&&process.stdout.isTTY);const ae={enabled:!iy&&sy==null&&ly!=="dumb"&&(vu!=null&&vu!=="0"||ay),reset:ke(0,0),bold:ke(1,22),dim:ke(2,22),italic:ke(3,23),underline:ke(4,24),inverse:ke(7,27),hidden:ke(8,28),strikethrough:ke(9,29),black:ke(30,39),red:ke(31,39),green:ke(32,39),yellow:ke(33,39),blue:ke(34,39),magenta:ke(35,39),cyan:ke(36,39),white:ke(37,39),gray:ke(90,39),grey:ke(90,39),bgBlack:ke(40,49),bgRed:ke(41,49),bgGreen:ke(42,49),bgYellow:ke(43,49),bgBlue:ke(44,49),bgMagenta:ke(45,49),bgCyan:ke(46,49),bgWhite:ke(47,49)};function Ig(t,e){let n=0,r,o="",i="";for(;n2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={}),this.options=o;var s=this;function l(_){return i?(setTimeout(function(){i(void 0,_)},0),!0):_}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var a=n.length,c=e.length,u=1,f=a+c;o.maxEditLength&&(f=Math.min(f,o.maxEditLength));var d=(r=o.timeout)!==null&&r!==void 0?r:1/0,g=Date.now()+d,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],n,e,0);if(h[0].oldPos+1>=c&&p+1>=a)return l([{value:this.join(n),count:n.length}]);var y=-1/0,m=1/0;function x(){for(var _=Math.max(y,-u);_<=Math.min(m,u);_+=2){var S=void 0,E=h[_-1],b=h[_+1];E&&(h[_-1]=void 0);var w=!1;if(b){var k=b.oldPos-_;w=b&&0<=k&&k=c&&p+1>=a)return l(l9(s,S.lastComponent,n,e,s.useLongestToken));h[_]=S,S.oldPos+1>=c&&(m=Math.min(m,_-1)),p+1>=a&&(y=Math.max(y,_+1))}u++}if(i)(function _(){setTimeout(function(){if(u>f||Date.now()>g)return i();x()||_()},0)})();else for(;u<=f&&Date.now()<=g;){var v=x();if(v)return v}},addToPath:function(e,n,r,o){var i=e.lastComponent;return i&&i.added===n&&i.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}},extractCommon:function(e,n,r,o){for(var i=n.length,s=r.length,l=e.oldPos,a=l-o,c=0;a+1p.length?m:p}),f.value=t.join(d)}else f.value=t.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}var h=i[a-1];return a>1&&typeof h.value=="string"&&(h.added||h.removed)&&t.equals("",h.value)&&(i[a-2].value+=h.value,i.pop()),i}var Rg=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Dg=/\S/,cy=new gr;cy.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Dg.test(t)&&!Dg.test(e)};cy.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n"u"?n:s}:r;return typeof t=="string"?t:JSON.stringify(Cu(t,null,null,o),o," ")};Xi.equals=function(t,e){return gr.prototype.equals.call(Xi,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};function Cu(t,e,n,r,o){e=e||[],n=n||[],r&&(t=r(o,t));var i;for(i=0;i1?i(f):(r.consume(f),a++,u);if(a<2)return i(f);const g=r.exit(xi),h=Vd(f);return g._open=!h||h===Fg.attentionSideAfter&&!!d,g._close=!d||d===Fg.attentionSideAfter&&!!h,o(f)}}}const m9={}.hasOwnProperty,y9=Symbol("continue"),mc=Symbol("exit"),x9=Symbol("skip");function _9(t,e){let n,r;typeof e=="function"?n=e:e&&typeof e=="object"&&(e.enter&&(n=e.enter),e.leave&&(r=e.leave)),o(t,void 0,void 0,[])();function o(i,s,l,a){return yc(i)&&(c.displayName="node ("+i.type+")"),c;function c(){const u=n?Bg(n(i,s,l,a)):[];if(u[0]===mc)return u;if(u[0]!==x9){let f;for(f in i)if(m9.call(i,f)&&i[f]&&typeof i[f]=="object"&&f!=="data"&&f!=="position"){const d=a.concat(i),g=i[f];if(Array.isArray(g)){const h=g;let p=0;for(;p>-1&&p0)}function v9(t,e){const n=e.prefix||"",r=e.suffix||"",o=Object.assign({},e.acornOptions),i=[],s=[],l=o.onComment,a=o.onToken;let c=!1,u,f;const d=Object.assign({},o,{onComment:i,preserveParens:!0});a&&(d.onToken=s);const g=C9(t,e.tokenTypes),h=g.value,p=n+h+r,y=jg(h);if(y&&!e.allowEmpty)throw new it("Unexpected empty expression",{place:x(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{u=e.expression&&!y?e.acorn.parseExpressionAt(p,0,d):e.acorn.parse(p,d)}catch(v){const _=v,S=x(_.pos);_.message=String(_.message).replace(/ \(\d+:\d+\)$/,""),_.pos=S.offset,_.loc={line:S.line,column:S.column-1},f=_,c=_.raisedAt>=n.length+h.length||_.message==="Unterminated comment"}if(u&&e.expression&&!y)if(jg(p.slice(u.end,p.length-r.length)))u={type:"Program",start:0,end:n.length+h.length,body:[{type:"ExpressionStatement",expression:u,start:0,end:n.length+h.length}],sourceType:"module",comments:[]};else{const v=x(u.end),_=new Error("Unexpected content after expression");_.pos=v.offset,_.loc={line:v.line,column:v.column-1},f=_,u=void 0}if(u){if(u.comments=i,_9(u,function(v,_,S,E){let b=E[E.length-1],w=_;v.type==="ParenthesizedExpression"&&b&&w&&(typeof S=="number"&&(b=b[w],w=S),b[w]=v.expression),m(v)}),Array.isArray(l))l.push(...i);else if(typeof l=="function")for(const v of i)l(v.type==="Block",v.value,v.start,v.end,v.loc.start,v.loc.end);for(const v of s)v.end<=n.length||v.start-n.length>=h.length||(m(v),Array.isArray(a)?a.push(v):a(v))}return{estree:u,error:f,swallow:c};function m(v){const _=x(v.start),S=x(v.end);v.start=_.offset,v.end=S.offset,v.loc={start:{line:_.line,column:_.column-1,offset:_.offset},end:{line:S.line,column:S.column-1,offset:S.offset}},v.range=[v.start,v.end]}function x(v){let _=v-n.length;_<0?_=0:_>h.length&&(_=h.length);let S=b9(g.stops,_);return S||(S={line:e.start.line,column:e.start.column,offset:e.start.offset}),S}}function jg(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function C9(t,e){const n={value:"",stops:[]};let r=-1;for(;++r0&&s[0]===-1;)s.shift();const l=w9(s);n.stops.push([n.value.length,o[1].start]),n.value+=l,n.stops.push([n.value.length,o[1].end])}}}return n}function b9(t,e){let n=0;for(;n-1;){const r=t.stack[n];if(r==="blockquote"||r==="listItem")break;r==="mdxJsxFlowElement"&&e++}return e}function ry(t){return ty.repeat(t)}function r9(){return"<"}var Pg=Object.prototype.hasOwnProperty;function Lg(t,e,n){for(n of t.keys())if(Mi(n,e))return n}function Mi(t,e){var n,r,o;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Mi(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(o=r,o&&typeof o=="object"&&(o=Lg(e,o),!o)||!e.has(o))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(o=r[0],o&&typeof o=="object"&&(o=Lg(e,o),!o)||!Mi(r[1],e.get(o)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Pg.call(t,n)&&++r&&!Pg.call(e,n)||!(n in e)||!Mi(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var o9={};let vu,oy,iy,sy,ly=!0;typeof process<"u"&&({FORCE_COLOR:vu,NODE_DISABLE_COLORS:oy,NO_COLOR:iy,TERM:sy}=o9||{},ly=process.stdout&&process.stdout.isTTY);const ae={enabled:!oy&&iy==null&&sy!=="dumb"&&(vu!=null&&vu!=="0"||ly),reset:ke(0,0),bold:ke(1,22),dim:ke(2,22),italic:ke(3,23),underline:ke(4,24),inverse:ke(7,27),hidden:ke(8,28),strikethrough:ke(9,29),black:ke(30,39),red:ke(31,39),green:ke(32,39),yellow:ke(33,39),blue:ke(34,39),magenta:ke(35,39),cyan:ke(36,39),white:ke(37,39),gray:ke(90,39),grey:ke(90,39),bgBlack:ke(40,49),bgRed:ke(41,49),bgGreen:ke(42,49),bgYellow:ke(43,49),bgBlue:ke(44,49),bgMagenta:ke(45,49),bgCyan:ke(46,49),bgWhite:ke(47,49)};function $g(t,e){let n=0,r,o="",i="";for(;n2&&arguments[2]!==void 0?arguments[2]:{},i=o.callback;typeof o=="function"&&(i=o,o={}),this.options=o;var s=this;function l(_){return i?(setTimeout(function(){i(void 0,_)},0),!0):_}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var a=n.length,c=e.length,u=1,f=a+c;o.maxEditLength&&(f=Math.min(f,o.maxEditLength));var d=(r=o.timeout)!==null&&r!==void 0?r:1/0,g=Date.now()+d,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],n,e,0);if(h[0].oldPos+1>=c&&p+1>=a)return l([{value:this.join(n),count:n.length}]);var y=-1/0,m=1/0;function x(){for(var _=Math.max(y,-u);_<=Math.min(m,u);_+=2){var S=void 0,E=h[_-1],b=h[_+1];E&&(h[_-1]=void 0);var w=!1;if(b){var k=b.oldPos-_;w=b&&0<=k&&k=c&&p+1>=a)return l(s9(s,S.lastComponent,n,e,s.useLongestToken));h[_]=S,S.oldPos+1>=c&&(m=Math.min(m,_-1)),p+1>=a&&(y=Math.max(y,_+1))}u++}if(i)(function _(){setTimeout(function(){if(u>f||Date.now()>g)return i();x()||_()},0)})();else for(;u<=f&&Date.now()<=g;){var v=x();if(v)return v}},addToPath:function(e,n,r,o){var i=e.lastComponent;return i&&i.added===n&&i.removed===r?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}},extractCommon:function(e,n,r,o){for(var i=n.length,s=r.length,l=e.oldPos,a=l-o,c=0;a+1p.length?m:p}),f.value=t.join(d)}else f.value=t.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}var h=i[a-1];return a>1&&typeof h.value=="string"&&(h.added||h.removed)&&t.equals("",h.value)&&(i[a-2].value+=h.value,i.pop()),i}var Ig=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Rg=/\S/,ay=new gr;ay.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Rg.test(t)&&!Rg.test(e)};ay.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n"u"?n:s}:r;return typeof t=="string"?t:JSON.stringify(Cu(t,null,null,o),o," ")};Xi.equals=function(t,e){return gr.prototype.equals.call(Xi,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};function Cu(t,e,n,r,o){e=e||[],n=n||[],r&&(t=r(o,t));var i;for(i=0;i1?i(f):(r.consume(f),a++,u);if(a<2)return i(f);const g=r.exit(xi),h=Vd(f);return g._open=!h||h===Dg.attentionSideAfter&&!!d,g._close=!d||d===Dg.attentionSideAfter&&!!h,o(f)}}}const p9={}.hasOwnProperty,m9=Symbol("continue"),mc=Symbol("exit"),y9=Symbol("skip");function x9(t,e){let n,r;typeof e=="function"?n=e:e&&typeof e=="object"&&(e.enter&&(n=e.enter),e.leave&&(r=e.leave)),o(t,void 0,void 0,[])();function o(i,s,l,a){return yc(i)&&(c.displayName="node ("+i.type+")"),c;function c(){const u=n?Vg(n(i,s,l,a)):[];if(u[0]===mc)return u;if(u[0]!==y9){let f;for(f in i)if(p9.call(i,f)&&i[f]&&typeof i[f]=="object"&&f!=="data"&&f!=="position"){const d=a.concat(i),g=i[f];if(Array.isArray(g)){const h=g;let p=0;for(;p>-1&&p0)}function _9(t,e){const n=e.prefix||"",r=e.suffix||"",o=Object.assign({},e.acornOptions),i=[],s=[],l=o.onComment,a=o.onToken;let c=!1,u,f;const d=Object.assign({},o,{onComment:i,preserveParens:!0});a&&(d.onToken=s);const g=v9(t,e.tokenTypes),h=g.value,p=n+h+r,y=Bg(h);if(y&&!e.allowEmpty)throw new it("Unexpected empty expression",{place:x(0),ruleId:"unexpected-empty-expression",source:"micromark-extension-mdx-expression"});try{u=e.expression&&!y?e.acorn.parseExpressionAt(p,0,d):e.acorn.parse(p,d)}catch(v){const _=v,S=x(_.pos);_.message=String(_.message).replace(/ \(\d+:\d+\)$/,""),_.pos=S.offset,_.loc={line:S.line,column:S.column-1},f=_,c=_.raisedAt>=n.length+h.length||_.message==="Unterminated comment"}if(u&&e.expression&&!y)if(Bg(p.slice(u.end,p.length-r.length)))u={type:"Program",start:0,end:n.length+h.length,body:[{type:"ExpressionStatement",expression:u,start:0,end:n.length+h.length}],sourceType:"module",comments:[]};else{const v=x(u.end),_=new Error("Unexpected content after expression");_.pos=v.offset,_.loc={line:v.line,column:v.column-1},f=_,u=void 0}if(u){if(u.comments=i,x9(u,function(v,_,S,E){let b=E[E.length-1],w=_;v.type==="ParenthesizedExpression"&&b&&w&&(typeof S=="number"&&(b=b[w],w=S),b[w]=v.expression),m(v)}),Array.isArray(l))l.push(...i);else if(typeof l=="function")for(const v of i)l(v.type==="Block",v.value,v.start,v.end,v.loc.start,v.loc.end);for(const v of s)v.end<=n.length||v.start-n.length>=h.length||(m(v),Array.isArray(a)?a.push(v):a(v))}return{estree:u,error:f,swallow:c};function m(v){const _=x(v.start),S=x(v.end);v.start=_.offset,v.end=S.offset,v.loc={start:{line:_.line,column:_.column-1,offset:_.offset},end:{line:S.line,column:S.column-1,offset:S.offset}},v.range=[v.start,v.end]}function x(v){let _=v-n.length;_<0?_=0:_>h.length&&(_=h.length);let S=C9(g.stops,_);return S||(S={line:e.start.line,column:e.start.column,offset:e.start.offset}),S}}function Bg(t){return/^\s*$/.test(t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,""))}function v9(t,e){const n={value:"",stops:[]};let r=-1;for(;++r0&&s[0]===-1;)s.shift();const l=b9(s);n.stops.push([n.value.length,o[1].start]),n.value+=l,n.stops.push([n.value.length,o[1].end])}}}return n}function C9(t,e){let n=0;for(;n-1?t:void 0}const S9=2,No="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",E9="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",T9="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",zg="#unexpected-type-in-code-expected-an-object-spread-spread",k9="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",N9="#could-not-parse-expression-with-acorn";function Kg(t,e,n,r,o,i,s,l,a,c,u){const f=this,d=this.events.length+3;let g=0,h,p;return y;function y(_){return t.enter(n),t.enter(r),t.consume(_),t.exit(r),h=f.now(),m}function m(_){if(_===null){if(p)throw p;const S=new it("Unexpected end of file in expression, expected a corresponding closing brace for `{`",{place:f.now(),ruleId:"unexpected-eof",source:"micromark-extension-mdx-expression"});throw S.url=No+E9,S}if(rn(_))return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),v;if(_===125&&g===0){const S=i?M9.call(f,i,s,o,d,h,c||!1,a||!1):{type:"ok",estree:void 0};if(S.type==="ok"){t.enter(r),t.consume(_),t.exit(r);const E=t.exit(n);return l&&S.estree&&Object.assign(E,{estree:S.estree}),e}return p=S.message,t.enter(o),t.consume(_),x}return t.enter(o),x(_)}function x(_){return _===125&&g===0||_===null||rn(_)?(t.exit(o),m(_)):(_===123&&!i?g+=1:_===125&&(g-=1),t.consume(_),x)}function v(_){const S=f.now();if(S.line!==h.line&&!u&&f.parser.lazy[S.line]){const E=new it("Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",{place:f.now(),ruleId:"unexpected-lazy",source:"micromark-extension-mdx-expression"});throw E.url=No+T9,E}return pl(_)?tf(t,m,"linePrefix",S9+1)(_):m(_)}}function M9(t,e,n,r,o,i,s){const l=v9(this.events.slice(r),{acorn:t,tokenTypes:[n],acornOptions:e,start:o,expression:!0,allowEmpty:i,prefix:s?"({":"",suffix:s?"})":""}),a=l.estree;if(s&&a){const c=a.body[0];if(c.type!=="ExpressionStatement"||c.expression.type!=="ObjectExpression"){const u=xc(c),f=new it("Unexpected `"+c.type+"` in code: expected an object spread (`{...spread}`)",{place:u.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw f.url=No+zg,f}if(c.expression.properties[1]){const u=xc(c.expression.properties[1]),f=new it("Unexpected extra content in spread: only a single spread is supported",{place:u.start,ruleId:"spread-extra",source:"micromark-extension-mdx-expression"});throw f.url=No+k9,f}if(c.expression.properties[0]&&c.expression.properties[0].type!=="SpreadElement"){const u=xc(c.expression.properties[0]),f=new it("Unexpected `"+c.expression.properties[0].type+"` in code: only spread elements are supported",{place:u.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw f.url=No+zg,f}}if(l.error){const c=new it("Could not parse expression with acorn",{cause:l.error,place:{line:l.error.loc.line,column:l.error.loc.column+1,offset:l.error.pos},ruleId:"acorn",source:"micromark-extension-mdx-expression"});return c.url=No+N9,{type:"nok",message:c}}return{type:"ok",estree:a}}const Jg="https://github.com/micromark/micromark-extension-mdx-jsx";function fy(t,e,n,r,o,i,s,l,a,c,u,f,d,g,h,p,y,m,x,v,_,S,E,b,w,k,M,A,R,F,H,W){const z=this;let B,K;return J;function J(T){return t.enter(l),t.enter(a),t.consume(T),t.exit(a),X}function X(T){return xr(T)?n(T):(B=ie,De(T))}function ie(T){if(T===47)return t.enter(c),t.consume(T),t.exit(c),B=xe,De;if(T===62)return Ts(T);if(T!==null&&T>=0&&zt(T))return t.enter(f),t.enter(d),t.consume(T),de;Be(T,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(T===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function xe(T){if(T===62)return Ts(T);if(T!==null&&T>=0&&zt(T))return t.enter(f),t.enter(d),t.consume(T),de;Be(T,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(T===42||T===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function de(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),de;if(T===46||T===47||T===58||T===62||T===123||xr(T)||Un(T))return t.exit(d),B=Ve,De(T);Be(T,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(T===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function Ve(T){if(T===46)return t.enter(g),t.consume(T),t.exit(g),B=qe,De;if(T===58)return t.enter(p),t.consume(T),t.exit(p),B=G,De;if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(f),le(T);Be(T,"after name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function qe(T){if(T!==null&&T>=0&&zt(T))return t.enter(h),t.consume(T),oe;Be(T,"before member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function oe(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),oe;if(T===46||T===47||T===62||T===123||xr(T)||Un(T))return t.exit(h),B=me,De(T);Be(T,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(T===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function me(T){if(T===46)return t.enter(g),t.consume(T),t.exit(g),B=qe,De;if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(f),le(T);Be(T,"after member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function G(T){if(T!==null&&T>=0&&zt(T))return t.enter(y),t.consume(T),se;Be(T,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(T===43||T!==null&&T>46&&T<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function se(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),se;if(T===47||T===62||T===123||xr(T)||Un(T))return t.exit(y),B=Oe,De(T);Be(T,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Oe(T){if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(f),le(T);Be(T,"after local name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function le(T){if(T===47)return t.enter(u),t.consume(T),t.exit(u),B=ho,De;if(T===62)return Ts(T);if(T===123)return Kg.call(z,t,ue,m,x,v,r,o,i,!0,!1,s)(T);if(T!==null&&T>=0&&zt(T))return t.enter(_),t.enter(S),t.enter(E),t.consume(T),ge;Be(T,"before attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function ue(T){return B=le,De(T)}function ge(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),ge;if(T===47||T===58||T===61||T===62||T===123||xr(T)||Un(T))return t.exit(E),B=Nt,De(T);Be(T,"in attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Nt(T){if(T===58)return t.enter(b),t.consume(T),t.exit(b),B=Mt,De;if(T===61)return t.exit(S),t.enter(k),t.consume(T),t.exit(k),B=Jn,De;if(T===47||T===62||T===123||xr(T)||Un(T)||T!==null&&T>=0&&zt(T))return t.exit(S),t.exit(_),B=le,De(T);Be(T,"after attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function Mt(T){if(T!==null&&T>=0&&zt(T))return t.enter(w),t.consume(T),en;Be(T,"before local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function en(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),en;if(T===47||T===61||T===62||T===123||xr(T)||Un(T))return t.exit(w),t.exit(S),B=Kn,De(T);Be(T,"in local attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Kn(T){if(T===61)return t.enter(k),t.consume(T),t.exit(k),B=Jn,De;if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(_),le(T);Be(T,"after local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function Jn(T){if(T===34||T===39)return t.enter(M),t.enter(A),t.consume(T),t.exit(A),K=T,ui;if(T===123)return Kg.call(z,t,Ga,F,H,W,r,o,i,!1,!1,s)(T);Be(T,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(T===60?" (note: to use an element or fragment as a prop value in MDX, use `{}`)":""))}function Ga(T){return t.exit(_),B=le,De(T)}function ui(T){return T===null&&Be(T,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(K)+"`"),T===K?(t.enter(A),t.consume(T),t.exit(A),t.exit(M),t.exit(_),K=void 0,B=le,De):rn(T)?(B=ui,De(T)):(t.enter(R),Es(T))}function Es(T){return T===null||T===K||rn(T)?(t.exit(R),ui(T)):(t.consume(T),Es)}function ho(T){if(T===62)return Ts(T);Be(T,"after self-closing slash","`>` to end the tag"+(T===42||T===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function Ts(T){return t.enter(a),t.consume(T),t.exit(a),t.exit(l),e}function De(T){return rn(T)?(t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),o2):pl(T)||Un(T)?(t.enter("esWhitespace"),Id(T)):B(T)}function Id(T){return rn(T)?(t.exit("esWhitespace"),De(T)):pl(T)||Un(T)?(t.consume(T),Id):(t.exit("esWhitespace"),B(T))}function o2(T){if(!s&&z.parser.lazy[z.now().line]){const ks=new it("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",z.now(),"micromark-extension-mdx-jsx:unexpected-lazy");throw ks.url=Jg+"#unexpected-lazy-line-in-container-expected-line-to-be",ks}return De(T)}function Be(T,ks,i2){const Rd=new it("Unexpected "+(T===null?"end of file":"character `"+(T===96?"` ` `":String.fromCodePoint(T))+"` ("+O9(T)+")")+" "+ks+", expected "+i2,z.now(),"micromark-extension-mdx-jsx:unexpected-"+(T===null?"eof":"character"));throw Rd.url=Jg+(T===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),Rd}}function O9(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function A9(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(r,o,i){return fy.call(this,r,o,i,t,e.acornOptions,e.addResult,!0,"mdxJsxTextTag","mdxJsxTextTagMarker","mdxJsxTextTagClosingMarker","mdxJsxTextTagSelfClosingMarker","mdxJsxTextTagName","mdxJsxTextTagNamePrimary","mdxJsxTextTagNameMemberMarker","mdxJsxTextTagNameMember","mdxJsxTextTagNamePrefixMarker","mdxJsxTextTagNameLocal","mdxJsxTextTagExpressionAttribute","mdxJsxTextTagExpressionAttributeMarker","mdxJsxTextTagExpressionAttributeValue","mdxJsxTextTagAttribute","mdxJsxTextTagAttributeName","mdxJsxTextTagAttributeNamePrimary","mdxJsxTextTagAttributeNamePrefixMarker","mdxJsxTextTagAttributeNameLocal","mdxJsxTextTagAttributeInitializerMarker","mdxJsxTextTagAttributeValueLiteral","mdxJsxTextTagAttributeValueLiteralMarker","mdxJsxTextTagAttributeValueLiteralValue","mdxJsxTextTagAttributeValueExpression","mdxJsxTextTagAttributeValueExpressionMarker","mdxJsxTextTagAttributeValueExpressionValue")}}function P9(t,e){return{concrete:!0,name:"mdxJsxFlowTag",tokenize:n};function n(r,o,i){const s=this;return l;function l(f){return a(f)}function a(f){return fy.call(s,r,c,i,t,e.acornOptions,e.addResult,!1,"mdxJsxFlowTag","mdxJsxFlowTagMarker","mdxJsxFlowTagClosingMarker","mdxJsxFlowTagSelfClosingMarker","mdxJsxFlowTagName","mdxJsxFlowTagNamePrimary","mdxJsxFlowTagNameMemberMarker","mdxJsxFlowTagNameMember","mdxJsxFlowTagNamePrefixMarker","mdxJsxFlowTagNameLocal","mdxJsxFlowTagExpressionAttribute","mdxJsxFlowTagExpressionAttributeMarker","mdxJsxFlowTagExpressionAttributeValue","mdxJsxFlowTagAttribute","mdxJsxFlowTagAttributeName","mdxJsxFlowTagAttributeNamePrimary","mdxJsxFlowTagAttributeNamePrefixMarker","mdxJsxFlowTagAttributeNameLocal","mdxJsxFlowTagAttributeInitializerMarker","mdxJsxFlowTagAttributeValueLiteral","mdxJsxFlowTagAttributeValueLiteralMarker","mdxJsxFlowTagAttributeValueLiteralValue","mdxJsxFlowTagAttributeValueExpression","mdxJsxFlowTagAttributeValueExpressionMarker","mdxJsxFlowTagAttributeValueExpressionValue")(f)}function c(f){return pl(f)?tf(r,u,"whitespace")(f):u(f)}function u(f){const d=s.parser.constructs.flow[123],g=Array.isArray(d)?d:d?[d]:[];let h;for(const p of g)if(p.name==="mdxFlowExpression"){h=p;break}return f===60?l(f):f===123&&h?r.attempt(h,u,i)(f):f===null||rn(f)?o(f):i(f)}}}function L9(t){const e={},n=e.acorn;let r;if(n){if(!n.parse||!n.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");r=Object.assign({ecmaVersion:2024,sourceType:"module"},e.acornOptions,{locations:!0})}else if(e.acornOptions||e.addResult)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{60:P9(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})},text:{60:A9(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})}}}function $9(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const I9=["mdxJsxTextElement","mdxJsxFlowElement"];function dy(t){return I9.includes(t.type)&&R9.includes(t.name)}const R9=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function D9(t,e){const n=Ug(t),r=Ug(e),o={...n,...r};return F9(o)}function Ug(t){const e={};return t.split(";").filter(r=>r.trim()!=="").forEach(r=>{const[o,i]=r.split(":").map(s=>s.trim());e[o]=i}),e}function F9(t){return Object.entries(t).map(([e,n])=>`${e}: ${n}`).join("; ")}function H9(t){return t.children instanceof Array}function V9({root:t,visitors:e,jsxComponentDescriptors:n,jsxIsAvailable:r,addImportStatements:o=!0}){let i=null;const s=new Set,l=new Map;e=[...e].sort((m,x)=>(x.priority??0)-(m.priority??0)),f(t,null);function a(m,x){s.add(m),x&&l.set(m,{...x})}function c(m,x){if(i===null)return i=x,i;if(!H9(m))throw new Error("Attempting to append children to a non-parent");const v=m.children,_=v.at(-1);if(_){const S=e.find(E=>{var b;return(b=E.shouldJoin)==null?void 0:b.call(E,_,x)});if(S){const E=S.join(_,x);return v.splice(v.length-1,1,E),E}}return v.push(x),x}function u(m,x){m.getChildren().forEach(v=>{f(v,x)})}function f(m,x,v=null){var _;const S=e.find((E,b)=>{var w;return v!=null&&v.has(b)?!1:(w=E.testLexicalNode)==null?void 0:w.call(E,m)});if(!S)throw new Error(`no lexical visitor found for ${m.getType()}`,{cause:m});(_=S.visitLexicalNode)==null||_.call(S,{lexicalNode:m,mdastParent:x,actions:{addAndStepInto(E,b={},w=!0){const k={type:E,...b,...w?{children:[]}:{}};c(x,k),O(m)&&w&&u(m,k)},appendToParent:c,visitChildren:u,visit:f,registerReferredComponent:a,nextVisitor(){f(m,x,(v??new Set).add(e.indexOf(S)))}}})}if(i===null)throw new Error("traversal ended with no root element");const d=new Map,g=new Map;for(const m of s){const x=n.find(v=>v.name===m)??l.get(m)??n.find(v=>v.name==="*");if(!x)throw new Error(`Component ${m} is used but not imported`);if(x.source)if(x.defaultExport)g.set(m,x.source);else{const{source:v}=x,_=d.get(v);_?_.push(m):d.set(v,[m])}}if(!o){for(const[m,x]of d.entries()){const v=x.filter(_=>l.has(_));v.length>0?d.set(m,v):d.delete(m)}for(const m of g.keys())l.has(m)||g.delete(m)}const h=Array.from(d).map(([m,x])=>({type:"mdxjsEsm",value:`import { ${x.join(", ")} } from '${m}'`}));h.push(...Array.from(g).map(([m,x])=>({type:"mdxjsEsm",value:`import ${m} from '${x}'`})));const p=i,y=p.children.find(m=>m.type==="yaml");return y?p.children.splice(p.children.indexOf(y)+1,0,...h):p.children.unshift(...h),ll(p,[]),hy(p),r||gy(p),p}function hy(t){if("children"in t&&t.children.length>0){if(dy(t)&&t.children.length===1){const e=t.children[0];e.type==="mdxJsxTextElement"&&e.name==="span"&&(e.attributes.forEach(n=>{if(n.type==="mdxJsxAttribute"){const r=t.attributes.find(o=>o.type==="mdxJsxAttribute"&&o.name===n.name);if(r)if(n.name==="className"){const o=new Set([...r.value.split(" "),...n.value.split(" ")]);r.value=Array.from(o).join(" ")}else n.name==="style"&&(r.value=D9(r.value,n.value));else t.attributes.push(n)}}),t.children=e.children)}t.children.forEach(e=>{hy(e)})}}function gy(t){if(Object.hasOwn(t,"children")){const e=t,n=[];e.children.forEach(r=>{r.type==="mdxJsxTextElement"&&r.name==="u"?n.push({type:"html",value:""},...r.children,{type:"html",value:""}):(n.push(r),gy(r))}),e.children=n}}const Gg=/\s+$/,Zg=/^\s+/;function ll(t,e){if(t.type==="strong"||t.type==="emphasis"){const n=t.children.at(-1);if((n==null?void 0:n.type)==="text"){const o=Gg.exec(n.value);if(o){n.value=n.value.replace(Gg,"");const i=e.at(-1);i&&(i.children.splice(i.children.indexOf(t)+1,0,{type:"text",value:o[0]}),ll(i,e.slice(0,-1)))}}const r=t.children.at(0);if((r==null?void 0:r.type)==="text"){const o=Zg.exec(r.value);if(o){r.value=r.value.replace(Zg,"");const i=e.at(-1);i&&(i.children.splice(i.children.indexOf(t),0,{type:"text",value:o[0]}),ll(i,e.slice(0,-1)))}}}if("children"in t&&t.children.length>0){const n=t;n.children.forEach(r=>{ll(r,[...e,n])})}}function py({root:t,toMarkdownOptions:e,toMarkdownExtensions:n,visitors:r,jsxComponentDescriptors:o,jsxIsAvailable:i}){return um(V9({root:t,visitors:r,jsxComponentDescriptors:o,jsxIsAvailable:i}),{extensions:n,...e})+` -`}function _i(t){return t.children instanceof Array}class wu extends Error{constructor(e,n){super(e),this.name="MarkdownParseError",this.cause=n}}class Su extends Error{constructor(e){super(e),this.name="UnrecognizedMarkdownConstructError"}}function B9(t){const e=new Map;return t.type!=="root"?{importDeclarations:{}}:(t.children.filter(r=>r.type==="mdxjsEsm").filter(r=>r.value.startsWith("import ")).forEach(r=>{var o,i;(((i=(o=r.data)==null?void 0:o.estree)==null?void 0:i.body)??[]).forEach(s=>{s.type==="ImportDeclaration"&&s.specifiers.forEach(l=>{e.set(l.local.name,{source:`${s.source.value}`,defaultExport:l.type==="ImportDefaultSpecifier"})})})}),{importDeclarations:Object.fromEntries(e.entries())})}function j9({root:t,markdown:e,visitors:n,syntaxExtensions:r,mdastExtensions:o,...i}){var s;let l;try{l=h2(e,{extensions:r,mdastExtensions:o})}catch(a){throw a instanceof Error?new wu(`Error parsing markdown: ${a.message}`,a):new wu(`Error parsing markdown: ${a}`,a)}l.children.length===0&&l.children.push({type:"paragraph",children:[]}),((s=l.children.at(-1))==null?void 0:s.type)!=="paragraph"&&l.children.push({type:"paragraph",children:[]}),W9({root:t,mdastRoot:l,visitors:n,...i})}function W9({root:t,mdastRoot:e,visitors:n,...r}){const o=new WeakMap,i=new WeakMap,s=B9(e);n=n.sort((c,u)=>(u.priority??0)-(c.priority??0));function l(c,u){if(!_i(c))throw new Error("Attempting to visit children of a non-parent");c.children.forEach(f=>{a(f,u,c)})}function a(c,u,f,d=null){const g=n.find((h,p)=>d!=null&&d.has(p)?!1:typeof h.testNode=="string"?h.testNode===c.type:h.testNode(c,r));if(!g)try{throw new Su(`Unsupported markdown syntax: ${um(c)}`)}catch{throw new Su(`Parsing of the following markdown structure failed: ${JSON.stringify({type:c.type,name:"name"in c?c.name:"N/A"})}`)}g.visitNode({mdastNode:c,lexicalParent:u,mdastParent:f,descriptors:r,metaData:s,actions:{visitChildren:l,nextVisitor(){a(c,u,f,(d??new Set).add(n.indexOf(g)))},addAndStepInto(h){u.append(h),_i(c)&&l(c,h)},addFormatting(h,p){p||_i(c)&&(p=c),p&&o.set(p,h|(o.get(f)??0))},removeFormatting(h,p){p||_i(c)&&(p=c),p&&o.set(p,h^(o.get(f)??0))},getParentFormatting(){return o.get(f)??0},addStyle(h,p){p||_i(c)&&(p=c),p&&i.set(p,h)},getParentStyle(){return i.get(f)??""}}})}a(e,t,null)}function Ho(){}var z9=Object.defineProperty,K9=(t,e,n)=>e in t?z9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vc=(t,e,n)=>(K9(t,typeof e!="symbol"?e+"":e,n),n);const qg="generic-html";class _s extends ft{constructor(e,n,r,o){super(o),vc(this,"__tag"),vc(this,"__nodeType"),vc(this,"__attributes"),this.__tag=e,this.__nodeType=n,this.__attributes=r}static getType(){return qg}static clone(e){return new _s(e.__tag,e.__nodeType,e.__attributes,e.__key)}getTag(){return this.__tag}getNodeType(){return this.__nodeType}getAttributes(){return this.__attributes}updateAttributes(e){const n=this.getWritable();n.__attributes=e}getStyle(){var e;return(e=this.__attributes.find(n=>n.name==="style"))==null?void 0:e.value}createDOM(){const e=this.__tag,n=document.createElement(e);return this.__attributes.forEach(r=>{n.setAttribute(r.name,r.value)}),n}updateDOM(){return!1}static importDOM(){return{}}exportDOM(e){const{element:n}=super.exportDOM(e);return{element:n}}static importJSON(e){const n=my(e.tag,e.mdxType,e.attributes);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),attributes:this.__attributes,mdxType:this.__nodeType,type:qg,version:1}}extractWithChild(){return!0}isInline(){return this.__nodeType==="mdxJsxTextElement"}}function my(t,e,n){return kt(new _s(t,e,n))}function J9(t){return t instanceof _s}const U9={testLexicalNode:J9,visitLexicalNode({actions:t,lexicalNode:e}){t.addAndStepInto("mdxJsxTextElement",{name:e.getTag(),type:e.getNodeType(),attributes:e.getAttributes()})},priority:-100},G9={testLexicalNode:rt,visitLexicalNode:({mdastParent:t,actions:e})=>{e.appendToParent(t,{type:"text",value:` -`})}},Z9={testLexicalNode:Qo,visitLexicalNode:({actions:t})=>{t.addAndStepInto("paragraph")}},q9={testLexicalNode:$e,visitLexicalNode:({actions:t})=>{t.addAndStepInto("root")}},Oi=1,Ai=2,al=4,Pi=8,Yf=16,cl=32,ul=64,fl=128;function Yg(t){return t.type==="text"}const Y9=["u","span","sub","sup"],X9={shouldJoin:(t,e)=>{if(["text","emphasis","strong","highlight"].includes(t.type))return t.type===e.type;if(t.type==="mdxJsxTextElement"&&e.type==="mdxJsxTextElement"&&Y9.includes(e.name)){const n=e;return t.name===n.name&&JSON.stringify(t.attributes)===JSON.stringify(n.attributes)}return!1},join(t,e){return Yg(t)&&Yg(e)?{type:"text",value:t.value+e.value}:{...t,children:[...t.children,...e.children]}},testLexicalNode:D,visitLexicalNode:({lexicalNode:t,mdastParent:e,actions:n})=>{const r=t.getPreviousSibling(),o=D(r)?r.getFormat():0,i=t.getTextContent(),s=t.getFormat(),l=t.getStyle();let a=e;if(l&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"span",children:[],attributes:[{type:"mdxJsxAttribute",name:"style",value:l}]})),o&s&Pi&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"u",children:[],attributes:[]})),o&s&ul&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sup",children:[],attributes:[]})),o&s&cl&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sub",children:[],attributes:[]})),o&s&Ai&&(a=n.appendToParent(a,{type:"emphasis",children:[]})),o&s&Oi&&(a=n.appendToParent(a,{type:"strong",children:[]})),o&s&al&&(a=n.appendToParent(a,{type:"delete",children:[]})),o&s&fl&&(a=n.appendToParent(a,{type:"highlight",children:[]})),s&Pi&&!(o&Pi)&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"u",children:[],attributes:[]})),s&ul&&!(o&ul)&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sup",children:[],attributes:[]})),s&cl&&!(o&cl)&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sub",children:[],attributes:[]})),s&Ai&&!(o&Ai)&&(a=n.appendToParent(a,{type:"emphasis",children:[]})),s&Oi&&!(o&Oi)&&(a=n.appendToParent(a,{type:"strong",children:[]})),s&al&&!(o&al)&&(a=n.appendToParent(a,{type:"delete",children:[]})),s&fl&&!(o&fl)&&(a=n.appendToParent(a,{type:"highlight",children:[]})),s&Yf){n.appendToParent(a,{type:"inlineCode",value:i});return}n.appendToParent(a,{type:"text",value:i})}},Q9={testNode:"break",visitNode:function({lexicalParent:t}){t.append(_t())}};function Vs(t,e){return[{testNode:n=>n.type==="mdxJsxTextElement"&&n.name===t,visitNode({actions:n,mdastNode:r,lexicalParent:o}){n.addFormatting(e),n.visitChildren(r,o)}},{testNode:n=>n.type==="html"&&n.value===`<${t}>`,visitNode({actions:n,mdastParent:r}){n.addFormatting(e,r)}},{testNode:n=>n.type==="html"&&n.value===``,visitNode({actions:n,mdastParent:r}){n.removeFormatting(e,r)}}]}const e3={testNode:"delete",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(al),e.visitChildren(t,n)}},t3={testNode:"highlight",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(fl),e.visitChildren(t,n)}},n3={testNode:"inlineCode",visitNode({mdastNode:t,actions:e}){e.addAndStepInto(Pe(t.value).setFormat(e.getParentFormatting()|Yf))}},r3={testNode:"emphasis",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(Ai),e.visitChildren(t,n)}},o3={testNode:"strong",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(Oi),e.visitChildren(t,n)}},i3=[r3,o3,...Vs("u",Pi),...Vs("code",Yf),n3,e3,t3,...Vs("sup",ul),...Vs("sub",cl)],s3={testNode:dy,visitNode:function({mdastNode:t,actions:e,lexicalParent:n}){t.name==="span"&&t.attributes.length===1&&t.attributes[0].type==="mdxJsxAttribute"&&t.attributes[0].name==="style"?(e.addStyle(t.attributes[0].value,t),e.visitChildren(t,n)):e.addAndStepInto(my(t.name,t.type,t.attributes))},priority:-100},l3=["listitem","admonition"],a3={testNode:"paragraph",visitNode:function({mdastNode:t,mdastParent:e,lexicalParent:n,actions:r}){const o=n.getType();if(l3.includes(o)){const i=(e==null?void 0:e.children.indexOf(t))??-1,s=i>0?e==null?void 0:e.children.at(i-1):void 0;o==="listitem"&&(s==null?void 0:s.type)==="paragraph"&&n.append(_t(),_t()),r.visitChildren(t,n)}else r.addAndStepInto(re())}},c3={testNode:"root",visitNode({actions:t,mdastNode:e,lexicalParent:n}){t.visitChildren(e,n)}},u3={testNode:"text",visitNode({mdastNode:t,actions:e}){const n=Pe(t.value);n.setFormat(e.getParentFormatting());const r=e.getParentStyle();r!==""&&n.setStyle(r),e.addAndStepInto(n)}},Kt={dash:45,eof:null,exclamationMark:33,greaterThan:62},br={data:"data",lineEnding:"lineEnding",linePrefix:"linePrefix"};function f3(t){return{canContainEols:["comment"],enter:{comment(e){this.buffer()}},exit:{comment(e){this.resume()}}}}const Xg=(t,e,n)=>{return r;function r(h){return t.enter("comment"),t.consume(h),o}function o(h){return h===Kt.exclamationMark?(t.consume(h),i):n(h)}function i(h){return h===Kt.dash?(t.consume(h),s):n(h)}function s(h){return h===Kt.dash?(t.consume(h),l):n(h)}function l(h){return h===Kt.greaterThan?n(h):rn(h)?u(h):(t.enter(br.data),h===Kt.dash?(t.consume(h),a):c(h))}function a(h){return h===Kt.greaterThan?n(h):c(h)}function c(h){return h===Kt.eof?n(h):h===Kt.dash?(t.consume(h),d):rn(h)?(t.exit(br.data),u(h)):(t.consume(h),c)}function u(h){return t.enter(br.lineEnding),t.consume(h),t.exit(br.lineEnding),tf(t,f,br.linePrefix)}function f(h){return rn(h)?u(h):(t.enter(br.data),c(h))}function d(h){return h===Kt.dash?(t.consume(h),g):c(h)}function g(h){return h===Kt.greaterThan?(t.exit(br.data),t.enter("commentEnd"),t.consume(h),t.exit("commentEnd"),t.exit("comment"),e(h)):h===Kt.dash?(t.consume(h),g):c(h)}},d3={flow:{60:{tokenize:Xg,concrete:!0}},text:{60:{tokenize:Xg}}},h3="_bold_6j9u9_10",g3="_italic_6j9u9_14",p3="_underline_6j9u9_18",m3="_strikethrough_6j9u9_34",y3="_underlineStrikethrough_6j9u9_38",x3="_subscript_6j9u9_42",_3="_superscript_6j9u9_47",v3="_code_6j9u9_52",C3="_quote_6j9u9_59",b3="_nestedListItem_6j9u9_66",w3="_listitem_6j9u9_76",S3="_listItemChecked_6j9u9_80",E3="_listItemUnchecked_6j9u9_81",T3="_admonitionDanger_6j9u9_158",k3="_admonitionInfo_6j9u9_159",N3="_admonitionNote_6j9u9_160",M3="_admonitionTip_6j9u9_161",O3="_admonitionCaution_6j9u9_162",je={bold:h3,italic:g3,underline:p3,strikethrough:m3,underlineStrikethrough:y3,subscript:x3,superscript:_3,code:v3,quote:C3,nestedListItem:b3,listitem:w3,listItemChecked:S3,listItemUnchecked:E3,admonitionDanger:T3,admonitionInfo:k3,admonitionNote:N3,admonitionTip:M3,admonitionCaution:O3},yy={quote:je.quote,text:{bold:je.bold,italic:je.italic,underline:je.underline,code:je.code,strikethrough:je.strikethrough,subscript:je.subscript,superscript:je.superscript,underlineStrikethrough:je.underlineStrikethrough},list:{listitem:je.listitem,listitemChecked:je.listItemChecked,listitemUnchecked:je.listItemUnchecked,nested:{listitem:je.nestedListItem}},admonition:{danger:je.admonitionDanger,info:je.admonitionInfo,note:je.admonitionNote,tip:je.admonitionTip,caution:je.admonitionCaution}},xy=C.createContext(null);function pn(){const t=C.useContext(xy);return t==null&&function(e,...n){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const i of n)o.append("v",i);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t}function A3(){return Ce().getTextContent()}function P3(t,e=!0){if(t)return!1;let n=A3();return e&&(n=n.trim()),n===""}function L3(t){if(!P3(t,!1))return!1;const e=Ce().getChildren(),n=e.length;if(n>1)return!1;for(let r=0;rL3(t)}const vy=dt?C.useLayoutEffect:C.useEffect;function $3({editor:t,ariaActiveDescendant:e,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:g,className:h,id:p,role:y="textbox",spellCheck:m=!0,style:x,tabIndex:v,"data-testid":_,...S},E){const[b,w]=C.useState(t.isEditable()),k=C.useCallback(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?t.setRootElement(A):t.setRootElement(null)},[t]),M=C.useMemo(()=>function(...A){return R=>{for(const F of A)typeof F=="function"?F(R):F!=null&&(F.current=R)}}(E,k),[k,E]);return vy(()=>(w(t.isEditable()),t.registerEditableListener(A=>{w(A)})),[t]),L.jsx("div",{"aria-activedescendant":b?e:void 0,"aria-autocomplete":b?n:"none","aria-controls":b?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":b&&y==="combobox"?!!s:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":c,"aria-multiline":u,"aria-owns":b?f:void 0,"aria-readonly":!b||void 0,"aria-required":d,autoCapitalize:g,className:h,contentEditable:b,"data-testid":_,id:p,ref:M,role:y,spellCheck:m,style:x,tabIndex:v??(b?void 0:-1),...S})}const I3=C.forwardRef($3);function Qg(t){return t.read("latest",_y(t.isComposing()))}const Cy=C.forwardRef(R3);function R3(t,e){const{placeholder:n,...r}=t,[o]=pn();return L.jsxs(L.Fragment,{children:[L.jsx(I3,{editor:o,...r,ref:e}),n!=null&&L.jsx(D3,{editor:o,content:n})]})}function D3({content:t,editor:e}){const n=function(s){const[l,a]=C.useState(()=>Qg(s));return vy(()=>{function c(){const u=Qg(s);a(u)}return c(),tt(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),l}(e),[r,o]=C.useState(e.isEditable());if(C.useLayoutEffect(()=>(o(e.isEditable()),e.registerEditableListener(s=>{o(s)})),[e]),!n)return null;let i=null;return typeof t=="function"?i=t(r):t!==null&&(i=t),i===null?null:L.jsx("div",{"aria-hidden":!0,children:i})}class F3 extends C.Component{constructor(){super(...arguments);P(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,r){this.props.onError(n instanceof Error?n:new Error(String(n),{cause:n}),r)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function by({children:t,fallback:e,onError:n}){return L.jsx(F3,{fallback:e===void 0?L.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}):e,onError:n,children:t})}const Wl={name:"@lexical/react/ReactProvider"};function H3(t,e){const[n]=e,r=t.decorators.map(o=>typeof o=="function"?L.jsx(o,{context:e}):o);return function(o){const{EditorChildrenComponent:i=t.EditorChildrenComponent,ErrorBoundary:s=t.ErrorBoundary,contentEditable:l=t.contentEditable,children:a}=o,c=function(f,d){const[g,h]=C.useMemo(()=>[y=>f.registerDecoratorListener(y),()=>f.getDecorators()],[f]),p=C.useSyncExternalStore(g,h,h);return C.useMemo(()=>{const y=[];for(const m in p){const x=f.getElementByKey(m);if(x!==null){const v=L.jsx(d,{onError:_=>{f._onError(_)},children:L.jsx(C.Suspense,{fallback:null,children:p[m]})});y.push(nr.createPortal(v,x,m))}}return y},[d,p,f])}(n,s),u=C.useMemo(()=>r.map((f,d)=>L.jsx(s,{onError:g=>{n._onError(g)},children:L.jsx(C.Suspense,{fallback:null,children:f})},d)),[s]);return L.jsx(xy.Provider,{value:e,children:L.jsxs(i,{context:e,contentEditable:l,children:[a,u,c]})})}}function V3({contentEditable:t,children:e}){return L.jsxs(L.Fragment,{children:[t,e]})}const B3={EditorChildrenComponent:V3,ErrorBoundary:by,contentEditable:L.jsx(Cy,{}),decorators:[]},wy={build(t,e,n){n.getPeer(Wl.name)||function(o,...i){const s=new URL("https://lexical.dev/docs/error"),l=new URLSearchParams;l.append("code",o);for(const a of i)l.append("v",a);throw s.search=l.toString(),Error(`Minified Lexical error #${o}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(321,[...n.getDirectDependentNames()].join(" "));const r=[t,{getTheme:()=>t._config.theme}];return{Component:H3(e,r),context:r}},config:B3,mergeConfig(t,e){const n=ma(t,e);return e.decorators&&(n.decorators=e.decorators.length>0?[...t.decorators,...e.decorators]:t.decorators),n},name:"@lexical/react/React",peerDependencies:[Kv(Wl.name)]},j3=new WeakSet,W3=new WeakMap,z3=new Set([eo,Qt,to,Yr,fr]),wr=new WeakMap;function K3(t){return Eo(Do,{createInitialHistoryState:()=>t,disabled:!1})}function J3({name:t,namespace:e,nodes:n,theme:r,editable:o=!0,parentEditor:i,historyMode:s,historyState:l,initialEditorState:a,onError:c=u=>{throw u}}){const u=[Wl,Eo(wy,{contentEditable:null}),Eo(S0,{setOptions:{tag:Ar},updateOptions:{tag:Ar}})];if(i&&u.push(Eo(mC,{$getParentEditor:()=>i,inheritEditableFromParent:!0})),s==="nested-shared")u.push(bC);else if(s==="root-shared"||s==="nested-external"){if(!l)throw new Error(`${s} requires a historyState`);u.push(K3(l))}else s==="table-local"&&u.push(Eo(Do,{disabled:!1}));const f={name:t,namespace:e,nodes:n==null?void 0:n.filter(_=>!z3.has(_)),theme:r,editable:o,$initialEditorState:a,onError:c,dependencies:u},d=fC(f),g=io(d,Do.name),h=g==null?void 0:g.output.historyState.value;h&&W3.set(d,h),h&&(wr.has(h)||wr.set(h,h.current));const p=h?d.registerUpdateListener(({dirtyElements:_,dirtyLeaves:S,tags:E})=>{const b=h.current;if(E.has(Ar)){wr.set(h,b);return}if(_.size>0||S.size>0){wr.set(h,b);return}const w=wr.get(h);(b==null?void 0:b.editor)===d&&w&&w.editor!==d&&(h.undoStack.push({...w}),h.redoStack=[],d.dispatchCommand(Mr,!0),d.dispatchCommand(Nr,!1)),wr.set(h,b)}):()=>{},y=new Set,m=h?d.registerCommand(_f,()=>{const _=setTimeout(()=>{y.delete(_),d.dispatchCommand(Mr,h.undoStack.length>0),d.dispatchCommand(Nr,h.redoStack.length>0)});return y.add(_),!1},st):()=>{},x=d.dispose.bind(d);let v=!1;return d.dispose=()=>{v||(v=!0,y.forEach(clearTimeout),y.clear(),m(),p(),x())},s==="root-shared"&&j3.add(d),d}const Xf=U("NESTED_EDITOR_UPDATED_COMMAND"),pr=Y(null),bt=Y(null),Eu=Y(""),Tu=Y(!0),Qi=Y(!1,t=>{t.sub(t.pipe(Qi,Ft(pr)),([e,n])=>{n==null||n.setEditable(!e)})}),ku=Y(""),ep=Y(!1),es=Y(!1),Sy=Y(0),zl=Y(null),Nu=jt(t=>{t.link(t.pipe(zl,ta(e=>e!==null)),Nu)}),Ey=jt(t=>{t.sub(t.pipe(Ey,Ft(bt)),([e,n])=>{n==null||n.dispatchCommand(Sn,e)})}),Qf=Y(null,t=>{t.sub(t.pipe(Qf,Ft(bt)),([e,n])=>{if(!e||!n)return;const r=e.anchor.getNode();let o=r.getKey()==="root"?r:Ne(r,l=>{const a=l.getParent();return a!==null&&ve(a)});o??(o=r.getTopLevelElementOrThrow());const i=o.getKey();if(n.getElementByKey(i)!==null){const l=ba(o)?o.getTag():o.getType();t.pub(Zy,l)}})}),Ty=Y(""),Jr=Y(""),Kl=Y(!1),wa=jt(t=>{t.link(Jr,wa),t.sub(Ty,e=>{t.pubIn({[Kl]:!0,[Jr]:e})})}),Mu=jt(t=>{t.link(t.pipe(wa,Ft(Pu),ta(([,e])=>!e),pm(([e])=>e)),Mu)},!0),ky=Y([]),Ny=Y([]),My=Y([]),Oy=Y([]),ed=Y([]),td=Y([]),Jl=Y({}),Ay=Y(!1),nd=Y([]),U3=Y([]),Py=Y([]),Ly=Y(""),rd=Y(null),G3=Y(null),$y=Y(null),Sa=gt(Ny),ts=gt(ky),Ou=gt(My),Au=gt(Oy),Ea=gt(ed),Iy=gt(td),Pu=Y(!1),od=jt(t=>{t.sub(t.pipe(od,Ft(Jr,pr,es),ta(([e,n])=>e.trim()!==n.trim())),([e,,n,r])=>{t.pub(Pu,!0),n==null||n.update(()=>{Ce().clear(),id(t,Ce(),e),r?n.focus():He(null)},{onUpdate:()=>{t.pub(Pu,!1)}})})}),Ry=jt(t=>{t.sub(t.pipe(Ry,Ft(bt,es)),([e,n,r])=>{n==null||n.update(()=>{const o=V();if(o!==null){const i={children:[],append(s){this.children.push(s)},getType(){return o.getNodes()[0].getType()}};id(t,i,e),wf(i.children)}r?n.focus():He(null)})})});function Dy(){return mm((t,[e,n])=>(t.forEach(r=>{if(!r)throw new Error("You have a subscription that does not return a teardown");r()}),n?e.map(r=>r(n)):[]),[])}const Z3=Y(null),Fy=Y([],t=>{t.pipe(t.combine(Fy,bt),Dy())}),Hy=Y([],t=>{t.pipe(t.combine(Hy,pr),Dy())}),q3=Y(null,Ho,(t,e)=>!!(t&&e&&t.editorRef===e.editorRef)),Lu=jt(),vs=Y(t=>{throw new Error(`No icon component for ${t}`)});function gt(t,e){return jt((n,r)=>{n.changeWith(t,r,(o,i)=>{Array.isArray(i)||(i=[i]);let s=o;for(const l of i)o.includes(l)||(s=[...s,l]);return s}),e==null||e(n,r)})}function Vy(t){const e=V();$(e)&&t.pubIn({[Qf]:e,[Sy]:e.format})}const By=gt(Hy,(t,e)=>{t.pub(e,[n=>n.registerCommand(lf,(r,o)=>(t.pubIn({[bt]:o,[es]:!0}),o._parentEditor===null&&o.getEditorState().read(()=>{t.pub(q3,{rootNode:Ce(),editorType:"lexical",editorRef:o})}),Vy(t),!1),or),n=>n.registerUpdateListener(({dirtyElements:r,dirtyLeaves:o,editorState:i})=>{if(t.getValue(zl)!==null||r.size===0&&o.size===0)return;let l;i.read(()=>{Ce().getLastChild()instanceof ds&&n.update(()=>{Ce().append(re())},{discrete:!0}),l=py({root:Ce(),visitors:t.getValue(ed),jsxComponentDescriptors:t.getValue(nd),toMarkdownExtensions:t.getValue(td),toMarkdownOptions:t.getValue(Jl),jsxIsAvailable:t.getValue(Ay)})}),t.pub(Jr,l.trim()),t.pub(Kl,!1)}),n=>n.registerCommand(_f,()=>(t.pub(es,!0),!1),or)])}),Y3=gt(Fy,(t,e)=>{t.pub(e,[n=>n.registerUpdateListener(({editorState:r})=>{r.read(()=>{Vy(t)})}),n=>n.registerCommand(Xm,r=>{var o;const i=t.getValue(pr);return i&&!((o=i.getRootElement())!=null&&o.contains(r.relatedTarget))&&t.pubIn({[es]:!1,[Lu]:r}),!1},or)])});function id(t,e,n){try{j9({root:e,visitors:t.getValue(ky),mdastExtensions:t.getValue(Oy),markdown:n,syntaxExtensions:t.getValue(My),jsxComponentDescriptors:t.getValue(nd),directiveDescriptors:t.getValue(U3),codeBlockEditorDescriptors:t.getValue(Py),defaultCodeBlockLanguage:t.getValue(Ly)}),t.pub(zl,null)}catch(r){if(r instanceof wu||r instanceof Su)t.pubIn({[Jr]:n,[zl]:{error:r.message,source:n}});else throw r}}const jy=Y([]),Wy=gt(jy),zy=Y([]),X3=gt(zy),Ky=Y([]),Q3=gt(Ky),Jy=Y([]);gt(Jy);const ew=Y([]),Uy=gt(ew),tw=Y([]),nw=gt(tw),Gy=Y(!1,t=>{t.link(t.pipe(bt,pm(e=>{var n,r;return["td","th"].includes(((r=(n=e==null?void 0:e.getRootElement())==null?void 0:n.parentNode)==null?void 0:r.nodeName.toLowerCase())??"")})),Gy)}),tp=Y(Uf()),Zy=Y("");jt();const Ul=jt(t=>{t.sub(t.pipe(Ul,Ft(bt)),([e,n])=>{n==null||n.update(()=>{const r=V();$(r)&&(Gv(r,e),setTimeout(()=>{n.focus()}))})})}),rw=jt(t=>{t.sub(t.pipe(rw,Ft(bt)),([e,n])=>{n==null||n.focus(()=>{n.getEditorState().read(()=>{const r=V();$(r)&&(n.update(()=>{const o=e();o.isInline()?(wf([o]),ve(o.getParentOrThrow())&&Xv(o,re).selectEnd()):Yv(o),setTimeout(()=>{"select"in o&&typeof o.select=="function"&&o.select()})}),setTimeout(()=>{n.dispatchCommand(Xf,void 0)}))})},{defaultSelection:"rootEnd"})})}),Gl=Y("rich-text",t=>{function e(){return mm((n,r)=>({current:n.next,next:r}),{current:"rich-text",next:"rich-text"})}t.sub(t.pipe(Gl,e(),Ft(ns)),([{current:n},r])=>{(n==="source"||n==="diff")&&t.pub(od,r)}),t.sub(t.pipe(Gl,e(),ta(n=>n.current==="rich-text"),Ft(bt)),([,n])=>{n==null||n.dispatchCommand(Xf,void 0)})}),ns=Y("",t=>{t.link(Jr,ns),t.link(ns,wa)},!0),sd=Y([]),ld=gt(sd),qy=Y(()=>{throw new Error("No translation function provided")}),np=Y(yy),ow=Xo({init(t,e){const n=(e==null?void 0:e.initialMarkdown)??"";t.register(By),t.register(Y3),t.register(wa),t.register(ns),t.pubIn({[Ty]:e!=null&&e.trim?n.trim():n,[vs]:e==null?void 0:e.iconComponentFor,[ts]:[c3,a3,u3,Q9,...i3],[Sa]:[fr,Qt,_s],[Ea]:[q9,Z9,X9,G9,U9],[Eu]:e==null?void 0:e.contentEditableClassName,[Tu]:e==null?void 0:e.spellCheck,[Jl]:e==null?void 0:e.toMarkdownOptions,[ep]:e==null?void 0:e.autoFocus,[ku]:e==null?void 0:e.placeholder,[Qi]:e==null?void 0:e.readOnly,[qy]:e==null?void 0:e.translation,[tp]:Uf(),[Au]:[m2(),$b],[Ou]:[p2(),p9()],[Iy]:[n9(),g2(),Db],[np]:(e==null?void 0:e.lexicalTheme)??yy}),t.singletonSub(Nu,e==null?void 0:e.onError),t.singletonSub(Mu,r=>{e==null||e.onChange(r,t.getValue(Kl))}),t.singletonSub(Lu,e==null?void 0:e.onBlur),e!=null&&e.suppressHtmlProcessing||t.pubIn({[Au]:[t9(),f3()],[Ou]:[L9(),$9(),d3],[ts]:s3})},postInit(t,e){const n=J3({name:"@mdxeditor/root",editable:(e==null?void 0:e.readOnly)!==!0,namespace:(e==null?void 0:e.lexicalEditorNamespace)??"MDXEditor",nodes:[...t.getValue(Ny),...(e==null?void 0:e.additionalLexicalNodes)??[]],theme:t.getValue(np),historyMode:e!=null&&e.suppressSharedHistory?"none":"root-shared",historyState:t.getValue(tp),initialEditorState:(e==null?void 0:e.editorState)===null?null:()=>{const o=(e==null?void 0:e.initialMarkdown.trim())??"";id(t,Ce(),o)}});Kd(t,()=>{n.dispose()});const r=e==null?void 0:e.autoFocus;if((e==null?void 0:e.editorState)!==null&&r){const o=setTimeout(()=>{n.focus(Ho,{defaultSelection:r===!0?"rootStart":r.defaultSelection??"rootStart"})});Kd(t,()=>{clearTimeout(o)})}t.pub(pr,n),t.pub(bt,n)},update(t,e){t.pubIn({[Eu]:e==null?void 0:e.contentEditableClassName,[Tu]:e==null?void 0:e.spellCheck,[Jl]:e==null?void 0:e.toMarkdownOptions,[ep]:e==null?void 0:e.autoFocus,[ku]:e==null?void 0:e.placeholder,[Qi]:e==null?void 0:e.readOnly}),t.singletonSub(Mu,n=>{e==null||e.onChange(n,t.getValue(Kl))}),t.singletonSub(Lu,e==null?void 0:e.onBlur),t.singletonSub(Nu,e==null?void 0:e.onError)}});function oi(){return ln(qy)}function iw({initialEditor:t,children:e}){const{Component:n}=hC(t,wy).output;return L.jsx(n,{children:e})}const sw=dt?C.useLayoutEffect:C.useEffect;function lw(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function aw(){return function(t){const[e]=pn(),n=C.useMemo(()=>t(e),[e,t]),[r,o]=C.useState(()=>n.initialValueFn()),i=C.useRef(r);return sw(()=>{const{initialValueFn:s,subscribe:l}=n,a=s();return i.current!==a&&(i.current=a,o(a)),l(c=>{i.current=c,o(c)})},[n,t]),r}(lw)}function cw(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ad=dt?C.useLayoutEffect:C.useEffect;function uw({editor:t,ErrorBoundary:e}){return function(n,r){const[o,i]=C.useState(()=>n.getDecorators());return ad(()=>n.registerDecoratorListener(s=>{nr.flushSync(()=>{i(s)})}),[n]),C.useEffect(()=>{i(n.getDecorators())},[n]),C.useMemo(()=>{const s=[],l=Object.keys(o);for(let a=0;an._onError(d),children:L.jsx(C.Suspense,{fallback:null,children:o[c]})}),f=n.getElementByKey(c);f!==null&&s.push(nr.createPortal(u,f,c))}return s},[r,o,n])}(t,e)}function fw({editor:t,ErrorBoundary:e}){return function(n){const r=On.maybeFromEditor(n);if(r&&r.hasExtensionByName(Wl.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&cw(320,o);return!0}return!1}(t)?null:L.jsx(uw,{editor:t,ErrorBoundary:e})}function rp(t){return t.read("latest",_y(t.isComposing()))}function dw({contentEditable:t,placeholder:e=null,ErrorBoundary:n}){const[r]=pn();return function(o){ad(()=>tt(Pb(o),Tb(o)),[o])}(r),L.jsxs(L.Fragment,{children:[t,L.jsx(hw,{content:e}),L.jsx(fw,{editor:r,ErrorBoundary:n})]})}function hw({content:t}){const[e]=pn(),n=function(o){const[i,s]=C.useState(()=>rp(o));return ad(()=>{function l(){const a=rp(o);s(a)}return l(),tt(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i}(e),r=aw();return n?typeof t=="function"?t(r):t:null}var Yy={exports:{}};/*! +`;break}case-2:{i=" ";break}case-1:{if(r)continue;i=" ";break}default:i=String.fromCharCode(o)}r=o===-2,n.push(i)}return n.join("")}function xc(t){const e=t||{},n=e.loc||{},r=e.range||[void 0,void 0],o=jg(n.start,r[0]||e.start),i=jg(n.end,r[1]||e.end);if(o&&i)return{start:o,end:i}}function jg(t,e){if(t&&typeof t=="object"){const n="line"in t?_c(t.line):void 0,r="column"in t?_c(t.column):void 0;if(n&&r!==void 0)return{line:n,column:r+1,offset:_c(e)}}}function _c(t){return typeof t=="number"&&t>-1?t:void 0}const w9=2,No="https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression",S9="#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-",E9="#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed",Wg="#unexpected-type-in-code-expected-an-object-spread-spread",T9="#unexpected-extra-content-in-spread-only-a-single-spread-is-supported",k9="#could-not-parse-expression-with-acorn";function zg(t,e,n,r,o,i,s,l,a,c,u){const f=this,d=this.events.length+3;let g=0,h,p;return y;function y(_){return t.enter(n),t.enter(r),t.consume(_),t.exit(r),h=f.now(),m}function m(_){if(_===null){if(p)throw p;const S=new it("Unexpected end of file in expression, expected a corresponding closing brace for `{`",{place:f.now(),ruleId:"unexpected-eof",source:"micromark-extension-mdx-expression"});throw S.url=No+S9,S}if(rn(_))return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),v;if(_===125&&g===0){const S=i?N9.call(f,i,s,o,d,h,c||!1,a||!1):{type:"ok",estree:void 0};if(S.type==="ok"){t.enter(r),t.consume(_),t.exit(r);const E=t.exit(n);return l&&S.estree&&Object.assign(E,{estree:S.estree}),e}return p=S.message,t.enter(o),t.consume(_),x}return t.enter(o),x(_)}function x(_){return _===125&&g===0||_===null||rn(_)?(t.exit(o),m(_)):(_===123&&!i?g+=1:_===125&&(g-=1),t.consume(_),x)}function v(_){const S=f.now();if(S.line!==h.line&&!u&&f.parser.lazy[S.line]){const E=new it("Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",{place:f.now(),ruleId:"unexpected-lazy",source:"micromark-extension-mdx-expression"});throw E.url=No+E9,E}return pl(_)?tf(t,m,"linePrefix",w9+1)(_):m(_)}}function N9(t,e,n,r,o,i,s){const l=_9(this.events.slice(r),{acorn:t,tokenTypes:[n],acornOptions:e,start:o,expression:!0,allowEmpty:i,prefix:s?"({":"",suffix:s?"})":""}),a=l.estree;if(s&&a){const c=a.body[0];if(c.type!=="ExpressionStatement"||c.expression.type!=="ObjectExpression"){const u=xc(c),f=new it("Unexpected `"+c.type+"` in code: expected an object spread (`{...spread}`)",{place:u.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw f.url=No+Wg,f}if(c.expression.properties[1]){const u=xc(c.expression.properties[1]),f=new it("Unexpected extra content in spread: only a single spread is supported",{place:u.start,ruleId:"spread-extra",source:"micromark-extension-mdx-expression"});throw f.url=No+T9,f}if(c.expression.properties[0]&&c.expression.properties[0].type!=="SpreadElement"){const u=xc(c.expression.properties[0]),f=new it("Unexpected `"+c.expression.properties[0].type+"` in code: only spread elements are supported",{place:u.start,ruleId:"non-spread",source:"micromark-extension-mdx-expression"});throw f.url=No+Wg,f}}if(l.error){const c=new it("Could not parse expression with acorn",{cause:l.error,place:{line:l.error.loc.line,column:l.error.loc.column+1,offset:l.error.pos},ruleId:"acorn",source:"micromark-extension-mdx-expression"});return c.url=No+k9,{type:"nok",message:c}}return{type:"ok",estree:a}}const Kg="https://github.com/micromark/micromark-extension-mdx-jsx";function uy(t,e,n,r,o,i,s,l,a,c,u,f,d,g,h,p,y,m,x,v,_,S,E,b,w,k,M,A,R,F,H,W){const z=this;let B,K;return J;function J(T){return t.enter(l),t.enter(a),t.consume(T),t.exit(a),X}function X(T){return xr(T)?n(T):(B=ie,De(T))}function ie(T){if(T===47)return t.enter(c),t.consume(T),t.exit(c),B=xe,De;if(T===62)return Ts(T);if(T!==null&&T>=0&&zt(T))return t.enter(f),t.enter(d),t.consume(T),de;Be(T,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(T===33?" (note: to create a comment in MDX, use `{/* text */}`)":""))}function xe(T){if(T===62)return Ts(T);if(T!==null&&T>=0&&zt(T))return t.enter(f),t.enter(d),t.consume(T),de;Be(T,"before name","a character that can start a name, such as a letter, `$`, or `_`"+(T===42||T===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function de(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),de;if(T===46||T===47||T===58||T===62||T===123||xr(T)||Un(T))return t.exit(d),B=Ve,De(T);Be(T,"in name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(T===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function Ve(T){if(T===46)return t.enter(g),t.consume(T),t.exit(g),B=qe,De;if(T===58)return t.enter(p),t.consume(T),t.exit(p),B=G,De;if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(f),le(T);Be(T,"after name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function qe(T){if(T!==null&&T>=0&&zt(T))return t.enter(h),t.consume(T),oe;Be(T,"before member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function oe(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),oe;if(T===46||T===47||T===62||T===123||xr(T)||Un(T))return t.exit(h),B=me,De(T);Be(T,"in member name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(T===64?" (note: to create a link in MDX, use `[text](url)`)":""))}function me(T){if(T===46)return t.enter(g),t.consume(T),t.exit(g),B=qe,De;if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(f),le(T);Be(T,"after member name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function G(T){if(T!==null&&T>=0&&zt(T))return t.enter(y),t.consume(T),se;Be(T,"before local name","a character that can start a name, such as a letter, `$`, or `_`"+(T===43||T!==null&&T>46&&T<58?" (note: to create a link in MDX, use `[text](url)`)":""))}function se(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),se;if(T===47||T===62||T===123||xr(T)||Un(T))return t.exit(y),B=Oe,De(T);Be(T,"in local name","a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function Oe(T){if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(f),le(T);Be(T,"after local name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function le(T){if(T===47)return t.enter(u),t.consume(T),t.exit(u),B=ho,De;if(T===62)return Ts(T);if(T===123)return zg.call(z,t,ue,m,x,v,r,o,i,!0,!1,s)(T);if(T!==null&&T>=0&&zt(T))return t.enter(_),t.enter(S),t.enter(E),t.consume(T),ge;Be(T,"before attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function ue(T){return B=le,De(T)}function ge(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),ge;if(T===47||T===58||T===61||T===62||T===123||xr(T)||Un(T))return t.exit(E),B=Nt,De(T);Be(T,"in attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Nt(T){if(T===58)return t.enter(b),t.consume(T),t.exit(b),B=Mt,De;if(T===61)return t.exit(S),t.enter(k),t.consume(T),t.exit(k),B=Jn,De;if(T===47||T===62||T===123||xr(T)||Un(T)||T!==null&&T>=0&&zt(T))return t.exit(S),t.exit(_),B=le,De(T);Be(T,"after attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function Mt(T){if(T!==null&&T>=0&&zt(T))return t.enter(w),t.consume(T),en;Be(T,"before local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function en(T){if(T!==null&&T>=0&&fi(T,{jsx:!0}))return t.consume(T),en;if(T===47||T===61||T===62||T===123||xr(T)||Un(T))return t.exit(w),t.exit(S),B=Kn,De(T);Be(T,"in local attribute name","an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function Kn(T){if(T===61)return t.enter(k),t.consume(T),t.exit(k),B=Jn,De;if(T===47||T===62||T===123||T!==null&&T>=0&&zt(T))return t.exit(_),le(T);Be(T,"after local attribute name","a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function Jn(T){if(T===34||T===39)return t.enter(M),t.enter(A),t.consume(T),t.exit(A),K=T,ui;if(T===123)return zg.call(z,t,Ga,F,H,W,r,o,i,!1,!1,s)(T);Be(T,"before attribute value","a character that can start an attribute value, such as `\"`, `'`, or `{`"+(T===60?" (note: to use an element or fragment as a prop value in MDX, use `{}`)":""))}function Ga(T){return t.exit(_),B=le,De(T)}function ui(T){return T===null&&Be(T,"in attribute value","a corresponding closing quote `"+String.fromCodePoint(K)+"`"),T===K?(t.enter(A),t.consume(T),t.exit(A),t.exit(M),t.exit(_),K=void 0,B=le,De):rn(T)?(B=ui,De(T)):(t.enter(R),Es(T))}function Es(T){return T===null||T===K||rn(T)?(t.exit(R),ui(T)):(t.consume(T),Es)}function ho(T){if(T===62)return Ts(T);Be(T,"after self-closing slash","`>` to end the tag"+(T===42||T===47?" (note: JS comments in JSX tags are not supported in MDX)":""))}function Ts(T){return t.enter(a),t.consume(T),t.exit(a),t.exit(l),e}function De(T){return rn(T)?(t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),r2):pl(T)||Un(T)?(t.enter("esWhitespace"),Id(T)):B(T)}function Id(T){return rn(T)?(t.exit("esWhitespace"),De(T)):pl(T)||Un(T)?(t.consume(T),Id):(t.exit("esWhitespace"),B(T))}function r2(T){if(!s&&z.parser.lazy[z.now().line]){const ks=new it("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",z.now(),"micromark-extension-mdx-jsx:unexpected-lazy");throw ks.url=Kg+"#unexpected-lazy-line-in-container-expected-line-to-be",ks}return De(T)}function Be(T,ks,o2){const Rd=new it("Unexpected "+(T===null?"end of file":"character `"+(T===96?"` ` `":String.fromCodePoint(T))+"` ("+M9(T)+")")+" "+ks+", expected "+o2,z.now(),"micromark-extension-mdx-jsx:unexpected-"+(T===null?"eof":"character"));throw Rd.url=Kg+(T===null?"#unexpected-end-of-file-at-expected-expect":"#unexpected-character-at-expected-expect"),Rd}}function M9(t){return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function O9(t,e){return{name:"mdxJsxTextTag",tokenize:n};function n(r,o,i){return uy.call(this,r,o,i,t,e.acornOptions,e.addResult,!0,"mdxJsxTextTag","mdxJsxTextTagMarker","mdxJsxTextTagClosingMarker","mdxJsxTextTagSelfClosingMarker","mdxJsxTextTagName","mdxJsxTextTagNamePrimary","mdxJsxTextTagNameMemberMarker","mdxJsxTextTagNameMember","mdxJsxTextTagNamePrefixMarker","mdxJsxTextTagNameLocal","mdxJsxTextTagExpressionAttribute","mdxJsxTextTagExpressionAttributeMarker","mdxJsxTextTagExpressionAttributeValue","mdxJsxTextTagAttribute","mdxJsxTextTagAttributeName","mdxJsxTextTagAttributeNamePrimary","mdxJsxTextTagAttributeNamePrefixMarker","mdxJsxTextTagAttributeNameLocal","mdxJsxTextTagAttributeInitializerMarker","mdxJsxTextTagAttributeValueLiteral","mdxJsxTextTagAttributeValueLiteralMarker","mdxJsxTextTagAttributeValueLiteralValue","mdxJsxTextTagAttributeValueExpression","mdxJsxTextTagAttributeValueExpressionMarker","mdxJsxTextTagAttributeValueExpressionValue")}}function A9(t,e){return{concrete:!0,name:"mdxJsxFlowTag",tokenize:n};function n(r,o,i){const s=this;return l;function l(f){return a(f)}function a(f){return uy.call(s,r,c,i,t,e.acornOptions,e.addResult,!1,"mdxJsxFlowTag","mdxJsxFlowTagMarker","mdxJsxFlowTagClosingMarker","mdxJsxFlowTagSelfClosingMarker","mdxJsxFlowTagName","mdxJsxFlowTagNamePrimary","mdxJsxFlowTagNameMemberMarker","mdxJsxFlowTagNameMember","mdxJsxFlowTagNamePrefixMarker","mdxJsxFlowTagNameLocal","mdxJsxFlowTagExpressionAttribute","mdxJsxFlowTagExpressionAttributeMarker","mdxJsxFlowTagExpressionAttributeValue","mdxJsxFlowTagAttribute","mdxJsxFlowTagAttributeName","mdxJsxFlowTagAttributeNamePrimary","mdxJsxFlowTagAttributeNamePrefixMarker","mdxJsxFlowTagAttributeNameLocal","mdxJsxFlowTagAttributeInitializerMarker","mdxJsxFlowTagAttributeValueLiteral","mdxJsxFlowTagAttributeValueLiteralMarker","mdxJsxFlowTagAttributeValueLiteralValue","mdxJsxFlowTagAttributeValueExpression","mdxJsxFlowTagAttributeValueExpressionMarker","mdxJsxFlowTagAttributeValueExpressionValue")(f)}function c(f){return pl(f)?tf(r,u,"whitespace")(f):u(f)}function u(f){const d=s.parser.constructs.flow[123],g=Array.isArray(d)?d:d?[d]:[];let h;for(const p of g)if(p.name==="mdxFlowExpression"){h=p;break}return f===60?l(f):f===123&&h?r.attempt(h,u,i)(f):f===null||rn(f)?o(f):i(f)}}}function P9(t){const e={},n=e.acorn;let r;if(n){if(!n.parse||!n.parseExpressionAt)throw new Error("Expected a proper `acorn` instance passed in as `options.acorn`");r=Object.assign({ecmaVersion:2024,sourceType:"module"},e.acornOptions,{locations:!0})}else if(e.acornOptions||e.addResult)throw new Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{60:A9(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})},text:{60:O9(n||void 0,{acornOptions:r,addResult:e.addResult||void 0})}}}function L9(){return{disable:{null:["autolink","codeIndented","htmlFlow","htmlText"]}}}const $9=["mdxJsxTextElement","mdxJsxFlowElement"];function fy(t){return $9.includes(t.type)&&I9.includes(t.name)}const I9=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function R9(t,e){const n=Jg(t),r=Jg(e),o={...n,...r};return D9(o)}function Jg(t){const e={};return t.split(";").filter(r=>r.trim()!=="").forEach(r=>{const[o,i]=r.split(":").map(s=>s.trim());e[o]=i}),e}function D9(t){return Object.entries(t).map(([e,n])=>`${e}: ${n}`).join("; ")}function F9(t){return t.children instanceof Array}function H9({root:t,visitors:e,jsxComponentDescriptors:n,jsxIsAvailable:r,addImportStatements:o=!0}){let i=null;const s=new Set,l=new Map;e=[...e].sort((m,x)=>(x.priority??0)-(m.priority??0)),f(t,null);function a(m,x){s.add(m),x&&l.set(m,{...x})}function c(m,x){if(i===null)return i=x,i;if(!F9(m))throw new Error("Attempting to append children to a non-parent");const v=m.children,_=v.at(-1);if(_){const S=e.find(E=>{var b;return(b=E.shouldJoin)==null?void 0:b.call(E,_,x)});if(S){const E=S.join(_,x);return v.splice(v.length-1,1,E),E}}return v.push(x),x}function u(m,x){m.getChildren().forEach(v=>{f(v,x)})}function f(m,x,v=null){var _;const S=e.find((E,b)=>{var w;return v!=null&&v.has(b)?!1:(w=E.testLexicalNode)==null?void 0:w.call(E,m)});if(!S)throw new Error(`no lexical visitor found for ${m.getType()}`,{cause:m});(_=S.visitLexicalNode)==null||_.call(S,{lexicalNode:m,mdastParent:x,actions:{addAndStepInto(E,b={},w=!0){const k={type:E,...b,...w?{children:[]}:{}};c(x,k),O(m)&&w&&u(m,k)},appendToParent:c,visitChildren:u,visit:f,registerReferredComponent:a,nextVisitor(){f(m,x,(v??new Set).add(e.indexOf(S)))}}})}if(i===null)throw new Error("traversal ended with no root element");const d=new Map,g=new Map;for(const m of s){const x=n.find(v=>v.name===m)??l.get(m)??n.find(v=>v.name==="*");if(!x)throw new Error(`Component ${m} is used but not imported`);if(x.source)if(x.defaultExport)g.set(m,x.source);else{const{source:v}=x,_=d.get(v);_?_.push(m):d.set(v,[m])}}if(!o){for(const[m,x]of d.entries()){const v=x.filter(_=>l.has(_));v.length>0?d.set(m,v):d.delete(m)}for(const m of g.keys())l.has(m)||g.delete(m)}const h=Array.from(d).map(([m,x])=>({type:"mdxjsEsm",value:`import { ${x.join(", ")} } from '${m}'`}));h.push(...Array.from(g).map(([m,x])=>({type:"mdxjsEsm",value:`import ${m} from '${x}'`})));const p=i,y=p.children.find(m=>m.type==="yaml");return y?p.children.splice(p.children.indexOf(y)+1,0,...h):p.children.unshift(...h),ll(p,[]),dy(p),r||hy(p),p}function dy(t){if("children"in t&&t.children.length>0){if(fy(t)&&t.children.length===1){const e=t.children[0];e.type==="mdxJsxTextElement"&&e.name==="span"&&(e.attributes.forEach(n=>{if(n.type==="mdxJsxAttribute"){const r=t.attributes.find(o=>o.type==="mdxJsxAttribute"&&o.name===n.name);if(r)if(n.name==="className"){const o=new Set([...r.value.split(" "),...n.value.split(" ")]);r.value=Array.from(o).join(" ")}else n.name==="style"&&(r.value=R9(r.value,n.value));else t.attributes.push(n)}}),t.children=e.children)}t.children.forEach(e=>{dy(e)})}}function hy(t){if(Object.hasOwn(t,"children")){const e=t,n=[];e.children.forEach(r=>{r.type==="mdxJsxTextElement"&&r.name==="u"?n.push({type:"html",value:""},...r.children,{type:"html",value:""}):(n.push(r),hy(r))}),e.children=n}}const Ug=/\s+$/,Gg=/^\s+/;function ll(t,e){if(t.type==="strong"||t.type==="emphasis"){const n=t.children.at(-1);if((n==null?void 0:n.type)==="text"){const o=Ug.exec(n.value);if(o){n.value=n.value.replace(Ug,"");const i=e.at(-1);i&&(i.children.splice(i.children.indexOf(t)+1,0,{type:"text",value:o[0]}),ll(i,e.slice(0,-1)))}}const r=t.children.at(0);if((r==null?void 0:r.type)==="text"){const o=Gg.exec(r.value);if(o){r.value=r.value.replace(Gg,"");const i=e.at(-1);i&&(i.children.splice(i.children.indexOf(t),0,{type:"text",value:o[0]}),ll(i,e.slice(0,-1)))}}}if("children"in t&&t.children.length>0){const n=t;n.children.forEach(r=>{ll(r,[...e,n])})}}function gy({root:t,toMarkdownOptions:e,toMarkdownExtensions:n,visitors:r,jsxComponentDescriptors:o,jsxIsAvailable:i}){return cm(H9({root:t,visitors:r,jsxComponentDescriptors:o,jsxIsAvailable:i}),{extensions:n,...e})+` +`}function _i(t){return t.children instanceof Array}class wu extends Error{constructor(e,n){super(e),this.name="MarkdownParseError",this.cause=n}}class Su extends Error{constructor(e){super(e),this.name="UnrecognizedMarkdownConstructError"}}function V9(t){const e=new Map;return t.type!=="root"?{importDeclarations:{}}:(t.children.filter(r=>r.type==="mdxjsEsm").filter(r=>r.value.startsWith("import ")).forEach(r=>{var o,i;(((i=(o=r.data)==null?void 0:o.estree)==null?void 0:i.body)??[]).forEach(s=>{s.type==="ImportDeclaration"&&s.specifiers.forEach(l=>{e.set(l.local.name,{source:`${s.source.value}`,defaultExport:l.type==="ImportDefaultSpecifier"})})})}),{importDeclarations:Object.fromEntries(e.entries())})}function B9({root:t,markdown:e,visitors:n,syntaxExtensions:r,mdastExtensions:o,...i}){var s;let l;try{l=h2(e,{extensions:r,mdastExtensions:o})}catch(a){throw a instanceof Error?new wu(`Error parsing markdown: ${a.message}`,a):new wu(`Error parsing markdown: ${a}`,a)}l.children.length===0&&l.children.push({type:"paragraph",children:[]}),((s=l.children.at(-1))==null?void 0:s.type)!=="paragraph"&&l.children.push({type:"paragraph",children:[]}),j9({root:t,mdastRoot:l,visitors:n,...i})}function j9({root:t,mdastRoot:e,visitors:n,...r}){const o=new WeakMap,i=new WeakMap,s=V9(e);n=n.sort((c,u)=>(u.priority??0)-(c.priority??0));function l(c,u){if(!_i(c))throw new Error("Attempting to visit children of a non-parent");c.children.forEach(f=>{a(f,u,c)})}function a(c,u,f,d=null){const g=n.find((h,p)=>d!=null&&d.has(p)?!1:typeof h.testNode=="string"?h.testNode===c.type:h.testNode(c,r));if(!g)try{throw new Su(`Unsupported markdown syntax: ${cm(c)}`)}catch{throw new Su(`Parsing of the following markdown structure failed: ${JSON.stringify({type:c.type,name:"name"in c?c.name:"N/A"})}`)}g.visitNode({mdastNode:c,lexicalParent:u,mdastParent:f,descriptors:r,metaData:s,actions:{visitChildren:l,nextVisitor(){a(c,u,f,(d??new Set).add(n.indexOf(g)))},addAndStepInto(h){u.append(h),_i(c)&&l(c,h)},addFormatting(h,p){p||_i(c)&&(p=c),p&&o.set(p,h|(o.get(f)??0))},removeFormatting(h,p){p||_i(c)&&(p=c),p&&o.set(p,h^(o.get(f)??0))},getParentFormatting(){return o.get(f)??0},addStyle(h,p){p||_i(c)&&(p=c),p&&i.set(p,h)},getParentStyle(){return i.get(f)??""}}})}a(e,t,null)}function Ho(){}var W9=Object.defineProperty,z9=(t,e,n)=>e in t?W9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vc=(t,e,n)=>(z9(t,typeof e!="symbol"?e+"":e,n),n);const Zg="generic-html";class _s extends ft{constructor(e,n,r,o){super(o),vc(this,"__tag"),vc(this,"__nodeType"),vc(this,"__attributes"),this.__tag=e,this.__nodeType=n,this.__attributes=r}static getType(){return Zg}static clone(e){return new _s(e.__tag,e.__nodeType,e.__attributes,e.__key)}getTag(){return this.__tag}getNodeType(){return this.__nodeType}getAttributes(){return this.__attributes}updateAttributes(e){const n=this.getWritable();n.__attributes=e}getStyle(){var e;return(e=this.__attributes.find(n=>n.name==="style"))==null?void 0:e.value}createDOM(){const e=this.__tag,n=document.createElement(e);return this.__attributes.forEach(r=>{n.setAttribute(r.name,r.value)}),n}updateDOM(){return!1}static importDOM(){return{}}exportDOM(e){const{element:n}=super.exportDOM(e);return{element:n}}static importJSON(e){const n=py(e.tag,e.mdxType,e.attributes);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),attributes:this.__attributes,mdxType:this.__nodeType,type:Zg,version:1}}extractWithChild(){return!0}isInline(){return this.__nodeType==="mdxJsxTextElement"}}function py(t,e,n){return kt(new _s(t,e,n))}function K9(t){return t instanceof _s}const J9={testLexicalNode:K9,visitLexicalNode({actions:t,lexicalNode:e}){t.addAndStepInto("mdxJsxTextElement",{name:e.getTag(),type:e.getNodeType(),attributes:e.getAttributes()})},priority:-100},U9={testLexicalNode:rt,visitLexicalNode:({mdastParent:t,actions:e})=>{e.appendToParent(t,{type:"text",value:` +`})}},G9={testLexicalNode:Qo,visitLexicalNode:({actions:t})=>{t.addAndStepInto("paragraph")}},Z9={testLexicalNode:$e,visitLexicalNode:({actions:t})=>{t.addAndStepInto("root")}},Oi=1,Ai=2,al=4,Pi=8,Yf=16,cl=32,ul=64,fl=128;function qg(t){return t.type==="text"}const q9=["u","span","sub","sup"],Y9={shouldJoin:(t,e)=>{if(["text","emphasis","strong","highlight"].includes(t.type))return t.type===e.type;if(t.type==="mdxJsxTextElement"&&e.type==="mdxJsxTextElement"&&q9.includes(e.name)){const n=e;return t.name===n.name&&JSON.stringify(t.attributes)===JSON.stringify(n.attributes)}return!1},join(t,e){return qg(t)&&qg(e)?{type:"text",value:t.value+e.value}:{...t,children:[...t.children,...e.children]}},testLexicalNode:D,visitLexicalNode:({lexicalNode:t,mdastParent:e,actions:n})=>{const r=t.getPreviousSibling(),o=D(r)?r.getFormat():0,i=t.getTextContent(),s=t.getFormat(),l=t.getStyle();let a=e;if(l&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"span",children:[],attributes:[{type:"mdxJsxAttribute",name:"style",value:l}]})),o&s&Pi&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"u",children:[],attributes:[]})),o&s&ul&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sup",children:[],attributes:[]})),o&s&cl&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sub",children:[],attributes:[]})),o&s&Ai&&(a=n.appendToParent(a,{type:"emphasis",children:[]})),o&s&Oi&&(a=n.appendToParent(a,{type:"strong",children:[]})),o&s&al&&(a=n.appendToParent(a,{type:"delete",children:[]})),o&s&fl&&(a=n.appendToParent(a,{type:"highlight",children:[]})),s&Pi&&!(o&Pi)&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"u",children:[],attributes:[]})),s&ul&&!(o&ul)&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sup",children:[],attributes:[]})),s&cl&&!(o&cl)&&(a=n.appendToParent(a,{type:"mdxJsxTextElement",name:"sub",children:[],attributes:[]})),s&Ai&&!(o&Ai)&&(a=n.appendToParent(a,{type:"emphasis",children:[]})),s&Oi&&!(o&Oi)&&(a=n.appendToParent(a,{type:"strong",children:[]})),s&al&&!(o&al)&&(a=n.appendToParent(a,{type:"delete",children:[]})),s&fl&&!(o&fl)&&(a=n.appendToParent(a,{type:"highlight",children:[]})),s&Yf){n.appendToParent(a,{type:"inlineCode",value:i});return}n.appendToParent(a,{type:"text",value:i})}},X9={testNode:"break",visitNode:function({lexicalParent:t}){t.append(_t())}};function Vs(t,e){return[{testNode:n=>n.type==="mdxJsxTextElement"&&n.name===t,visitNode({actions:n,mdastNode:r,lexicalParent:o}){n.addFormatting(e),n.visitChildren(r,o)}},{testNode:n=>n.type==="html"&&n.value===`<${t}>`,visitNode({actions:n,mdastParent:r}){n.addFormatting(e,r)}},{testNode:n=>n.type==="html"&&n.value===``,visitNode({actions:n,mdastParent:r}){n.removeFormatting(e,r)}}]}const Q9={testNode:"delete",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(al),e.visitChildren(t,n)}},e3={testNode:"highlight",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(fl),e.visitChildren(t,n)}},t3={testNode:"inlineCode",visitNode({mdastNode:t,actions:e}){e.addAndStepInto(Pe(t.value).setFormat(e.getParentFormatting()|Yf))}},n3={testNode:"emphasis",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(Ai),e.visitChildren(t,n)}},r3={testNode:"strong",visitNode({mdastNode:t,actions:e,lexicalParent:n}){e.addFormatting(Oi),e.visitChildren(t,n)}},o3=[n3,r3,...Vs("u",Pi),...Vs("code",Yf),t3,Q9,e3,...Vs("sup",ul),...Vs("sub",cl)],i3={testNode:fy,visitNode:function({mdastNode:t,actions:e,lexicalParent:n}){t.name==="span"&&t.attributes.length===1&&t.attributes[0].type==="mdxJsxAttribute"&&t.attributes[0].name==="style"?(e.addStyle(t.attributes[0].value,t),e.visitChildren(t,n)):e.addAndStepInto(py(t.name,t.type,t.attributes))},priority:-100},s3=["listitem","admonition"],l3={testNode:"paragraph",visitNode:function({mdastNode:t,mdastParent:e,lexicalParent:n,actions:r}){const o=n.getType();if(s3.includes(o)){const i=(e==null?void 0:e.children.indexOf(t))??-1,s=i>0?e==null?void 0:e.children.at(i-1):void 0;o==="listitem"&&(s==null?void 0:s.type)==="paragraph"&&n.append(_t(),_t()),r.visitChildren(t,n)}else r.addAndStepInto(re())}},a3={testNode:"root",visitNode({actions:t,mdastNode:e,lexicalParent:n}){t.visitChildren(e,n)}},c3={testNode:"text",visitNode({mdastNode:t,actions:e}){const n=Pe(t.value);n.setFormat(e.getParentFormatting());const r=e.getParentStyle();r!==""&&n.setStyle(r),e.addAndStepInto(n)}},Kt={dash:45,eof:null,exclamationMark:33,greaterThan:62},br={data:"data",lineEnding:"lineEnding",linePrefix:"linePrefix"};function u3(t){return{canContainEols:["comment"],enter:{comment(e){this.buffer()}},exit:{comment(e){this.resume()}}}}const Yg=(t,e,n)=>{return r;function r(h){return t.enter("comment"),t.consume(h),o}function o(h){return h===Kt.exclamationMark?(t.consume(h),i):n(h)}function i(h){return h===Kt.dash?(t.consume(h),s):n(h)}function s(h){return h===Kt.dash?(t.consume(h),l):n(h)}function l(h){return h===Kt.greaterThan?n(h):rn(h)?u(h):(t.enter(br.data),h===Kt.dash?(t.consume(h),a):c(h))}function a(h){return h===Kt.greaterThan?n(h):c(h)}function c(h){return h===Kt.eof?n(h):h===Kt.dash?(t.consume(h),d):rn(h)?(t.exit(br.data),u(h)):(t.consume(h),c)}function u(h){return t.enter(br.lineEnding),t.consume(h),t.exit(br.lineEnding),tf(t,f,br.linePrefix)}function f(h){return rn(h)?u(h):(t.enter(br.data),c(h))}function d(h){return h===Kt.dash?(t.consume(h),g):c(h)}function g(h){return h===Kt.greaterThan?(t.exit(br.data),t.enter("commentEnd"),t.consume(h),t.exit("commentEnd"),t.exit("comment"),e(h)):h===Kt.dash?(t.consume(h),g):c(h)}},f3={flow:{60:{tokenize:Yg,concrete:!0}},text:{60:{tokenize:Yg}}},d3="_bold_6j9u9_10",h3="_italic_6j9u9_14",g3="_underline_6j9u9_18",p3="_strikethrough_6j9u9_34",m3="_underlineStrikethrough_6j9u9_38",y3="_subscript_6j9u9_42",x3="_superscript_6j9u9_47",_3="_code_6j9u9_52",v3="_quote_6j9u9_59",C3="_nestedListItem_6j9u9_66",b3="_listitem_6j9u9_76",w3="_listItemChecked_6j9u9_80",S3="_listItemUnchecked_6j9u9_81",E3="_admonitionDanger_6j9u9_158",T3="_admonitionInfo_6j9u9_159",k3="_admonitionNote_6j9u9_160",N3="_admonitionTip_6j9u9_161",M3="_admonitionCaution_6j9u9_162",je={bold:d3,italic:h3,underline:g3,strikethrough:p3,underlineStrikethrough:m3,subscript:y3,superscript:x3,code:_3,quote:v3,nestedListItem:C3,listitem:b3,listItemChecked:w3,listItemUnchecked:S3,admonitionDanger:E3,admonitionInfo:T3,admonitionNote:k3,admonitionTip:N3,admonitionCaution:M3},my={quote:je.quote,text:{bold:je.bold,italic:je.italic,underline:je.underline,code:je.code,strikethrough:je.strikethrough,subscript:je.subscript,superscript:je.superscript,underlineStrikethrough:je.underlineStrikethrough},list:{listitem:je.listitem,listitemChecked:je.listItemChecked,listitemUnchecked:je.listItemUnchecked,nested:{listitem:je.nestedListItem}},admonition:{danger:je.admonitionDanger,info:je.admonitionInfo,note:je.admonitionNote,tip:je.admonitionTip,caution:je.admonitionCaution}},yy=C.createContext(null);function pn(){const t=C.useContext(yy);return t==null&&function(e,...n){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const i of n)o.append("v",i);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t}function O3(){return Ce().getTextContent()}function A3(t,e=!0){if(t)return!1;let n=O3();return e&&(n=n.trim()),n===""}function P3(t){if(!A3(t,!1))return!1;const e=Ce().getChildren(),n=e.length;if(n>1)return!1;for(let r=0;rP3(t)}const _y=dt?C.useLayoutEffect:C.useEffect;function L3({editor:t,ariaActiveDescendant:e,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:g,className:h,id:p,role:y="textbox",spellCheck:m=!0,style:x,tabIndex:v,"data-testid":_,...S},E){const[b,w]=C.useState(t.isEditable()),k=C.useCallback(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?t.setRootElement(A):t.setRootElement(null)},[t]),M=C.useMemo(()=>function(...A){return R=>{for(const F of A)typeof F=="function"?F(R):F!=null&&(F.current=R)}}(E,k),[k,E]);return _y(()=>(w(t.isEditable()),t.registerEditableListener(A=>{w(A)})),[t]),L.jsx("div",{"aria-activedescendant":b?e:void 0,"aria-autocomplete":b?n:"none","aria-controls":b?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":b&&y==="combobox"?!!s:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":c,"aria-multiline":u,"aria-owns":b?f:void 0,"aria-readonly":!b||void 0,"aria-required":d,autoCapitalize:g,className:h,contentEditable:b,"data-testid":_,id:p,ref:M,role:y,spellCheck:m,style:x,tabIndex:v??(b?void 0:-1),...S})}const $3=C.forwardRef(L3);function Xg(t){return t.read("latest",xy(t.isComposing()))}const vy=C.forwardRef(I3);function I3(t,e){const{placeholder:n,...r}=t,[o]=pn();return L.jsxs(L.Fragment,{children:[L.jsx($3,{editor:o,...r,ref:e}),n!=null&&L.jsx(R3,{editor:o,content:n})]})}function R3({content:t,editor:e}){const n=function(s){const[l,a]=C.useState(()=>Xg(s));return _y(()=>{function c(){const u=Xg(s);a(u)}return c(),tt(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),l}(e),[r,o]=C.useState(e.isEditable());if(C.useLayoutEffect(()=>(o(e.isEditable()),e.registerEditableListener(s=>{o(s)})),[e]),!n)return null;let i=null;return typeof t=="function"?i=t(r):t!==null&&(i=t),i===null?null:L.jsx("div",{"aria-hidden":!0,children:i})}class D3 extends C.Component{constructor(){super(...arguments);P(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n,r){this.props.onError(n instanceof Error?n:new Error(String(n),{cause:n}),r)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function Cy({children:t,fallback:e,onError:n}){return L.jsx(D3,{fallback:e===void 0?L.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}):e,onError:n,children:t})}const Wl={name:"@lexical/react/ReactProvider"};function F3(t,e){const[n]=e,r=t.decorators.map(o=>typeof o=="function"?L.jsx(o,{context:e}):o);return function(o){const{EditorChildrenComponent:i=t.EditorChildrenComponent,ErrorBoundary:s=t.ErrorBoundary,contentEditable:l=t.contentEditable,children:a}=o,c=function(f,d){const[g,h]=C.useMemo(()=>[y=>f.registerDecoratorListener(y),()=>f.getDecorators()],[f]),p=C.useSyncExternalStore(g,h,h);return C.useMemo(()=>{const y=[];for(const m in p){const x=f.getElementByKey(m);if(x!==null){const v=L.jsx(d,{onError:_=>{f._onError(_)},children:L.jsx(C.Suspense,{fallback:null,children:p[m]})});y.push(nr.createPortal(v,x,m))}}return y},[d,p,f])}(n,s),u=C.useMemo(()=>r.map((f,d)=>L.jsx(s,{onError:g=>{n._onError(g)},children:L.jsx(C.Suspense,{fallback:null,children:f})},d)),[s]);return L.jsx(yy.Provider,{value:e,children:L.jsxs(i,{context:e,contentEditable:l,children:[a,u,c]})})}}function H3({contentEditable:t,children:e}){return L.jsxs(L.Fragment,{children:[t,e]})}const V3={EditorChildrenComponent:H3,ErrorBoundary:Cy,contentEditable:L.jsx(vy,{}),decorators:[]},by={build(t,e,n){n.getPeer(Wl.name)||function(o,...i){const s=new URL("https://lexical.dev/docs/error"),l=new URLSearchParams;l.append("code",o);for(const a of i)l.append("v",a);throw s.search=l.toString(),Error(`Minified Lexical error #${o}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(321,[...n.getDirectDependentNames()].join(" "));const r=[t,{getTheme:()=>t._config.theme}];return{Component:F3(e,r),context:r}},config:V3,mergeConfig(t,e){const n=ma(t,e);return e.decorators&&(n.decorators=e.decorators.length>0?[...t.decorators,...e.decorators]:t.decorators),n},name:"@lexical/react/React",peerDependencies:[zv(Wl.name)]},B3=new WeakSet,j3=new WeakMap,W3=new Set([eo,Qt,to,Yr,fr]),wr=new WeakMap;function z3(t){return Eo(Do,{createInitialHistoryState:()=>t,disabled:!1})}function K3({name:t,namespace:e,nodes:n,theme:r,editable:o=!0,parentEditor:i,historyMode:s,historyState:l,initialEditorState:a,onError:c=u=>{throw u}}){const u=[Wl,Eo(by,{contentEditable:null}),Eo(w0,{setOptions:{tag:Ar},updateOptions:{tag:Ar}})];if(i&&u.push(Eo(pC,{$getParentEditor:()=>i,inheritEditableFromParent:!0})),s==="nested-shared")u.push(CC);else if(s==="root-shared"||s==="nested-external"){if(!l)throw new Error(`${s} requires a historyState`);u.push(z3(l))}else s==="table-local"&&u.push(Eo(Do,{disabled:!1}));const f={name:t,namespace:e,nodes:n==null?void 0:n.filter(_=>!W3.has(_)),theme:r,editable:o,$initialEditorState:a,onError:c,dependencies:u},d=uC(f),g=io(d,Do.name),h=g==null?void 0:g.output.historyState.value;h&&j3.set(d,h),h&&(wr.has(h)||wr.set(h,h.current));const p=h?d.registerUpdateListener(({dirtyElements:_,dirtyLeaves:S,tags:E})=>{const b=h.current;if(E.has(Ar)){wr.set(h,b);return}if(_.size>0||S.size>0){wr.set(h,b);return}const w=wr.get(h);(b==null?void 0:b.editor)===d&&w&&w.editor!==d&&(h.undoStack.push({...w}),h.redoStack=[],d.dispatchCommand(Mr,!0),d.dispatchCommand(Nr,!1)),wr.set(h,b)}):()=>{},y=new Set,m=h?d.registerCommand(_f,()=>{const _=setTimeout(()=>{y.delete(_),d.dispatchCommand(Mr,h.undoStack.length>0),d.dispatchCommand(Nr,h.redoStack.length>0)});return y.add(_),!1},st):()=>{},x=d.dispose.bind(d);let v=!1;return d.dispose=()=>{v||(v=!0,y.forEach(clearTimeout),y.clear(),m(),p(),x())},s==="root-shared"&&B3.add(d),d}const Xf=U("NESTED_EDITOR_UPDATED_COMMAND"),pr=Y(null),bt=Y(null),Eu=Y(""),Tu=Y(!0),Qi=Y(!1,t=>{t.sub(t.pipe(Qi,Ft(pr)),([e,n])=>{n==null||n.setEditable(!e)})}),ku=Y(""),Qg=Y(!1),es=Y(!1),wy=Y(0),zl=Y(null),Nu=jt(t=>{t.link(t.pipe(zl,ta(e=>e!==null)),Nu)}),Sy=jt(t=>{t.sub(t.pipe(Sy,Ft(bt)),([e,n])=>{n==null||n.dispatchCommand(Sn,e)})}),Qf=Y(null,t=>{t.sub(t.pipe(Qf,Ft(bt)),([e,n])=>{if(!e||!n)return;const r=e.anchor.getNode();let o=r.getKey()==="root"?r:Ne(r,l=>{const a=l.getParent();return a!==null&&ve(a)});o??(o=r.getTopLevelElementOrThrow());const i=o.getKey();if(n.getElementByKey(i)!==null){const l=ba(o)?o.getTag():o.getType();t.pub(Gy,l)}})}),Ey=Y(""),Jr=Y(""),Kl=Y(!1),wa=jt(t=>{t.link(Jr,wa),t.sub(Ey,e=>{t.pubIn({[Kl]:!0,[Jr]:e})})}),Mu=jt(t=>{t.link(t.pipe(wa,Ft(Pu),ta(([,e])=>!e),gm(([e])=>e)),Mu)},!0),Ty=Y([]),ky=Y([]),Ny=Y([]),My=Y([]),ed=Y([]),td=Y([]),Jl=Y({}),Oy=Y(!1),nd=Y([]),J3=Y([]),Ay=Y([]),Py=Y(""),rd=Y(null),U3=Y(null),Ly=Y(null),Sa=gt(ky),ts=gt(Ty),Ou=gt(Ny),Au=gt(My),Ea=gt(ed),$y=gt(td),Pu=Y(!1),od=jt(t=>{t.sub(t.pipe(od,Ft(Jr,pr,es),ta(([e,n])=>e.trim()!==n.trim())),([e,,n,r])=>{t.pub(Pu,!0),n==null||n.update(()=>{Ce().clear(),id(t,Ce(),e),r?n.focus():He(null)},{onUpdate:()=>{t.pub(Pu,!1)}})})}),Iy=jt(t=>{t.sub(t.pipe(Iy,Ft(bt,es)),([e,n,r])=>{n==null||n.update(()=>{const o=V();if(o!==null){const i={children:[],append(s){this.children.push(s)},getType(){return o.getNodes()[0].getType()}};id(t,i,e),wf(i.children)}r?n.focus():He(null)})})});function Ry(){return pm((t,[e,n])=>(t.forEach(r=>{if(!r)throw new Error("You have a subscription that does not return a teardown");r()}),n?e.map(r=>r(n)):[]),[])}const G3=Y(null),Dy=Y([],t=>{t.pipe(t.combine(Dy,bt),Ry())}),Fy=Y([],t=>{t.pipe(t.combine(Fy,pr),Ry())}),Z3=Y(null,Ho,(t,e)=>!!(t&&e&&t.editorRef===e.editorRef)),Lu=jt(),vs=Y(t=>{throw new Error(`No icon component for ${t}`)});function gt(t,e){return jt((n,r)=>{n.changeWith(t,r,(o,i)=>{Array.isArray(i)||(i=[i]);let s=o;for(const l of i)o.includes(l)||(s=[...s,l]);return s}),e==null||e(n,r)})}function Hy(t){const e=V();$(e)&&t.pubIn({[Qf]:e,[wy]:e.format})}const Vy=gt(Fy,(t,e)=>{t.pub(e,[n=>n.registerCommand(lf,(r,o)=>(t.pubIn({[bt]:o,[es]:!0}),o._parentEditor===null&&o.getEditorState().read(()=>{t.pub(Z3,{rootNode:Ce(),editorType:"lexical",editorRef:o})}),Hy(t),!1),or),n=>n.registerUpdateListener(({dirtyElements:r,dirtyLeaves:o,editorState:i})=>{if(t.getValue(zl)!==null||r.size===0&&o.size===0)return;let l;i.read(()=>{Ce().getLastChild()instanceof ds&&n.update(()=>{Ce().append(re())},{discrete:!0}),l=gy({root:Ce(),visitors:t.getValue(ed),jsxComponentDescriptors:t.getValue(nd),toMarkdownExtensions:t.getValue(td),toMarkdownOptions:t.getValue(Jl),jsxIsAvailable:t.getValue(Oy)})}),t.pub(Jr,l.trim()),t.pub(Kl,!1)}),n=>n.registerCommand(_f,()=>(t.pub(es,!0),!1),or)])}),q3=gt(Dy,(t,e)=>{t.pub(e,[n=>n.registerUpdateListener(({editorState:r})=>{r.read(()=>{Hy(t)})}),n=>n.registerCommand(Ym,r=>{var o;const i=t.getValue(pr);return i&&!((o=i.getRootElement())!=null&&o.contains(r.relatedTarget))&&t.pubIn({[es]:!1,[Lu]:r}),!1},or)])});function id(t,e,n){try{B9({root:e,visitors:t.getValue(Ty),mdastExtensions:t.getValue(My),markdown:n,syntaxExtensions:t.getValue(Ny),jsxComponentDescriptors:t.getValue(nd),directiveDescriptors:t.getValue(J3),codeBlockEditorDescriptors:t.getValue(Ay),defaultCodeBlockLanguage:t.getValue(Py)}),t.pub(zl,null)}catch(r){if(r instanceof wu||r instanceof Su)t.pubIn({[Jr]:n,[zl]:{error:r.message,source:n}});else throw r}}const By=Y([]),jy=gt(By),Wy=Y([]),Y3=gt(Wy),zy=Y([]),X3=gt(zy),Ky=Y([]);gt(Ky);const Q3=Y([]),Jy=gt(Q3),ew=Y([]),tw=gt(ew),Uy=Y(!1,t=>{t.link(t.pipe(bt,gm(e=>{var n,r;return["td","th"].includes(((r=(n=e==null?void 0:e.getRootElement())==null?void 0:n.parentNode)==null?void 0:r.nodeName.toLowerCase())??"")})),Uy)}),ep=Y(Uf()),Gy=Y("");jt();const Ul=jt(t=>{t.sub(t.pipe(Ul,Ft(bt)),([e,n])=>{n==null||n.update(()=>{const r=V();$(r)&&(Uv(r,e),setTimeout(()=>{n.focus()}))})})}),nw=jt(t=>{t.sub(t.pipe(nw,Ft(bt)),([e,n])=>{n==null||n.focus(()=>{n.getEditorState().read(()=>{const r=V();$(r)&&(n.update(()=>{const o=e();o.isInline()?(wf([o]),ve(o.getParentOrThrow())&&Yv(o,re).selectEnd()):qv(o),setTimeout(()=>{"select"in o&&typeof o.select=="function"&&o.select()})}),setTimeout(()=>{n.dispatchCommand(Xf,void 0)}))})},{defaultSelection:"rootEnd"})})}),Gl=Y("rich-text",t=>{function e(){return pm((n,r)=>({current:n.next,next:r}),{current:"rich-text",next:"rich-text"})}t.sub(t.pipe(Gl,e(),Ft(ns)),([{current:n},r])=>{(n==="source"||n==="diff")&&t.pub(od,r)}),t.sub(t.pipe(Gl,e(),ta(n=>n.current==="rich-text"),Ft(bt)),([,n])=>{n==null||n.dispatchCommand(Xf,void 0)})}),ns=Y("",t=>{t.link(Jr,ns),t.link(ns,wa)},!0),sd=Y([]),ld=gt(sd),Zy=Y(()=>{throw new Error("No translation function provided")}),tp=Y(my),rw=Xo({init(t,e){const n=(e==null?void 0:e.initialMarkdown)??"";t.register(Vy),t.register(q3),t.register(wa),t.register(ns),t.pubIn({[Ey]:e!=null&&e.trim?n.trim():n,[vs]:e==null?void 0:e.iconComponentFor,[ts]:[a3,l3,c3,X9,...o3],[Sa]:[fr,Qt,_s],[Ea]:[Z9,G9,Y9,U9,J9],[Eu]:e==null?void 0:e.contentEditableClassName,[Tu]:e==null?void 0:e.spellCheck,[Jl]:e==null?void 0:e.toMarkdownOptions,[Qg]:e==null?void 0:e.autoFocus,[ku]:e==null?void 0:e.placeholder,[Qi]:e==null?void 0:e.readOnly,[Zy]:e==null?void 0:e.translation,[ep]:Uf(),[Au]:[m2(),Lb],[Ou]:[p2(),g9()],[$y]:[t9(),g2(),Rb],[tp]:(e==null?void 0:e.lexicalTheme)??my}),t.singletonSub(Nu,e==null?void 0:e.onError),t.singletonSub(Mu,r=>{e==null||e.onChange(r,t.getValue(Kl))}),t.singletonSub(Lu,e==null?void 0:e.onBlur),e!=null&&e.suppressHtmlProcessing||t.pubIn({[Au]:[e9(),u3()],[Ou]:[P9(),L9(),f3],[ts]:i3})},postInit(t,e){const n=K3({name:"@mdxeditor/root",editable:(e==null?void 0:e.readOnly)!==!0,namespace:(e==null?void 0:e.lexicalEditorNamespace)??"MDXEditor",nodes:[...t.getValue(ky),...(e==null?void 0:e.additionalLexicalNodes)??[]],theme:t.getValue(tp),historyMode:e!=null&&e.suppressSharedHistory?"none":"root-shared",historyState:t.getValue(ep),initialEditorState:(e==null?void 0:e.editorState)===null?null:()=>{const o=(e==null?void 0:e.initialMarkdown.trim())??"";id(t,Ce(),o)}});zd(t,()=>{n.dispose()});const r=e==null?void 0:e.autoFocus;if((e==null?void 0:e.editorState)!==null&&r){const o=setTimeout(()=>{n.focus(Ho,{defaultSelection:r===!0?"rootStart":r.defaultSelection??"rootStart"})});zd(t,()=>{clearTimeout(o)})}t.pub(pr,n),t.pub(bt,n)},update(t,e){t.pubIn({[Eu]:e==null?void 0:e.contentEditableClassName,[Tu]:e==null?void 0:e.spellCheck,[Jl]:e==null?void 0:e.toMarkdownOptions,[Qg]:e==null?void 0:e.autoFocus,[ku]:e==null?void 0:e.placeholder,[Qi]:e==null?void 0:e.readOnly}),t.singletonSub(Mu,n=>{e==null||e.onChange(n,t.getValue(Kl))}),t.singletonSub(Lu,e==null?void 0:e.onBlur),t.singletonSub(Nu,e==null?void 0:e.onError)}});function oi(){return ln(Zy)}function ow({initialEditor:t,children:e}){const{Component:n}=dC(t,by).output;return L.jsx(n,{children:e})}const iw=dt?C.useLayoutEffect:C.useEffect;function sw(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function lw(){return function(t){const[e]=pn(),n=C.useMemo(()=>t(e),[e,t]),[r,o]=C.useState(()=>n.initialValueFn()),i=C.useRef(r);return iw(()=>{const{initialValueFn:s,subscribe:l}=n,a=s();return i.current!==a&&(i.current=a,o(a)),l(c=>{i.current=c,o(c)})},[n,t]),r}(sw)}function aw(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ad=dt?C.useLayoutEffect:C.useEffect;function cw({editor:t,ErrorBoundary:e}){return function(n,r){const[o,i]=C.useState(()=>n.getDecorators());return ad(()=>n.registerDecoratorListener(s=>{nr.flushSync(()=>{i(s)})}),[n]),C.useEffect(()=>{i(n.getDecorators())},[n]),C.useMemo(()=>{const s=[],l=Object.keys(o);for(let a=0;an._onError(d),children:L.jsx(C.Suspense,{fallback:null,children:o[c]})}),f=n.getElementByKey(c);f!==null&&s.push(nr.createPortal(u,f,c))}return s},[r,o,n])}(t,e)}function uw({editor:t,ErrorBoundary:e}){return function(n){const r=On.maybeFromEditor(n);if(r&&r.hasExtensionByName(Wl.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&aw(320,o);return!0}return!1}(t)?null:L.jsx(cw,{editor:t,ErrorBoundary:e})}function np(t){return t.read("latest",xy(t.isComposing()))}function fw({contentEditable:t,placeholder:e=null,ErrorBoundary:n}){const[r]=pn();return function(o){ad(()=>tt(Ab(o),Eb(o)),[o])}(r),L.jsxs(L.Fragment,{children:[t,L.jsx(dw,{content:e}),L.jsx(uw,{editor:r,ErrorBoundary:n})]})}function dw({content:t}){const[e]=pn(),n=function(o){const[i,s]=C.useState(()=>np(o));return ad(()=>{function l(){const a=np(o);s(a)}return l(),tt(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i}(e),r=lw();return n?typeof t=="function"?t(r):t:null}var qy={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var i="",s=0;s{const l=V();!l||$(l)&&l.isCollapsed()||l.getNodes().length===0||(r=U0(t,l).nodes,r.length>0&&(n=I1()))},{editor:t});const i=n;if(!i||r.length===0)return"";const s={error:void 0,failed:!1};if(i.update(()=>{try{const l=Ce(),a=G0(r);let c=re();const u=()=>{c.isEmpty()||(l.append(c),c=re())};for(const f of a)f.isInline()?c.append(f):(u(),l.append(f));u(),o=py({root:l,...e})}catch(l){s.failed=!0,s.error=l}},{discrete:!0,skipTransforms:!0}),s.failed)throw s.error;return o.replace(/\n+$/u,"")}const Iw=({children:t})=>{const e=ln(pr);return N.createElement(iw,{initialEditor:e},t)},Rw=()=>{const t=oi(),e=$r($y),n=$r(Z3),r=f=>{n(f),e(f?{current:f}:null)},[o,i,s,l,a,c,u]=Yo(Eu,Tu,jy,zy,Jy,ku,Ky);return N.createElement(N.Fragment,null,l.map((f,d)=>N.createElement(f,{key:d})),N.createElement(Xy,{wrappers:a},N.createElement("div",{className:Rt(Le.rootContentEditableWrapper,"mdxeditor-root-contenteditable")},N.createElement(dw,{contentEditable:N.createElement("div",{ref:r},N.createElement(Cy,{className:Rt(Le.contentEditable,o),ariaLabel:t("contentArea.editableMarkdown","editable markdown"),spellCheck:i})),placeholder:N.createElement("div",{className:Rt(Le.contentEditable,Le.placeholder,o)},N.createElement("p",null,c)),ErrorBoundary:by}))),s.map((f,d)=>N.createElement(f,{key:d})),u.map((f,d)=>N.createElement(f,{key:d})))},Dw={listItemIndent:"one"},Fw=t=>pw[t];function Hw(t,e,n={}){let r=e;for(const[o,i]of Object.entries(n))r=r.replaceAll(`{{${o}}}`,String(i));return r}const Xy=({wrappers:t,children:e})=>{if(t.length===0)return N.createElement(N.Fragment,null,e);const n=t[0];return N.createElement(n,null,N.createElement(Xy,{wrappers:t.slice(1)},e))},Vw=({children:t,className:e,overlayContainer:n})=>{const r=N.useRef(null),o=N.useRef(null),i=$r(rd),s=$r(G3);return N.useEffect(()=>{const l=document.createElement("div");return l.classList.add("mdxeditor-popup-container",Le.editorRoot,Le.popupContainer,...(e??"").trim().split(" ").filter(Boolean)),(n??document.body).appendChild(l),r.current=l,i(r),s(o),()=>{l.remove()}},[e,r,n,i,s]),N.createElement("div",{className:Rt("mdxeditor",Le.editorRoot,Le.editorWrapper,e),ref:o},t)};function Bw(t){return{getMarkdown:()=>{const e=t.getValue(Gl);return e==="source"||e==="diff"?t.getValue(ns):t.getValue(Jr)},setMarkdown:e=>{t.pub(od,e)},insertMarkdown:e=>{t.pub(Ry,e)},focus:(e,n)=>{var r;(r=t.getValue(pr))==null||r.focus(e,n)},getContentEditableHTML:()=>{var e;return((e=t.getValue($y))==null?void 0:e.current.innerHTML)??""},getSelectionMarkdown:()=>{const e=t.getValue(Gl);if(e==="source"||e==="diff")return"";const n=t.getValue(bt);if(!n)return"";const r=t.getValue(ed),o=t.getValue(td),i=t.getValue(Jl),s=t.getValue(nd),l=t.getValue(Ay);return $w(n,{visitors:r,toMarkdownExtensions:o,toMarkdownOptions:i,jsxComponentDescriptors:s,jsxIsAvailable:l})}}}const jw=({onReady:t,onDispose:e})=>{const n=ea(),r=N.useMemo(()=>Bw(n),[n]);return N.useLayoutEffect(()=>(t(r),()=>{e(r)}),[r,e,t]),null},Ww=N.forwardRef((t,e)=>{const n=N.useRef(null),r=N.useRef(null),o=N.useRef([]),i=N.useRef(t.trim===!1?t.markdown:t.markdown.trim()),s=N.useCallback(u=>{const f=n.current;f&&r.current===null?u(f):o.current.push(u)},[]),l=N.useMemo(()=>({getMarkdown:()=>{var u;return((u=n.current)==null?void 0:u.getMarkdown())??i.current},setMarkdown:u=>{i.current=u,s(f=>{f.setMarkdown(u)})},insertMarkdown:u=>{s(f=>{f.insertMarkdown(u)})},focus:(u,f)=>{s(d=>{d.focus(u,f)})},getContentEditableHTML:()=>{var u;return((u=n.current)==null?void 0:u.getContentEditableHTML())??""},getSelectionMarkdown:()=>{var u;return((u=n.current)==null?void 0:u.getSelectionMarkdown())??""}}),[s]),a=N.useCallback(u=>{if(n.current=u,r.current===u)return;if(o.current.length===0){i.current=u.getMarkdown();return}r.current=u;const f=()=>{if(n.current!==u){r.current===u&&(r.current=null);return}const d=o.current.shift();if(!d){r.current=null,i.current=u.getMarkdown();return}d(u),queueMicrotask(f)};f()},[]),c=N.useCallback(u=>{n.current===u&&(i.current=u.getMarkdown(),n.current=null)},[]);return N.useImperativeHandle(e,()=>l,[l]),N.createElement(U2,{plugins:[ow({contentEditableClassName:t.contentEditableClassName??"",spellCheck:t.spellCheck??!0,initialMarkdown:t.markdown,onChange:t.onChange??Ho,onBlur:t.onBlur??Ho,toMarkdownOptions:t.toMarkdownOptions??Dw,autoFocus:t.autoFocus??!1,placeholder:t.placeholder??"",readOnly:!!t.readOnly,iconComponentFor:t.iconComponentFor??Fw,suppressHtmlProcessing:t.suppressHtmlProcessing??!1,onError:t.onError??Ho,translation:t.translation??Hw,trim:t.trim??!0,lexicalTheme:t.lexicalTheme,..."editorState"in t?{editorState:t.editorState}:{},suppressSharedHistory:t.suppressSharedHistory??!1,additionalLexicalNodes:t.additionalLexicalNodes??[],lexicalEditorNamespace:t.lexicalEditorNamespace??"MDXEditor"}),...t.plugins??[]]},N.createElement(Vw,{className:t.className,overlayContainer:t.overlayContainer},N.createElement(Iw,null,N.createElement(Rw,null))),N.createElement(jw,{onReady:a,onDispose:c}))}),zw=typeof window<"u"&&typeof window.document.createElement<"u",$u=zw&&(()=>{var t;const e=(t=navigator.userAgentData)==null?void 0:t.platform;return e?/mac/i.test(e):/Mac|iPod|iPhone|iPad/.test(navigator.userAgent)})();function Kw(t,e){return $u?t:e}const Jw={testLexicalNode:ba,visitLexicalNode:({lexicalNode:t,actions:e})=>{const n=parseInt(t.getTag()[1],10);e.addAndStepInto("heading",{depth:n})}},Uw={testNode:"heading",visitNode:function({mdastNode:t,actions:e}){e.addAndStepInto(Yt(`h${t.depth}`))}},Gw=["Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6"],Qy=[1,2,3,4,5,6],Zw={Digit1:1,Digit2:2,Digit3:3,Digit4:4,Digit5:5,Digit6:6},Ta=Y(Qy,t=>{t.pub(By,e=>e.registerCommand(uf,n=>{const{code:r,ctrlKey:o,metaKey:i,altKey:s}=n;return Gw.includes(r)&&Kw(i,o)&&s?(n.preventDefault(),e.update(()=>{if(r==="Digit0")t.pub(Ul,()=>re());else{const l=t.getValue(Ta),a=Zw[r];l.includes(a)&&t.pub(Ul,()=>Yt(`h${a}`))}}),!0):!1},st))}),qw=Xo({init(t){t.pubIn({[ld]:"headings",[ts]:Uw,[Sa]:xs,[Ea]:Jw})},update(t,e){t.pub(Ta,(e==null?void 0:e.allowedHeadingLevels)??Qy)}});function op(t,e){return t.read("latest",()=>{const n=Se(e);return n!==null&&n.isSelected()})}function Yw(t){const[e]=pn(),[n,r]=C.useState(()=>op(e,t));return C.useEffect(()=>{let o=!0;const i=e.registerUpdateListener(()=>{o&&r(op(e,t))});return()=>{o=!1,i()}},[e,t]),[n,C.useCallback(o=>{e.update(()=>{let i=V();be(i)||(i=Ki(),He(i)),be(i)&&(o?i.add(t):i.delete(t))})},[e,t]),C.useCallback(()=>{e.update(()=>{const o=V();be(o)&&o.clear()})},[e])]}function Xw({nodeKey:t}){const[e]=pn(),[n,r,o]=Yw(t);return C.useEffect(()=>tt(e.registerCommand(af,i=>{const s=e.getElementByKey(t);return If(i)===s&&(i.shiftKey||o(),r(!n),!0)},st)),[o,e,n,t,r]),C.useEffect(()=>{const i=e.getElementByKey(t),s=e._config.theme.hrSelected??"selected";i!==null&&(n?Xt(i,s):ya(i,s))},[e,n,t]),null}class ka extends so{static getType(){return"horizontalrule"}static clone(e){return new ka(e.__key)}static importJSON(e){return cd().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Qw,priority:0})}}decorate(){return L.jsx(Xw,{nodeKey:this.__key})}}function Qw(){return{node:cd()}}function cd(){return kt(new ka)}function Zn(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function rs(t){let e=1,n=t.getParent();for(;n!=null;){if(Q(n)){const r=n.getParent();if(Z(r)){e++,n=r.getParent();continue}Zn(40)}return e}return e}function Iu(t){const e=t.getParent();Z(e)||Zn(40);let n=e,r=e;for(;r!==null;)r=r.getParent(),Z(r)&&(n=r);return n}function e5(t){let e=[];const n=t.getChildren().filter(Q);for(let r=0;r0&&t.append(...o),e.remove()}function e8(){const t=V();if($(t)){const e=new Set,n=t.getNodes(),r=t.anchor.getNode();if(t5(r,n))e.add(Iu(r));else for(let o=0;os.append(c));const l=lt(t),a=lt(e);l.append(a),Ur(a,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(l),n.replace(t)}}}function n8(t=!1){const e=V();if(!$(e)||!e.isCollapsed())return!1;const n=e.anchor.getNode();let r=null;if(Q(n)&&n.getChildrenSize()===0)r=n;else if(D(n)){const c=n.getParent();Q(c)&&c.getChildren().every(u=>D(u)&&u.getTextContent().trim()==="")&&(r=c)}if(r===null)return!1;const o=Iu(r),i=r.getParent();Z(i)||Zn(40);const s=i.getParent();let l;if(ve(s))l=re(),o.insertAfter(l);else{if(!Q(s))return!1;l=lt(s),s.insertAfter(l)}l.setTextStyle(e.style).setTextFormat(e.format).select();const a=r.getNextSiblings();if(a.length>0){const c=t?function(f,d){return f.getStart()+d.getIndexWithinParent()}(i,r):1,u=lt(i).setStart(c);if(Q(l)){const f=lt(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...a)}return function(c){let u=c;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!Q(f)&&!Z(f))break;u=f}u.remove()}(r),!0}let jn=class extends ft{constructor(n=1,r=void 0,o){super(o);P(this,"__value");P(this,"__checked");this.__value=n===void 0?1:n,this.__checked=r}$config(){return this.config("listitem",{$transform:n=>{const r=n.getParent();if(Z(r))r.getListType()!=="check"&&n.getChecked()!=null&&n.setChecked(void 0);else if(r){const o=n.createParentElementNode();Z(o)||Zn(340);const i=[n];for(const s of["previous","next"]){i.reverse();for(const{origin:l}of fe(n,s)){if(!Q(l))break;i.push(l)}}n.insertBefore(o),o.splice(0,0,i),ve(r)||(Wf(o,oo(fe(o,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),r.isEmpty()&&r.isAttached()&&r.remove())}},extends:ft,importDOM:{li:()=>({conversion:r8,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__value=n.__value,this.__checked=n.__checked}createDOM(n){const r=Te().createElement("li");return this.updateListItemDOM(null,r,n),r}updateListItemDOM(n,r,o){(function(l,a){const c=a.getParent();!Z(c)||c.getListType()!=="check"||Z(a.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),l.setAttribute("aria-checked",a.getChecked()?"true":"false"))})(r,this),r.value=this.__value,function(l,a,c){const u=a.list;if(!u)return;const f=u.listitem,d=u.nested&&u.nested.listitem,g=c.getParent(),h=Z(g)&&g.getListType()==="check",p=c.getChecked(),y=c.getChildren().some(v=>Z(v)),m=[];u.listitemChecked!==void 0&&m.push(u.listitemChecked),u.listitemUnchecked!==void 0&&m.push(u.listitemUnchecked),d!==void 0&&m.push(...Nn(d)),m.length>0&&ya(l,...m);const x=[];if(f!==void 0&&x.push(...Nn(f)),h){const v=p?u.listitemChecked:u.listitemUnchecked;v!==void 0&&x.push(v)}d!==void 0&&y&&x.push(...Nn(d)),x.length>0&&Xt(l,...x)}(r,o.theme,this);const i=n?n.__style:"",s=this.__style;i!==s&&$o(r.style,s,i),function(l,a,c){const u=a.__textStyle,f=c?c.__textStyle:"";if(c!==null&&f===u)return;const d=Tl(u);for(const g in d)l.style.setProperty(`--listitem-marker-${g}`,d[g]);if(f!=="")for(const g in Tl(f))g in d||l.style.removeProperty(`--listitem-marker-${g}`)}(r,this,n)}updateDOM(n,r,o){const i=r;return this.updateListItemDOM(n,i,o),!1}updateFromJSON(n){return super.updateFromJSON(n).setValue(n.value).setChecked(n.checked)}exportDOM(n){const r=this.createDOM(n._config),o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();return i&&(r.dir=i),At(this)?{after(s){if(q(s)){const l=s.previousElementSibling;if(q(l)&&l.nodeName==="LI"){for(;s.firstChild;)l.append(s.firstChild);s.remove()}}return s},element:r}:{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...n){for(let r=0;rs.append(l)),n.insertAfter(s,r)}return n}remove(n){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(n),r&&o&&At(r)&&At(o)&&(ud(r.getFirstChild(),o.getFirstChild()),o.remove())}resetOnCopyNodeFrom(n){super.resetOnCopyNodeFrom(n),n.getChecked()&&this.setChecked(!1)}insertNewAfter(n,r=!0){const o=lt(this);return this.insertAfter(o,r),o}collapseAtStart(n){if(At(this))return!1;const r=this.getParentOrThrow();if(Q(r.getParentOrThrow()))return sp(this),!0;const o=re().append(...this.getChildren()),i=this.getNextSiblings();if(i.length>0){const s=lt(r);s.append(...i),r.insertAfter(s)}return r.insertAfter(o),this.remove(),r.getChildrenSize()===0&&r.remove(),o.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(n){const r=this.getWritable();return r.__value=n,r}getChecked(){const n=this.getLatest();let r;const o=this.getParent();return Z(o)&&(r=o.getListType()),r==="check"?!!n.__checked:void 0}setChecked(n){const r=this.getWritable();return r.__checked=n,r}toggleChecked(){const n=this.getWritable();return n.setChecked(!n.__checked)}getIndent(){const n=this.getParent();if(n===null||!this.isAttached())return this.getLatest().__indent;let r=n.getParentOrThrow(),o=0;for(;Q(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(n){typeof n!="number"&&Zn(117),(n=Math.floor(n))>=0||Zn(199);let r=this.getIndent();for(;r!==n;)r0&&r.children[0].tagName==="INPUT")return lp(r.children[0])}const e=t.getAttribute("aria-checked"),n=Bt(e==="true"||e!=="false"&&void 0);return gn(n,t),{after:r5.bind(null,n),node:Wt(n,t)}}function lp(t){if(t.getAttribute("type")!=="checkbox")return{node:null};const e=Bt(t.hasAttribute("checked"));return{after:r5.bind(null,e),node:e}}function r5(t,e){const n=e[0];return e.length===1&&Qo(n)&&!t.getFormatType()&&n.getFormatType()?(t.setFormat(n.getFormatType()),n.getChildren()):e}function Bt(t){return kt(new jn(void 0,t))}function Q(t){return t instanceof jn}let Wn=class extends ft{constructor(n="number",r=1,o){super(o);P(this,"__tag");P(this,"__start");P(this,"__listType");const i=o8[n]||n;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:n=>{(function(r){const o=r.getNextSibling();Z(o)&&r.getListType()===o.getListType()&&ud(r,o)})(n),n5(n)},extends:ft,importDOM:{ol:()=>({conversion:cp,priority:0}),ul:()=>({conversion:cp,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__listType=n.__listType,this.__tag=n.__tag,this.__start=n.__start}getTag(){return this.getLatest().__tag}setListType(n){const r=this.getWritable();return r.__listType=n,r.__tag=n==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(n){const r=this.getWritable();return r.__start=n,r}createDOM(n,r){const o=this.__tag,i=Te().createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,ap(i,n.theme,this),i}updateDOM(n,r,o){return n.__tag!==this.__tag||n.__listType!==this.__listType||(ap(r,o.theme,this),n.__start!==this.__start&&r.setAttribute("start",String(this.__start)),!1)}updateFromJSON(n){return super.updateFromJSON(n).setListType(n.listType).setStart(n.start)}exportDOM(n){const r=this.createDOM(n._config,n);return q(r)&&(this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check")),{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(n,r,o){let i=o;for(let s=0;s1?r.push(...h):o.push(...h)}}o.length>0&&ya(t,...o),r.length>0&&Xt(t,...r)}function cp(t){let e;if(function(n){return q(n)&&n.nodeName.toLowerCase()==="ol"}(t)){const n=t.start;e=Dt("number",n)}else e=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list")||n.getAttribute("data-is-checklist")==="1")return!0;for(const r of n.childNodes)if(q(r)&&r.hasAttribute("aria-checked"))return!0;return!1}(t)?Dt("check"):Dt("bullet");return Wt(e,t),{after:n=>function(r,o){const i=o.createListItemNode.bind(o),s=[];for(let l=0;l1&&c.forEach(u=>{Z(u)&&s.push(i().append(u))})}else s.push(i().append(a))}return s}(n,e),node:e}}const o8={ol:"number",ul:"bullet"};function Dt(t="number",e=1){return kt(new Wn(t,e))}function Z(t){return t instanceof Wn}const o5=U("INSERT_CHECK_LIST_COMMAND");function i8(t,e){const n=e&&e.disableTakeFocusOnClick||!1,r=typeof n=="boolean"?()=>n:n.peek.bind(n),o=c=>{const u=c.target;if(!q(u))return!1;const f=u.__lexicalCheckListLastHandled;return f!==void 0&&c.timeStamp-f<500},i=c=>{const u=c.target;q(u)&&(u.__lexicalCheckListLastHandled=c.timeStamp)},s=c=>{o(c)||(i(c),up(c,r()))},l=c=>{c.pointerType==="touch"&&(o(c)||(i(c),up(c,r())))},a=c=>{(function(u,f){i5(u,()=>{u.preventDefault(),f&&u.stopPropagation()})})(c,r())};return tt(t.registerCommand(o5,()=>(Ru("check"),!0),st),t.registerCommand(hf,c=>fp(c,t,!1),st),t.registerCommand(df,c=>fp(c,t,!0),st),t.registerCommand(mf,()=>{if(Du(t)!=null){const c=t.getRootElement();return c!=null&&c.focus(),!0}return!1},st),t.registerCommand(gf,c=>{const u=Du(t);return!(u==null||!t.isEditable())&&(t.update(()=>{const f=un(u);Q(f)&&(c.preventDefault(),f.toggleChecked())}),!0)},st),t.registerCommand(ff,c=>t.read("latest",()=>{const u=V();if($(u)&&u.isCollapsed()){const{anchor:f}=u,d=f.type==="element";if(d||f.offset===0){const g=f.getNode(),h=Ne(g,p=>O(p)&&!p.isInline());if(Q(h)){const p=h.getParent();if(Z(p)&&p.getListType()==="check"&&(d||h.getFirstDescendant()===g)){const y=t.getElementByKey(h.__key);if(y!=null&&Ui(y)!==y)return y.focus(),c.preventDefault(),!0}}}}return!1}),st),t.registerRootListener(c=>{if(c!==null)return tt(og(c,{click:s,pointerup:l}),og(c,{mousedown:a,pointerdown:a},{capture:!0}),vf(c,"touchstart",a,{capture:!0,passive:!1}))}))}function i5(t,e){const n=t.target;if(!q(n))return;const r=n.firstChild;if(q(r)&&(r.tagName==="UL"||r.tagName==="OL"))return;const o=n.parentNode;if(!o||o.__lexicalListType!=="check")return;let i=null,s=null;if("clientX"in t)i=t.clientX;else if("touches"in t){const g=t.touches;g.length>0&&(i=g[0].clientX,s="touch")}if(i==null)return;const l=n.getBoundingClientRect(),a=i/Qv(n),c=n.ownerDocument.defaultView,u=c?c.getComputedStyle(n,"::before"):{width:"0px"},f=parseFloat(u.width),d=s==="touch"||"pointerType"in t&&t.pointerType==="touch"?32:0;(n.dir==="rtl"?al.right-f-d:a>l.left-d&&a{if(q(t.target)){const n=t.target,r=Pr(n);r!=null&&r.isEditable()&&r.update(()=>{const o=un(n);Q(o)&&(e?(In(El),In(u1)):n.focus(),o.toggleChecked())})}})}function Du(t){const e=t.getRootElement(),n=e?Ui(e):null;return q(n)&&n.tagName==="LI"&&n.parentNode!=null&&n.parentNode.__lexicalListType==="check"?n:null}function fp(t,e,n){const r=Du(e);return r!=null&&e.update(()=>{const o=un(r);if(!Q(o))return;const i=function(s,l){let a=l?s.getPreviousSibling():s.getNextSibling(),c=s;for(;a==null&&Q(c);)c=c.getParentOrThrow().getParent(),c!=null&&(a=l?c.getPreviousSibling():c.getNextSibling());for(;Q(a);){const u=l?a.getLastChild():a.getFirstChild();if(!Z(u))return a;a=l?u.getLastChild():u.getFirstChild()}return null}(o,n);if(i!=null){i.selectStart();const s=e.getElementByKey(i.__key);s!=null&&(t.preventDefault(),setTimeout(()=>{s.focus()},0))}}),!1}function s8(t){const e=[];for(const n of t)if(Q(n)){e.push(n);const r=n.getChildren();if(r.length>1)for(const o of r)Z(o)&&e.push(Bt().append(o))}else e.push(Bt().append(n));return e}const l8={$import:(t,e)=>{let n;var r;return $0(e,"ol")?n=Dt("number",e.start):n=(r=e).matches('[__lexicallisttype="check"], .contains-task-list, [data-is-checklist="1"]')||r.querySelector(":scope > [aria-checked]")!==null?Dt("check"):Dt("bullet"),Wt(n,e),[n.splice(0,0,D0(s8(t.$importChildren(e)),e))]},match:Ge.tag("ol","ul"),name:"@lexical/list/list"};function s5(t,e){if(e.length!==1)return e;const n=e[0];return Qo(n)&&!t.getFormatType()&&n.getFormatType()?(t.setFormat(n.getFormatType()),n.getChildren()):e}function l5(t){const e=s=>Zf(s)&&!Z(s);if(!t.some(e))return t;const n=[];let r=[];const o=()=>{r.length>0&&(n.push(r),r=[])};for(const s of t)e(s)?(o(),n.push(O(s)?s.getChildren():[s])):r.push(s);o();const i=[];for(const s of n)i.length>0&&i.push(_t()),i.push(...s);return i}const a8={$import:(t,e)=>{const n=e.getAttribute("aria-checked"),r=Bt(n==="true"||n!=="false"&&void 0);return gn(r,e),Wt(r,e),[r.splice(0,0,l5(s5(r,t.$importChildren(e))))]},match:Ge.tag("li"),name:"@lexical/list/li"};function dp(t,e,n){const r=$0(n,"input")?n:n.querySelector('input[type="checkbox"]');if(!r||r.getAttribute("type")!=="checkbox")return[];const o=Bt(r.hasAttribute("checked"));return gn(o,e),Wt(o,e),[o.splice(0,0,l5(s5(o,t.$importChildren(e))))]}Ge.tag("li").classAll("task-list-item"),Ge.tag("li").classAll("joplin-checkbox");const c8=U("UPDATE_LIST_START_COMMAND"),a5=U("INSERT_UNORDERED_LIST_COMMAND"),c5=U("INSERT_ORDERED_LIST_COMMAND"),u5=U("REMOVE_LIST_COMMAND");function hp(t,e){return tt(t.registerCommand(c5,()=>(Ru("number"),!0),st),t.registerCommand(c8,n=>{const{listNodeKey:r,newStart:o}=n,i=Se(r);return!!Z(i)&&(i.getListType()==="number"&&(i.setStart(o),n5(i)),!0)},st),t.registerCommand(a5,()=>(Ru("bullet"),!0),st),t.registerCommand(u5,()=>(e8(),!0),st),t.registerCommand(Hi,()=>n8(!!(e&&e.restoreNumbering)),st),t.registerCommand(pf,n=>{if(function(){const s=V();if(!$(s)||!s.isCollapsed()||s.anchor.offset!==0)return!1;const l=s.anchor.getNode(),a=Ne(l,Q);if(!Q(a))return!1;const c=a.getFirstDescendant();if(c===null||!a.is(l)&&!c.is(l))return!1;const u=a.getParent();if(!Z(u)||!a.is(u.getFirstChild()))return!1;const f=u.getPreviousSibling();if(!te(f)||f.isIsolated()||!f.isKeyboardSelectable()&&f.isInline())return!1;const d=re().append(...a.getChildren());return u.insertBefore(d),a.remove(),u.isEmpty()&&u.remove(),d.selectStart(),!0}())return n.preventDefault(),!0;const r=V();if(!$(r)||!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;let i=o.getNode();for(;!Q(i);){if(i.getPreviousSibling()!==null)return!1;const s=i.getParent();if(s===null)return!1;i=s}return!(!Q(i)||!i.collapseAtStart(r))&&(n.preventDefault(),!0)},ov),t.registerNodeTransform(jn,n=>{const r=n.getFirstChild();if(r){if(D(r)){const o=r.getStyle(),i=r.getFormat();n.getTextStyle()!==o&&n.setTextStyle(o),n.getTextFormat()!==i&&n.setTextFormat(i)}}else{const o=V();$(o)&&(o.style!==n.getTextStyle()||o.format!==n.getTextFormat())&&o.isCollapsed()&&n.is(o.anchor.getNode())&&n.setTextStyle(o.style).setTextFormat(o.format)}}),t.registerNodeTransform(Qt,n=>{const r=n.getParent();if(Q(r)&&n.is(r.getFirstChild())){const o=n.getStyle(),i=n.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function u8(t){const e=n=>{const r=n.getParent();if(Z(n.getFirstChild())||!Z(r))return;const o=Ne(n,i=>Q(i)&&Z(i.getParent())&&Q(i.getPreviousSibling()));if(o===null&&n.getIndent()>0)n.setIndent(0);else if(Q(o)){const i=o.getPreviousSibling();if(Q(i)){const s=function(a){let c=a,u=c.getFirstChild();for(;Z(u);){const f=u.getLastChild();if(!Q(f))break;c=f,u=c.getFirstChild()}return c}(i),l=s.getParent();if(Z(l)){const a=rs(l);a+1{const r=[n];for(;r.length>0;){const o=r.shift();if(Z(o)){for(const i of o.getChildren())if(Q(i)){e(i);const s=i.getFirstChild();Z(s)&&r.push(s)}}}})}const f8={testNode:"list",visitNode:function({mdastNode:t,lexicalParent:e,actions:n}){const r=t.children.some(i=>typeof i.checked=="boolean")?"check":t.ordered?"number":"bullet",o=Dt(r);if(Q(e)){const i=Bt();i.append(o),e.insertAfter(i)}else e.append(o);n.visitChildren(t,o)}},d8={testNode:"listItem",visitNode({mdastNode:t,actions:e,lexicalParent:n}){const r=n.getListType()==="check"?t.checked??!1:void 0;e.addAndStepInto(Bt(r))}},h8={testLexicalNode:Z,visitLexicalNode:({lexicalNode:t,actions:e})=>{e.addAndStepInto("list",{ordered:t.getListType()==="number",spread:!1})}},g8={testLexicalNode:Q,visitLexicalNode:({lexicalNode:t,mdastParent:e,actions:n})=>{const r=t.getChildren(),o=r[0];if(r.length===1&&Z(o)){const i=e.children.at(-1);i?n.visitChildren(t,i):n.visitChildren(o,e)}else{const i=t.getParent(),s=n.appendToParent(e,{type:"listItem",checked:i.getListType()==="check"?!!t.getChecked():void 0,spread:!1,children:[]});let l=null;for(const a of t.getChildren())D(a)||rt(a)||a.isInline()&&(O(a)||te(a))?(l??(l=n.appendToParent(s,{type:"paragraph",children:[]})),n.visit(a,l)):(l=null,n.visit(a,s))}}};function gp({maxIndent:t,$canIndent:e}){const[n]=pn();return C.useEffect(()=>xC(n,t,e),[n,t,e]),null}function pp({disableTakeFocusOnClick:t=!1}){const[e]=pn();return C.useEffect(()=>i8(e,{disableTakeFocusOnClick:t}),[e,t]),null}function mp({hasStrictIndent:t=!1,shouldPreserveNumbering:e=!1}){const[n]=pn();return C.useEffect(()=>{if(!n.hasNodes([Wn,jn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[n]),C.useEffect(()=>tt(hp(n,{restoreNumbering:e}),t?u8(n):()=>{}),[n,t,e]),function(r){C.useEffect(()=>hp(r),[r])}(n),null}const p8=new Map([["number",c5],["bullet",a5],["check",o5],["",u5]]),Fu=Y("",t=>{t.sub(t.pipe(Qf,Ft(bt)),([e,n])=>{if(!e||!n)return;const r=e.anchor.getNode();let o=r.getKey()==="root"?r:Ne(r,l=>{const a=l.getParent();return a!==null&&ve(a)});o??(o=r.getTopLevelElementOrThrow());const i=o.getKey();if(n.getElementByKey(i)!==null)if(Z(o)){const l=g0(r,Wn),a=l?l.getListType():o.getListType();t.pub(Fu,a)}else t.pub(Fu,"")})}),f5=jt(t=>{t.sub(t.pipe(f5,Ft(bt)),([e,n])=>{n==null||n.dispatchCommand(p8.get(e),void 0)})}),m8=Xo({init(t){var e;(e=t.getValue(pr))==null||e.registerCommand(Cl,()=>!x8(7),or),t.pubIn({[ld]:"lists",[Au]:v2(),[Ou]:_2(),[ts]:[f8,d8],[Sa]:[jn,Wn],[Ea]:[h8,g8],[Iy]:x2(),[Wy]:[gp,mp,pp],[Uy]:[gp,mp,pp]})}});function y8(t){const e=t.getNodes();return e.length===0?new Set([t.anchor.getNode().getParentOrThrow(),t.focus.getNode().getParentOrThrow()]):new Set(e.map(n=>O(n)?n:n.getParentOrThrow()))}function x8(t){const e=V();if(!$(e))return!1;const n=y8(e);let r=0;for(const o of n)if(Z(o))r=Math.max(rs(o)+1,r);else if(Q(o)){const i=o.getParent();if((i==null?void 0:i.getChildren().length)===1){const s=i.getParent();if(Q(s)&&s.getChildren().length===1)return!1}if(!Z(i))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");r=Math.max(rs(i)+1,r)}return r<=t}var _8=Object.defineProperty,ii=(t,e)=>_8(t,"name",{value:e,configurable:!0}),d5=!!(typeof window<"u"&&window.document&&window.document.createElement);function pe(t,e,{checkForDefaultPrevented:n=!0}={}){return ii(function(o){if(t==null||t(o),n===!1||!o||!o.defaultPrevented)return e==null?void 0:e(o)},"handleEvent")}ii(pe,"composeEventHandlers");function v8(t){var e;if(!d5)throw new Error("Cannot access window outside of the DOM");return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??window}ii(v8,"getOwnerWindow");function Hu(t){if(!d5)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}ii(Hu,"getOwnerDocument");function h5(t,e=!1){const{activeElement:n}=Hu(t);if(!(n!=null&&n.nodeName))return null;if(g5(n)&&n.contentDocument)return h5(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const o=Hu(n).getElementById(r);if(o)return o}}return n}ii(h5,"getActiveElement");function g5(t){return t.tagName==="IFRAME"}ii(g5,"isFrame");function yp(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function C8(...t){return e=>{let n=!1;const r=t.map(o=>{const i=yp(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o{var m;const{scope:d,children:g,...h}=f,p=((m=d==null?void 0:d[t])==null?void 0:m[a])||l,y=C.useMemo(()=>h,Object.values(h));return L.jsx(p.Provider,{value:y,children:g})};c.displayName=i+"Provider";function u(f,d,g={}){var m;const{optional:h=!1}=g,p=((m=d==null?void 0:d[t])==null?void 0:m[a])||l,y=C.useContext(p);if(y)return y;if(s!==void 0)return s;if(!h)throw new Error(`\`${f}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(l){const a=(l==null?void 0:l[t])||i;return C.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,b8(o,...e)]}function b8(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const f=a(i)[`__scope${c}`];return{...l,...f}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Zl(t){const e=C.forwardRef((n,r)=>{let{children:o,...i}=n,s=null,l=!1;const a=[];xp(o)&&typeof Bs=="function"&&(o=Bs(o._payload)),C.Children.forEach(o,d=>{var g;if(k8(d)){l=!0;const h=d;let p="child"in h.props?h.props.child:h.props.children;xp(p)&&typeof Bs=="function"&&(p=Bs(p._payload)),s=S8(h,p),a.push((g=s==null?void 0:s.props)==null?void 0:g.children)}else a.push(d)}),s?s=C.cloneElement(s,void 0,a):!l&&C.Children.count(o)===1&&C.isValidElement(o)&&(s=o);const c=s?T8(s):void 0,u=Ze(r,c);if(!s){if(o||o===0)throw new Error(l?A8(t):O8(t));return o}const f=E8(i,s.props??{});return s.type!==C.Fragment&&(f.ref=r?u:c),C.cloneElement(s,f)});return e.displayName=`${t}.Slot`,e}var p5=Symbol.for("radix.slottable");function w8(t){const e=n=>"child"in n?n.children(n.child):n.children;return e.displayName=`${t}.Slottable`,e.__radixId=p5,e}var S8=(t,e)=>{if("child"in t.props){const n=t.props.child;return C.isValidElement(n)?C.cloneElement(n,void 0,t.props.children(n.props.children)):null}return C.isValidElement(e)?e:null};function E8(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function T8(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function k8(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===p5}var N8=Symbol.for("react.lazy");function xp(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===N8&&"_payload"in t&&M8(t._payload)}function M8(t){return typeof t=="object"&&t!==null&&"then"in t}var O8=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,A8=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Bs=qo[" use ".trim().toString()],P8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=P8.reduce((t,e)=>{const n=Zl(`Primitive.${e}`),r=C.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),L.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function L8(t,e){t&&nr.flushSync(()=>t.dispatchEvent(e))}function fn(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}var $8=Object.defineProperty,We=(t,e)=>$8(t,"name",{value:e,configurable:!0}),Vu="dismissableLayer.update",I8="dismissableLayer.pointerDownOutside",R8="dismissableLayer.focusOutside",_p,m5=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),y5=C.forwardRef(We(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:c,...u}=e,f=C.useContext(m5),[d,g]=C.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=C.useState({}),y=Ze(n,g),m=Array.from(f.layers),[x]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=x?m.indexOf(x):-1,_=d?m.indexOf(d):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=v,b=C.useRef(!1),w=x5(R=>{s==null||s(R),a==null||a(R),R.defaultPrevented||c==null||c()},{ownerDocument:h,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:b,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:C.useCallback(R=>{if(!(R instanceof Node))return!1;const F=[...f.branches].some(H=>H.contains(R));return E&&!F},[f.branches,E])}),k=_5(R=>{if(o&&b.current)return;const F=R.target;[...f.branches].some(W=>W.contains(F))||(l==null||l(R),a==null||a(R),R.defaultPrevented||c==null||c())},h),M=d?_===m.length-1:!1,A=fn(R=>{R.key==="Escape"&&(i==null||i(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))});return C.useEffect(()=>{if(M)return h.addEventListener("keydown",A,{capture:!0}),()=>h.removeEventListener("keydown",A,{capture:!0})},[h,M,A]),C.useEffect(()=>{if(d)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(_p=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(d)),f.layers.add(d),Bu(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(d),f.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=_p))}},[d,h,r,f]),C.useEffect(()=>()=>{d&&(f.layers.delete(d),f.layersWithOutsidePointerEventsDisabled.delete(d),Bu())},[d,f]),C.useEffect(()=>{const R=We(()=>p({}),"handleUpdate");return document.addEventListener(Vu,R),()=>document.removeEventListener(Vu,R)},[]),L.jsx(Ie.div,{...u,ref:y,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:pe(e.onFocusCapture,k.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,w.onPointerDownCapture)})},"DismissableLayer"));function D8(){const t=C.useContext(m5),[e,n]=C.useState(null);return C.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}We(D8,"useDismissableLayerSurface");var F8=We(()=>!0,"IS_TRUE");function x5(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:s=F8}=e,l=fn(t),a=C.useRef(!1),c=C.useRef(!1),u=C.useRef(new Map),f=C.useRef(()=>{});return C.useEffect(()=>{function d(){c.current=!1,o.current=!1,u.current.clear()}We(d,"resetOutsideInteraction");function g(){return Array.from(u.current.values()).some(Boolean)}We(g,"isOutsideInteractionIntercepted");function h(v){if(!c.current)return;const _=v.target;_ instanceof Node&&[...i].some(E=>E.contains(_))||u.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{c.current&&f.current()},0)}We(h,"handleInteractionCapture");function p(v){c.current&&u.current.set(v.type,!1)}We(p,"handleInteractionBubble");const y=We(v=>{if(v.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const E=g();d(),E||fd(I8,l,S,{discrete:!0})};if(We(_,"handleAndDispatchPointerDownOutsideEvent"),!s(v.target)){n.removeEventListener("click",f.current),d(),a.current=!1;return}const S={originalEvent:v};c.current=!0,o.current=r&&v.button===0,u.current.clear(),!r||v.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),d();a.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of m)n.addEventListener(v,h,!0),n.addEventListener(v,p);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",y),n.removeEventListener("click",f.current);for(const v of m)n.removeEventListener(v,h,!0),n.removeEventListener(v,p)}},[n,l,r,o,i,s]),{onPointerDownCapture:We(()=>a.current=!0,"onPointerDownCapture")}}We(x5,"usePointerDownOutside");function _5(t,e=globalThis==null?void 0:globalThis.document){const n=fn(t),r=C.useRef(!1);return C.useEffect(()=>{const o=We(i=>{i.target&&!r.current&&fd(R8,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:We(()=>r.current=!0,"onFocusCapture"),onBlurCapture:We(()=>r.current=!1,"onBlurCapture")}}We(_5,"useFocusOutside");function Bu(){const t=new CustomEvent(Vu);document.dispatchEvent(t)}We(Bu,"dispatchUpdate");function fd(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?L8(o,i):o.dispatchEvent(i)}We(fd,"handleAndDispatchCustomEvent");var js=0,tn=null;function H8(){C.useEffect(()=>{tn||(tn={start:vp(),end:vp()});const{start:t,end:e}=tn;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),js++,()=>{js===1&&(tn==null||tn.start.remove(),tn==null||tn.end.remove(),tn=null),js=Math.max(0,js-1)}},[])}function vp(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var V8=Object.defineProperty,at=(t,e)=>V8(t,"name",{value:e,configurable:!0}),Cc="focusScope.autoFocusOnMount",bc="focusScope.autoFocusOnUnmount",Cp={bubbles:!1,cancelable:!0},B8=C.forwardRef(at(function(e,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...l}=e,[a,c]=C.useState(null),u=fn(i),f=fn(s),d=C.useRef(null),g=Ze(n,c),h=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(o){let y=function(_){if(h.paused||!a)return;const S=_.target;a.contains(S)?d.current=S:Cn(d.current,{select:!0})},m=function(_){if(h.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||Cn(d.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const E of _)E.removedNodes.length>0&&Cn(a)};at(y,"handleFocusIn"),at(m,"handleFocusOut"),at(x,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",m);const v=new MutationObserver(x);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",m),v.disconnect()}}},[o,a,h.paused]),C.useEffect(()=>{if(a){bp.add(h);const y=document.activeElement;if(!a.contains(y)){const x=new CustomEvent(Cc,Cp);a.addEventListener(Cc,u),a.dispatchEvent(x),x.defaultPrevented||(v5(E5(dd(a)),{select:!0}),document.activeElement===y&&Cn(a))}return()=>{a.removeEventListener(Cc,u),setTimeout(()=>{const x=new CustomEvent(bc,Cp);a.addEventListener(bc,f),a.dispatchEvent(x),x.defaultPrevented||Cn(y??document.body,{select:!0}),a.removeEventListener(bc,f),bp.remove(h)},0)}}},[a,u,f,h]);const p=C.useCallback(y=>{if(!r&&!o||h.paused)return;const m=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,x=document.activeElement;if(m&&x){const v=y.currentTarget,[_,S]=C5(v);_&&S?!y.shiftKey&&x===S?(y.preventDefault(),r&&Cn(_,{select:!0})):y.shiftKey&&x===_&&(y.preventDefault(),r&&Cn(S,{select:!0})):x===v&&y.preventDefault()}},[r,o,h.paused]);return L.jsx(Ie.div,{tabIndex:-1,...l,ref:g,onKeyDown:p})},"FocusScope"));function v5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Cn(r,{select:e}),document.activeElement!==n)return}at(v5,"focusFirst");function C5(t){const e=dd(t),n=ju(e,t),r=ju(e.reverse(),t);return[n,r]}at(C5,"getTabbableEdges");function dd(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:at(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}at(dd,"getTabbableCandidates");function ju(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):b5(r,{upTo:e})))return r}at(ju,"findVisible");function b5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}at(b5,"isHidden");function w5(t){return t instanceof HTMLInputElement&&"select"in t}at(w5,"isSelectableInput");function Cn(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&w5(t)&&e&&t.select()}}at(Cn,"focus");var bp=S5();function S5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Wu(t,e),t.unshift(e)},remove(e){var n;t=Wu(t,e),(n=t[0])==null||n.resume()}}}at(S5,"createFocusScopesStack");function Wu(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}at(Wu,"arrayRemove");function E5(t){return t.filter(e=>e.tagName!=="A")}at(E5,"removeLinks");var et=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{},j8=qo[" useId ".trim().toString()]||(()=>{}),W8=0;function Na(t){const[e,n]=C.useState(j8());return et(()=>{n(r=>r??String(W8++))},[t]),e?`radix-${e}`:""}const z8=["top","right","bottom","left"],lr=Math.min,An=Math.max,ql=Math.round,Ws=Math.floor,Pn=t=>({x:t,y:t}),K8={left:"right",right:"left",bottom:"top",top:"bottom"};function T5(t,e,n){return An(t,lr(e,n))}function Hn(t,e){return typeof t=="function"?t(e):t}function ar(t){return t.split("-")[0]}function si(t){return t.split("-")[1]}function hd(t){return t==="x"?"y":"x"}function gd(t){return t==="y"?"height":"width"}function sn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function pd(t){return hd(sn(t))}function J8(t,e,n){n===void 0&&(n=!1);const r=si(t),o=pd(t),i=gd(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Yl(s)),[s,Yl(s)]}function U8(t){const e=Yl(t);return[zu(t),e,zu(e)]}function zu(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const wp=["left","right"],Sp=["right","left"],G8=["top","bottom"],Z8=["bottom","top"];function q8(t,e,n){switch(t){case"top":case"bottom":return n?e?Sp:wp:e?wp:Sp;case"left":case"right":return e?G8:Z8;default:return[]}}function Y8(t,e,n,r){const o=si(t);let i=q8(ar(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(zu)))),i}function Yl(t){const e=ar(t);return K8[e]+t.slice(e.length)}function X8(t){var e,n,r,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(o=t.left)!=null?o:0}}function k5(t){return typeof t!="number"?X8(t):{top:t,right:t,bottom:t,left:t}}function Xl(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function Ep(t,e,n){let{reference:r,floating:o}=t;const i=sn(e),s=pd(e),l=gd(s),a=ar(e),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[l]/2-o[l]/2;let g;switch(a){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}const h=si(e);return h&&(g[s]+=d*(h==="end"?1:-1)*(n&&c?-1:1)),g}async function Q8(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:g=0}=Hn(e,t),h=k5(g),y=l[d?f==="floating"?"reference":"floating":f],m=Xl(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),_=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},S=Xl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:v,strategy:a}):x);return{top:(m.top-S.top+h.top)/_.y,bottom:(S.bottom-m.bottom+h.bottom)/_.y,left:(m.left-S.left+h.left)/_.x,right:(S.right-m.right+h.right)/_.x}}const eS=50,tS=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:Q8},a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:f}=Ep(c,r,a),d=r,g=0;const h={};for(let p=0;p({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Hn(t,e)||{};if(c==null)return{};const f=k5(u),d={x:n,y:r},g=pd(o),h=gd(g),p=await s.getDimensions(c),y=g==="y",m=y?"top":"left",x=y?"bottom":"right",v=y?"clientHeight":"clientWidth",_=i.reference[h]+i.reference[g]-d[g]-i.floating[h],S=d[g]-i.reference[g],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let b=E?E[v]:0;(!b||!await(s.isElement==null?void 0:s.isElement(E)))&&(b=l.floating[v]||i.floating[h]);const w=_/2-S/2,k=b/2-p[h]/2-1,M=lr(f[m],k),A=lr(f[x],k),R=b-p[h]-A,F=b/2-p[h]/2+w,H=T5(M,F,R),W=!a.arrow&&si(o)!=null&&F!==H&&i.reference[h]/2-(FH<=0)){var A,R;const H=(((A=i.flip)==null?void 0:A.index)||0)+1,W=b[H];if(W&&(!(f==="alignment"?x!==sn(W):!1)||M.every(K=>sn(K.placement)===x?K.overflows[0]>0:!0)))return{data:{index:H,overflows:M},reset:{placement:W}};let z=(R=M.filter(B=>B.overflows[0]<=0).sort((B,K)=>B.overflows[1]-K.overflows[1])[0])==null?void 0:R.placement;if(!z)switch(g){case"bestFit":{var F;const B=(F=M.filter(K=>{if(E){const J=sn(K.placement);return J===x||J==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(J=>J>0).reduce((J,X)=>J+X,0)]).sort((K,J)=>K[1]-J[1])[0])==null?void 0:F[0];B&&(z=B);break}case"initialPlacement":z=l;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Tp(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function kp(t){return z8.some(e=>t[e]>=0)}const oS=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...i}=Hn(t,e);switch(o){case"referenceHidden":{const s=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=Tp(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:kp(l)}}}case"escaped":{const s=await r.detectOverflow(e,{...i,altBoundary:!0}),l=Tp(s,n.floating);return{data:{escapedOffsets:l,escaped:kp(l)}}}default:return{}}}}},N5=new Set(["left","top"]);async function iS(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=ar(n),l=si(n),a=sn(n)==="y",c=N5.has(s)?-1:1,u=i&&a?-1:1,f=Hn(e,t);let{mainAxis:d,crossAxis:g,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof h=="number"&&(g=l==="end"?h*-1:h),a?{x:g*u,y:d*c}:{x:d*c,y:g*u}}const sS=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await iS(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},lS=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:x=>{let{x:v,y:_}=x;return{x:v,y:_}}},...c}=Hn(t,e),u={x:n,y:r},f=await i.detectOverflow(e,c),d=sn(o),g=hd(d);let h=u[g],p=u[d];const y=(x,v)=>T5(v+f[x==="y"?"top":"left"],v,v-f[x==="y"?"bottom":"right"]);s&&(h=y(g,h)),l&&(p=y(d,p));const m=a.fn({...e,[g]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[g]:s,[d]:l}}}}}},aS=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:o,y:i,placement:s,rects:l,middlewareData:a}=e,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=Hn(t,e),d={x:o,y:i},g=sn(s),h=hd(g);let p=d[h],y=d[g];const m=Hn(c,e),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:(n=m.mainAxis)!=null?n:0,crossAxis:(r=m.crossAxis)!=null?r:0};if(u){const S=h==="y"?"height":"width",E=l.reference[h]-l.floating[S]+x.mainAxis,b=l.reference[h]+l.reference[S]-x.mainAxis;pb&&(p=b)}if(f){var v,_;const S=h==="y"?"width":"height",E=N5.has(ar(s)),b=l.reference[g]-l.floating[S]+(E&&((v=a.offset)==null?void 0:v[g])||0)+(E?0:x.crossAxis),w=l.reference[g]+l.reference[S]+(E?0:((_=a.offset)==null?void 0:_[g])||0)-(E?x.crossAxis:0);yw&&(y=w)}return{[h]:p,[g]:y}}}},cS=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:o,elements:i}=e,{apply:s=()=>{},...l}=Hn(t,e),a=await o.detectOverflow(e,l),c=ar(n),u=si(n),f=sn(n)==="y",{width:d,height:g}=r.floating;let h,p;c==="top"||c==="bottom"?(h=c,p=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(p=c,h=u==="end"?"top":"bottom");const y=g-a.top-a.bottom,m=d-a.left-a.right,x=lr(g-a[h],y),v=lr(d-a[p],m),_=e.middlewareData.shift,S=!_;let E=x,b=v;_!=null&&_.enabled.x&&(b=m),_!=null&&_.enabled.y&&(E=y),S&&!u&&(f?b=d-2*An(a.left,a.right):E=g-2*An(a.top,a.bottom)),await s({...e,availableWidth:b,availableHeight:E});const w=await o.getDimensions(i.floating);return d!==w.width||g!==w.height?{reset:{rects:!0}}:{}}}};function Ma(){return typeof window<"u"}function li(t){return M5(t)?(t.nodeName||"").toLowerCase():"#document"}function xt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zn(t){var e;return(e=(M5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function M5(t){return Ma()?t instanceof Node||t instanceof xt(t).Node:!1}function dn(t){return Ma()?t instanceof Element||t instanceof xt(t).Element:!1}function mr(t){return Ma()?t instanceof HTMLElement||t instanceof xt(t).HTMLElement:!1}function Np(t){return!Ma()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xt(t).ShadowRoot}function Oa(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=hn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function uS(t){return/^(table|td|th)$/.test(li(t))}function Aa(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const fS=/transform|translate|scale|rotate|perspective|filter/,dS=/paint|layout|strict|content/,Sr=t=>!!t&&t!=="none";let wc;function md(t){const e=dn(t)?hn(t):t;return Sr(e.transform)||Sr(e.translate)||Sr(e.scale)||Sr(e.rotate)||Sr(e.perspective)||!yd()&&(Sr(e.backdropFilter)||Sr(e.filter))||fS.test(e.willChange||"")||dS.test(e.contain||"")}function hS(t){let e=Gr(t);for(;mr(e)&&!os(e);){if(md(e))return e;if(Aa(e))return null;e=Gr(e)}return null}function yd(){return wc==null&&(wc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),wc}function os(t){return/^(html|body|#document)$/.test(li(t))}function hn(t){return xt(t).getComputedStyle(t)}function Pa(t){return dn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Gr(t){if(li(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Np(t)&&t.host||zn(t);return Np(e)?e.host:e}function O5(t){const e=Gr(t);return os(e)?(t.ownerDocument||t).body:mr(e)&&Oa(e)?e:O5(e)}function is(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=O5(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=xt(o);if(i){const l=Ku(s);return e.concat(s,s.visualViewport||[],Oa(o)?o:[],l&&n?is(l):[])}else return e.concat(o,is(o,[],n))}function Ku(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function A5(t){const e=hn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=mr(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=ql(n)!==i||ql(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function xd(t){return dn(t)?t:t.contextElement}function Vo(t){const e=xd(t);if(!mr(e))return Pn(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=A5(e);let s=(i?ql(n.width):n.width)/r,l=(i?ql(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const gS=Pn(0);function P5(t){const e=xt(t);return!yd()||!e.visualViewport?gS:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function pS(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===xt(t)}function Zr(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=xd(t);let s=Pn(1);e&&(r?dn(r)&&(s=Vo(r)):s=Vo(t));const l=pS(i,n,r)?P5(i):Pn(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i&&r){const d=xt(i),g=dn(r)?xt(r):r;let h=d,p=Ku(h);for(;p&&g!==h;){const y=Vo(p),m=p.getBoundingClientRect(),x=hn(p),v=m.left+(p.clientLeft+parseFloat(x.paddingLeft))*y.x,_=m.top+(p.clientTop+parseFloat(x.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,f*=y.y,a+=v,c+=_,h=xt(p),p=Ku(h)}}return Xl({width:u,height:f,x:a,y:c})}function La(t,e){const n=Pa(t).scrollLeft;return e?e.left+n:Zr(zn(t)).left+n}function L5(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-La(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function mS(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=zn(r),l=e?Aa(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=Pn(1);const u=Pn(0),f=mr(r);if((f||!i)&&((li(r)!=="body"||Oa(s))&&(a=Pa(r)),f)){const g=Zr(r);c=Vo(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}const d=s&&!f&&!i?L5(s,a):Pn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+d.x,y:n.y*c.y-a.scrollTop*c.y+u.y+d.y}}function yS(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function xS(t){const e=Pa(t),n=t.ownerDocument.body,r=An(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=An(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+La(t);const s=-e.scrollTop;return hn(n).direction==="rtl"&&(i+=An(t.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:s}}const _S=25;function vS(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=xt(t),i=zn(t),s=o.visualViewport;let l=i.clientWidth,a=i.clientHeight,c=0,u=0;if(s){const d=!yd()||e==="fixed";r?d||(c=-s.offsetLeft,u=-s.offsetTop):(l=s.width,a=s.height,d&&(c=s.offsetLeft,u=s.offsetTop))}if(La(i)<=0){const d=i.ownerDocument,g=d.body,h=getComputedStyle(g),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(i.clientWidth-g.clientWidth-p),m=getComputedStyle(i).scrollbarGutter==="stable both-edges"?y/2:y;m<=_S&&(l-=m)}return{width:l,height:a,x:c,y:u}}function CS(t,e){const n=Zr(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Vo(t),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function Mp(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=vS(t,n,e);else if(e==="document")r=xS(zn(t));else if(dn(e))r=CS(e,n);else{const o=P5(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Xl(r)}function bS(t,e){const n=e.get(t);if(n)return n;let r=is(t,[],!1).filter(l=>dn(l)&&li(l)!=="body"),o=null;const i=hn(t).position==="fixed";let s=i?Gr(t):t;for(;dn(s)&&!os(s);){const l=hn(s),a=md(s),c=o?o.position:i?"fixed":"";!a&&(c==="fixed"||c==="absolute"&&l.position==="static")?r=r.filter(f=>f!==s):o=l,s=Gr(s)}return e.set(t,r),r}function wS(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?Aa(e)?[]:bS(e,this._c):[].concat(n),r],l=Mp(e,s[0],o);let a=l.top,c=l.right,u=l.bottom,f=l.left;for(let d=1;d{l(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(w,{...E,root:i.ownerDocument})}catch{r=new IntersectionObserver(w,E)}r.observe(t)}const a=xt(t),c=()=>l(n);return a.addEventListener("resize",c),l(!0),()=>{a.removeEventListener("resize",c),s()}}function OS(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=xd(t),u=o||i?[...c?is(c):[],...e?is(e):[]]:[];u.forEach(m=>{o&&m.addEventListener("scroll",n),i&&m.addEventListener("resize",n)});const f=c&&l?MS(c,n,i):null;let d=-1,g=null;s&&(g=new ResizeObserver(m=>{let[x]=m;x&&x.target===c&&g&&e&&(g.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var v;(v=g)==null||v.observe(e)})),n()}),c&&!a&&g.observe(c),e&&g.observe(e));let h,p=a?Zr(t):null;a&&y();function y(){const m=Zr(t);p&&!I5(p,m)&&n(),p=m,h=requestAnimationFrame(y)}return n(),()=>{var m;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(m=g)==null||m.disconnect(),g=null,a&&cancelAnimationFrame(h)}}const AS=sS,PS=lS,LS=rS,$S=cS,IS=oS,Ap=nS,RS=aS,DS=(t,e,n)=>{const r=new Map,o=n??{},i={...NS,...o.platform,_c:r};return tS(t,e,{...o,platform:i})};var FS=typeof document<"u",HS=function(){},dl=FS?C.useLayoutEffect:HS;function Ql(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Ql(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Ql(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function R5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Pp(t,e){const n=R5(t);return Math.round(e*n)/n}function Ec(t){const e=C.useRef(t);return dl(()=>{e.current=t}),e}function VS(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,f]=C.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[d,g]=C.useState(r);Ql(d,r)||g(r);const[h,p]=C.useState(null),[y,m]=C.useState(null),x=C.useCallback(K=>{K!==E.current&&(E.current=K,p(K))},[]),v=C.useCallback(K=>{K!==b.current&&(b.current=K,m(K))},[]),_=i||h,S=s||y,E=C.useRef(null),b=C.useRef(null),w=C.useRef(u),k=a!=null,M=Ec(a),A=Ec(o),R=Ec(c),F=C.useCallback(()=>{if(!E.current||!b.current)return;const K={placement:e,strategy:n,middleware:d};A.current&&(K.platform=A.current),DS(E.current,b.current,K).then(J=>{const X={...J,isPositioned:R.current!==!1};H.current&&!Ql(w.current,X)&&(w.current=X,nr.flushSync(()=>{f(X)}))})},[d,e,n,A,R]);dl(()=>{c===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,f(K=>({...K,isPositioned:!1})))},[c]);const H=C.useRef(!1);dl(()=>(H.current=!0,()=>{H.current=!1}),[]),dl(()=>{if(_&&(E.current=_),S&&(b.current=S),_&&S){if(M.current)return M.current(_,S,F);F()}},[_,S,F,M,k]);const W=C.useMemo(()=>({reference:E,floating:b,setReference:x,setFloating:v}),[x,v]),z=C.useMemo(()=>({reference:_,floating:S}),[_,S]),B=C.useMemo(()=>{const K={position:n,left:0,top:0};if(!z.floating)return K;const J=Pp(z.floating,u.x),X=Pp(z.floating,u.y);return l?{...K,transform:"translate("+J+"px, "+X+"px)",...R5(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:X}},[n,l,z.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:F,refs:W,elements:z,floatingStyles:B}),[u,F,W,z,B])}const BS=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Ap({element:r.current,padding:o}).fn(n):{}:r?Ap({element:r,padding:o}).fn(n):{}}}},jS=(t,e)=>{const n=AS(t);return{name:n.name,fn:n.fn,options:[t,e]}},WS=(t,e)=>{const n=PS(t);return{name:n.name,fn:n.fn,options:[t,e]}},zS=(t,e)=>({fn:RS(t).fn,options:[t,e]}),KS=(t,e)=>{const n=LS(t);return{name:n.name,fn:n.fn,options:[t,e]}},JS=(t,e)=>{const n=$S(t);return{name:n.name,fn:n.fn,options:[t,e]}},US=(t,e)=>{const n=IS(t);return{name:n.name,fn:n.fn,options:[t,e]}},GS=(t,e)=>{const n=BS(t);return{name:n.name,fn:n.fn,options:[t,e]}};function ZS(t){const[e,n]=C.useState(void 0);return et(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var qS=Object.defineProperty,tr=(t,e)=>qS(t,"name",{value:e,configurable:!0}),D5="Popper",[F5,$a]=co(D5),[YS,H5]=F5(D5),XS=tr(t=>{const{__scopePopper:e,children:n}=t,[r,o]=C.useState(null),[i,s]=C.useState(void 0);return L.jsx(YS,{scope:e,anchor:r,onAnchorChange:o,placementState:i,setPlacementState:s,children:n})},"Popper"),QS="PopperAnchor",e7=C.forwardRef(tr(function(e,n){const{__scopePopper:r,virtualRef:o,...i}=e,s=H5(QS,r),l=C.useRef(null),a=s.onAnchorChange,c=C.useCallback(p=>{l.current=p,p&&a(p)},[a]),u=Ze(n,c),f=C.useRef(null);C.useEffect(()=>{if(!o)return;const p=f.current;f.current=o.current,p!==f.current&&a(f.current)});const d=s.placementState&&Ia(s.placementState),g=d==null?void 0:d[0],h=d==null?void 0:d[1];return o?null:L.jsx(Ie.div,{"data-radix-popper-side":g,"data-radix-popper-align":h,...i,ref:u})},"PopperAnchor")),V5="PopperContent",[t7,iT]=F5(V5),n7=C.forwardRef(tr(function(e,n){var se,Oe,le,ue,ge,Nt,Mt;const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:g=!1,updatePositionStrategy:h="optimized",onPlaced:p,...y}=e,m=H5(V5,r),[x,v]=C.useState(null),_=Ze(n,v),[S,E]=C.useState(null),b=ZS(S),w=(b==null?void 0:b.width)??0,k=(b==null?void 0:b.height)??0,M=o+(s!=="center"?"-"+s:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],F=R.length>0,H={padding:A,boundary:R.filter(B5),altBoundary:F},{refs:W,floatingStyles:z,placement:B,isPositioned:K,middlewareData:J}=VS({strategy:"fixed",placement:M,whileElementsMounted:tr((...en)=>OS(...en,{animationFrame:h==="always"}),"whileElementsMounted"),elements:{reference:m.anchor},middleware:[jS({mainAxis:i+k,alignmentAxis:l}),c&&WS({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?zS():void 0,...H}),c&&KS({...H}),JS({...H,apply:tr(({elements:en,rects:Kn,availableWidth:Jn,availableHeight:Ga})=>{const{width:ui,height:Es}=Kn.reference,ho=en.floating.style;ho.setProperty("--radix-popper-available-width",`${Jn}px`),ho.setProperty("--radix-popper-available-height",`${Ga}px`),ho.setProperty("--radix-popper-anchor-width",`${ui}px`),ho.setProperty("--radix-popper-anchor-height",`${Es}px`)},"apply")}),S&&GS({element:S,padding:a}),r7({arrowWidth:w,arrowHeight:k}),g&&US({strategy:"referenceHidden",...H,boundary:F?H.boundary:void 0})]}),X=m.setPlacementState;et(()=>(X(B),()=>{X(void 0)}),[B,X]);const[ie,xe]=Ia(B),de=fn(p);et(()=>{K&&(de==null||de())},[K,de]);const Ve=(se=J.arrow)==null?void 0:se.x,qe=(Oe=J.arrow)==null?void 0:Oe.y,oe=((le=J.arrow)==null?void 0:le.centerOffset)!==0,[me,G]=C.useState();return et(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),L.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:K?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(ue=J.transformOrigin)==null?void 0:ue.x,(ge=J.transformOrigin)==null?void 0:ge.y].join(" "),...((Nt=J.hide)==null?void 0:Nt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:L.jsx(t7,{scope:r,placedSide:ie,placedAlign:xe,onArrowChange:E,arrowX:Ve,arrowY:qe,shouldHideArrow:oe,children:L.jsx(Ie.div,{"data-side":ie,"data-align":xe,...y,ref:_,style:{...y.style,animation:K?(Mt=y.style)==null?void 0:Mt.animation:"none"}})})})},"PopperContent"));function B5(t){return t!==null}tr(B5,"isNotNull");var r7=tr(t=>({name:"transformOrigin",options:t,fn(e){var y,m,x;const{placement:n,rects:r,middlewareData:o}=e,s=((y=o.arrow)==null?void 0:y.centerOffset)!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=Ia(n),f={start:"0%",center:"50%",end:"100%"}[u],d=(((m=o.arrow)==null?void 0:m.x)??0)+l/2,g=(((x=o.arrow)==null?void 0:x.y)??0)+a/2;let h="",p="";return c==="bottom"?(h=s?f:`${d}px`,p=`${-a}px`):c==="top"?(h=s?f:`${d}px`,p=`${r.floating.height+a}px`):c==="right"?(h=`${-a}px`,p=s?f:`${g}px`):c==="left"&&(h=`${r.floating.width+a}px`,p=s?f:`${g}px`),{data:{x:h,y:p}}}}),"transformOrigin");function Ia(t){const[e,n="center"]=t.split("-");return[e,n]}tr(Ia,"getSideAndAlignFromPlacement");var j5=XS,W5=e7,z5=n7,o7=Object.defineProperty,i7=(t,e)=>o7(t,"name",{value:e,configurable:!0}),K5=C.forwardRef(i7(function(e,n){var a;const{container:r,...o}=e,[i,s]=C.useState(!1);et(()=>s(!0),[]);const l=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?nr.createPortal(L.jsx(Ie.div,{...o,ref:n}),l):null},"Portal")),s7=Object.defineProperty,Vn=(t,e)=>s7(t,"name",{value:e,configurable:!0});function J5(t,e){return C.useReducer((n,r)=>e[n][r]??n,t)}Vn(J5,"useStateMachine");var _d=Vn(t=>{const{present:e,children:n}=t,r=U5(e),o=typeof n=="function"?n({present:r.isPresent}):C.Children.only(n),i=G5(r.ref,Z5(o));return typeof n=="function"||r.isPresent?C.cloneElement(o,{ref:i}):null},"Presence");function U5(t){const[e,n]=C.useState(),r=C.useRef(null),o=C.useRef(t),i=C.useRef("none"),s=C.useRef(void 0),l=t?"mounted":"unmounted",[a,c]=J5(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{a==="mounted"?(i.current=s.current??wo(r.current),s.current=void 0):i.current="none"},[a]),et(()=>{const u=r.current,f=o.current;if(f!==t){const g=i.current,h=wo(u);t?(s.current=h,c("MOUNT")):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&g!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),et(()=>{if(e){let u;const f=e.ownerDocument.defaultView??window,d=Vn(h=>{const y=wo(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&y&&(c("ANIMATION_END"),!o.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",u=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},"handleAnimationEnd"),g=Vn(h=>{h.target===e&&(i.current=wo(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{f.clearTimeout(u),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:C.useCallback(u=>{if(u){const f=getComputedStyle(u);r.current=f,s.current=wo(f)}else r.current=null;n(u)},[])}}Vn(U5,"usePresence");function Ju(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Vn(Ju,"setRef");function G5(...t){const e=C.useRef(t);return e.current=t,C.useCallback(n=>{const r=e.current;let o=!1;const i=r.map(s=>{const l=Ju(s,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let s=0;s{throw new Error("Cannot call an event handler while rendering.")});return typeof $p=="function"?$p(()=>{e.current=t}):et(()=>{e.current=t}),C.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}var a7=Object.defineProperty,Cs=(t,e)=>a7(t,"name",{value:e,configurable:!0}),c7=qo[" useInsertionEffect ".trim().toString()]||et;function cr({prop:t,defaultProp:e,onChange:n=Cs(()=>{},"onChange"),caller:r}){const[o,i,s]=q5({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o,c=C.useCallback(u=>{var f;if(l){const d=Y5(u)?u(t):u;d!==t&&((f=s.current)==null||f.call(s,d))}else i(u)},[l,t,i,s]);return[a,c]}Cs(cr,"useControllableState");function q5({defaultProp:t,onChange:e}){const[n,r]=C.useState(t),o=C.useRef(n),i=C.useRef(e);return c7(()=>{i.current=e},[e]),C.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}Cs(q5,"useUncontrolledState");function Y5(t){return typeof t=="function"}Cs(Y5,"isFunction");var Ip=Symbol("RADIX:SYNC_STATE");function u7(t,e,n,r){const{prop:o,defaultProp:i,onChange:s,caller:l}=e,a=o!==void 0,c=l7(s),u=[{...n,state:i}];r&&u.push(r);const[f,d]=C.useReducer((y,m)=>{if(m.type===Ip)return{...y,state:m.state};const x=t(y,m);return a&&!Object.is(x.state,y.state)&&c(x.state),x},...u),g=f.state,h=C.useRef(g);C.useEffect(()=>{h.current!==g&&(h.current=g,a||c(g))},[g,h,a]);const p=C.useMemo(()=>o!==void 0?{...f,state:o}:f,[f,o]);return C.useEffect(()=>{a&&!Object.is(o,f.state)&&d({type:Ip,state:o})},[o,f.state,a]),[p,d]}Cs(u7,"useControllableStateReducer");var f7=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},_o=new WeakMap,zs=new WeakMap,Ks={},Tc=0,X5=function(t){return t&&(t.host||X5(t.parentNode))},d7=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=X5(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},h7=function(t,e,n,r){var o=d7(e,Array.isArray(t)?t:[t]);Ks[n]||(Ks[n]=new WeakMap);var i=Ks[n],s=[],l=new Set,a=new Set(o),c=function(f){!f||l.has(f)||(l.add(f),c(f.parentNode))};o.forEach(c);var u=function(f){!f||a.has(f)||Array.prototype.forEach.call(f.children,function(d){if(l.has(d))u(d);else try{var g=d.getAttribute(r),h=g!==null&&g!=="false",p=(_o.get(d)||0)+1,y=(i.get(d)||0)+1;_o.set(d,p),i.set(d,y),s.push(d),p===1&&h&&zs.set(d,!0),y===1&&d.setAttribute(n,"true"),h||d.setAttribute(r,"true")}catch(m){console.error("aria-hidden: cannot operate on ",d,m)}})};return u(e),l.clear(),Tc++,function(){s.forEach(function(f){var d=_o.get(f)-1,g=i.get(f)-1;_o.set(f,d),i.set(f,g),d||(zs.has(f)||f.removeAttribute(r),zs.delete(f)),g||f.removeAttribute(n)}),Tc--,Tc||(_o=new WeakMap,_o=new WeakMap,zs=new WeakMap,Ks={})}},g7=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=f7(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),h7(r,o,n,"aria-hidden")):function(){return null}},nn=function(){return nn=Object.assign||function(e){for(var n,r=1,o=arguments.length;r"u")return A7;var e=P7(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},$7=nx(),Bo="data-scroll-locked",I7=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),` - .`.concat(m7,` { +*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var i="",s=0;s{const l=V();!l||$(l)&&l.isCollapsed()||l.getNodes().length===0||(r=J0(t,l).nodes,r.length>0&&(n=$1()))},{editor:t});const i=n;if(!i||r.length===0)return"";const s={error:void 0,failed:!1};if(i.update(()=>{try{const l=Ce(),a=U0(r);let c=re();const u=()=>{c.isEmpty()||(l.append(c),c=re())};for(const f of a)f.isInline()?c.append(f):(u(),l.append(f));u(),o=gy({root:l,...e})}catch(l){s.failed=!0,s.error=l}},{discrete:!0,skipTransforms:!0}),s.failed)throw s.error;return o.replace(/\n+$/u,"")}const $w=({children:t})=>{const e=ln(pr);return N.createElement(ow,{initialEditor:e},t)},Iw=()=>{const t=oi(),e=$r(Ly),n=$r(G3),r=f=>{n(f),e(f?{current:f}:null)},[o,i,s,l,a,c,u]=Yo(Eu,Tu,By,Wy,Ky,ku,zy);return N.createElement(N.Fragment,null,l.map((f,d)=>N.createElement(f,{key:d})),N.createElement(Yy,{wrappers:a},N.createElement("div",{className:Rt(Le.rootContentEditableWrapper,"mdxeditor-root-contenteditable")},N.createElement(fw,{contentEditable:N.createElement("div",{ref:r},N.createElement(vy,{className:Rt(Le.contentEditable,o),ariaLabel:t("contentArea.editableMarkdown","editable markdown"),spellCheck:i})),placeholder:N.createElement("div",{className:Rt(Le.contentEditable,Le.placeholder,o)},N.createElement("p",null,c)),ErrorBoundary:Cy}))),s.map((f,d)=>N.createElement(f,{key:d})),u.map((f,d)=>N.createElement(f,{key:d})))},Rw={listItemIndent:"one"},Dw=t=>gw[t];function Fw(t,e,n={}){let r=e;for(const[o,i]of Object.entries(n))r=r.replaceAll(`{{${o}}}`,String(i));return r}const Yy=({wrappers:t,children:e})=>{if(t.length===0)return N.createElement(N.Fragment,null,e);const n=t[0];return N.createElement(n,null,N.createElement(Yy,{wrappers:t.slice(1)},e))},Hw=({children:t,className:e,overlayContainer:n})=>{const r=N.useRef(null),o=N.useRef(null),i=$r(rd),s=$r(U3);return N.useEffect(()=>{const l=document.createElement("div");return l.classList.add("mdxeditor-popup-container",Le.editorRoot,Le.popupContainer,...(e??"").trim().split(" ").filter(Boolean)),(n??document.body).appendChild(l),r.current=l,i(r),s(o),()=>{l.remove()}},[e,r,n,i,s]),N.createElement("div",{className:Rt("mdxeditor",Le.editorRoot,Le.editorWrapper,e),ref:o},t)};function Vw(t){return{getMarkdown:()=>{const e=t.getValue(Gl);return e==="source"||e==="diff"?t.getValue(ns):t.getValue(Jr)},setMarkdown:e=>{t.pub(od,e)},insertMarkdown:e=>{t.pub(Iy,e)},focus:(e,n)=>{var r;(r=t.getValue(pr))==null||r.focus(e,n)},getContentEditableHTML:()=>{var e;return((e=t.getValue(Ly))==null?void 0:e.current.innerHTML)??""},getSelectionMarkdown:()=>{const e=t.getValue(Gl);if(e==="source"||e==="diff")return"";const n=t.getValue(bt);if(!n)return"";const r=t.getValue(ed),o=t.getValue(td),i=t.getValue(Jl),s=t.getValue(nd),l=t.getValue(Oy);return Lw(n,{visitors:r,toMarkdownExtensions:o,toMarkdownOptions:i,jsxComponentDescriptors:s,jsxIsAvailable:l})}}}const Bw=({onReady:t,onDispose:e})=>{const n=ea(),r=N.useMemo(()=>Vw(n),[n]);return N.useLayoutEffect(()=>(t(r),()=>{e(r)}),[r,e,t]),null},jw=N.forwardRef((t,e)=>{const n=N.useRef(null),r=N.useRef(null),o=N.useRef([]),i=N.useRef(t.trim===!1?t.markdown:t.markdown.trim()),s=N.useCallback(u=>{const f=n.current;f&&r.current===null?u(f):o.current.push(u)},[]),l=N.useMemo(()=>({getMarkdown:()=>{var u;return((u=n.current)==null?void 0:u.getMarkdown())??i.current},setMarkdown:u=>{i.current=u,s(f=>{f.setMarkdown(u)})},insertMarkdown:u=>{s(f=>{f.insertMarkdown(u)})},focus:(u,f)=>{s(d=>{d.focus(u,f)})},getContentEditableHTML:()=>{var u;return((u=n.current)==null?void 0:u.getContentEditableHTML())??""},getSelectionMarkdown:()=>{var u;return((u=n.current)==null?void 0:u.getSelectionMarkdown())??""}}),[s]),a=N.useCallback(u=>{if(n.current=u,r.current===u)return;if(o.current.length===0){i.current=u.getMarkdown();return}r.current=u;const f=()=>{if(n.current!==u){r.current===u&&(r.current=null);return}const d=o.current.shift();if(!d){r.current=null,i.current=u.getMarkdown();return}d(u),queueMicrotask(f)};f()},[]),c=N.useCallback(u=>{n.current===u&&(i.current=u.getMarkdown(),n.current=null)},[]);return N.useImperativeHandle(e,()=>l,[l]),N.createElement(J2,{plugins:[rw({contentEditableClassName:t.contentEditableClassName??"",spellCheck:t.spellCheck??!0,initialMarkdown:t.markdown,onChange:t.onChange??Ho,onBlur:t.onBlur??Ho,toMarkdownOptions:t.toMarkdownOptions??Rw,autoFocus:t.autoFocus??!1,placeholder:t.placeholder??"",readOnly:!!t.readOnly,iconComponentFor:t.iconComponentFor??Dw,suppressHtmlProcessing:t.suppressHtmlProcessing??!1,onError:t.onError??Ho,translation:t.translation??Fw,trim:t.trim??!0,lexicalTheme:t.lexicalTheme,..."editorState"in t?{editorState:t.editorState}:{},suppressSharedHistory:t.suppressSharedHistory??!1,additionalLexicalNodes:t.additionalLexicalNodes??[],lexicalEditorNamespace:t.lexicalEditorNamespace??"MDXEditor"}),...t.plugins??[]]},N.createElement(Hw,{className:t.className,overlayContainer:t.overlayContainer},N.createElement($w,null,N.createElement(Iw,null))),N.createElement(Bw,{onReady:a,onDispose:c}))}),Ww=typeof window<"u"&&typeof window.document.createElement<"u",$u=Ww&&(()=>{var t;const e=(t=navigator.userAgentData)==null?void 0:t.platform;return e?/mac/i.test(e):/Mac|iPod|iPhone|iPad/.test(navigator.userAgent)})();function zw(t,e){return $u?t:e}const Kw={testLexicalNode:ba,visitLexicalNode:({lexicalNode:t,actions:e})=>{const n=parseInt(t.getTag()[1],10);e.addAndStepInto("heading",{depth:n})}},Jw={testNode:"heading",visitNode:function({mdastNode:t,actions:e}){e.addAndStepInto(Yt(`h${t.depth}`))}},Uw=["Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6"],Xy=[1,2,3,4,5,6],Gw={Digit1:1,Digit2:2,Digit3:3,Digit4:4,Digit5:5,Digit6:6},Ta=Y(Xy,t=>{t.pub(Vy,e=>e.registerCommand(uf,n=>{const{code:r,ctrlKey:o,metaKey:i,altKey:s}=n;return Uw.includes(r)&&zw(i,o)&&s?(n.preventDefault(),e.update(()=>{if(r==="Digit0")t.pub(Ul,()=>re());else{const l=t.getValue(Ta),a=Gw[r];l.includes(a)&&t.pub(Ul,()=>Yt(`h${a}`))}}),!0):!1},st))}),Zw=Xo({init(t){t.pubIn({[ld]:"headings",[ts]:Jw,[Sa]:xs,[Ea]:Kw})},update(t,e){t.pub(Ta,(e==null?void 0:e.allowedHeadingLevels)??Xy)}});function rp(t,e){return t.read("latest",()=>{const n=Se(e);return n!==null&&n.isSelected()})}function qw(t){const[e]=pn(),[n,r]=C.useState(()=>rp(e,t));return C.useEffect(()=>{let o=!0;const i=e.registerUpdateListener(()=>{o&&r(rp(e,t))});return()=>{o=!1,i()}},[e,t]),[n,C.useCallback(o=>{e.update(()=>{let i=V();be(i)||(i=Ki(),He(i)),be(i)&&(o?i.add(t):i.delete(t))})},[e,t]),C.useCallback(()=>{e.update(()=>{const o=V();be(o)&&o.clear()})},[e])]}function Yw({nodeKey:t}){const[e]=pn(),[n,r,o]=qw(t);return C.useEffect(()=>tt(e.registerCommand(af,i=>{const s=e.getElementByKey(t);return If(i)===s&&(i.shiftKey||o(),r(!n),!0)},st)),[o,e,n,t,r]),C.useEffect(()=>{const i=e.getElementByKey(t),s=e._config.theme.hrSelected??"selected";i!==null&&(n?Xt(i,s):ya(i,s))},[e,n,t]),null}class ka extends so{static getType(){return"horizontalrule"}static clone(e){return new ka(e.__key)}static importJSON(e){return cd().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Xw,priority:0})}}decorate(){return L.jsx(Yw,{nodeKey:this.__key})}}function Xw(){return{node:cd()}}function cd(){return kt(new ka)}function Zn(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function rs(t){let e=1,n=t.getParent();for(;n!=null;){if(Q(n)){const r=n.getParent();if(Z(r)){e++,n=r.getParent();continue}Zn(40)}return e}return e}function Iu(t){const e=t.getParent();Z(e)||Zn(40);let n=e,r=e;for(;r!==null;)r=r.getParent(),Z(r)&&(n=r);return n}function Qy(t){let e=[];const n=t.getChildren().filter(Q);for(let r=0;r0&&t.append(...o),e.remove()}function Qw(){const t=V();if($(t)){const e=new Set,n=t.getNodes(),r=t.anchor.getNode();if(e5(r,n))e.add(Iu(r));else for(let o=0;os.append(c));const l=lt(t),a=lt(e);l.append(a),Ur(a,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(l),n.replace(t)}}}function t8(t=!1){const e=V();if(!$(e)||!e.isCollapsed())return!1;const n=e.anchor.getNode();let r=null;if(Q(n)&&n.getChildrenSize()===0)r=n;else if(D(n)){const c=n.getParent();Q(c)&&c.getChildren().every(u=>D(u)&&u.getTextContent().trim()==="")&&(r=c)}if(r===null)return!1;const o=Iu(r),i=r.getParent();Z(i)||Zn(40);const s=i.getParent();let l;if(ve(s))l=re(),o.insertAfter(l);else{if(!Q(s))return!1;l=lt(s),s.insertAfter(l)}l.setTextStyle(e.style).setTextFormat(e.format).select();const a=r.getNextSiblings();if(a.length>0){const c=t?function(f,d){return f.getStart()+d.getIndexWithinParent()}(i,r):1,u=lt(i).setStart(c);if(Q(l)){const f=lt(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...a)}return function(c){let u=c;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!Q(f)&&!Z(f))break;u=f}u.remove()}(r),!0}let jn=class extends ft{constructor(n=1,r=void 0,o){super(o);P(this,"__value");P(this,"__checked");this.__value=n===void 0?1:n,this.__checked=r}$config(){return this.config("listitem",{$transform:n=>{const r=n.getParent();if(Z(r))r.getListType()!=="check"&&n.getChecked()!=null&&n.setChecked(void 0);else if(r){const o=n.createParentElementNode();Z(o)||Zn(340);const i=[n];for(const s of["previous","next"]){i.reverse();for(const{origin:l}of fe(n,s)){if(!Q(l))break;i.push(l)}}n.insertBefore(o),o.splice(0,0,i),ve(r)||(Wf(o,oo(fe(o,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),r.isEmpty()&&r.isAttached()&&r.remove())}},extends:ft,importDOM:{li:()=>({conversion:n8,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__value=n.__value,this.__checked=n.__checked}createDOM(n){const r=Te().createElement("li");return this.updateListItemDOM(null,r,n),r}updateListItemDOM(n,r,o){(function(l,a){const c=a.getParent();!Z(c)||c.getListType()!=="check"||Z(a.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),l.setAttribute("aria-checked",a.getChecked()?"true":"false"))})(r,this),r.value=this.__value,function(l,a,c){const u=a.list;if(!u)return;const f=u.listitem,d=u.nested&&u.nested.listitem,g=c.getParent(),h=Z(g)&&g.getListType()==="check",p=c.getChecked(),y=c.getChildren().some(v=>Z(v)),m=[];u.listitemChecked!==void 0&&m.push(u.listitemChecked),u.listitemUnchecked!==void 0&&m.push(u.listitemUnchecked),d!==void 0&&m.push(...Nn(d)),m.length>0&&ya(l,...m);const x=[];if(f!==void 0&&x.push(...Nn(f)),h){const v=p?u.listitemChecked:u.listitemUnchecked;v!==void 0&&x.push(v)}d!==void 0&&y&&x.push(...Nn(d)),x.length>0&&Xt(l,...x)}(r,o.theme,this);const i=n?n.__style:"",s=this.__style;i!==s&&$o(r.style,s,i),function(l,a,c){const u=a.__textStyle,f=c?c.__textStyle:"";if(c!==null&&f===u)return;const d=Tl(u);for(const g in d)l.style.setProperty(`--listitem-marker-${g}`,d[g]);if(f!=="")for(const g in Tl(f))g in d||l.style.removeProperty(`--listitem-marker-${g}`)}(r,this,n)}updateDOM(n,r,o){const i=r;return this.updateListItemDOM(n,i,o),!1}updateFromJSON(n){return super.updateFromJSON(n).setValue(n.value).setChecked(n.checked)}exportDOM(n){const r=this.createDOM(n._config),o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();return i&&(r.dir=i),At(this)?{after(s){if(q(s)){const l=s.previousElementSibling;if(q(l)&&l.nodeName==="LI"){for(;s.firstChild;)l.append(s.firstChild);s.remove()}}return s},element:r}:{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...n){for(let r=0;rs.append(l)),n.insertAfter(s,r)}return n}remove(n){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(n),r&&o&&At(r)&&At(o)&&(ud(r.getFirstChild(),o.getFirstChild()),o.remove())}resetOnCopyNodeFrom(n){super.resetOnCopyNodeFrom(n),n.getChecked()&&this.setChecked(!1)}insertNewAfter(n,r=!0){const o=lt(this);return this.insertAfter(o,r),o}collapseAtStart(n){if(At(this))return!1;const r=this.getParentOrThrow();if(Q(r.getParentOrThrow()))return ip(this),!0;const o=re().append(...this.getChildren()),i=this.getNextSiblings();if(i.length>0){const s=lt(r);s.append(...i),r.insertAfter(s)}return r.insertAfter(o),this.remove(),r.getChildrenSize()===0&&r.remove(),o.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(n){const r=this.getWritable();return r.__value=n,r}getChecked(){const n=this.getLatest();let r;const o=this.getParent();return Z(o)&&(r=o.getListType()),r==="check"?!!n.__checked:void 0}setChecked(n){const r=this.getWritable();return r.__checked=n,r}toggleChecked(){const n=this.getWritable();return n.setChecked(!n.__checked)}getIndent(){const n=this.getParent();if(n===null||!this.isAttached())return this.getLatest().__indent;let r=n.getParentOrThrow(),o=0;for(;Q(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(n){typeof n!="number"&&Zn(117),(n=Math.floor(n))>=0||Zn(199);let r=this.getIndent();for(;r!==n;)r0&&r.children[0].tagName==="INPUT")return sp(r.children[0])}const e=t.getAttribute("aria-checked"),n=Bt(e==="true"||e!=="false"&&void 0);return gn(n,t),{after:n5.bind(null,n),node:Wt(n,t)}}function sp(t){if(t.getAttribute("type")!=="checkbox")return{node:null};const e=Bt(t.hasAttribute("checked"));return{after:n5.bind(null,e),node:e}}function n5(t,e){const n=e[0];return e.length===1&&Qo(n)&&!t.getFormatType()&&n.getFormatType()?(t.setFormat(n.getFormatType()),n.getChildren()):e}function Bt(t){return kt(new jn(void 0,t))}function Q(t){return t instanceof jn}let Wn=class extends ft{constructor(n="number",r=1,o){super(o);P(this,"__tag");P(this,"__start");P(this,"__listType");const i=r8[n]||n;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:n=>{(function(r){const o=r.getNextSibling();Z(o)&&r.getListType()===o.getListType()&&ud(r,o)})(n),t5(n)},extends:ft,importDOM:{ol:()=>({conversion:ap,priority:0}),ul:()=>({conversion:ap,priority:0})}})}afterCloneFrom(n){super.afterCloneFrom(n),this.__listType=n.__listType,this.__tag=n.__tag,this.__start=n.__start}getTag(){return this.getLatest().__tag}setListType(n){const r=this.getWritable();return r.__listType=n,r.__tag=n==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(n){const r=this.getWritable();return r.__start=n,r}createDOM(n,r){const o=this.__tag,i=Te().createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,lp(i,n.theme,this),i}updateDOM(n,r,o){return n.__tag!==this.__tag||n.__listType!==this.__listType||(lp(r,o.theme,this),n.__start!==this.__start&&r.setAttribute("start",String(this.__start)),!1)}updateFromJSON(n){return super.updateFromJSON(n).setListType(n.listType).setStart(n.start)}exportDOM(n){const r=this.createDOM(n._config,n);return q(r)&&(this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check")),{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(n,r,o){let i=o;for(let s=0;s1?r.push(...h):o.push(...h)}}o.length>0&&ya(t,...o),r.length>0&&Xt(t,...r)}function ap(t){let e;if(function(n){return q(n)&&n.nodeName.toLowerCase()==="ol"}(t)){const n=t.start;e=Dt("number",n)}else e=function(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list")||n.getAttribute("data-is-checklist")==="1")return!0;for(const r of n.childNodes)if(q(r)&&r.hasAttribute("aria-checked"))return!0;return!1}(t)?Dt("check"):Dt("bullet");return Wt(e,t),{after:n=>function(r,o){const i=o.createListItemNode.bind(o),s=[];for(let l=0;l1&&c.forEach(u=>{Z(u)&&s.push(i().append(u))})}else s.push(i().append(a))}return s}(n,e),node:e}}const r8={ol:"number",ul:"bullet"};function Dt(t="number",e=1){return kt(new Wn(t,e))}function Z(t){return t instanceof Wn}const r5=U("INSERT_CHECK_LIST_COMMAND");function o8(t,e){const n=e&&e.disableTakeFocusOnClick||!1,r=typeof n=="boolean"?()=>n:n.peek.bind(n),o=c=>{const u=c.target;if(!q(u))return!1;const f=u.__lexicalCheckListLastHandled;return f!==void 0&&c.timeStamp-f<500},i=c=>{const u=c.target;q(u)&&(u.__lexicalCheckListLastHandled=c.timeStamp)},s=c=>{o(c)||(i(c),cp(c,r()))},l=c=>{c.pointerType==="touch"&&(o(c)||(i(c),cp(c,r())))},a=c=>{(function(u,f){o5(u,()=>{u.preventDefault(),f&&u.stopPropagation()})})(c,r())};return tt(t.registerCommand(r5,()=>(Ru("check"),!0),st),t.registerCommand(hf,c=>up(c,t,!1),st),t.registerCommand(df,c=>up(c,t,!0),st),t.registerCommand(mf,()=>{if(Du(t)!=null){const c=t.getRootElement();return c!=null&&c.focus(),!0}return!1},st),t.registerCommand(gf,c=>{const u=Du(t);return!(u==null||!t.isEditable())&&(t.update(()=>{const f=un(u);Q(f)&&(c.preventDefault(),f.toggleChecked())}),!0)},st),t.registerCommand(ff,c=>t.read("latest",()=>{const u=V();if($(u)&&u.isCollapsed()){const{anchor:f}=u,d=f.type==="element";if(d||f.offset===0){const g=f.getNode(),h=Ne(g,p=>O(p)&&!p.isInline());if(Q(h)){const p=h.getParent();if(Z(p)&&p.getListType()==="check"&&(d||h.getFirstDescendant()===g)){const y=t.getElementByKey(h.__key);if(y!=null&&Ui(y)!==y)return y.focus(),c.preventDefault(),!0}}}}return!1}),st),t.registerRootListener(c=>{if(c!==null)return tt(rg(c,{click:s,pointerup:l}),rg(c,{mousedown:a,pointerdown:a},{capture:!0}),vf(c,"touchstart",a,{capture:!0,passive:!1}))}))}function o5(t,e){const n=t.target;if(!q(n))return;const r=n.firstChild;if(q(r)&&(r.tagName==="UL"||r.tagName==="OL"))return;const o=n.parentNode;if(!o||o.__lexicalListType!=="check")return;let i=null,s=null;if("clientX"in t)i=t.clientX;else if("touches"in t){const g=t.touches;g.length>0&&(i=g[0].clientX,s="touch")}if(i==null)return;const l=n.getBoundingClientRect(),a=i/Xv(n),c=n.ownerDocument.defaultView,u=c?c.getComputedStyle(n,"::before"):{width:"0px"},f=parseFloat(u.width),d=s==="touch"||"pointerType"in t&&t.pointerType==="touch"?32:0;(n.dir==="rtl"?al.right-f-d:a>l.left-d&&a{if(q(t.target)){const n=t.target,r=Pr(n);r!=null&&r.isEditable()&&r.update(()=>{const o=un(n);Q(o)&&(e?(In(El),In(c1)):n.focus(),o.toggleChecked())})}})}function Du(t){const e=t.getRootElement(),n=e?Ui(e):null;return q(n)&&n.tagName==="LI"&&n.parentNode!=null&&n.parentNode.__lexicalListType==="check"?n:null}function up(t,e,n){const r=Du(e);return r!=null&&e.update(()=>{const o=un(r);if(!Q(o))return;const i=function(s,l){let a=l?s.getPreviousSibling():s.getNextSibling(),c=s;for(;a==null&&Q(c);)c=c.getParentOrThrow().getParent(),c!=null&&(a=l?c.getPreviousSibling():c.getNextSibling());for(;Q(a);){const u=l?a.getLastChild():a.getFirstChild();if(!Z(u))return a;a=l?u.getLastChild():u.getFirstChild()}return null}(o,n);if(i!=null){i.selectStart();const s=e.getElementByKey(i.__key);s!=null&&(t.preventDefault(),setTimeout(()=>{s.focus()},0))}}),!1}function i8(t){const e=[];for(const n of t)if(Q(n)){e.push(n);const r=n.getChildren();if(r.length>1)for(const o of r)Z(o)&&e.push(Bt().append(o))}else e.push(Bt().append(n));return e}const s8={$import:(t,e)=>{let n;var r;return L0(e,"ol")?n=Dt("number",e.start):n=(r=e).matches('[__lexicallisttype="check"], .contains-task-list, [data-is-checklist="1"]')||r.querySelector(":scope > [aria-checked]")!==null?Dt("check"):Dt("bullet"),Wt(n,e),[n.splice(0,0,R0(i8(t.$importChildren(e)),e))]},match:Ge.tag("ol","ul"),name:"@lexical/list/list"};function i5(t,e){if(e.length!==1)return e;const n=e[0];return Qo(n)&&!t.getFormatType()&&n.getFormatType()?(t.setFormat(n.getFormatType()),n.getChildren()):e}function s5(t){const e=s=>Zf(s)&&!Z(s);if(!t.some(e))return t;const n=[];let r=[];const o=()=>{r.length>0&&(n.push(r),r=[])};for(const s of t)e(s)?(o(),n.push(O(s)?s.getChildren():[s])):r.push(s);o();const i=[];for(const s of n)i.length>0&&i.push(_t()),i.push(...s);return i}const l8={$import:(t,e)=>{const n=e.getAttribute("aria-checked"),r=Bt(n==="true"||n!=="false"&&void 0);return gn(r,e),Wt(r,e),[r.splice(0,0,s5(i5(r,t.$importChildren(e))))]},match:Ge.tag("li"),name:"@lexical/list/li"};function fp(t,e,n){const r=L0(n,"input")?n:n.querySelector('input[type="checkbox"]');if(!r||r.getAttribute("type")!=="checkbox")return[];const o=Bt(r.hasAttribute("checked"));return gn(o,e),Wt(o,e),[o.splice(0,0,s5(i5(o,t.$importChildren(e))))]}Ge.tag("li").classAll("task-list-item"),Ge.tag("li").classAll("joplin-checkbox");const a8=U("UPDATE_LIST_START_COMMAND"),l5=U("INSERT_UNORDERED_LIST_COMMAND"),a5=U("INSERT_ORDERED_LIST_COMMAND"),c5=U("REMOVE_LIST_COMMAND");function dp(t,e){return tt(t.registerCommand(a5,()=>(Ru("number"),!0),st),t.registerCommand(a8,n=>{const{listNodeKey:r,newStart:o}=n,i=Se(r);return!!Z(i)&&(i.getListType()==="number"&&(i.setStart(o),t5(i)),!0)},st),t.registerCommand(l5,()=>(Ru("bullet"),!0),st),t.registerCommand(c5,()=>(Qw(),!0),st),t.registerCommand(Hi,()=>t8(!!(e&&e.restoreNumbering)),st),t.registerCommand(pf,n=>{if(function(){const s=V();if(!$(s)||!s.isCollapsed()||s.anchor.offset!==0)return!1;const l=s.anchor.getNode(),a=Ne(l,Q);if(!Q(a))return!1;const c=a.getFirstDescendant();if(c===null||!a.is(l)&&!c.is(l))return!1;const u=a.getParent();if(!Z(u)||!a.is(u.getFirstChild()))return!1;const f=u.getPreviousSibling();if(!te(f)||f.isIsolated()||!f.isKeyboardSelectable()&&f.isInline())return!1;const d=re().append(...a.getChildren());return u.insertBefore(d),a.remove(),u.isEmpty()&&u.remove(),d.selectStart(),!0}())return n.preventDefault(),!0;const r=V();if(!$(r)||!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;let i=o.getNode();for(;!Q(i);){if(i.getPreviousSibling()!==null)return!1;const s=i.getParent();if(s===null)return!1;i=s}return!(!Q(i)||!i.collapseAtStart(r))&&(n.preventDefault(),!0)},rv),t.registerNodeTransform(jn,n=>{const r=n.getFirstChild();if(r){if(D(r)){const o=r.getStyle(),i=r.getFormat();n.getTextStyle()!==o&&n.setTextStyle(o),n.getTextFormat()!==i&&n.setTextFormat(i)}}else{const o=V();$(o)&&(o.style!==n.getTextStyle()||o.format!==n.getTextFormat())&&o.isCollapsed()&&n.is(o.anchor.getNode())&&n.setTextStyle(o.style).setTextFormat(o.format)}}),t.registerNodeTransform(Qt,n=>{const r=n.getParent();if(Q(r)&&n.is(r.getFirstChild())){const o=n.getStyle(),i=n.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function c8(t){const e=n=>{const r=n.getParent();if(Z(n.getFirstChild())||!Z(r))return;const o=Ne(n,i=>Q(i)&&Z(i.getParent())&&Q(i.getPreviousSibling()));if(o===null&&n.getIndent()>0)n.setIndent(0);else if(Q(o)){const i=o.getPreviousSibling();if(Q(i)){const s=function(a){let c=a,u=c.getFirstChild();for(;Z(u);){const f=u.getLastChild();if(!Q(f))break;c=f,u=c.getFirstChild()}return c}(i),l=s.getParent();if(Z(l)){const a=rs(l);a+1{const r=[n];for(;r.length>0;){const o=r.shift();if(Z(o)){for(const i of o.getChildren())if(Q(i)){e(i);const s=i.getFirstChild();Z(s)&&r.push(s)}}}})}const u8={testNode:"list",visitNode:function({mdastNode:t,lexicalParent:e,actions:n}){const r=t.children.some(i=>typeof i.checked=="boolean")?"check":t.ordered?"number":"bullet",o=Dt(r);if(Q(e)){const i=Bt();i.append(o),e.insertAfter(i)}else e.append(o);n.visitChildren(t,o)}},f8={testNode:"listItem",visitNode({mdastNode:t,actions:e,lexicalParent:n}){const r=n.getListType()==="check"?t.checked??!1:void 0;e.addAndStepInto(Bt(r))}},d8={testLexicalNode:Z,visitLexicalNode:({lexicalNode:t,actions:e})=>{e.addAndStepInto("list",{ordered:t.getListType()==="number",spread:!1})}},h8={testLexicalNode:Q,visitLexicalNode:({lexicalNode:t,mdastParent:e,actions:n})=>{const r=t.getChildren(),o=r[0];if(r.length===1&&Z(o)){const i=e.children.at(-1);i?n.visitChildren(t,i):n.visitChildren(o,e)}else{const i=t.getParent(),s=n.appendToParent(e,{type:"listItem",checked:i.getListType()==="check"?!!t.getChecked():void 0,spread:!1,children:[]});let l=null;for(const a of t.getChildren())D(a)||rt(a)||a.isInline()&&(O(a)||te(a))?(l??(l=n.appendToParent(s,{type:"paragraph",children:[]})),n.visit(a,l)):(l=null,n.visit(a,s))}}};function hp({maxIndent:t,$canIndent:e}){const[n]=pn();return C.useEffect(()=>yC(n,t,e),[n,t,e]),null}function gp({disableTakeFocusOnClick:t=!1}){const[e]=pn();return C.useEffect(()=>o8(e,{disableTakeFocusOnClick:t}),[e,t]),null}function pp({hasStrictIndent:t=!1,shouldPreserveNumbering:e=!1}){const[n]=pn();return C.useEffect(()=>{if(!n.hasNodes([Wn,jn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[n]),C.useEffect(()=>tt(dp(n,{restoreNumbering:e}),t?c8(n):()=>{}),[n,t,e]),function(r){C.useEffect(()=>dp(r),[r])}(n),null}const g8=new Map([["number",a5],["bullet",l5],["check",r5],["",c5]]),Fu=Y("",t=>{t.sub(t.pipe(Qf,Ft(bt)),([e,n])=>{if(!e||!n)return;const r=e.anchor.getNode();let o=r.getKey()==="root"?r:Ne(r,l=>{const a=l.getParent();return a!==null&&ve(a)});o??(o=r.getTopLevelElementOrThrow());const i=o.getKey();if(n.getElementByKey(i)!==null)if(Z(o)){const l=h0(r,Wn),a=l?l.getListType():o.getListType();t.pub(Fu,a)}else t.pub(Fu,"")})}),u5=jt(t=>{t.sub(t.pipe(u5,Ft(bt)),([e,n])=>{n==null||n.dispatchCommand(g8.get(e),void 0)})}),p8=Xo({init(t){var e;(e=t.getValue(pr))==null||e.registerCommand(Cl,()=>!y8(7),or),t.pubIn({[ld]:"lists",[Au]:v2(),[Ou]:_2(),[ts]:[u8,f8],[Sa]:[jn,Wn],[Ea]:[d8,h8],[$y]:x2(),[jy]:[hp,pp,gp],[Jy]:[hp,pp,gp]})}});function m8(t){const e=t.getNodes();return e.length===0?new Set([t.anchor.getNode().getParentOrThrow(),t.focus.getNode().getParentOrThrow()]):new Set(e.map(n=>O(n)?n:n.getParentOrThrow()))}function y8(t){const e=V();if(!$(e))return!1;const n=m8(e);let r=0;for(const o of n)if(Z(o))r=Math.max(rs(o)+1,r);else if(Q(o)){const i=o.getParent();if((i==null?void 0:i.getChildren().length)===1){const s=i.getParent();if(Q(s)&&s.getChildren().length===1)return!1}if(!Z(i))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");r=Math.max(rs(i)+1,r)}return r<=t}var x8=Object.defineProperty,ii=(t,e)=>x8(t,"name",{value:e,configurable:!0}),f5=!!(typeof window<"u"&&window.document&&window.document.createElement);function pe(t,e,{checkForDefaultPrevented:n=!0}={}){return ii(function(o){if(t==null||t(o),n===!1||!o||!o.defaultPrevented)return e==null?void 0:e(o)},"handleEvent")}ii(pe,"composeEventHandlers");function _8(t){var e;if(!f5)throw new Error("Cannot access window outside of the DOM");return((e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)??window}ii(_8,"getOwnerWindow");function Hu(t){if(!f5)throw new Error("Cannot access document outside of the DOM");return(t==null?void 0:t.ownerDocument)??document}ii(Hu,"getOwnerDocument");function d5(t,e=!1){const{activeElement:n}=Hu(t);if(!(n!=null&&n.nodeName))return null;if(h5(n)&&n.contentDocument)return d5(n.contentDocument.body,e);if(e){const r=n.getAttribute("aria-activedescendant");if(r){const o=Hu(n).getElementById(r);if(o)return o}}return n}ii(d5,"getActiveElement");function h5(t){return t.tagName==="IFRAME"}ii(h5,"isFrame");function mp(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function v8(...t){return e=>{let n=!1;const r=t.map(o=>{const i=mp(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o{var m;const{scope:d,children:g,...h}=f,p=((m=d==null?void 0:d[t])==null?void 0:m[a])||l,y=C.useMemo(()=>h,Object.values(h));return L.jsx(p.Provider,{value:y,children:g})};c.displayName=i+"Provider";function u(f,d,g={}){var m;const{optional:h=!1}=g,p=((m=d==null?void 0:d[t])==null?void 0:m[a])||l,y=C.useContext(p);if(y)return y;if(s!==void 0)return s;if(!h)throw new Error(`\`${f}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>C.createContext(s));return function(l){const a=(l==null?void 0:l[t])||i;return C.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return o.scopeName=t,[r,C8(o,...e)]}function C8(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((l,{useScope:a,scopeName:c})=>{const f=a(i)[`__scope${c}`];return{...l,...f}},{});return C.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Zl(t){const e=C.forwardRef((n,r)=>{let{children:o,...i}=n,s=null,l=!1;const a=[];yp(o)&&typeof Bs=="function"&&(o=Bs(o._payload)),C.Children.forEach(o,d=>{var g;if(T8(d)){l=!0;const h=d;let p="child"in h.props?h.props.child:h.props.children;yp(p)&&typeof Bs=="function"&&(p=Bs(p._payload)),s=w8(h,p),a.push((g=s==null?void 0:s.props)==null?void 0:g.children)}else a.push(d)}),s?s=C.cloneElement(s,void 0,a):!l&&C.Children.count(o)===1&&C.isValidElement(o)&&(s=o);const c=s?E8(s):void 0,u=Ze(r,c);if(!s){if(o||o===0)throw new Error(l?O8(t):M8(t));return o}const f=S8(i,s.props??{});return s.type!==C.Fragment&&(f.ref=r?u:c),C.cloneElement(s,f)});return e.displayName=`${t}.Slot`,e}var g5=Symbol.for("radix.slottable");function b8(t){const e=n=>"child"in n?n.children(n.child):n.children;return e.displayName=`${t}.Slottable`,e.__radixId=g5,e}var w8=(t,e)=>{if("child"in t.props){const n=t.props.child;return C.isValidElement(n)?C.cloneElement(n,void 0,t.props.children(n.props.children)):null}return C.isValidElement(e)?e:null};function S8(t,e){const n={...e};for(const r in e){const o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function E8(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function T8(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===g5}var k8=Symbol.for("react.lazy");function yp(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===k8&&"_payload"in t&&N8(t._payload)}function N8(t){return typeof t=="object"&&t!==null&&"then"in t}var M8=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,O8=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Bs=qo[" use ".trim().toString()],A8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=A8.reduce((t,e)=>{const n=Zl(`Primitive.${e}`),r=C.forwardRef((o,i)=>{const{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),L.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function P8(t,e){t&&nr.flushSync(()=>t.dispatchEvent(e))}function fn(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}var L8=Object.defineProperty,We=(t,e)=>L8(t,"name",{value:e,configurable:!0}),Vu="dismissableLayer.update",$8="dismissableLayer.pointerDownOutside",I8="dismissableLayer.focusOutside",xp,p5=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),m5=C.forwardRef(We(function(e,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:c,...u}=e,f=C.useContext(p5),[d,g]=C.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=C.useState({}),y=Ze(n,g),m=Array.from(f.layers),[x]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=x?m.indexOf(x):-1,_=d?m.indexOf(d):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=v,b=C.useRef(!1),w=y5(R=>{s==null||s(R),a==null||a(R),R.defaultPrevented||c==null||c()},{ownerDocument:h,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:b,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:C.useCallback(R=>{if(!(R instanceof Node))return!1;const F=[...f.branches].some(H=>H.contains(R));return E&&!F},[f.branches,E])}),k=x5(R=>{if(o&&b.current)return;const F=R.target;[...f.branches].some(W=>W.contains(F))||(l==null||l(R),a==null||a(R),R.defaultPrevented||c==null||c())},h),M=d?_===m.length-1:!1,A=fn(R=>{R.key==="Escape"&&(i==null||i(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))});return C.useEffect(()=>{if(M)return h.addEventListener("keydown",A,{capture:!0}),()=>h.removeEventListener("keydown",A,{capture:!0})},[h,M,A]),C.useEffect(()=>{if(d)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(xp=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(d)),f.layers.add(d),Bu(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(d),f.layersWithOutsidePointerEventsDisabled.size===0&&(h.body.style.pointerEvents=xp))}},[d,h,r,f]),C.useEffect(()=>()=>{d&&(f.layers.delete(d),f.layersWithOutsidePointerEventsDisabled.delete(d),Bu())},[d,f]),C.useEffect(()=>{const R=We(()=>p({}),"handleUpdate");return document.addEventListener(Vu,R),()=>document.removeEventListener(Vu,R)},[]),L.jsx(Ie.div,{...u,ref:y,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:pe(e.onFocusCapture,k.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,w.onPointerDownCapture)})},"DismissableLayer"));function R8(){const t=C.useContext(p5),[e,n]=C.useState(null);return C.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}We(R8,"useDismissableLayerSurface");var D8=We(()=>!0,"IS_TRUE");function y5(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:s=D8}=e,l=fn(t),a=C.useRef(!1),c=C.useRef(!1),u=C.useRef(new Map),f=C.useRef(()=>{});return C.useEffect(()=>{function d(){c.current=!1,o.current=!1,u.current.clear()}We(d,"resetOutsideInteraction");function g(){return Array.from(u.current.values()).some(Boolean)}We(g,"isOutsideInteractionIntercepted");function h(v){if(!c.current)return;const _=v.target;_ instanceof Node&&[...i].some(E=>E.contains(_))||u.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{c.current&&f.current()},0)}We(h,"handleInteractionCapture");function p(v){c.current&&u.current.set(v.type,!1)}We(p,"handleInteractionBubble");const y=We(v=>{if(v.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const E=g();d(),E||fd($8,l,S,{discrete:!0})};if(We(_,"handleAndDispatchPointerDownOutsideEvent"),!s(v.target)){n.removeEventListener("click",f.current),d(),a.current=!1;return}const S={originalEvent:v};c.current=!0,o.current=r&&v.button===0,u.current.clear(),!r||v.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),d();a.current=!1},"handlePointerDown"),m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of m)n.addEventListener(v,h,!0),n.addEventListener(v,p);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",y),n.removeEventListener("click",f.current);for(const v of m)n.removeEventListener(v,h,!0),n.removeEventListener(v,p)}},[n,l,r,o,i,s]),{onPointerDownCapture:We(()=>a.current=!0,"onPointerDownCapture")}}We(y5,"usePointerDownOutside");function x5(t,e=globalThis==null?void 0:globalThis.document){const n=fn(t),r=C.useRef(!1);return C.useEffect(()=>{const o=We(i=>{i.target&&!r.current&&fd(I8,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:We(()=>r.current=!0,"onFocusCapture"),onBlurCapture:We(()=>r.current=!1,"onBlurCapture")}}We(x5,"useFocusOutside");function Bu(){const t=new CustomEvent(Vu);document.dispatchEvent(t)}We(Bu,"dispatchUpdate");function fd(t,e,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?P8(o,i):o.dispatchEvent(i)}We(fd,"handleAndDispatchCustomEvent");var js=0,tn=null;function F8(){C.useEffect(()=>{tn||(tn={start:_p(),end:_p()});const{start:t,end:e}=tn;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),js++,()=>{js===1&&(tn==null||tn.start.remove(),tn==null||tn.end.remove(),tn=null),js=Math.max(0,js-1)}},[])}function _p(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var H8=Object.defineProperty,at=(t,e)=>H8(t,"name",{value:e,configurable:!0}),Cc="focusScope.autoFocusOnMount",bc="focusScope.autoFocusOnUnmount",vp={bubbles:!1,cancelable:!0},V8=C.forwardRef(at(function(e,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...l}=e,[a,c]=C.useState(null),u=fn(i),f=fn(s),d=C.useRef(null),g=Ze(n,c),h=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(o){let y=function(_){if(h.paused||!a)return;const S=_.target;a.contains(S)?d.current=S:Cn(d.current,{select:!0})},m=function(_){if(h.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||Cn(d.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const E of _)E.removedNodes.length>0&&Cn(a)};at(y,"handleFocusIn"),at(m,"handleFocusOut"),at(x,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",m);const v=new MutationObserver(x);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",m),v.disconnect()}}},[o,a,h.paused]),C.useEffect(()=>{if(a){Cp.add(h);const y=document.activeElement;if(!a.contains(y)){const x=new CustomEvent(Cc,vp);a.addEventListener(Cc,u),a.dispatchEvent(x),x.defaultPrevented||(_5(S5(dd(a)),{select:!0}),document.activeElement===y&&Cn(a))}return()=>{a.removeEventListener(Cc,u),setTimeout(()=>{const x=new CustomEvent(bc,vp);a.addEventListener(bc,f),a.dispatchEvent(x),x.defaultPrevented||Cn(y??document.body,{select:!0}),a.removeEventListener(bc,f),Cp.remove(h)},0)}}},[a,u,f,h]);const p=C.useCallback(y=>{if(!r&&!o||h.paused)return;const m=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,x=document.activeElement;if(m&&x){const v=y.currentTarget,[_,S]=v5(v);_&&S?!y.shiftKey&&x===S?(y.preventDefault(),r&&Cn(_,{select:!0})):y.shiftKey&&x===_&&(y.preventDefault(),r&&Cn(S,{select:!0})):x===v&&y.preventDefault()}},[r,o,h.paused]);return L.jsx(Ie.div,{tabIndex:-1,...l,ref:g,onKeyDown:p})},"FocusScope"));function _5(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Cn(r,{select:e}),document.activeElement!==n)return}at(_5,"focusFirst");function v5(t){const e=dd(t),n=ju(e,t),r=ju(e.reverse(),t);return[n,r]}at(v5,"getTabbableEdges");function dd(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:at(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}at(dd,"getTabbableCandidates");function ju(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):C5(r,{upTo:e})))return r}at(ju,"findVisible");function C5(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}at(C5,"isHidden");function b5(t){return t instanceof HTMLInputElement&&"select"in t}at(b5,"isSelectableInput");function Cn(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&b5(t)&&e&&t.select()}}at(Cn,"focus");var Cp=w5();function w5(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Wu(t,e),t.unshift(e)},remove(e){var n;t=Wu(t,e),(n=t[0])==null||n.resume()}}}at(w5,"createFocusScopesStack");function Wu(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}at(Wu,"arrayRemove");function S5(t){return t.filter(e=>e.tagName!=="A")}at(S5,"removeLinks");var et=globalThis!=null&&globalThis.document?C.useLayoutEffect:()=>{},B8=qo[" useId ".trim().toString()]||(()=>{}),j8=0;function Na(t){const[e,n]=C.useState(B8());return et(()=>{n(r=>r??String(j8++))},[t]),e?`radix-${e}`:""}const W8=["top","right","bottom","left"],lr=Math.min,An=Math.max,ql=Math.round,Ws=Math.floor,Pn=t=>({x:t,y:t}),z8={left:"right",right:"left",bottom:"top",top:"bottom"};function E5(t,e,n){return An(t,lr(e,n))}function Hn(t,e){return typeof t=="function"?t(e):t}function ar(t){return t.split("-")[0]}function si(t){return t.split("-")[1]}function hd(t){return t==="x"?"y":"x"}function gd(t){return t==="y"?"height":"width"}function sn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function pd(t){return hd(sn(t))}function K8(t,e,n){n===void 0&&(n=!1);const r=si(t),o=pd(t),i=gd(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Yl(s)),[s,Yl(s)]}function J8(t){const e=Yl(t);return[zu(t),e,zu(e)]}function zu(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const bp=["left","right"],wp=["right","left"],U8=["top","bottom"],G8=["bottom","top"];function Z8(t,e,n){switch(t){case"top":case"bottom":return n?e?wp:bp:e?bp:wp;case"left":case"right":return e?U8:G8;default:return[]}}function q8(t,e,n,r){const o=si(t);let i=Z8(ar(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(zu)))),i}function Yl(t){const e=ar(t);return z8[e]+t.slice(e.length)}function Y8(t){var e,n,r,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(o=t.left)!=null?o:0}}function T5(t){return typeof t!="number"?Y8(t):{top:t,right:t,bottom:t,left:t}}function Xl(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function Sp(t,e,n){let{reference:r,floating:o}=t;const i=sn(e),s=pd(e),l=gd(s),a=ar(e),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[l]/2-o[l]/2;let g;switch(a){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}const h=si(e);return h&&(g[s]+=d*(h==="end"?1:-1)*(n&&c?-1:1)),g}async function X8(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:g=0}=Hn(e,t),h=T5(g),y=l[d?f==="floating"?"reference":"floating":f],m=Xl(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),_=await(i.isElement==null?void 0:i.isElement(v))&&await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1},S=Xl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:v,strategy:a}):x);return{top:(m.top-S.top+h.top)/_.y,bottom:(S.bottom-m.bottom+h.bottom)/_.y,left:(m.left-S.left+h.left)/_.x,right:(S.right-m.right+h.right)/_.x}}const Q8=50,eS=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:X8},a=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:f}=Sp(c,r,a),d=r,g=0;const h={};for(let p=0;p({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Hn(t,e)||{};if(c==null)return{};const f=T5(u),d={x:n,y:r},g=pd(o),h=gd(g),p=await s.getDimensions(c),y=g==="y",m=y?"top":"left",x=y?"bottom":"right",v=y?"clientHeight":"clientWidth",_=i.reference[h]+i.reference[g]-d[g]-i.floating[h],S=d[g]-i.reference[g],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let b=E?E[v]:0;(!b||!await(s.isElement==null?void 0:s.isElement(E)))&&(b=l.floating[v]||i.floating[h]);const w=_/2-S/2,k=b/2-p[h]/2-1,M=lr(f[m],k),A=lr(f[x],k),R=b-p[h]-A,F=b/2-p[h]/2+w,H=E5(M,F,R),W=!a.arrow&&si(o)!=null&&F!==H&&i.reference[h]/2-(FH<=0)){var A,R;const H=(((A=i.flip)==null?void 0:A.index)||0)+1,W=b[H];if(W&&(!(f==="alignment"?x!==sn(W):!1)||M.every(K=>sn(K.placement)===x?K.overflows[0]>0:!0)))return{data:{index:H,overflows:M},reset:{placement:W}};let z=(R=M.filter(B=>B.overflows[0]<=0).sort((B,K)=>B.overflows[1]-K.overflows[1])[0])==null?void 0:R.placement;if(!z)switch(g){case"bestFit":{var F;const B=(F=M.filter(K=>{if(E){const J=sn(K.placement);return J===x||J==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(J=>J>0).reduce((J,X)=>J+X,0)]).sort((K,J)=>K[1]-J[1])[0])==null?void 0:F[0];B&&(z=B);break}case"initialPlacement":z=l;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Ep(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Tp(t){return W8.some(e=>t[e]>=0)}const rS=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...i}=Hn(t,e);switch(o){case"referenceHidden":{const s=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=Ep(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Tp(l)}}}case"escaped":{const s=await r.detectOverflow(e,{...i,altBoundary:!0}),l=Ep(s,n.floating);return{data:{escapedOffsets:l,escaped:Tp(l)}}}default:return{}}}}},k5=new Set(["left","top"]);async function oS(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=ar(n),l=si(n),a=sn(n)==="y",c=k5.has(s)?-1:1,u=i&&a?-1:1,f=Hn(e,t);let{mainAxis:d,crossAxis:g,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof h=="number"&&(g=l==="end"?h*-1:h),a?{x:g*u,y:d*c}:{x:d*c,y:g*u}}const iS=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=e,a=await oS(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},sS=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:x=>{let{x:v,y:_}=x;return{x:v,y:_}}},...c}=Hn(t,e),u={x:n,y:r},f=await i.detectOverflow(e,c),d=sn(o),g=hd(d);let h=u[g],p=u[d];const y=(x,v)=>E5(v+f[x==="y"?"top":"left"],v,v-f[x==="y"?"bottom":"right"]);s&&(h=y(g,h)),l&&(p=y(d,p));const m=a.fn({...e,[g]:h,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[g]:s,[d]:l}}}}}},lS=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:o,y:i,placement:s,rects:l,middlewareData:a}=e,{offset:c=0,mainAxis:u=!0,crossAxis:f=!0}=Hn(t,e),d={x:o,y:i},g=sn(s),h=hd(g);let p=d[h],y=d[g];const m=Hn(c,e),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:(n=m.mainAxis)!=null?n:0,crossAxis:(r=m.crossAxis)!=null?r:0};if(u){const S=h==="y"?"height":"width",E=l.reference[h]-l.floating[S]+x.mainAxis,b=l.reference[h]+l.reference[S]-x.mainAxis;pb&&(p=b)}if(f){var v,_;const S=h==="y"?"width":"height",E=k5.has(ar(s)),b=l.reference[g]-l.floating[S]+(E&&((v=a.offset)==null?void 0:v[g])||0)+(E?0:x.crossAxis),w=l.reference[g]+l.reference[S]+(E?0:((_=a.offset)==null?void 0:_[g])||0)-(E?x.crossAxis:0);yw&&(y=w)}return{[h]:p,[g]:y}}}},aS=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:o,elements:i}=e,{apply:s=()=>{},...l}=Hn(t,e),a=await o.detectOverflow(e,l),c=ar(n),u=si(n),f=sn(n)==="y",{width:d,height:g}=r.floating;let h,p;c==="top"||c==="bottom"?(h=c,p=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(p=c,h=u==="end"?"top":"bottom");const y=g-a.top-a.bottom,m=d-a.left-a.right,x=lr(g-a[h],y),v=lr(d-a[p],m),_=e.middlewareData.shift,S=!_;let E=x,b=v;_!=null&&_.enabled.x&&(b=m),_!=null&&_.enabled.y&&(E=y),S&&!u&&(f?b=d-2*An(a.left,a.right):E=g-2*An(a.top,a.bottom)),await s({...e,availableWidth:b,availableHeight:E});const w=await o.getDimensions(i.floating);return d!==w.width||g!==w.height?{reset:{rects:!0}}:{}}}};function Ma(){return typeof window<"u"}function li(t){return N5(t)?(t.nodeName||"").toLowerCase():"#document"}function xt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function zn(t){var e;return(e=(N5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function N5(t){return Ma()?t instanceof Node||t instanceof xt(t).Node:!1}function dn(t){return Ma()?t instanceof Element||t instanceof xt(t).Element:!1}function mr(t){return Ma()?t instanceof HTMLElement||t instanceof xt(t).HTMLElement:!1}function kp(t){return!Ma()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xt(t).ShadowRoot}function Oa(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=hn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function cS(t){return/^(table|td|th)$/.test(li(t))}function Aa(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const uS=/transform|translate|scale|rotate|perspective|filter/,fS=/paint|layout|strict|content/,Sr=t=>!!t&&t!=="none";let wc;function md(t){const e=dn(t)?hn(t):t;return Sr(e.transform)||Sr(e.translate)||Sr(e.scale)||Sr(e.rotate)||Sr(e.perspective)||!yd()&&(Sr(e.backdropFilter)||Sr(e.filter))||uS.test(e.willChange||"")||fS.test(e.contain||"")}function dS(t){let e=Gr(t);for(;mr(e)&&!os(e);){if(md(e))return e;if(Aa(e))return null;e=Gr(e)}return null}function yd(){return wc==null&&(wc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),wc}function os(t){return/^(html|body|#document)$/.test(li(t))}function hn(t){return xt(t).getComputedStyle(t)}function Pa(t){return dn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Gr(t){if(li(t)==="html")return t;const e=t.assignedSlot||t.parentNode||kp(t)&&t.host||zn(t);return kp(e)?e.host:e}function M5(t){const e=Gr(t);return os(e)?(t.ownerDocument||t).body:mr(e)&&Oa(e)?e:M5(e)}function is(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=M5(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=xt(o);if(i){const l=Ku(s);return e.concat(s,s.visualViewport||[],Oa(o)?o:[],l&&n?is(l):[])}else return e.concat(o,is(o,[],n))}function Ku(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function O5(t){const e=hn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=mr(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=ql(n)!==i||ql(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function xd(t){return dn(t)?t:t.contextElement}function Vo(t){const e=xd(t);if(!mr(e))return Pn(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=O5(e);let s=(i?ql(n.width):n.width)/r,l=(i?ql(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const hS=Pn(0);function A5(t){const e=xt(t);return!yd()||!e.visualViewport?hS:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function gS(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===xt(t)}function Zr(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=xd(t);let s=Pn(1);e&&(r?dn(r)&&(s=Vo(r)):s=Vo(t));const l=gS(i,n,r)?A5(i):Pn(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i&&r){const d=xt(i),g=dn(r)?xt(r):r;let h=d,p=Ku(h);for(;p&&g!==h;){const y=Vo(p),m=p.getBoundingClientRect(),x=hn(p),v=m.left+(p.clientLeft+parseFloat(x.paddingLeft))*y.x,_=m.top+(p.clientTop+parseFloat(x.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,f*=y.y,a+=v,c+=_,h=xt(p),p=Ku(h)}}return Xl({width:u,height:f,x:a,y:c})}function La(t,e){const n=Pa(t).scrollLeft;return e?e.left+n:Zr(zn(t)).left+n}function P5(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-La(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function pS(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",s=zn(r),l=e?Aa(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=Pn(1);const u=Pn(0),f=mr(r);if((f||!i)&&((li(r)!=="body"||Oa(s))&&(a=Pa(r)),f)){const g=Zr(r);c=Vo(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}const d=s&&!f&&!i?P5(s,a):Pn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+d.x,y:n.y*c.y-a.scrollTop*c.y+u.y+d.y}}function mS(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function yS(t){const e=Pa(t),n=t.ownerDocument.body,r=An(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=An(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+La(t);const s=-e.scrollTop;return hn(n).direction==="rtl"&&(i+=An(t.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:s}}const xS=25;function _S(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=xt(t),i=zn(t),s=o.visualViewport;let l=i.clientWidth,a=i.clientHeight,c=0,u=0;if(s){const d=!yd()||e==="fixed";r?d||(c=-s.offsetLeft,u=-s.offsetTop):(l=s.width,a=s.height,d&&(c=s.offsetLeft,u=s.offsetTop))}if(La(i)<=0){const d=i.ownerDocument,g=d.body,h=getComputedStyle(g),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(i.clientWidth-g.clientWidth-p),m=getComputedStyle(i).scrollbarGutter==="stable both-edges"?y/2:y;m<=xS&&(l-=m)}return{width:l,height:a,x:c,y:u}}function vS(t,e){const n=Zr(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Vo(t),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function Np(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=_S(t,n,e);else if(e==="document")r=yS(zn(t));else if(dn(e))r=vS(e,n);else{const o=A5(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Xl(r)}function CS(t,e){const n=e.get(t);if(n)return n;let r=is(t,[],!1).filter(l=>dn(l)&&li(l)!=="body"),o=null;const i=hn(t).position==="fixed";let s=i?Gr(t):t;for(;dn(s)&&!os(s);){const l=hn(s),a=md(s),c=o?o.position:i?"fixed":"";!a&&(c==="fixed"||c==="absolute"&&l.position==="static")?r=r.filter(f=>f!==s):o=l,s=Gr(s)}return e.set(t,r),r}function bS(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?Aa(e)?[]:CS(e,this._c):[].concat(n),r],l=Np(e,s[0],o);let a=l.top,c=l.right,u=l.bottom,f=l.left;for(let d=1;d{l(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(w,{...E,root:i.ownerDocument})}catch{r=new IntersectionObserver(w,E)}r.observe(t)}const a=xt(t),c=()=>l(n);return a.addEventListener("resize",c),l(!0),()=>{a.removeEventListener("resize",c),s()}}function MS(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=xd(t),u=o||i?[...c?is(c):[],...e?is(e):[]]:[];u.forEach(m=>{o&&m.addEventListener("scroll",n),i&&m.addEventListener("resize",n)});const f=c&&l?NS(c,n,i):null;let d=-1,g=null;s&&(g=new ResizeObserver(m=>{let[x]=m;x&&x.target===c&&g&&e&&(g.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var v;(v=g)==null||v.observe(e)})),n()}),c&&!a&&g.observe(c),e&&g.observe(e));let h,p=a?Zr(t):null;a&&y();function y(){const m=Zr(t);p&&!$5(p,m)&&n(),p=m,h=requestAnimationFrame(y)}return n(),()=>{var m;u.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(m=g)==null||m.disconnect(),g=null,a&&cancelAnimationFrame(h)}}const OS=iS,AS=sS,PS=nS,LS=aS,$S=rS,Op=tS,IS=lS,RS=(t,e,n)=>{const r=new Map,o=n??{},i={...kS,...o.platform,_c:r};return eS(t,e,{...o,platform:i})};var DS=typeof document<"u",FS=function(){},dl=DS?C.useLayoutEffect:FS;function Ql(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Ql(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!Ql(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function I5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ap(t,e){const n=I5(t);return Math.round(e*n)/n}function Ec(t){const e=C.useRef(t);return dl(()=>{e.current=t}),e}function HS(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,f]=C.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[d,g]=C.useState(r);Ql(d,r)||g(r);const[h,p]=C.useState(null),[y,m]=C.useState(null),x=C.useCallback(K=>{K!==E.current&&(E.current=K,p(K))},[]),v=C.useCallback(K=>{K!==b.current&&(b.current=K,m(K))},[]),_=i||h,S=s||y,E=C.useRef(null),b=C.useRef(null),w=C.useRef(u),k=a!=null,M=Ec(a),A=Ec(o),R=Ec(c),F=C.useCallback(()=>{if(!E.current||!b.current)return;const K={placement:e,strategy:n,middleware:d};A.current&&(K.platform=A.current),RS(E.current,b.current,K).then(J=>{const X={...J,isPositioned:R.current!==!1};H.current&&!Ql(w.current,X)&&(w.current=X,nr.flushSync(()=>{f(X)}))})},[d,e,n,A,R]);dl(()=>{c===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,f(K=>({...K,isPositioned:!1})))},[c]);const H=C.useRef(!1);dl(()=>(H.current=!0,()=>{H.current=!1}),[]),dl(()=>{if(_&&(E.current=_),S&&(b.current=S),_&&S){if(M.current)return M.current(_,S,F);F()}},[_,S,F,M,k]);const W=C.useMemo(()=>({reference:E,floating:b,setReference:x,setFloating:v}),[x,v]),z=C.useMemo(()=>({reference:_,floating:S}),[_,S]),B=C.useMemo(()=>{const K={position:n,left:0,top:0};if(!z.floating)return K;const J=Ap(z.floating,u.x),X=Ap(z.floating,u.y);return l?{...K,transform:"translate("+J+"px, "+X+"px)",...I5(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:X}},[n,l,z.floating,u.x,u.y]);return C.useMemo(()=>({...u,update:F,refs:W,elements:z,floatingStyles:B}),[u,F,W,z,B])}const VS=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Op({element:r.current,padding:o}).fn(n):{}:r?Op({element:r,padding:o}).fn(n):{}}}},BS=(t,e)=>{const n=OS(t);return{name:n.name,fn:n.fn,options:[t,e]}},jS=(t,e)=>{const n=AS(t);return{name:n.name,fn:n.fn,options:[t,e]}},WS=(t,e)=>({fn:IS(t).fn,options:[t,e]}),zS=(t,e)=>{const n=PS(t);return{name:n.name,fn:n.fn,options:[t,e]}},KS=(t,e)=>{const n=LS(t);return{name:n.name,fn:n.fn,options:[t,e]}},JS=(t,e)=>{const n=$S(t);return{name:n.name,fn:n.fn,options:[t,e]}},US=(t,e)=>{const n=VS(t);return{name:n.name,fn:n.fn,options:[t,e]}};function GS(t){const[e,n]=C.useState(void 0);return et(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const a=i.borderBoxSize,c=Array.isArray(a)?a[0]:a;s=c.inlineSize,l=c.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var ZS=Object.defineProperty,tr=(t,e)=>ZS(t,"name",{value:e,configurable:!0}),R5="Popper",[D5,$a]=co(R5),[qS,F5]=D5(R5),YS=tr(t=>{const{__scopePopper:e,children:n}=t,[r,o]=C.useState(null),[i,s]=C.useState(void 0);return L.jsx(qS,{scope:e,anchor:r,onAnchorChange:o,placementState:i,setPlacementState:s,children:n})},"Popper"),XS="PopperAnchor",QS=C.forwardRef(tr(function(e,n){const{__scopePopper:r,virtualRef:o,...i}=e,s=F5(XS,r),l=C.useRef(null),a=s.onAnchorChange,c=C.useCallback(p=>{l.current=p,p&&a(p)},[a]),u=Ze(n,c),f=C.useRef(null);C.useEffect(()=>{if(!o)return;const p=f.current;f.current=o.current,p!==f.current&&a(f.current)});const d=s.placementState&&Ia(s.placementState),g=d==null?void 0:d[0],h=d==null?void 0:d[1];return o?null:L.jsx(Ie.div,{"data-radix-popper-side":g,"data-radix-popper-align":h,...i,ref:u})},"PopperAnchor")),H5="PopperContent",[e7,oT]=D5(H5),t7=C.forwardRef(tr(function(e,n){var se,Oe,le,ue,ge,Nt,Mt;const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:g=!1,updatePositionStrategy:h="optimized",onPlaced:p,...y}=e,m=F5(H5,r),[x,v]=C.useState(null),_=Ze(n,v),[S,E]=C.useState(null),b=GS(S),w=(b==null?void 0:b.width)??0,k=(b==null?void 0:b.height)??0,M=o+(s!=="center"?"-"+s:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],F=R.length>0,H={padding:A,boundary:R.filter(V5),altBoundary:F},{refs:W,floatingStyles:z,placement:B,isPositioned:K,middlewareData:J}=HS({strategy:"fixed",placement:M,whileElementsMounted:tr((...en)=>MS(...en,{animationFrame:h==="always"}),"whileElementsMounted"),elements:{reference:m.anchor},middleware:[BS({mainAxis:i+k,alignmentAxis:l}),c&&jS({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?WS():void 0,...H}),c&&zS({...H}),KS({...H,apply:tr(({elements:en,rects:Kn,availableWidth:Jn,availableHeight:Ga})=>{const{width:ui,height:Es}=Kn.reference,ho=en.floating.style;ho.setProperty("--radix-popper-available-width",`${Jn}px`),ho.setProperty("--radix-popper-available-height",`${Ga}px`),ho.setProperty("--radix-popper-anchor-width",`${ui}px`),ho.setProperty("--radix-popper-anchor-height",`${Es}px`)},"apply")}),S&&US({element:S,padding:a}),n7({arrowWidth:w,arrowHeight:k}),g&&JS({strategy:"referenceHidden",...H,boundary:F?H.boundary:void 0})]}),X=m.setPlacementState;et(()=>(X(B),()=>{X(void 0)}),[B,X]);const[ie,xe]=Ia(B),de=fn(p);et(()=>{K&&(de==null||de())},[K,de]);const Ve=(se=J.arrow)==null?void 0:se.x,qe=(Oe=J.arrow)==null?void 0:Oe.y,oe=((le=J.arrow)==null?void 0:le.centerOffset)!==0,[me,G]=C.useState();return et(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),L.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:K?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(ue=J.transformOrigin)==null?void 0:ue.x,(ge=J.transformOrigin)==null?void 0:ge.y].join(" "),...((Nt=J.hide)==null?void 0:Nt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:L.jsx(e7,{scope:r,placedSide:ie,placedAlign:xe,onArrowChange:E,arrowX:Ve,arrowY:qe,shouldHideArrow:oe,children:L.jsx(Ie.div,{"data-side":ie,"data-align":xe,...y,ref:_,style:{...y.style,animation:K?(Mt=y.style)==null?void 0:Mt.animation:"none"}})})})},"PopperContent"));function V5(t){return t!==null}tr(V5,"isNotNull");var n7=tr(t=>({name:"transformOrigin",options:t,fn(e){var y,m,x;const{placement:n,rects:r,middlewareData:o}=e,s=((y=o.arrow)==null?void 0:y.centerOffset)!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=Ia(n),f={start:"0%",center:"50%",end:"100%"}[u],d=(((m=o.arrow)==null?void 0:m.x)??0)+l/2,g=(((x=o.arrow)==null?void 0:x.y)??0)+a/2;let h="",p="";return c==="bottom"?(h=s?f:`${d}px`,p=`${-a}px`):c==="top"?(h=s?f:`${d}px`,p=`${r.floating.height+a}px`):c==="right"?(h=`${-a}px`,p=s?f:`${g}px`):c==="left"&&(h=`${r.floating.width+a}px`,p=s?f:`${g}px`),{data:{x:h,y:p}}}}),"transformOrigin");function Ia(t){const[e,n="center"]=t.split("-");return[e,n]}tr(Ia,"getSideAndAlignFromPlacement");var B5=YS,j5=QS,W5=t7,r7=Object.defineProperty,o7=(t,e)=>r7(t,"name",{value:e,configurable:!0}),z5=C.forwardRef(o7(function(e,n){var a;const{container:r,...o}=e,[i,s]=C.useState(!1);et(()=>s(!0),[]);const l=r||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?nr.createPortal(L.jsx(Ie.div,{...o,ref:n}),l):null},"Portal")),i7=Object.defineProperty,Vn=(t,e)=>i7(t,"name",{value:e,configurable:!0});function K5(t,e){return C.useReducer((n,r)=>e[n][r]??n,t)}Vn(K5,"useStateMachine");var _d=Vn(t=>{const{present:e,children:n}=t,r=J5(e),o=typeof n=="function"?n({present:r.isPresent}):C.Children.only(n),i=U5(r.ref,G5(o));return typeof n=="function"||r.isPresent?C.cloneElement(o,{ref:i}):null},"Presence");function J5(t){const[e,n]=C.useState(),r=C.useRef(null),o=C.useRef(t),i=C.useRef("none"),s=C.useRef(void 0),l=t?"mounted":"unmounted",[a,c]=K5(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return C.useEffect(()=>{a==="mounted"?(i.current=s.current??wo(r.current),s.current=void 0):i.current="none"},[a]),et(()=>{const u=r.current,f=o.current;if(f!==t){const g=i.current,h=wo(u);t?(s.current=h,c("MOUNT")):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&g!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),et(()=>{if(e){let u;const f=e.ownerDocument.defaultView??window,d=Vn(h=>{const y=wo(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&y&&(c("ANIMATION_END"),!o.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",u=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},"handleAnimationEnd"),g=Vn(h=>{h.target===e&&(i.current=wo(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{f.clearTimeout(u),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:C.useCallback(u=>{if(u){const f=getComputedStyle(u);r.current=f,s.current=wo(f)}else r.current=null;n(u)},[])}}Vn(J5,"usePresence");function Ju(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Vn(Ju,"setRef");function U5(...t){const e=C.useRef(t);return e.current=t,C.useCallback(n=>{const r=e.current;let o=!1;const i=r.map(s=>{const l=Ju(s,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let s=0;s{throw new Error("Cannot call an event handler while rendering.")});return typeof Lp=="function"?Lp(()=>{e.current=t}):et(()=>{e.current=t}),C.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}var l7=Object.defineProperty,Cs=(t,e)=>l7(t,"name",{value:e,configurable:!0}),a7=qo[" useInsertionEffect ".trim().toString()]||et;function cr({prop:t,defaultProp:e,onChange:n=Cs(()=>{},"onChange"),caller:r}){const[o,i,s]=Z5({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o,c=C.useCallback(u=>{var f;if(l){const d=q5(u)?u(t):u;d!==t&&((f=s.current)==null||f.call(s,d))}else i(u)},[l,t,i,s]);return[a,c]}Cs(cr,"useControllableState");function Z5({defaultProp:t,onChange:e}){const[n,r]=C.useState(t),o=C.useRef(n),i=C.useRef(e);return a7(()=>{i.current=e},[e]),C.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}Cs(Z5,"useUncontrolledState");function q5(t){return typeof t=="function"}Cs(q5,"isFunction");var $p=Symbol("RADIX:SYNC_STATE");function c7(t,e,n,r){const{prop:o,defaultProp:i,onChange:s,caller:l}=e,a=o!==void 0,c=s7(s),u=[{...n,state:i}];r&&u.push(r);const[f,d]=C.useReducer((y,m)=>{if(m.type===$p)return{...y,state:m.state};const x=t(y,m);return a&&!Object.is(x.state,y.state)&&c(x.state),x},...u),g=f.state,h=C.useRef(g);C.useEffect(()=>{h.current!==g&&(h.current=g,a||c(g))},[g,h,a]);const p=C.useMemo(()=>o!==void 0?{...f,state:o}:f,[f,o]);return C.useEffect(()=>{a&&!Object.is(o,f.state)&&d({type:$p,state:o})},[o,f.state,a]),[p,d]}Cs(c7,"useControllableStateReducer");var u7=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},_o=new WeakMap,zs=new WeakMap,Ks={},Tc=0,Y5=function(t){return t&&(t.host||Y5(t.parentNode))},f7=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Y5(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},d7=function(t,e,n,r){var o=f7(e,Array.isArray(t)?t:[t]);Ks[n]||(Ks[n]=new WeakMap);var i=Ks[n],s=[],l=new Set,a=new Set(o),c=function(f){!f||l.has(f)||(l.add(f),c(f.parentNode))};o.forEach(c);var u=function(f){!f||a.has(f)||Array.prototype.forEach.call(f.children,function(d){if(l.has(d))u(d);else try{var g=d.getAttribute(r),h=g!==null&&g!=="false",p=(_o.get(d)||0)+1,y=(i.get(d)||0)+1;_o.set(d,p),i.set(d,y),s.push(d),p===1&&h&&zs.set(d,!0),y===1&&d.setAttribute(n,"true"),h||d.setAttribute(r,"true")}catch(m){console.error("aria-hidden: cannot operate on ",d,m)}})};return u(e),l.clear(),Tc++,function(){s.forEach(function(f){var d=_o.get(f)-1,g=i.get(f)-1;_o.set(f,d),i.set(f,g),d||(zs.has(f)||f.removeAttribute(r),zs.delete(f)),g||f.removeAttribute(n)}),Tc--,Tc||(_o=new WeakMap,_o=new WeakMap,zs=new WeakMap,Ks={})}},h7=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=u7(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),d7(r,o,n,"aria-hidden")):function(){return null}},nn=function(){return nn=Object.assign||function(e){for(var n,r=1,o=arguments.length;r"u")return O7;var e=A7(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},L7=tx(),Bo="data-scroll-locked",$7=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),` + .`.concat(p7,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } @@ -82,15 +82,15 @@ var s2=Object.defineProperty;var l2=(t,e,n)=>e in t?s2(t,e,{enumerable:!0,config } body[`).concat(Bo,`] { - `).concat(y7,": ").concat(l,`px; + `).concat(m7,": ").concat(l,`px; } -`)},Dp=function(){var t=parseInt(document.body.getAttribute(Bo)||"0",10);return isFinite(t)?t:0},R7=function(){C.useEffect(function(){return document.body.setAttribute(Bo,(Dp()+1).toString()),function(){var t=Dp()-1;t<=0?document.body.removeAttribute(Bo):document.body.setAttribute(Bo,t.toString())}},[])},D7=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;R7();var i=C.useMemo(function(){return L7(o)},[o]);return C.createElement($7,{styles:I7(i,!e,o,n?"":"!important")})},Uu=!1;if(typeof window<"u")try{var Js=Object.defineProperty({},"passive",{get:function(){return Uu=!0,!0}});window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Uu=!1}var vo=Uu?{passive:!1}:!1,F7=function(t){return t.tagName==="TEXTAREA"},rx=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!F7(t)&&n[e]==="visible")},H7=function(t){return rx(t,"overflowY")},V7=function(t){return rx(t,"overflowX")},Fp=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=ox(t,r);if(o){var i=ix(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},B7=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},j7=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},ox=function(t,e){return t==="v"?H7(e):V7(e)},ix=function(t,e){return t==="v"?B7(e):j7(e)},W7=function(t,e){return t==="h"&&e==="rtl"?-1:1},z7=function(t,e,n,r,o){var i=W7(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,f=0,d=0;do{if(!l)break;var g=ix(t,l),h=g[0],p=g[1],y=g[2],m=p-y-i*h;(h||m)&&ox(t,l)&&(f+=m,d+=h);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&Math.abs(f)<1||!u&&Math.abs(d)<1)&&(c=!0),c},Us=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Hp=function(t){return[t.deltaX,t.deltaY]},Vp=function(t){return t&&"current"in t?t.current:t},K7=function(t,e){return t[0]===e[0]&&t[1]===e[1]},J7=function(t){return` +`)},Rp=function(){var t=parseInt(document.body.getAttribute(Bo)||"0",10);return isFinite(t)?t:0},I7=function(){C.useEffect(function(){return document.body.setAttribute(Bo,(Rp()+1).toString()),function(){var t=Rp()-1;t<=0?document.body.removeAttribute(Bo):document.body.setAttribute(Bo,t.toString())}},[])},R7=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;I7();var i=C.useMemo(function(){return P7(o)},[o]);return C.createElement(L7,{styles:$7(i,!e,o,n?"":"!important")})},Uu=!1;if(typeof window<"u")try{var Js=Object.defineProperty({},"passive",{get:function(){return Uu=!0,!0}});window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Uu=!1}var vo=Uu?{passive:!1}:!1,D7=function(t){return t.tagName==="TEXTAREA"},nx=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!D7(t)&&n[e]==="visible")},F7=function(t){return nx(t,"overflowY")},H7=function(t){return nx(t,"overflowX")},Dp=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=rx(t,r);if(o){var i=ox(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},V7=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},B7=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},rx=function(t,e){return t==="v"?F7(e):H7(e)},ox=function(t,e){return t==="v"?V7(e):B7(e)},j7=function(t,e){return t==="h"&&e==="rtl"?-1:1},W7=function(t,e,n,r,o){var i=j7(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,f=0,d=0;do{if(!l)break;var g=ox(t,l),h=g[0],p=g[1],y=g[2],m=p-y-i*h;(h||m)&&rx(t,l)&&(f+=m,d+=h);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&Math.abs(f)<1||!u&&Math.abs(d)<1)&&(c=!0),c},Us=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Fp=function(t){return[t.deltaX,t.deltaY]},Hp=function(t){return t&&"current"in t?t.current:t},z7=function(t,e){return t[0]===e[0]&&t[1]===e[1]},K7=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},U7=0,Co=[];function G7(t){var e=C.useRef([]),n=C.useRef([0,0]),r=C.useRef(),o=C.useState(U7++)[0],i=C.useState(nx)[0],s=C.useRef(t);C.useEffect(function(){s.current=t},[t]),C.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var p=p7([t.lockRef.current],(t.shards||[]).map(Vp),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=C.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!s.current.allowPinchZoom;var m=Us(p),x=n.current,v="deltaX"in p?p.deltaX:x[0]-m[0],_="deltaY"in p?p.deltaY:x[1]-m[1],S,E=p.target,b=Math.abs(v)>Math.abs(_)?"h":"v";if("touches"in p&&b==="h"&&E.type==="range")return!1;var w=window.getSelection(),k=w&&w.anchorNode,M=k?k===E||k.contains(E):!1;if(M)return!1;var A=Fp(b,E);if(!A)return!0;if(A?S=b:(S=b==="v"?"h":"v",A=Fp(b,E)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||_)&&(r.current=S),!S)return!0;var R=r.current||S;return z7(R,y,p,R==="h"?v:_)},[]),a=C.useCallback(function(p){var y=p;if(!(!Co.length||Co[Co.length-1]!==i)){var m="deltaY"in y?Hp(y):Us(y),x=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&K7(S.delta,m)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var v=(s.current.shards||[]).map(Vp).filter(Boolean).filter(function(S){return S.contains(y.target)}),_=v.length>0?l(y,v[0]):!s.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),c=C.useCallback(function(p,y,m,x){var v={name:p,delta:y,target:m,should:x,shadowParent:Z7(m)};e.current.push(v),setTimeout(function(){e.current=e.current.filter(function(_){return _!==v})},1)},[]),u=C.useCallback(function(p){n.current=Us(p),r.current=void 0},[]),f=C.useCallback(function(p){c(p.type,Hp(p),p.target,l(p,t.lockRef.current))},[]),d=C.useCallback(function(p){c(p.type,Us(p),p.target,l(p,t.lockRef.current))},[]);C.useEffect(function(){return Co.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",a,vo),document.addEventListener("touchmove",a,vo),document.addEventListener("touchstart",u,vo),function(){Co=Co.filter(function(p){return p!==i}),document.removeEventListener("wheel",a,vo),document.removeEventListener("touchmove",a,vo),document.removeEventListener("touchstart",u,vo)}},[]);var g=t.removeScrollBar,h=t.inert;return C.createElement(C.Fragment,null,h?C.createElement(i,{styles:J7(o)}):null,g?C.createElement(D7,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Z7(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const q7=S7(tx,G7);var sx=C.forwardRef(function(t,e){return C.createElement(Ra,nn({},t,{ref:e,sideCar:q7}))});sx.classNames=Ra.classNames;function lx(t){const e=t+"CollectionProvider",[n,r]=co(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:y,children:m}=p,x=C.useRef(null),v=C.useRef(new Map).current;return L.jsx(o,{scope:y,itemMap:v,collectionRef:x,children:m})};s.displayName=e;const l=t+"CollectionSlot",a=Zl(l),c=C.forwardRef((p,y)=>{const{scope:m,children:x}=p,v=i(l,m),_=Ze(y,v.collectionRef);return L.jsx(a,{ref:_,children:x})});c.displayName=l;const u=t+"CollectionItemSlot",f="data-radix-collection-item",d=Zl(u),g=C.forwardRef((p,y)=>{const{scope:m,children:x,...v}=p,_=C.useRef(null),S=Ze(y,_),E=i(u,m);return C.useEffect(()=>(E.itemMap.set(_,{ref:_,...v}),()=>void E.itemMap.delete(_))),L.jsx(d,{[f]:"",ref:S,children:x})});g.displayName=u;function h(p){const y=i(t+"CollectionConsumer",p);return C.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const v=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((E,b)=>v.indexOf(E.ref.current)-v.indexOf(b.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:g},h,r]}var Y7=C.createContext(void 0);function Da(t){const e=C.useContext(Y7);return t||e||"ltr"}var Oc=!1;function X7(){const[t,e]=C.useState(Oc);return C.useEffect(()=>{Oc||(Oc=!0,e(!0))},[]),t}var ax=qo[" useSyncExternalStore ".trim().toString()];function Q7(){return()=>{}}function e4(){return ax(Q7,()=>!0,()=>!1)}var t4=typeof ax=="function"?e4:X7,n4=Object.defineProperty,uo=(t,e)=>n4(t,"name",{value:e,configurable:!0}),Ac="rovingFocusGroup.onEntryFocus",r4={bubbles:!1,cancelable:!0},Fa="RovingFocusGroup",[Gu,cx,o4]=lx(Fa),[i4,Ha]=co(Fa,[o4]),[s4,l4]=i4(Fa),a4=C.forwardRef(uo(function(e,n){return L.jsx(Gu.Provider,{scope:e.__scopeRovingFocusGroup,children:L.jsx(Gu.Slot,{scope:e.__scopeRovingFocusGroup,children:L.jsx(c4,{...e,ref:n})})})},"RovingFocusGroup")),c4=C.forwardRef(uo(function(e,n){const{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,g=C.useRef(null),h=Ze(n,g),p=Da(s),[y,m]=cr({prop:l,defaultProp:a??null,onChange:c,caller:Fa}),[x,v]=C.useState(!1),_=fn(u),S=cx(r),E=C.useRef(!1),[b,w]=C.useState(0);return C.useEffect(()=>{const k=g.current;if(k)return k.addEventListener(Ac,_),()=>k.removeEventListener(Ac,_)},[_]),L.jsx(s4,{scope:r,orientation:o,dir:p,loop:i,currentTabStopId:y,onItemFocus:C.useCallback(k=>m(k),[m]),onItemShiftTab:C.useCallback(()=>v(!0),[]),onFocusableItemAdd:C.useCallback(()=>w(k=>k+1),[]),onFocusableItemRemove:C.useCallback(()=>w(k=>k-1),[]),children:L.jsx(Ie.div,{tabIndex:x||b===0?-1:0,"data-orientation":o,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:pe(e.onMouseDown,()=>{E.current=!0}),onFocus:pe(e.onFocus,k=>{const M=!E.current;if(k.target===k.currentTarget&&M&&!x){const A=new CustomEvent(Ac,r4);if(k.currentTarget.dispatchEvent(A),!A.defaultPrevented){const R=S().filter(B=>B.focusable),F=R.find(B=>B.active),H=R.find(B=>B.id===y),z=[F,H,...R].filter(Boolean).map(B=>B.ref.current);vd(z,f)}}E.current=!1}),onBlur:pe(e.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),u4="RovingFocusGroupItem",f4=C.forwardRef(uo(function(e,n){const{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:l,...a}=e,c=Na(),u=s||c,f=l4(u4,r),d=f.currentTabStopId===u,g=cx(r),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:y}=f,m=t4();return et(()=>{if(!(!m||!o))return h(),()=>p()},[m,o,h,p]),C.useEffect(()=>{if(!(m||!o))return h(),()=>p()},[m,o,h,p]),L.jsx(Gu.ItemSlot,{scope:r,id:u,focusable:o,active:i,children:L.jsx(Ie.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...a,ref:n,onMouseDown:pe(e.onMouseDown,x=>{o?f.onItemFocus(u):x.preventDefault()}),onFocus:pe(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:pe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const v=fx(x,f.orientation,f.dir);if(v!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=g().filter(E=>E.focusable).map(E=>E.ref.current);if(v==="last")S.reverse();else if(v==="prev"||v==="next"){v==="prev"&&S.reverse();const E=S.indexOf(x.currentTarget);S=f.loop?dx(S,E+1):S.slice(E+1)}setTimeout(()=>vd(S))}}),children:typeof l=="function"?l({isCurrentTabStop:d,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),d4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ux(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}uo(ux,"getDirectionAwareKey");function fx(t,e,n){const r=ux(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return d4[r]}uo(fx,"getFocusIntent");function vd(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}uo(vd,"focusFirst");function dx(t,e){return t.map((n,r)=>t[(e+r)%t.length])}uo(dx,"wrapArray");var hx=a4,gx=f4,h4=Object.defineProperty,g4=(t,e)=>h4(t,"name",{value:e,configurable:!0}),p4="Toggle",m4=C.forwardRef(g4(function(e,n){const{pressed:r,defaultPressed:o,onPressedChange:i,...s}=e,[l,a]=cr({prop:r,onChange:i,defaultProp:o??!1,caller:p4});return L.jsx(Ie.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:n,onClick:pe(e.onClick,()=>{e.disabled||a(!l)})})},"Toggle")),y4=Object.defineProperty,ur=(t,e)=>y4(t,"name",{value:e,configurable:!0}),ai="ToggleGroup",[px,mx]=co(ai,[Ha]),yx=Ha(),x4=C.forwardRef(ur(function(e,n){const{type:r,...o}=e;if(r==="single"){const i=o;return L.jsx(_4,{role:"radiogroup",...i,ref:n})}if(r==="multiple"){const i=o;return L.jsx(v4,{role:"toolbar",...i,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${ai}\``)},"ToggleGroup")),[xx,_x]=px(ai),_4=C.forwardRef(ur(function(e,n){const{value:r,defaultValue:o,onValueChange:i=ur(()=>{},"onValueChange"),...s}=e,[l,a]=cr({prop:r,defaultProp:o??"",onChange:i,caller:ai});return L.jsx(xx,{scope:e.__scopeToggleGroup,type:"single",value:C.useMemo(()=>l?[l]:[],[l]),onItemActivate:a,onItemDeactivate:C.useCallback(()=>a(""),[a]),children:L.jsx(vx,{...s,ref:n})})},"ToggleGroupImplSingle")),v4=C.forwardRef(ur(function(e,n){const{value:r,defaultValue:o,onValueChange:i=ur(()=>{},"onValueChange"),...s}=e,[l,a]=cr({prop:r,defaultProp:o??[],onChange:i,caller:ai}),c=C.useCallback(f=>a((d=[])=>[...d,f]),[a]),u=C.useCallback(f=>a((d=[])=>d.filter(g=>g!==f)),[a]);return L.jsx(xx,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:c,onItemDeactivate:u,children:L.jsx(vx,{...s,ref:n})})},"ToggleGroupImplMultiple")),[C4,b4]=px(ai),vx=C.forwardRef(ur(function(e,n){const{__scopeToggleGroup:r,disabled:o=!1,rovingFocus:i=!0,orientation:s,dir:l,loop:a=!0,...c}=e,u=yx(r),f=Da(l),d={dir:f,...c};return L.jsx(C4,{scope:r,rovingFocus:i,disabled:o,children:i?L.jsx(hx,{asChild:!0,...u,orientation:s,dir:f,loop:a,children:L.jsx(Ie.div,{...d,ref:n})}):L.jsx(Ie.div,{...d,ref:n})})},"ToggleGroupImpl")),Zu="ToggleGroupItem",w4=C.forwardRef(ur(function(e,n){const r=_x(Zu,e.__scopeToggleGroup),o=b4(Zu,e.__scopeToggleGroup),i=yx(e.__scopeToggleGroup),s=r.value.includes(e.value),l=o.disabled||e.disabled,a={...e,pressed:s,disabled:l},c=C.useRef(null);return o.rovingFocus?L.jsx(gx,{asChild:!0,...i,focusable:!l,active:s,ref:c,children:L.jsx(Bp,{...a,ref:n})}):L.jsx(Bp,{...a,ref:n})},"ToggleGroupItem")),Bp=C.forwardRef(ur(function(e,n){const{__scopeToggleGroup:r,value:o,...i}=e,s=_x(Zu,r),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?l:void 0;return L.jsx(m4,{...a,...i,ref:n,onPressedChange:c=>{c?s.onItemActivate(o):s.onItemDeactivate(o)}})},"ToggleGroupItemImpl")),S4=Object.defineProperty,Va=(t,e)=>S4(t,"name",{value:e,configurable:!0}),Cx="Toolbar",[E4]=co(Cx,[Ha,mx]),bx=Ha(),wx=mx(),[T4,k4]=E4(Cx),N4=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,orientation:o="horizontal",dir:i,loop:s=!0,...l}=e,a=bx(r),c=Da(i);return L.jsx(T4,{scope:r,orientation:o,dir:c,children:L.jsx(hx,{asChild:!0,...a,orientation:o,dir:c,loop:s,children:L.jsx(Ie.div,{role:"toolbar","aria-orientation":o,dir:c,...l,ref:n})})})},"Toolbar")),Sx=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,...o}=e,i=bx(r);return L.jsx(gx,{asChild:!0,...i,focusable:!e.disabled,children:L.jsx(Ie.button,{type:"button",...o,ref:n})})},"ToolbarButton")),M4="ToolbarToggleGroup",O4=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,...o}=e,i=k4(M4,r),s=wx(r);return L.jsx(x4,{"data-orientation":i.orientation,dir:i.dir,...s,...o,ref:n,rovingFocus:!1})},"ToolbarToggleGroup")),A4=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,...o}=e,i=wx(r),s={__scopeToolbar:e.__scopeToolbar};return L.jsx(Sx,{asChild:!0,...s,children:L.jsx(w4,{...i,...o,ref:n})})},"ToolbarToggleItem")),P4=N4,L4=Sx,Cd=O4,$4=A4;const jp=new Set(["http:","https:","mailto:","sms:","tel:"]);class ci extends ft{constructor(n="",r={},o){super(o);P(this,"__url");P(this,"__target");P(this,"__rel");P(this,"__title");const{target:i=null,rel:s=null,title:l=null}=r;this.__url=n,this.__target=i,this.__rel=s,this.__title=l}static getType(){return"link"}static clone(n){return new ci(n.__url,{rel:n.__rel,target:n.__target,title:n.__title},n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__url=n.__url,this.__rel=n.__rel,this.__target=n.__target,this.__title=n.__title}createDOM(n){const r=Te().createElement("a");return this.updateLinkDOM(null,r,n),Xt(r,n.theme.link),r}updateLinkDOM(n,r,o){if(q1(r)){n&&n.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,l=this[s];n&&n[s]===l||(l?r[i]=l:r.removeAttribute(i))}}}updateDOM(n,r,o){return this.updateLinkDOM(n,r,o),!1}static importDOM(){return{a:n=>({conversion:I4,priority:1})}}static importJSON(n){return Ba().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setURL(n.url).setRel(n.rel||null).setTarget(n.target||null).setTitle(n.title||null)}sanitizeUrl(n){const r=n;n=Kp(n);try{const o=new URL(Kp(n));if(!jp.has(o.protocol))return"about:blank"}catch{const i=r.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(i!=null&&!jp.has(`${i[1].toLowerCase()}:`))return"about:blank"}return n}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(n){const r=this.getWritable();return r.__url=n,r}getTarget(){return this.getLatest().__target}setTarget(n){const r=this.getWritable();return r.__target=n,r}getRel(){return this.getLatest().__rel}setRel(n){const r=this.getWritable();return r.__rel=n,r}getTitle(){return this.getLatest().__title}setTitle(n){const r=this.getWritable();return r.__title=n,r}insertNewAfter(n,r=!0){const o=lt(this);return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(n,r,o){if(!$(r))return!1;const i=r.anchor.getNode(),s=r.focus.getNode();return(this.is(i)||this.isParentOf(i))&&(this.is(s)||this.isParentOf(s))&&r.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}shouldMergeAdjacentLink(n){return this.getType()===n.getType()&&this.__url===n.__url&&this.__target===n.__target&&this.__rel===n.__rel&&this.__title===n.__title}}function I4(t){let e=null;if(q1(t)){const n=t.textContent;(n!==null&&n!==""||t.children.length>0)&&(e=Ba(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function Ba(t="",e){return kt(new ci(t,e))}function Wp(t){return t instanceof ci}class ja extends ci{constructor(n="",r={},o){super(n,r,o);P(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}afterCloneFrom(n){super.afterCloneFrom(n),this.__isUnlinked=n.__isUnlinked}static getType(){return"autolink"}static clone(n){return new ja(n.__url,{isUnlinked:n.__isUnlinked,rel:n.__rel,target:n.__target,title:n.__title},n.__key)}shouldMergeAdjacentLink(n){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(n){const r=this.getWritable();return r.__isUnlinked=n,r}createDOM(n){return this.__isUnlinked?Te().createElement("span"):super.createDOM(n)}updateDOM(n,r,o){return super.updateDOM(n,r,o)||n.__isUnlinked!==this.__isUnlinked}static importJSON(n){return zp().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setIsUnlinked(n.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(n,r=!0){const o=zp(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,r),o}}function zp(t="",e){return kt(new ja(t,e))}function R4(t){return t instanceof ja}const D4=/^\+?[0-9\s()-]{5,}$/;function Kp(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:D4.test(t)?`tel:${t}`:`https://${t}`}Ge.tag("a");const F4={testNode:"blockquote",visitNode({actions:t}){t.addAndStepInto(ao())}},H4={testLexicalNode:_u,visitLexicalNode:({actions:t})=>{t.addAndStepInto("blockquote")}},V4=Xo({init(t){t.pubIn({[ld]:"quote",[ts]:F4,[Sa]:Ca,[Ea]:H4})}});function Jp(){let t=Ho;return{publish:()=>{t()},subscribe:e=>{t=e}}}function B4(t,e,n,r){const o=[...t].sort((s,l)=>l.priority-s.priority),i=n??"";return o.find(s=>s.match(e??"",i))??o.find(s=>s.match(r??"",i))}var j4=Object.defineProperty,W4=(t,e,n)=>e in t?j4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gn=(t,e,n)=>(W4(t,typeof e!="symbol"?e+"":e,n),n);class Wa extends ds{constructor(e,n,r,o){super(o),Gn(this,"__code"),Gn(this,"__meta"),Gn(this,"__language"),Gn(this,"__focusEmitter",Jp()),Gn(this,"setCode",i=>{i!==this.__code&&(this.getWritable().__code=i)}),Gn(this,"setMeta",i=>{i!==this.__meta&&(this.getWritable().__meta=i)}),Gn(this,"setLanguage",i=>{i!==this.__language&&(this.getWritable().__language=i)}),Gn(this,"select",()=>{this.__focusEmitter.publish()}),this.__code=e,this.__meta=r,this.__language=n}static getType(){return"codeblock"}static clone(e){return new Wa(e.__code,e.__language,e.__meta,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__code=e.__code,this.__meta=e.__meta,this.__language=e.__language,this.__focusEmitter=Jp()}static importJSON(e){const n=typeof e.code=="string"?e.code:"",r=typeof e.language=="string"?e.language:"",o=typeof e.meta=="string"?e.meta:"";return bd({code:n,language:r,meta:o})}static importDOM(){return{pre:()=>({conversion:U4,priority:3})}}exportJSON(){return{code:this.getCode(),language:this.getLanguage(),meta:this.getMeta(),type:"codeblock",version:1}}createDOM(e,n){return document.createElement("div")}updateDOM(){return!1}getCode(){return this.__code}getMeta(){return this.__meta}getLanguage(){return this.__language}decorate(e){return N.createElement(J4,{parentEditor:e,code:this.getCode(),meta:this.getMeta(),language:this.getLanguage(),codeBlockNode:this,nodeKey:this.getKey(),focusEmitter:this.__focusEmitter})}isInline(){return!1}}const z4=N.createContext(null),K4=({parentEditor:t,lexicalNode:e,children:n})=>{const r=N.useMemo(()=>({lexicalNode:e,parentEditor:t,setCode:o=>{t.update(()=>{e.setCode(o),setTimeout(()=>{t.dispatchCommand(Xf,void 0)},0)})},setLanguage:o=>{t.update(()=>{e.setLanguage(o)})},setMeta:o=>{t.update(()=>{e.setMeta(o)})}}),[e,t]);return N.createElement(z4.Provider,{value:r},n)},J4=t=>{const e=ln(Py),n=ln(Ly),r=B4(e,t.language,t.meta,n);if(!r)throw new Error(`No CodeBlockEditor registered for language=${t.language} meta=${t.meta}`);const o=r.Editor,{codeBlockNode:i,parentEditor:s,...l}=t;return N.createElement(K4,{parentEditor:t.parentEditor,lexicalNode:t.codeBlockNode},N.createElement(o,{...l}))};function bd(t){const{code:e="",language:n="",meta:r=""}=t;return new Wa(e,n,r)}function U4(t){const e=t,n=e.textContent,r=t.getAttribute("class")??"",o=t.getAttribute("data-language")??"",i=/language-(\w+)/.exec(r),s=i?i[1]:o,l=e.getAttribute("data-meta")??"";return{node:bd({code:n,language:s,meta:l})}}function Up(t,[e,n]){return Math.min(n,Math.max(e,t))}function G4(t){const e=C.useRef({value:t,previous:t});return C.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Z4=Object.defineProperty,q4=(t,e)=>Z4(t,"name",{value:e,configurable:!0}),Ex=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Y4=C.forwardRef(q4(function(e,n){return L.jsx(Ie.span,{...e,ref:n,style:{...Ex,...e.style}})},"VisuallyHidden")),X4=Y4,Q4=Object.defineProperty,Ee=(t,e)=>Q4(t,"name",{value:e,configurable:!0}),e6=[" ","Enter","ArrowUp","ArrowDown"],t6=[" ","Enter"],Zo="Select",[za,wd,n6]=lx(Zo),[fo]=co(Zo,[n6,$a]),Sd=$a(),[r6,yr]=fo(Zo),[o6,i6]=fo(Zo);function Tx(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:c,name:u,autoComplete:f,disabled:d,required:g,form:h,internal_do_not_use_render:p}=t,y=Sd(e),[m,x]=C.useState(null),[v,_]=C.useState(null),[S,E]=C.useState(!1),b=Da(c),[w,k]=cr({prop:r,defaultProp:o??!1,onChange:i,caller:Zo}),[M,A]=cr({prop:s,defaultProp:l,onChange:a,caller:Zo}),R=C.useRef(null),F=C.useRef(M);C.useEffect(()=>{const xe=h?m==null?void 0:m.ownerDocument.getElementById(h):m==null?void 0:m.form;if(xe instanceof HTMLFormElement){const de=Ee(()=>A(F.current),"reset");return xe.addEventListener("reset",de),()=>xe.removeEventListener("reset",de)}},[h,m,A]);const H=m?!!h||!!m.closest("form"):!0,[W,z]=C.useState(new Set),B=Na(),K=Array.from(W).map(xe=>xe.props.value).join(";"),J=C.useCallback(xe=>{z(de=>new Set(de).add(xe))},[]),X=C.useCallback(xe=>{z(de=>{const Ve=new Set(de);return Ve.delete(xe),Ve})},[]),ie={required:g,trigger:m,onTriggerChange:x,valueNode:v,onValueNodeChange:_,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:B,value:M,onValueChange:A,open:w,onOpenChange:k,dir:b,triggerPointerDownPosRef:R,disabled:d,name:u,autoComplete:f,form:h,nativeOptions:W,nativeSelectKey:K,isFormControl:H};return L.jsx(j5,{...y,children:L.jsx(r6,{scope:e,...ie,children:L.jsx(za.Provider,{scope:e,children:L.jsx(o6,{scope:e,onNativeOptionAdd:J,onNativeOptionRemove:X,children:Nx(p)?p(ie):n})})})})}Ee(Tx,"SelectProvider");var s6=Ee(t=>{const{__scopeSelect:e,children:n,...r}=t;return L.jsx(Tx,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:o})=>L.jsxs(L.Fragment,{children:[n,o?L.jsx(A6,{__scopeSelect:e}):null]})})},"Select"),l6="SelectTrigger",a6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,disabled:o=!1,...i}=e,s=Sd(r),l=yr(l6,r),a=l.disabled||o,c=Ze(n,l.onTriggerChange),u=wd(r),f=C.useRef("touch"),[d,g,h]=Ed(y=>{const m=u().filter(_=>!_.disabled),x=m.find(_=>_.value===l.value),v=Td(m,y,x);v!==void 0&&l.onValueChange(v.value)}),p=Ee(y=>{a||(l.onOpenChange(!0),h()),y&&(l.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})},"handleOpen");return L.jsx(W5,{asChild:!0,...s,children:L.jsx(Ie.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":bs(l.value)?"":void 0,...i,ref:c,onClick:pe(i.onClick,y=>{y.currentTarget.focus(),f.current!=="mouse"&&p(y)}),onPointerDown:pe(i.onPointerDown,y=>{f.current=y.pointerType;const m=y.target;m.hasPointerCapture(y.pointerId)&&m.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(p(y),y.preventDefault())}),onKeyDown:pe(i.onKeyDown,y=>{const m=d.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&g(y.key),!(m&&y.key===" ")&&e6.includes(y.key)&&(p(),y.preventDefault())})})})},"SelectTrigger")),c6="SelectValue",u6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,className:o,style:i,children:s,placeholder:l="",...a}=e,c=yr(c6,r),{onValueNodeHasChildrenChange:u}=c,f=s!==void 0,d=Ze(n,c.onValueNodeChange);et(()=>{u(f)},[u,f]);const g=bs(c.value);return L.jsx(Ie.span,{...a,asChild:g?!1:a.asChild,ref:d,style:{pointerEvents:"none"},children:L.jsx(C.Fragment,{children:g?l:s},g?"placeholder":"value")})},"SelectValue")),f6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,children:o,...i}=e;return L.jsx(Ie.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})},"SelectIcon")),d6="SelectPortal",[h6,g6]=fo(d6,{forceMount:void 0}),p6=Ee(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return L.jsx(h6,{scope:t.__scopeSelect,forceMount:n,children:L.jsx(K5,{asChild:!0,...r})})},"SelectPortal"),qr="SelectContent",m6=C.forwardRef(Ee(function(e,n){const r=g6(qr,e.__scopeSelect),{forceMount:o=r.forceMount,...i}=e,s=yr(qr,e.__scopeSelect),[l,a]=C.useState();return et(()=>{a(new DocumentFragment)},[]),L.jsx(_d,{present:o||s.open,children:({present:c})=>c?L.jsx(_6,{...i,ref:n}):L.jsx(y6,{...i,fragment:l})})},"SelectContent")),y6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,children:o,fragment:i}=e;return i?nr.createPortal(L.jsx(kx,{scope:r,children:L.jsx(za.Slot,{scope:r,children:L.jsx("div",{ref:n,children:o})})}),i):null},"SelectContentFragment")),Jt=10,[kx,Ka]=fo(qr),x6=Zl("SelectContent.RemoveScroll"),_6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r}=e,{position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:l,side:a,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:m,...x}=e,v=yr(qr,r),[_,S]=C.useState(null),[E,b]=C.useState(null),w=Ze(n,S),[k,M]=C.useState(null),[A,R]=C.useState(null),F=wd(r),[H,W]=C.useState(!1),z=C.useRef(!1);C.useEffect(()=>{if(_)return g7(_)},[_]),H8();const B=C.useCallback(G=>{const[se,...Oe]=F().map(ge=>ge.ref.current),[le]=Oe.slice(-1),ue=document.activeElement;for(const ge of G)if(ge===ue||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===se&&E&&(E.scrollTop=0),ge===le&&E&&(E.scrollTop=E.scrollHeight),ge==null||ge.focus(),document.activeElement!==ue))return},[F,E]),K=C.useCallback(()=>B([k,_]),[B,k,_]);C.useEffect(()=>{H&&K()},[H,K]);const{onOpenChange:J,triggerPointerDownPosRef:X}=v;C.useEffect(()=>{if(_){let G={x:0,y:0};const se=Ee(le=>{var ue,ge;G={x:Math.abs(Math.round(le.pageX)-(((ue=X.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(le.pageY)-(((ge=X.current)==null?void 0:ge.y)??0))}},"handlePointerMove"),Oe=Ee(le=>{G.x<=10&&G.y<=10?le.preventDefault():le.composedPath().includes(_)||J(!1),document.removeEventListener("pointermove",se),X.current=null},"handlePointerUp");return X.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Oe,{capture:!0})}}},[_,J,X]),C.useEffect(()=>{const G=Ee(()=>J(!1),"close");return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[J]);const[ie,xe]=Ed(G=>{const se=F().filter(ue=>!ue.disabled),Oe=se.find(ue=>ue.ref.current===document.activeElement),le=Td(se,G,Oe);le&&setTimeout(()=>{var ue;return(ue=le.ref.current)==null?void 0:ue.focus()})}),de=C.useCallback((G,se,Oe)=>{const le=!z.current&&!Oe;(v.value!==void 0&&v.value===se||le)&&(M(G),le&&(z.current=!0))},[v.value]),Ve=C.useCallback(()=>_==null?void 0:_.focus(),[_]),qe=C.useCallback((G,se,Oe)=>{const le=!z.current&&!Oe;(v.value!==void 0&&v.value===se||le)&&R(G)},[v.value]),oe=o==="popper"?Gp:v6,me=oe===Gp?{side:a,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:m}:{};return L.jsx(kx,{scope:r,content:_,viewport:E,onViewportChange:b,itemRefCallback:de,selectedItem:k,onItemLeave:Ve,itemTextRefCallback:qe,focusSelectedItem:K,selectedItemText:A,position:o,isPositioned:H,searchRef:ie,children:L.jsx(sx,{as:x6,allowPinchZoom:!0,children:L.jsx(B8,{asChild:!0,trapped:v.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:pe(i,G=>{var se;(se=v.trigger)==null||se.focus({preventScroll:!0}),G.preventDefault()}),children:L.jsx(y5,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:L.jsx(oe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:G=>G.preventDefault(),...x,...me,onPlaced:()=>W(!0),ref:w,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:pe(x.onKeyDown,G=>{const se=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!se&&G.key.length===1&&xe(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let le=F().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(G.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ue=G.target,ge=le.indexOf(ue);le=le.slice(ge+1)}setTimeout(()=>B(le)),G.preventDefault()}})})})})})})},"SelectContentImpl")),v6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,onPlaced:o,...i}=e,s=yr(qr,r),l=Ka(qr,r),[a,c]=C.useState(null),[u,f]=C.useState(null),d=Ze(n,f),g=wd(r),h=C.useRef(!1),p=C.useRef(!0),{viewport:y,selectedItem:m,selectedItemText:x,focusSelectedItem:v}=l,_=C.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&y&&m&&x){const w=s.trigger.getBoundingClientRect(),k=u.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),A=x.getBoundingClientRect();if(s.dir!=="rtl"){const ue=A.left-k.left,ge=M.left-ue,Nt=w.left-ge,Mt=w.width+Nt,en=Math.max(Mt,k.width),Kn=window.innerWidth-Jt,Jn=Up(ge,[Jt,Math.max(Jt,Kn-en)]);a.style.minWidth=Mt+"px",a.style.left=Jn+"px"}else{const ue=k.right-A.right,ge=window.innerWidth-M.right-ue,Nt=window.innerWidth-w.right-ge,Mt=w.width+Nt,en=Math.max(Mt,k.width),Kn=window.innerWidth-Jt,Jn=Up(ge,[Jt,Math.max(Jt,Kn-en)]);a.style.minWidth=Mt+"px",a.style.right=Jn+"px"}const R=g(),F=window.innerHeight-Jt*2,H=y.scrollHeight,W=window.getComputedStyle(u),z=parseInt(W.borderTopWidth,10),B=parseInt(W.paddingTop,10),K=parseInt(W.borderBottomWidth,10),J=parseInt(W.paddingBottom,10),X=z+B+H+J+K,ie=Math.min(m.offsetHeight*5,X),xe=window.getComputedStyle(y),de=parseInt(xe.paddingTop,10),Ve=parseInt(xe.paddingBottom,10),qe=w.top+w.height/2-Jt,oe=F-qe,me=m.offsetHeight/2,G=m.offsetTop+me,se=z+B+G,Oe=X-se;if(se<=qe){const ue=R.length>0&&m===R[R.length-1].ref.current;a.style.bottom="0px";const ge=u.clientHeight-y.offsetTop-y.offsetHeight,Nt=Math.max(oe,me+(ue?Ve:0)+ge+K),Mt=se+Nt;a.style.height=Mt+"px"}else{const ue=R.length>0&&m===R[0].ref.current;a.style.top="0px";const Nt=Math.max(qe,z+y.offsetTop+(ue?de:0)+me)+Oe;a.style.height=Nt+"px",y.scrollTop=se-qe+y.offsetTop}a.style.margin=`${Jt}px 0`,a.style.minHeight=ie+"px",a.style.maxHeight=F+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[g,s.trigger,s.valueNode,a,u,y,m,x,s.dir,o]);et(()=>_(),[_]);const[S,E]=C.useState();et(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const b=C.useCallback(w=>{w&&p.current===!0&&(_(),v==null||v(),p.current=!1)},[_,v]);return L.jsx(C6,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:b,children:L.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:L.jsx(Ie.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),Gp=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,align:o="start",collisionPadding:i=Jt,...s}=e,l=Sd(r);return L.jsx(z5,{...l,...s,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[C6,b6]=fo(qr,{}),Zp="SelectViewport",w6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,nonce:o,...i}=e,s=Ka(Zp,r),l=b6(Zp,r),a=Ze(n,s.onViewportChange),c=C.useRef(0);return L.jsxs(L.Fragment,{children:[L.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),L.jsx(za.Slot,{scope:r,children:L.jsx(Ie.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:pe(i.onScroll,u=>{const f=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:g}=l;if(g!=null&&g.current&&d){const h=Math.abs(c.current-f.scrollTop);if(h>0){const p=window.innerHeight-Jt*2,y=parseFloat(d.style.minHeight),m=parseFloat(d.style.height),x=Math.max(y,m);if(x0?S:0,d.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})},"SelectViewport")),S6="SelectGroup",[sT,lT]=fo(S6),qu="SelectItem",[E6,T6]=fo(qu),k6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,value:o,disabled:i=!1,textValue:s,...l}=e,a=yr(qu,r),c=Ka(qu,r),u=a.value===o,[f,d]=C.useState(s??""),[g,h]=C.useState(!1),p=fn(_=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,_,o,i)}),y=Ze(n,p),m=Na(),x=C.useRef("touch"),v=Ee(()=>{i||(a.onValueChange(o),a.onOpenChange(!1))},"handleSelect");return L.jsx(E6,{scope:r,value:o,disabled:i,textId:m,isSelected:u,onItemTextChange:C.useCallback(_=>{d(S=>S||((_==null?void 0:_.textContent)??"").trim())},[]),children:L.jsx(za.ItemSlot,{scope:r,value:o,disabled:i,textValue:f,children:L.jsx(Ie.div,{role:"option","aria-labelledby":m,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:y,onFocus:pe(l.onFocus,()=>h(!0)),onBlur:pe(l.onBlur,()=>h(!1)),onClick:pe(l.onClick,()=>{x.current!=="mouse"&&v()}),onPointerUp:pe(l.onPointerUp,()=>{x.current==="mouse"&&v()}),onPointerDown:pe(l.onPointerDown,_=>{x.current=_.pointerType}),onPointerMove:pe(l.onPointerMove,_=>{var S;x.current=_.pointerType,i?(S=c.onItemLeave)==null||S.call(c):x.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:pe(l.onPointerLeave,_=>{var S;_.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:pe(l.onKeyDown,_=>{var E;i||_.target!==_.currentTarget||((E=c.searchRef)==null?void 0:E.current)!==""&&_.key===" "||(t6.includes(_.key)&&v(),_.key===" "&&_.preventDefault())})})})})},"SelectItem")),Gs="SelectItemText",N6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,className:o,style:i,...s}=e,l=yr(Gs,r),a=Ka(Gs,r),c=T6(Gs,r),u=i6(Gs,r),[f,d]=C.useState(null),g=fn(v=>{var _;return(_=a.itemTextRefCallback)==null?void 0:_.call(a,v,c.value,c.disabled)}),h=Ze(n,d,c.onItemTextChange,g),p=f==null?void 0:f.textContent,y=C.useMemo(()=>L.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return et(()=>(m(y),()=>x(y)),[m,x,y]),L.jsxs(L.Fragment,{children:[L.jsx(Ie.span,{id:c.textId,...s,ref:h}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!bs(l.value)?nr.createPortal(s.children,l.valueNode):null]})},"SelectItemText")),M6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,...o}=e;return L.jsx(Ie.div,{"aria-hidden":!0,...o,ref:n})},"SelectSeparator")),O6="SelectBubbleInput",A6=C.forwardRef(Ee(function({__scopeSelect:e,...n},r){const o=yr(O6,e),{value:i,onValueChange:s,required:l,disabled:a,name:c,autoComplete:u,form:f}=o,{nativeOptions:d,nativeSelectKey:g}=o,h=C.useRef(null),p=Ze(r,h),y=i??"",m=G4(y),x=Array.from(d).some(v=>(v.props.value??"")==="");return C.useEffect(()=>{const v=h.current;if(!v)return;const _=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(_,"value").set;if(m!==y&&E){const b=new Event("change",{bubbles:!0});E.call(v,y),v.dispatchEvent(b)}},[m,y]),L.jsxs(Ie.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:f,onChange:v=>s(v.target.value),...n,style:{...Ex,...n.style},ref:p,defaultValue:y,children:[bs(i)&&!x?L.jsx("option",{value:""}):null,Array.from(d)]},g)},"SelectBubbleInput"));function Nx(t){return typeof t=="function"}Ee(Nx,"isFunction");function bs(t){return t===""||t===void 0}Ee(bs,"shouldShowPlaceholder");function Ed(t){const e=fn(t),n=C.useRef(""),r=C.useRef(0),o=C.useCallback(s=>{const l=n.current+s;e(l),Ee(function a(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>a(""),1e3))},"updateSearch")(l)},[e]),i=C.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}Ee(Ed,"useTypeaheadSearch");function Td(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=Mx(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}Ee(Td,"findNextItem");function Mx(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Ee(Mx,"wrapArray");var P6=Object.defineProperty,Ue=(t,e)=>P6(t,"name",{value:e,configurable:!0}),[kd]=co("Tooltip",[$a]),Nd=$a(),L6="TooltipProvider",$6=700,Yu="tooltip.open",[I6,Md]=kd(L6),R6=Ue(t=>{const{__scopeTooltip:e,delayDuration:n=$6,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=t,s=C.useRef(!0),l=C.useRef(!1),a=C.useRef(0);return C.useEffect(()=>{const c=a.current;return()=>window.clearTimeout(c)},[]),L.jsx(I6,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:C.useCallback(()=>{r<=0||(window.clearTimeout(a.current),s.current=!1)},[r]),onClose:C.useCallback(()=>{r<=0||(window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(c=>{l.current=c},[]),disableHoverableContent:o,children:i})},"TooltipProvider"),Xu="Tooltip",[D6,ws]=kd(Xu),F6=Ue(t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=t,a=Md(Xu,t.__scopeTooltip),c=Nd(e),[u,f]=C.useState(null),[d,g]=C.useState(void 0),h=Na(),p=C.useRef(0),y=s??a.disableHoverableContent,m=l??a.delayDuration,x=C.useRef(!1),[v,_]=cr({prop:r,defaultProp:o??!1,onChange:Ue(M=>{M?(a.onOpen(),document.dispatchEvent(new CustomEvent(Yu))):a.onClose(),i==null||i(M)},"onChange"),caller:Xu}),S=C.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),E=C.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,_(!0)},[_]),b=C.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),w=C.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,_(!0),p.current=0},m)},[m,_]);C.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]);const k=d??h;return L.jsx(j5,{...c,children:L.jsx(D6,{scope:e,contentId:k,setContentId:g,open:v,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:C.useCallback(()=>{a.isOpenDelayedRef.current?w():E()},[a.isOpenDelayedRef,w,E]),onTriggerLeave:C.useCallback(()=>{y?b():(window.clearTimeout(p.current),p.current=0)},[b,y]),onOpen:E,onClose:b,disableHoverableContent:y,children:n})})},"Tooltip"),qp="TooltipTrigger",H6=C.forwardRef(Ue(function(e,n){const{__scopeTooltip:r,...o}=e,i=ws(qp,r),s=Md(qp,r),l=Nd(r),a=C.useRef(null),c=Ze(n,a,i.onTriggerChange),u=C.useRef(!1),f=C.useRef(!1),d=C.useCallback(()=>u.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),L.jsx(W5,{asChild:!0,...l,children:L.jsx(Ie.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...o,ref:c,onPointerMove:pe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:pe(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:pe(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:pe(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:pe(e.onBlur,i.onClose),onClick:pe(e.onClick,i.onClose)})})},"TooltipTrigger")),Ox="TooltipPortal",[V6,B6]=kd(Ox,{forceMount:void 0}),j6=Ue(t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,i=ws(Ox,e);return L.jsx(V6,{scope:e,forceMount:n,children:L.jsx(_d,{present:n||i.open,children:L.jsx(K5,{asChild:!0,container:o,children:r})})})},"TooltipPortal"),ss="TooltipContent",W6=C.forwardRef(Ue(function(e,n){const r=B6(ss,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...s}=e,l=ws(ss,e.__scopeTooltip);return L.jsx(_d,{present:o||l.open,children:l.disableHoverableContent?L.jsx(Ax,{side:i,...s,ref:n}):L.jsx(z6,{side:i,...s,ref:n})})},"TooltipContent")),z6=C.forwardRef(Ue(function(e,n){const r=ws(ss,e.__scopeTooltip),o=Md(ss,e.__scopeTooltip),i=C.useRef(null),s=Ze(n,i),[l,a]=C.useState(null),{trigger:c,onClose:u}=r,f=i.current,{onPointerInTransitChange:d}=o,g=C.useCallback(()=>{a(null),d(!1)},[d]),h=C.useCallback((p,y)=>{const m=p.currentTarget,x={x:p.clientX,y:p.clientY},v=Px(x,m.getBoundingClientRect()),_=Lx(x,v),S=$x(y.getBoundingClientRect()),E=Rx([..._,...S]);a(E),d(!0)},[d]);return C.useEffect(()=>()=>g(),[g]),C.useEffect(()=>{if(c&&f){const p=Ue(m=>h(m,f),"handleTriggerLeave"),y=Ue(m=>h(m,c),"handleContentLeave");return c.addEventListener("pointerleave",p),f.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",p),f.removeEventListener("pointerleave",y)}}},[c,f,h,g]),C.useEffect(()=>{if(l){const p=Ue(y=>{const m=y.target,x={x:y.clientX,y:y.clientY},v=(c==null?void 0:c.contains(m))||(f==null?void 0:f.contains(m)),_=!Ix(x,l);v?g():_&&(g(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,f,l,u,g]),L.jsx(Ax,{...e,ref:s})},"TooltipContentHoverable")),K6=w8("TooltipContent"),Ax=C.forwardRef(Ue(function(e,n){const{__scopeTooltip:r,children:o,"aria-label":i,id:s,onEscapeKeyDown:l,onPointerDownOutside:a,...c}=e,u=ws(ss,r),f=Nd(r),{onClose:d}=u;C.useEffect(()=>(document.addEventListener(Yu,d),()=>document.removeEventListener(Yu,d)),[d]),C.useEffect(()=>{if(u.trigger){const h=Ue(p=>{p.target instanceof Node&&p.target.contains(u.trigger)&&d()},"handleScroll");return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,d]);const{setContentId:g}=u;return et(()=>(g(s),()=>{g(void 0)}),[s,g]),L.jsx(y5,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:L.jsxs(z5,{"data-state":u.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:u.contentId,...f,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[L.jsx(K6,{children:o}),i?L.jsx(X4,{id:u.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function Px(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Ue(Px,"getExitSideFromRect");function Lx(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}Ue(Lx,"getPaddedExitPoints");function $x(t){const{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}Ue($x,"getPointsFromRect");function Ix(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;ir!=d>r&&n<(f-c)*(r-u)/(d-u)+c&&(o=!o)}return o}Ue(Ix,"isPointInPolygon");function Rx(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Dx(e)}Ue(Rx,"getHull");function Dx(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],s=e[e.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))e.pop();else break}e.push(o)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const o=t[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}Ue(Dx,"getHullPresorted");var J6=R6,U6=F6,G6=H6,Z6=j6,q6=W6;const Od=N.forwardRef(({title:t,children:e},n)=>{const r=ln(rd);return N.createElement(J6,{delayDuration:100},N.createElement(U6,null,N.createElement(G6,{ref:n,asChild:!0},N.createElement("span",{className:Le.tooltipTrigger},e)),N.createElement(Z6,{container:r==null?void 0:r.current},N.createElement(q6,{className:Rt(Le.tooltipContent),sideOffset:10},t))))}),Y6=N.forwardRef(({children:t,className:e,...n},r)=>N.createElement(k6,{...n,ref:r,className:Rt(e,Le.selectItem)},N.createElement(N6,null,t))),X6=({title:t,placeholder:e,className:n})=>{const[r,o]=Yo(Qi,vs);return N.createElement(Od,{title:t},N.createElement(a6,{"aria-label":e,className:Rt(Le.selectTrigger,n),"data-toolbar-item":!0,disabled:r},N.createElement(u6,{placeholder:e}),N.createElement(f6,{className:Le.selectDropdownArrow},o("arrow_drop_down"))))},Q6=({children:t,className:e=Le.selectContainer})=>{const n=ln(rd);return N.createElement(p6,{container:n==null?void 0:n.current},N.createElement(m6,{className:Rt(e,"mdxeditor-select-content"),onCloseAutoFocus:r=>{r.preventDefault()},position:"popper"},N.createElement(w6,{"data-editor-dropdown":!0,style:{maxHeight:"var(--radix-select-content-available-height)"}},t)))},eE=t=>N.createElement(s6,{value:t.value||"",onValueChange:t.onChange,disabled:t.disabled},N.createElement(X6,{title:t.triggerTitle,placeholder:t.placeholder}),N.createElement(Q6,null,t.items.map((e,n)=>e==="separator"?N.createElement(M6,{key:n}):N.createElement(Y6,{key:n,value:e.value},e.label))));function Ad(t,e){return N.forwardRef((n,r)=>{const o=Rt(e.className,n.className);return N.createElement(t,{...e,...n,className:o,ref:r})})}const tE=({readOnly:t,children:e,className:n})=>N.createElement(P4,{className:Rt("mdxeditor-toolbar",Le.toolbarRoot,{[Le.readOnlyToolbarRoot]:t},n),...t?{tabIndex:-1}:{}},e);Ad(L4,{className:Le.toolbarButton,"data-toolbar-item":!0});const Fx=Ad($4,{className:Le.toolbarToggleItem,"data-toolbar-item":!0});Ad(Cd,{type:"single",className:Le.toolbarToggleSingleGroup});const Hx=N.forwardRef(({on:t,title:e,children:n,disabled:r,...o},i)=>N.createElement(Cd,{type:"single",className:Le.toolbarToggleSingleGroup,...o,value:t?"on":"off",ref:i},N.createElement(Fx,{"aria-label":e,value:"on",disabled:r},N.createElement(Od,{title:e},n)))),nE=({items:t})=>N.createElement("div",{className:Le.toolbarGroupOfGroups},t.map((e,n)=>N.createElement(Hx,{key:n,title:e.title,on:e.active,onValueChange:r=>{e.onChange(r==="on")},disabled:e.disabled},e.contents))),rE=({value:t,onChange:e,className:n,ggClassName:r,items:o,disabled:i})=>{const s=oi();return N.createElement("div",{className:Rt(Le.toolbarGroupOfGroups,r)},N.createElement(Cd,{"aria-label":s("toolbar.toggleGroup","toggle group"),type:"single",className:Rt(Le.toolbarToggleSingleGroup,n),onValueChange:e,value:t||"",disabled:i,onFocus:l=>{l.preventDefault()}},o.map((l,a)=>N.createElement(Fx,{key:a,"aria-label":l.title,value:l.value},N.createElement(Od,{title:l.title},l.contents)))))},Pc=Y(()=>null),Lc=Y(""),Yp=()=>"This is an empty toolbar. Pass `{toolbarContents: () => { return <>toolbar components }}` to the toolbarPlugin to customize it.",oE=Xo({init(t,e){const n=(e==null?void 0:e.toolbarPosition)==="bottom"?Q3:X3;t.pubIn({[Pc]:(e==null?void 0:e.toolbarContents)??Yp,[Lc]:(e==null?void 0:e.toolbarClassName)??"",[n]:()=>{const[r,o,i]=Yo(Pc,Qi,Lc);return N.createElement(tE,{className:i,readOnly:o},r())}})},update(t,e){t.pub(Pc,(e==null?void 0:e.toolbarContents)??Yp),t.pub(Lc,(e==null?void 0:e.toolbarClassName)??"")}});function iE(t,e){let n=t;for(let r=fe(t,e);r&&(jx(r.origin)||Dr(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function sE(t){return iE(t,"previous")}function Vx(t,e){for(const n of t.childNodes)if(q(n)&&n.tagName===e||Vx(n,e))return!0;return!1}const Ci="data-language",vi="data-highlight-language",Zs="data-theme";class Ss extends ft{constructor(n,r){super(r);P(this,"__language");P(this,"__theme");P(this,"__isSyntaxHighlightSupported");this.__language=n||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}static getType(){return"code"}static clone(n){return new Ss(n.__language,n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__language=n.__language,this.__theme=n.__theme,this.__isSyntaxHighlightSupported=n.__isSyntaxHighlightSupported}createDOM(n){const r=Te().createElement("code");Xt(r,n.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Ci,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(vi,o));const i=this.getTheme();i&&r.setAttribute(Zs,i);const s=this.getStyle();return s&&$o(r.style,s),r}updateDOM(n,r,o){const i=this.__language,s=n.__language;i?i!==s&&r.setAttribute(Ci,i):s&&r.removeAttribute(Ci);const l=this.__isSyntaxHighlightSupported;n.__isSyntaxHighlightSupported&&s?l&&i?i!==s&&r.setAttribute(vi,i):r.removeAttribute(vi):l&&i&&r.setAttribute(vi,i);const a=this.__theme,c=n.__theme;a?a!==c&&r.setAttribute(Zs,a):c&&r.removeAttribute(Zs);const u=this.__style,f=n.__style;return u!==f&&$o(r.style,u,f),!1}exportDOM(n){const r=Te().createElement("pre");Xt(r,n._config.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Ci,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(vi,o));const i=this.getTheme();i&&r.setAttribute(Zs,i);const s=this.getStyle();return s&&$o(r.style,s),{element:r}}static importDOM(){return{code:n=>n.textContent!=null&&(/\r?\n/.test(n.textContent)||Vx(n,"BR"))?{conversion:Xp,priority:1}:null,div:()=>({conversion:lE,priority:1}),pre:()=>({conversion:Xp,priority:0}),table:n=>$c(n)?{conversion:aE,priority:3}:null,td:n=>{const r=n,o=r.closest("table");return r.classList.contains("js-file-line")||o&&$c(o)?{conversion:Qp,priority:3}:null},tr:n=>{const r=n.closest("table");return r&&$c(r)?{conversion:Qp,priority:3}:null}}}static importJSON(n){return ct().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setLanguage(n.language).setTheme(n.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(n,r=!0){if(!io(Me(),"@lexical/code")){const l=cE(n);if(l)return l}const{anchor:o,focus:i}=n,s=(o.isBefore(i)?o:i).getNode();if(D(s)){let l=sE(s);const a=[];for(;;)if(Dr(l))a.push(fs()),l=l.getNextSibling();else{if(!jx(l))break;{let p=0;const y=l.getTextContent(),m=l.getTextContentSize();for(;pn.append(r)),this.replace(n),!0}setLanguage(n){const r=this.getWritable();return r.__language=n||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(n){const r=this.getWritable();return r.__isSyntaxHighlightSupported=n,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(n){const r=this.getWritable();return r.__theme=n||void 0,r}getTheme(){return this.getLatest().__theme}}function ct(t,e){return Q1(Ss).setLanguage(t).setTheme(e)}function ls(t){return t instanceof Ss}function Xp(t){return{node:ct(t.getAttribute(Ci))}}function lE(t){const e=t,n=em(e);return n||function(r){let o=r.parentElement;for(;o!==null;){if(em(o))return!0;o=o.parentElement}return!1}(e)?{node:n?ct():null}:{node:null}}function aE(){return{node:ct()}}function Qp(){return{node:null}}function em(t){return t.style.fontFamily.match("monospace")!==null}function $c(t){return t.classList.contains("js-file-line-container")}function cE(t){const{anchor:e}=t;if(t.isCollapsed()&&e.type==="element"){const n=e.getNode();if(ls(n)){const r=n.getChildrenSize();if(r>=2&&e.offset===r){const o=n.getLastChild();if(rt(o)&&rt(o.getPreviousSibling())){const i=re();return n.splice(r-2,2,[]).insertAfter(i,!1),i.select(),i}}}}return null}class Ja extends Qt{constructor(n="",r,o){super(n,o);P(this,"__highlightType");this.__highlightType=r}static getType(){return"code-highlight"}static clone(n){return new Ja(n.__text,n.__highlightType||void 0,n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__highlightType=n.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(n){const r=this.getWritable();return r.__highlightType=n||void 0,r}canHaveFormat(){return!1}createDOM(n){const r=super.createDOM(n),o=Ic(n.theme,this.__highlightType);return Xt(r,o),r}updateDOM(n,r,o){const i=super.updateDOM(n,r,o),s=Ic(o.theme,n.__highlightType),l=Ic(o.theme,this.__highlightType);return s!==l&&(s&&ya(r,s),l&&Xt(r,l)),i}static importJSON(n){return Bx().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setHighlightType(n.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(n){return this}isParentRequired(){return!0}createParentElementNode(){return ct()}}function Ic(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function Bx(t="",e){return kt(new Ja(t,e))}function jx(t){return t instanceof Ja}const Wx="data-language";function zx(t){return t.style.fontFamily.match("monospace")!==null}function Qu(t){let e=t.parentElement;for(;e!==null;){if(zx(e))return!0;e=e.parentElement}return!1}const uE=H0([{$import:(t,e)=>t.$importChildren(e),match:Ge.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"}]),fE={$import:(t,e)=>[ct(e.getAttribute(Wx)).splice(0,0,t.$importChildren(e))],match:Ge.tag("pre"),name:"@lexical/code/pre"},dE={$import:(t,e,n)=>{const r=e.textContent||"";return/\r?\n/.test(r)||e.querySelector("br")!==null?[ct(e.getAttribute(Wx)).splice(0,0,t.$importChildren(e))]:n()},match:Ge.tag("code"),name:"@lexical/code/code-multiline"};function qs(t){if(!q(t))return!1;const e=t.style.fontFamily,n=t.style.whiteSpace;return typeof e=="string"&&/monospace/i.test(e)&&typeof n=="string"&&n.startsWith("pre")}function hE(t){let e=!1;const n=[];let r="",o=!1;const i=()=>{o&&(n.push(r),r="",o=!1)};for(const s of Array.from(t.childNodes))if(q(s))s.tagName==="DIV"?(i(),n.push(s.textContent||""),e=!0):s.tagName==="BR"?(i(),n.push(""),e=!0):(r+=s.textContent||"",o=!0);else if(vt(s)){const l=s.textContent||"";l.length>0&&(r+=l,o=!0)}return i(),e?n:null}Ge.tag("div"),Ge.tag("div","br");const gE={$import:(t,e,n)=>zx(e)?[ct().splice(0,0,t.$importChildren(e))]:Qu(e)?t.$importChildren(e):n(),match:Ge.tag("div"),name:"@lexical/code/div"};Ge.tag("table").classAll("js-file-line-container"),Ge.tag("td").classAll("js-file-line");function ef(t,e){const n={};for(const r of t){const o=e(r);o&&(n[o]?n[o].push(r):n[o]=[r])}return n}function pE(t){const e=ef(t,n=>n.type);return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const tm=/[!-/:-@[-`{-~\s]/;function nm(t){return t.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(e,n)=>String.fromCodePoint(Number(n)))}const mE=/^(\s*)(\d{1,})\.\s/,yE=/^(\s*)[-*+]\s/,xE=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,_E=/^(#{1,6})\s/,vE=/^>\s/,CE=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,bE=/^[ \t]*`{3,}$/,bi=us("mdListMarker",{parse:t=>typeof t=="string"&&/^[-*+]$/.test(t)?t:"-",resetOnCopyNode:!0}),rm=us("mdCodeFence",{parse:t=>typeof t=="string"&&/^`{3,}$/.test(t)?t:"```",resetOnCopyNode:!0}),wE=us("mdHardLineBreak",{parse:t=>typeof t=="string"&&/^(\\| {2,})$/.test(t)?t:"",resetOnCopyNode:!0});function SE(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];const e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function EE(t){const e=t.getChildren(),n=e.length-1,r=e[n];if(!D(r))return null;const o=r.getTextContent(),i=SE(o);if(i!==null){const[s,l]=i;return r.setTextContent(s),l}return/^ {2,}$/.test(o)&&function(s,l){for(let a=l-1;a>=0;a--){if(rt(s[a]))return!1;if(/\S/.test(s[a].getTextContent()))return!0}return!1}(e,n)?(r.setTextContent(""),o):null}function TE(t){const e=_t(),n=EE(t);return n!==null&&Oo(e,wE,n),e}const Kx=t=>(e,n,r,o)=>{const i=t(r);i.append(...n),e.replace(i),o||i.select(0,0)},Pd=t=>(e,n,r,o)=>{const i=e.getPreviousSibling(),s=e.getNextSibling(),l=Bt(t==="check"?r[3]==="x":void 0),a=r[0].trim()[0],c=t!=="bullet"&&t!=="check"||a!==bi.parse(a)?void 0:a;if(Z(s)&&s.getListType()===t){c&&Oo(s,bi,c);const f=s.getFirstChild();f!==null?f.insertBefore(l):s.append(l),t==="number"&&s.setStart(Number(r[2])),e.remove()}else if(Z(i)&&i.getListType()===t)c&&Oo(i,bi,c),i.append(l),e.remove();else{const f=Dt(t,t==="number"?Number(r[2]):void 0);c&&Oo(f,bi,c),f.append(l),e.replace(f)}l.append(...n),o||l.select(0,0);const u=function(f){const d=f.match(/\t/g),g=f.match(/ /g);let h=0;return d&&(h+=d.length),g&&(h+=Math.floor(g.length/4)),h}(r[1]);u&&l.setIndent(u)},Ua=(t,e,n,r)=>{const o=[],i=t.getChildren();let s=0;for(const l of i)if(Q(l)){if(l.getChildrenSize()===1){const g=l.getFirstChild();if(Z(g)){const h=Ua(g,e,n+1,r);h&&o.push(h);continue}}if(r&&!l.getChildren().some(g=>g.isSelected(r)))continue;const a=" ".repeat(4*n),c=t.getListType(),u=na(t,bi),f=c==="number"?`${t.getStart()+s}. `:c==="check"?`${u} [${l.getChecked()?"x":" "}] `:u+" ";let d=e(l);c!=="number"&&(d=d.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),o.push(a+f+d),s++}return o.join(` -`)},kE={dependencies:[xs],export:(t,e)=>{if(!ba(t))return null;const n=Number(t.getTag().slice(1));return"#".repeat(n)+" "+e(t)},regExp:_E,replace:Kx(t=>{const e="h"+t[1].length;return Yt(e)}),triggerOnEnter:!0,type:"element"},Jx={dependencies:[Ca],export:(t,e)=>{if(!_u(t))return null;const n=e(t).split(` +`)},J7=0,Co=[];function U7(t){var e=C.useRef([]),n=C.useRef([0,0]),r=C.useRef(),o=C.useState(J7++)[0],i=C.useState(tx)[0],s=C.useRef(t);C.useEffect(function(){s.current=t},[t]),C.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var p=g7([t.lockRef.current],(t.shards||[]).map(Hp),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=C.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!s.current.allowPinchZoom;var m=Us(p),x=n.current,v="deltaX"in p?p.deltaX:x[0]-m[0],_="deltaY"in p?p.deltaY:x[1]-m[1],S,E=p.target,b=Math.abs(v)>Math.abs(_)?"h":"v";if("touches"in p&&b==="h"&&E.type==="range")return!1;var w=window.getSelection(),k=w&&w.anchorNode,M=k?k===E||k.contains(E):!1;if(M)return!1;var A=Dp(b,E);if(!A)return!0;if(A?S=b:(S=b==="v"?"h":"v",A=Dp(b,E)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||_)&&(r.current=S),!S)return!0;var R=r.current||S;return W7(R,y,p,R==="h"?v:_)},[]),a=C.useCallback(function(p){var y=p;if(!(!Co.length||Co[Co.length-1]!==i)){var m="deltaY"in y?Fp(y):Us(y),x=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&z7(S.delta,m)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var v=(s.current.shards||[]).map(Hp).filter(Boolean).filter(function(S){return S.contains(y.target)}),_=v.length>0?l(y,v[0]):!s.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),c=C.useCallback(function(p,y,m,x){var v={name:p,delta:y,target:m,should:x,shadowParent:G7(m)};e.current.push(v),setTimeout(function(){e.current=e.current.filter(function(_){return _!==v})},1)},[]),u=C.useCallback(function(p){n.current=Us(p),r.current=void 0},[]),f=C.useCallback(function(p){c(p.type,Fp(p),p.target,l(p,t.lockRef.current))},[]),d=C.useCallback(function(p){c(p.type,Us(p),p.target,l(p,t.lockRef.current))},[]);C.useEffect(function(){return Co.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",a,vo),document.addEventListener("touchmove",a,vo),document.addEventListener("touchstart",u,vo),function(){Co=Co.filter(function(p){return p!==i}),document.removeEventListener("wheel",a,vo),document.removeEventListener("touchmove",a,vo),document.removeEventListener("touchstart",u,vo)}},[]);var g=t.removeScrollBar,h=t.inert;return C.createElement(C.Fragment,null,h?C.createElement(i,{styles:K7(o)}):null,g?C.createElement(R7,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function G7(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Z7=w7(ex,U7);var ix=C.forwardRef(function(t,e){return C.createElement(Ra,nn({},t,{ref:e,sideCar:Z7}))});ix.classNames=Ra.classNames;function sx(t){const e=t+"CollectionProvider",[n,r]=co(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:y,children:m}=p,x=C.useRef(null),v=C.useRef(new Map).current;return L.jsx(o,{scope:y,itemMap:v,collectionRef:x,children:m})};s.displayName=e;const l=t+"CollectionSlot",a=Zl(l),c=C.forwardRef((p,y)=>{const{scope:m,children:x}=p,v=i(l,m),_=Ze(y,v.collectionRef);return L.jsx(a,{ref:_,children:x})});c.displayName=l;const u=t+"CollectionItemSlot",f="data-radix-collection-item",d=Zl(u),g=C.forwardRef((p,y)=>{const{scope:m,children:x,...v}=p,_=C.useRef(null),S=Ze(y,_),E=i(u,m);return C.useEffect(()=>(E.itemMap.set(_,{ref:_,...v}),()=>void E.itemMap.delete(_))),L.jsx(d,{[f]:"",ref:S,children:x})});g.displayName=u;function h(p){const y=i(t+"CollectionConsumer",p);return C.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const v=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((E,b)=>v.indexOf(E.ref.current)-v.indexOf(b.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:g},h,r]}var q7=C.createContext(void 0);function Da(t){const e=C.useContext(q7);return t||e||"ltr"}var Oc=!1;function Y7(){const[t,e]=C.useState(Oc);return C.useEffect(()=>{Oc||(Oc=!0,e(!0))},[]),t}var lx=qo[" useSyncExternalStore ".trim().toString()];function X7(){return()=>{}}function Q7(){return lx(X7,()=>!0,()=>!1)}var e4=typeof lx=="function"?Q7:Y7,t4=Object.defineProperty,uo=(t,e)=>t4(t,"name",{value:e,configurable:!0}),Ac="rovingFocusGroup.onEntryFocus",n4={bubbles:!1,cancelable:!0},Fa="RovingFocusGroup",[Gu,ax,r4]=sx(Fa),[o4,Ha]=co(Fa,[r4]),[i4,s4]=o4(Fa),l4=C.forwardRef(uo(function(e,n){return L.jsx(Gu.Provider,{scope:e.__scopeRovingFocusGroup,children:L.jsx(Gu.Slot,{scope:e.__scopeRovingFocusGroup,children:L.jsx(a4,{...e,ref:n})})})},"RovingFocusGroup")),a4=C.forwardRef(uo(function(e,n){const{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,g=C.useRef(null),h=Ze(n,g),p=Da(s),[y,m]=cr({prop:l,defaultProp:a??null,onChange:c,caller:Fa}),[x,v]=C.useState(!1),_=fn(u),S=ax(r),E=C.useRef(!1),[b,w]=C.useState(0);return C.useEffect(()=>{const k=g.current;if(k)return k.addEventListener(Ac,_),()=>k.removeEventListener(Ac,_)},[_]),L.jsx(i4,{scope:r,orientation:o,dir:p,loop:i,currentTabStopId:y,onItemFocus:C.useCallback(k=>m(k),[m]),onItemShiftTab:C.useCallback(()=>v(!0),[]),onFocusableItemAdd:C.useCallback(()=>w(k=>k+1),[]),onFocusableItemRemove:C.useCallback(()=>w(k=>k-1),[]),children:L.jsx(Ie.div,{tabIndex:x||b===0?-1:0,"data-orientation":o,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:pe(e.onMouseDown,()=>{E.current=!0}),onFocus:pe(e.onFocus,k=>{const M=!E.current;if(k.target===k.currentTarget&&M&&!x){const A=new CustomEvent(Ac,n4);if(k.currentTarget.dispatchEvent(A),!A.defaultPrevented){const R=S().filter(B=>B.focusable),F=R.find(B=>B.active),H=R.find(B=>B.id===y),z=[F,H,...R].filter(Boolean).map(B=>B.ref.current);vd(z,f)}}E.current=!1}),onBlur:pe(e.onBlur,()=>v(!1))})})},"RovingFocusGroupImpl")),c4="RovingFocusGroupItem",u4=C.forwardRef(uo(function(e,n){const{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:l,...a}=e,c=Na(),u=s||c,f=s4(c4,r),d=f.currentTabStopId===u,g=ax(r),{onFocusableItemAdd:h,onFocusableItemRemove:p,currentTabStopId:y}=f,m=e4();return et(()=>{if(!(!m||!o))return h(),()=>p()},[m,o,h,p]),C.useEffect(()=>{if(!(m||!o))return h(),()=>p()},[m,o,h,p]),L.jsx(Gu.ItemSlot,{scope:r,id:u,focusable:o,active:i,children:L.jsx(Ie.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...a,ref:n,onMouseDown:pe(e.onMouseDown,x=>{o?f.onItemFocus(u):x.preventDefault()}),onFocus:pe(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:pe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const v=ux(x,f.orientation,f.dir);if(v!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let S=g().filter(E=>E.focusable).map(E=>E.ref.current);if(v==="last")S.reverse();else if(v==="prev"||v==="next"){v==="prev"&&S.reverse();const E=S.indexOf(x.currentTarget);S=f.loop?fx(S,E+1):S.slice(E+1)}setTimeout(()=>vd(S))}}),children:typeof l=="function"?l({isCurrentTabStop:d,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),f4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cx(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}uo(cx,"getDirectionAwareKey");function ux(t,e,n){const r=cx(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return f4[r]}uo(ux,"getFocusIntent");function vd(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}uo(vd,"focusFirst");function fx(t,e){return t.map((n,r)=>t[(e+r)%t.length])}uo(fx,"wrapArray");var dx=l4,hx=u4,d4=Object.defineProperty,h4=(t,e)=>d4(t,"name",{value:e,configurable:!0}),g4="Toggle",p4=C.forwardRef(h4(function(e,n){const{pressed:r,defaultPressed:o,onPressedChange:i,...s}=e,[l,a]=cr({prop:r,onChange:i,defaultProp:o??!1,caller:g4});return L.jsx(Ie.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:n,onClick:pe(e.onClick,()=>{e.disabled||a(!l)})})},"Toggle")),m4=Object.defineProperty,ur=(t,e)=>m4(t,"name",{value:e,configurable:!0}),ai="ToggleGroup",[gx,px]=co(ai,[Ha]),mx=Ha(),y4=C.forwardRef(ur(function(e,n){const{type:r,...o}=e;if(r==="single"){const i=o;return L.jsx(x4,{role:"radiogroup",...i,ref:n})}if(r==="multiple"){const i=o;return L.jsx(_4,{role:"toolbar",...i,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${ai}\``)},"ToggleGroup")),[yx,xx]=gx(ai),x4=C.forwardRef(ur(function(e,n){const{value:r,defaultValue:o,onValueChange:i=ur(()=>{},"onValueChange"),...s}=e,[l,a]=cr({prop:r,defaultProp:o??"",onChange:i,caller:ai});return L.jsx(yx,{scope:e.__scopeToggleGroup,type:"single",value:C.useMemo(()=>l?[l]:[],[l]),onItemActivate:a,onItemDeactivate:C.useCallback(()=>a(""),[a]),children:L.jsx(_x,{...s,ref:n})})},"ToggleGroupImplSingle")),_4=C.forwardRef(ur(function(e,n){const{value:r,defaultValue:o,onValueChange:i=ur(()=>{},"onValueChange"),...s}=e,[l,a]=cr({prop:r,defaultProp:o??[],onChange:i,caller:ai}),c=C.useCallback(f=>a((d=[])=>[...d,f]),[a]),u=C.useCallback(f=>a((d=[])=>d.filter(g=>g!==f)),[a]);return L.jsx(yx,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:c,onItemDeactivate:u,children:L.jsx(_x,{...s,ref:n})})},"ToggleGroupImplMultiple")),[v4,C4]=gx(ai),_x=C.forwardRef(ur(function(e,n){const{__scopeToggleGroup:r,disabled:o=!1,rovingFocus:i=!0,orientation:s,dir:l,loop:a=!0,...c}=e,u=mx(r),f=Da(l),d={dir:f,...c};return L.jsx(v4,{scope:r,rovingFocus:i,disabled:o,children:i?L.jsx(dx,{asChild:!0,...u,orientation:s,dir:f,loop:a,children:L.jsx(Ie.div,{...d,ref:n})}):L.jsx(Ie.div,{...d,ref:n})})},"ToggleGroupImpl")),Zu="ToggleGroupItem",b4=C.forwardRef(ur(function(e,n){const r=xx(Zu,e.__scopeToggleGroup),o=C4(Zu,e.__scopeToggleGroup),i=mx(e.__scopeToggleGroup),s=r.value.includes(e.value),l=o.disabled||e.disabled,a={...e,pressed:s,disabled:l},c=C.useRef(null);return o.rovingFocus?L.jsx(hx,{asChild:!0,...i,focusable:!l,active:s,ref:c,children:L.jsx(Vp,{...a,ref:n})}):L.jsx(Vp,{...a,ref:n})},"ToggleGroupItem")),Vp=C.forwardRef(ur(function(e,n){const{__scopeToggleGroup:r,value:o,...i}=e,s=xx(Zu,r),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?l:void 0;return L.jsx(p4,{...a,...i,ref:n,onPressedChange:c=>{c?s.onItemActivate(o):s.onItemDeactivate(o)}})},"ToggleGroupItemImpl")),w4=Object.defineProperty,Va=(t,e)=>w4(t,"name",{value:e,configurable:!0}),vx="Toolbar",[S4]=co(vx,[Ha,px]),Cx=Ha(),bx=px(),[E4,T4]=S4(vx),k4=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,orientation:o="horizontal",dir:i,loop:s=!0,...l}=e,a=Cx(r),c=Da(i);return L.jsx(E4,{scope:r,orientation:o,dir:c,children:L.jsx(dx,{asChild:!0,...a,orientation:o,dir:c,loop:s,children:L.jsx(Ie.div,{role:"toolbar","aria-orientation":o,dir:c,...l,ref:n})})})},"Toolbar")),wx=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,...o}=e,i=Cx(r);return L.jsx(hx,{asChild:!0,...i,focusable:!e.disabled,children:L.jsx(Ie.button,{type:"button",...o,ref:n})})},"ToolbarButton")),N4="ToolbarToggleGroup",M4=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,...o}=e,i=T4(N4,r),s=bx(r);return L.jsx(y4,{"data-orientation":i.orientation,dir:i.dir,...s,...o,ref:n,rovingFocus:!1})},"ToolbarToggleGroup")),O4=C.forwardRef(Va(function(e,n){const{__scopeToolbar:r,...o}=e,i=bx(r),s={__scopeToolbar:e.__scopeToolbar};return L.jsx(wx,{asChild:!0,...s,children:L.jsx(b4,{...i,...o,ref:n})})},"ToolbarToggleItem")),A4=k4,P4=wx,Cd=M4,L4=O4;const Bp=new Set(["http:","https:","mailto:","sms:","tel:"]);class ci extends ft{constructor(n="",r={},o){super(o);P(this,"__url");P(this,"__target");P(this,"__rel");P(this,"__title");const{target:i=null,rel:s=null,title:l=null}=r;this.__url=n,this.__target=i,this.__rel=s,this.__title=l}static getType(){return"link"}static clone(n){return new ci(n.__url,{rel:n.__rel,target:n.__target,title:n.__title},n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__url=n.__url,this.__rel=n.__rel,this.__target=n.__target,this.__title=n.__title}createDOM(n){const r=Te().createElement("a");return this.updateLinkDOM(null,r,n),Xt(r,n.theme.link),r}updateLinkDOM(n,r,o){if(Z1(r)){n&&n.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,l=this[s];n&&n[s]===l||(l?r[i]=l:r.removeAttribute(i))}}}updateDOM(n,r,o){return this.updateLinkDOM(n,r,o),!1}static importDOM(){return{a:n=>({conversion:$4,priority:1})}}static importJSON(n){return Ba().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setURL(n.url).setRel(n.rel||null).setTarget(n.target||null).setTitle(n.title||null)}sanitizeUrl(n){const r=n;n=zp(n);try{const o=new URL(zp(n));if(!Bp.has(o.protocol))return"about:blank"}catch{const i=r.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(i!=null&&!Bp.has(`${i[1].toLowerCase()}:`))return"about:blank"}return n}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(n){const r=this.getWritable();return r.__url=n,r}getTarget(){return this.getLatest().__target}setTarget(n){const r=this.getWritable();return r.__target=n,r}getRel(){return this.getLatest().__rel}setRel(n){const r=this.getWritable();return r.__rel=n,r}getTitle(){return this.getLatest().__title}setTitle(n){const r=this.getWritable();return r.__title=n,r}insertNewAfter(n,r=!0){const o=lt(this);return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(n,r,o){if(!$(r))return!1;const i=r.anchor.getNode(),s=r.focus.getNode();return(this.is(i)||this.isParentOf(i))&&(this.is(s)||this.isParentOf(s))&&r.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}shouldMergeAdjacentLink(n){return this.getType()===n.getType()&&this.__url===n.__url&&this.__target===n.__target&&this.__rel===n.__rel&&this.__title===n.__title}}function $4(t){let e=null;if(Z1(t)){const n=t.textContent;(n!==null&&n!==""||t.children.length>0)&&(e=Ba(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}))}return{node:e}}function Ba(t="",e){return kt(new ci(t,e))}function jp(t){return t instanceof ci}class ja extends ci{constructor(n="",r={},o){super(n,r,o);P(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}afterCloneFrom(n){super.afterCloneFrom(n),this.__isUnlinked=n.__isUnlinked}static getType(){return"autolink"}static clone(n){return new ja(n.__url,{isUnlinked:n.__isUnlinked,rel:n.__rel,target:n.__target,title:n.__title},n.__key)}shouldMergeAdjacentLink(n){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(n){const r=this.getWritable();return r.__isUnlinked=n,r}createDOM(n){return this.__isUnlinked?Te().createElement("span"):super.createDOM(n)}updateDOM(n,r,o){return super.updateDOM(n,r,o)||n.__isUnlinked!==this.__isUnlinked}static importJSON(n){return Wp().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setIsUnlinked(n.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(n,r=!0){const o=Wp(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,r),o}}function Wp(t="",e){return kt(new ja(t,e))}function I4(t){return t instanceof ja}const R4=/^\+?[0-9\s()-]{5,}$/;function zp(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:R4.test(t)?`tel:${t}`:`https://${t}`}Ge.tag("a");const D4={testNode:"blockquote",visitNode({actions:t}){t.addAndStepInto(ao())}},F4={testLexicalNode:_u,visitLexicalNode:({actions:t})=>{t.addAndStepInto("blockquote")}},H4=Xo({init(t){t.pubIn({[ld]:"quote",[ts]:D4,[Sa]:Ca,[Ea]:F4})}});function Kp(){let t=Ho;return{publish:()=>{t()},subscribe:e=>{t=e}}}function V4(t,e,n,r){const o=[...t].sort((s,l)=>l.priority-s.priority),i=n??"";return o.find(s=>s.match(e??"",i))??o.find(s=>s.match(r??"",i))}var B4=Object.defineProperty,j4=(t,e,n)=>e in t?B4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gn=(t,e,n)=>(j4(t,typeof e!="symbol"?e+"":e,n),n);class Wa extends ds{constructor(e,n,r,o){super(o),Gn(this,"__code"),Gn(this,"__meta"),Gn(this,"__language"),Gn(this,"__focusEmitter",Kp()),Gn(this,"setCode",i=>{i!==this.__code&&(this.getWritable().__code=i)}),Gn(this,"setMeta",i=>{i!==this.__meta&&(this.getWritable().__meta=i)}),Gn(this,"setLanguage",i=>{i!==this.__language&&(this.getWritable().__language=i)}),Gn(this,"select",()=>{this.__focusEmitter.publish()}),this.__code=e,this.__meta=r,this.__language=n}static getType(){return"codeblock"}static clone(e){return new Wa(e.__code,e.__language,e.__meta,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__code=e.__code,this.__meta=e.__meta,this.__language=e.__language,this.__focusEmitter=Kp()}static importJSON(e){const n=typeof e.code=="string"?e.code:"",r=typeof e.language=="string"?e.language:"",o=typeof e.meta=="string"?e.meta:"";return bd({code:n,language:r,meta:o})}static importDOM(){return{pre:()=>({conversion:J4,priority:3})}}exportJSON(){return{code:this.getCode(),language:this.getLanguage(),meta:this.getMeta(),type:"codeblock",version:1}}createDOM(e,n){return document.createElement("div")}updateDOM(){return!1}getCode(){return this.__code}getMeta(){return this.__meta}getLanguage(){return this.__language}decorate(e){return N.createElement(K4,{parentEditor:e,code:this.getCode(),meta:this.getMeta(),language:this.getLanguage(),codeBlockNode:this,nodeKey:this.getKey(),focusEmitter:this.__focusEmitter})}isInline(){return!1}}const W4=N.createContext(null),z4=({parentEditor:t,lexicalNode:e,children:n})=>{const r=N.useMemo(()=>({lexicalNode:e,parentEditor:t,setCode:o=>{t.update(()=>{e.setCode(o),setTimeout(()=>{t.dispatchCommand(Xf,void 0)},0)})},setLanguage:o=>{t.update(()=>{e.setLanguage(o)})},setMeta:o=>{t.update(()=>{e.setMeta(o)})}}),[e,t]);return N.createElement(W4.Provider,{value:r},n)},K4=t=>{const e=ln(Ay),n=ln(Py),r=V4(e,t.language,t.meta,n);if(!r)throw new Error(`No CodeBlockEditor registered for language=${t.language} meta=${t.meta}`);const o=r.Editor,{codeBlockNode:i,parentEditor:s,...l}=t;return N.createElement(z4,{parentEditor:t.parentEditor,lexicalNode:t.codeBlockNode},N.createElement(o,{...l}))};function bd(t){const{code:e="",language:n="",meta:r=""}=t;return new Wa(e,n,r)}function J4(t){const e=t,n=e.textContent,r=t.getAttribute("class")??"",o=t.getAttribute("data-language")??"",i=/language-(\w+)/.exec(r),s=i?i[1]:o,l=e.getAttribute("data-meta")??"";return{node:bd({code:n,language:s,meta:l})}}function Jp(t,[e,n]){return Math.min(n,Math.max(e,t))}function U4(t){const e=C.useRef({value:t,previous:t});return C.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var G4=Object.defineProperty,Z4=(t,e)=>G4(t,"name",{value:e,configurable:!0}),Sx=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),q4=C.forwardRef(Z4(function(e,n){return L.jsx(Ie.span,{...e,ref:n,style:{...Sx,...e.style}})},"VisuallyHidden")),Y4=q4,X4=Object.defineProperty,Ee=(t,e)=>X4(t,"name",{value:e,configurable:!0}),Q4=[" ","Enter","ArrowUp","ArrowDown"],e6=[" ","Enter"],Zo="Select",[za,wd,t6]=sx(Zo),[fo]=co(Zo,[t6,$a]),Sd=$a(),[n6,yr]=fo(Zo),[r6,o6]=fo(Zo);function Ex(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:c,name:u,autoComplete:f,disabled:d,required:g,form:h,internal_do_not_use_render:p}=t,y=Sd(e),[m,x]=C.useState(null),[v,_]=C.useState(null),[S,E]=C.useState(!1),b=Da(c),[w,k]=cr({prop:r,defaultProp:o??!1,onChange:i,caller:Zo}),[M,A]=cr({prop:s,defaultProp:l,onChange:a,caller:Zo}),R=C.useRef(null),F=C.useRef(M);C.useEffect(()=>{const xe=h?m==null?void 0:m.ownerDocument.getElementById(h):m==null?void 0:m.form;if(xe instanceof HTMLFormElement){const de=Ee(()=>A(F.current),"reset");return xe.addEventListener("reset",de),()=>xe.removeEventListener("reset",de)}},[h,m,A]);const H=m?!!h||!!m.closest("form"):!0,[W,z]=C.useState(new Set),B=Na(),K=Array.from(W).map(xe=>xe.props.value).join(";"),J=C.useCallback(xe=>{z(de=>new Set(de).add(xe))},[]),X=C.useCallback(xe=>{z(de=>{const Ve=new Set(de);return Ve.delete(xe),Ve})},[]),ie={required:g,trigger:m,onTriggerChange:x,valueNode:v,onValueNodeChange:_,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:B,value:M,onValueChange:A,open:w,onOpenChange:k,dir:b,triggerPointerDownPosRef:R,disabled:d,name:u,autoComplete:f,form:h,nativeOptions:W,nativeSelectKey:K,isFormControl:H};return L.jsx(B5,{...y,children:L.jsx(n6,{scope:e,...ie,children:L.jsx(za.Provider,{scope:e,children:L.jsx(r6,{scope:e,onNativeOptionAdd:J,onNativeOptionRemove:X,children:kx(p)?p(ie):n})})})})}Ee(Ex,"SelectProvider");var i6=Ee(t=>{const{__scopeSelect:e,children:n,...r}=t;return L.jsx(Ex,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:o})=>L.jsxs(L.Fragment,{children:[n,o?L.jsx(O6,{__scopeSelect:e}):null]})})},"Select"),s6="SelectTrigger",l6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,disabled:o=!1,...i}=e,s=Sd(r),l=yr(s6,r),a=l.disabled||o,c=Ze(n,l.onTriggerChange),u=wd(r),f=C.useRef("touch"),[d,g,h]=Ed(y=>{const m=u().filter(_=>!_.disabled),x=m.find(_=>_.value===l.value),v=Td(m,y,x);v!==void 0&&l.onValueChange(v.value)}),p=Ee(y=>{a||(l.onOpenChange(!0),h()),y&&(l.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})},"handleOpen");return L.jsx(j5,{asChild:!0,...s,children:L.jsx(Ie.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":bs(l.value)?"":void 0,...i,ref:c,onClick:pe(i.onClick,y=>{y.currentTarget.focus(),f.current!=="mouse"&&p(y)}),onPointerDown:pe(i.onPointerDown,y=>{f.current=y.pointerType;const m=y.target;m.hasPointerCapture(y.pointerId)&&m.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(p(y),y.preventDefault())}),onKeyDown:pe(i.onKeyDown,y=>{const m=d.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&g(y.key),!(m&&y.key===" ")&&Q4.includes(y.key)&&(p(),y.preventDefault())})})})},"SelectTrigger")),a6="SelectValue",c6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,className:o,style:i,children:s,placeholder:l="",...a}=e,c=yr(a6,r),{onValueNodeHasChildrenChange:u}=c,f=s!==void 0,d=Ze(n,c.onValueNodeChange);et(()=>{u(f)},[u,f]);const g=bs(c.value);return L.jsx(Ie.span,{...a,asChild:g?!1:a.asChild,ref:d,style:{pointerEvents:"none"},children:L.jsx(C.Fragment,{children:g?l:s},g?"placeholder":"value")})},"SelectValue")),u6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,children:o,...i}=e;return L.jsx(Ie.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})},"SelectIcon")),f6="SelectPortal",[d6,h6]=fo(f6,{forceMount:void 0}),g6=Ee(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return L.jsx(d6,{scope:t.__scopeSelect,forceMount:n,children:L.jsx(z5,{asChild:!0,...r})})},"SelectPortal"),qr="SelectContent",p6=C.forwardRef(Ee(function(e,n){const r=h6(qr,e.__scopeSelect),{forceMount:o=r.forceMount,...i}=e,s=yr(qr,e.__scopeSelect),[l,a]=C.useState();return et(()=>{a(new DocumentFragment)},[]),L.jsx(_d,{present:o||s.open,children:({present:c})=>c?L.jsx(x6,{...i,ref:n}):L.jsx(m6,{...i,fragment:l})})},"SelectContent")),m6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,children:o,fragment:i}=e;return i?nr.createPortal(L.jsx(Tx,{scope:r,children:L.jsx(za.Slot,{scope:r,children:L.jsx("div",{ref:n,children:o})})}),i):null},"SelectContentFragment")),Jt=10,[Tx,Ka]=fo(qr),y6=Zl("SelectContent.RemoveScroll"),x6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r}=e,{position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:l,side:a,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:m,...x}=e,v=yr(qr,r),[_,S]=C.useState(null),[E,b]=C.useState(null),w=Ze(n,S),[k,M]=C.useState(null),[A,R]=C.useState(null),F=wd(r),[H,W]=C.useState(!1),z=C.useRef(!1);C.useEffect(()=>{if(_)return h7(_)},[_]),F8();const B=C.useCallback(G=>{const[se,...Oe]=F().map(ge=>ge.ref.current),[le]=Oe.slice(-1),ue=document.activeElement;for(const ge of G)if(ge===ue||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===se&&E&&(E.scrollTop=0),ge===le&&E&&(E.scrollTop=E.scrollHeight),ge==null||ge.focus(),document.activeElement!==ue))return},[F,E]),K=C.useCallback(()=>B([k,_]),[B,k,_]);C.useEffect(()=>{H&&K()},[H,K]);const{onOpenChange:J,triggerPointerDownPosRef:X}=v;C.useEffect(()=>{if(_){let G={x:0,y:0};const se=Ee(le=>{var ue,ge;G={x:Math.abs(Math.round(le.pageX)-(((ue=X.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(le.pageY)-(((ge=X.current)==null?void 0:ge.y)??0))}},"handlePointerMove"),Oe=Ee(le=>{G.x<=10&&G.y<=10?le.preventDefault():le.composedPath().includes(_)||J(!1),document.removeEventListener("pointermove",se),X.current=null},"handlePointerUp");return X.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Oe,{capture:!0})}}},[_,J,X]),C.useEffect(()=>{const G=Ee(()=>J(!1),"close");return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[J]);const[ie,xe]=Ed(G=>{const se=F().filter(ue=>!ue.disabled),Oe=se.find(ue=>ue.ref.current===document.activeElement),le=Td(se,G,Oe);le&&setTimeout(()=>{var ue;return(ue=le.ref.current)==null?void 0:ue.focus()})}),de=C.useCallback((G,se,Oe)=>{const le=!z.current&&!Oe;(v.value!==void 0&&v.value===se||le)&&(M(G),le&&(z.current=!0))},[v.value]),Ve=C.useCallback(()=>_==null?void 0:_.focus(),[_]),qe=C.useCallback((G,se,Oe)=>{const le=!z.current&&!Oe;(v.value!==void 0&&v.value===se||le)&&R(G)},[v.value]),oe=o==="popper"?Up:_6,me=oe===Up?{side:a,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:g,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:m}:{};return L.jsx(Tx,{scope:r,content:_,viewport:E,onViewportChange:b,itemRefCallback:de,selectedItem:k,onItemLeave:Ve,itemTextRefCallback:qe,focusSelectedItem:K,selectedItemText:A,position:o,isPositioned:H,searchRef:ie,children:L.jsx(ix,{as:y6,allowPinchZoom:!0,children:L.jsx(V8,{asChild:!0,trapped:v.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:pe(i,G=>{var se;(se=v.trigger)==null||se.focus({preventScroll:!0}),G.preventDefault()}),children:L.jsx(m5,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:L.jsx(oe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:G=>G.preventDefault(),...x,...me,onPlaced:()=>W(!0),ref:w,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:pe(x.onKeyDown,G=>{const se=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!se&&G.key.length===1&&xe(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let le=F().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(G.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ue=G.target,ge=le.indexOf(ue);le=le.slice(ge+1)}setTimeout(()=>B(le)),G.preventDefault()}})})})})})})},"SelectContentImpl")),_6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,onPlaced:o,...i}=e,s=yr(qr,r),l=Ka(qr,r),[a,c]=C.useState(null),[u,f]=C.useState(null),d=Ze(n,f),g=wd(r),h=C.useRef(!1),p=C.useRef(!0),{viewport:y,selectedItem:m,selectedItemText:x,focusSelectedItem:v}=l,_=C.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&y&&m&&x){const w=s.trigger.getBoundingClientRect(),k=u.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),A=x.getBoundingClientRect();if(s.dir!=="rtl"){const ue=A.left-k.left,ge=M.left-ue,Nt=w.left-ge,Mt=w.width+Nt,en=Math.max(Mt,k.width),Kn=window.innerWidth-Jt,Jn=Jp(ge,[Jt,Math.max(Jt,Kn-en)]);a.style.minWidth=Mt+"px",a.style.left=Jn+"px"}else{const ue=k.right-A.right,ge=window.innerWidth-M.right-ue,Nt=window.innerWidth-w.right-ge,Mt=w.width+Nt,en=Math.max(Mt,k.width),Kn=window.innerWidth-Jt,Jn=Jp(ge,[Jt,Math.max(Jt,Kn-en)]);a.style.minWidth=Mt+"px",a.style.right=Jn+"px"}const R=g(),F=window.innerHeight-Jt*2,H=y.scrollHeight,W=window.getComputedStyle(u),z=parseInt(W.borderTopWidth,10),B=parseInt(W.paddingTop,10),K=parseInt(W.borderBottomWidth,10),J=parseInt(W.paddingBottom,10),X=z+B+H+J+K,ie=Math.min(m.offsetHeight*5,X),xe=window.getComputedStyle(y),de=parseInt(xe.paddingTop,10),Ve=parseInt(xe.paddingBottom,10),qe=w.top+w.height/2-Jt,oe=F-qe,me=m.offsetHeight/2,G=m.offsetTop+me,se=z+B+G,Oe=X-se;if(se<=qe){const ue=R.length>0&&m===R[R.length-1].ref.current;a.style.bottom="0px";const ge=u.clientHeight-y.offsetTop-y.offsetHeight,Nt=Math.max(oe,me+(ue?Ve:0)+ge+K),Mt=se+Nt;a.style.height=Mt+"px"}else{const ue=R.length>0&&m===R[0].ref.current;a.style.top="0px";const Nt=Math.max(qe,z+y.offsetTop+(ue?de:0)+me)+Oe;a.style.height=Nt+"px",y.scrollTop=se-qe+y.offsetTop}a.style.margin=`${Jt}px 0`,a.style.minHeight=ie+"px",a.style.maxHeight=F+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[g,s.trigger,s.valueNode,a,u,y,m,x,s.dir,o]);et(()=>_(),[_]);const[S,E]=C.useState();et(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const b=C.useCallback(w=>{w&&p.current===!0&&(_(),v==null||v(),p.current=!1)},[_,v]);return L.jsx(v6,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:b,children:L.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:L.jsx(Ie.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),Up=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,align:o="start",collisionPadding:i=Jt,...s}=e,l=Sd(r);return L.jsx(W5,{...l,...s,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[v6,C6]=fo(qr,{}),Gp="SelectViewport",b6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,nonce:o,...i}=e,s=Ka(Gp,r),l=C6(Gp,r),a=Ze(n,s.onViewportChange),c=C.useRef(0);return L.jsxs(L.Fragment,{children:[L.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),L.jsx(za.Slot,{scope:r,children:L.jsx(Ie.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:pe(i.onScroll,u=>{const f=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:g}=l;if(g!=null&&g.current&&d){const h=Math.abs(c.current-f.scrollTop);if(h>0){const p=window.innerHeight-Jt*2,y=parseFloat(d.style.minHeight),m=parseFloat(d.style.height),x=Math.max(y,m);if(x0?S:0,d.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})},"SelectViewport")),w6="SelectGroup",[iT,sT]=fo(w6),qu="SelectItem",[S6,E6]=fo(qu),T6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,value:o,disabled:i=!1,textValue:s,...l}=e,a=yr(qu,r),c=Ka(qu,r),u=a.value===o,[f,d]=C.useState(s??""),[g,h]=C.useState(!1),p=fn(_=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,_,o,i)}),y=Ze(n,p),m=Na(),x=C.useRef("touch"),v=Ee(()=>{i||(a.onValueChange(o),a.onOpenChange(!1))},"handleSelect");return L.jsx(S6,{scope:r,value:o,disabled:i,textId:m,isSelected:u,onItemTextChange:C.useCallback(_=>{d(S=>S||((_==null?void 0:_.textContent)??"").trim())},[]),children:L.jsx(za.ItemSlot,{scope:r,value:o,disabled:i,textValue:f,children:L.jsx(Ie.div,{role:"option","aria-labelledby":m,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:y,onFocus:pe(l.onFocus,()=>h(!0)),onBlur:pe(l.onBlur,()=>h(!1)),onClick:pe(l.onClick,()=>{x.current!=="mouse"&&v()}),onPointerUp:pe(l.onPointerUp,()=>{x.current==="mouse"&&v()}),onPointerDown:pe(l.onPointerDown,_=>{x.current=_.pointerType}),onPointerMove:pe(l.onPointerMove,_=>{var S;x.current=_.pointerType,i?(S=c.onItemLeave)==null||S.call(c):x.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:pe(l.onPointerLeave,_=>{var S;_.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:pe(l.onKeyDown,_=>{var E;i||_.target!==_.currentTarget||((E=c.searchRef)==null?void 0:E.current)!==""&&_.key===" "||(e6.includes(_.key)&&v(),_.key===" "&&_.preventDefault())})})})})},"SelectItem")),Gs="SelectItemText",k6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,className:o,style:i,...s}=e,l=yr(Gs,r),a=Ka(Gs,r),c=E6(Gs,r),u=o6(Gs,r),[f,d]=C.useState(null),g=fn(v=>{var _;return(_=a.itemTextRefCallback)==null?void 0:_.call(a,v,c.value,c.disabled)}),h=Ze(n,d,c.onItemTextChange,g),p=f==null?void 0:f.textContent,y=C.useMemo(()=>L.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return et(()=>(m(y),()=>x(y)),[m,x,y]),L.jsxs(L.Fragment,{children:[L.jsx(Ie.span,{id:c.textId,...s,ref:h}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!bs(l.value)?nr.createPortal(s.children,l.valueNode):null]})},"SelectItemText")),N6=C.forwardRef(Ee(function(e,n){const{__scopeSelect:r,...o}=e;return L.jsx(Ie.div,{"aria-hidden":!0,...o,ref:n})},"SelectSeparator")),M6="SelectBubbleInput",O6=C.forwardRef(Ee(function({__scopeSelect:e,...n},r){const o=yr(M6,e),{value:i,onValueChange:s,required:l,disabled:a,name:c,autoComplete:u,form:f}=o,{nativeOptions:d,nativeSelectKey:g}=o,h=C.useRef(null),p=Ze(r,h),y=i??"",m=U4(y),x=Array.from(d).some(v=>(v.props.value??"")==="");return C.useEffect(()=>{const v=h.current;if(!v)return;const _=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(_,"value").set;if(m!==y&&E){const b=new Event("change",{bubbles:!0});E.call(v,y),v.dispatchEvent(b)}},[m,y]),L.jsxs(Ie.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:c,autoComplete:u,disabled:a,form:f,onChange:v=>s(v.target.value),...n,style:{...Sx,...n.style},ref:p,defaultValue:y,children:[bs(i)&&!x?L.jsx("option",{value:""}):null,Array.from(d)]},g)},"SelectBubbleInput"));function kx(t){return typeof t=="function"}Ee(kx,"isFunction");function bs(t){return t===""||t===void 0}Ee(bs,"shouldShowPlaceholder");function Ed(t){const e=fn(t),n=C.useRef(""),r=C.useRef(0),o=C.useCallback(s=>{const l=n.current+s;e(l),Ee(function a(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>a(""),1e3))},"updateSearch")(l)},[e]),i=C.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}Ee(Ed,"useTypeaheadSearch");function Td(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=Nx(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const a=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}Ee(Td,"findNextItem");function Nx(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Ee(Nx,"wrapArray");var A6=Object.defineProperty,Ue=(t,e)=>A6(t,"name",{value:e,configurable:!0}),[kd]=co("Tooltip",[$a]),Nd=$a(),P6="TooltipProvider",L6=700,Yu="tooltip.open",[$6,Md]=kd(P6),I6=Ue(t=>{const{__scopeTooltip:e,delayDuration:n=L6,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=t,s=C.useRef(!0),l=C.useRef(!1),a=C.useRef(0);return C.useEffect(()=>{const c=a.current;return()=>window.clearTimeout(c)},[]),L.jsx($6,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:C.useCallback(()=>{r<=0||(window.clearTimeout(a.current),s.current=!1)},[r]),onClose:C.useCallback(()=>{r<=0||(window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(c=>{l.current=c},[]),disableHoverableContent:o,children:i})},"TooltipProvider"),Xu="Tooltip",[R6,ws]=kd(Xu),D6=Ue(t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=t,a=Md(Xu,t.__scopeTooltip),c=Nd(e),[u,f]=C.useState(null),[d,g]=C.useState(void 0),h=Na(),p=C.useRef(0),y=s??a.disableHoverableContent,m=l??a.delayDuration,x=C.useRef(!1),[v,_]=cr({prop:r,defaultProp:o??!1,onChange:Ue(M=>{M?(a.onOpen(),document.dispatchEvent(new CustomEvent(Yu))):a.onClose(),i==null||i(M)},"onChange"),caller:Xu}),S=C.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),E=C.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,_(!0)},[_]),b=C.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),w=C.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,_(!0),p.current=0},m)},[m,_]);C.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]);const k=d??h;return L.jsx(B5,{...c,children:L.jsx(R6,{scope:e,contentId:k,setContentId:g,open:v,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:C.useCallback(()=>{a.isOpenDelayedRef.current?w():E()},[a.isOpenDelayedRef,w,E]),onTriggerLeave:C.useCallback(()=>{y?b():(window.clearTimeout(p.current),p.current=0)},[b,y]),onOpen:E,onClose:b,disableHoverableContent:y,children:n})})},"Tooltip"),Zp="TooltipTrigger",F6=C.forwardRef(Ue(function(e,n){const{__scopeTooltip:r,...o}=e,i=ws(Zp,r),s=Md(Zp,r),l=Nd(r),a=C.useRef(null),c=Ze(n,a,i.onTriggerChange),u=C.useRef(!1),f=C.useRef(!1),d=C.useCallback(()=>u.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),L.jsx(j5,{asChild:!0,...l,children:L.jsx(Ie.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...o,ref:c,onPointerMove:pe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:pe(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:pe(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:pe(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:pe(e.onBlur,i.onClose),onClick:pe(e.onClick,i.onClose)})})},"TooltipTrigger")),Mx="TooltipPortal",[H6,V6]=kd(Mx,{forceMount:void 0}),B6=Ue(t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,i=ws(Mx,e);return L.jsx(H6,{scope:e,forceMount:n,children:L.jsx(_d,{present:n||i.open,children:L.jsx(z5,{asChild:!0,container:o,children:r})})})},"TooltipPortal"),ss="TooltipContent",j6=C.forwardRef(Ue(function(e,n){const r=V6(ss,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...s}=e,l=ws(ss,e.__scopeTooltip);return L.jsx(_d,{present:o||l.open,children:l.disableHoverableContent?L.jsx(Ox,{side:i,...s,ref:n}):L.jsx(W6,{side:i,...s,ref:n})})},"TooltipContent")),W6=C.forwardRef(Ue(function(e,n){const r=ws(ss,e.__scopeTooltip),o=Md(ss,e.__scopeTooltip),i=C.useRef(null),s=Ze(n,i),[l,a]=C.useState(null),{trigger:c,onClose:u}=r,f=i.current,{onPointerInTransitChange:d}=o,g=C.useCallback(()=>{a(null),d(!1)},[d]),h=C.useCallback((p,y)=>{const m=p.currentTarget,x={x:p.clientX,y:p.clientY},v=Ax(x,m.getBoundingClientRect()),_=Px(x,v),S=Lx(y.getBoundingClientRect()),E=Ix([..._,...S]);a(E),d(!0)},[d]);return C.useEffect(()=>()=>g(),[g]),C.useEffect(()=>{if(c&&f){const p=Ue(m=>h(m,f),"handleTriggerLeave"),y=Ue(m=>h(m,c),"handleContentLeave");return c.addEventListener("pointerleave",p),f.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",p),f.removeEventListener("pointerleave",y)}}},[c,f,h,g]),C.useEffect(()=>{if(l){const p=Ue(y=>{const m=y.target,x={x:y.clientX,y:y.clientY},v=(c==null?void 0:c.contains(m))||(f==null?void 0:f.contains(m)),_=!$x(x,l);v?g():_&&(g(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,f,l,u,g]),L.jsx(Ox,{...e,ref:s})},"TooltipContentHoverable")),z6=b8("TooltipContent"),Ox=C.forwardRef(Ue(function(e,n){const{__scopeTooltip:r,children:o,"aria-label":i,id:s,onEscapeKeyDown:l,onPointerDownOutside:a,...c}=e,u=ws(ss,r),f=Nd(r),{onClose:d}=u;C.useEffect(()=>(document.addEventListener(Yu,d),()=>document.removeEventListener(Yu,d)),[d]),C.useEffect(()=>{if(u.trigger){const h=Ue(p=>{p.target instanceof Node&&p.target.contains(u.trigger)&&d()},"handleScroll");return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,d]);const{setContentId:g}=u;return et(()=>(g(s),()=>{g(void 0)}),[s,g]),L.jsx(m5,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:L.jsxs(W5,{"data-state":u.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:u.contentId,...f,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[L.jsx(z6,{children:o}),i?L.jsx(Y4,{id:u.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function Ax(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Ue(Ax,"getExitSideFromRect");function Px(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}Ue(Px,"getPaddedExitPoints");function Lx(t){const{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}Ue(Lx,"getPointsFromRect");function $x(t,e){const{x:n,y:r}=t;let o=!1;for(let i=0,s=e.length-1;ir!=d>r&&n<(f-c)*(r-u)/(d-u)+c&&(o=!o)}return o}Ue($x,"isPointInPolygon");function Ix(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Rx(e)}Ue(Ix,"getHull");function Rx(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],s=e[e.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))e.pop();else break}e.push(o)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const o=t[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}Ue(Rx,"getHullPresorted");var K6=I6,J6=D6,U6=F6,G6=B6,Z6=j6;const Od=N.forwardRef(({title:t,children:e},n)=>{const r=ln(rd);return N.createElement(K6,{delayDuration:100},N.createElement(J6,null,N.createElement(U6,{ref:n,asChild:!0},N.createElement("span",{className:Le.tooltipTrigger},e)),N.createElement(G6,{container:r==null?void 0:r.current},N.createElement(Z6,{className:Rt(Le.tooltipContent),sideOffset:10},t))))}),q6=N.forwardRef(({children:t,className:e,...n},r)=>N.createElement(T6,{...n,ref:r,className:Rt(e,Le.selectItem)},N.createElement(k6,null,t))),Y6=({title:t,placeholder:e,className:n})=>{const[r,o]=Yo(Qi,vs);return N.createElement(Od,{title:t},N.createElement(l6,{"aria-label":e,className:Rt(Le.selectTrigger,n),"data-toolbar-item":!0,disabled:r},N.createElement(c6,{placeholder:e}),N.createElement(u6,{className:Le.selectDropdownArrow},o("arrow_drop_down"))))},X6=({children:t,className:e=Le.selectContainer})=>{const n=ln(rd);return N.createElement(g6,{container:n==null?void 0:n.current},N.createElement(p6,{className:Rt(e,"mdxeditor-select-content"),onCloseAutoFocus:r=>{r.preventDefault()},position:"popper"},N.createElement(b6,{"data-editor-dropdown":!0,style:{maxHeight:"var(--radix-select-content-available-height)"}},t)))},Q6=t=>N.createElement(i6,{value:t.value||"",onValueChange:t.onChange,disabled:t.disabled},N.createElement(Y6,{title:t.triggerTitle,placeholder:t.placeholder}),N.createElement(X6,null,t.items.map((e,n)=>e==="separator"?N.createElement(N6,{key:n}):N.createElement(q6,{key:n,value:e.value},e.label))));function Ad(t,e){return N.forwardRef((n,r)=>{const o=Rt(e.className,n.className);return N.createElement(t,{...e,...n,className:o,ref:r})})}const eE=({readOnly:t,children:e,className:n})=>N.createElement(A4,{className:Rt("mdxeditor-toolbar",Le.toolbarRoot,{[Le.readOnlyToolbarRoot]:t},n),...t?{tabIndex:-1}:{}},e);Ad(P4,{className:Le.toolbarButton,"data-toolbar-item":!0});const Dx=Ad(L4,{className:Le.toolbarToggleItem,"data-toolbar-item":!0});Ad(Cd,{type:"single",className:Le.toolbarToggleSingleGroup});const Fx=N.forwardRef(({on:t,title:e,children:n,disabled:r,...o},i)=>N.createElement(Cd,{type:"single",className:Le.toolbarToggleSingleGroup,...o,value:t?"on":"off",ref:i},N.createElement(Dx,{"aria-label":e,value:"on",disabled:r},N.createElement(Od,{title:e},n)))),tE=({items:t})=>N.createElement("div",{className:Le.toolbarGroupOfGroups},t.map((e,n)=>N.createElement(Fx,{key:n,title:e.title,on:e.active,onValueChange:r=>{e.onChange(r==="on")},disabled:e.disabled},e.contents))),nE=({value:t,onChange:e,className:n,ggClassName:r,items:o,disabled:i})=>{const s=oi();return N.createElement("div",{className:Rt(Le.toolbarGroupOfGroups,r)},N.createElement(Cd,{"aria-label":s("toolbar.toggleGroup","toggle group"),type:"single",className:Rt(Le.toolbarToggleSingleGroup,n),onValueChange:e,value:t||"",disabled:i,onFocus:l=>{l.preventDefault()}},o.map((l,a)=>N.createElement(Dx,{key:a,"aria-label":l.title,value:l.value},N.createElement(Od,{title:l.title},l.contents)))))},Pc=Y(()=>null),Lc=Y(""),qp=()=>"This is an empty toolbar. Pass `{toolbarContents: () => { return <>toolbar components }}` to the toolbarPlugin to customize it.",rE=Xo({init(t,e){const n=(e==null?void 0:e.toolbarPosition)==="bottom"?X3:Y3;t.pubIn({[Pc]:(e==null?void 0:e.toolbarContents)??qp,[Lc]:(e==null?void 0:e.toolbarClassName)??"",[n]:()=>{const[r,o,i]=Yo(Pc,Qi,Lc);return N.createElement(eE,{className:i,readOnly:o},r())}})},update(t,e){t.pub(Pc,(e==null?void 0:e.toolbarContents)??qp),t.pub(Lc,(e==null?void 0:e.toolbarClassName)??"")}});function oE(t,e){let n=t;for(let r=fe(t,e);r&&(Bx(r.origin)||Dr(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function iE(t){return oE(t,"previous")}function Hx(t,e){for(const n of t.childNodes)if(q(n)&&n.tagName===e||Hx(n,e))return!0;return!1}const Ci="data-language",vi="data-highlight-language",Zs="data-theme";class Ss extends ft{constructor(n,r){super(r);P(this,"__language");P(this,"__theme");P(this,"__isSyntaxHighlightSupported");this.__language=n||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}static getType(){return"code"}static clone(n){return new Ss(n.__language,n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__language=n.__language,this.__theme=n.__theme,this.__isSyntaxHighlightSupported=n.__isSyntaxHighlightSupported}createDOM(n){const r=Te().createElement("code");Xt(r,n.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Ci,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(vi,o));const i=this.getTheme();i&&r.setAttribute(Zs,i);const s=this.getStyle();return s&&$o(r.style,s),r}updateDOM(n,r,o){const i=this.__language,s=n.__language;i?i!==s&&r.setAttribute(Ci,i):s&&r.removeAttribute(Ci);const l=this.__isSyntaxHighlightSupported;n.__isSyntaxHighlightSupported&&s?l&&i?i!==s&&r.setAttribute(vi,i):r.removeAttribute(vi):l&&i&&r.setAttribute(vi,i);const a=this.__theme,c=n.__theme;a?a!==c&&r.setAttribute(Zs,a):c&&r.removeAttribute(Zs);const u=this.__style,f=n.__style;return u!==f&&$o(r.style,u,f),!1}exportDOM(n){const r=Te().createElement("pre");Xt(r,n._config.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(Ci,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(vi,o));const i=this.getTheme();i&&r.setAttribute(Zs,i);const s=this.getStyle();return s&&$o(r.style,s),{element:r}}static importDOM(){return{code:n=>n.textContent!=null&&(/\r?\n/.test(n.textContent)||Hx(n,"BR"))?{conversion:Yp,priority:1}:null,div:()=>({conversion:sE,priority:1}),pre:()=>({conversion:Yp,priority:0}),table:n=>$c(n)?{conversion:lE,priority:3}:null,td:n=>{const r=n,o=r.closest("table");return r.classList.contains("js-file-line")||o&&$c(o)?{conversion:Xp,priority:3}:null},tr:n=>{const r=n.closest("table");return r&&$c(r)?{conversion:Xp,priority:3}:null}}}static importJSON(n){return ct().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setLanguage(n.language).setTheme(n.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(n,r=!0){if(!io(Me(),"@lexical/code")){const l=aE(n);if(l)return l}const{anchor:o,focus:i}=n,s=(o.isBefore(i)?o:i).getNode();if(D(s)){let l=iE(s);const a=[];for(;;)if(Dr(l))a.push(fs()),l=l.getNextSibling();else{if(!Bx(l))break;{let p=0;const y=l.getTextContent(),m=l.getTextContentSize();for(;pn.append(r)),this.replace(n),!0}setLanguage(n){const r=this.getWritable();return r.__language=n||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(n){const r=this.getWritable();return r.__isSyntaxHighlightSupported=n,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(n){const r=this.getWritable();return r.__theme=n||void 0,r}getTheme(){return this.getLatest().__theme}}function ct(t,e){return X1(Ss).setLanguage(t).setTheme(e)}function ls(t){return t instanceof Ss}function Yp(t){return{node:ct(t.getAttribute(Ci))}}function sE(t){const e=t,n=Qp(e);return n||function(r){let o=r.parentElement;for(;o!==null;){if(Qp(o))return!0;o=o.parentElement}return!1}(e)?{node:n?ct():null}:{node:null}}function lE(){return{node:ct()}}function Xp(){return{node:null}}function Qp(t){return t.style.fontFamily.match("monospace")!==null}function $c(t){return t.classList.contains("js-file-line-container")}function aE(t){const{anchor:e}=t;if(t.isCollapsed()&&e.type==="element"){const n=e.getNode();if(ls(n)){const r=n.getChildrenSize();if(r>=2&&e.offset===r){const o=n.getLastChild();if(rt(o)&&rt(o.getPreviousSibling())){const i=re();return n.splice(r-2,2,[]).insertAfter(i,!1),i.select(),i}}}}return null}class Ja extends Qt{constructor(n="",r,o){super(n,o);P(this,"__highlightType");this.__highlightType=r}static getType(){return"code-highlight"}static clone(n){return new Ja(n.__text,n.__highlightType||void 0,n.__key)}afterCloneFrom(n){super.afterCloneFrom(n),this.__highlightType=n.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(n){const r=this.getWritable();return r.__highlightType=n||void 0,r}canHaveFormat(){return!1}createDOM(n){const r=super.createDOM(n),o=Ic(n.theme,this.__highlightType);return Xt(r,o),r}updateDOM(n,r,o){const i=super.updateDOM(n,r,o),s=Ic(o.theme,n.__highlightType),l=Ic(o.theme,this.__highlightType);return s!==l&&(s&&ya(r,s),l&&Xt(r,l)),i}static importJSON(n){return Vx().updateFromJSON(n)}updateFromJSON(n){return super.updateFromJSON(n).setHighlightType(n.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(n){return this}isParentRequired(){return!0}createParentElementNode(){return ct()}}function Ic(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function Vx(t="",e){return kt(new Ja(t,e))}function Bx(t){return t instanceof Ja}const jx="data-language";function Wx(t){return t.style.fontFamily.match("monospace")!==null}function Qu(t){let e=t.parentElement;for(;e!==null;){if(Wx(e))return!0;e=e.parentElement}return!1}const cE=F0([{$import:(t,e)=>t.$importChildren(e),match:Ge.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"}]),uE={$import:(t,e)=>[ct(e.getAttribute(jx)).splice(0,0,t.$importChildren(e))],match:Ge.tag("pre"),name:"@lexical/code/pre"},fE={$import:(t,e,n)=>{const r=e.textContent||"";return/\r?\n/.test(r)||e.querySelector("br")!==null?[ct(e.getAttribute(jx)).splice(0,0,t.$importChildren(e))]:n()},match:Ge.tag("code"),name:"@lexical/code/code-multiline"};function qs(t){if(!q(t))return!1;const e=t.style.fontFamily,n=t.style.whiteSpace;return typeof e=="string"&&/monospace/i.test(e)&&typeof n=="string"&&n.startsWith("pre")}function dE(t){let e=!1;const n=[];let r="",o=!1;const i=()=>{o&&(n.push(r),r="",o=!1)};for(const s of Array.from(t.childNodes))if(q(s))s.tagName==="DIV"?(i(),n.push(s.textContent||""),e=!0):s.tagName==="BR"?(i(),n.push(""),e=!0):(r+=s.textContent||"",o=!0);else if(vt(s)){const l=s.textContent||"";l.length>0&&(r+=l,o=!0)}return i(),e?n:null}Ge.tag("div"),Ge.tag("div","br");const hE={$import:(t,e,n)=>Wx(e)?[ct().splice(0,0,t.$importChildren(e))]:Qu(e)?t.$importChildren(e):n(),match:Ge.tag("div"),name:"@lexical/code/div"};Ge.tag("table").classAll("js-file-line-container"),Ge.tag("td").classAll("js-file-line");function ef(t,e){const n={};for(const r of t){const o=e(r);o&&(n[o]?n[o].push(r):n[o]=[r])}return n}function gE(t){const e=ef(t,n=>n.type);return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const em=/[!-/:-@[-`{-~\s]/;function tm(t){return t.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(e,n)=>String.fromCodePoint(Number(n)))}const pE=/^(\s*)(\d{1,})\.\s/,mE=/^(\s*)[-*+]\s/,yE=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,xE=/^(#{1,6})\s/,_E=/^>\s/,vE=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,CE=/^[ \t]*`{3,}$/,bi=us("mdListMarker",{parse:t=>typeof t=="string"&&/^[-*+]$/.test(t)?t:"-",resetOnCopyNode:!0}),nm=us("mdCodeFence",{parse:t=>typeof t=="string"&&/^`{3,}$/.test(t)?t:"```",resetOnCopyNode:!0}),bE=us("mdHardLineBreak",{parse:t=>typeof t=="string"&&/^(\\| {2,})$/.test(t)?t:"",resetOnCopyNode:!0});function wE(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];const e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function SE(t){const e=t.getChildren(),n=e.length-1,r=e[n];if(!D(r))return null;const o=r.getTextContent(),i=wE(o);if(i!==null){const[s,l]=i;return r.setTextContent(s),l}return/^ {2,}$/.test(o)&&function(s,l){for(let a=l-1;a>=0;a--){if(rt(s[a]))return!1;if(/\S/.test(s[a].getTextContent()))return!0}return!1}(e,n)?(r.setTextContent(""),o):null}function EE(t){const e=_t(),n=SE(t);return n!==null&&Oo(e,bE,n),e}const zx=t=>(e,n,r,o)=>{const i=t(r);i.append(...n),e.replace(i),o||i.select(0,0)},Pd=t=>(e,n,r,o)=>{const i=e.getPreviousSibling(),s=e.getNextSibling(),l=Bt(t==="check"?r[3]==="x":void 0),a=r[0].trim()[0],c=t!=="bullet"&&t!=="check"||a!==bi.parse(a)?void 0:a;if(Z(s)&&s.getListType()===t){c&&Oo(s,bi,c);const f=s.getFirstChild();f!==null?f.insertBefore(l):s.append(l),t==="number"&&s.setStart(Number(r[2])),e.remove()}else if(Z(i)&&i.getListType()===t)c&&Oo(i,bi,c),i.append(l),e.remove();else{const f=Dt(t,t==="number"?Number(r[2]):void 0);c&&Oo(f,bi,c),f.append(l),e.replace(f)}l.append(...n),o||l.select(0,0);const u=function(f){const d=f.match(/\t/g),g=f.match(/ /g);let h=0;return d&&(h+=d.length),g&&(h+=Math.floor(g.length/4)),h}(r[1]);u&&l.setIndent(u)},Ua=(t,e,n,r)=>{const o=[],i=t.getChildren();let s=0;for(const l of i)if(Q(l)){if(l.getChildrenSize()===1){const g=l.getFirstChild();if(Z(g)){const h=Ua(g,e,n+1,r);h&&o.push(h);continue}}if(r&&!l.getChildren().some(g=>g.isSelected(r)))continue;const a=" ".repeat(4*n),c=t.getListType(),u=na(t,bi),f=c==="number"?`${t.getStart()+s}. `:c==="check"?`${u} [${l.getChecked()?"x":" "}] `:u+" ";let d=e(l);c!=="number"&&(d=d.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),o.push(a+f+d),s++}return o.join(` +`)},TE={dependencies:[xs],export:(t,e)=>{if(!ba(t))return null;const n=Number(t.getTag().slice(1));return"#".repeat(n)+" "+e(t)},regExp:xE,replace:zx(t=>{const e="h"+t[1].length;return Yt(e)}),triggerOnEnter:!0,type:"element"},Kx={dependencies:[Ca],export:(t,e)=>{if(!_u(t))return null;const n=e(t).split(` `),r=[];for(const o of n)r.push("> "+o);return r.join(` -`)},regExp:vE,replace:(t,e,n,r)=>{if(r){const i=t.getPreviousSibling();if(_u(i))return i.splice(i.getChildrenSize(),0,[TE(i),...e]),void t.remove()}const o=ao();o.append(...e),t.replace(o),r||o.select(0,0)},triggerOnEnter:!0,type:"element"},Li={dependencies:[Ss],export:t=>{if(!ls(t))return null;const e=t.getTextContent();let n=na(t,rm);if(e.indexOf(n)>-1){const r=e.match(/`{3,}/g);if(r){const o=Math.max(...r.map(i=>i.length));n="`".repeat(o+1)}}return n+(t.getLanguage()||"")+(e?` +`)},regExp:_E,replace:(t,e,n,r)=>{if(r){const i=t.getPreviousSibling();if(_u(i))return i.splice(i.getChildrenSize(),0,[EE(i),...e]),void t.remove()}const o=ao();o.append(...e),t.replace(o),r||o.select(0,0)},triggerOnEnter:!0,type:"element"},Li={dependencies:[Ss],export:t=>{if(!ls(t))return null;const e=t.getTextContent();let n=na(t,nm);if(e.indexOf(n)>-1){const r=e.match(/`{3,}/g);if(r){const o=Math.max(...r.map(i=>i.length));n="`".repeat(o+1)}}return n+(t.getLanguage()||"")+(e?` `+e:"")+` -`+n},handleImportAfterStartMatch:({lines:t,rootNode:e,startLineIndex:n,startMatch:r})=>{const o=r[1],i=o.trim().length,s=t[n],l=r.index+o.length,a=s.slice(l),c=new RegExp(`\`{${i},}$`);if(c.test(a)){const g=a.match(c),h=a.slice(0,a.lastIndexOf(g[0])),p=[...r];return p[2]="",Li.replace(e,null,p,g,[h],!0),[!0,n]}const u=new RegExp(`^[ \\t]*\`{${i},}$`);for(let g=n+1;g0&&y.unshift(m),Li.replace(e,null,r,p,y,!0),[!0,g]}}const f=t.slice(n+1),d=s.slice(r[0].length);return d.length>0&&f.unshift(d),Li.replace(e,null,r,null,f,!0),[!0,t.length-1]},regExpEnd:{optional:!0,regExp:bE},regExpStart:CE,replace:(t,e,n,r,o,i)=>{let s,l;const a=n[1]?n[1].trim():"```",c=n[2]||void 0;if(!e&&o){if(o.length===1)r?(s=ct(c),l=o[0]):(s=ct(c),l=o[0].startsWith(" ")?o[0].slice(1):o[0]);else{for(s=ct(c),o.length>0&&(o[0].trim().length===0?o.shift():o[0].startsWith(" ")&&(o[0]=o[0].slice(1)));o.length>0&&!o[o.length-1].length;)o.pop();l=o.join(` -`)}Oo(s,rm,a);const u=Pe(l);s.append(u),t.append(s)}else e&&Kx(u=>ct(u?u[2]:void 0))(t,e,n,i)},type:"multiline-element"},Ld={dependencies:[Wn,jn],export:(t,e,n)=>Z(t)?Ua(t,e,0,n):null,regExp:yE,replace:Pd("bullet"),triggerOnEnter:!0,type:"element"},Ux={dependencies:[Wn,jn],export:(t,e,n)=>Z(t)?Ua(t,e,0,n):null,regExp:xE,replace:Pd("check"),triggerOnEnter:!0,type:"element"},$d={dependencies:[Wn,jn],export:(t,e,n)=>Z(t)?Ua(t,e,0,n):null,regExp:mE,replace:Pd("number"),triggerOnEnter:!0,type:"element"},Gx={format:["code"],tag:"`",type:"text-format"},NE={format:["highlight"],tag:"==",type:"text-format"},Zx={format:["bold","italic"],tag:"***",type:"text-format"},qx={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},Yx={format:["bold"],tag:"**",type:"text-format"},Xx={format:["bold"],intraword:!1,tag:"__",type:"text-format"},ME={format:["strikethrough"],tag:"~~",type:"text-format"},Qx={format:["italic"],tag:"*",type:"text-format"},e2={format:["italic"],intraword:!1,tag:"_",type:"text-format"},t2={dependencies:[ci],export:(t,e,n)=>{if(!Wp(t)||R4(t))return null;const r=e(t);let o=t.getTitle();return o!=null&&(o=o.replace(/([\\"])/g,"\\$1")),o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{if(Ne(t,Wp))return;const[,n,r,o]=e,i=r!=null?nm(r):void 0,s=o!=null?nm(o):void 0,l=Ba(i,{title:s}),a=n.split("[").length-1,c=n.split("]").length-1;let u=n,f="";if(ac){const g=n.split("[");f="["+g[0],u=g.slice(1).join("[")}const d=Pe(u);return d.setFormat(t.getFormat()),l.append(d),t.replace(l),f&&l.insertBefore(Pe(f)),d},trigger:")",type:"text-match"},OE=[kE,Jx,Ld,$d],AE=[Li],PE=[Gx,Zx,qx,Yx,Xx,NE,Qx,e2,ME],LE=[t2],n2=[...OE,...AE,...PE,...LE];function om(t){return D(t)&&!t.hasFormat("code")}function $E(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function im(t,e,n,r,o){const i=t.getParent();if(!ve(i)||t.getFirstChild()!==e)return!1;const s=e.getTextContent();if(!o&&s[n-1]!==" ")return!1;for(const{regExp:l,replace:a}of r){const c=s.match(l),u=o||c&&c[0].endsWith(" ")?n:n-1;if(c&&c[0].length===u){const f=e.getNextSiblings(),[d,g]=e.splitText(n);if(a(t,g?[g,...f]:f,c,!1)!==!1)return d.remove(),!0}}return!1}function sm(t,e,n,r,o){const i=t.getParent();if(!ve(i)||t.getFirstChild()!==e)return!1;const s=e.getTextContent();if(!o&&s[n-1]!==" ")return!1;for(const{regExpStart:l,replace:a,regExpEnd:c}of r){if(c&&!("optional"in c)||c&&"optional"in c&&!c.optional)continue;const u=s.match(l);if(u){const f=o||u[0].endsWith(" ")?n:n-1;if(u[0].length!==f)continue;const d=e.getNextSiblings(),[g,h]=e.splitText(n);if(a(t,h?[h,...d]:d,u,null,null,!1)!==!1)return g.remove(),!0}}return!1}function IE(t,e){let n=0;const r=t.getTextContent();for(let o=0;o=r;o--){const i=o-r;if(r2(t,i,n,0,r)&&t[i+r]!==" ")return i}return-1}function r2(t,e,n,r,o){for(let i=0;ia.triggerOnEnter),o=ef(n.textFormat,({tag:a})=>a[a.length-1]),i=ef(n.textMatch,({trigger:a})=>a),s=new Set([" "]);for(const a of n.textFormat)s.add(a.tag.slice(-1));for(const a of n.textMatch)a.trigger!==void 0&&s.add(a.trigger);for(const a of e){const c=a.type;if(c==="element"||c==="text-match"||c==="multiline-element"){const u=a.dependencies;for(const f of u)t.hasNode(f)||$E(173,f.getType())}}const l=(a,c,u)=>!!im(a,c,u,n.element)||!!sm(a,c,u,n.multilineElement)||!!function(f,d,g){let h=f.getTextContent();const p=g[h[d-1]];if(p==null)return!1;d1&&!r2(h,S,v,0,_)||h[S-1]===" ")continue;const E=h[p+1];if(x.intraword===!1&&E&&!tm.test(E))continue;const b=f;let w=b,k=lm(h,S,v),M=w;for(;k<0&&(M=M.getPreviousSibling())&&!rt(M);)if(D(M)){if(M.hasFormat("code"))continue;const J=M.getTextContent();w=M,k=lm(J,J.length,v)}if(k<0||w===b&&k+_===S)continue;const A=w.getTextContent();if(k>0&&A[k-1]===y)continue;const R=A[k-1];if(x.intraword===!1&&R&&!tm.test(R)||!x.format.includes("code")&&IE(w,k))continue;const F=b.getTextContent(),H=F.slice(0,S)+F.slice(p+1);b.setTextContent(H);const W=w===b?H:A;w.setTextContent(W.slice(0,k)+W.slice(k+_));const z=V(),B=aa();He(B);const K=p-_*(w===b?2:1)+1;B.anchor.set(w.__key,k,"text"),B.focus.set(b.__key,K,"text");for(const J of x.format)B.formatText(J,$n[J]);B.anchor.set(B.focus.key,B.focus.offset,B.focus.type);for(const J of x.format)B.hasFormat(J)&&B.toggleFormat(J);return $(z)&&(B.format=z.format),!0}return!1}(c,u,o);return tt(t.registerUpdateListener(({tags:a,dirtyLeaves:c,editorState:u,prevEditorState:f})=>{if(a.has(c1)||a.has(Ar)||t.isComposing())return;const d=a.has(zi),g=u.read(V),h=f.read(V);if(!$(h)||!$(g)||!g.isCollapsed()||g.is(h)&&!d)return;const p=g.anchor.key,y=g.anchor.offset,m=u._nodeMap.get(p);if(D(m)&&c.has(p)&&(d||y===1||!(y>h.anchor.offset+1))){if(d){const x=u.read(()=>m.getTextContent())[y-1];if(!s.has(x))return}t.update(()=>{if(!om(m))return;const x=m.getParent();x===null||ls(x)||l(x,m,g.anchor.offset)&&In(s1)})}}),t.registerCommand(ji,a=>{if(a!==null&&a.shiftKey)return!1;const c=V();if(!$(c)||!c.isCollapsed())return!1;const u=c.anchor.offset,f=c.anchor.getNode();if(!D(f)||!om(f))return!1;const d=f.getParent();return d===null||ls(d)?!1:u===f.getTextContent().length&&!(!sm(d,f,u,n.multilineElement,!0)&&!im(d,f,u,r,!0))&&(a!==null&&a.preventDefault(),!0)},st))}const DE=[{dependencies:[so],export:t=>E0(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{const o=_a();r||t.getNextSibling()!=null?t.replace(o):t.insertBefore(o),o.selectNext()},triggerOnEnter:!0,type:"element"},...n2];function Rc({transformers:t=DE}){const[e]=pn();return C.useEffect(()=>RE(e,t),[e,t]),null}const FE=Xo({init(t){const e=t.getValue(sd),n=e.includes("headings")?t.getValue(Ta):[],r=jE(e,n),o=r.filter(i=>!BE.has(i));t.pubIn({[Wy]:()=>N.createElement(Rc,{transformers:r}),[Uy]:()=>N.createElement(Rc,{transformers:r}),[nw]:()=>N.createElement(Rc,{transformers:o})})}}),HE=t=>(e,n,r)=>{const o=t(r);o.append(...n),e.replace(o),o.select(0,0)},VE={dependencies:[ka],export:t=>E0(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{const o=cd();r||t.getNextSibling()!=null?t.replace(o):t.insertBefore(o),o.selectNext()},type:"element"},BE=new Set([$d,Ld,Ux]);function jE(t,e){const n=[Zx,qx,Yx,Xx,Gx,Qx,e2];if(t.includes("headings")){const r=Math.min(...e),o=Math.max(...e),i=new RegExp(`^(#{${r},${o}})\\s`),s={dependencies:[xs],export:(l,a)=>{if(!ba(l))return null;const c=Number(l.getTag().slice(1));return"#".repeat(c)+" "+a(l)},regExp:i,replace:HE(l=>{const a=`h${l[1].length}`;return Yt(a)}),type:"element"};n.push(s)}if(t.includes("thematicBreak")&&n.push(VE),t.includes("quote")&&n.push(Jx),t.includes("link")&&n.push(t2),t.includes("lists")&&n.push($d,Ld,Ux),t.includes("codeblock")){const r={...Li,dependencies:[Wa],replace:(o,i,s)=>{const l=bd({code:"",language:s[1]??"",meta:""});o.selectPrevious(),o.replace(l),setTimeout(()=>{l.select()},80)}};n.push(r)}return n}const WE=()=>{const t=$r(Ul),e=ln(Zy),n=ln(sd),r=n.includes("quote"),o=n.includes("headings"),i=oi();if(!r&&!o)return null;const s=[{label:i("toolbar.blockTypes.paragraph","Paragraph"),value:"paragraph"}];if(r&&s.push({label:i("toolbar.blockTypes.quote","Quote"),value:"quote"}),o){const l=ln(Ta);s.push(...l.map(a=>({label:i("toolbar.blockTypes.heading","Heading {{level}}",{level:a}),value:`h${a}`})))}return N.createElement(eE,{value:e,onChange:l=>{switch(l){case"quote":t(()=>ao());break;case"paragraph":t(()=>re());break;case"":break;default:if(l.startsWith("h"))t(()=>Yt(l));else throw new Error(`Unknown block type: ${l}`)}},triggerTitle:i("toolbar.blockTypeSelect.selectBlockTypeTooltip","Select block type"),placeholder:i("toolbar.blockTypeSelect.placeholder","Block type"),items:s})},Dc=({format:t,addTitle:e,removeTitle:n,icon:r,formatName:o})=>{const[i,s]=Yo(Sy,vs),l=$r(Ey),a=(i&t)!==0;return N.createElement(Hx,{title:a?n:e,on:a,onValueChange:()=>{l(o)}},s(r))},zE=({options:t})=>{const e=oi(),n=typeof t>"u";return N.createElement("div",{className:Le.toolbarGroupOfGroups},n||t.includes("Bold")?N.createElement(Dc,{format:Oi,addTitle:e("toolbar.bold","Bold"),removeTitle:e("toolbar.removeBold","Remove bold"),icon:"format_bold",formatName:"bold"}):null,n||t.includes("Italic")?N.createElement(Dc,{format:Ai,addTitle:e("toolbar.italic","Italic"),removeTitle:e("toolbar.removeItalic","Remove italic"),icon:"format_italic",formatName:"italic"}):null,n||t.includes("Underline")?N.createElement(Dc,{format:Pi,addTitle:e("toolbar.underline","Underline"),removeTitle:e("toolbar.removeUnderline","Remove underline"),icon:"format_underlined",formatName:"underline"}):null)},KE={bullet:"format_list_bulleted",number:"format_list_numbered",check:"format_list_checked"},JE=({options:t=["bullet","number","check"]})=>{const[e,n,r]=Yo(Fu,vs,Gy),o=$r(f5),i=oi(),s={bullet:i("toolbar.bulletedList","Bulleted list"),number:i("toolbar.numberedList","Numbered list"),check:i("toolbar.checkList","Check list")},l=t.map(a=>({value:a,title:s[a],contents:n(KE[a])}));return N.createElement(rE,{value:e||"",items:l,onChange:o,disabled:r})},UE=()=>{const[t,e]=Yo(vs,bt),[n,r]=N.useState(!1),[o,i]=N.useState(!1),s=oi();return N.useEffect(()=>{if(e)return tt(e.registerCommand(Mr,l=>(r(l),!1),or),e.registerCommand(Nr,l=>(i(l),!1),or))},[e]),N.createElement(nE,{items:[{title:s("toolbar.undo","Undo {{shortcut}}",{shortcut:$u?"⌘Z":"Ctrl+Z"}),disabled:!n,contents:t("undo"),active:!1,onChange:()=>e==null?void 0:e.dispatchCommand(oa,void 0)},{title:s("toolbar.redo","Redo {{shortcut}}",{shortcut:$u?"⌘Y":"Ctrl+Y"}),disabled:!o,contents:t("redo"),active:!1,onChange:()=>e==null?void 0:e.dispatchCommand(ia,void 0)}]})},GE={"toolbar.undo":"撤销 {{shortcut}}","toolbar.redo":"重做 {{shortcut}}","toolbar.blockTypes.paragraph":"正文","toolbar.blockTypes.quote":"引用","toolbar.blockTypes.heading":"标题 {{level}}","toolbar.blockTypeSelect.selectBlockTypeTooltip":"选择文本类型","toolbar.blockTypeSelect.placeholder":"文本类型","toolbar.bold":"加粗","toolbar.removeBold":"取消加粗","toolbar.italic":"斜体","toolbar.removeItalic":"取消斜体","toolbar.bulletedList":"无序列表","toolbar.numberedList":"有序列表"};function ZE(t,e,n){let r=GE[t]??e;for(const[o,i]of Object.entries(n??{}))r=r.split(`{{${o}}}`).join(String(i));return r}function aT({value:t,onChange:e,invalid:n=!1}){const r=C.useRef(null),o=C.useRef(t),[i,s]=C.useState(""),l=C.useMemo(()=>[qw({allowedHeadingLevels:[1,2,3]}),m8(),V4(),FE(),oE({toolbarClassName:"cw-markdown-toolbar",toolbarContents:()=>L.jsxs(L.Fragment,{children:[L.jsx(UE,{}),L.jsx(WE,{}),L.jsx(zE,{options:["Bold","Italic"]}),L.jsx(JE,{options:["bullet","number"]})]})})],[]);return C.useEffect(()=>{var a;t!==o.current&&((a=r.current)==null||a.setMarkdown(t),o.current=t,s(""))},[t]),L.jsxs("div",{children:[L.jsx(Ww,{ref:r,className:`cw-markdown-editor${n?" is-error":""}`,contentEditableClassName:"cw-markdown-content",markdown:t,placeholder:"输入系统提示词;键入 ## 加空格可创建二级标题…",plugins:l,suppressHtmlProcessing:!0,trim:!1,translation:ZE,onChange:(a,c)=>{o.current=a,s(""),c||e(a)},onError:({error:a})=>s(a)}),i&&L.jsx("span",{className:"cw-markdown-error",role:"alert",children:"Markdown 内容暂时无法解析,请检查未闭合的语法。"})]})}export{aT as default}; +`+n},handleImportAfterStartMatch:({lines:t,rootNode:e,startLineIndex:n,startMatch:r})=>{const o=r[1],i=o.trim().length,s=t[n],l=r.index+o.length,a=s.slice(l),c=new RegExp(`\`{${i},}$`);if(c.test(a)){const g=a.match(c),h=a.slice(0,a.lastIndexOf(g[0])),p=[...r];return p[2]="",Li.replace(e,null,p,g,[h],!0),[!0,n]}const u=new RegExp(`^[ \\t]*\`{${i},}$`);for(let g=n+1;g0&&y.unshift(m),Li.replace(e,null,r,p,y,!0),[!0,g]}}const f=t.slice(n+1),d=s.slice(r[0].length);return d.length>0&&f.unshift(d),Li.replace(e,null,r,null,f,!0),[!0,t.length-1]},regExpEnd:{optional:!0,regExp:CE},regExpStart:vE,replace:(t,e,n,r,o,i)=>{let s,l;const a=n[1]?n[1].trim():"```",c=n[2]||void 0;if(!e&&o){if(o.length===1)r?(s=ct(c),l=o[0]):(s=ct(c),l=o[0].startsWith(" ")?o[0].slice(1):o[0]);else{for(s=ct(c),o.length>0&&(o[0].trim().length===0?o.shift():o[0].startsWith(" ")&&(o[0]=o[0].slice(1)));o.length>0&&!o[o.length-1].length;)o.pop();l=o.join(` +`)}Oo(s,nm,a);const u=Pe(l);s.append(u),t.append(s)}else e&&zx(u=>ct(u?u[2]:void 0))(t,e,n,i)},type:"multiline-element"},Ld={dependencies:[Wn,jn],export:(t,e,n)=>Z(t)?Ua(t,e,0,n):null,regExp:mE,replace:Pd("bullet"),triggerOnEnter:!0,type:"element"},Jx={dependencies:[Wn,jn],export:(t,e,n)=>Z(t)?Ua(t,e,0,n):null,regExp:yE,replace:Pd("check"),triggerOnEnter:!0,type:"element"},$d={dependencies:[Wn,jn],export:(t,e,n)=>Z(t)?Ua(t,e,0,n):null,regExp:pE,replace:Pd("number"),triggerOnEnter:!0,type:"element"},Ux={format:["code"],tag:"`",type:"text-format"},kE={format:["highlight"],tag:"==",type:"text-format"},Gx={format:["bold","italic"],tag:"***",type:"text-format"},Zx={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},qx={format:["bold"],tag:"**",type:"text-format"},Yx={format:["bold"],intraword:!1,tag:"__",type:"text-format"},NE={format:["strikethrough"],tag:"~~",type:"text-format"},Xx={format:["italic"],tag:"*",type:"text-format"},Qx={format:["italic"],intraword:!1,tag:"_",type:"text-format"},e2={dependencies:[ci],export:(t,e,n)=>{if(!jp(t)||I4(t))return null;const r=e(t);let o=t.getTitle();return o!=null&&(o=o.replace(/([\\"])/g,"\\$1")),o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{if(Ne(t,jp))return;const[,n,r,o]=e,i=r!=null?tm(r):void 0,s=o!=null?tm(o):void 0,l=Ba(i,{title:s}),a=n.split("[").length-1,c=n.split("]").length-1;let u=n,f="";if(ac){const g=n.split("[");f="["+g[0],u=g.slice(1).join("[")}const d=Pe(u);return d.setFormat(t.getFormat()),l.append(d),t.replace(l),f&&l.insertBefore(Pe(f)),d},trigger:")",type:"text-match"},ME=[TE,Kx,Ld,$d],OE=[Li],AE=[Ux,Gx,Zx,qx,Yx,kE,Xx,Qx,NE],PE=[e2],t2=[...ME,...OE,...AE,...PE];function rm(t){return D(t)&&!t.hasFormat("code")}function LE(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const o of e)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function om(t,e,n,r,o){const i=t.getParent();if(!ve(i)||t.getFirstChild()!==e)return!1;const s=e.getTextContent();if(!o&&s[n-1]!==" ")return!1;for(const{regExp:l,replace:a}of r){const c=s.match(l),u=o||c&&c[0].endsWith(" ")?n:n-1;if(c&&c[0].length===u){const f=e.getNextSiblings(),[d,g]=e.splitText(n);if(a(t,g?[g,...f]:f,c,!1)!==!1)return d.remove(),!0}}return!1}function im(t,e,n,r,o){const i=t.getParent();if(!ve(i)||t.getFirstChild()!==e)return!1;const s=e.getTextContent();if(!o&&s[n-1]!==" ")return!1;for(const{regExpStart:l,replace:a,regExpEnd:c}of r){if(c&&!("optional"in c)||c&&"optional"in c&&!c.optional)continue;const u=s.match(l);if(u){const f=o||u[0].endsWith(" ")?n:n-1;if(u[0].length!==f)continue;const d=e.getNextSiblings(),[g,h]=e.splitText(n);if(a(t,h?[h,...d]:d,u,null,null,!1)!==!1)return g.remove(),!0}}return!1}function $E(t,e){let n=0;const r=t.getTextContent();for(let o=0;o=r;o--){const i=o-r;if(n2(t,i,n,0,r)&&t[i+r]!==" ")return i}return-1}function n2(t,e,n,r,o){for(let i=0;ia.triggerOnEnter),o=ef(n.textFormat,({tag:a})=>a[a.length-1]),i=ef(n.textMatch,({trigger:a})=>a),s=new Set([" "]);for(const a of n.textFormat)s.add(a.tag.slice(-1));for(const a of n.textMatch)a.trigger!==void 0&&s.add(a.trigger);for(const a of e){const c=a.type;if(c==="element"||c==="text-match"||c==="multiline-element"){const u=a.dependencies;for(const f of u)t.hasNode(f)||LE(173,f.getType())}}const l=(a,c,u)=>!!om(a,c,u,n.element)||!!im(a,c,u,n.multilineElement)||!!function(f,d,g){let h=f.getTextContent();const p=g[h[d-1]];if(p==null)return!1;d1&&!n2(h,S,v,0,_)||h[S-1]===" ")continue;const E=h[p+1];if(x.intraword===!1&&E&&!em.test(E))continue;const b=f;let w=b,k=sm(h,S,v),M=w;for(;k<0&&(M=M.getPreviousSibling())&&!rt(M);)if(D(M)){if(M.hasFormat("code"))continue;const J=M.getTextContent();w=M,k=sm(J,J.length,v)}if(k<0||w===b&&k+_===S)continue;const A=w.getTextContent();if(k>0&&A[k-1]===y)continue;const R=A[k-1];if(x.intraword===!1&&R&&!em.test(R)||!x.format.includes("code")&&$E(w,k))continue;const F=b.getTextContent(),H=F.slice(0,S)+F.slice(p+1);b.setTextContent(H);const W=w===b?H:A;w.setTextContent(W.slice(0,k)+W.slice(k+_));const z=V(),B=aa();He(B);const K=p-_*(w===b?2:1)+1;B.anchor.set(w.__key,k,"text"),B.focus.set(b.__key,K,"text");for(const J of x.format)B.formatText(J,$n[J]);B.anchor.set(B.focus.key,B.focus.offset,B.focus.type);for(const J of x.format)B.hasFormat(J)&&B.toggleFormat(J);return $(z)&&(B.format=z.format),!0}return!1}(c,u,o);return tt(t.registerUpdateListener(({tags:a,dirtyLeaves:c,editorState:u,prevEditorState:f})=>{if(a.has(a1)||a.has(Ar)||t.isComposing())return;const d=a.has(zi),g=u.read(V),h=f.read(V);if(!$(h)||!$(g)||!g.isCollapsed()||g.is(h)&&!d)return;const p=g.anchor.key,y=g.anchor.offset,m=u._nodeMap.get(p);if(D(m)&&c.has(p)&&(d||y===1||!(y>h.anchor.offset+1))){if(d){const x=u.read(()=>m.getTextContent())[y-1];if(!s.has(x))return}t.update(()=>{if(!rm(m))return;const x=m.getParent();x===null||ls(x)||l(x,m,g.anchor.offset)&&In(i1)})}}),t.registerCommand(ji,a=>{if(a!==null&&a.shiftKey)return!1;const c=V();if(!$(c)||!c.isCollapsed())return!1;const u=c.anchor.offset,f=c.anchor.getNode();if(!D(f)||!rm(f))return!1;const d=f.getParent();return d===null||ls(d)?!1:u===f.getTextContent().length&&!(!im(d,f,u,n.multilineElement,!0)&&!om(d,f,u,r,!0))&&(a!==null&&a.preventDefault(),!0)},st))}const RE=[{dependencies:[so],export:t=>S0(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{const o=_a();r||t.getNextSibling()!=null?t.replace(o):t.insertBefore(o),o.selectNext()},triggerOnEnter:!0,type:"element"},...t2];function Rc({transformers:t=RE}){const[e]=pn();return C.useEffect(()=>IE(e,t),[e,t]),null}const DE=Xo({init(t){const e=t.getValue(sd),n=e.includes("headings")?t.getValue(Ta):[],r=BE(e,n),o=r.filter(i=>!VE.has(i));t.pubIn({[jy]:()=>N.createElement(Rc,{transformers:r}),[Jy]:()=>N.createElement(Rc,{transformers:r}),[tw]:()=>N.createElement(Rc,{transformers:o})})}}),FE=t=>(e,n,r)=>{const o=t(r);o.append(...n),e.replace(o),o.select(0,0)},HE={dependencies:[ka],export:t=>S0(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{const o=cd();r||t.getNextSibling()!=null?t.replace(o):t.insertBefore(o),o.selectNext()},type:"element"},VE=new Set([$d,Ld,Jx]);function BE(t,e){const n=[Gx,Zx,qx,Yx,Ux,Xx,Qx];if(t.includes("headings")){const r=Math.min(...e),o=Math.max(...e),i=new RegExp(`^(#{${r},${o}})\\s`),s={dependencies:[xs],export:(l,a)=>{if(!ba(l))return null;const c=Number(l.getTag().slice(1));return"#".repeat(c)+" "+a(l)},regExp:i,replace:FE(l=>{const a=`h${l[1].length}`;return Yt(a)}),type:"element"};n.push(s)}if(t.includes("thematicBreak")&&n.push(HE),t.includes("quote")&&n.push(Kx),t.includes("link")&&n.push(e2),t.includes("lists")&&n.push($d,Ld,Jx),t.includes("codeblock")){const r={...Li,dependencies:[Wa],replace:(o,i,s)=>{const l=bd({code:"",language:s[1]??"",meta:""});o.selectPrevious(),o.replace(l),setTimeout(()=>{l.select()},80)}};n.push(r)}return n}const jE=()=>{const t=$r(Ul),e=ln(Gy),n=ln(sd),r=n.includes("quote"),o=n.includes("headings"),i=oi();if(!r&&!o)return null;const s=[{label:i("toolbar.blockTypes.paragraph","Paragraph"),value:"paragraph"}];if(r&&s.push({label:i("toolbar.blockTypes.quote","Quote"),value:"quote"}),o){const l=ln(Ta);s.push(...l.map(a=>({label:i("toolbar.blockTypes.heading","Heading {{level}}",{level:a}),value:`h${a}`})))}return N.createElement(Q6,{value:e,onChange:l=>{switch(l){case"quote":t(()=>ao());break;case"paragraph":t(()=>re());break;case"":break;default:if(l.startsWith("h"))t(()=>Yt(l));else throw new Error(`Unknown block type: ${l}`)}},triggerTitle:i("toolbar.blockTypeSelect.selectBlockTypeTooltip","Select block type"),placeholder:i("toolbar.blockTypeSelect.placeholder","Block type"),items:s})},Dc=({format:t,addTitle:e,removeTitle:n,icon:r,formatName:o})=>{const[i,s]=Yo(wy,vs),l=$r(Sy),a=(i&t)!==0;return N.createElement(Fx,{title:a?n:e,on:a,onValueChange:()=>{l(o)}},s(r))},WE=({options:t})=>{const e=oi(),n=typeof t>"u";return N.createElement("div",{className:Le.toolbarGroupOfGroups},n||t.includes("Bold")?N.createElement(Dc,{format:Oi,addTitle:e("toolbar.bold","Bold"),removeTitle:e("toolbar.removeBold","Remove bold"),icon:"format_bold",formatName:"bold"}):null,n||t.includes("Italic")?N.createElement(Dc,{format:Ai,addTitle:e("toolbar.italic","Italic"),removeTitle:e("toolbar.removeItalic","Remove italic"),icon:"format_italic",formatName:"italic"}):null,n||t.includes("Underline")?N.createElement(Dc,{format:Pi,addTitle:e("toolbar.underline","Underline"),removeTitle:e("toolbar.removeUnderline","Remove underline"),icon:"format_underlined",formatName:"underline"}):null)},zE={bullet:"format_list_bulleted",number:"format_list_numbered",check:"format_list_checked"},KE=({options:t=["bullet","number","check"]})=>{const[e,n,r]=Yo(Fu,vs,Uy),o=$r(u5),i=oi(),s={bullet:i("toolbar.bulletedList","Bulleted list"),number:i("toolbar.numberedList","Numbered list"),check:i("toolbar.checkList","Check list")},l=t.map(a=>({value:a,title:s[a],contents:n(zE[a])}));return N.createElement(nE,{value:e||"",items:l,onChange:o,disabled:r})},JE=()=>{const[t,e]=Yo(vs,bt),[n,r]=N.useState(!1),[o,i]=N.useState(!1),s=oi();return N.useEffect(()=>{if(e)return tt(e.registerCommand(Mr,l=>(r(l),!1),or),e.registerCommand(Nr,l=>(i(l),!1),or))},[e]),N.createElement(tE,{items:[{title:s("toolbar.undo","Undo {{shortcut}}",{shortcut:$u?"⌘Z":"Ctrl+Z"}),disabled:!n,contents:t("undo"),active:!1,onChange:()=>e==null?void 0:e.dispatchCommand(oa,void 0)},{title:s("toolbar.redo","Redo {{shortcut}}",{shortcut:$u?"⌘Y":"Ctrl+Y"}),disabled:!o,contents:t("redo"),active:!1,onChange:()=>e==null?void 0:e.dispatchCommand(ia,void 0)}]})},UE={"toolbar.undo":"撤销 {{shortcut}}","toolbar.redo":"重做 {{shortcut}}","toolbar.blockTypes.paragraph":"正文","toolbar.blockTypes.quote":"引用","toolbar.blockTypes.heading":"标题 {{level}}","toolbar.blockTypeSelect.selectBlockTypeTooltip":"选择文本类型","toolbar.blockTypeSelect.placeholder":"文本类型","toolbar.bold":"加粗","toolbar.removeBold":"取消加粗","toolbar.italic":"斜体","toolbar.removeItalic":"取消斜体","toolbar.bulletedList":"无序列表","toolbar.numberedList":"有序列表"};function GE(t,e,n){let r=UE[t]??e;for(const[o,i]of Object.entries(n??{}))r=r.split(`{{${o}}}`).join(String(i));return r}function lT({value:t,onChange:e,invalid:n=!1}){const r=C.useRef(null),o=C.useRef(t),[i,s]=C.useState(""),l=C.useMemo(()=>[Zw({allowedHeadingLevels:[1,2,3]}),p8(),H4(),DE(),rE({toolbarClassName:"cw-markdown-toolbar",toolbarContents:()=>L.jsxs(L.Fragment,{children:[L.jsx(JE,{}),L.jsx(jE,{}),L.jsx(WE,{options:["Bold","Italic"]}),L.jsx(KE,{options:["bullet","number"]})]})})],[]);return C.useEffect(()=>{var a;t!==o.current&&((a=r.current)==null||a.setMarkdown(t),o.current=t,s(""))},[t]),L.jsxs("div",{children:[L.jsx(jw,{ref:r,className:`cw-markdown-editor${n?" is-error":""}`,contentEditableClassName:"cw-markdown-content",markdown:t,placeholder:"输入系统提示词;键入 ## 加空格可创建二级标题…",plugins:l,suppressHtmlProcessing:!0,trim:!1,translation:GE,onChange:(a,c)=>{o.current=a,s(""),c||e(a)},onError:({error:a})=>s(a)}),i&&L.jsx("span",{className:"cw-markdown-error",role:"alert",children:"Markdown 内容暂时无法解析,请检查未闭合的语法。"})]})}export{lT as default}; diff --git a/veadk/webui/assets/index-NDcH-KLD.js b/veadk/webui/assets/index-NDcH-KLD.js deleted file mode 100644 index 84de0193..00000000 --- a/veadk/webui/assets/index-NDcH-KLD.js +++ /dev/null @@ -1,695 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor-CvbLdIOO.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); -var N4=Object.defineProperty;var A4=(e,t,n)=>t in e?N4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pw=(e,t,n)=>A4(e,typeof t!="symbol"?t+"":t,n);function C4(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var jh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a2={exports:{}},Qp={},o2={exports:{}},lt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ud=Symbol.for("react.element"),I4=Symbol.for("react.portal"),R4=Symbol.for("react.fragment"),O4=Symbol.for("react.strict_mode"),L4=Symbol.for("react.profiler"),M4=Symbol.for("react.provider"),D4=Symbol.for("react.context"),P4=Symbol.for("react.forward_ref"),j4=Symbol.for("react.suspense"),B4=Symbol.for("react.memo"),F4=Symbol.for("react.lazy"),jw=Symbol.iterator;function U4(e){return e===null||typeof e!="object"?null:(e=jw&&e[jw]||e["@@iterator"],typeof e=="function"?e:null)}var l2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},c2=Object.assign,u2={};function Fl(e,t,n){this.props=e,this.context=t,this.refs=u2,this.updater=n||l2}Fl.prototype.isReactComponent={};Fl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Fl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function d2(){}d2.prototype=Fl.prototype;function mb(e,t,n){this.props=e,this.context=t,this.refs=u2,this.updater=n||l2}var gb=mb.prototype=new d2;gb.constructor=mb;c2(gb,Fl.prototype);gb.isPureReactComponent=!0;var Bw=Array.isArray,f2=Object.prototype.hasOwnProperty,yb={current:null},h2={key:!0,ref:!0,__self:!0,__source:!0};function p2(e,t,n){var r,i={},s=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)f2.call(t,r)&&!h2.hasOwnProperty(r)&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1>>1,V=O[H];if(0>>1;Hi(J,N))rei(de,J)?(O[H]=de,O[re]=N,H=re):(O[H]=J,O[ne]=N,H=ne);else if(rei(de,N))O[H]=de,O[re]=N,H=re;else break e}}return j}function i(O,j){var N=O.sortIndex-j.sortIndex;return N!==0?N:O.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],d=1,f=null,h=3,p=!1,m=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(O){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=O)r(u),j.sortIndex=j.expirationTime,t(l,j);else break;j=n(u)}}function _(O){if(y=!1,b(O),!m)if(n(l)!==null)m=!0,A(k);else{var j=n(u);j!==null&&L(_,j.startTime-O)}}function k(O,j){m=!1,y&&(y=!1,g(S),S=-1),p=!0;var N=h;try{for(b(j),f=n(l);f!==null&&(!(f.expirationTime>j)||O&&!M());){var H=f.callback;if(typeof H=="function"){f.callback=null,h=f.priorityLevel;var V=H(f.expirationTime<=j);j=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(l)&&r(l),b(j)}else r(l);f=n(l)}if(f!==null)var D=!0;else{var ne=n(u);ne!==null&&L(_,ne.startTime-j),D=!1}return D}finally{f=null,h=N,p=!1}}var T=!1,C=null,S=-1,R=5,I=-1;function M(){return!(e.unstable_now()-IO||125H?(O.sortIndex=N,t(u,O),n(l)===null&&O===n(u)&&(y?(g(S),S=-1):y=!0,L(_,N-H))):(O.sortIndex=V,t(l,O),m||p||(m=!0,A(k))),O},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(O){var j=h;return function(){var N=h;h=j;try{return O.apply(this,arguments)}finally{h=N}}}})(E2);b2.exports=E2;var Q4=b2.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Z4=v,Br=Q4;function me(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),sy=Object.prototype.hasOwnProperty,J4=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Uw={},$w={};function e6(e){return sy.call($w,e)?!0:sy.call(Uw,e)?!1:J4.test(e)?$w[e]=!0:(Uw[e]=!0,!1)}function t6(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function n6(e,t,n,r){if(t===null||typeof t>"u"||t6(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pr(e,t,n,r,i,s,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=a}var Kn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Kn[e]=new pr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Kn[t]=new pr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Kn[e]=new pr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Kn[e]=new pr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Kn[e]=new pr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Kn[e]=new pr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Kn[e]=new pr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Kn[e]=new pr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Kn[e]=new pr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Eb=/[\-:]([a-z])/g;function xb(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Eb,xb);Kn[t]=new pr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Eb,xb);Kn[t]=new pr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Eb,xb);Kn[t]=new pr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Kn[e]=new pr(e,1,!1,e.toLowerCase(),null,!1,!1)});Kn.xlinkHref=new pr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Kn[e]=new pr(e,1,!1,e.toLowerCase(),null,!0,!0)});function wb(e,t,n,r){var i=Kn.hasOwnProperty(t)?Kn[t]:null;(i!==null?i.type!==0:r||!(2o||i[a]!==s[o]){var l=` -`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=o);break}}}finally{gg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Rc(e):""}function r6(e){switch(e.tag){case 5:return Rc(e.type);case 16:return Rc("Lazy");case 13:return Rc("Suspense");case 19:return Rc("SuspenseList");case 0:case 2:case 15:return e=yg(e.type,!1),e;case 11:return e=yg(e.type.render,!1),e;case 1:return e=yg(e.type,!0),e;default:return""}}function cy(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Io:return"Fragment";case Co:return"Portal";case ay:return"Profiler";case vb:return"StrictMode";case oy:return"Suspense";case ly:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case v2:return(e.displayName||"Context")+".Consumer";case w2:return(e._context.displayName||"Context")+".Provider";case _b:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Tb:return t=e.displayName||null,t!==null?t:cy(e.type)||"Memo";case Ns:t=e._payload,e=e._init;try{return cy(e(t))}catch{}}return null}function i6(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return cy(t);case 8:return t===vb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Xs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T2(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function s6(e){var t=T2(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rf(e){e._valueTracker||(e._valueTracker=s6(e))}function k2(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=T2(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Bh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function uy(e,t){var n=t.checked;return on({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function zw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Xs(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function S2(e,t){t=t.checked,t!=null&&wb(e,"checked",t,!1)}function dy(e,t){S2(e,t);var n=Xs(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?fy(e,t.type,n):t.hasOwnProperty("defaultValue")&&fy(e,t.type,Xs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Vw(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function fy(e,t,n){(t!=="number"||Bh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Oc=Array.isArray;function Zo(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=sf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Eu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},a6=["Webkit","ms","Moz","O"];Object.keys(zc).forEach(function(e){a6.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zc[t]=zc[e]})});function I2(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||zc.hasOwnProperty(e)&&zc[e]?(""+t).trim():t+"px"}function R2(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=I2(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var o6=on({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function my(e,t){if(t){if(o6[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(me(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(me(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(me(61))}if(t.style!=null&&typeof t.style!="object")throw Error(me(62))}}function gy(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yy=null;function kb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var by=null,Jo=null,el=null;function Ww(e){if(e=hd(e)){if(typeof by!="function")throw Error(me(280));var t=e.stateNode;t&&(t=nm(t),by(e.stateNode,e.type,t))}}function O2(e){Jo?el?el.push(e):el=[e]:Jo=e}function L2(){if(Jo){var e=Jo,t=el;if(el=Jo=null,Ww(e),t)for(e=0;e>>=0,e===0?32:31-(b6(e)/E6|0)|0}var af=64,of=4194304;function Lc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Hh(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~i;o!==0?r=Lc(o):(s&=a,s!==0&&(r=Lc(s)))}else a=n&~i,a!==0?r=Lc(a):s!==0&&(r=Lc(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function dd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-mi(t),e[t]=n}function _6(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Kc),nv=" ",rv=!1;function J2(e,t){switch(e){case"keyup":return Q6.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ro=!1;function J6(e,t){switch(e){case"compositionend":return eA(t);case"keypress":return t.which!==32?null:(rv=!0,nv);case"textInput":return e=t.data,e===nv&&rv?null:e;default:return null}}function e5(e,t){if(Ro)return e==="compositionend"||!Lb&&J2(e,t)?(e=Q2(),sh=Ib=Ms=null,Ro=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ov(n)}}function iA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?iA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sA(){for(var e=window,t=Bh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Bh(e.document)}return t}function Mb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function c5(e){var t=sA(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&iA(n.ownerDocument.documentElement,n)){if(r!==null&&Mb(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=lv(n,s);var a=lv(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Oo=null,Ty=null,Wc=null,ky=!1;function cv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ky||Oo==null||Oo!==Bh(r)||(r=Oo,"selectionStart"in r&&Mb(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Wc&&ku(Wc,r)||(Wc=r,r=Kh(Ty,"onSelect"),0Do||(e.current=Ry[Do],Ry[Do]=null,Do--)}function Bt(e,t){Do++,Ry[Do]=e.current,e.current=t}var Qs={},er=na(Qs),xr=na(!1),Fa=Qs;function hl(e,t){var n=e.type.contextTypes;if(!n)return Qs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function wr(e){return e=e.childContextTypes,e!=null}function Wh(){Ht(xr),Ht(er)}function gv(e,t,n){if(er.current!==Qs)throw Error(me(168));Bt(er,t),Bt(xr,n)}function pA(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(me(108,i6(e)||"Unknown",i));return on({},n,r)}function qh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qs,Fa=er.current,Bt(er,e),Bt(xr,xr.current),!0}function yv(e,t,n){var r=e.stateNode;if(!r)throw Error(me(169));n?(e=pA(e,t,Fa),r.__reactInternalMemoizedMergedChildContext=e,Ht(xr),Ht(er),Bt(er,e)):Ht(xr),Bt(xr,n)}var Gi=null,rm=!1,Rg=!1;function mA(e){Gi===null?Gi=[e]:Gi.push(e)}function w5(e){rm=!0,mA(e)}function ra(){if(!Rg&&Gi!==null){Rg=!0;var e=0,t=Tt;try{var n=Gi;for(Tt=1;e>=a,i-=a,Qi=1<<32-mi(t)+i|n<S?(R=C,C=null):R=C.sibling;var I=h(g,C,b[S],_);if(I===null){C===null&&(C=R);break}e&&C&&I.alternate===null&&t(g,C),E=s(I,E,S),T===null?k=I:T.sibling=I,T=I,C=R}if(S===b.length)return n(g,C),Gt&&pa(g,S),k;if(C===null){for(;SS?(R=C,C=null):R=C.sibling;var M=h(g,C,I.value,_);if(M===null){C===null&&(C=R);break}e&&C&&M.alternate===null&&t(g,C),E=s(M,E,S),T===null?k=M:T.sibling=M,T=M,C=R}if(I.done)return n(g,C),Gt&&pa(g,S),k;if(C===null){for(;!I.done;S++,I=b.next())I=f(g,I.value,_),I!==null&&(E=s(I,E,S),T===null?k=I:T.sibling=I,T=I);return Gt&&pa(g,S),k}for(C=r(g,C);!I.done;S++,I=b.next())I=p(C,g,S,I.value,_),I!==null&&(e&&I.alternate!==null&&C.delete(I.key===null?S:I.key),E=s(I,E,S),T===null?k=I:T.sibling=I,T=I);return e&&C.forEach(function(B){return t(g,B)}),Gt&&pa(g,S),k}function w(g,E,b,_){if(typeof b=="object"&&b!==null&&b.type===Io&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case nf:e:{for(var k=b.key,T=E;T!==null;){if(T.key===k){if(k=b.type,k===Io){if(T.tag===7){n(g,T.sibling),E=i(T,b.props.children),E.return=g,g=E;break e}}else if(T.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ns&&xv(k)===T.type){n(g,T.sibling),E=i(T,b.props),E.ref=hc(g,T,b),E.return=g,g=E;break e}n(g,T);break}else t(g,T);T=T.sibling}b.type===Io?(E=Oa(b.props.children,g.mode,_,b.key),E.return=g,g=E):(_=hh(b.type,b.key,b.props,null,g.mode,_),_.ref=hc(g,E,b),_.return=g,g=_)}return a(g);case Co:e:{for(T=b.key;E!==null;){if(E.key===T)if(E.tag===4&&E.stateNode.containerInfo===b.containerInfo&&E.stateNode.implementation===b.implementation){n(g,E.sibling),E=i(E,b.children||[]),E.return=g,g=E;break e}else{n(g,E);break}else t(g,E);E=E.sibling}E=Fg(b,g.mode,_),E.return=g,g=E}return a(g);case Ns:return T=b._init,w(g,E,T(b._payload),_)}if(Oc(b))return m(g,E,b,_);if(lc(b))return y(g,E,b,_);pf(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,E!==null&&E.tag===6?(n(g,E.sibling),E=i(E,b),E.return=g,g=E):(n(g,E),E=Bg(b,g.mode,_),E.return=g,g=E),a(g)):n(g,E)}return w}var ml=EA(!0),xA=EA(!1),Qh=na(null),Zh=null,Bo=null,Bb=null;function Fb(){Bb=Bo=Zh=null}function Ub(e){var t=Qh.current;Ht(Qh),e._currentValue=t}function My(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function nl(e,t){Zh=e,Bb=Bo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(br=!0),e.firstContext=null)}function Jr(e){var t=e._currentValue;if(Bb!==e)if(e={context:e,memoizedValue:t,next:null},Bo===null){if(Zh===null)throw Error(me(308));Bo=e,Zh.dependencies={lanes:0,firstContext:e}}else Bo=Bo.next=e;return t}var Ta=null;function $b(e){Ta===null?Ta=[e]:Ta.push(e)}function wA(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,$b(t)):(n.next=i.next,i.next=n),t.interleaved=n,ds(e,r)}function ds(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var As=!1;function Hb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vA(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function rs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Hs(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,gt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ds(e,n)}return i=r.interleaved,i===null?(t.next=t,$b(r)):(t.next=i.next,i.next=t),r.interleaved=t,ds(e,n)}function oh(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nb(e,n)}}function wv(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Jh(e,t,n,r){var i=e.updateQueue;As=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,u=l.next;l.next=null,a===null?s=u:a.next=u,a=l;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=l))}if(s!==null){var f=i.baseState;a=0,d=u=l=null,o=s;do{var h=o.lane,p=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,y=o;switch(h=t,p=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=on({},f,h);break e;case 2:As=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,l=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;h=o,o=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Ha|=a,e.lanes=a,e.memoizedState=f}}function vv(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Lg.transition;Lg.transition={};try{e(!1),t()}finally{Tt=n,Lg.transition=r}}function FA(){return ei().memoizedState}function k5(e,t,n){var r=Vs(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},UA(e))$A(t,n);else if(n=wA(e,t,n,r),n!==null){var i=ur();gi(n,e,r,i),HA(n,t,r)}}function S5(e,t,n){var r=Vs(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(UA(e))$A(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,o=s(a,n);if(i.hasEagerState=!0,i.eagerState=o,bi(o,a)){var l=t.interleaved;l===null?(i.next=i,$b(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=wA(e,t,i,r),n!==null&&(i=ur(),gi(n,e,r,i),HA(n,t,r))}}function UA(e){var t=e.alternate;return e===an||t!==null&&t===an}function $A(e,t){qc=tp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function HA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nb(e,n)}}var np={readContext:Jr,useCallback:qn,useContext:qn,useEffect:qn,useImperativeHandle:qn,useInsertionEffect:qn,useLayoutEffect:qn,useMemo:qn,useReducer:qn,useRef:qn,useState:qn,useDebugValue:qn,useDeferredValue:qn,useTransition:qn,useMutableSource:qn,useSyncExternalStore:qn,useId:qn,unstable_isNewReconciler:!1},N5={readContext:Jr,useCallback:function(e,t){return Ci().memoizedState=[e,t===void 0?null:t],e},useContext:Jr,useEffect:Tv,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ch(4194308,4,MA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ch(4194308,4,e,t)},useInsertionEffect:function(e,t){return ch(4,2,e,t)},useMemo:function(e,t){var n=Ci();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ci();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=k5.bind(null,an,e),[r.memoizedState,e]},useRef:function(e){var t=Ci();return e={current:e},t.memoizedState=e},useState:_v,useDebugValue:Xb,useDeferredValue:function(e){return Ci().memoizedState=e},useTransition:function(){var e=_v(!1),t=e[0];return e=T5.bind(null,e[1]),Ci().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=an,i=Ci();if(Gt){if(n===void 0)throw Error(me(407));n=n()}else{if(n=t(),Bn===null)throw Error(me(349));$a&30||SA(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Tv(AA.bind(null,r,s,e),[e]),r.flags|=2048,Lu(9,NA.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Ci(),t=Bn.identifierPrefix;if(Gt){var n=Zi,r=Qi;n=(r&~(1<<32-mi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ru++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Li]=t,e[Au]=r,ZA(e,t,!1,!1),t.stateNode=e;e:{switch(a=gy(n,r),n){case"dialog":$t("cancel",e),$t("close",e),i=r;break;case"iframe":case"object":case"embed":$t("load",e),i=r;break;case"video":case"audio":for(i=0;ibl&&(t.flags|=128,r=!0,pc(s,!1),t.lanes=4194304)}else{if(!r)if(e=ep(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),pc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!Gt)return Gn(t),null}else 2*hn()-s.renderingStartTime>bl&&n!==1073741824&&(t.flags|=128,r=!0,pc(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=hn(),t.sibling=null,n=rn.current,Bt(rn,r?n&1|2:n&1),t):(Gn(t),null);case 22:case 23:return nE(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Or&1073741824&&(Gn(t),t.subtreeFlags&6&&(t.flags|=8192)):Gn(t),null;case 24:return null;case 25:return null}throw Error(me(156,t.tag))}function D5(e,t){switch(Pb(t),t.tag){case 1:return wr(t.type)&&Wh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gl(),Ht(xr),Ht(er),Kb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Vb(t),null;case 13:if(Ht(rn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(me(340));pl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ht(rn),null;case 4:return gl(),null;case 10:return Ub(t.type._context),null;case 22:case 23:return nE(),null;case 24:return null;default:return null}}var gf=!1,Qn=!1,P5=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function Fo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){cn(e,t,r)}else n.current=null}function zy(e,t,n){try{n()}catch(r){cn(e,t,r)}}var Dv=!1;function j5(e,t){if(Sy=zh,e=sA(),Mb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,l=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(o=a+i),f!==s||r!==0&&f.nodeType!==3||(l=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(o=a),h===s&&++d===r&&(l=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ny={focusedElem:e,selectionRange:n},zh=!1,Ce=t;Ce!==null;)if(t=Ce,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ce=e;else for(;Ce!==null;){t=Ce;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,w=m.memoizedState,g=t.stateNode,E=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:li(t.type,y),w);g.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(me(163))}}catch(_){cn(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Ce=e;break}Ce=t.return}return m=Dv,Dv=!1,m}function Gc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&zy(t,n,s)}i=i.next}while(i!==r)}}function am(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Vy(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function tC(e){var t=e.alternate;t!==null&&(e.alternate=null,tC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Li],delete t[Au],delete t[Iy],delete t[E5],delete t[x5])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nC(e){return e.tag===5||e.tag===3||e.tag===4}function Pv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ky(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yh));else if(r!==4&&(e=e.child,e!==null))for(Ky(e,t,n),e=e.sibling;e!==null;)Ky(e,t,n),e=e.sibling}function Yy(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Yy(e,t,n),e=e.sibling;e!==null;)Yy(e,t,n),e=e.sibling}var Hn=null,ci=!1;function xs(e,t,n){for(n=n.child;n!==null;)rC(e,t,n),n=n.sibling}function rC(e,t,n){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(Zp,n)}catch{}switch(n.tag){case 5:Qn||Fo(n,t);case 6:var r=Hn,i=ci;Hn=null,xs(e,t,n),Hn=r,ci=i,Hn!==null&&(ci?(e=Hn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Hn.removeChild(n.stateNode));break;case 18:Hn!==null&&(ci?(e=Hn,n=n.stateNode,e.nodeType===8?Ig(e.parentNode,n):e.nodeType===1&&Ig(e,n),_u(e)):Ig(Hn,n.stateNode));break;case 4:r=Hn,i=ci,Hn=n.stateNode.containerInfo,ci=!0,xs(e,t,n),Hn=r,ci=i;break;case 0:case 11:case 14:case 15:if(!Qn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&zy(n,t,a),i=i.next}while(i!==r)}xs(e,t,n);break;case 1:if(!Qn&&(Fo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){cn(n,t,o)}xs(e,t,n);break;case 21:xs(e,t,n);break;case 22:n.mode&1?(Qn=(r=Qn)||n.memoizedState!==null,xs(e,t,n),Qn=r):xs(e,t,n);break;default:xs(e,t,n)}}function jv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new P5),t.forEach(function(r){var i=Y5.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function si(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~s}if(r=i,r=hn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*F5(r/1960))-r,10e?16:e,Ds===null)var r=!1;else{if(e=Ds,Ds=null,sp=0,gt&6)throw Error(me(331));var i=gt;for(gt|=4,Ce=e.current;Ce!==null;){var s=Ce,a=s.child;if(Ce.flags&16){var o=s.deletions;if(o!==null){for(var l=0;lhn()-eE?Ra(e,0):Jb|=n),vr(e,t)}function dC(e,t){t===0&&(e.mode&1?(t=of,of<<=1,!(of&130023424)&&(of=4194304)):t=1);var n=ur();e=ds(e,t),e!==null&&(dd(e,t,n),vr(e,n))}function K5(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dC(e,n)}function Y5(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(me(314))}r!==null&&r.delete(t),dC(e,n)}var fC;fC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||xr.current)br=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return br=!1,L5(e,t,n);br=!!(e.flags&131072)}else br=!1,Gt&&t.flags&1048576&&gA(t,Xh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;uh(e,t),e=t.pendingProps;var i=hl(t,er.current);nl(t,n),i=Wb(null,t,r,e,i,n);var s=qb();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,wr(r)?(s=!0,qh(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Hb(t),i.updater=sm,t.stateNode=i,i._reactInternals=t,Py(t,r,e,n),t=Fy(null,t,r,!0,s,n)):(t.tag=0,Gt&&s&&Db(t),or(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(uh(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=q5(r),e=li(r,e),i){case 0:t=By(null,t,r,e,n);break e;case 1:t=Ov(null,t,r,e,n);break e;case 11:t=Iv(null,t,r,e,n);break e;case 14:t=Rv(null,t,r,li(r.type,e),n);break e}throw Error(me(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:li(r,i),By(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:li(r,i),Ov(e,t,r,i,n);case 3:e:{if(GA(t),e===null)throw Error(me(387));r=t.pendingProps,s=t.memoizedState,i=s.element,vA(e,t),Jh(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=yl(Error(me(423)),t),t=Lv(e,t,r,n,i);break e}else if(r!==i){i=yl(Error(me(424)),t),t=Lv(e,t,r,n,i);break e}else for(Mr=$s(t.stateNode.containerInfo.firstChild),Dr=t,Gt=!0,di=null,n=xA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(pl(),r===i){t=fs(e,t,n);break e}or(e,t,r,n)}t=t.child}return t;case 5:return _A(t),e===null&&Ly(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,a=i.children,Ay(r,i)?a=null:s!==null&&Ay(r,s)&&(t.flags|=32),qA(e,t),or(e,t,a,n),t.child;case 6:return e===null&&Ly(t),null;case 13:return XA(e,t,n);case 4:return zb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ml(t,null,r,n):or(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:li(r,i),Iv(e,t,r,i,n);case 7:return or(e,t,t.pendingProps,n),t.child;case 8:return or(e,t,t.pendingProps.children,n),t.child;case 12:return or(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,Bt(Qh,r._currentValue),r._currentValue=a,s!==null)if(bi(s.value,a)){if(s.children===i.children&&!xr.current){t=fs(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=rs(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),My(s.return,n,t),o.lanes|=n;break}l=l.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(me(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),My(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}or(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,nl(t,n),i=Jr(i),r=r(i),t.flags|=1,or(e,t,r,n),t.child;case 14:return r=t.type,i=li(r,t.pendingProps),i=li(r.type,i),Rv(e,t,r,i,n);case 15:return YA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:li(r,i),uh(e,t),t.tag=1,wr(r)?(e=!0,qh(t)):e=!1,nl(t,n),zA(t,r,i),Py(t,r,i,n),Fy(null,t,r,!0,e,n);case 19:return QA(e,t,n);case 22:return WA(e,t,n)}throw Error(me(156,t.tag))};function hC(e,t){return U2(e,t)}function W5(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xr(e,t,n,r){return new W5(e,t,n,r)}function iE(e){return e=e.prototype,!(!e||!e.isReactComponent)}function q5(e){if(typeof e=="function")return iE(e)?1:0;if(e!=null){if(e=e.$$typeof,e===_b)return 11;if(e===Tb)return 14}return 2}function Ks(e,t){var n=e.alternate;return n===null?(n=Xr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function hh(e,t,n,r,i,s){var a=2;if(r=e,typeof e=="function")iE(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Io:return Oa(n.children,i,s,t);case vb:a=8,i|=8;break;case ay:return e=Xr(12,n,t,i|2),e.elementType=ay,e.lanes=s,e;case oy:return e=Xr(13,n,t,i),e.elementType=oy,e.lanes=s,e;case ly:return e=Xr(19,n,t,i),e.elementType=ly,e.lanes=s,e;case _2:return lm(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case w2:a=10;break e;case v2:a=9;break e;case _b:a=11;break e;case Tb:a=14;break e;case Ns:a=16,r=null;break e}throw Error(me(130,e==null?e:typeof e,""))}return t=Xr(a,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Oa(e,t,n,r){return e=Xr(7,e,r,t),e.lanes=n,e}function lm(e,t,n,r){return e=Xr(22,e,r,t),e.elementType=_2,e.lanes=n,e.stateNode={isHidden:!1},e}function Bg(e,t,n){return e=Xr(6,e,null,t),e.lanes=n,e}function Fg(e,t,n){return t=Xr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function G5(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Eg(0),this.expirationTimes=Eg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Eg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function sE(e,t,n,r,i,s,a,o,l){return e=new G5(e,t,n,o,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Xr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hb(s),e}function X5(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yC)}catch(e){console.error(e)}}yC(),y2.exports=$r;var Va=y2.exports,Kv=Va;iy.createRoot=Kv.createRoot,iy.hydrateRoot=Kv.hydrateRoot;const cE=v.createContext({});function hm(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const pm=v.createContext(null),Du=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class tj extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function nj({children:e,isPresent:t}){const n=v.useId(),r=v.useRef(null),i=v.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=v.useContext(Du);return v.useInsertionEffect(()=>{const{width:a,height:o,top:l,left:u}=i.current;if(t||!r.current||!a||!o)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` - [data-motion-pop-id="${n}"] { - position: absolute !important; - width: ${a}px !important; - height: ${o}px !important; - top: ${l}px !important; - left: ${u}px !important; - } - `),()=>{document.head.removeChild(d)}},[t]),c.jsx(tj,{isPresent:t,childRef:r,sizeRef:i,children:v.cloneElement(e,{ref:r})})}const rj=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a})=>{const o=hm(ij),l=v.useId(),u=v.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;r&&r()},[o,r]),d=v.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),s?[Math.random(),u]:[n,u]);return v.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),v.useEffect(()=>{!n&&!o.size&&r&&r()},[n]),a==="popLayout"&&(e=c.jsx(nj,{isPresent:n,children:e})),c.jsx(pm.Provider,{value:d,children:e})};function ij(){return new Map}function bC(e=!0){const t=v.useContext(pm);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=v.useId();v.useEffect(()=>{e&&i(s)},[e]);const a=v.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,a]:[!0]}const Ef=e=>e.key||"";function Yv(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const uE=typeof window<"u",EC=uE?v.useLayoutEffect:v.useEffect,Ys=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1})=>{const[o,l]=bC(a),u=v.useMemo(()=>Yv(e),[e]),d=a&&!o?[]:u.map(Ef),f=v.useRef(!0),h=v.useRef(u),p=hm(()=>new Map),[m,y]=v.useState(u),[w,g]=v.useState(u);EC(()=>{f.current=!1,h.current=u;for(let _=0;_{const k=Ef(_),T=a&&!o?!1:u===w||d.includes(k),C=()=>{if(p.has(k))p.set(k,!0);else return;let S=!0;p.forEach(R=>{R||(S=!1)}),S&&(b==null||b(),g(h.current),a&&(l==null||l()),r&&r())};return c.jsx(rj,{isPresent:T,initial:!f.current||n?void 0:!1,custom:T?void 0:t,presenceAffectsLayout:i,mode:s,onExitComplete:T?void 0:C,children:_},k)})})},Pr=e=>e;let xC=Pr;const sj={useManualTiming:!1};function aj(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){s.has(u)&&(l.schedule(u),e()),u(a)}const l={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&s.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(o),t.clear(),r=!1,i&&(i=!1,l.process(u))}};return l}const xf=["read","resolveKeyframes","update","preRender","render","postRender"],oj=40;function wC(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=xf.reduce((g,E)=>(g[E]=aj(s),g),{}),{read:o,resolveKeyframes:l,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const g=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(g-i.timestamp,oj),1),i.timestamp=g,i.isProcessing=!0,o.process(i),l.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,i.isProcessing||e(p)};return{schedule:xf.reduce((g,E)=>{const b=a[E];return g[E]=(_,k=!1,T=!1)=>(n||m(),b.schedule(_,k,T)),g},{}),cancel:g=>{for(let E=0;EWv[e].some(n=>!!t[n])};function lj(e){for(const t in e)El[t]={...El[t],...e[t]}}const cj=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function lp(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||cj.has(e)}let _C=e=>!lp(e);function TC(e){e&&(_C=t=>t.startsWith("on")?!lp(t):e(t))}try{TC(require("@emotion/is-prop-valid").default)}catch{}function uj(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(_C(i)||n===!0&&lp(i)||!t&&!lp(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function dj({children:e,isValidProp:t,...n}){t&&TC(t),n={...v.useContext(Du),...n},n.isStatic=hm(()=>n.isStatic);const r=v.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return c.jsx(Du.Provider,{value:r,children:e})}function fj(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const mm=v.createContext({});function Pu(e){return typeof e=="string"||Array.isArray(e)}function gm(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const dE=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],fE=["initial",...dE];function ym(e){return gm(e.animate)||fE.some(t=>Pu(e[t]))}function kC(e){return!!(ym(e)||e.variants)}function hj(e,t){if(ym(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Pu(n)?n:void 0,animate:Pu(r)?r:void 0}}return e.inherit!==!1?t:{}}function pj(e){const{initial:t,animate:n}=hj(e,v.useContext(mm));return v.useMemo(()=>({initial:t,animate:n}),[qv(t),qv(n)])}function qv(e){return Array.isArray(e)?e.join(" "):e}const mj=Symbol.for("motionComponentSymbol");function $o(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function gj(e,t,n){return v.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):$o(n)&&(n.current=r))},[t])}const hE=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),yj="framerAppearId",SC="data-"+hE(yj),{schedule:pE}=wC(queueMicrotask,!1),NC=v.createContext({});function bj(e,t,n,r,i){var s,a;const{visualElement:o}=v.useContext(mm),l=v.useContext(vC),u=v.useContext(pm),d=v.useContext(Du).reducedMotion,f=v.useRef(null);r=r||l.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=v.useContext(NC);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&Ej(f.current,n,i,p);const m=v.useRef(!1);v.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const y=n[SC],w=v.useRef(!!y&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,y))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,y)));return EC(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),pE.render(h.render),w.current&&h.animationState&&h.animationState.animateChanges())}),v.useEffect(()=>{h&&(!w.current&&h.animationState&&h.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,y)}),w.current=!1))}),h}function Ej(e,t,n,r){const{layoutId:i,layout:s,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:AC(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||o&&$o(o),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function AC(e){if(e)return e.options.allowProjection!==!1?e.projection:AC(e.parent)}function xj({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,a;e&&lj(e);function o(u,d){let f;const h={...v.useContext(Du),...u,layoutId:wj(u)},{isStatic:p}=h,m=pj(u),y=r(u,p);if(!p&&uE){vj();const w=_j(h);f=w.MeasureLayout,m.visualElement=bj(i,y,h,t,w.ProjectionNode)}return c.jsxs(mm.Provider,{value:m,children:[f&&m.visualElement?c.jsx(f,{visualElement:m.visualElement,...h}):null,n(i,u,gj(y,m.visualElement,d),y,p,m.visualElement)]})}o.displayName=`motion.${typeof i=="string"?i:`create(${(a=(s=i.displayName)!==null&&s!==void 0?s:i.name)!==null&&a!==void 0?a:""})`}`;const l=v.forwardRef(o);return l[mj]=i,l}function wj({layoutId:e}){const t=v.useContext(cE).id;return t&&e!==void 0?t+"-"+e:e}function vj(e,t){v.useContext(vC).strict}function _j(e){const{drag:t,layout:n}=El;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const Tj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function mE(e){return typeof e!="string"||e.includes("-")?!1:!!(Tj.indexOf(e)>-1||/[A-Z]/u.test(e))}function Gv(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function gE(e,t,n,r){if(typeof t=="function"){const[i,s]=Gv(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=Gv(r);t=t(n!==void 0?n:e.custom,i,s)}return t}const Qy=e=>Array.isArray(e),kj=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Sj=e=>Qy(e)?e[e.length-1]||0:e,Zn=e=>!!(e&&e.getVelocity);function ph(e){const t=Zn(e)?e.get():e;return kj(t)?t.toValue():t}function Nj({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,s){const a={latestValues:Aj(r,i,s,e),renderState:t()};return n&&(a.onMount=o=>n({props:r,current:o,...a}),a.onUpdate=o=>n(o)),a}const CC=e=>(t,n)=>{const r=v.useContext(mm),i=v.useContext(pm),s=()=>Nj(e,t,r,i);return n?s():hm(s)};function Aj(e,t,n,r){const i={},s=r(e,{});for(const h in s)i[h]=ph(s[h]);let{initial:a,animate:o}=e;const l=ym(e),u=kC(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!gm(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),RC=IC("--"),Cj=IC("var(--"),yE=e=>Cj(e)?Ij.test(e.split("/*")[0].trim()):!1,Ij=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,OC=(e,t)=>t&&typeof e=="number"?t.transform(e):e,hs=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},ju={...zl,transform:e=>hs(0,1,e)},wf={...zl,default:1},md=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ts=md("deg"),Pi=md("%"),Ve=md("px"),Rj=md("vh"),Oj=md("vw"),Xv={...Pi,parse:e=>Pi.parse(e)/100,transform:e=>Pi.transform(e*100)},Lj={borderWidth:Ve,borderTopWidth:Ve,borderRightWidth:Ve,borderBottomWidth:Ve,borderLeftWidth:Ve,borderRadius:Ve,radius:Ve,borderTopLeftRadius:Ve,borderTopRightRadius:Ve,borderBottomRightRadius:Ve,borderBottomLeftRadius:Ve,width:Ve,maxWidth:Ve,height:Ve,maxHeight:Ve,top:Ve,right:Ve,bottom:Ve,left:Ve,padding:Ve,paddingTop:Ve,paddingRight:Ve,paddingBottom:Ve,paddingLeft:Ve,margin:Ve,marginTop:Ve,marginRight:Ve,marginBottom:Ve,marginLeft:Ve,backgroundPositionX:Ve,backgroundPositionY:Ve},Mj={rotate:Ts,rotateX:Ts,rotateY:Ts,rotateZ:Ts,scale:wf,scaleX:wf,scaleY:wf,scaleZ:wf,skew:Ts,skewX:Ts,skewY:Ts,distance:Ve,translateX:Ve,translateY:Ve,translateZ:Ve,x:Ve,y:Ve,z:Ve,perspective:Ve,transformPerspective:Ve,opacity:ju,originX:Xv,originY:Xv,originZ:Ve},Qv={...zl,transform:Math.round},bE={...Lj,...Mj,zIndex:Qv,size:Ve,fillOpacity:ju,strokeOpacity:ju,numOctaves:Qv},Dj={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Pj=Hl.length;function jj(e,t,n){let r="",i=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),LC=()=>({...wE(),attrs:{}}),vE=e=>typeof e=="string"&&e.toLowerCase()==="svg";function MC(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const s in n)e.style.setProperty(s,n[s])}const DC=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function PC(e,t,n,r){MC(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(DC.has(i)?i:hE(i),t.attrs[i])}const cp={};function Hj(e){Object.assign(cp,e)}function jC(e,{layout:t,layoutId:n}){return ro.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!cp[e]||e==="opacity")}function _E(e,t,n){var r;const{style:i}=e,s={};for(const a in i)(Zn(i[a])||t.style&&Zn(t.style[a])||jC(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(s[a]=i[a]);return s}function BC(e,t,n){const r=_E(e,t,n);for(const i in e)if(Zn(e[i])||Zn(t[i])){const s=Hl.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function zj(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Jv=["x","y","width","height","cx","cy","r"],Vj={useVisualState:CC({scrapeMotionValuesFromProps:BC,createRenderState:LC,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let s=!!e.drag;if(!s){for(const o in i)if(ro.has(o)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let o=0;o{zj(n,r),zt.render(()=>{xE(r,i,vE(n.tagName),e.transformTemplate),PC(n,r)})})}})},Kj={useVisualState:CC({scrapeMotionValuesFromProps:_E,createRenderState:wE})};function FC(e,t,n){for(const r in t)!Zn(t[r])&&!jC(r,n)&&(e[r]=t[r])}function Yj({transformTemplate:e},t){return v.useMemo(()=>{const n=wE();return EE(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Wj(e,t){const n=e.style||{},r={};return FC(r,n,e),Object.assign(r,Yj(e,t)),r}function qj(e,t){const n={},r=Wj(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function Gj(e,t,n,r){const i=v.useMemo(()=>{const s=LC();return xE(s,t,vE(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};FC(s,e.style,e),i.style={...s,...i.style}}return i}function Xj(e=!1){return(n,r,i,{latestValues:s},a)=>{const l=(mE(n)?Gj:qj)(r,s,a,n),u=uj(r,typeof n=="string",e),d=n!==v.Fragment?{...u,...l,ref:i}:{},{children:f}=r,h=v.useMemo(()=>Zn(f)?f.get():f,[f]);return v.createElement(n,{...d,children:h})}}function Qj(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...mE(r)?Vj:Kj,preloadedFeatures:e,useRender:Xj(i),createVisualElement:t,Component:r};return xj(a)}}function UC(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(mh===void 0&&ji.set(zn.isProcessing||sj.useManualTiming?zn.timestamp:performance.now()),mh),set:e=>{mh=e,queueMicrotask(Zj)}};function kE(e,t){e.indexOf(t)===-1&&e.push(t)}function SE(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class NE{constructor(){this.subscriptions=[]}add(t){return kE(this.subscriptions,t),()=>SE(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s!isNaN(parseFloat(e));class eB{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=ji.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=ji.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Jj(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new NE);const r=this.events[t].add(n);return t==="change"?()=>{r(),zt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=ji.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>e_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,e_);return HC(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Bu(e,t){return new eB(e,t)}function tB(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Bu(n))}function nB(e,t){const n=bm(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const o=Sj(s[a]);tB(e,a,o)}}function rB(e){return!!(Zn(e)&&e.add)}function Zy(e,t){const n=e.getValue("willChange");if(rB(n))return n.add(t)}function zC(e){return e.props[SC]}function AE(e){let t;return()=>(t===void 0&&(t=e()),t)}const iB=AE(()=>window.ScrollTimeline!==void 0);class sB{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(iB()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{r.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class aB extends sB{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const is=e=>e*1e3,ss=e=>e/1e3;function CE(e){return typeof e=="function"}function t_(e,t){e.timeline=t,e.onfinish=null}const IE=e=>Array.isArray(e)&&typeof e[0]=="number",oB={linearEasing:void 0};function lB(e,t){const n=AE(e);return()=>{var r;return(r=oB[t])!==null&&r!==void 0?r:n()}}const up=lB(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xl=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},VC=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jy={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Dc([0,.65,.55,1]),circOut:Dc([.55,0,1,.45]),backIn:Dc([.31,.01,.66,-.59]),backOut:Dc([.33,1.53,.69,.99])};function YC(e,t){if(e)return typeof e=="function"&&up()?VC(e,t):IE(e)?Dc(e):Array.isArray(e)?e.map(n=>YC(n,t)||Jy.easeOut):Jy[e]}const WC=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,cB=1e-7,uB=12;function dB(e,t,n,r,i){let s,a,o=0;do a=t+(n-t)/2,s=WC(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>cB&&++odB(s,0,1,e,n);return s=>s===0||s===1?s:WC(i(s),t,r)}const qC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,GC=e=>t=>1-e(1-t),XC=gd(.33,1.53,.69,.99),RE=GC(XC),QC=qC(RE),ZC=e=>(e*=2)<1?.5*RE(e):.5*(2-Math.pow(2,-10*(e-1))),OE=e=>1-Math.sin(Math.acos(e)),JC=GC(OE),eI=qC(OE),tI=e=>/^0[^.\s]+$/u.test(e);function fB(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||tI(e):!0}const Zc=e=>Math.round(e*1e5)/1e5,LE=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hB(e){return e==null}const pB=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ME=(e,t)=>n=>!!(typeof n=="string"&&pB.test(n)&&n.startsWith(e)||t&&!hB(n)&&Object.prototype.hasOwnProperty.call(n,t)),nI=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,o]=r.match(LE);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},mB=e=>hs(0,255,e),$g={...zl,transform:e=>Math.round(mB(e))},Sa={test:ME("rgb","red"),parse:nI("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+$g.transform(e)+", "+$g.transform(t)+", "+$g.transform(n)+", "+Zc(ju.transform(r))+")"};function gB(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const e1={test:ME("#"),parse:gB,transform:Sa.transform},Ho={test:ME("hsl","hue"),parse:nI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Pi.transform(Zc(t))+", "+Pi.transform(Zc(n))+", "+Zc(ju.transform(r))+")"},Xn={test:e=>Sa.test(e)||e1.test(e)||Ho.test(e),parse:e=>Sa.test(e)?Sa.parse(e):Ho.test(e)?Ho.parse(e):e1.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Sa.transform(e):Ho.transform(e)},yB=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function bB(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(LE))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(yB))===null||n===void 0?void 0:n.length)||0)>0}const rI="number",iI="color",EB="var",xB="var(",n_="${}",wB=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Fu(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const o=t.replace(wB,l=>(Xn.test(l)?(r.color.push(s),i.push(iI),n.push(Xn.parse(l))):l.startsWith(xB)?(r.var.push(s),i.push(EB),n.push(l)):(r.number.push(s),i.push(rI),n.push(parseFloat(l))),++s,n_)).split(n_);return{values:n,split:o,indexes:r,types:i}}function sI(e){return Fu(e).values}function aI(e){const{split:t,types:n}=Fu(e),r=t.length;return i=>{let s="";for(let a=0;atypeof e=="number"?0:e;function _B(e){const t=sI(e);return aI(e)(t.map(vB))}const Js={test:bB,parse:sI,createTransformer:aI,getAnimatableNone:_B},TB=new Set(["brightness","contrast","saturate","opacity"]);function kB(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(LE)||[];if(!r)return e;const i=n.replace(r,"");let s=TB.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const SB=/\b([a-z-]*)\(.*?\)/gu,t1={...Js,getAnimatableNone:e=>{const t=e.match(SB);return t?t.map(kB).join(" "):e}},NB={...bE,color:Xn,backgroundColor:Xn,outlineColor:Xn,fill:Xn,stroke:Xn,borderColor:Xn,borderTopColor:Xn,borderRightColor:Xn,borderBottomColor:Xn,borderLeftColor:Xn,filter:t1,WebkitFilter:t1},DE=e=>NB[e];function oI(e,t){let n=DE(e);return n!==t1&&(n=Js),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const AB=new Set(["auto","none","0"]);function CB(e,t,n){let r=0,i;for(;re===zl||e===Ve,i_=(e,t)=>parseFloat(e.split(", ")[t]),s_=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return i_(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?i_(s[1],e):0}},IB=new Set(["x","y","z"]),RB=Hl.filter(e=>!IB.has(e));function OB(e){const t=[];return RB.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const wl={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:s_(4,13),y:s_(5,14)};wl.translateX=wl.x;wl.translateY=wl.y;const La=new Set;let n1=!1,r1=!1;function lI(){if(r1){const e=Array.from(La).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=OB(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,a])=>{var o;(o=r.getValue(s))===null||o===void 0||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}r1=!1,n1=!1,La.forEach(e=>e.complete()),La.clear()}function cI(){La.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(r1=!0)})}function LB(){cI(),lI()}class PE{constructor(t,n,r,i,s,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(La.add(this),n1||(n1=!0,zt.read(cI),zt.resolveKeyframes(lI))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;for(let s=0;s/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),MB=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function DB(e){const t=MB.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function dI(e,t,n=1){const[r,i]=DB(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return uI(a)?parseFloat(a):a}return yE(i)?dI(i,t,n+1):i}const fI=e=>t=>t.test(e),PB={test:e=>e==="auto",parse:e=>e},hI=[zl,Ve,Pi,Ts,Oj,Rj,PB],a_=e=>hI.find(fI(e));class pI extends PE{constructor(t,n,r,i,s){super(t,n,r,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const o_=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Js.test(e)||e==="0")&&!e.startsWith("url("));function jB(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Em(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(FB),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const UB=40;class mI{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=ji.now(),this.options={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>UB?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&LB(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=ji.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:a,onComplete:o,onUpdate:l,isGenerator:u}=this.options;if(!u&&!BB(t,r,i,s))if(a)this.options.duration=0;else{l&&l(Em(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const i1=2e4;function gI(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=i1?1/0:t}const sn=(e,t,n)=>e+(t-e)*n;function Hg(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function $B({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,a=0;if(!t)i=s=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;i=Hg(l,o,e+1/3),s=Hg(l,o,e),a=Hg(l,o,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function dp(e,t){return n=>n>0?t:e}const zg=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},HB=[e1,Sa,Ho],zB=e=>HB.find(t=>t.test(e));function l_(e){const t=zB(e);if(!t)return!1;let n=t.parse(e);return t===Ho&&(n=$B(n)),n}const c_=(e,t)=>{const n=l_(e),r=l_(t);if(!n||!r)return dp(e,t);const i={...n};return s=>(i.red=zg(n.red,r.red,s),i.green=zg(n.green,r.green,s),i.blue=zg(n.blue,r.blue,s),i.alpha=sn(n.alpha,r.alpha,s),Sa.transform(i))},VB=(e,t)=>n=>t(e(n)),yd=(...e)=>e.reduce(VB),s1=new Set(["none","hidden"]);function KB(e,t){return s1.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function YB(e,t){return n=>sn(e,t,n)}function jE(e){return typeof e=="number"?YB:typeof e=="string"?yE(e)?dp:Xn.test(e)?c_:GB:Array.isArray(e)?yI:typeof e=="object"?Xn.test(e)?c_:WB:dp}function yI(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>jE(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in r)n[s]=r[s](i);return n}}function qB(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=Js.createTransformer(t),r=Fu(e),i=Fu(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?s1.has(e)&&!i.values.length||s1.has(t)&&!r.values.length?KB(e,t):yd(yI(qB(r,i),i.values),n):dp(e,t)};function bI(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?sn(e,t,n):jE(e)(e,t)}const XB=5;function EI(e,t,n){const r=Math.max(t-XB,0);return HC(n-e(r),t-r)}const ln={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Vg=.001;function QB({duration:e=ln.duration,bounce:t=ln.bounce,velocity:n=ln.velocity,mass:r=ln.mass}){let i,s,a=1-t;a=hs(ln.minDamping,ln.maxDamping,a),e=hs(ln.minDuration,ln.maxDuration,ss(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=a1(u,a),m=Math.exp(-f);return Vg-h/p*m},s=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),y=a1(Math.pow(u,2),a);return(-i(u)+Vg>0?-1:1)*((h-p)*m)/y}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Vg+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,l=JB(i,s,o);if(e=is(e),isNaN(l))return{stiffness:ln.stiffness,damping:ln.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const ZB=12;function JB(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function n8(e){let t={velocity:ln.velocity,stiffness:ln.stiffness,damping:ln.damping,mass:ln.mass,isResolvedFromDuration:!1,...e};if(!u_(e,t8)&&u_(e,e8))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*hs(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ln.mass,stiffness:i,damping:s}}else{const n=QB(e);t={...t,...n,mass:ln.mass},t.isResolvedFromDuration=!0}return t}function xI(e=ln.visualDuration,t=ln.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:s},{stiffness:l,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=n8({...n,velocity:-ss(n.velocity||0)}),m=h||0,y=u/(2*Math.sqrt(l*d)),w=a-s,g=ss(Math.sqrt(l/d)),E=Math.abs(w)<5;r||(r=E?ln.restSpeed.granular:ln.restSpeed.default),i||(i=E?ln.restDelta.granular:ln.restDelta.default);let b;if(y<1){const k=a1(g,y);b=T=>{const C=Math.exp(-y*g*T);return a-C*((m+y*g*w)/k*Math.sin(k*T)+w*Math.cos(k*T))}}else if(y===1)b=k=>a-Math.exp(-g*k)*(w+(m+g*w)*k);else{const k=g*Math.sqrt(y*y-1);b=T=>{const C=Math.exp(-y*g*T),S=Math.min(k*T,300);return a-C*((m+y*g*w)*Math.sinh(S)+k*w*Math.cosh(S))/k}}const _={calculatedDuration:p&&f||null,next:k=>{const T=b(k);if(p)o.done=k>=f;else{let C=0;y<1&&(C=k===0?is(m):EI(b,k,T));const S=Math.abs(C)<=r,R=Math.abs(a-T)<=i;o.done=S&&R}return o.value=o.done?a:T,o},toString:()=>{const k=Math.min(gI(_),i1),T=VC(C=>_.next(k*C).value,k,30);return k+"ms "+T}};return _}function d_({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=S=>o!==void 0&&Sl,m=S=>o===void 0?l:l===void 0||Math.abs(o-S)-y*Math.exp(-S/r),b=S=>g+E(S),_=S=>{const R=E(S),I=b(S);h.done=Math.abs(R)<=u,h.value=h.done?g:I};let k,T;const C=S=>{p(h.value)&&(k=S,T=xI({keyframes:[h.value,m(h.value)],velocity:EI(b,S,h.value),damping:i,stiffness:s,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:S=>{let R=!1;return!T&&k===void 0&&(R=!0,_(S),C(S)),k!==void 0&&S>=k?T.next(S-k):(!R&&_(S),h)}}}const r8=gd(.42,0,1,1),i8=gd(0,0,.58,1),wI=gd(.42,0,.58,1),s8=e=>Array.isArray(e)&&typeof e[0]!="number",a8={linear:Pr,easeIn:r8,easeInOut:wI,easeOut:i8,circIn:OE,circInOut:eI,circOut:JC,backIn:RE,backInOut:QC,backOut:XC,anticipate:ZC},f_=e=>{if(IE(e)){xC(e.length===4);const[t,n,r,i]=e;return gd(t,n,r,i)}else if(typeof e=="string")return a8[e];return e};function o8(e,t,n){const r=[],i=n||bI,s=e.length-1;for(let a=0;at[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=o8(t,r,i),l=o.length,u=d=>{if(a&&d1)for(;fu(hs(e[0],e[s-1],d)):u}function c8(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=xl(0,t,r);e.push(sn(n,1,i))}}function u8(e){const t=[0];return c8(t,e.length-1),t}function d8(e,t){return e.map(n=>n*t)}function f8(e,t){return e.map(()=>t||wI).splice(0,e.length-1)}function fp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=s8(r)?r.map(f_):f_(r),s={done:!1,value:t[0]},a=d8(n&&n.length===t.length?n:u8(t),e),o=l8(a,t,{ease:Array.isArray(i)?i:f8(t,i)});return{calculatedDuration:e,next:l=>(s.value=o(l),s.done=l>=e,s)}}const h8=e=>{const t=({timestamp:n})=>e(n);return{start:()=>zt.update(t,!0),stop:()=>Zs(t),now:()=>zn.isProcessing?zn.timestamp:ji.now()}},p8={decay:d_,inertia:d_,tween:fp,keyframes:fp,spring:xI},m8=e=>e/100;class BE extends mI{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:i,keyframes:s}=this.options,a=(i==null?void 0:i.KeyframeResolver)||PE,o=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new a(s,o,n,r,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:a=0}=this.options,o=CE(n)?n:p8[n]||fp;let l,u;o!==fp&&typeof t[0]!="number"&&(l=yd(m8,bI(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});s==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=gI(d));const{calculatedDuration:f}=d,h=f+i,p=h*(r+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:l,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return s.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:y,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),E=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let b=this.currentTime,_=s;if(p){const S=Math.min(this.currentTime,d)/f;let R=Math.floor(S),I=S%1;!I&&S>=1&&(I=1),I===1&&R--,R=Math.min(R,p+1),!!(R%2)&&(m==="reverse"?(I=1-I,y&&(I-=y/f)):m==="mirror"&&(_=a)),b=hs(0,1,I)*f}const k=E?{done:!1,value:l[0]}:_.next(b);o&&(k.value=o(k.value));let{done:T}=k;!E&&u!==null&&(T=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return C&&i!==void 0&&(k.value=Em(l,this.options,i)),w&&w(k.value),C&&this.finish(),k}get duration(){const{resolved:t}=this;return t?ss(t.calculatedDuration):0}get time(){return ss(this.currentTime)}set time(t){t=is(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=ss(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=h8,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const g8=new Set(["opacity","clipPath","filter","transform"]);function y8(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:o="easeInOut",times:l}={}){const u={[t]:n};l&&(u.offset=l);const d=YC(o,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const b8=AE(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),hp=10,E8=2e4;function x8(e){return CE(e.type)||e.type==="spring"||!KC(e.ease)}function w8(e,t){const n=new BE({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const i=[];let s=0;for(;!r.done&&sthis.onKeyframesResolved(a,o),n,r,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:i,ease:s,type:a,motionValue:o,name:l,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof s=="string"&&up()&&v8(s)&&(s=vI[s]),x8(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...y}=this.options,w=w8(t,y);t=w.keyframes,t.length===1&&(t[1]=t[0]),r=w.duration,i=w.times,s=w.ease,a="keyframes"}const d=y8(o.owner.current,l,t,{...this.options,duration:r,times:i,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(t_(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(Em(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:i,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return ss(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return ss(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=is(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Pr;const{animation:r}=n;t_(r,t)}return Pr}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:i,type:s,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new BE({...p,keyframes:r,duration:i,type:s,ease:a,times:o,isGenerator:!0}),y=is(this.time);u.setWithVelocity(m.sample(y-hp).value,m.sample(y).value,hp)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:i,repeatType:s,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=n.owner.getProps();return b8()&&r&&g8.has(r)&&!l&&!u&&!i&&s!=="mirror"&&a!==0&&o!=="inertia"}}const _8={type:"spring",stiffness:500,damping:25,restSpeed:10},T8=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),k8={type:"keyframes",duration:.8},S8={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},N8=(e,{keyframes:t})=>t.length>2?k8:ro.has(e)?e.startsWith("scale")?T8(t[1]):_8:S8;function A8({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:a,repeatDelay:o,from:l,elapsed:u,...d}){return!!Object.keys(d).length}const FE=(e,t,n,r={},i,s)=>a=>{const o=TE(r,e)||{},l=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-is(l);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:s?void 0:i};A8(o)||(d={...d,...N8(e,d)}),d.duration&&(d.duration=is(d.duration)),d.repeatDelay&&(d.repeatDelay=is(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!s&&t.get()!==void 0){const h=Em(d.keyframes,o);if(h!==void 0)return zt.update(()=>{d.onUpdate(h),d.onComplete()}),new aB([])}return!s&&h_.supports(d)?new h_(d):new BE(d)};function C8({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function _I(e,t,{delay:n=0,transitionOverride:r,type:i}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...l}=t;r&&(a=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in l){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),p=l[f];if(p===void 0||d&&C8(d,f))continue;const m={delay:n,...TE(a||{},f)};let y=!1;if(window.MotionHandoffAnimation){const g=zC(e);if(g){const E=window.MotionHandoffAnimation(g,f,zt);E!==null&&(m.startTime=E,y=!0)}}Zy(e,f),h.start(FE(f,h,p,e.shouldReduceMotion&&$C.has(f)?{type:!1}:m,e,y));const w=h.animation;w&&u.push(w)}return o&&Promise.all(u).then(()=>{zt.update(()=>{o&&nB(e,o)})}),u}function o1(e,t,n={}){var r;const i=bm(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const a=i?()=>Promise.all(_I(e,i,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return I8(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function I8(e,t,n=0,r=0,i=1,s){const a=[],o=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(e.variantChildren).sort(R8).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(o1(u,t,{...s,delay:n+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function R8(e,t){return e.sortNodePosition(t)}function O8(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>o1(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=o1(e,t,n);else{const i=typeof t=="function"?bm(e,t,n.custom):t;r=Promise.all(_I(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const L8=fE.length;function TI(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?TI(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>O8(e,n,r)))}function j8(e){let t=P8(e),n=p_(),r=!0;const i=l=>(u,d)=>{var f;const h=bm(e,d,l==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...y}=h;u={...u,...y,...m}}return u};function s(l){t=l(e)}function a(l){const{props:u}=e,d=TI(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let w=0;wm&&_,R=!1;const I=Array.isArray(b)?b:[b];let M=I.reduce(i(g),{});k===!1&&(M={});const{prevResolvedValues:B={}}=E,Y={...B,...M},P=L=>{S=!0,h.has(L)&&(R=!0,h.delete(L)),E.needsAnimating[L]=!0;const O=e.getValue(L);O&&(O.liveStyle=!1)};for(const L in Y){const O=M[L],j=B[L];if(p.hasOwnProperty(L))continue;let N=!1;Qy(O)&&Qy(j)?N=!UC(O,j):N=O!==j,N?O!=null?P(L):h.add(L):O!==void 0&&h.has(L)?P(L):E.protectedKeys[L]=!0}E.prevProp=b,E.prevResolvedValues=M,E.isActive&&(p={...p,...M}),r&&e.blockInitialAnimation&&(S=!1),S&&(!(T&&C)||R)&&f.push(...I.map(L=>({animation:L,options:{type:g}})))}if(h.size){const w={};h.forEach(g=>{const E=e.getBaseTarget(g),b=e.getValue(g);b&&(b.liveStyle=!0),w[g]=E??null}),f.push({animation:w})}let y=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(f):Promise.resolve()}function o(l,u){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:s,getState:()=>n,reset:()=>{n=p_(),r=!0}}}function B8(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!UC(t,e):!1}function da(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function p_(){return{animate:da(!0),whileInView:da(),whileHover:da(),whileTap:da(),whileDrag:da(),whileFocus:da(),exit:da()}}class ia{constructor(t){this.isMounted=!1,this.node=t}update(){}}class F8 extends ia{constructor(t){super(t),t.animationState||(t.animationState=j8(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();gm(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let U8=0;class $8 extends ia{constructor(){super(...arguments),this.id=U8++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const H8={animation:{Feature:F8},exit:{Feature:$8}},oi={x:!1,y:!1};function kI(){return oi.x||oi.y}function z8(e){return e==="x"||e==="y"?oi[e]?null:(oi[e]=!0,()=>{oi[e]=!1}):oi.x||oi.y?null:(oi.x=oi.y=!0,()=>{oi.x=oi.y=!1})}const UE=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Uu(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function bd(e){return{point:{x:e.pageX,y:e.pageY}}}const V8=e=>t=>UE(t)&&e(t,bd(t));function Jc(e,t,n,r){return Uu(e,t,V8(n),r)}const m_=(e,t)=>Math.abs(e-t);function K8(e,t){const n=m_(e.x,t.x),r=m_(e.y,t.y);return Math.sqrt(n**2+r**2)}class SI{constructor(t,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Yg(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=K8(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:y}=zn;this.history.push({...m,timestamp:y});const{onStart:w,onMove:g}=this.handlers;h||(w&&w(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Kg(h,this.transformPagePoint),zt.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Yg(f.type==="pointercancel"?this.lastMoveEventInfo:Kg(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,w),m&&m(f,w)},!UE(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const a=bd(t),o=Kg(a,this.transformPagePoint),{point:l}=o,{timestamp:u}=zn;this.history=[{...l,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Yg(o,this.history)),this.removeListeners=yd(Jc(this.contextWindow,"pointermove",this.handlePointerMove),Jc(this.contextWindow,"pointerup",this.handlePointerUp),Jc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Zs(this.updatePoint)}}function Kg(e,t){return t?{point:t(e.point)}:e}function g_(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Yg({point:e},t){return{point:e,delta:g_(e,NI(t)),offset:g_(e,Y8(t)),velocity:W8(t,.1)}}function Y8(e){return e[0]}function NI(e){return e[e.length-1]}function W8(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=NI(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>is(t)));)n--;if(!r)return{x:0,y:0};const s=ss(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const a={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const AI=1e-4,q8=1-AI,G8=1+AI,CI=.01,X8=0-CI,Q8=0+CI;function Fr(e){return e.max-e.min}function Z8(e,t,n){return Math.abs(e-t)<=n}function y_(e,t,n,r=.5){e.origin=r,e.originPoint=sn(t.min,t.max,e.origin),e.scale=Fr(n)/Fr(t),e.translate=sn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=q8&&e.scale<=G8||isNaN(e.scale))&&(e.scale=1),(e.translate>=X8&&e.translate<=Q8||isNaN(e.translate))&&(e.translate=0)}function eu(e,t,n,r){y_(e.x,t.x,n.x,r?r.originX:void 0),y_(e.y,t.y,n.y,r?r.originY:void 0)}function b_(e,t,n){e.min=n.min+t.min,e.max=e.min+Fr(t)}function J8(e,t,n){b_(e.x,t.x,n.x),b_(e.y,t.y,n.y)}function E_(e,t,n){e.min=t.min-n.min,e.max=e.min+Fr(t)}function tu(e,t,n){E_(e.x,t.x,n.x),E_(e.y,t.y,n.y)}function eF(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?sn(n,e,r.max):Math.min(e,n)),e}function x_(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function tF(e,{top:t,left:n,bottom:r,right:i}){return{x:x_(e.x,n,i),y:x_(e.y,t,r)}}function w_(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=xl(t.min,t.max-r,e.min):r>i&&(n=xl(e.min,e.max-i,t.min)),hs(0,1,n)}function iF(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const l1=.35;function sF(e=l1){return e===!1?e=0:e===!0&&(e=l1),{x:v_(e,"left","right"),y:v_(e,"top","bottom")}}function v_(e,t,n){return{min:__(e,t),max:__(e,n)}}function __(e,t){return typeof e=="number"?e:e[t]||0}const T_=()=>({translate:0,scale:1,origin:0,originPoint:0}),zo=()=>({x:T_(),y:T_()}),k_=()=>({min:0,max:0}),fn=()=>({x:k_(),y:k_()});function Vr(e){return[e("x"),e("y")]}function II({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function aF({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function oF(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Wg(e){return e===void 0||e===1}function c1({scale:e,scaleX:t,scaleY:n}){return!Wg(e)||!Wg(t)||!Wg(n)}function ga(e){return c1(e)||RI(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function RI(e){return S_(e.x)||S_(e.y)}function S_(e){return e&&e!=="0%"}function pp(e,t,n){const r=e-n,i=t*r;return n+i}function N_(e,t,n,r,i){return i!==void 0&&(e=pp(e,i,r)),pp(e,n,r)+t}function u1(e,t=0,n=1,r,i){e.min=N_(e.min,t,n,r,i),e.max=N_(e.max,t,n,r,i)}function OI(e,{x:t,y:n}){u1(e.x,t.translate,t.scale,t.originPoint),u1(e.y,n.translate,n.scale,n.originPoint)}const A_=.999999999999,C_=1.0000000000001;function lF(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,a;for(let o=0;oA_&&(t.x=1),t.yA_&&(t.y=1)}function Vo(e,t){e.min=e.min+t,e.max=e.max+t}function I_(e,t,n,r,i=.5){const s=sn(e.min,e.max,i);u1(e,t,n,s,r)}function Ko(e,t){I_(e.x,t.x,t.scaleX,t.scale,t.originX),I_(e.y,t.y,t.scaleY,t.scale,t.originY)}function LI(e,t){return II(oF(e.getBoundingClientRect(),t))}function cF(e,t,n){const r=LI(e,n),{scroll:i}=t;return i&&(Vo(r.x,i.offset.x),Vo(r.y,i.offset.y)),r}const MI=({current:e})=>e?e.ownerDocument.defaultView:null,uF=new WeakMap;class dF{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=fn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(bd(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=z8(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vr(w=>{let g=this.getAxisMotionValue(w).get()||0;if(Pi.test(g)){const{projection:E}=this.visualElement;if(E&&E.layout){const b=E.layout.layoutBox[w];b&&(g=Fr(b)*(parseFloat(g)/100))}}this.originPoint[w]=g}),m&&zt.postRender(()=>m(d,f)),Zy(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:y}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=fF(w),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),y&&y(d,f)},o=(d,f)=>this.stop(d,f),l=()=>Vr(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new SI(t,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:MI(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&zt.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!vf(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=eF(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&$o(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=tF(i.layoutBox,n):this.constraints=!1,this.elastic=sF(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Vr(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=iF(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!$o(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=cF(r,i.root,this.visualElement.getTransformPagePoint());let a=nF(i.layout.layoutBox,s);if(n){const o=n(aF(a));this.hasMutatedConstraints=!!o,o&&(a=II(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=Vr(d=>{if(!vf(d,n,this.currentDirection))return;let f=l&&l[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Zy(this.visualElement,t),r.start(FE(t,r,0,n,this.visualElement,!1))}stopAnimation(){Vr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Vr(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Vr(n=>{const{drag:r}=this.getProps();if(!vf(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:o}=i.layout.layoutBox[n];s.set(t[n]-sn(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!$o(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Vr(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();i[a]=rF({min:l,max:l},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Vr(a=>{if(!vf(a,t,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(sn(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;uF.set(this.visualElement,this);const t=this.visualElement.current,n=Jc(t,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();$o(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),zt.read(r);const a=Uu(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Vr(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=l[d].translate,f.set(f.get()+l[d].translate))}),this.visualElement.render())});return()=>{a(),n(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:a=l1,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:o}}}function vf(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function fF(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class hF extends ia{constructor(t){super(t),this.removeGroupControls=Pr,this.removeListeners=Pr,this.controls=new dF(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pr}unmount(){this.removeGroupControls(),this.removeListeners()}}const R_=e=>(t,n)=>{e&&zt.postRender(()=>e(t,n))};class pF extends ia{constructor(){super(...arguments),this.removePointerDownListener=Pr}onPointerDown(t){this.session=new SI(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:MI(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:R_(t),onStart:R_(n),onMove:r,onEnd:(s,a)=>{delete this.session,i&&zt.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=Jc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const gh={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function O_(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const gc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ve.test(e))e=parseFloat(e);else return e;const n=O_(e,t.target.x),r=O_(e,t.target.y);return`${n}% ${r}%`}},mF={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Js.parse(e);if(i.length>5)return r;const s=Js.createTransformer(e),a=typeof i[0]!="number"?1:0,o=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=o,i[1+a]/=l;const u=sn(o,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),s(i)}};class gF extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;Hj(yF),s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),gh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,a=r.projection;return a&&(a.isPresent=s,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||zt.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),pE.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function DI(e){const[t,n]=bC(),r=v.useContext(cE);return c.jsx(gF,{...e,layoutGroup:r,switchLayoutGroup:v.useContext(NC),isPresent:t,safeToRemove:n})}const yF={borderRadius:{...gc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:gc,borderTopRightRadius:gc,borderBottomLeftRadius:gc,borderBottomRightRadius:gc,boxShadow:mF};function bF(e,t,n){const r=Zn(e)?e:Bu(e);return r.start(FE("",r,t,n)),r.animation}function EF(e){return e instanceof SVGElement&&e.tagName!=="svg"}const xF=(e,t)=>e.depth-t.depth;class wF{constructor(){this.children=[],this.isDirty=!1}add(t){kE(this.children,t),this.isDirty=!0}remove(t){SE(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(xF),this.isDirty=!1,this.children.forEach(t)}}function vF(e,t){const n=ji.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Zs(r),e(s-t))};return zt.read(r,!0),()=>Zs(r)}const PI=["TopLeft","TopRight","BottomLeft","BottomRight"],_F=PI.length,L_=e=>typeof e=="string"?parseFloat(e):e,M_=e=>typeof e=="number"||Ve.test(e);function TF(e,t,n,r,i,s){i?(e.opacity=sn(0,n.opacity!==void 0?n.opacity:1,kF(r)),e.opacityExit=sn(t.opacity!==void 0?t.opacity:1,0,SF(r))):s&&(e.opacity=sn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;a<_F;a++){const o=`border${PI[a]}Radius`;let l=D_(t,o),u=D_(n,o);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||M_(l)===M_(u)?(e[o]=Math.max(sn(L_(l),L_(u),r),0),(Pi.test(u)||Pi.test(l))&&(e[o]+="%")):e[o]=u}(t.rotate||n.rotate)&&(e.rotate=sn(t.rotate||0,n.rotate||0,r))}function D_(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const kF=jI(0,.5,JC),SF=jI(.5,.95,Pr);function jI(e,t,n){return r=>rt?1:n(xl(e,t,r))}function P_(e,t){e.min=t.min,e.max=t.max}function zr(e,t){P_(e.x,t.x),P_(e.y,t.y)}function j_(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function B_(e,t,n,r,i){return e-=t,e=pp(e,1/n,r),i!==void 0&&(e=pp(e,1/i,r)),e}function NF(e,t=0,n=1,r=.5,i,s=e,a=e){if(Pi.test(t)&&(t=parseFloat(t),t=sn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=sn(s.min,s.max,r);e===s&&(o-=t),e.min=B_(e.min,t,n,o,i),e.max=B_(e.max,t,n,o,i)}function F_(e,t,[n,r,i],s,a){NF(e,t[n],t[r],t[i],t.scale,s,a)}const AF=["x","scaleX","originX"],CF=["y","scaleY","originY"];function U_(e,t,n,r){F_(e.x,t,AF,n?n.x:void 0,r?r.x:void 0),F_(e.y,t,CF,n?n.y:void 0,r?r.y:void 0)}function $_(e){return e.translate===0&&e.scale===1}function BI(e){return $_(e.x)&&$_(e.y)}function H_(e,t){return e.min===t.min&&e.max===t.max}function IF(e,t){return H_(e.x,t.x)&&H_(e.y,t.y)}function z_(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function FI(e,t){return z_(e.x,t.x)&&z_(e.y,t.y)}function V_(e){return Fr(e.x)/Fr(e.y)}function K_(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class RF{constructor(){this.members=[]}add(t){kE(this.members,t),t.scheduleRender()}remove(t){if(SE(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function OF(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||s||a)&&(r=`translate3d(${i}px, ${s}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=e.x.scale*t.x,l=e.y.scale*t.y;return(o!==1||l!==1)&&(r+=`scale(${o}, ${l})`),r||"none"}const ya={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Pc=typeof window<"u"&&window.MotionDebug!==void 0,qg=["","X","Y","Z"],LF={visibility:"hidden"},Y_=1e3;let MF=0;function Gg(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function UI(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=zC(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",zt,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&UI(r)}function $I({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},o=t==null?void 0:t()){this.id=MF++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Pc&&(ya.totalNodes=ya.resolvedTargetDeltas=ya.recalculatedProjection=0),this.nodes.forEach(jF),this.nodes.forEach(HF),this.nodes.forEach(zF),this.nodes.forEach(BF),Pc&&window.MotionDebug.record(ya)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=vF(h,250),gh.hasAnimatedSinceResize&&(gh.hasAnimatedSinceResize=!1,this.nodes.forEach(q_))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||d.getDefaultTransition()||qF,{onLayoutAnimationStart:w,onLayoutAnimationComplete:g}=d.getProps(),E=!this.targetLayout||!FI(this.targetLayout,m)||p,b=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||h&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,b);const _={...TE(y,"layout"),onPlay:w,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||q_(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Zs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(VF),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&UI(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const k=_/1e3;G_(f.x,a.x,k),G_(f.y,a.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tu(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),YF(this.relativeTarget,this.relativeTargetOrigin,h,k),b&&IF(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=fn()),zr(b,this.relativeTarget)),y&&(this.animationValues=d,TF(d,u,this.latestValues,k,E,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Zs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=zt.update(()=>{gh.hasAnimatedSinceResize=!0,this.currentAnimation=bF(0,Y_,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Y_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:u,latestValues:d}=a;if(!(!o||!l||!u)){if(this!==a&&this.layout&&u&&HI(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||fn();const f=Fr(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+f;const h=Fr(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+h}zr(o,l),Ko(o,d),eu(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new RF),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const u={};l.z&&Gg("z",a,u,this.animationValues);for(let d=0;d{var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(W_),this.root.sharedNodes.clear()}}}function DF(e){e.updateLayout()}function PF(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?Vr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Fr(h);h.min=r[f].min,h.max=h.min+p}):HI(s,n.layoutBox,r)&&Vr(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Fr(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=zo();eu(o,r,n.layoutBox);const l=zo();a?eu(l,e.applyTransform(i,!0),n.measuredBox):eu(l,r,n.layoutBox);const u=!BI(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=fn();tu(m,n.layoutBox,h.layoutBox);const y=fn();tu(y,r,p.layoutBox),FI(m,y)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function jF(e){Pc&&ya.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function BF(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function FF(e){e.clearSnapshot()}function W_(e){e.clearMeasurements()}function UF(e){e.isLayoutDirty=!1}function $F(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function q_(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function HF(e){e.resolveTargetDelta()}function zF(e){e.calcProjection()}function VF(e){e.resetSkewAndRotation()}function KF(e){e.removeLeadSnapshot()}function G_(e,t,n){e.translate=sn(t.translate,0,n),e.scale=sn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function X_(e,t,n,r){e.min=sn(t.min,n.min,r),e.max=sn(t.max,n.max,r)}function YF(e,t,n,r){X_(e.x,t.x,n.x,r),X_(e.y,t.y,n.y,r)}function WF(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const qF={duration:.45,ease:[.4,0,.1,1]},Q_=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Z_=Q_("applewebkit/")&&!Q_("chrome/")?Math.round:Pr;function J_(e){e.min=Z_(e.min),e.max=Z_(e.max)}function GF(e){J_(e.x),J_(e.y)}function HI(e,t,n){return e==="position"||e==="preserve-aspect"&&!Z8(V_(t),V_(n),.2)}function XF(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const QF=$I({attachResizeListener:(e,t)=>Uu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Xg={current:void 0},zI=$I({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Xg.current){const e=new QF({});e.mount(window),e.setOptions({layoutScroll:!0}),Xg.current=e}return Xg.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),ZF={pan:{Feature:pF},drag:{Feature:hF,ProjectionNode:zI,MeasureLayout:DI}};function JF(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const s=(r=void 0)!==null&&r!==void 0?r:i.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function VI(e,t){const n=JF(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function eT(e){return t=>{t.pointerType==="touch"||kI()||e(t)}}function e9(e,t,n={}){const[r,i,s]=VI(e,n),a=eT(o=>{const{target:l}=o,u=t(o);if(typeof u!="function"||!l)return;const d=eT(f=>{u(f),l.removeEventListener("pointerleave",d)});l.addEventListener("pointerleave",d,i)});return r.forEach(o=>{o.addEventListener("pointerenter",a,i)}),s}function tT(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,s=r[i];s&&zt.postRender(()=>s(t,bd(t)))}class t9 extends ia{mount(){const{current:t}=this.node;t&&(this.unmount=e9(t,n=>(tT(this.node,n,"Start"),r=>tT(this.node,r,"End"))))}unmount(){}}class n9 extends ia{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yd(Uu(this.node.current,"focus",()=>this.onFocus()),Uu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const KI=(e,t)=>t?e===t?!0:KI(e,t.parentElement):!1,r9=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function i9(e){return r9.has(e.tagName)||e.tabIndex!==-1}const jc=new WeakSet;function nT(e){return t=>{t.key==="Enter"&&e(t)}}function Qg(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const s9=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=nT(()=>{if(jc.has(n))return;Qg(n,"down");const i=nT(()=>{Qg(n,"up")}),s=()=>Qg(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function rT(e){return UE(e)&&!kI()}function a9(e,t,n={}){const[r,i,s]=VI(e,n),a=o=>{const l=o.currentTarget;if(!rT(o)||jc.has(l))return;jc.add(l);const u=t(o),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!rT(p)||!jc.has(l))&&(jc.delete(l),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||KI(l,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(o=>{!i9(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,i),o.addEventListener("focus",u=>s9(u,i),i)}),s}function iT(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),s=r[i];s&&zt.postRender(()=>s(t,bd(t)))}class o9 extends ia{mount(){const{current:t}=this.node;t&&(this.unmount=a9(t,n=>(iT(this.node,n,"Start"),(r,{success:i})=>iT(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const d1=new WeakMap,Zg=new WeakMap,l9=e=>{const t=d1.get(e.target);t&&t(e)},c9=e=>{e.forEach(l9)};function u9({root:e,...t}){const n=e||document;Zg.has(n)||Zg.set(n,{});const r=Zg.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(c9,{root:e,...t})),r[i]}function d9(e,t,n){const r=u9(t);return d1.set(e,n),r.observe(e),()=>{d1.delete(e),r.unobserve(e)}}const f9={some:0,all:1};class h9 extends ia{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:f9[i]},o=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(l)};return d9(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(p9(t,n))&&this.startObserver()}unmount(){}}function p9({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const m9={inView:{Feature:h9},tap:{Feature:o9},focus:{Feature:n9},hover:{Feature:t9}},g9={layout:{ProjectionNode:zI,MeasureLayout:DI}},f1={current:null},YI={current:!1};function y9(){if(YI.current=!0,!!uE)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>f1.current=e.matches;e.addListener(t),t()}else f1.current=!1}const b9=[...hI,Xn,Js],E9=e=>b9.find(fI(e)),sT=new WeakMap;function x9(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Zn(i))e.addValue(r,i);else if(Zn(s))e.addValue(r,Bu(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(r);e.addValue(r,Bu(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const aT=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class w9{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:s,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=PE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=ji.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),YI.current||y9(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:f1.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){sT.delete(this.current),this.projection&&this.projection.unmount(),Zs(this.notifyUpdate),Zs(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=ro.has(t),i=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&zt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in El){const n=El[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):fn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Bu(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(uI(i)||tI(i))?i=parseFloat(i):!E9(i)&&Js.test(n)&&(i=oI(t,n)),this.setBaseTarget(t,Zn(i)?i.get():i)),Zn(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const a=gE(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Zn(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new NE),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class WI extends w9{constructor(){super(...arguments),this.KeyframeResolver=pI}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Zn(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function v9(e){return window.getComputedStyle(e)}class _9 extends WI{constructor(){super(...arguments),this.type="html",this.renderInstance=MC}readValueFromInstance(t,n){if(ro.has(n)){const r=DE(n);return r&&r.default||0}else{const r=v9(t),i=(RC(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return LI(t,n)}build(t,n,r){EE(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return _E(t,n,r)}}class T9 extends WI{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(ro.has(n)){const r=DE(n);return r&&r.default||0}return n=DC.has(n)?n:hE(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return BC(t,n,r)}build(t,n,r){xE(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){PC(t,n,r,i)}mount(t){this.isSVGTag=vE(t.tagName),super.mount(t)}}const k9=(e,t)=>mE(e)?new T9(t):new _9(t,{allowProjection:e!==v.Fragment}),S9=Qj({...H8,...m9,...ZF,...g9},k9),Xt=fj(S9);function Sn(){return Sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?v.useEffect:v.useLayoutEffect;function _o(e,t,n){var r=v.useRef(t);r.current=t,v.useEffect(function(){function i(s){r.current(s)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var N9=["container"];function A9(e){var t=e.container,n=t===void 0?document.body:t,r=xm(e,N9);return Va.createPortal(nt.createElement("div",Sn({},r)),n)}function C9(e){return nt.createElement("svg",Sn({width:"44",height:"44",viewBox:"0 0 768 768"},e),nt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function I9(e){return nt.createElement("svg",Sn({width:"44",height:"44",viewBox:"0 0 768 768"},e),nt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function R9(e){return nt.createElement("svg",Sn({width:"44",height:"44",viewBox:"0 0 768 768"},e),nt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function O9(){return v.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function lT(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var i=e.touches[1],s=i.clientX,a=i.clientY;return[(n+s)/2,(r+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var Cs=function(e,t,n,r){var i,s=n*t,a=(s-r)/2,o=e;return s<=r?(i=1,o=0):e>0&&a-e<=0?(i=2,o=a):e<0&&a+e<=0&&(i=3,o=-a),[i,o]};function Jg(e,t,n,r,i,s,a,o,l,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),l===void 0&&(l=0),u===void 0&&(u=0);var d=Cs(e,s,n,innerWidth)[0],f=Cs(t,s,r,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-s/i*(a-(h+e))-h+(r/n>=3&&n*s===innerWidth?0:d?l/2:l),y:o-s/i*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function m1(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function e0(e,t,n){var r=m1(n,innerWidth,innerHeight),i=r[0],s=r[1],a=0,o=i,l=s,u=e/t*s,d=t/e*i;return e=s?o=u:e>=i&&ti/s?l=d:t/e>=3&&!r[2]?a=((l=d)-s)/2:o=u,{width:o,height:l,x:0,y:a,pause:!0}}function Tf(e,t){var n=t.leading,r=n!==void 0&&n,i=t.maxWait,s=t.wait,a=s===void 0?i||0:s,o=v.useRef(e);o.current=e;var l=v.useRef(0),u=v.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=v.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){l.current=p,d(),o.current.apply(null,h)}var y=l.current,w=p-y;if(y===0&&(r&&m(),l.current=p),i!==void 0){if(w>i)return void m()}else w=1&&s&&s())};d()}function d(){l=requestAnimationFrame(u)}}var M9={T:0,L:0,W:0,H:0,FIT:void 0},GI=function(){var e=v.useRef(!1);return v.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},D9=["className"];function P9(e){var t=e.className,n=t===void 0?"":t,r=xm(e,D9);return nt.createElement("div",Sn({className:"PhotoView__Spinner "+n},r),nt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},nt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),nt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var j9=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function B9(e){var t=e.src,n=e.loaded,r=e.broken,i=e.className,s=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,l=xm(e,j9),u=GI();return t&&!r?nt.createElement(nt.Fragment,null,nt.createElement("img",Sn({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},l)),!n&&(a?nt.createElement("span",{className:"PhotoView__icon"},a):nt.createElement(P9,{className:"PhotoView__icon"}))):o?nt.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var F9={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function U9(e){var t=e.item,n=t.src,r=t.render,i=t.width,s=i===void 0?0:i,a=t.height,o=a===void 0?0:a,l=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,y=e.loadingElement,w=e.brokenElement,g=e.onPhotoTap,E=e.onMaskTap,b=e.onReachMove,_=e.onReachUp,k=e.onPhotoResize,T=e.isActive,C=e.expose,S=mp(F9),R=S[0],I=S[1],M=v.useRef(0),B=GI(),Y=R.naturalWidth,P=Y===void 0?s:Y,U=R.naturalHeight,A=U===void 0?o:U,L=R.width,O=L===void 0?s:L,j=R.height,N=j===void 0?o:j,H=R.loaded,V=H===void 0?!n:H,D=R.broken,ne=R.x,J=R.y,re=R.touched,de=R.stopRaf,G=R.maskTouched,W=R.rotate,ae=R.scale,he=R.CX,Z=R.CY,ce=R.lastX,Ie=R.lastY,xe=R.lastCX,ge=R.lastCY,De=R.lastScale,_e=R.touchTime,He=R.touchLength,Oe=R.pause,oe=R.reach,kt=Ma({onScale:function(ue){return ve(_f(ue))},onRotate:function(ue){W!==ue&&(C({rotate:ue}),I(Sn({rotate:ue},e0(P,A,ue))))}});function ve(ue,Me,Ze){ae!==ue&&(C({scale:ue}),I(Sn({scale:ue},Jg(ne,J,O,N,ae,ue,Me,Ze),ue<=1&&{x:0,y:0})))}var St=Tf(function(ue,Me,Ze){if(Ze===void 0&&(Ze=0),(re||G)&&T){var un=m1(W,O,N),dn=un[0],se=un[1];if(Ze===0&&M.current===0){var Te=Math.abs(ue-he)<=20,ye=Math.abs(Me-Z)<=20;if(Te&&ye)return void I({lastCX:ue,lastCY:Me});M.current=Te?Me>Z?3:2:1}var je,ze=ue-xe,Ge=Me-ge;if(Ze===0){var Et=Cs(ze+ce,ae,dn,innerWidth)[0],Lt=Cs(Ge+Ie,ae,se,innerHeight);je=function(bn,En,Kt,Cn){return En&&bn===1||Cn==="x"?"x":Kt&&bn>1||Cn==="y"?"y":void 0}(M.current,Et,Lt[0],oe),je!==void 0&&b(je,ue,Me,ae)}if(je==="x"||G)return void I({reach:"x"});var Mt=_f(ae+(Ze-He)/100/2*ae,P/O,.2);C({scale:Mt}),I(Sn({touchLength:Ze,reach:je,scale:Mt},Jg(ne,J,O,N,ae,Mt,ue,Me,ze,Ge)))}},{maxWait:8});function dt(ue){return!de&&!re&&(B.current&&I(Sn({},ue,{pause:u})),B.current)}var K,X,le,Se,Le,ft,qe,ct,Jt=(Le=function(ue){return dt({x:ue})},ft=function(ue){return dt({y:ue})},qe=function(ue){return B.current&&(C({scale:ue}),I({scale:ue})),!re&&B.current},ct=Ma({X:function(ue){return Le(ue)},Y:function(ue){return ft(ue)},S:function(ue){return qe(ue)}}),function(ue,Me,Ze,un,dn,se,Te,ye,je,ze,Ge){var Et=m1(ze,dn,se),Lt=Et[0],Mt=Et[1],bn=Cs(ue,ye,Lt,innerWidth),En=bn[0],Kt=bn[1],Cn=Cs(Me,ye,Mt,innerHeight),rr=Cn[0],Sr=Cn[1],Fn=Date.now()-Ge;if(Fn>=200||ye!==Te||Math.abs(je-Te)>1){var Yn=Jg(ue,Me,dn,se,Te,ye),ir=Yn.x,Nr=Yn.y,Yt=En?Kt:ir!==ue?ir:null,In=rr?Sr:Nr!==Me?Nr:null;return Yt!==null&&wa(ue,Yt,ct.X),In!==null&&wa(Me,In,ct.Y),void(ye!==Te&&wa(Te,ye,ct.S))}var Un=(ue-Ze)/Fn,sr=(Me-un)/Fn,Wn=Math.sqrt(Math.pow(Un,2)+Math.pow(sr,2)),Rn=!1,at=!1;(function(On,Ut){var en,Ln=On,$n=0,Tn=0,te=function(Be){en||(en=Be);var wt=Be-en,mt=Math.sign(On),tn=-.001*mt,vt=Math.sign(-Ln)*Math.pow(Ln,2)*2e-4,Mn=Ln*wt+(tn+vt)*Math.pow(wt,2)/2;$n+=Mn,en=Be,mt*(Ln+=(tn+vt)*wt)<=0?Re():Ut($n)?Ne():Re()};function Ne(){Tn=requestAnimationFrame(te)}function Re(){cancelAnimationFrame(Tn)}Ne()})(Wn,function(On){var Ut=ue+On*(Un/Wn),en=Me+On*(sr/Wn),Ln=Cs(Ut,Te,Lt,innerWidth),$n=Ln[0],Tn=Ln[1],te=Cs(en,Te,Mt,innerHeight),Ne=te[0],Re=te[1];if($n&&!Rn&&(Rn=!0,En?wa(Ut,Tn,ct.X):cT(Tn,Ut+(Ut-Tn),ct.X)),Ne&&!at&&(at=!0,rr?wa(en,Re,ct.Y):cT(Re,en+(en-Re),ct.Y)),Rn&&at)return!1;var Be=Rn||ct.X(Tn),wt=at||ct.Y(Re);return Be&&wt})}),Ot=(K=g,X=function(ue,Me){oe||ve(ae!==1?1:Math.max(2,P/O),ue,Me)},le=v.useRef(0),Se=Tf(function(){le.current=0,K.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ue=[].slice.call(arguments);le.current+=1,Se.apply(void 0,ue),le.current>=2&&(Se.cancel(),le.current=0,X.apply(void 0,ue))});function Xe(ue,Me){if(M.current=0,(re||G)&&T){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Ze=_f(ae,P/O);if(Jt(ne,J,ce,Ie,O,N,ae,Ze,De,W,_e),_(ue,Me),he===ue&&Z===Me){if(re)return void Ot(ue,Me);G&&E(ue,Me)}}}function xt(ue,Me,Ze){Ze===void 0&&(Ze=0),I({touched:!0,CX:ue,CY:Me,lastCX:ue,lastCY:Me,lastX:ne,lastY:J,lastScale:ae,touchLength:Ze,touchTime:Date.now()})}function Vt(ue){I({maskTouched:!0,CX:ue.clientX,CY:ue.clientY,lastX:ne,lastY:J})}_o(Wi?void 0:"mousemove",function(ue){ue.preventDefault(),St(ue.clientX,ue.clientY)}),_o(Wi?void 0:"mouseup",function(ue){Xe(ue.clientX,ue.clientY)}),_o(Wi?"touchmove":void 0,function(ue){ue.preventDefault();var Me=lT(ue);St.apply(void 0,Me)},{passive:!1}),_o(Wi?"touchend":void 0,function(ue){var Me=ue.changedTouches[0];Xe(Me.clientX,Me.clientY)},{passive:!1}),_o("resize",Tf(function(){V&&!re&&(I(e0(P,A,W)),k())},{maxWait:8})),p1(function(){T&&C(Sn({scale:ae,rotate:W},kt))},[T]);var An=function(ue,Me,Ze,un,dn,se,Te,ye,je,ze){var Ge=function(ir,Nr,Yt,In,Un){var sr=v.useRef(!1),Wn=mp({lead:!0,scale:Yt}),Rn=Wn[0],at=Rn.lead,On=Rn.scale,Ut=Wn[1],en=Tf(function(Ln){try{return Un(!0),Ut({lead:!1,scale:Ln}),Promise.resolve()}catch($n){return Promise.reject($n)}},{wait:In});return p1(function(){sr.current?(Un(!1),Ut({lead:!0}),en(Yt)):sr.current=!0},[Yt]),at?[ir*On,Nr*On,Yt/On]:[ir*Yt,Nr*Yt,1]}(se,Te,ye,je,ze),Et=Ge[0],Lt=Ge[1],Mt=Ge[2],bn=function(ir,Nr,Yt,In,Un){var sr=v.useState(M9),Wn=sr[0],Rn=sr[1],at=v.useState(0),On=at[0],Ut=at[1],en=v.useRef(),Ln=Ma({OK:function(){return ir&&Ut(4)}});function $n(Tn){Un(!1),Ut(Tn)}return v.useEffect(function(){if(en.current||(en.current=Date.now()),Yt){if(function(Tn,te){var Ne=Tn&&Tn.current;if(Ne&&Ne.nodeType===1){var Re=Ne.getBoundingClientRect();te({T:Re.top,L:Re.left,W:Re.width,H:Re.height,FIT:Ne.tagName==="IMG"?getComputedStyle(Ne).objectFit:void 0})}}(Nr,Rn),ir)return Date.now()-en.current<250?(Ut(1),requestAnimationFrame(function(){Ut(2),requestAnimationFrame(function(){return $n(3)})}),void setTimeout(Ln.OK,In)):void Ut(4);$n(5)}},[ir,Yt]),[On,Wn]}(ue,Me,Ze,je,ze),En=bn[0],Kt=bn[1],Cn=Kt.W,rr=Kt.FIT,Sr=innerWidth/2,Fn=innerHeight/2,Yn=En<3||En>4;return[Yn?Cn?Kt.L:Sr:un+(Sr-se*ye/2),Yn?Cn?Kt.T:Fn:dn+(Fn-Te*ye/2),Et,Yn&&rr?Et*(Kt.H/Cn):Lt,En===0?Mt:Yn?Cn/(se*ye)||.01:Mt,Yn?rr?1:0:1,En,rr]}(u,l,V,ne,J,O,N,ae,d,function(ue){return I({pause:ue})}),$e=An[4],st=An[6],rt="transform "+d+"ms "+f,bt={className:p,onMouseDown:Wi?void 0:function(ue){ue.stopPropagation(),ue.button===0&&xt(ue.clientX,ue.clientY,0)},onTouchStart:Wi?function(ue){ue.stopPropagation(),xt.apply(void 0,lT(ue))}:void 0,onWheel:function(ue){if(!oe){var Me=_f(ae-ue.deltaY/100/2,P/O);I({stopRaf:!0}),ve(Me,ue.clientX,ue.clientY)}},style:{width:An[2]+"px",height:An[3]+"px",opacity:An[5],objectFit:st===4?void 0:An[7],transform:W?"rotate("+W+"deg)":void 0,transition:st>2?rt+", opacity "+d+"ms ease, height "+(st<4?d/2:st>4?d:0)+"ms "+f:void 0}};return nt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Wi&&T?Vt:void 0,onTouchStart:Wi&&T?function(ue){return Vt(ue.touches[0])}:void 0},nt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+$e+", 0, 0, "+$e+", "+An[0]+", "+An[1]+")",transition:re||Oe?void 0:rt,willChange:T?"transform":void 0}},n?nt.createElement(B9,Sn({src:n,loaded:V,broken:D},bt,{onPhotoLoad:function(ue){I(Sn({},ue,ue.loaded&&e0(ue.naturalWidth||0,ue.naturalHeight||0,W)))},loadingElement:y,brokenElement:w})):r&&r({attrs:bt,scale:$e,rotate:W})))}var uT={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function $9(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,i=e.easing,s=e.photoClosable,a=e.maskClosable,o=a===void 0||a,l=e.maskOpacity,u=l===void 0?1:l,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,y=e.toolbarRender,w=e.className,g=e.maskClassName,E=e.photoClassName,b=e.photoWrapClassName,_=e.loadingElement,k=e.brokenElement,T=e.images,C=e.index,S=C===void 0?0:C,R=e.onIndexChange,I=e.visible,M=e.onClose,B=e.afterClose,Y=e.portalContainer,P=mp(uT),U=P[0],A=P[1],L=v.useState(0),O=L[0],j=L[1],N=U.x,H=U.touched,V=U.pause,D=U.lastCX,ne=U.lastCY,J=U.bg,re=J===void 0?u:J,de=U.lastBg,G=U.overlay,W=U.minimal,ae=U.scale,he=U.rotate,Z=U.onScale,ce=U.onRotate,Ie=e.hasOwnProperty("index"),xe=Ie?S:O,ge=Ie?R:j,De=v.useRef(xe),_e=T.length,He=T[xe],Oe=typeof n=="boolean"?n:_e>n,oe=function($e,st){var rt=v.useReducer(function(Ze){return!Ze},!1)[1],bt=v.useRef(0),ue=function(Ze){var un=v.useRef(Ze);function dn(se){un.current=se}return v.useMemo(function(){(function(se){$e?(se($e),bt.current=1):bt.current=2})(dn)},[Ze]),[un.current,dn]}($e),Me=ue[1];return[ue[0],bt.current,function(){rt(),bt.current===2&&(Me(!1),st&&st()),bt.current=0}]}(I,B),kt=oe[0],ve=oe[1],St=oe[2];p1(function(){if(kt)return A({pause:!0,x:xe*-(innerWidth+go)}),void(De.current=xe);A(uT)},[kt]);var dt=Ma({close:function($e){ce&&ce(0),A({overlay:!0,lastBg:re}),M($e)},changeIndex:function($e,st){st===void 0&&(st=!1);var rt=Oe?De.current+($e-xe):$e,bt=_e-1,ue=h1(rt,0,bt),Me=Oe?rt:ue,Ze=innerWidth+go;A({touched:!1,lastCX:void 0,lastCY:void 0,x:-Ze*Me,pause:st}),De.current=Me,ge&&ge(Oe?$e<0?bt:$e>bt?0:$e:ue)}}),K=dt.close,X=dt.changeIndex;function le($e){return $e?K():A({overlay:!G})}function Se(){A({x:-(innerWidth+go)*xe,lastCX:void 0,lastCY:void 0,pause:!0}),De.current=xe}function Le($e,st,rt,bt){$e==="x"?function(ue){if(D!==void 0){var Me=ue-D,Ze=Me;!Oe&&(xe===0&&Me>0||xe===_e-1&&Me<0)&&(Ze=Me/2),A({touched:!0,lastCX:D,x:-(innerWidth+go)*De.current+Ze,pause:!1})}else A({touched:!0,lastCX:ue,x:N,pause:!1})}(st):$e==="y"&&function(ue,Me){if(ne!==void 0){var Ze=u===null?null:h1(u,.01,u-Math.abs(ue-ne)/100/4);A({touched:!0,lastCY:ne,bg:Me===1?Ze:u,minimal:Me===1})}else A({touched:!0,lastCY:ue,bg:re,minimal:!0})}(rt,bt)}function ft($e,st){var rt=$e-(D??$e),bt=st-(ne??st),ue=!1;if(rt<-40)X(xe+1);else if(rt>40)X(xe-1);else{var Me=-(innerWidth+go)*De.current;Math.abs(bt)>100&&W&&f&&(ue=!0,K()),A({touched:!1,x:Me,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ue||G})}}_o("keydown",function($e){if(I)switch($e.key){case"ArrowLeft":X(xe-1,!0);break;case"ArrowRight":X(xe+1,!0);break;case"Escape":K()}});var qe=function($e,st,rt){return v.useMemo(function(){var bt=$e.length;return rt?$e.concat($e).concat($e).slice(bt+st-1,bt+st+2):$e.slice(Math.max(st-1,0),Math.min(st+2,bt+1))},[$e,st,rt])}(T,xe,Oe);if(!kt)return null;var ct=G&&!ve,Jt=I?re:de,Ot=Z&&ce&&{images:T,index:xe,visible:I,onClose:K,onIndexChange:X,overlayVisible:ct,overlay:He&&He.overlay,scale:ae,rotate:he,onScale:Z,onRotate:ce},Xe=r?r(ve):400,xt=i?i(ve):oT,Vt=r?r(3):600,An=i?i(3):oT;return nt.createElement(A9,{className:"PhotoView-Portal"+(ct?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(w?" "+w:""),role:"dialog",onClick:function($e){return $e.stopPropagation()},container:Y},I&&nt.createElement(O9,null),nt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(g?" "+g:"")+(ve===1?" PhotoView-Slider__fadeIn":ve===2?" PhotoView-Slider__fadeOut":""),style:{background:Jt?"rgba(0, 0, 0, "+Jt+")":void 0,transitionTimingFunction:xt,transitionDuration:(H?0:Xe)+"ms",animationDuration:Xe+"ms"},onAnimationEnd:St}),p&&nt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},nt.createElement("div",{className:"PhotoView-Slider__Counter"},xe+1," / ",_e),nt.createElement("div",{className:"PhotoView-Slider__BannerRight"},y&&Ot&&y(Ot),nt.createElement(C9,{className:"PhotoView-Slider__toolbarIcon",onClick:K}))),qe.map(function($e,st){var rt=Oe||xe!==0?De.current-1+st:xe+st;return nt.createElement(U9,{key:Oe?$e.key+"/"+$e.src+"/"+rt:$e.key,item:$e,speed:Xe,easing:xt,visible:I,onReachMove:Le,onReachUp:ft,onPhotoTap:function(){return le(s)},onMaskTap:function(){return le(o)},wrapClassName:b,className:E,style:{left:(innerWidth+go)*rt+"px",transform:"translate3d("+N+"px, 0px, 0)",transition:H||V?void 0:"transform "+Vt+"ms "+An},loadingElement:_,brokenElement:k,onPhotoResize:Se,isActive:De.current===rt,expose:A})}),!Wi&&p&&nt.createElement(nt.Fragment,null,(Oe||xe!==0)&&nt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return X(xe-1,!0)}},nt.createElement(I9,null)),(Oe||xe+1<_e)&&nt.createElement("div",{className:"PhotoView-Slider__ArrowRight",onClick:function(){return X(xe+1,!0)}},nt.createElement(R9,null))),m&&Ot&&nt.createElement("div",{className:"PhotoView-Slider__Overlay"},m(Ot)))}var H9=["children","onIndexChange","onVisibleChange"],z9={images:[],visible:!1,index:0};function V9(e){var t=e.children,n=e.onIndexChange,r=e.onVisibleChange,i=xm(e,H9),s=mp(z9),a=s[0],o=s[1],l=v.useRef(0),u=a.images,d=a.visible,f=a.index,h=Ma({nextId:function(){return l.current+=1},update:function(y){var w=u.findIndex(function(E){return E.key===y.key});if(w>-1){var g=u.slice();return g.splice(w,1,y),void o({images:g})}o(function(E){return{images:E.images.concat(y)}})},remove:function(y){o(function(w){var g=w.images.filter(function(E){return E.key!==y});return{images:g,index:Math.min(g.length-1,f)}})},show:function(y){var w=u.findIndex(function(g){return g.key===y});o({visible:!0,index:w}),r&&r(!0,w,a)}}),p=Ma({close:function(){o({visible:!1}),r&&r(!1,f,a)},changeIndex:function(y){o({index:y}),n&&n(y,a)}}),m=v.useMemo(function(){return Sn({},a,h)},[a,h]);return nt.createElement(qI.Provider,{value:m},t,nt.createElement($9,Sn({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var XI=function(e){var t,n,r=e.src,i=e.render,s=e.overlay,a=e.width,o=e.height,l=e.triggers,u=l===void 0?["onClick"]:l,d=e.children,f=v.useContext(qI),h=(t=function(){return f.nextId()},(n=v.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=v.useRef(null);v.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),v.useEffect(function(){return function(){f.remove(h)}},[]);var m=Ma({render:function(w){return i&&i(w)},show:function(w,g){f.show(h),function(E,b){if(d){var _=d.props[E];_&&_(b)}}(w,g)}}),y=v.useMemo(function(){var w={};return u.forEach(function(g){w[g]=m.show.bind(null,g)}),w},[]);return v.useEffect(function(){f.update({key:h,src:r,originRef:p,render:m.render,overlay:s,width:a,height:o})},[r]),d?v.Children.only(v.cloneElement(d,Sn({},y,{ref:p}))):null};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K9=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),QI=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var Y9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W9=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>v.createElement("svg",{ref:l,...Y9,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:QI("lucide",i),...o},[...a.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ke=(e,t)=>{const n=v.forwardRef(({className:r,...i},s)=>v.createElement(W9,{ref:s,iconNode:t,className:QI(`lucide-${K9(e)}`,r),...i}));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q9=ke("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZI=ke("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G9=ke("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JI=ke("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eR=ke("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tR=ke("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X9=ke("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ka=ke("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nR=ke("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q9=ke("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Z9=ke("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $i=ke("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gp=ke("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J9=ke("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dr=ke("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rR=ke("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eU=ke("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tU=ke("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nU=ke("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $E=ke("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HE=ke("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iR=ke("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yh=ke("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zE=ke("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rU=ke("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VE=ke("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iU=ke("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sR=ke("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dT=ke("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sU=ke("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aU=ke("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aR=ke("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oU=ke("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oR=ke("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lU=ke("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cU=ke("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KE=ke("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lR=ke("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cR=ke("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uU=ke("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wm=ke("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dU=ke("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fU=ke("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uR=ke("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ed=ke("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hU=ke("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dR=ke("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pU=ke("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mU=ke("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gU=ke("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yU=ke("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _t=ke("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bU=ke("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EU=ke("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nu=ke("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fR=ke("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xU=ke("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wU=ke("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vU=ke("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hR=ke("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _U=ke("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TU=ke("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kU=ke("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SU=ke("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ei=ke("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YE=ke("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WE=ke("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NU=ke("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pR=ke("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g1=ke("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AU=ke("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CU=ke("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fT=ke("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ya=ke("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mR=ke("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vl=ke("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IU=ke("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RU=ke("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OU=ke("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LU=ke("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MU=ke("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qE=ke("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ti=ke("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),hT="veadk_auth_qs";let yc=null;function DU(){if(yc!==null)return yc;const e=window.location.search.replace(/^\?/,"");return e?(sessionStorage.setItem(hT,e),window.history.replaceState(null,"",window.location.pathname+window.location.hash),yc=e):yc=sessionStorage.getItem(hT)??"",yc}function Bi(e){const t=DU();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,i)=>{n.searchParams.has(i)||n.searchParams.set(i,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const PU=/\brun_sse\s*failed\s*:\s*404\b/i,pT="提示:该 404 可能是多实例部署使用 in-memory 或 SQLite 短期记忆导致的:请求落到不同实例后,会话无法找到。请改用基于数据库的持久化短期记忆存储。";function kf(e){const t=String(e);return!PU.test(t)||t.includes(pT)?t:`${t} - -${pT}`}async function*GE(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let r="";try{for(;;){const{done:i,value:s}=await t.read();if(i)break;r+=n.decode(s,{stream:!0});let a=r.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const o=r.slice(0,a.index);r=r.slice(a.index+a[0].length);const l=o.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(l)try{yield JSON.parse(l)}catch{l!=="[DONE]"&&l!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${l.length} chars):`,l.slice(0,200))}a=r.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const vm=3e4,jU=12e4,gR=1e4;function as(e,t=vm){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const yp="veadk_local_user",bp="veadk_local_user_tab",BU=/^[A-Za-z0-9]{1,16}$/;function yR(){try{const e=sessionStorage.getItem(bp);if(e)return e;const t=localStorage.getItem(yp);return t&&sessionStorage.setItem(bp,t),t}catch{try{return localStorage.getItem(yp)}catch{return null}}}function mT(e){try{sessionStorage.setItem(bp,e)}catch{}try{localStorage.setItem(yp,e)}catch{}}function FU(){try{sessionStorage.removeItem(bp)}catch{}try{localStorage.removeItem(yp)}catch{}}function _m(e){const t=new Headers(e),n=yR();return n&&t.set("X-VeADK-Local-User",n),t}async function UU(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:as(void 0,gR)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function $U(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function HU(){window.location.assign("/oauth2/logout")}async function zU(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:as(void 0,gR)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(i){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",i),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=yR();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function VU(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function KU(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const bh="",XE=new Map;function bR(e,t){XE.set(e,t)}function ER(){XE.clear()}function wi(e){const t=XE.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}function It(e,t={},n={},r=vm){const i={...t,headers:_m(t.headers),signal:as(t.signal,r)};if(n.runtimeId){const s=n.region?`${e.includes("?")?"&":"?"}region=${encodeURIComponent(n.region)}`:"";return fetch(Bi(`${bh}/web/runtime-proxy/${n.runtimeId}${e}${s}`),i)}if(n.base){const s=new Headers(i.headers);return s.set("X-AgentKit-Base",n.base),n.apiKey&&s.set("X-AgentKit-Key",n.apiKey),fetch(Bi(`${bh}/agentkit-proxy${e}`),{...i,headers:s})}return fetch(Bi(`${bh}${e}`),i)}function YU(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const r=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",i=String(t.msg??"");return r?`${r}: ${i}`:i}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function ii(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const r=JSON.parse(n);return YU(r.detail??r.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function xR(){const e=await It("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class xd extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class $u extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}async function WU(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Tm(e,t,n){const r=await It("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await WU(r):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new xd;if(n!=null&&n.runtimeId&&r.status===404)throw new $u("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new $u("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await ii(r,"读取 Agent 列表失败"));return r.json()}async function Ep(e,t){const{app:n,ep:r}=wi(e),i=await It(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!i.ok)throw new Error(`create session failed: ${i.status}`);return(await i.json()).id}async function QE(e,t){const{app:n,ep:r}=wi(e),i=await It(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function xp(e,t,n){const{app:r,ep:i}=wi(e),s=await It(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{},i);if(!s.ok)throw new Error(`get session failed: ${s.status}`);return s.json()}async function y1(e,t,n){const{app:r,ep:i}=wi(e),s=await It(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}async function qU(e){const t=await It("/web/media/capabilities");if(!t.ok)throw new Error(await ii(t,"media capabilities failed"));return t.json()}async function wR(e,t,n,r){const{app:i}=wi(e),s=new FormData;s.set("app_name",i),s.set("user_id",t),s.set("session_id",n),s.set("file",r);const a=await It("/web/media",{method:"POST",body:s},{},jU);if(!a.ok)throw new Error(await ii(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function b1(e,t,n){const{app:r}=wi(e),i=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,s=await It(i,{method:"DELETE"});if(!s.ok&&s.status!==404)throw new Error(await ii(s,"media cleanup failed"))}function vR(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((r,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function Eh(e,t){const n=vR(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await It(n,{method:"DELETE"});if(!r.ok&&r.status!==404)throw new Error(await ii(r,"media cleanup failed"))}function _R(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=vR(t);if(!n)return t;const r=`${n}/content`;return Bi(`${bh}${r}`)}async function TR(e,t){const{app:n,ep:r}=wi(e),i=await It(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!i.ok)throw new Error(`trace failed: ${i.status}`);const s=i.headers.get("content-type")??"";if(!s.includes("application/json")){const o=s.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${o}),请检查 Studio API 代理配置`)}const a=await i.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}async function kR(e,t){const n=await It(`/web/agent-info/${e}`,{},t);if(!n.ok)throw new Error(`agent-info failed: ${n.status}`);const r=await n.json();return{name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph}}async function wd(e){const{app:t,ep:n}=wi(e);return kR(t,n)}async function SR(e,t){const n={runtimeId:e,region:t},i=(await Tm("","",n))[0];if(!i)throw new Error("该 Runtime 未提供可预览的 Agent。");return kR(i,n)}async function NR(e,t,n,r){const{app:i,ep:s}=wi(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:r}),o=await It(`/web/search?${a.toString()}`,{},s);if(!o.ok)throw new Error(await ii(o,"Agent 检索失败"));return o.json()}async function AR(e,t){const{app:n}=wi(e),r=await It(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`web search failed: ${r.status}`);return r.json()}async function*Hu({appName:e,userId:t,sessionId:n,text:r,attachments:i=[],invocation:s,functionResponses:a=[],signal:o}){const{app:l,ep:u}=wi(e),d=i.flatMap(m=>m.status&&m.status!=="ready"?[]:m.uri?[{fileData:{mimeType:m.mimeType,fileUri:m.uri,displayName:m.name},partMetadata:{veadkMedia:{id:m.id,uri:m.uri,name:m.name,mimeType:m.mimeType,sizeBytes:m.sizeBytes}}}]:m.data?[{inlineData:{mimeType:m.mimeType,data:m.data,displayName:m.name}}]:[]),f=s&&(s.skills.length>0||s.targetAgent)?s:void 0,h=[...d,...a.map(m=>({functionResponse:{id:m.id,name:m.name,response:m.response}})),...r.trim()?[{text:r}]:[]];if(f&&h.length>0){const m=h[0],y=m.partMetadata;h[0]={...m,partMetadata:{...y,veadkInvocation:f}}}const p=await It("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:l,user_id:t,session_id:n,new_message:{role:"user",parts:h},streaming:!0,custom_metadata:f?{veadkInvocation:f}:void 0}),signal:o},u,0);if(!p.ok)throw new Error(kf(`run_sse failed: ${p.status}`));for await(const m of GE(p)){const y=m;typeof y.error=="string"&&(y.error=kf(y.error)),typeof y.errorMessage=="string"&&(y.errorMessage=kf(y.errorMessage)),typeof y.error_message=="string"&&(y.error_message=kf(y.error_message)),yield y}}const ru=new Map;async function ZE(e,t,n,r){var u;const i=r==null?void 0:r.taskId,s=i?new AbortController:void 0;i&&s&&ru.set(i,s);const a=()=>{i&&ru.get(i)===s&&ru.delete(i)};let o;try{o=await It("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:i,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs})},{},0)}catch(d){throw a(),d}if(!o.ok){const d=await o.text().catch(()=>"");throw a(),new Error(d||`部署失败 (${o.status})`)}let l=null;try{for await(const d of GE(o)){const f=d;if(f&&f.done){l=f;break}f&&f.message&&((u=r==null?void 0:r.onStage)==null||u.call(r,f))}}catch(d){throw a(),d}if(a(),!l)throw new Error("部署失败:连接中断");if(!l.success)throw new Error(l.error||"部署失败");if(!l.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!l.runtimeId&&!l.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:l.apikey??"",url:l.url??"",agentName:l.agentName,runtimeId:l.runtimeId,consoleUrl:l.consoleUrl,region:l.region,feishuChannel:l.feishuChannel}}async function CR(e){var n;const t=await It("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||`取消部署失败 (${t.status})`)}(n=ru.get(e))==null||n.abort(),ru.delete(e)}async function IR(e="cn-beijing"){const t=await It(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const zu={title:"VeADK Studio",logoUrl:""},t0={studio:!1,branding:zu,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function RR(){var e,t;try{const n=await It("/web/ui-config");if(!n.ok)return t0;const r=await n.json(),i=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:zu.logoUrl;return{studio:r.studio??!1,branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:zu.title,logoUrl:i?Bi(i):""},features:{...t0.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local"}}catch{return t0}}const OR={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function LR(){var n,r,i;const e=await It("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((i=t.capabilities)==null?void 0:i.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function xh(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await It(`/web/runtimes?${t.toString()}`);if(!n.ok)throw new Error(`加载 Runtime 失败 (${n.status})`);const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function MR(e,t="cn-beijing"){try{return await Tm("","",{runtimeId:e,region:t})}catch(n){if(n instanceof xd||n instanceof $u)throw n;return null}}async function DR(e,t="cn-beijing"){const n=await It("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(r||`删除失败 (${n.status})`)}}async function JE(e,t="cn-beijing"){const n=await It(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await ii(n,"加载 Runtime 详情失败"));return n.json()}async function wp(e){const t=await It("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await ii(t,"生成项目失败"));return t.json()}async function PR(e){const t=await It("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await ii(t,"创建调试运行失败"));return t.json()}async function jR(e,t){const n=await It(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await ii(n,"创建调试会话失败"));return(await n.json()).id}async function*BR({runId:e,userId:t,sessionId:n,text:r,signal:i}){const s=r.trim()?[{text:r}]:[],a=await It(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:s},streaming:!0}),signal:i},{},0);if(!a.ok)throw new Error(await ii(a,"调试运行失败"));for await(const o of GE(a))yield o}async function E1(e){const t=await It(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await ii(t,"清理调试运行失败"))}const GU=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:zu,DEFAULT_STUDIO_ACCESS:OR,RuntimeAccessDeniedError:xd,RuntimeProbeError:$u,cancelAgentkitDeployment:CR,clearRemoteApps:ER,componentSearch:NR,createGeneratedAgentTestRun:PR,createGeneratedAgentTestSession:jR,createSession:Ep,deleteGeneratedAgentTestRun:E1,deleteMedia:Eh,deleteRuntime:DR,deleteSession:y1,deleteSessionMedia:b1,deployAgentkitProject:ZE,fetchRemoteApps:Tm,generateAgentProject:wp,getAgentInfo:wd,getMediaCapabilities:qU,getMyRuntimes:IR,getRuntimeAgentInfo:SR,getRuntimeDetail:JE,getRuntimes:xh,getSession:xp,getSessionTrace:TR,getStudioAccess:LR,getUiConfig:RR,listApps:xR,listSessions:QE,mediaContentUrl:_R,probeRuntimeApps:MR,registerRemoteApp:bR,runGeneratedAgentTestSSE:BR,runSSE:Hu,uploadMedia:wR,webSearch:AR},Symbol.toStringTag,{value:"Module"})),XU="send_a2ui_json_to_client",QU="validated_a2ui_json",x1="adk_request_credential";function ZU(e){var r,i,s,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function Ji(){return{blocks:[],liveStart:0}}const gT=e=>e.functionCall??e.function_call,w1=e=>e.functionResponse??e.function_response;function JU(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function FR(e){const t=[];for(const[n,r]of e.entries()){const i=r.partMetadata??r.part_metadata,s=i==null?void 0:i.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const a=i==null?void 0:i.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=r.inlineData??r.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:JU(o.data),name:o.displayName??o.display_name});continue}const l=r.fileData??r.file_data,u=(l==null?void 0:l.fileUri)??(l==null?void 0:l.file_uri);l&&u&&t.push({id:u,mimeType:l.mimeType??l.mime_type,uri:u,name:l.displayName??l.display_name})}return t}function v1(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const e7=new Set(["llm","sequential","parallel","loop","a2a"]);function t7(e){var t;for(const n of e){const r=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!r||typeof r!="object")continue;const i=r,s=Array.isArray(i.skills)?i.skills.flatMap(l=>{if(!l||typeof l!="object")return[];const u=l;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=i.targetAgent;if(o&&typeof o=="object"){const l=o,u=l.type;typeof l.name=="string"&&typeof u=="string"&&e7.has(u)&&Array.isArray(l.path)&&(a={name:l.name,description:typeof l.description=="string"?l.description:"",type:u,path:l.path.filter(d=>typeof d=="string")})}if(s.length>0||a)return{skills:s,targetAgent:a}}}function n7(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function yT(e,t,n){const r=e[e.length-1];r&&r.kind===t?r.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function Sf(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function vl(e,t){var a,o;const n=e.blocks.map(l=>({...l}));let r=e.liveStart;const i=((a=t.content)==null?void 0:a.parts)??[],s=i.some(l=>gT(l)||w1(l));if(t.partial&&!s){for(const l of i){const u=v1(l);typeof u=="string"&&u&&yT(n,l.thought?"thinking":"text",u)}return{blocks:n,liveStart:r}}n.length=r;for(const l of i){const u=gT(l),d=w1(l),f=FR([l]),h=v1(l);if(typeof h=="string"&&h)yT(n,l.thought?"thinking":"text",h);else if(f.length)Sf(n),n7(n,f);else if(u)if(Sf(n),u.name===x1){const p=u.args??{},m=p.authConfig??p.auth_config??p,w=String(p.functionCallId??p.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:u.id??"",label:w,authUri:ZU(m),authConfig:m,done:!1})}else n.push({kind:"tool",name:u.name??"",args:u.args,done:!1});else if(d){if(Sf(n),d.name===x1)for(let p=n.length-1;p>=0;p--){const m=n[p];if(m.kind==="auth"&&!m.done){m.done=!0;break}}for(let p=n.length-1;p>=0;p--){const m=n[p];if(m.kind==="tool"&&!m.done&&m.name===d.name){m.done=!0,m.response=d.response;break}}if(d.name===XU){const p=((o=d.response)==null?void 0:o[QU])??[];if(p.length){const m=n[n.length-1];m&&m.kind==="a2ui"?m.messages.push(...p):n.push({kind:"a2ui",messages:p})}}}}return Sf(n),r=n.length,{blocks:n,liveStart:r}}function r7(e){var r;const t=[];let n=Ji();for(const i of e)if(i.author==="user"){const a=((r=i.content)==null?void 0:r.parts)??[];if(a.some(f=>{var h;return((h=w1(f))==null?void 0:h.name)===x1})){for(let f=t.length-1;f>=0;f--)if(t[f].role==="assistant"){for(let h=t[f].blocks.length-1;h>=0;h--){const p=t[f].blocks[h];if(p.kind==="auth"){p.done=!0;break}}break}}const o=a.map(v1).filter(f=>!!f).join(""),l=FR(a),u=t7(a);if(!o&&!l.length&&!u){n=Ji();continue}const d=[];u&&d.push({kind:"invocation",value:u}),l.length&&d.push({kind:"attachment",files:l}),o&&d.push({kind:"text",text:o}),t.push({role:"user",blocks:d,meta:{ts:i.timestamp}}),n=Ji()}else{let a=t[t.length-1];(!a||a.role!=="assistant")&&(a={role:"assistant",blocks:[],meta:{}},t.push(a),n=Ji()),n=vl(n,i),a.blocks=n.blocks;const o=i.usageMetadata??i.usage_metadata,l=a.meta??(a.meta={});o!=null&&o.totalTokenCount&&(l.tokens=o.totalTokenCount),i.timestamp&&(l.ts=i.timestamp)}return t}function UR(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const i=(((n=r.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(i)return i}return"新会话"}async function vd(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:as(void 0,vm)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function i7(){return(await vd("/web/skill-spaces?region=all")).items||[]}async function s7(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),vd(`/web/skill-spaces?${t.toString()}`)}async function a7(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await vd(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function o7(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),vd(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function l7(e,t,n,r,i){const s=[];n&&s.push(`version=${encodeURIComponent(n)}`),r&&s.push(`region=${encodeURIComponent(r)}`),i&&s.push(`project=${encodeURIComponent(i)}`);const a=s.length>0?`?${s.join("&")}`:"";return vd(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function c7(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function u7(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function xfe(){}function d7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const f7=/[$_\p{ID_Start}]/u,h7=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,p7=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,m7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,g7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$R={};function wfe(e){return e?f7.test(String.fromCodePoint(e)):!1}function vfe(e,t){const r=(t||$R).jsx?p7:h7;return e?r.test(String.fromCodePoint(e)):!1}function bT(e,t){return($R.jsx?g7:m7).test(e)}const y7=/[ \t\n\f\r]/g;function b7(e){return typeof e=="object"?e.type==="text"?ET(e.value):!1:ET(e)}function ET(e){return e.replace(y7,"")===""}let _d=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};_d.prototype.normal={};_d.prototype.property={};_d.prototype.space=void 0;function HR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new _d(n,r,t)}function _1(e){return e.toLowerCase()}let Tr=class{constructor(t,n){this.attribute=n,this.property=t}};Tr.prototype.attribute="";Tr.prototype.booleanish=!1;Tr.prototype.boolean=!1;Tr.prototype.commaOrSpaceSeparated=!1;Tr.prototype.commaSeparated=!1;Tr.prototype.defined=!1;Tr.prototype.mustUseProperty=!1;Tr.prototype.number=!1;Tr.prototype.overloadedBoolean=!1;Tr.prototype.property="";Tr.prototype.spaceSeparated=!1;Tr.prototype.space=void 0;let E7=0;const et=io(),xn=io(),T1=io(),be=io(),Pt=io(),il=io(),Ir=io();function io(){return 2**++E7}const k1=Object.freeze(Object.defineProperty({__proto__:null,boolean:et,booleanish:xn,commaOrSpaceSeparated:Ir,commaSeparated:il,number:be,overloadedBoolean:T1,spaceSeparated:Pt},Symbol.toStringTag,{value:"Module"})),n0=Object.keys(k1);let ex=class extends Tr{constructor(t,n,r,i){let s=-1;if(super(t,n),xT(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&T7.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(wT,N7);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!wT.test(s)){let a=s.replace(_7,S7);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=ex}return new i(r,t)}function S7(e){return"-"+e.toLowerCase()}function N7(e){return e.charAt(1).toUpperCase()}const A7=HR([zR,x7,YR,WR,qR],"html"),tx=HR([zR,w7,YR,WR,qR],"svg");function C7(e){return e.join(" ").trim()}var nx={},vT=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,I7=/\n/g,R7=/^\s*/,O7=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,L7=/^:\s*/,M7=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,D7=/^[;\s]*/,P7=/^\s+|\s+$/g,j7=` -`,_T="/",TT="*",va="",B7="comment",F7="declaration";function U7(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var y=m.match(I7);y&&(n+=y.length);var w=m.lastIndexOf(j7);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(y){return y.position=new a(m),u(),y}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var y=new Error(t.source+":"+n+":"+r+": "+m);if(y.reason=m,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(m){var y=m.exec(e);if(y){var w=y[0];return i(w),e=e.slice(w.length),y}}function u(){l(R7)}function d(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=s();if(!(_T!=e.charAt(0)||TT!=e.charAt(1))){for(var y=2;va!=e.charAt(y)&&(TT!=e.charAt(y)||_T!=e.charAt(y+1));)++y;if(y+=2,va===e.charAt(y-1))return o("End of comment missing");var w=e.slice(2,y-2);return r+=2,i(w),e=e.slice(y),r+=2,m({type:B7,comment:w})}}function h(){var m=s(),y=l(O7);if(y){if(f(),!l(L7))return o("property missing ':'");var w=l(M7),g=m({type:F7,property:kT(y[0].replace(vT,va)),value:w?kT(w[0].replace(vT,va)):va});return l(D7),g}}function p(){var m=[];d(m);for(var y;y=h();)y!==!1&&(m.push(y),d(m));return m}return u(),p()}function kT(e){return e?e.replace(P7,va):va}var $7=U7,H7=jh&&jh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nx,"__esModule",{value:!0});nx.default=V7;const z7=H7($7);function V7(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,z7.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:o}=s;i?t(a,o,s):o&&(n=n||{},n[a]=o)}),n}var km={};Object.defineProperty(km,"__esModule",{value:!0});km.camelCase=void 0;var K7=/^--[a-zA-Z0-9_-]+$/,Y7=/-([a-z])/g,W7=/^[^-]+$/,q7=/^-(webkit|moz|ms|o|khtml)-/,G7=/^-(ms)-/,X7=function(e){return!e||W7.test(e)||K7.test(e)},Q7=function(e,t){return t.toUpperCase()},ST=function(e,t){return"".concat(t,"-")},Z7=function(e,t){return t===void 0&&(t={}),X7(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(G7,ST):e=e.replace(q7,ST),e.replace(Y7,Q7))};km.camelCase=Z7;var J7=jh&&jh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},e$=J7(nx),t$=km;function S1(e,t){var n={};return!e||typeof e!="string"||(0,e$.default)(e,function(r,i){r&&i&&(n[(0,t$.camelCase)(r,t)]=i)}),n}S1.default=S1;var n$=S1;const r$=cd(n$),GR=XR("end"),rx=XR("start");function XR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function i$(e){const t=rx(e),n=GR(e);if(t&&n)return{start:t,end:n}}function iu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?NT(e.position):"start"in e||"end"in e?NT(e):"line"in e||"column"in e?N1(e):""}function N1(e){return AT(e&&e.line)+":"+AT(e&&e.column)}function NT(e){return N1(e&&e.start)+"-"+N1(e&&e.end)}function AT(e){return e&&typeof e=="number"?e:1}class tr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=iu(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tr.prototype.file="";tr.prototype.name="";tr.prototype.reason="";tr.prototype.message="";tr.prototype.stack="";tr.prototype.column=void 0;tr.prototype.line=void 0;tr.prototype.ancestors=void 0;tr.prototype.cause=void 0;tr.prototype.fatal=void 0;tr.prototype.place=void 0;tr.prototype.ruleId=void 0;tr.prototype.source=void 0;const ix={}.hasOwnProperty,s$=new Map,a$=/[A-Z]/g,o$=new Set(["table","tbody","thead","tfoot","tr"]),l$=new Set(["td","th"]),QR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function c$(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=y$(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=g$(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?tx:A7,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=ZR(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function ZR(e,t,n){if(t.type==="element")return u$(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return d$(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return h$(e,t,n);if(t.type==="mdxjsEsm")return f$(e,t);if(t.type==="root")return p$(e,t,n);if(t.type==="text")return m$(e,t)}function u$(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=tx,e.schema=i),e.ancestors.push(t);const s=eO(e,t.tagName,!1),a=b$(e,t);let o=ax(e,t);return o$.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!b7(l):!0})),JR(e,a,s,t),sx(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function d$(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Vu(e,t.position)}function f$(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Vu(e,t.position)}function h$(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=tx,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:eO(e,t.name,!0),a=E$(e,t),o=ax(e,t);return JR(e,a,s,t),sx(a,o),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function p$(e,t,n){const r={};return sx(r,ax(e,t)),e.create(t,e.Fragment,r,n)}function m$(e,t){return t.value}function JR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function sx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function g$(e,t,n){return r;function r(i,s,a,o){const u=Array.isArray(a.children)?n:t;return o?u(s,a,o):u(s,a)}}function y$(e,t){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=rx(r);return t(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function b$(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ix.call(t.properties,i)){const s=x$(e,i,t.properties[i]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&l$.has(t.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function E$(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Vu(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,s=e.evaluater.evaluateExpression(o.expression)}else Vu(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ax(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:s$;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);s0?(jr(e,e.length,0,t),e):t}const RT={}.hasOwnProperty;function nO(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function yi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cr=sa(/[A-Za-z]/),Jn=sa(/[\dA-Za-z]/),C$=sa(/[#-'*+\--9=?A-Z^-~]/);function vp(e){return e!==null&&(e<32||e===127)}const A1=sa(/\d/),I$=sa(/[\dA-Fa-f]/),R$=sa(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function Rt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const Sm=sa(new RegExp("\\p{P}|\\p{S}","u")),Wa=sa(/\s/);function sa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Yl(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const o=e.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function ht(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return ot(l)?(e.enter(n),o(l)):t(l)}function o(l){return ot(l)&&s++a))return;const C=t.events.length;let S=C,R,I;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(R){I=t.events[S][1].end;break}R=!0}for(g(r),T=C;Tb;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=b}function E(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function P$(e,t,n){return ht(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _l(e){if(e===null||Rt(e)||Wa(e))return 1;if(Sm(e))return 2}function Nm(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};LT(f,-l),LT(h,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Wr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Wr(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=Wr(u,Nm(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Wr(u,[["exit",s,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Wr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,jr(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&ot(T)?ht(e,E,"linePrefix",s+1)(T):E(T)}function E(T){return T===null||Ue(T)?e.check(MT,y,_)(T):(e.enter("codeFlowValue"),b(T))}function b(T){return T===null||Ue(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),b)}function _(T){return e.exit("codeFenced"),t(T)}function k(T,C,S){let R=0;return I;function I(U){return T.enter("lineEnding"),T.consume(U),T.exit("lineEnding"),M}function M(U){return T.enter("codeFencedFence"),ot(U)?ht(T,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):B(U)}function B(U){return U===o?(T.enter("codeFencedFenceSequence"),Y(U)):S(U)}function Y(U){return U===o?(R++,T.consume(U),Y):R>=a?(T.exit("codeFencedFenceSequence"),ot(U)?ht(T,P,"whitespace")(U):P(U)):S(U)}function P(U){return U===null||Ue(U)?(T.exit("codeFencedFence"),C(U)):S(U)}}}function q$(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const i0={name:"codeIndented",tokenize:X$},G$={partial:!0,tokenize:Q$};function X$(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),ht(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):Ue(u)?e.attempt(G$,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Ue(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function Q$(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Ue(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):ht(e,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):Ue(a)?i(a):n(a)}}const Z$={name:"codeText",previous:eH,resolve:J$,tokenize:tH};function J$(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&bc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),bc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),bc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function lO(e,t,n,r,i,s,a,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(g),e.exit(s),h):g===null||g===32||g===41||vp(g)?n(g):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),y(g))}function h(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(o),h(g)):g===null||g===60||Ue(g)?n(g):(e.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function y(g){return!d&&(g===null||g===41||Rt(g))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(g)):d999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ue(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Ue(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!ot(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function uO(e,t,n,r,i,s){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,l):n(h)}function l(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===a?(e.exit(s),l(a)):h===null?n(h):Ue(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ht(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Ue(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function su(e,t){let n;return r;function r(i){return Ue(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):ot(i)?ht(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const cH={name:"definition",tokenize:dH},uH={partial:!0,tokenize:fH};function dH(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),a(p)}function a(p){return cO.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return i=yi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Rt(p)?su(e,u)(p):u(p)}function u(p){return lO(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(uH,f,f)(p)}function f(p){return ot(p)?ht(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Ue(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function fH(e,t,n){return r;function r(o){return Rt(o)?su(e,i)(o):n(o)}function i(o){return uO(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return ot(o)?ht(e,a,"whitespace")(o):a(o)}function a(o){return o===null||Ue(o)?t(o):n(o)}}const hH={name:"hardBreakEscape",tokenize:pH};function pH(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ue(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const mH={name:"headingAtx",resolve:gH,tokenize:yH};function gH(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},jr(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function yH(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Rt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Ue(d)?(e.exit("atxHeading"),t(d)):ot(d)?ht(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Rt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const bH=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],PT=["pre","script","style","textarea"],EH={concrete:!0,name:"htmlFlow",resolveTo:vH,tokenize:_H},xH={partial:!0,tokenize:kH},wH={partial:!0,tokenize:TH};function vH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function _H(e,t,n){const r=this;let i,s,a,o,l;return u;function u(D){return d(D)}function d(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),f}function f(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),s=!0,y):D===63?(e.consume(D),i=3,r.interrupt?t:N):cr(D)?(e.consume(D),a=String.fromCharCode(D),w):n(D)}function h(D){return D===45?(e.consume(D),i=2,p):D===91?(e.consume(D),i=5,o=0,m):cr(D)?(e.consume(D),i=4,r.interrupt?t:N):n(D)}function p(D){return D===45?(e.consume(D),r.interrupt?t:N):n(D)}function m(D){const ne="CDATA[";return D===ne.charCodeAt(o++)?(e.consume(D),o===ne.length?r.interrupt?t:B:m):n(D)}function y(D){return cr(D)?(e.consume(D),a=String.fromCharCode(D),w):n(D)}function w(D){if(D===null||D===47||D===62||Rt(D)){const ne=D===47,J=a.toLowerCase();return!ne&&!s&&PT.includes(J)?(i=1,r.interrupt?t(D):B(D)):bH.includes(a.toLowerCase())?(i=6,ne?(e.consume(D),g):r.interrupt?t(D):B(D)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):s?E(D):b(D))}return D===45||Jn(D)?(e.consume(D),a+=String.fromCharCode(D),w):n(D)}function g(D){return D===62?(e.consume(D),r.interrupt?t:B):n(D)}function E(D){return ot(D)?(e.consume(D),E):I(D)}function b(D){return D===47?(e.consume(D),I):D===58||D===95||cr(D)?(e.consume(D),_):ot(D)?(e.consume(D),b):I(D)}function _(D){return D===45||D===46||D===58||D===95||Jn(D)?(e.consume(D),_):k(D)}function k(D){return D===61?(e.consume(D),T):ot(D)?(e.consume(D),k):b(D)}function T(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),l=D,C):ot(D)?(e.consume(D),T):S(D)}function C(D){return D===l?(e.consume(D),l=null,R):D===null||Ue(D)?n(D):(e.consume(D),C)}function S(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Rt(D)?k(D):(e.consume(D),S)}function R(D){return D===47||D===62||ot(D)?b(D):n(D)}function I(D){return D===62?(e.consume(D),M):n(D)}function M(D){return D===null||Ue(D)?B(D):ot(D)?(e.consume(D),M):n(D)}function B(D){return D===45&&i===2?(e.consume(D),A):D===60&&i===1?(e.consume(D),L):D===62&&i===4?(e.consume(D),H):D===63&&i===3?(e.consume(D),N):D===93&&i===5?(e.consume(D),j):Ue(D)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(xH,V,Y)(D)):D===null||Ue(D)?(e.exit("htmlFlowData"),Y(D)):(e.consume(D),B)}function Y(D){return e.check(wH,P,V)(D)}function P(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),U}function U(D){return D===null||Ue(D)?Y(D):(e.enter("htmlFlowData"),B(D))}function A(D){return D===45?(e.consume(D),N):B(D)}function L(D){return D===47?(e.consume(D),a="",O):B(D)}function O(D){if(D===62){const ne=a.toLowerCase();return PT.includes(ne)?(e.consume(D),H):B(D)}return cr(D)&&a.length<8?(e.consume(D),a+=String.fromCharCode(D),O):B(D)}function j(D){return D===93?(e.consume(D),N):B(D)}function N(D){return D===62?(e.consume(D),H):D===45&&i===2?(e.consume(D),N):B(D)}function H(D){return D===null||Ue(D)?(e.exit("htmlFlowData"),V(D)):(e.consume(D),H)}function V(D){return e.exit("htmlFlow"),t(D)}}function TH(e,t,n){const r=this;return i;function i(a){return Ue(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function kH(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Td,t,n)}}const SH={name:"htmlText",tokenize:NH};function NH(e,t,n){const r=this;let i,s,a;return o;function o(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),u):N===47?(e.consume(N),k):N===63?(e.consume(N),b):cr(N)?(e.consume(N),S):n(N)}function u(N){return N===45?(e.consume(N),d):N===91?(e.consume(N),s=0,m):cr(N)?(e.consume(N),E):n(N)}function d(N){return N===45?(e.consume(N),p):n(N)}function f(N){return N===null?n(N):N===45?(e.consume(N),h):Ue(N)?(a=f,L(N)):(e.consume(N),f)}function h(N){return N===45?(e.consume(N),p):f(N)}function p(N){return N===62?A(N):N===45?h(N):f(N)}function m(N){const H="CDATA[";return N===H.charCodeAt(s++)?(e.consume(N),s===H.length?y:m):n(N)}function y(N){return N===null?n(N):N===93?(e.consume(N),w):Ue(N)?(a=y,L(N)):(e.consume(N),y)}function w(N){return N===93?(e.consume(N),g):y(N)}function g(N){return N===62?A(N):N===93?(e.consume(N),g):y(N)}function E(N){return N===null||N===62?A(N):Ue(N)?(a=E,L(N)):(e.consume(N),E)}function b(N){return N===null?n(N):N===63?(e.consume(N),_):Ue(N)?(a=b,L(N)):(e.consume(N),b)}function _(N){return N===62?A(N):b(N)}function k(N){return cr(N)?(e.consume(N),T):n(N)}function T(N){return N===45||Jn(N)?(e.consume(N),T):C(N)}function C(N){return Ue(N)?(a=C,L(N)):ot(N)?(e.consume(N),C):A(N)}function S(N){return N===45||Jn(N)?(e.consume(N),S):N===47||N===62||Rt(N)?R(N):n(N)}function R(N){return N===47?(e.consume(N),A):N===58||N===95||cr(N)?(e.consume(N),I):Ue(N)?(a=R,L(N)):ot(N)?(e.consume(N),R):A(N)}function I(N){return N===45||N===46||N===58||N===95||Jn(N)?(e.consume(N),I):M(N)}function M(N){return N===61?(e.consume(N),B):Ue(N)?(a=M,L(N)):ot(N)?(e.consume(N),M):R(N)}function B(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),i=N,Y):Ue(N)?(a=B,L(N)):ot(N)?(e.consume(N),B):(e.consume(N),P)}function Y(N){return N===i?(e.consume(N),i=void 0,U):N===null?n(N):Ue(N)?(a=Y,L(N)):(e.consume(N),Y)}function P(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||Rt(N)?R(N):(e.consume(N),P)}function U(N){return N===47||N===62||Rt(N)?R(N):n(N)}function A(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function L(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),O}function O(N){return ot(N)?ht(e,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):j(N)}function j(N){return e.enter("htmlTextData"),a(N)}}const cx={name:"labelEnd",resolveAll:RH,resolveTo:OH,tokenize:LH},AH={tokenize:MH},CH={tokenize:DH},IH={tokenize:PH};function RH(e){let t=-1;const n=[];for(;++t=3&&(u===null||Ue(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),ot(u)?ht(e,o,"whitespace")(u):o(u))}}const gr={continuation:{tokenize:YH},exit:qH,name:"list",tokenize:KH},zH={partial:!0,tokenize:GH},VH={partial:!0,tokenize:WH};function KH(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:A1(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(wh,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return A1(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Td,r.interrupt?n:d,e.attempt(zH,h,f))}function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return ot(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function YH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Td,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ht(e,t,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!ot(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(VH,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ht(e,e.attempt(gr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function WH(e,t,n){const r=this;return ht(e,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(s):n(s)}}function qH(e){e.exit(this.containerState.type)}function GH(e,t,n){const r=this;return ht(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!ot(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const jT={name:"setextUnderline",resolveTo:XH,tokenize:QH};function XH(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function QH(e,t,n){const r=this;let i;return s;function s(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),ot(u)?ht(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Ue(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ZH={tokenize:JH};function JH(e){const t=this,n=e.attempt(Td,r,e.attempt(this.parser.constructs.flowInitial,i,ht(e,e.attempt(this.parser.constructs.flow,i,e.attempt(iH,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ez={resolveAll:fO()},tz=dO("string"),nz=dO("text");function dO(e){return{resolveAll:fO(e==="text"?rz:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,o);return a;function a(d){return u(d)?s(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function gz(e,t){let n=-1;const r=[];let i;for(;++n0){const ft=le.tokenStack[le.tokenStack.length-1];(ft[1]||FT).call(le,void 0,ft[0])}for(X.position={start:ws(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:ws(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},Le=-1;++Le0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Iz(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Rz(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Oz(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Yl(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function Lz(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mz(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mO(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function Dz(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mO(e,t);const i={src:Yl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Pz(e,t){const n={src:Yl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jz(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Bz(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mO(e,t);const i={href:Yl(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Fz(e,t){const n={href:Yl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Uz(e,t,n){const r=e.all(t),i=n?$z(n):gO(t),s={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o1}function Hz(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=rx(t.children[1]),l=GR(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function Wz(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(HT(t.slice(i),i>0,!1)),s.join("")}function HT(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===UT||s===$T;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===UT||s===$T;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Xz(e,t){const n={type:"text",value:Gz(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Qz(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Zz={blockquote:Nz,break:Az,code:Cz,delete:Iz,emphasis:Rz,footnoteReference:Oz,heading:Lz,html:Mz,imageReference:Dz,image:Pz,inlineCode:jz,linkReference:Bz,link:Fz,listItem:Uz,list:Hz,paragraph:zz,root:Vz,strong:Kz,table:Yz,tableCell:qz,tableRow:Wz,text:Xz,thematicBreak:Qz,toml:Nf,yaml:Nf,definition:Nf,footnoteDefinition:Nf};function Nf(){}const yO=-1,Am=0,au=1,_p=2,ux=3,dx=4,fx=5,hx=6,bO=7,EO=8,Jz=typeof self=="object"?self:globalThis,zT=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Jz[e](t)},eV=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Am:case yO:return n(a,i);case au:{const o=n([],i);for(const l of a)o.push(r(l));return o}case _p:{const o=n({},i);for(const[l,u]of a)o[r(l)]=r(u);return o}case ux:return n(new Date(a),i);case dx:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case fx:{const o=n(new Map,i);for(const[l,u]of a)o.set(r(l),r(u));return o}case hx:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case bO:{const{name:o,message:l}=a;return n(zT(o,l),i)}case EO:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(zT(s,a),i)};return r},VT=e=>eV(new Map,e)(0),yo="",{toString:tV}={},{keys:nV}=Object,Ec=e=>{const t=typeof e;if(t!=="object"||!e)return[Am,t];const n=tV.call(e).slice(8,-1);switch(n){case"Array":return[au,yo];case"Object":return[_p,yo];case"Date":return[ux,yo];case"RegExp":return[dx,yo];case"Map":return[fx,yo];case"Set":return[hx,yo];case"DataView":return[au,n]}return n.includes("Array")?[au,n]:n.includes("Error")?[bO,n]:[_p,n]},Af=([e,t])=>e===Am&&(t==="function"||t==="symbol"),rV=(e,t,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=Ec(a);switch(o){case Am:{let d=a;switch(l){case"bigint":o=EO,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([yO],a)}return i([o,d],a)}case au:{if(l){let h=a;return l==="DataView"?h=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(a)),i([l,[...h]],a)}const d=[],f=i([o,d],a);for(const h of a)d.push(s(h));return f}case _p:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const d=[],f=i([o,d],a);for(const h of nV(a))(e||!Af(Ec(a[h])))&&d.push([s(h),s(a[h])]);return f}case ux:return i([o,a.toISOString()],a);case dx:{const{source:d,flags:f}=a;return i([o,{source:d,flags:f}],a)}case fx:{const d=[],f=i([o,d],a);for(const[h,p]of a)(e||!(Af(Ec(h))||Af(Ec(p))))&&d.push([s(h),s(p)]);return f}case hx:{const d=[],f=i([o,d],a);for(const h of a)(e||!Af(Ec(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([o,{name:l,message:u}],a)};return s},KT=(e,{json:t,lossy:n}={})=>{const r=[];return rV(!(t||n),!!t,new Map,r)(e),r},Tp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?VT(KT(e,t)):structuredClone(e):(e,t)=>VT(KT(e,t));function iV(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function sV(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function aV(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||iV,r=e.options.footnoteBackLabel||sV,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l0&&m.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,p);typeof E=="string"&&(E={type:"text",value:E}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const E=w.children[w.children.length-1];E&&E.type==="text"?E.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...m)}else d.push(...m);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Tp(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const kd=function(e){if(e==null)return uV;if(typeof e=="function")return Cm(e);if(typeof e=="object")return Array.isArray(e)?oV(e):lV(e);if(typeof e=="string")return cV(e);throw new Error("Expected function, string, or object as test")};function oV(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=xO,m,y,w;if((!t||s(l,u,d[d.length-1]||void 0))&&(p=pV(n(l,d)),p[0]===I1))return p;if("children"in l&&l.children){const g=l;if(g.children&&p[0]!==hV)for(y=(r?g.children.length:-1)+a,w=d.concat(g);y>-1&&y0&&n.push({type:"text",value:` -`}),n}function YT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function WT(e,t){const n=gV(e,t),r=n.one(e,void 0),i=aV(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` -`},i),s}function wV(e,t){return e&&"run"in e?async function(n,r){const i=WT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return WT(n,{file:r,...e||t})}}function qT(e){if(e)throw e}var vh=Object.prototype.hasOwnProperty,vO=Object.prototype.toString,GT=Object.defineProperty,XT=Object.getOwnPropertyDescriptor,QT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):vO.call(t)==="[object Array]"},ZT=function(t){if(!t||vO.call(t)!=="[object Object]")return!1;var n=vh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&vh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||vh.call(t,i)},JT=function(t,n){GT&&n.name==="__proto__"?GT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ek=function(t,n){if(n==="__proto__")if(vh.call(t,n)){if(XT)return XT(t,n).value}else return;return t[n]},vV=function e(){var t,n,r,i,s,a,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});la.length;let l;o&&a.push(i);try{l=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return i(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,t(a,...o))}function s(a){i(null,a)}}const Ii={basename:kV,dirname:SV,extname:NV,join:AV,sep:"/"};function kV(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Sd(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function SV(e){if(Sd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function NV(e){Sd(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function AV(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function IV(e,t){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=e.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function Sd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const RV={cwd:OV};function OV(){return"/"}function L1(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function LV(e){if(typeof e=="string")e=new URL(e);else if(!L1(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return MV(e)}function MV(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const y=r[h][1];O1(y)&&O1(p)&&(p=a0(!0,y,p)),r[h]=[u,p,...m]}}}}const BV=new px().freeze();function u0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function d0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function f0(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function nk(e){if(!O1(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function rk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cf(e){return FV(e)?e:new _O(e)}function FV(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function UV(e){return typeof e=="string"||$V(e)}function $V(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const HV="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ik=[],sk={allowDangerousHtml:!0},zV=/^(https?|ircs?|mailto|xmpp)$/i,VV=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function KV(e){const t=YV(e),n=WV(e);return qV(t.runSync(t.parse(n),n),e)}function YV(e){const t=e.rehypePlugins||ik,n=e.remarkPlugins||ik,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...sk}:sk;return BV().use(Sz).use(n).use(wV,r).use(t)}function WV(e){const t=e.children||"",n=new _O;return typeof t=="string"&&(n.value=t),n}function qV(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||GV;for(const d of VV)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+HV+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Im(e,u),c$(e,{Fragment:c.Fragment,components:i,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in r0)if(Object.hasOwn(r0,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],y=r0[p];(y===null||y.includes(d.tagName))&&(d.properties[p]=l(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function GV(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||zV.test(e.slice(0,t))?e:""}function ak(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function XV(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function QV(e,t,n){const i=kd((n||{}).ignore||[]),s=ZV(t);let a=-1;for(;++a0?{type:"text",value:T}:void 0),T===!1?h.lastIndex=_+1:(m!==_&&E.push({type:"text",value:u.value.slice(m,_)}),Array.isArray(T)?E.push(...T):T&&E.push(T),m=_+b[0].length,g=!0),!h.global)break;b=h.exec(u.value)}return g?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=ak(e,"(");let s=ak(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function TO(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Wa(n)||Sm(n))&&(!t||n!==47)}kO.peek=wK;function hK(){this.buffer()}function pK(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function mK(){this.buffer()}function gK(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function yK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bK(e){this.exit(e)}function EK(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xK(e){this.exit(e)}function wK(){return"["}function kO(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),o(),a(),s+=i.move("]"),s}function vK(){return{enter:{gfmFootnoteCallString:hK,gfmFootnoteCall:pK,gfmFootnoteDefinitionLabelString:mK,gfmFootnoteDefinition:gK},exit:{gfmFootnoteCallString:yK,gfmFootnoteCall:bK,gfmFootnoteDefinitionLabelString:EK,gfmFootnoteDefinition:xK}}}function _K(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kO},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const o=s.createTracker(a);let l=o.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return l+=o.move(s.safe(s.associationId(r),{before:l,after:"]"})),d(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?` -`:" ")+s.indentLines(s.containerFlow(r,o.current()),t?SO:TK))),u(),l}}function TK(e,t,n){return t===0?e:SO(e,t,n)}function SO(e,t,n){return(n?"":" ")+e}const kK=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];NO.peek=IK;function SK(){return{canContainEols:["delete"],enter:{strikethrough:AK},exit:{strikethrough:CK}}}function NK(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:kK}],handlers:{delete:NO}}}function AK(e){this.enter({type:"delete",children:[]},e)}function CK(e){this.exit(e)}function NO(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function IK(){return"~"}function RK(e){return e.length}function OK(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||RK,s=[],a=[],o=[],l=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++gl[g])&&(l[g]=b)}y.push(E)}a[d]=y,o[d]=w}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fl[f]&&(l[f]=E),p[f]=E),h[f]=b}a.splice(1,0,h),o.splice(1,0,p),d=-1;const m=[];for(;++d "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),DK);return i(),a}function DK(e,t,n){return">"+(n?"":" ")+e}function PK(e,t){return lk(e,t.inConstruct,!0)&&!lk(e,t.notInConstruct,!1)}function lk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function BK(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function FK(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function UK(e,t,n,r){const i=FK(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(BK(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,$K);return f(),h}const o=n.createTracker(r),l=i.repeat(Math.max(jK(s,i)+1,3)),u=n.enter("codeFenced");let d=o.move(l);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:` -`,encode:["`"],...o.current()})),f()}return d+=o.move(` -`),s&&(d+=o.move(s+` -`)),d+=o.move(l),u(),d}function $K(e,t,n){return(n?"":" ")+e}function mx(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function HK(e,t,n,r){const i=mx(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),a(),u}function zK(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ku(e){return"&#x"+e.toString(16).toUpperCase()+";"}function kp(e,t,n){const r=_l(e),i=_l(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}AO.peek=VK;function AO(e,t,n,r){const i=zK(n),s=n.enter("emphasis"),a=n.createTracker(r),o=a.move(i);let l=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const u=l.charCodeAt(0),d=kp(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(l=Ku(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=kp(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+Ku(f));const p=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+l+p}function VK(e,t,n){return n.options.emphasis||"*"}function KK(e,t){let n=!1;return Im(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,I1}),!!((!e.depth||e.depth<3)&&ox(e)&&(t.options.setext||n))}function YK(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(KK(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:` -`,after:` -`});return f(),d(),h+` -`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` -`))+1))}const a="#".repeat(i),o=n.enter("headingAtx"),l=n.enter("phrasing");s.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...s.current()});return/^[\t ]/.test(u)&&(u=Ku(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),l(),o(),u}CO.peek=WK;function CO(e){return e.value||""}function WK(){return"<"}IO.peek=qK;function IO(e,t,n,r){const i=mx(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),o()),u+=l.move(")"),a(),u}function qK(){return"!"}RO.peek=GK;function RO(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const u=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function GK(){return"!"}OO.peek=XK;function OO(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}MO.peek=QK;function MO(e,t,n,r){const i=mx(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(LO(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),l=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),l()),u+=a.move(")"),o(),u}function QK(e,t,n){return LO(e,n)?"<":"["}DO.peek=ZK;function DO(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?l+=o.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function ZK(){return"["}function gx(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function JK(e){const t=gx(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function eY(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function PO(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function tY(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?eY(n):gx(n);const o=e.ordered?a==="."?")":".":JK(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),PO(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(s+" ".repeat(a-s.length)),o.shift(a);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return l(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?s:s+" ".repeat(a-s.length))+f}}function iY(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const sY=kd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aY(e,t,n,r){return(e.children.some(function(a){return sY(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function oY(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}jO.peek=lY;function jO(e,t,n,r){const i=oY(n),s=n.enter("strong"),a=n.createTracker(r),o=a.move(i+i);let l=a.move(n.containerPhrasing(e,{after:i,before:o,...a.current()}));const u=l.charCodeAt(0),d=kp(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(l=Ku(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=kp(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+Ku(f));const p=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+l+p}function lY(e,t,n){return n.options.strong||"*"}function cY(e,t,n,r){return n.safe(e.value,r)}function uY(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function dY(e,t,n){const r=(PO(n)+(n.options.ruleSpaces?" ":"")).repeat(uY(n));return n.options.ruleSpaces?r.slice(0,-1):r}const BO={blockquote:MK,break:ck,code:UK,definition:HK,emphasis:AO,hardBreak:ck,heading:YK,html:CO,image:IO,imageReference:RO,inlineCode:OO,link:MO,linkReference:DO,list:tY,listItem:rY,paragraph:iY,root:aY,strong:jO,text:cY,thematicBreak:dY};function fY(){return{enter:{table:hY,tableData:uk,tableHeader:uk,tableRow:mY},exit:{codeText:gY,table:pY,tableData:g0,tableHeader:g0,tableRow:g0}}}function hY(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function pY(e){this.exit(e),this.data.inTable=void 0}function mY(e){this.enter({type:"tableRow",children:[]},e)}function g0(e){this.exit(e)}function uk(e){this.enter({type:"tableCell",children:[]},e)}function gY(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yY));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function yY(e,t){return t==="|"?t:e}function bY(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:l,tableRow:o}};function a(p,m,y,w){return u(d(p,y,w),p.align)}function o(p,m,y,w){const g=f(p,y,w),E=u([g]);return E.slice(0,E.indexOf(` -`))}function l(p,m,y,w){const g=y.enter("tableCell"),E=y.enter("phrasing"),b=y.containerPhrasing(p,{...w,before:s,after:s});return E(),g(),b}function u(p,m){return OK(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function d(p,m,y){const w=p.children;let g=-1;const E=[],b=m.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const PY={tokenize:VY,partial:!0};function jY(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:$Y,continuation:{tokenize:HY},exit:zY}},text:{91:{name:"gfmFootnoteCall",tokenize:UY},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:BY,resolveTo:FY}}}}function BY(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const u=yi(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function FY(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function UY(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(s>999||f===93&&!a||f===null||f===91||Rt(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(yi(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Rt(f)||(a=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function $Y(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!o||m===null||m===91||Rt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return s=yi(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Rt(m)||(o=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),ht(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function HY(e,t,n){return e.check(Td,t,e.attempt(PY,t,n))}function zY(e){e.exit("gfmFootnoteDefinition")}function VY(e,t,n){const r=this;return ht(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function KY(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,o){let l=-1;for(;++l1?l(m):(a.consume(m),f++,p);if(f<2&&!n)return l(m);const w=a.exit("strikethroughSequenceTemporary"),g=_l(m);return w._open=!g||g===2&&!!y,w._close=!y||y===2&&!!g,o(m)}}}class YY{constructor(){this.map=[]}add(t,n,r){WY(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function WY(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const P=r.events[M][1].type;if(P==="lineEnding"||P==="linePrefix")M--;else break}const B=M>-1?r.events[M][1].type:null,Y=B==="tableHead"||B==="tableRow"?T:l;return Y===T&&r.parser.lazy[r.now().line]?n(I):Y(I)}function l(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,s+=1),d(I)}function d(I){return I===null?n(I):Ue(I)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),p):n(I):ot(I)?ht(e,d,"whitespace")(I):(s+=1,a&&(a=!1,i+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(I)))}function f(I){return I===null||I===124||Rt(I)?(e.exit("data"),d(I)):(e.consume(I),I===92?h:f)}function h(I){return I===92||I===124?(e.consume(I),f):f(I)}function p(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,ot(I)?ht(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?w(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),y):k(I)}function y(I){return ot(I)?ht(e,w,"whitespace")(I):w(I)}function w(I){return I===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),g):I===45?(s+=1,g(I)):I===null||Ue(I)?_(I):k(I)}function g(I){return I===45?(e.enter("tableDelimiterFiller"),E(I)):k(I)}function E(I){return I===45?(e.consume(I),E):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(I))}function b(I){return ot(I)?ht(e,_,"whitespace")(I):_(I)}function _(I){return I===124?m(I):I===null||Ue(I)?!a||i!==s?k(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):k(I)}function k(I){return n(I)}function T(I){return e.enter("tableRow"),C(I)}function C(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),C):I===null||Ue(I)?(e.exit("tableRow"),t(I)):ot(I)?ht(e,C,"whitespace")(I):(e.enter("data"),S(I))}function S(I){return I===null||I===124||Rt(I)?(e.exit("data"),C(I)):(e.consume(I),I===92?R:S)}function R(I){return I===92||I===124?(e.consume(I),S):S(I)}}function QY(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,d,f;const h=new YY;for(;++nn[2]+1){const m=n[2]+1,y=n[3]-n[2]-1;e.add(m,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},To(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function fk(e,t,n,r,i){const s=[],a=To(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function To(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const ZY={name:"tasklistCheck",tokenize:eW};function JY(){return{text:{91:ZY}}}function eW(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return Rt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return Ue(l)?t(l):ot(l)?e.check({tokenize:tW},t,n)(l):n(l)}}function tW(e,t,n){return ht(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function nW(e){return nO([NY(),jY(),KY(e),GY(),JY()])}const rW={};function iW(e){const t=this,n=e||rW,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(nW(n)),s.push(_Y()),a.push(TY(n))}const hk=function(e,t,n){const r=kd(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&l.push(` -`.repeat(u)||" "),u=-1,l.push(d))}return l.join("")}function qO(e,t,n){return e.type==="element"?fW(e,t,n):e.type==="text"?n.whitespace==="normal"?GO(e,n):hW(e):[]}function fW(e,t,n){const r=XO(e,n),i=e.children||[];let s=-1,a=[];if(uW(e))return a;let o,l;for(D1(e)||yk(e)&&hk(t,e,yk)?l=` -`:cW(e)?(o=2,l=2):WO(e)&&(o=1,l=1);++s]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],w=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:w},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:T.concat([{begin:/\(/,end:/\)/,keywords:_,contains:T.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function xW(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=EW(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function QO(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(o);const l={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},y=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],w=["true","false"],g={match:/(\/[a-z._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],k=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:y,literal:w,built_in:[...E,...b,"set","shopt",..._,...k]},contains:[p,e.SHEBANG(),m,f,s,a,g,o,l,u,d,n]}}function wW(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",w={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},g=[f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:g.concat([{begin:/\(/,end:/\)/,keywords:w,contains:g.concat(["self"]),relevance:0}]),relevance:0},b={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:w,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:w}}}function vW(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],w=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:w},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:T.concat([{begin:/\(/,end:/\)/,keywords:_,contains:T.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function _W(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],a={keyword:i.concat(s),built_in:t,literal:r},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},w=e.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.C_BLOCK_COMMENT_MODE],p.contains=[w,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const g={variants:[u,y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},g,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[g,l,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}const TW=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),kW=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],SW=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],NW=[...kW,...SW],AW=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),CW=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),IW=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),RW=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function OW(e){const t=e.regex,n=TW(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+CW.join("|")+")"},{begin:":(:)?("+IW.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+RW.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:AW.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+NW.join("|")+")\\b"}]}}function LW(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function MW(e){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"JO(e,t,n-1))}function PW(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+JO("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,bk,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},bk,u]}}const Ek="[A-Za-z$_][0-9A-Za-z$_]*",jW=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],BW=["true","false","null","undefined","NaN","Infinity"],eL=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],tL=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],nL=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],FW=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],UW=[].concat(nL,eL,tL);function rL(e){const t=e.regex,n=(O,{after:j})=>{const N="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,j)=>{const N=O[0].length+O.index,H=O.input[N];if(H==="<"||H===","){j.ignoreMatch();return}H===">"&&(n(O,{after:N})||j.ignoreMatch());let V;const D=O.input.substring(N);if(V=D.match(/^\s*=/)){j.ignoreMatch();return}if((V=D.match(/^\s+extends\s+/))&&V.index===0){j.ignoreMatch();return}}},o={$pattern:Ek,keyword:jW,literal:BW,built_in:UW,"variable.language":FW},l="[0-9](_?[0-9])*",u=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,w,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(E,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...eL,...tL]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(O){return t.concat("(?!",O.join("|"),")")}const Y={match:t.concat(/\b/,B([...nL,"super","import"].map(O=>`${O}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,w,E,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},Y,M,C,U,{match:/\$[(.]/}]}}function iL(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var So="[0-9](_*[0-9])*",Lf=`\\.(${So})`,Mf="[0-9a-fA-F](_*[0-9a-fA-F])*",$W={className:"number",variants:[{begin:`(\\b(${So})((${Lf})|\\.)?|(${Lf}))[eE][+-]?(${So})[fFdD]?\\b`},{begin:`\\b(${So})((${Lf})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Lf})[fFdD]?\\b`},{begin:`\\b(${So})[fFdD]\\b`},{begin:`\\b0[xX]((${Mf})\\.?|(${Mf})?\\.(${Mf}))[pP][+-]?(${So})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Mf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function HW(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(a);const o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=$W,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,o,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,o,l,a,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,l]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const zW=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),VW=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],KW=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],YW=[...VW,...KW],WW=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),sL=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),aL=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),qW=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),GW=sL.concat(aL).sort().reverse();function XW(e){const t=zW(e),n=GW,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",a=[],o=[],l=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},u=function(b,_,k){return{className:b,begin:_,relevance:k}},d={$pattern:/[a-z-]+/,keyword:r,attribute:WW.join(" ")},f={begin:"\\(",end:"\\)",contains:o,keywords:d,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=o.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},m={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+qW.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},y={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:o,relevance:0}},w={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},g={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+YW.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+sL.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+aL.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},E={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[g]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,w,E,m,g,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function QW(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function oL(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,l];return[u,d,f,h].forEach(g=>{g.contains=g.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function ZW(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,o={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function JW(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,s,l],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(y,w,g="\\1")=>{const E=g==="\\1"?g:t.concat(g,w);return t.concat(t.concat("(?:",y,")"),w,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,g,r)},p=(y,w,g)=>t.concat(t.concat("(?:",y,")"),w,/(?:\\.|[^\\\/])*?/,g,r),m=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function eq(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(P,U)=>{U.data._beginMatch=P[1]||P[2]},"on:end":(P,U)=>{U.data._beginMatch!==P[1]&&U.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ -]`,m={scope:"string",variants:[d,u,f,h]},y={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},w=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],_={keyword:g,literal:(P=>{const U=[];return P.forEach(A=>{U.push(A),A.toLowerCase()===A?U.push(A.toUpperCase()):U.push(A.toLowerCase())}),U})(w),built_in:E},k=P=>P.map(U=>U.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",k(E).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(r,"\\b(?!\\()"),S={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[R,a,S,e.C_BLOCK_COMMENT_MODE,m,y,T]},M={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(g).join("\\b|"),"|",k(E).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(M);const B=[R,S,e.C_BLOCK_COMMENT_MODE,m,y,T],Y={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:w,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:w,keyword:["new","array"]},contains:["self",...B]},...B,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:_,contains:[Y,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},a,M,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},T,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:_,contains:["self",Y,a,S,e.C_BLOCK_COMMENT_MODE,m,y]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,y]}}function tq(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function nq(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function cL(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,y={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},w={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,y,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,y,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,y,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,w,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[y,g,f]}]}}function rq(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function iq(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function sq(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},o={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},y={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},T=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,u),relevance:0}].concat(l,u);d.contains=T,y.contains=T;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:T}}];return u.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(I).concat(u).concat(T)}}function aq(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",o=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:o,literal:l,built_in:u},illegal:""},s]}}const oq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),lq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],cq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],uq=[...lq,...cq],dq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),fq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),hq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),pq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function mq(e){const t=oq(e),n=hq,r=fq,i="@[a-z-]+",s="and or not only",o={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+uq.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+pq.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,o,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:dq.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function gq(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function yq(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...u,...l].filter(k=>!d.includes(k)),y={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},w={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},g={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function E(k){return t.concat(/\b/,t.either(...k.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const b={scope:"keyword",match:E(h),relevance:0};function _(k,{exceptions:T,when:C}={}){const S=C;return T=T||[],k.map(R=>R.match(/\|\d+$/)||T.includes(R)?R:S(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(m,{when:k=>k.length<3}),literal:s,type:o,built_in:f},contains:[{scope:"type",match:E(a)},b,g,y,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,w]}}function uL(e){return e?typeof e=="string"?e:e.source:null}function xc(e){return Ct("(?=",e,")")}function Ct(...e){return e.map(n=>uL(n)).join("")}function bq(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function ar(...e){return"("+(bq(e).capture?"":"?:")+e.map(r=>uL(r)).join("|")+")"}const Ex=e=>Ct(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Eq=["Protocol","Type"].map(Ex),xk=["init","self"].map(Ex),xq=["Any","Self"],y0=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],wk=["false","nil","true"],wq=["assignment","associativity","higherThan","left","lowerThan","none","right"],vq=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],vk=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],dL=ar(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),fL=ar(dL,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),b0=Ct(dL,fL,"*"),hL=ar(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Sp=ar(hL,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Ai=Ct(hL,Sp,"*"),Df=Ct(/[A-Z]/,Sp,"*"),_q=["attached","autoclosure",Ct(/convention\(/,ar("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ct(/objc\(/,Ai,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Tq=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function kq(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,ar(...Eq,...xk)],className:{2:"keyword"}},s={match:Ct(/\./,ar(...y0)),relevance:0},a=y0.filter(ge=>typeof ge=="string").concat(["_|0"]),o=y0.filter(ge=>typeof ge!="string").concat(xq).map(Ex),l={variants:[{className:"keyword",match:ar(...o,...xk)}]},u={$pattern:ar(/\b\w+/,/#\w+/),keyword:a.concat(vq),literal:wk},d=[i,s,l],f={match:Ct(/\./,ar(...vk)),relevance:0},h={className:"built_in",match:Ct(/\b/,ar(...vk),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},y={className:"operator",relevance:0,variants:[{match:b0},{match:`\\.(\\.|${fL})+`}]},w=[m,y],g="([0-9]_*)+",E="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${g})(\\.(${g}))?([eE][+-]?(${g}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${g}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(ge="")=>({className:"subst",variants:[{match:Ct(/\\/,ge,/[0\\tnr"']/)},{match:Ct(/\\/,ge,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(ge="")=>({className:"subst",match:Ct(/\\/,ge,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(ge="")=>({className:"subst",label:"interpol",begin:Ct(/\\/,ge,/\(/),end:/\)/}),C=(ge="")=>({begin:Ct(ge,/"""/),end:Ct(/"""/,ge),contains:[_(ge),k(ge),T(ge)]}),S=(ge="")=>({begin:Ct(ge,/"/),end:Ct(/"/,ge),contains:[_(ge),T(ge)]}),R={className:"string",variants:[C(),C("#"),C("##"),C("###"),S(),S("#"),S("##"),S("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],M={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},B=ge=>{const De=Ct(ge,/\//),_e=Ct(/\//,ge);return{begin:De,end:_e,contains:[...I,{scope:"comment",begin:`#(?!.*${_e})`,end:/$/}]}},Y={scope:"regexp",variants:[B("###"),B("##"),B("#"),M]},P={match:Ct(/`/,Ai,/`/)},U={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${Sp}+`},L=[P,U,A],O={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Tq,contains:[...w,b,R]}]}},j={scope:"keyword",match:Ct(/@/,ar(..._q),xc(ar(/\(/,/\s+/)))},N={scope:"meta",match:Ct(/@/,Ai)},H=[O,j,N],V={match:xc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ct(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Sp,"+")},{className:"type",match:Df,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ct(/\s+&\s+/,xc(Df)),relevance:0}]},D={begin://,keywords:u,contains:[...r,...d,...H,m,V]};V.contains.push(D);const ne={match:Ct(Ai,/\s*:/),keywords:"_|0",relevance:0},J={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ne,...r,Y,...d,...p,...w,b,R,...L,...H,V]},re={begin://,keywords:"repeat each",contains:[...r,V]},de={begin:ar(xc(Ct(Ai,/\s*:/)),xc(Ct(Ai,/\s+/,Ai,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Ai}]},G={begin:/\(/,end:/\)/,keywords:u,contains:[de,...r,...d,...w,b,R,...H,V,J],endsParent:!0,illegal:/["']/},W={match:[/(func|macro)/,/\s+/,ar(P.match,Ai,b0)],className:{1:"keyword",3:"title.function"},contains:[re,G,t],illegal:[/\[/,/%/]},ae={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[re,G,t],illegal:/\[|%/},he={match:[/operator/,/\s+/,b0],className:{1:"keyword",3:"title"}},Z={begin:[/precedencegroup/,/\s+/,Df],className:{1:"keyword",3:"title"},contains:[V],keywords:[...wq,...wk],end:/}/},ce={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ie={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},xe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Ai,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[re,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:Df},...d],relevance:0}]};for(const ge of R.variants){const De=ge.contains.find(He=>He.label==="interpol");De.keywords=u;const _e=[...d,...p,...w,b,R,...L];De.contains=[..._e,{begin:/\(/,end:/\)/,contains:["self",..._e]}]}return{name:"Swift",keywords:u,contains:[...r,W,ae,ce,Ie,xe,he,Z,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},Y,...d,...p,...w,b,R,...L,...H,V,J]}}const Np="[A-Za-z$_][0-9A-Za-z$_]*",pL=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],mL=["true","false","null","undefined","NaN","Infinity"],gL=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],yL=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],bL=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],EL=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],xL=[].concat(bL,gL,yL);function Sq(e){const t=e.regex,n=(O,{after:j})=>{const N="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,j)=>{const N=O[0].length+O.index,H=O.input[N];if(H==="<"||H===","){j.ignoreMatch();return}H===">"&&(n(O,{after:N})||j.ignoreMatch());let V;const D=O.input.substring(N);if(V=D.match(/^\s*=/)){j.ignoreMatch();return}if((V=D.match(/^\s+extends\s+/))&&V.index===0){j.ignoreMatch();return}}},o={$pattern:Np,keyword:pL,literal:mL,built_in:xL,"variable.language":EL},l="[0-9](_?[0-9])*",u=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,w,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(E,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...gL,...yL]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(O){return t.concat("(?!",O.join("|"),")")}const Y={match:t.concat(/\b/,B([...bL,"super","import"].map(O=>`${O}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,w,E,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},Y,M,C,U,{match:/\$[(.]/}]}}function wL(e){const t=e.regex,n=Sq(e),r=Np,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Np,keyword:pL.concat(l),literal:mL,built_in:xL.concat(i),"variable.language":EL},d={className:"meta",begin:"@"+r},f=(y,w,g)=>{const E=y.contains.findIndex(b=>b.label===w);if(E===-1)throw new Error("can not find mode to replace");y.contains.splice(E,1,g)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(y=>y.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,s,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const m=n.contains.find(y=>y.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function Nq(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,i),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(s,i),/ +/,t.either(a,o),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function Aq(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,a,i,e.QUOTE_STRING_MODE,l,u,o]}}function Cq(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(s,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,l,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,a,l,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function vL(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},w=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,y,s,a],g=[...w];return g.pop(),g.push(o),p.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:w}}const Iq={arduino:xW,bash:QO,c:wW,cpp:vW,csharp:_W,css:OW,diff:LW,go:MW,graphql:DW,ini:ZO,java:PW,javascript:rL,json:iL,kotlin:HW,less:XW,lua:QW,makefile:oL,markdown:lL,objectivec:ZW,perl:JW,php:eq,"php-template":tq,plaintext:nq,python:cL,"python-repl":rq,r:iq,ruby:sq,rust:aq,scss:mq,shell:gq,sql:yq,swift:kq,typescript:wL,vbnet:Nq,wasm:Aq,xml:Cq,yaml:vL};function _L(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&_L(n)}),e}let _k=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function TL(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ps(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const Rq="",Tk=e=>!!e.scope,Oq=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class Lq{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=TL(t)}openNode(t){if(!Tk(t))return;const n=Oq(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Tk(t)&&(this.buffer+=Rq)}value(){return this.buffer}span(t){this.buffer+=``}}const kk=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class xx{constructor(){this.rootNode=kk(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=kk({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{xx._collapse(n)}))}}class Mq extends xx{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Lq(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Yu(e){return e?typeof e=="string"?e:e.source:null}function kL(e){return ao("(?=",e,")")}function Dq(e){return ao("(?:",e,")*")}function Pq(e){return ao("(?:",e,")?")}function ao(...e){return e.map(n=>Yu(n)).join("")}function jq(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function wx(...e){return"("+(jq(e).capture?"":"?:")+e.map(r=>Yu(r)).join("|")+")"}function SL(e){return new RegExp(e.toString()+"|").exec("").length-1}function Bq(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Fq=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function vx(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const i=n;let s=Yu(r),a="";for(;s.length>0;){const o=Fq.exec(s);if(!o){a+=s;break}a+=s.substring(0,o.index),s=s.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+i):(a+=o[0],o[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const Uq=/\b\B/,NL="[a-zA-Z]\\w*",_x="[a-zA-Z_]\\w*",AL="\\b\\d+(\\.\\d+)?",CL="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",IL="\\b(0b[01]+)",$q="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Hq=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=ao(t,/.*\b/,e.binary,/\b.*/)),Ps({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Wu={begin:"\\\\[\\s\\S]",relevance:0},zq={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Wu]},Vq={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Wu]},Kq={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Rm=function(e,t,n={}){const r=Ps({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=wx("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:ao(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Yq=Rm("//","$"),Wq=Rm("/\\*","\\*/"),qq=Rm("#","$"),Gq={scope:"number",begin:AL,relevance:0},Xq={scope:"number",begin:CL,relevance:0},Qq={scope:"number",begin:IL,relevance:0},Zq={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Wu,{begin:/\[/,end:/\]/,relevance:0,contains:[Wu]}]},Jq={scope:"title",begin:NL,relevance:0},eG={scope:"title",begin:_x,relevance:0},tG={begin:"\\.\\s*"+_x,relevance:0},nG=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var Pf=Object.freeze({__proto__:null,APOS_STRING_MODE:zq,BACKSLASH_ESCAPE:Wu,BINARY_NUMBER_MODE:Qq,BINARY_NUMBER_RE:IL,COMMENT:Rm,C_BLOCK_COMMENT_MODE:Wq,C_LINE_COMMENT_MODE:Yq,C_NUMBER_MODE:Xq,C_NUMBER_RE:CL,END_SAME_AS_BEGIN:nG,HASH_COMMENT_MODE:qq,IDENT_RE:NL,MATCH_NOTHING_RE:Uq,METHOD_GUARD:tG,NUMBER_MODE:Gq,NUMBER_RE:AL,PHRASAL_WORDS_MODE:Kq,QUOTE_STRING_MODE:Vq,REGEXP_MODE:Zq,RE_STARTERS_RE:$q,SHEBANG:Hq,TITLE_MODE:Jq,UNDERSCORE_IDENT_RE:_x,UNDERSCORE_TITLE_MODE:eG});function rG(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function iG(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function sG(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=rG,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function aG(e,t){Array.isArray(e.illegal)&&(e.illegal=wx(...e.illegal))}function oG(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function lG(e,t){e.relevance===void 0&&(e.relevance=1)}const cG=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=ao(n.beforeMatch,kL(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},uG=["of","and","for","in","not","or","if","then","parent","list","value"],dG="keyword";function RL(e,t,n=dG){const r=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(s){Object.assign(r,RL(e[s],t,s))}),r;function i(s,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const l=o.split("|");r[l[0]]=[s,fG(l[0],l[1])]})}}function fG(e,t){return t?Number(t):hG(e)?0:1}function hG(e){return uG.includes(e.toLowerCase())}const Sk={},Da=e=>{console.error(e)},Nk=(e,...t)=>{console.log(`WARN: ${e}`,...t)},bo=(e,t)=>{Sk[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Sk[`${e}/${t}`]=!0)},Ap=new Error;function OL(e,t,{key:n}){let r=0;const i=e[n],s={},a={};for(let o=1;o<=t.length;o++)a[o+r]=i[o],s[o+r]=!0,r+=SL(t[o-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function pG(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Da("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ap;if(typeof e.beginScope!="object"||e.beginScope===null)throw Da("beginScope must be object"),Ap;OL(e,e.begin,{key:"beginScope"}),e.begin=vx(e.begin,{joinWith:""})}}function mG(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Da("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ap;if(typeof e.endScope!="object"||e.endScope===null)throw Da("endScope must be object"),Ap;OL(e,e.end,{key:"endScope"}),e.end=vx(e.end,{joinWith:""})}}function gG(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function yG(e){gG(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),pG(e),mG(e)}function bG(e){function t(a,o){return new RegExp(Yu(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=SL(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(l=>l[1]);this.matcherRe=t(vx(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(o);if(!l)return null;const u=l.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return l.splice(0,u),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const l=new n;return this.rules.slice(o).forEach(([u,d])=>l.addRule(u,d)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let u=l.exec(o);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(o)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const o=new r;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function s(a,o){const l=a;if(a.isCompiled)return l;[iG,oG,yG,cG].forEach(d=>d(a,o)),e.compilerExtensions.forEach(d=>d(a,o)),a.__beforeBegin=null,[sG,aG,lG].forEach(d=>d(a,o)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=RL(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(u,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=Yu(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return EG(d==="self"?a:d)})),a.contains.forEach(function(d){s(d,l)}),a.starts&&s(a.starts,o),l.matcher=i(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Ps(e.classNameAliases||{}),s(e)}function LL(e){return e?e.endsWithParent||LL(e.starts):!1}function EG(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Ps(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:LL(e)?Ps(e,{starts:e.starts?Ps(e.starts):null}):Object.isFrozen(e)?Ps(e):e}var xG="11.11.1";class wG extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const E0=TL,Ak=Ps,Ck=Symbol("nomatch"),vG=7,ML=function(e){const t=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Mq};function l(A){return o.noHighlightRe.test(A)}function u(A){let L=A.className+" ";L+=A.parentNode?A.parentNode.className:"";const O=o.languageDetectRe.exec(L);if(O){const j=S(O[1]);return j||(Nk(s.replace("{}",O[1])),Nk("Falling back to no-highlight mode for this block.",A)),j?O[1]:"no-highlight"}return L.split(/\s+/).find(j=>l(j)||S(j))}function d(A,L,O){let j="",N="";typeof L=="object"?(j=A,O=L.ignoreIllegals,N=L.language):(bo("10.7.0","highlight(lang, code, ...args) has been deprecated."),bo("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),N=A,j=L),O===void 0&&(O=!0);const H={code:j,language:N};P("before:highlight",H);const V=H.result?H.result:f(H.language,H.code,O);return V.code=H.code,P("after:highlight",V),V}function f(A,L,O,j){const N=Object.create(null);function H(K,X){return K.keywords[X]}function V(){if(!_e.keywords){Oe.addText(oe);return}let K=0;_e.keywordPatternRe.lastIndex=0;let X=_e.keywordPatternRe.exec(oe),le="";for(;X;){le+=oe.substring(K,X.index);const Se=xe.case_insensitive?X[0].toLowerCase():X[0],Le=H(_e,Se);if(Le){const[ft,qe]=Le;if(Oe.addText(le),le="",N[Se]=(N[Se]||0)+1,N[Se]<=vG&&(kt+=qe),ft.startsWith("_"))le+=X[0];else{const ct=xe.classNameAliases[ft]||ft;J(X[0],ct)}}else le+=X[0];K=_e.keywordPatternRe.lastIndex,X=_e.keywordPatternRe.exec(oe)}le+=oe.substring(K),Oe.addText(le)}function D(){if(oe==="")return;let K=null;if(typeof _e.subLanguage=="string"){if(!t[_e.subLanguage]){Oe.addText(oe);return}K=f(_e.subLanguage,oe,!0,He[_e.subLanguage]),He[_e.subLanguage]=K._top}else K=p(oe,_e.subLanguage.length?_e.subLanguage:null);_e.relevance>0&&(kt+=K.relevance),Oe.__addSublanguage(K._emitter,K.language)}function ne(){_e.subLanguage!=null?D():V(),oe=""}function J(K,X){K!==""&&(Oe.startScope(X),Oe.addText(K),Oe.endScope())}function re(K,X){let le=1;const Se=X.length-1;for(;le<=Se;){if(!K._emit[le]){le++;continue}const Le=xe.classNameAliases[K[le]]||K[le],ft=X[le];Le?J(ft,Le):(oe=ft,V(),oe=""),le++}}function de(K,X){return K.scope&&typeof K.scope=="string"&&Oe.openNode(xe.classNameAliases[K.scope]||K.scope),K.beginScope&&(K.beginScope._wrap?(J(oe,xe.classNameAliases[K.beginScope._wrap]||K.beginScope._wrap),oe=""):K.beginScope._multi&&(re(K.beginScope,X),oe="")),_e=Object.create(K,{parent:{value:_e}}),_e}function G(K,X,le){let Se=Bq(K.endRe,le);if(Se){if(K["on:end"]){const Le=new _k(K);K["on:end"](X,Le),Le.isMatchIgnored&&(Se=!1)}if(Se){for(;K.endsParent&&K.parent;)K=K.parent;return K}}if(K.endsWithParent)return G(K.parent,X,le)}function W(K){return _e.matcher.regexIndex===0?(oe+=K[0],1):(dt=!0,0)}function ae(K){const X=K[0],le=K.rule,Se=new _k(le),Le=[le.__beforeBegin,le["on:begin"]];for(const ft of Le)if(ft&&(ft(K,Se),Se.isMatchIgnored))return W(X);return le.skip?oe+=X:(le.excludeBegin&&(oe+=X),ne(),!le.returnBegin&&!le.excludeBegin&&(oe=X)),de(le,K),le.returnBegin?0:X.length}function he(K){const X=K[0],le=L.substring(K.index),Se=G(_e,K,le);if(!Se)return Ck;const Le=_e;_e.endScope&&_e.endScope._wrap?(ne(),J(X,_e.endScope._wrap)):_e.endScope&&_e.endScope._multi?(ne(),re(_e.endScope,K)):Le.skip?oe+=X:(Le.returnEnd||Le.excludeEnd||(oe+=X),ne(),Le.excludeEnd&&(oe=X));do _e.scope&&Oe.closeNode(),!_e.skip&&!_e.subLanguage&&(kt+=_e.relevance),_e=_e.parent;while(_e!==Se.parent);return Se.starts&&de(Se.starts,K),Le.returnEnd?0:X.length}function Z(){const K=[];for(let X=_e;X!==xe;X=X.parent)X.scope&&K.unshift(X.scope);K.forEach(X=>Oe.openNode(X))}let ce={};function Ie(K,X){const le=X&&X[0];if(oe+=K,le==null)return ne(),0;if(ce.type==="begin"&&X.type==="end"&&ce.index===X.index&&le===""){if(oe+=L.slice(X.index,X.index+1),!i){const Se=new Error(`0 width match regex (${A})`);throw Se.languageName=A,Se.badRule=ce.rule,Se}return 1}if(ce=X,X.type==="begin")return ae(X);if(X.type==="illegal"&&!O){const Se=new Error('Illegal lexeme "'+le+'" for mode "'+(_e.scope||"")+'"');throw Se.mode=_e,Se}else if(X.type==="end"){const Se=he(X);if(Se!==Ck)return Se}if(X.type==="illegal"&&le==="")return oe+=` -`,1;if(St>1e5&&St>X.index*3)throw new Error("potential infinite loop, way more iterations than matches");return oe+=le,le.length}const xe=S(A);if(!xe)throw Da(s.replace("{}",A)),new Error('Unknown language: "'+A+'"');const ge=bG(xe);let De="",_e=j||ge;const He={},Oe=new o.__emitter(o);Z();let oe="",kt=0,ve=0,St=0,dt=!1;try{if(xe.__emitTokens)xe.__emitTokens(L,Oe);else{for(_e.matcher.considerAll();;){St++,dt?dt=!1:_e.matcher.considerAll(),_e.matcher.lastIndex=ve;const K=_e.matcher.exec(L);if(!K)break;const X=L.substring(ve,K.index),le=Ie(X,K);ve=K.index+le}Ie(L.substring(ve))}return Oe.finalize(),De=Oe.toHTML(),{language:A,value:De,relevance:kt,illegal:!1,_emitter:Oe,_top:_e}}catch(K){if(K.message&&K.message.includes("Illegal"))return{language:A,value:E0(L),illegal:!0,relevance:0,_illegalBy:{message:K.message,index:ve,context:L.slice(ve-100,ve+100),mode:K.mode,resultSoFar:De},_emitter:Oe};if(i)return{language:A,value:E0(L),illegal:!1,relevance:0,errorRaised:K,_emitter:Oe,_top:_e};throw K}}function h(A){const L={value:E0(A),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return L._emitter.addText(A),L}function p(A,L){L=L||o.languages||Object.keys(t);const O=h(A),j=L.filter(S).filter(I).map(ne=>f(ne,A,!1));j.unshift(O);const N=j.sort((ne,J)=>{if(ne.relevance!==J.relevance)return J.relevance-ne.relevance;if(ne.language&&J.language){if(S(ne.language).supersetOf===J.language)return 1;if(S(J.language).supersetOf===ne.language)return-1}return 0}),[H,V]=N,D=H;return D.secondBest=V,D}function m(A,L,O){const j=L&&n[L]||O;A.classList.add("hljs"),A.classList.add(`language-${j}`)}function y(A){let L=null;const O=u(A);if(l(O))return;if(P("before:highlightElement",{el:A,language:O}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(o.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),o.throwUnescapedHTML))throw new wG("One of your code blocks includes unescaped HTML.",A.innerHTML);L=A;const j=L.textContent,N=O?d(j,{language:O,ignoreIllegals:!0}):p(j);A.innerHTML=N.value,A.dataset.highlighted="yes",m(A,O,N.language),A.result={language:N.language,re:N.relevance,relevance:N.relevance},N.secondBest&&(A.secondBest={language:N.secondBest.language,relevance:N.secondBest.relevance}),P("after:highlightElement",{el:A,result:N,text:j})}function w(A){o=Ak(o,A)}const g=()=>{_(),bo("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){_(),bo("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function _(){function A(){_()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",A,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(y)}function k(A,L){let O=null;try{O=L(e)}catch(j){if(Da("Language definition for '{}' could not be registered.".replace("{}",A)),i)Da(j);else throw j;O=a}O.name||(O.name=A),t[A]=O,O.rawDefinition=L.bind(null,e),O.aliases&&R(O.aliases,{languageName:A})}function T(A){delete t[A];for(const L of Object.keys(n))n[L]===A&&delete n[L]}function C(){return Object.keys(t)}function S(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function R(A,{languageName:L}){typeof A=="string"&&(A=[A]),A.forEach(O=>{n[O.toLowerCase()]=L})}function I(A){const L=S(A);return L&&!L.disableAutodetect}function M(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=L=>{A["before:highlightBlock"](Object.assign({block:L.el},L))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=L=>{A["after:highlightBlock"](Object.assign({block:L.el},L))})}function B(A){M(A),r.push(A)}function Y(A){const L=r.indexOf(A);L!==-1&&r.splice(L,1)}function P(A,L){const O=A;r.forEach(function(j){j[O]&&j[O](L)})}function U(A){return bo("10.7.0","highlightBlock will be removed entirely in v12.0"),bo("10.7.0","Please use highlightElement now."),y(A)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:_,highlightElement:y,highlightBlock:U,configure:w,initHighlighting:g,initHighlightingOnLoad:E,registerLanguage:k,unregisterLanguage:T,listLanguages:C,getLanguage:S,registerAliases:R,autoDetection:I,inherit:Ak,addPlugin:B,removePlugin:Y}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=xG,e.regex={concat:ao,lookahead:kL,either:wx,optional:Pq,anyNumberOfTimes:Dq};for(const A in Pf)typeof Pf[A]=="object"&&_L(Pf[A]);return Object.assign(e,Pf),e},Tl=ML({});Tl.newInstance=()=>ML({});var _G=Tl;Tl.HighlightJS=Tl;Tl.default=Tl;const _r=cd(_G),Ik={},TG="hljs-";function kG(e){const t=_r.newInstance();return e&&s(e),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:a,registered:o};function n(l,u,d){const f=d||Ik,h=typeof f.prefix=="string"?f.prefix:TG;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:SG,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,y=m.data;return y.language=p.language,y.relevance=p.relevance,m}function r(l,u){const f=(u||Ik).subset||i();let h=-1,p=0,m;for(;++hp&&(p=w.data.relevance,m=w)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return t.listLanguages()}function s(l,u){if(typeof l=="string")t.registerLanguage(l,u);else{let d;for(d in l)Object.hasOwn(l,d)&&t.registerLanguage(d,l[d])}}function a(l,u){if(typeof l=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const f=l[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function o(l){return!!t.getLanguage(l)}}class SG{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(a,o){return o?a+"_".repeat(o):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const NG={};function Rk(e){const t=e||NG,n=t.aliases,r=t.detect||!1,i=t.languages||Iq,s=t.plainText,a=t.prefix,o=t.subset;let l="hljs";const u=kG(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");l=d===-1?a:a.slice(0,d)}return function(d,f){Im(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const y=AG(h);if(y===!1||!y&&!r||y&&s&&s.includes(y))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(l)||h.properties.className.unshift(l);const w=dW(h,{whitespace:"pre"});let g;try{g=y?u.highlight(y,w,{prefix:a}):u.highlightAuto(w,{prefix:a,subset:o})}catch(E){const b=E;if(y&&/Unknown language/.test(b.message)){f.message("Cannot highlight as `"+y+"`, it’s not registered",{ancestors:[m,h],cause:b,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw b}!y&&g.data&&g.data.language&&h.properties.className.push("language-"+g.data.language),g.children.length>0&&(h.children=g.children)})}}function AG(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Om:case DL:return n(a,i);case ou:{const o=n([],i);for(const l of a)o.push(r(l));return o}case Cp:{const o=n({},i);for(const[l,u]of a)o[r(l)]=r(u);return o}case Tx:return n(new Date(a),i);case kx:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case Sx:{const o=n(new Map,i);for(const[l,u]of a)o.set(r(l),r(u));return o}case Nx:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case PL:{const{name:o,message:l}=a;return n(new Ok[o](l),i)}case jL:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new Ok[s](a),i)};return r},Lk=e=>CG(new Map,e)(0),Eo="",{toString:IG}={},{keys:RG}=Object,wc=e=>{const t=typeof e;if(t!=="object"||!e)return[Om,t];const n=IG.call(e).slice(8,-1);switch(n){case"Array":return[ou,Eo];case"Object":return[Cp,Eo];case"Date":return[Tx,Eo];case"RegExp":return[kx,Eo];case"Map":return[Sx,Eo];case"Set":return[Nx,Eo];case"DataView":return[ou,n]}return n.includes("Array")?[ou,n]:n.includes("Error")?[PL,n]:[Cp,n]},jf=([e,t])=>e===Om&&(t==="function"||t==="symbol"),OG=(e,t,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=wc(a);switch(o){case Om:{let d=a;switch(l){case"bigint":o=jL,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([DL],a)}return i([o,d],a)}case ou:{if(l){let h=a;return l==="DataView"?h=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(a)),i([l,[...h]],a)}const d=[],f=i([o,d],a);for(const h of a)d.push(s(h));return f}case Cp:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const d=[],f=i([o,d],a);for(const h of RG(a))(e||!jf(wc(a[h])))&&d.push([s(h),s(a[h])]);return f}case Tx:return i([o,a.toISOString()],a);case kx:{const{source:d,flags:f}=a;return i([o,{source:d,flags:f}],a)}case Sx:{const d=[],f=i([o,d],a);for(const[h,p]of a)(e||!(jf(wc(h))||jf(wc(p))))&&d.push([s(h),s(p)]);return f}case Nx:{const d=[],f=i([o,d],a);for(const h of a)(e||!jf(wc(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([o,{name:l,message:u}],a)};return s},Mk=(e,{json:t,lossy:n}={})=>{const r=[];return OG(!(t||n),!!t,new Map,r)(e),r},Dk=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Lk(Mk(e,t)):structuredClone(e):(e,t)=>Lk(Mk(e,t));let Nd=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Nd.prototype.normal={};Nd.prototype.property={};Nd.prototype.space=void 0;function BL(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Nd(n,r,t)}function qu(e){return e.toLowerCase()}class kr{constructor(t,n){this.attribute=n,this.property=t}}kr.prototype.attribute="";kr.prototype.booleanish=!1;kr.prototype.boolean=!1;kr.prototype.commaOrSpaceSeparated=!1;kr.prototype.commaSeparated=!1;kr.prototype.defined=!1;kr.prototype.mustUseProperty=!1;kr.prototype.number=!1;kr.prototype.overloadedBoolean=!1;kr.prototype.property="";kr.prototype.spaceSeparated=!1;kr.prototype.space=void 0;let LG=0;const tt=oo(),wn=oo(),P1=oo(),Ee=oo(),jt=oo(),sl=oo(),Rr=oo();function oo(){return 2**++LG}const j1=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:wn,commaOrSpaceSeparated:Rr,commaSeparated:sl,number:Ee,overloadedBoolean:P1,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),x0=Object.keys(j1);class Ax extends kr{constructor(t,n,r,i){let s=-1;if(super(t,n),Pk(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&jG.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(jk,FG);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!jk.test(s)){let a=s.replace(PG,BG);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ax}return new i(r,t)}function BG(e){return"-"+e.toLowerCase()}function FG(e){return e.charAt(1).toUpperCase()}const Lm=BL([FL,MG,HL,zL,VL],"html"),Ad=BL([FL,DG,HL,zL,VL],"svg");function Bk(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function UG(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Fk=/[#.]/g;function $G(e,t){const n=e||"",r={};let i=0,s,a;for(;i-1&&s<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const l=Hk(t,n[a-1]);o=l===-1?t.length+1:l+1,n[a]=o}if(o>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length1?n[s.line-2]:0)+s.column-1;if(a=55296&&e<=57343}function hX(e){return e>=56320&&e<=57343}function pX(e,t){return(e-55296)*1024+9216+t}function QL(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ZL(e){return e>=64976&&e<=65007||fX.has(e)}var ie;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(ie||(ie={}));const mX=65536;class gX{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=mX,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:i,offset:s}=this,a=i+n,o=s+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(hX(n))return this.pos++,this._addGap(),pX(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,F.EOF;return this._err(ie.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,F.EOF;const r=this.html.charCodeAt(n);return r===F.CARRIAGE_RETURN?F.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,F.EOF;let t=this.html.charCodeAt(this.pos);return t===F.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,F.LINE_FEED):t===F.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,XL(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===F.LINE_FEED||t===F.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){QL(t)?this._err(ie.controlCharacterInInputStream):ZL(t)&&this._err(ie.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const yX=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),bX=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function EX(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=bX.get(e))!==null&&t!==void 0?t:e}var jn;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(jn||(jn={}));const xX=32;var js;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(js||(js={}));function F1(e){return e>=jn.ZERO&&e<=jn.NINE}function wX(e){return e>=jn.UPPER_A&&e<=jn.UPPER_F||e>=jn.LOWER_A&&e<=jn.LOWER_F}function vX(e){return e>=jn.UPPER_A&&e<=jn.UPPER_Z||e>=jn.LOWER_A&&e<=jn.LOWER_Z||F1(e)}function _X(e){return e===jn.EQUALS||vX(e)}var Dn;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Dn||(Dn={}));var Xi;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Xi||(Xi={}));class TX{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Dn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Xi.Strict}startEntity(t){this.decodeMode=t,this.state=Dn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Dn.EntityStart:return t.charCodeAt(n)===jn.NUM?(this.state=Dn.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Dn.NamedEntity,this.stateNamedEntity(t,n));case Dn.NumericStart:return this.stateNumericStart(t,n);case Dn.NumericDecimal:return this.stateNumericDecimal(t,n);case Dn.NumericHex:return this.stateNumericHex(t,n);case Dn.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|xX)===jn.LOWER_X?(this.state=Dn.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Dn.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(t.substr(n,s),i),this.consumed+=s}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,s!==0){if(a===jn.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Xi.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,i=(r[n]&js.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~js.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case Dn.NamedEntity:return this.result!==0&&(this.decodeMode!==Xi.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Dn.NumericDecimal:return this.emitNumericEntity(0,2);case Dn.NumericHex:return this.emitNumericEntity(0,3);case Dn.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Dn.EntityStart:return 0}}}function kX(e,t,n,r){const i=(t&js.BRANCH_LENGTH)>>7,s=t&js.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:e[n+l]-1}let a=n,o=a+i-1;for(;a<=o;){const l=a+o>>>1,u=e[l];if(ur)o=l-1;else return e[l+i]}return-1}var fe;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(fe||(fe={}));var Pa;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Pa||(Pa={}));var qr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(qr||(qr={}));var Q;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(Q||(Q={}));var x;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(x||(x={}));const SX=new Map([[Q.A,x.A],[Q.ADDRESS,x.ADDRESS],[Q.ANNOTATION_XML,x.ANNOTATION_XML],[Q.APPLET,x.APPLET],[Q.AREA,x.AREA],[Q.ARTICLE,x.ARTICLE],[Q.ASIDE,x.ASIDE],[Q.B,x.B],[Q.BASE,x.BASE],[Q.BASEFONT,x.BASEFONT],[Q.BGSOUND,x.BGSOUND],[Q.BIG,x.BIG],[Q.BLOCKQUOTE,x.BLOCKQUOTE],[Q.BODY,x.BODY],[Q.BR,x.BR],[Q.BUTTON,x.BUTTON],[Q.CAPTION,x.CAPTION],[Q.CENTER,x.CENTER],[Q.CODE,x.CODE],[Q.COL,x.COL],[Q.COLGROUP,x.COLGROUP],[Q.DD,x.DD],[Q.DESC,x.DESC],[Q.DETAILS,x.DETAILS],[Q.DIALOG,x.DIALOG],[Q.DIR,x.DIR],[Q.DIV,x.DIV],[Q.DL,x.DL],[Q.DT,x.DT],[Q.EM,x.EM],[Q.EMBED,x.EMBED],[Q.FIELDSET,x.FIELDSET],[Q.FIGCAPTION,x.FIGCAPTION],[Q.FIGURE,x.FIGURE],[Q.FONT,x.FONT],[Q.FOOTER,x.FOOTER],[Q.FOREIGN_OBJECT,x.FOREIGN_OBJECT],[Q.FORM,x.FORM],[Q.FRAME,x.FRAME],[Q.FRAMESET,x.FRAMESET],[Q.H1,x.H1],[Q.H2,x.H2],[Q.H3,x.H3],[Q.H4,x.H4],[Q.H5,x.H5],[Q.H6,x.H6],[Q.HEAD,x.HEAD],[Q.HEADER,x.HEADER],[Q.HGROUP,x.HGROUP],[Q.HR,x.HR],[Q.HTML,x.HTML],[Q.I,x.I],[Q.IMG,x.IMG],[Q.IMAGE,x.IMAGE],[Q.INPUT,x.INPUT],[Q.IFRAME,x.IFRAME],[Q.KEYGEN,x.KEYGEN],[Q.LABEL,x.LABEL],[Q.LI,x.LI],[Q.LINK,x.LINK],[Q.LISTING,x.LISTING],[Q.MAIN,x.MAIN],[Q.MALIGNMARK,x.MALIGNMARK],[Q.MARQUEE,x.MARQUEE],[Q.MATH,x.MATH],[Q.MENU,x.MENU],[Q.META,x.META],[Q.MGLYPH,x.MGLYPH],[Q.MI,x.MI],[Q.MO,x.MO],[Q.MN,x.MN],[Q.MS,x.MS],[Q.MTEXT,x.MTEXT],[Q.NAV,x.NAV],[Q.NOBR,x.NOBR],[Q.NOFRAMES,x.NOFRAMES],[Q.NOEMBED,x.NOEMBED],[Q.NOSCRIPT,x.NOSCRIPT],[Q.OBJECT,x.OBJECT],[Q.OL,x.OL],[Q.OPTGROUP,x.OPTGROUP],[Q.OPTION,x.OPTION],[Q.P,x.P],[Q.PARAM,x.PARAM],[Q.PLAINTEXT,x.PLAINTEXT],[Q.PRE,x.PRE],[Q.RB,x.RB],[Q.RP,x.RP],[Q.RT,x.RT],[Q.RTC,x.RTC],[Q.RUBY,x.RUBY],[Q.S,x.S],[Q.SCRIPT,x.SCRIPT],[Q.SEARCH,x.SEARCH],[Q.SECTION,x.SECTION],[Q.SELECT,x.SELECT],[Q.SOURCE,x.SOURCE],[Q.SMALL,x.SMALL],[Q.SPAN,x.SPAN],[Q.STRIKE,x.STRIKE],[Q.STRONG,x.STRONG],[Q.STYLE,x.STYLE],[Q.SUB,x.SUB],[Q.SUMMARY,x.SUMMARY],[Q.SUP,x.SUP],[Q.TABLE,x.TABLE],[Q.TBODY,x.TBODY],[Q.TEMPLATE,x.TEMPLATE],[Q.TEXTAREA,x.TEXTAREA],[Q.TFOOT,x.TFOOT],[Q.TD,x.TD],[Q.TH,x.TH],[Q.THEAD,x.THEAD],[Q.TITLE,x.TITLE],[Q.TR,x.TR],[Q.TRACK,x.TRACK],[Q.TT,x.TT],[Q.U,x.U],[Q.UL,x.UL],[Q.SVG,x.SVG],[Q.VAR,x.VAR],[Q.WBR,x.WBR],[Q.XMP,x.XMP]]);function Gl(e){var t;return(t=SX.get(e))!==null&&t!==void 0?t:x.UNKNOWN}const pe=x,NX={[fe.HTML]:new Set([pe.ADDRESS,pe.APPLET,pe.AREA,pe.ARTICLE,pe.ASIDE,pe.BASE,pe.BASEFONT,pe.BGSOUND,pe.BLOCKQUOTE,pe.BODY,pe.BR,pe.BUTTON,pe.CAPTION,pe.CENTER,pe.COL,pe.COLGROUP,pe.DD,pe.DETAILS,pe.DIR,pe.DIV,pe.DL,pe.DT,pe.EMBED,pe.FIELDSET,pe.FIGCAPTION,pe.FIGURE,pe.FOOTER,pe.FORM,pe.FRAME,pe.FRAMESET,pe.H1,pe.H2,pe.H3,pe.H4,pe.H5,pe.H6,pe.HEAD,pe.HEADER,pe.HGROUP,pe.HR,pe.HTML,pe.IFRAME,pe.IMG,pe.INPUT,pe.LI,pe.LINK,pe.LISTING,pe.MAIN,pe.MARQUEE,pe.MENU,pe.META,pe.NAV,pe.NOEMBED,pe.NOFRAMES,pe.NOSCRIPT,pe.OBJECT,pe.OL,pe.P,pe.PARAM,pe.PLAINTEXT,pe.PRE,pe.SCRIPT,pe.SECTION,pe.SELECT,pe.SOURCE,pe.STYLE,pe.SUMMARY,pe.TABLE,pe.TBODY,pe.TD,pe.TEMPLATE,pe.TEXTAREA,pe.TFOOT,pe.TH,pe.THEAD,pe.TITLE,pe.TR,pe.TRACK,pe.UL,pe.WBR,pe.XMP]),[fe.MATHML]:new Set([pe.MI,pe.MO,pe.MN,pe.MS,pe.MTEXT,pe.ANNOTATION_XML]),[fe.SVG]:new Set([pe.TITLE,pe.FOREIGN_OBJECT,pe.DESC]),[fe.XLINK]:new Set,[fe.XML]:new Set,[fe.XMLNS]:new Set},U1=new Set([pe.H1,pe.H2,pe.H3,pe.H4,pe.H5,pe.H6]);Q.STYLE,Q.SCRIPT,Q.XMP,Q.IFRAME,Q.NOEMBED,Q.NOFRAMES,Q.PLAINTEXT;var $;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})($||($={}));const pn={DATA:$.DATA,RCDATA:$.RCDATA,RAWTEXT:$.RAWTEXT,SCRIPT_DATA:$.SCRIPT_DATA,PLAINTEXT:$.PLAINTEXT,CDATA_SECTION:$.CDATA_SECTION};function AX(e){return e>=F.DIGIT_0&&e<=F.DIGIT_9}function Bc(e){return e>=F.LATIN_CAPITAL_A&&e<=F.LATIN_CAPITAL_Z}function CX(e){return e>=F.LATIN_SMALL_A&&e<=F.LATIN_SMALL_Z}function ks(e){return CX(e)||Bc(e)}function Kk(e){return ks(e)||AX(e)}function Bf(e){return e+32}function eM(e){return e===F.SPACE||e===F.LINE_FEED||e===F.TABULATION||e===F.FORM_FEED}function Yk(e){return eM(e)||e===F.SOLIDUS||e===F.GREATER_THAN_SIGN}function IX(e){return e===F.NULL?ie.nullCharacterReference:e>1114111?ie.characterReferenceOutsideUnicodeRange:XL(e)?ie.surrogateCharacterReference:ZL(e)?ie.noncharacterCharacterReference:QL(e)||e===F.CARRIAGE_RETURN?ie.controlCharacterReference:null}class RX{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=$.DATA,this.returnState=$.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new gX(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new TX(yX,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ie.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(ie.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=IX(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(ie.endTagWithAttributes),t.selfClosing&&this._err(ie.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case it.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case it.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case it.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:it.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=eM(t)?it.WHITESPACE_CHARACTER:t===F.NULL?it.NULL_CHARACTER:it.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(it.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=$.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Xi.Attribute:Xi.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===$.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===$.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===$.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case $.DATA:{this._stateData(t);break}case $.RCDATA:{this._stateRcdata(t);break}case $.RAWTEXT:{this._stateRawtext(t);break}case $.SCRIPT_DATA:{this._stateScriptData(t);break}case $.PLAINTEXT:{this._statePlaintext(t);break}case $.TAG_OPEN:{this._stateTagOpen(t);break}case $.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case $.TAG_NAME:{this._stateTagName(t);break}case $.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case $.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case $.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case $.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case $.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case $.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case $.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case $.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case $.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case $.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case $.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case $.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case $.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case $.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case $.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case $.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case $.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case $.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case $.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case $.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case $.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case $.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case $.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case $.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case $.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case $.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case $.BOGUS_COMMENT:{this._stateBogusComment(t);break}case $.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case $.COMMENT_START:{this._stateCommentStart(t);break}case $.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case $.COMMENT:{this._stateComment(t);break}case $.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case $.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case $.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case $.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case $.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case $.COMMENT_END:{this._stateCommentEnd(t);break}case $.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case $.DOCTYPE:{this._stateDoctype(t);break}case $.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case $.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case $.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case $.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case $.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case $.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case $.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case $.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case $.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case $.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case $.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case $.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case $.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case $.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case $.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case $.CDATA_SECTION:{this._stateCdataSection(t);break}case $.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case $.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case $.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case $.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case F.LESS_THAN_SIGN:{this.state=$.TAG_OPEN;break}case F.AMPERSAND:{this._startCharacterReference();break}case F.NULL:{this._err(ie.unexpectedNullCharacter),this._emitCodePoint(t);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case F.AMPERSAND:{this._startCharacterReference();break}case F.LESS_THAN_SIGN:{this.state=$.RCDATA_LESS_THAN_SIGN;break}case F.NULL:{this._err(ie.unexpectedNullCharacter),this._emitChars(Wt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case F.LESS_THAN_SIGN:{this.state=$.RAWTEXT_LESS_THAN_SIGN;break}case F.NULL:{this._err(ie.unexpectedNullCharacter),this._emitChars(Wt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case F.LESS_THAN_SIGN:{this.state=$.SCRIPT_DATA_LESS_THAN_SIGN;break}case F.NULL:{this._err(ie.unexpectedNullCharacter),this._emitChars(Wt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case F.NULL:{this._err(ie.unexpectedNullCharacter),this._emitChars(Wt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(ks(t))this._createStartTagToken(),this.state=$.TAG_NAME,this._stateTagName(t);else switch(t){case F.EXCLAMATION_MARK:{this.state=$.MARKUP_DECLARATION_OPEN;break}case F.SOLIDUS:{this.state=$.END_TAG_OPEN;break}case F.QUESTION_MARK:{this._err(ie.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=$.BOGUS_COMMENT,this._stateBogusComment(t);break}case F.EOF:{this._err(ie.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ie.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=$.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(ks(t))this._createEndTagToken(),this.state=$.TAG_NAME,this._stateTagName(t);else switch(t){case F.GREATER_THAN_SIGN:{this._err(ie.missingEndTagName),this.state=$.DATA;break}case F.EOF:{this._err(ie.eofBeforeTagName),this._emitChars("");break}case F.NULL:{this._err(ie.unexpectedNullCharacter),this.state=$.SCRIPT_DATA_ESCAPED,this._emitChars(Wt);break}case F.EOF:{this._err(ie.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=$.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===F.SOLIDUS?this.state=$.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:ks(t)?(this._emitChars("<"),this.state=$.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=$.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){ks(t)?(this.state=$.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case F.NULL:{this._err(ie.unexpectedNullCharacter),this.state=$.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Wt);break}case F.EOF:{this._err(ie.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=$.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===F.SOLIDUS?(this.state=$.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=$.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(mr.SCRIPT,!1)&&Yk(this.preprocessor.peek(mr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==fe.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(PX,fe.HTML)}clearBackToTableBodyContext(){this.clearBackTo(DX,fe.HTML)}clearBackToTableRowContext(){this.clearBackTo(MX,fe.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===x.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===x.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case fe.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case fe.SVG:{if(Gk.has(i))return!1;break}case fe.MATHML:{if(qk.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Ip)}hasInListItemScope(t){return this.hasInDynamicScope(t,OX)}hasInButtonScope(t){return this.hasInDynamicScope(t,LX)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case fe.HTML:{if(U1.has(n))return!0;if(Ip.has(n))return!1;break}case fe.SVG:{if(Gk.has(n))return!1;break}case fe.MATHML:{if(qk.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===fe.HTML)switch(this.tagIDs[n]){case t:return!0;case x.TABLE:case x.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===fe.HTML)switch(this.tagIDs[t]){case x.TBODY:case x.THEAD:case x.TFOOT:return!0;case x.TABLE:case x.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===fe.HTML)switch(this.tagIDs[n]){case t:return!0;case x.OPTION:case x.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&tM.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Wk.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Wk.has(this.currentTagId);)this.pop()}}const w0=3;var Ri;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ri||(Ri={}));const Xk={type:Ri.Marker};class FX{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o[a.name,a.value]));let s=0;for(let a=0;ai.get(l.name)===l.value)&&(s+=1,s>=w0&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(Xk)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ri.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Ri.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(Xk);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===Ri.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Ri.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Ri.Element&&n.element===t)}}const Ss={createDocument(){return{nodeName:"#document",mode:qr.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const i=e.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};Ss.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(Ss.isTextNode(n)){n.value+=t;return}}Ss.appendChild(e,Ss.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Ss.isTextNode(r)?r.value+=t:Ss.insertBefore(e,Ss.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function KX(e){return e.name===nM&&e.publicId===null&&(e.systemId===null||e.systemId===UX)}function YX(e){if(e.name!==nM)return qr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===$X)return qr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),zX.has(n))return qr.QUIRKS;let r=t===null?HX:rM;if(Qk(n,r))return qr.QUIRKS;if(r=t===null?iM:VX,Qk(n,r))return qr.LIMITED_QUIRKS}return qr.NO_QUIRKS}const Zk={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},WX="definitionurl",qX="definitionURL",GX=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),XX=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:fe.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:fe.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:fe.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:fe.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:fe.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:fe.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:fe.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:fe.XML}],["xml:space",{prefix:"xml",name:"space",namespace:fe.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:fe.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:fe.XMLNS}]]),QX=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),ZX=new Set([x.B,x.BIG,x.BLOCKQUOTE,x.BODY,x.BR,x.CENTER,x.CODE,x.DD,x.DIV,x.DL,x.DT,x.EM,x.EMBED,x.H1,x.H2,x.H3,x.H4,x.H5,x.H6,x.HEAD,x.HR,x.I,x.IMG,x.LI,x.LISTING,x.MENU,x.META,x.NOBR,x.OL,x.P,x.PRE,x.RUBY,x.S,x.SMALL,x.SPAN,x.STRONG,x.STRIKE,x.SUB,x.SUP,x.TABLE,x.TT,x.U,x.UL,x.VAR]);function JX(e){const t=e.tagID;return t===x.FONT&&e.attrs.some(({name:r})=>r===Pa.COLOR||r===Pa.SIZE||r===Pa.FACE)||ZX.has(t)}function sM(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let s,a;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,this._setContextModes(s,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===fe.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,fe.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=z.TEXT}switchToPlaintextParsing(){this.insertionMode=z.TEXT,this.originalInsertionMode=z.IN_BODY,this.tokenizer.state=pn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Q.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==fe.HTML))switch(this.fragmentContextID){case x.TITLE:case x.TEXTAREA:{this.tokenizer.state=pn.RCDATA;break}case x.STYLE:case x.XMP:case x.IFRAME:case x.NOEMBED:case x.NOFRAMES:case x.NOSCRIPT:{this.tokenizer.state=pn.RAWTEXT;break}case x.SCRIPT:{this.tokenizer.state=pn.SCRIPT_DATA;break}case x.PLAINTEXT:{this.tokenizer.state=pn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,fe.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,fe.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Q.HTML,fe.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,x.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,a=i[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:l,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:l,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(t),s=n.type===it.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,s)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===x.SVG&&this.treeAdapter.getTagName(n)===Q.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===fe.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===x.MGLYPH||t.tagID===x.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,fe.HTML)}_processToken(t){switch(t.type){case it.CHARACTER:{this.onCharacter(t);break}case it.NULL_CHARACTER:{this.onNullCharacter(t);break}case it.COMMENT:{this.onComment(t);break}case it.DOCTYPE:{this.onDoctype(t);break}case it.START_TAG:{this._processStartTag(t);break}case it.END_TAG:{this.onEndTag(t);break}case it.EOF:{this.onEof(t);break}case it.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return rQ(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===Ri.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=z.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(x.P),this.openElements.popUntilTagNamePopped(x.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case x.TR:{this.insertionMode=z.IN_ROW;return}case x.TBODY:case x.THEAD:case x.TFOOT:{this.insertionMode=z.IN_TABLE_BODY;return}case x.CAPTION:{this.insertionMode=z.IN_CAPTION;return}case x.COLGROUP:{this.insertionMode=z.IN_COLUMN_GROUP;return}case x.TABLE:{this.insertionMode=z.IN_TABLE;return}case x.BODY:{this.insertionMode=z.IN_BODY;return}case x.FRAMESET:{this.insertionMode=z.IN_FRAMESET;return}case x.SELECT:{this._resetInsertionModeForSelect(t);return}case x.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case x.HTML:{this.insertionMode=this.headElement?z.AFTER_HEAD:z.BEFORE_HEAD;return}case x.TD:case x.TH:{if(t>0){this.insertionMode=z.IN_CELL;return}break}case x.HEAD:{if(t>0){this.insertionMode=z.IN_HEAD;return}break}}this.insertionMode=z.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===x.TEMPLATE)break;if(r===x.TABLE){this.insertionMode=z.IN_SELECT_IN_TABLE;return}}this.insertionMode=z.IN_SELECT}_isElementCausesFosterParenting(t){return oM.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case x.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===fe.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case x.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return NX[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){jZ(this,t);return}switch(this.insertionMode){case z.INITIAL:{vc(this,t);break}case z.BEFORE_HTML:{lu(this,t);break}case z.BEFORE_HEAD:{cu(this,t);break}case z.IN_HEAD:{uu(this,t);break}case z.IN_HEAD_NO_SCRIPT:{du(this,t);break}case z.AFTER_HEAD:{fu(this,t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:{cM(this,t);break}case z.TEXT:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{v0(this,t);break}case z.IN_TABLE_TEXT:{mM(this,t);break}case z.IN_COLUMN_GROUP:{Rp(this,t);break}case z.AFTER_BODY:{Op(this,t);break}case z.AFTER_AFTER_BODY:{Th(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){PZ(this,t);return}switch(this.insertionMode){case z.INITIAL:{vc(this,t);break}case z.BEFORE_HTML:{lu(this,t);break}case z.BEFORE_HEAD:{cu(this,t);break}case z.IN_HEAD:{uu(this,t);break}case z.IN_HEAD_NO_SCRIPT:{du(this,t);break}case z.AFTER_HEAD:{fu(this,t);break}case z.TEXT:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{v0(this,t);break}case z.IN_COLUMN_GROUP:{Rp(this,t);break}case z.AFTER_BODY:{Op(this,t);break}case z.AFTER_AFTER_BODY:{Th(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){$1(this,t);return}switch(this.insertionMode){case z.INITIAL:case z.BEFORE_HTML:case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:case z.IN_BODY:case z.IN_TABLE:case z.IN_CAPTION:case z.IN_COLUMN_GROUP:case z.IN_TABLE_BODY:case z.IN_ROW:case z.IN_CELL:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:case z.IN_TEMPLATE:case z.IN_FRAMESET:case z.AFTER_FRAMESET:{$1(this,t);break}case z.IN_TABLE_TEXT:{_c(this,t);break}case z.AFTER_BODY:{pQ(this,t);break}case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{mQ(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case z.INITIAL:{gQ(this,t);break}case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:{this._err(t,ie.misplacedDoctype);break}case z.IN_TABLE_TEXT:{_c(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ie.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?BZ(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{vc(this,t);break}case z.BEFORE_HTML:{yQ(this,t);break}case z.BEFORE_HEAD:{EQ(this,t);break}case z.IN_HEAD:{vi(this,t);break}case z.IN_HEAD_NO_SCRIPT:{vQ(this,t);break}case z.AFTER_HEAD:{TQ(this,t);break}case z.IN_BODY:{nr(this,t);break}case z.IN_TABLE:{kl(this,t);break}case z.IN_TABLE_TEXT:{_c(this,t);break}case z.IN_CAPTION:{xZ(this,t);break}case z.IN_COLUMN_GROUP:{Dx(this,t);break}case z.IN_TABLE_BODY:{Pm(this,t);break}case z.IN_ROW:{jm(this,t);break}case z.IN_CELL:{_Z(this,t);break}case z.IN_SELECT:{bM(this,t);break}case z.IN_SELECT_IN_TABLE:{kZ(this,t);break}case z.IN_TEMPLATE:{NZ(this,t);break}case z.AFTER_BODY:{CZ(this,t);break}case z.IN_FRAMESET:{IZ(this,t);break}case z.AFTER_FRAMESET:{OZ(this,t);break}case z.AFTER_AFTER_BODY:{MZ(this,t);break}case z.AFTER_AFTER_FRAMESET:{DZ(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?FZ(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{vc(this,t);break}case z.BEFORE_HTML:{bQ(this,t);break}case z.BEFORE_HEAD:{xQ(this,t);break}case z.IN_HEAD:{wQ(this,t);break}case z.IN_HEAD_NO_SCRIPT:{_Q(this,t);break}case z.AFTER_HEAD:{kQ(this,t);break}case z.IN_BODY:{Dm(this,t);break}case z.TEXT:{uZ(this,t);break}case z.IN_TABLE:{Gu(this,t);break}case z.IN_TABLE_TEXT:{_c(this,t);break}case z.IN_CAPTION:{wZ(this,t);break}case z.IN_COLUMN_GROUP:{vZ(this,t);break}case z.IN_TABLE_BODY:{H1(this,t);break}case z.IN_ROW:{yM(this,t);break}case z.IN_CELL:{TZ(this,t);break}case z.IN_SELECT:{EM(this,t);break}case z.IN_SELECT_IN_TABLE:{SZ(this,t);break}case z.IN_TEMPLATE:{AZ(this,t);break}case z.AFTER_BODY:{wM(this,t);break}case z.IN_FRAMESET:{RZ(this,t);break}case z.AFTER_FRAMESET:{LZ(this,t);break}case z.AFTER_AFTER_BODY:{Th(this,t);break}}}onEof(t){switch(this.insertionMode){case z.INITIAL:{vc(this,t);break}case z.BEFORE_HTML:{lu(this,t);break}case z.BEFORE_HEAD:{cu(this,t);break}case z.IN_HEAD:{uu(this,t);break}case z.IN_HEAD_NO_SCRIPT:{du(this,t);break}case z.AFTER_HEAD:{fu(this,t);break}case z.IN_BODY:case z.IN_TABLE:case z.IN_CAPTION:case z.IN_COLUMN_GROUP:case z.IN_TABLE_BODY:case z.IN_ROW:case z.IN_CELL:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:{hM(this,t);break}case z.TEXT:{dZ(this,t);break}case z.IN_TABLE_TEXT:{_c(this,t);break}case z.IN_TEMPLATE:{xM(this,t);break}case z.AFTER_BODY:case z.IN_FRAMESET:case z.AFTER_FRAMESET:case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{Mx(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===F.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:case z.TEXT:case z.IN_COLUMN_GROUP:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:case z.IN_FRAMESET:case z.AFTER_FRAMESET:{this._insertCharacters(t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:case z.AFTER_BODY:case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{lM(this,t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{v0(this,t);break}case z.IN_TABLE_TEXT:{pM(this,t);break}}}};function lQ(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):fM(e,t),n}function cQ(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function uQ(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let s=0,a=i;a!==n;s++,a=i){i=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),l=o&&s>=aQ;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=dQ(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function dQ(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function fQ(e,t,n){const r=e.treeAdapter.getTagName(t),i=Gl(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===x.TEMPLATE&&s===fe.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function hQ(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,i.tagID)}function Lx(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(s);a&&!a.endTag&&e._setEndLocation(s,t)}}}}function gQ(e,t){e._setDocumentType(t);const n=t.forceQuirks?qr.QUIRKS:YX(t);KX(t)||e._err(t,ie.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=z.BEFORE_HTML}function vc(e,t){e._err(t,ie.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,qr.QUIRKS),e.insertionMode=z.BEFORE_HTML,e._processToken(t)}function yQ(e,t){t.tagID===x.HTML?(e._insertElement(t,fe.HTML),e.insertionMode=z.BEFORE_HEAD):lu(e,t)}function bQ(e,t){const n=t.tagID;(n===x.HTML||n===x.HEAD||n===x.BODY||n===x.BR)&&lu(e,t)}function lu(e,t){e._insertFakeRootElement(),e.insertionMode=z.BEFORE_HEAD,e._processToken(t)}function EQ(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.HEAD:{e._insertElement(t,fe.HTML),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD;break}default:cu(e,t)}}function xQ(e,t){const n=t.tagID;n===x.HEAD||n===x.BODY||n===x.HTML||n===x.BR?cu(e,t):e._err(t,ie.endTagWithoutMatchingOpenElement)}function cu(e,t){e._insertFakeElement(Q.HEAD,x.HEAD),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD,e._processToken(t)}function vi(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:{e._appendElement(t,fe.HTML),t.ackSelfClosing=!0;break}case x.TITLE:{e._switchToTextParsing(t,pn.RCDATA);break}case x.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,pn.RAWTEXT):(e._insertElement(t,fe.HTML),e.insertionMode=z.IN_HEAD_NO_SCRIPT);break}case x.NOFRAMES:case x.STYLE:{e._switchToTextParsing(t,pn.RAWTEXT);break}case x.SCRIPT:{e._switchToTextParsing(t,pn.SCRIPT_DATA);break}case x.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=z.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(z.IN_TEMPLATE);break}case x.HEAD:{e._err(t,ie.misplacedStartTagForHeadElement);break}default:uu(e,t)}}function wQ(e,t){switch(t.tagID){case x.HEAD:{e.openElements.pop(),e.insertionMode=z.AFTER_HEAD;break}case x.BODY:case x.BR:case x.HTML:{uu(e,t);break}case x.TEMPLATE:{lo(e,t);break}default:e._err(t,ie.endTagWithoutMatchingOpenElement)}}function lo(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==x.TEMPLATE&&e._err(t,ie.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(x.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ie.endTagWithoutMatchingOpenElement)}function uu(e,t){e.openElements.pop(),e.insertionMode=z.AFTER_HEAD,e._processToken(t)}function vQ(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.BASEFONT:case x.BGSOUND:case x.HEAD:case x.LINK:case x.META:case x.NOFRAMES:case x.STYLE:{vi(e,t);break}case x.NOSCRIPT:{e._err(t,ie.nestedNoscriptInHead);break}default:du(e,t)}}function _Q(e,t){switch(t.tagID){case x.NOSCRIPT:{e.openElements.pop(),e.insertionMode=z.IN_HEAD;break}case x.BR:{du(e,t);break}default:e._err(t,ie.endTagWithoutMatchingOpenElement)}}function du(e,t){const n=t.type===it.EOF?ie.openElementsLeftAfterEof:ie.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=z.IN_HEAD,e._processToken(t)}function TQ(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.BODY:{e._insertElement(t,fe.HTML),e.framesetOk=!1,e.insertionMode=z.IN_BODY;break}case x.FRAMESET:{e._insertElement(t,fe.HTML),e.insertionMode=z.IN_FRAMESET;break}case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:case x.NOFRAMES:case x.SCRIPT:case x.STYLE:case x.TEMPLATE:case x.TITLE:{e._err(t,ie.abandonedHeadElementChild),e.openElements.push(e.headElement,x.HEAD),vi(e,t),e.openElements.remove(e.headElement);break}case x.HEAD:{e._err(t,ie.misplacedStartTagForHeadElement);break}default:fu(e,t)}}function kQ(e,t){switch(t.tagID){case x.BODY:case x.HTML:case x.BR:{fu(e,t);break}case x.TEMPLATE:{lo(e,t);break}default:e._err(t,ie.endTagWithoutMatchingOpenElement)}}function fu(e,t){e._insertFakeElement(Q.BODY,x.BODY),e.insertionMode=z.IN_BODY,Mm(e,t)}function Mm(e,t){switch(t.type){case it.CHARACTER:{cM(e,t);break}case it.WHITESPACE_CHARACTER:{lM(e,t);break}case it.COMMENT:{$1(e,t);break}case it.START_TAG:{nr(e,t);break}case it.END_TAG:{Dm(e,t);break}case it.EOF:{hM(e,t);break}}}function lM(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function cM(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function SQ(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function NQ(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function AQ(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_FRAMESET)}function CQ(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML)}function IQ(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&U1.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,fe.HTML)}function RQ(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function OQ(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),n||(e.formElement=e.openElements.current))}function LQ(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const i=e.openElements.tagIDs[r];if(n===x.LI&&i===x.LI||(n===x.DD||n===x.DT)&&(i===x.DD||i===x.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==x.ADDRESS&&i!==x.DIV&&i!==x.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML)}function MQ(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),e.tokenizer.state=pn.PLAINTEXT}function DQ(e,t){e.openElements.hasInScope(x.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(x.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.framesetOk=!1}function PQ(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Q.A);n&&(Lx(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function jQ(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function BQ(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(x.NOBR)&&(Lx(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,fe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function FQ(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function UQ(e,t){e.treeAdapter.getDocumentMode(e.document)!==qr.QUIRKS&&e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),e.framesetOk=!1,e.insertionMode=z.IN_TABLE}function uM(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,fe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function dM(e){const t=JL(e,Pa.TYPE);return t!=null&&t.toLowerCase()===iQ}function $Q(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,fe.HTML),dM(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function HQ(e,t){e._appendElement(t,fe.HTML),t.ackSelfClosing=!0}function zQ(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._appendElement(t,fe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function VQ(e,t){t.tagName=Q.IMG,t.tagID=x.IMG,uM(e,t)}function KQ(e,t){e._insertElement(t,fe.HTML),e.skipNextNewLine=!0,e.tokenizer.state=pn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=z.TEXT}function YQ(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,pn.RAWTEXT)}function WQ(e,t){e.framesetOk=!1,e._switchToTextParsing(t,pn.RAWTEXT)}function tS(e,t){e._switchToTextParsing(t,pn.RAWTEXT)}function qQ(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===z.IN_TABLE||e.insertionMode===z.IN_CAPTION||e.insertionMode===z.IN_TABLE_BODY||e.insertionMode===z.IN_ROW||e.insertionMode===z.IN_CELL?z.IN_SELECT_IN_TABLE:z.IN_SELECT}function GQ(e,t){e.openElements.currentTagId===x.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML)}function XQ(e,t){e.openElements.hasInScope(x.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,fe.HTML)}function QQ(e,t){e.openElements.hasInScope(x.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(x.RTC),e._insertElement(t,fe.HTML)}function ZQ(e,t){e._reconstructActiveFormattingElements(),sM(t),Ox(t),t.selfClosing?e._appendElement(t,fe.MATHML):e._insertElement(t,fe.MATHML),t.ackSelfClosing=!0}function JQ(e,t){e._reconstructActiveFormattingElements(),aM(t),Ox(t),t.selfClosing?e._appendElement(t,fe.SVG):e._insertElement(t,fe.SVG),t.ackSelfClosing=!0}function nS(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML)}function nr(e,t){switch(t.tagID){case x.I:case x.S:case x.B:case x.U:case x.EM:case x.TT:case x.BIG:case x.CODE:case x.FONT:case x.SMALL:case x.STRIKE:case x.STRONG:{jQ(e,t);break}case x.A:{PQ(e,t);break}case x.H1:case x.H2:case x.H3:case x.H4:case x.H5:case x.H6:{IQ(e,t);break}case x.P:case x.DL:case x.OL:case x.UL:case x.DIV:case x.DIR:case x.NAV:case x.MAIN:case x.MENU:case x.ASIDE:case x.CENTER:case x.FIGURE:case x.FOOTER:case x.HEADER:case x.HGROUP:case x.DIALOG:case x.DETAILS:case x.ADDRESS:case x.ARTICLE:case x.SEARCH:case x.SECTION:case x.SUMMARY:case x.FIELDSET:case x.BLOCKQUOTE:case x.FIGCAPTION:{CQ(e,t);break}case x.LI:case x.DD:case x.DT:{LQ(e,t);break}case x.BR:case x.IMG:case x.WBR:case x.AREA:case x.EMBED:case x.KEYGEN:{uM(e,t);break}case x.HR:{zQ(e,t);break}case x.RB:case x.RTC:{XQ(e,t);break}case x.RT:case x.RP:{QQ(e,t);break}case x.PRE:case x.LISTING:{RQ(e,t);break}case x.XMP:{YQ(e,t);break}case x.SVG:{JQ(e,t);break}case x.HTML:{SQ(e,t);break}case x.BASE:case x.LINK:case x.META:case x.STYLE:case x.TITLE:case x.SCRIPT:case x.BGSOUND:case x.BASEFONT:case x.TEMPLATE:{vi(e,t);break}case x.BODY:{NQ(e,t);break}case x.FORM:{OQ(e,t);break}case x.NOBR:{BQ(e,t);break}case x.MATH:{ZQ(e,t);break}case x.TABLE:{UQ(e,t);break}case x.INPUT:{$Q(e,t);break}case x.PARAM:case x.TRACK:case x.SOURCE:{HQ(e,t);break}case x.IMAGE:{VQ(e,t);break}case x.BUTTON:{DQ(e,t);break}case x.APPLET:case x.OBJECT:case x.MARQUEE:{FQ(e,t);break}case x.IFRAME:{WQ(e,t);break}case x.SELECT:{qQ(e,t);break}case x.OPTION:case x.OPTGROUP:{GQ(e,t);break}case x.NOEMBED:case x.NOFRAMES:{tS(e,t);break}case x.FRAMESET:{AQ(e,t);break}case x.TEXTAREA:{KQ(e,t);break}case x.NOSCRIPT:{e.options.scriptingEnabled?tS(e,t):nS(e,t);break}case x.PLAINTEXT:{MQ(e,t);break}case x.COL:case x.TH:case x.TD:case x.TR:case x.HEAD:case x.FRAME:case x.TBODY:case x.TFOOT:case x.THEAD:case x.CAPTION:case x.COLGROUP:break;default:nS(e,t)}}function eZ(e,t){if(e.openElements.hasInScope(x.BODY)&&(e.insertionMode=z.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function tZ(e,t){e.openElements.hasInScope(x.BODY)&&(e.insertionMode=z.AFTER_BODY,wM(e,t))}function nZ(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function rZ(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(x.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(x.FORM):n&&e.openElements.remove(n))}function iZ(e){e.openElements.hasInButtonScope(x.P)||e._insertFakeElement(Q.P,x.P),e._closePElement()}function sZ(e){e.openElements.hasInListItemScope(x.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(x.LI),e.openElements.popUntilTagNamePopped(x.LI))}function aZ(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function oZ(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function lZ(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function cZ(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Q.BR,x.BR),e.openElements.pop(),e.framesetOk=!1}function fM(e,t){const n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const s=e.openElements.items[i],a=e.openElements.tagIDs[i];if(r===a&&(r!==x.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(s,a))break}}function Dm(e,t){switch(t.tagID){case x.A:case x.B:case x.I:case x.S:case x.U:case x.EM:case x.TT:case x.BIG:case x.CODE:case x.FONT:case x.NOBR:case x.SMALL:case x.STRIKE:case x.STRONG:{Lx(e,t);break}case x.P:{iZ(e);break}case x.DL:case x.UL:case x.OL:case x.DIR:case x.DIV:case x.NAV:case x.PRE:case x.MAIN:case x.MENU:case x.ASIDE:case x.BUTTON:case x.CENTER:case x.FIGURE:case x.FOOTER:case x.HEADER:case x.HGROUP:case x.DIALOG:case x.ADDRESS:case x.ARTICLE:case x.DETAILS:case x.SEARCH:case x.SECTION:case x.SUMMARY:case x.LISTING:case x.FIELDSET:case x.BLOCKQUOTE:case x.FIGCAPTION:{nZ(e,t);break}case x.LI:{sZ(e);break}case x.DD:case x.DT:{aZ(e,t);break}case x.H1:case x.H2:case x.H3:case x.H4:case x.H5:case x.H6:{oZ(e);break}case x.BR:{cZ(e);break}case x.BODY:{eZ(e,t);break}case x.HTML:{tZ(e,t);break}case x.FORM:{rZ(e);break}case x.APPLET:case x.OBJECT:case x.MARQUEE:{lZ(e,t);break}case x.TEMPLATE:{lo(e,t);break}default:fM(e,t)}}function hM(e,t){e.tmplInsertionModeStack.length>0?xM(e,t):Mx(e,t)}function uZ(e,t){var n;t.tagID===x.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function dZ(e,t){e._err(t,ie.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function v0(e,t){if(e.openElements.currentTagId!==void 0&&oM.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=z.IN_TABLE_TEXT,t.type){case it.CHARACTER:{mM(e,t);break}case it.WHITESPACE_CHARACTER:{pM(e,t);break}}else Cd(e,t)}function fZ(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_CAPTION}function hZ(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_COLUMN_GROUP}function pZ(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Q.COLGROUP,x.COLGROUP),e.insertionMode=z.IN_COLUMN_GROUP,Dx(e,t)}function mZ(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_TABLE_BODY}function gZ(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Q.TBODY,x.TBODY),e.insertionMode=z.IN_TABLE_BODY,Pm(e,t)}function yZ(e,t){e.openElements.hasInTableScope(x.TABLE)&&(e.openElements.popUntilTagNamePopped(x.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function bZ(e,t){dM(t)?e._appendElement(t,fe.HTML):Cd(e,t),t.ackSelfClosing=!0}function EZ(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,fe.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function kl(e,t){switch(t.tagID){case x.TD:case x.TH:case x.TR:{gZ(e,t);break}case x.STYLE:case x.SCRIPT:case x.TEMPLATE:{vi(e,t);break}case x.COL:{pZ(e,t);break}case x.FORM:{EZ(e,t);break}case x.TABLE:{yZ(e,t);break}case x.TBODY:case x.TFOOT:case x.THEAD:{mZ(e,t);break}case x.INPUT:{bZ(e,t);break}case x.CAPTION:{fZ(e,t);break}case x.COLGROUP:{hZ(e,t);break}default:Cd(e,t)}}function Gu(e,t){switch(t.tagID){case x.TABLE:{e.openElements.hasInTableScope(x.TABLE)&&(e.openElements.popUntilTagNamePopped(x.TABLE),e._resetInsertionMode());break}case x.TEMPLATE:{lo(e,t);break}case x.BODY:case x.CAPTION:case x.COL:case x.COLGROUP:case x.HTML:case x.TBODY:case x.TD:case x.TFOOT:case x.TH:case x.THEAD:case x.TR:break;default:Cd(e,t)}}function Cd(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Mm(e,t),e.fosterParentingEnabled=n}function pM(e,t){e.pendingCharacterTokens.push(t)}function mM(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function _c(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===x.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===x.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===x.OPTGROUP&&e.openElements.pop();break}case x.OPTION:{e.openElements.currentTagId===x.OPTION&&e.openElements.pop();break}case x.SELECT:{e.openElements.hasInSelectScope(x.SELECT)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode());break}case x.TEMPLATE:{lo(e,t);break}}}function kZ(e,t){const n=t.tagID;n===x.CAPTION||n===x.TABLE||n===x.TBODY||n===x.TFOOT||n===x.THEAD||n===x.TR||n===x.TD||n===x.TH?(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),e._processStartTag(t)):bM(e,t)}function SZ(e,t){const n=t.tagID;n===x.CAPTION||n===x.TABLE||n===x.TBODY||n===x.TFOOT||n===x.THEAD||n===x.TR||n===x.TD||n===x.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),e.onEndTag(t)):EM(e,t)}function NZ(e,t){switch(t.tagID){case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:case x.NOFRAMES:case x.SCRIPT:case x.STYLE:case x.TEMPLATE:case x.TITLE:{vi(e,t);break}case x.CAPTION:case x.COLGROUP:case x.TBODY:case x.TFOOT:case x.THEAD:{e.tmplInsertionModeStack[0]=z.IN_TABLE,e.insertionMode=z.IN_TABLE,kl(e,t);break}case x.COL:{e.tmplInsertionModeStack[0]=z.IN_COLUMN_GROUP,e.insertionMode=z.IN_COLUMN_GROUP,Dx(e,t);break}case x.TR:{e.tmplInsertionModeStack[0]=z.IN_TABLE_BODY,e.insertionMode=z.IN_TABLE_BODY,Pm(e,t);break}case x.TD:case x.TH:{e.tmplInsertionModeStack[0]=z.IN_ROW,e.insertionMode=z.IN_ROW,jm(e,t);break}default:e.tmplInsertionModeStack[0]=z.IN_BODY,e.insertionMode=z.IN_BODY,nr(e,t)}}function AZ(e,t){t.tagID===x.TEMPLATE&&lo(e,t)}function xM(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(x.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Mx(e,t)}function CZ(e,t){t.tagID===x.HTML?nr(e,t):Op(e,t)}function wM(e,t){var n;if(t.tagID===x.HTML){if(e.fragmentContext||(e.insertionMode=z.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===x.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Op(e,t)}function Op(e,t){e.insertionMode=z.IN_BODY,Mm(e,t)}function IZ(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.FRAMESET:{e._insertElement(t,fe.HTML);break}case x.FRAME:{e._appendElement(t,fe.HTML),t.ackSelfClosing=!0;break}case x.NOFRAMES:{vi(e,t);break}}}function RZ(e,t){t.tagID===x.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==x.FRAMESET&&(e.insertionMode=z.AFTER_FRAMESET))}function OZ(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.NOFRAMES:{vi(e,t);break}}}function LZ(e,t){t.tagID===x.HTML&&(e.insertionMode=z.AFTER_AFTER_FRAMESET)}function MZ(e,t){t.tagID===x.HTML?nr(e,t):Th(e,t)}function Th(e,t){e.insertionMode=z.IN_BODY,Mm(e,t)}function DZ(e,t){switch(t.tagID){case x.HTML:{nr(e,t);break}case x.NOFRAMES:{vi(e,t);break}}}function PZ(e,t){t.chars=Wt,e._insertCharacters(t)}function jZ(e,t){e._insertCharacters(t),e.framesetOk=!1}function vM(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==fe.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function BZ(e,t){if(JX(t))vM(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===fe.MATHML?sM(t):r===fe.SVG&&(eQ(t),aM(t)),Ox(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function FZ(e,t){if(t.tagID===x.P||t.tagID===x.BR){vM(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===fe.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Q.AREA,Q.BASE,Q.BASEFONT,Q.BGSOUND,Q.BR,Q.COL,Q.EMBED,Q.FRAME,Q.HR,Q.IMG,Q.INPUT,Q.KEYGEN,Q.LINK,Q.META,Q.PARAM,Q.SOURCE,Q.TRACK,Q.WBR;const _M=TM("end"),co=TM("start");function TM(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}const kM=function(e){if(e==null)return zZ;if(typeof e=="function")return Bm(e);if(typeof e=="object")return Array.isArray(e)?UZ(e):$Z(e);if(typeof e=="string")return HZ(e);throw new Error("Expected function, string, or object as test")};function UZ(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=SM,m,y,w;if((!t||s(l,u,d[d.length-1]||void 0))&&(p=qZ(n(l,d)),p[0]===rS))return p;if("children"in l&&l.children){const g=l;if(g.children&&p[0]!==YZ)for(y=(r?g.children.length:-1)+a,w=d.concat(g);y>-1&&y])/gi,QZ=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),iS={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function NM(e,t){const n=oJ(e),r=qL("type",{handlers:{root:ZZ,element:JZ,text:eJ,comment:CM,doctype:tJ,raw:rJ},unknown:iJ}),i={parser:n?new eS(iS):eS.getFragmentParser(void 0,iS),handle(o){r(o,i)},stitches:!1,options:t||{}};r(e,i),Xl(i,co());const s=n?i.parser.document:i.parser.getFragment(),a=ZG(s,{file:i.options.file});return i.stitches&&GZ(a,"comment",function(o,l,u){const d=o;if(d.value.stitch&&u&&l!==void 0){const f=u.children;return f[l]=d.value.stitch,l}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function AM(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:it.CHARACTER,chars:e.value,location:Id(e)};Xl(t,co(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function tJ(e,t){const n={type:it.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Id(e)};Xl(t,co(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function nJ(e,t){t.stitches=!0;const n=lJ(e);if("children"in e&&"children"in n){const r=NM({type:"root",children:e.children},t.options);n.children=r.children}CM({type:"comment",value:{stitch:n}},t)}function CM(e,t){const n=e.value,r={type:it.COMMENT,data:n,location:Id(e)};Xl(t,co(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function rJ(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,IM(t,co(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(XZ,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function iJ(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))nJ(n,t);else{let r="";throw QZ.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function Xl(e,t){IM(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=pn.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function IM(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function sJ(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===pn.PLAINTEXT)return;Xl(t,co(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:Na.html;i===Na.html&&n==="svg"&&(i=Na.svg);const s=rX({...e,children:[]},{space:i===Na.svg?"svg":"html"}),a={type:it.START_TAG,tagName:n,tagID:Gl(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:Id(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function aJ(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&dX.includes(n)||t.parser.tokenizer.state===pn.PLAINTEXT)return;Xl(t,_M(e));const r={type:it.END_TAG,tagName:n,tagID:Gl(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Id(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===pn.RCDATA||t.parser.tokenizer.state===pn.RAWTEXT||t.parser.tokenizer.state===pn.SCRIPT_DATA)&&(t.parser.tokenizer.state=pn.DATA)}function oJ(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Id(e){const t=co(e)||{line:void 0,column:void 0,offset:void 0},n=_M(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function lJ(e){return"children"in e?Dk({...e,children:[]}):Dk(e)}function cJ(e){return function(t,n){return NM(t,{...e,file:n})}}const RM=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function OM(e){if(!e)return!1;try{const t=e.toLowerCase();return RM.some(n=>t.includes(n))}catch{return!1}}function uJ(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(OM(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(s=>(s==null?void 0:s.value)||"").join("").toLowerCase();return RM.some(s=>i.includes(s))}return!1}function dJ({text:e,className:t,allowRawHtml:n=!0}){const[r,i]=v.useState(null),s=(l,u)=>{if(l.src)return l.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const y=d(m);if(y)return y}return null},f=d({children:u});if(f)return f}return""},a=l=>{try{const d=new URL(l).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},o=l=>l?Array.isArray(l)?l.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(l==null?void 0:l.value)||"video":"video";return c.jsxs("div",{className:t?`md ${t}`:"md",children:[c.jsx(KV,{remarkPlugins:[iW],rehypePlugins:n?[cJ,Rk]:[Rk],components:{a:({node:l,...u})=>{const d=u.href;if(d&&(OM(d)||uJ(l))){const f=d,h=o(l==null?void 0:l.children);return c.jsxs("div",{className:"video-container",children:[c.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>i({src:f,title:h}),children:[c.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),c.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:c.jsx(nu,{})})]}),c.jsx("div",{className:"video-caption",children:c.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return c.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:l,src:u,alt:d,...f})=>{const h=c.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?c.jsx(XI,{src:u,children:c.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,c.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:c.jsx(nu,{})})]})}):h},video:({node:l,src:u,children:d,...f})=>{const h=s({src:u},d);return h?c.jsx("div",{className:"video-container",children:c.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>i({src:h}),children:[c.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),c.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:c.jsx(nu,{})})]})}):c.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),r&&c.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>i(null),children:c.jsxs("div",{className:"video-viewer",onClick:l=>l.stopPropagation(),children:[c.jsxs("div",{className:"video-viewer-header",children:[c.jsx("div",{className:"video-viewer-title",children:r.title||a(r.src)}),c.jsxs("nav",{className:"video-viewer-nav",children:[c.jsx("a",{href:r.src,download:r.title||a(r.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:c.jsx(zE,{})}),c.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>i(null),children:c.jsx(ti,{})})]})]}),c.jsx("div",{className:"video-viewer-body",children:c.jsx("video",{src:r.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const Rd=v.memo(dJ),sS=6,aS=7,fJ={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function z1(e){return fJ[(e||"").trim().toLowerCase()]||"未知"}function oS(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function hJ(e){if(!e)return"";const t=e.trim(),n=Number(t),r=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function pJ(e){const t=e.replace(/\r\n/g,` -`);if(!t.startsWith(`--- -`))return e;const n=t.indexOf(` ---- -`,4);return n>=0?t.slice(n+5).trimStart():e}function mJ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M5.25 7.5h5.25v5.25H5.25zM13.5 7.5h5.25v5.25H13.5zM9.38 15.75h5.24v3H9.38z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),c.jsx("path",{d:"M7.88 12.75v1.5c0 .83.67 1.5 1.5 1.5h5.24c.83 0 1.5-.67 1.5-1.5v-1.5M12 4.75V7.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),c.jsx("circle",{cx:"12",cy:"4.75",r:"1",fill:"currentColor"})]})}function gJ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),c.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function yJ(){return c.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:c.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function lS({direction:e}){return c.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:c.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function V1(){return c.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function cS({page:e,total:t,pageSize:n,onPage:r}){const i=Math.max(1,Math.ceil(t/n));return c.jsxs("footer",{className:"skillcenter-pager",children:[c.jsxs("span",{children:["共 ",t," 项"]}),c.jsxs("div",{className:"skillcenter-pager-actions",children:[c.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:c.jsx(lS,{direction:"left"})}),c.jsxs("span",{children:[e," / ",i]}),c.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=i,"aria-label":"下一页",children:c.jsx(lS,{direction:"right"})})]})]})}function kh({children:e}){return c.jsx("div",{className:"skillcenter-empty",children:e})}function bJ({skill:e,space:t,region:n,detail:r,loading:i,error:s,onClose:a}){return v.useEffect(()=>{const o=l=>{l.key==="Escape"&&a()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a]),c.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:c.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:o=>o.stopPropagation(),children:[c.jsxs("header",{className:"skill-detail-head",children:[c.jsxs("div",{className:"skill-detail-heading",children:[c.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:c.jsx(gJ,{})}),c.jsxs("div",{children:[c.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),c.jsx("p",{children:(r==null?void 0:r.description)||e.skillDescription||"暂无描述"})]})]}),c.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:c.jsx(yJ,{})})]}),c.jsxs("dl",{className:"skill-detail-meta",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"技能 ID"}),c.jsx("dd",{title:e.skillId,children:e.skillId})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"版本"}),c.jsx("dd",{children:(r==null?void 0:r.version)||e.version||"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"状态"}),c.jsx("dd",{children:z1(e.skillStatus)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"技能空间"}),c.jsx("dd",{title:t.name,children:t.name})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Project"}),c.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"地域"}),c.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),c.jsxs("div",{className:"skill-detail-content",children:[c.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),i?c.jsxs("div",{className:"skillcenter-loading",children:[c.jsx(V1,{}),"正在读取技能内容…"]}):s?c.jsx("div",{className:"skillcenter-error",children:s}):r!=null&&r.skillMd?c.jsx(Rd,{text:pJ(r.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):c.jsx(kh,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function EJ({onClick:e}){return c.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"技能中心",title:"技能中心",children:[c.jsx(mJ,{}),c.jsx("span",{className:"sidebar-nav-label",children:"技能中心"})]})}function xJ(){const[e,t]=v.useState("cn-beijing"),[n,r]=v.useState([]),[i,s]=v.useState(1),[a,o]=v.useState(0),[l,u]=v.useState(!1),[d,f]=v.useState(""),[h,p]=v.useState(null),[m,y]=v.useState([]),[w,g]=v.useState(1),[E,b]=v.useState(0),[_,k]=v.useState(!1),[T,C]=v.useState(""),[S,R]=v.useState(null),[I,M]=v.useState(null),[B,Y]=v.useState(!1),[P,U]=v.useState(""),A=v.useRef(0);v.useEffect(()=>{let H=!0;return u(!0),f(""),s7({region:e,page:i,pageSize:sS}).then(V=>{if(!H)return;const D=V.items||[];r(D),o(V.totalCount||0),p(ne=>D.find(J=>J.id===(ne==null?void 0:ne.id))||null)}).catch(V=>{H&&(r([]),o(0),p(null),f(V instanceof Error?V.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{H&&u(!1)}),()=>{H=!1}},[e,i]),v.useEffect(()=>{if(!h){y([]),b(0);return}let H=!0;return k(!0),C(""),o7(h.id,{region:e,page:w,pageSize:aS,project:h.projectName}).then(V=>{H&&(y(V.items||[]),b(V.totalCount||0))}).catch(V=>{H&&(y([]),b(0),C(V instanceof Error?V.message:"读取技能失败,请稍后重试"))}).finally(()=>{H&&k(!1)}),()=>{H=!1}},[e,h,w]);const L=H=>{H!==e&&(j(),t(H),s(1),g(1),p(null),y([]))},O=H=>{j(),p(H),g(1)},j=()=>{A.current+=1,R(null),M(null),U(""),Y(!1)},N=async H=>{if(!h)return;const V=A.current+1;A.current=V,R(H),M(null),U(""),Y(!0);try{const D=await l7(h.id,H.skillId,H.version,e,h.projectName);A.current===V&&M(D)}catch(D){A.current===V&&U(D instanceof Error?D.message:"读取技能详情失败,请稍后重试")}finally{A.current===V&&Y(!1)}};return c.jsxs("section",{className:"skillcenter",children:[c.jsxs("div",{className:"skillcenter-browser",children:[c.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[c.jsxs("header",{className:"skillcenter-panel-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"技能空间"}),c.jsx("span",{className:"skillcenter-count-badge",children:a})]}),c.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[c.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>L("cn-beijing"),children:"北京"}),c.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>L("cn-shanghai"),children:"上海"})]})]}),c.jsxs("div",{className:"skillcenter-listwrap",children:[l&&c.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[c.jsx(V1,{}),"正在读取技能空间…"]}),d?c.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!l?c.jsx(kh,{children:"当前地域暂无可访问的技能空间"}):c.jsx("div",{className:"skillcenter-list",children:n.map(H=>c.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===H.id?"active":""}`,onClick:()=>O(H),children:c.jsxs("span",{className:"skillcenter-item-body",children:[c.jsx("span",{className:"skillcenter-item-title",title:H.name,children:H.name}),c.jsx("span",{className:"skillcenter-item-description",children:H.description||"暂无描述"}),c.jsxs("span",{className:"skillcenter-item-meta",children:[c.jsx("span",{className:`skillcenter-status ${oS(H.status)}`,children:z1(H.status)}),c.jsxs("span",{className:"skillcenter-meta-text",title:H.projectName||"default",children:["Project · ",H.projectName||"default"]}),c.jsxs("span",{className:"skillcenter-meta-text",children:[H.skillCount??0," 个技能"]}),H.updatedAt&&c.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",hJ(H.updatedAt)]})]})]})},`${H.projectName||"default"}:${H.id}`))})]}),c.jsx(cS,{page:i,total:a,pageSize:sS,onPage:s})]}),c.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:"skillcenter-panel-head",children:[c.jsx("div",{children:c.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),c.jsx("span",{children:E})]}),c.jsxs("div",{className:"skillcenter-listwrap",children:[_&&c.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[c.jsx(V1,{}),"正在读取技能…"]}),T?c.jsx("div",{className:"skillcenter-error",children:T}):m.length===0&&!_?c.jsx(kh,{children:"这个空间中暂无技能"}):c.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(H=>c.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void N(H),children:c.jsxs("span",{className:"skillcenter-item-body",children:[c.jsx("span",{className:"skillcenter-item-title",title:H.skillName,children:H.skillName}),c.jsx("span",{className:"skillcenter-item-description",children:H.skillDescription||"暂无描述"}),c.jsxs("span",{className:"skillcenter-item-meta",children:[c.jsx("span",{className:`skillcenter-status ${oS(H.skillStatus)}`,children:z1(H.skillStatus)}),c.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",H.version||"—"]})]})]})},`${H.skillId}:${H.version}`))})]}),c.jsx(cS,{page:w,total:E,pageSize:aS,onPage:g})]}):c.jsx(kh,{children:"点击 Skill 空间以查看详情"})})]}),S&&h&&c.jsx(bJ,{skill:S,space:h,region:e,detail:I,loading:B,error:P,onClose:j})]})}const wJ=50,uS=48;function vJ(e){return(e.events??[]).flatMap(t=>{var i,s;const r=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function _J(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const i=(((n=r.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(i)return i}return"未命名会话"}function TJ(e,t,n){const r=Math.max(0,t-uS),i=Math.min(e.length,t+n+uS);return(r>0?"…":"")+e.slice(r,i).trim()+(i{var l;if((l=o.events)!=null&&l.length)return o;try{return await xp(t,e,o.id)}catch{return o}})),a=[];for(const o of s)for(const{text:l,role:u,ts:d}of vJ(o)){const f=l.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:_J(o),snippet:TJ(l,f,r.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,l)=>(l.ts??0)-(o.ts??0)),a.slice(0,wJ)}async function SJ(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await AR(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:r,results:i,error:s}=n;return r?s?{results:[],note:s}:{results:i.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function NJ(e,t,n,r){if(!t||!r.trim())return{results:[]};const i=await NR(t,e,r.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const s=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:s,sourceType:i.sourceType}:{type:"memory",index:o,content:a.content,sourceName:s,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function AJ(e,t,n){return e==="session"?{results:await kJ(n.userId,n.appId,t)}:e==="web"?SJ(n.appId,t):NJ(e,n.appId,n.userId,t)}function LM({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),c.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function CJ({open:e}){return c.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:c.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function IJ({onClick:e}){return c.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"智能搜索",title:"智能搜索",children:[c.jsx(LM,{}),c.jsx("span",{className:"sidebar-nav-label",children:"智能搜索"})]})}function RJ(e,t,n){const r=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),s=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:s(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&i.has("knowledge"),unavailableLabel:s("知识库")},{id:"memory",label:"长期记忆",ready:r&&i.has("memory"),unavailableLabel:s("长期记忆")}]}function Lp(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function dS(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function OJ({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:i,onOpenSession:s}){var U,A;const[a,o]=v.useState("session"),[l,u]=v.useState(""),[d,f]=v.useState([]),[h,p]=v.useState(),[m,y]=v.useState(!1),[w,g]=v.useState(!1),[E,b]=v.useState(!1),_=v.useRef(0),k=v.useRef(null),T=RJ(t,n,r),C=T.find(L=>L.id===a),S=a==="knowledge"?(U=n==null?void 0:n.components)==null?void 0:U.find(L=>L.source==="knowledgebase"||L.kind==="knowledgebase"):a==="memory"?(A=n==null?void 0:n.components)==null?void 0:A.find(L=>L.source==="long_term_memory"||L.kind==="memory"):void 0;v.useEffect(()=>{_.current+=1,o("session"),f([]),p(void 0),g(!1),y(!1),b(!1)},[t]),v.useEffect(()=>{if(!E)return;function L(O){var j;(j=k.current)!=null&&j.contains(O.target)||b(!1)}return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[E]);async function R(L,O){var V;const j=L.trim();if(!j||!((V=T.find(D=>D.id===O))!=null&&V.ready))return;const N=++_.current;y(!0),g(!0);let H;try{H=await AJ(O,j,{userId:e,appId:t})}catch(D){const ne=D instanceof Error?D.message:String(D);H={results:[],note:`搜索失败:${ne}`}}N===_.current&&(f(H.results),p(H.note),y(!1))}function I(L){_.current+=1,u(L),f([]),p(void 0),g(!1),y(!1)}function M(L){_.current+=1,o(L),b(!1),f([]),p(void 0),g(!1),y(!1)}const B=!!(C!=null&&C.ready),Y=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(S==null?void 0:S.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(S==null?void 0:S.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",P=S!=null&&S.backend?Lp(S.backend):"";return c.jsxs("div",{className:"search",children:[c.jsxs("div",{className:"search-box",children:[c.jsxs("div",{className:"search-source-picker-wrap",ref:k,children:[c.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(C==null?void 0:C.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":E,onClick:()=>b(L=>!L),children:[c.jsx("span",{children:(C==null?void 0:C.label)??"搜索类型"}),P&&c.jsx("small",{children:P}),c.jsx(CJ,{open:E})]}),E&&c.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:T.map(L=>{var N,H;const O=L.id==="knowledge"?(N=n==null?void 0:n.components)==null?void 0:N.find(V=>V.source==="knowledgebase"||V.kind==="knowledgebase"):L.id==="memory"?(H=n==null?void 0:n.components)==null?void 0:H.find(V=>V.source==="long_term_memory"||V.kind==="memory"):void 0,j=O?[O.name,O.backend?Lp(O.backend):""].filter(Boolean).join(" · "):L.ready?L.description:L.unavailableLabel;return c.jsxs("button",{type:"button",role:"option","aria-selected":a===L.id,disabled:!L.ready,onClick:()=>M(L.id),children:[c.jsx("span",{children:L.label}),j&&c.jsx("small",{children:j})]},L.id)})})]}),c.jsx("span",{className:"search-box-divider","aria-hidden":!0}),c.jsx("input",{className:"search-input",value:l,onChange:L=>I(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),R(l,a))},placeholder:Y,disabled:!B,autoFocus:!0}),c.jsx("button",{className:"search-go",onClick:()=>void R(l,a),disabled:!l.trim()||m,"aria-label":"搜索",children:m?c.jsx(_t,{className:"icon spin"}):c.jsx(LM,{className:"icon"})})]}),c.jsx("div",{className:"search-results",children:B?w?m?null:h?c.jsx("div",{className:"search-empty",children:h}):d.length===0&&w?c.jsxs("div",{className:"search-empty",children:["未找到匹配「",l.trim(),"」的结果。"]}):d.map((L,O)=>c.jsx(LJ,{result:L,agentLabel:i,onOpen:s},O)):c.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):c.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(C==null?void 0:C.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function LJ({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return c.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[c.jsx(fR,{className:"search-result-icon"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsx("span",{className:"search-result-title",children:e.title}),c.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${dS(e.ts)}`:""]})]}),c.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return c.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[c.jsx(wm,{className:"search-result-icon"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsx("span",{className:"search-result-title",children:e.title||e.url}),c.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&c.jsx(VE,{className:"search-result-ext"})]})]}),e.summary&&c.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return c.jsxs("div",{className:"search-result search-result-static",children:[c.jsx(fS,{source:"knowledge"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),c.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Lp(e.sourceType)}`:""]})]}),c.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return c.jsxs("div",{className:"search-result search-result-static",children:[c.jsx(fS,{source:"memory"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),c.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Lp(e.sourceType)}`:"",e.ts?` · ${dS(e.ts)}`:""]})]}),c.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function fS({source:e,className:t="search-result-icon"}){return e==="knowledge"?c.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),c.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):c.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),c.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}const MM="veadk_agentkit_connections";function es(){try{const e=localStorage.getItem(MM);return e?JSON.parse(e):[]}catch{return[]}}function Fm(e){try{localStorage.setItem(MM,JSON.stringify(e))}catch{}}function qa(e,t){return`agentkit:${e}:${t}`}function DM(e){try{return new URL(e).host}catch{return e}}function Ql(e){ER();for(const t of e)for(const n of t.apps)bR(qa(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function PM(e,t,n,r,i){const s={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:i},a=[...es().filter(o=>o.runtimeId!==e),s];return Fm(a),Ql(a),s}async function Px(e,t,n){let r;try{r=await MR(e,n)}catch(a){throw a instanceof xd&&K1(e),a}if(!r||r.length===0)throw K1(e),new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const i=Object.fromEntries(r.map(a=>[a,t])),s=PM(e,t,n,r,i);return qa(s.id,r[0])}async function jM(e,t,n,r){const i=t.trim().replace(/\/+$/,""),s=await Tm(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||DM(i),base:i,apiKey:n.trim(),apps:s,appLabels:r&&s.length>0?{[s[0]]:r}:void 0},o=[...es().filter(l=>l.base!==i),a];return Fm(o),Ql(o),a}function MJ(e){const t=es().filter(n=>n.id!==e);return Fm(t),Ql(t),t}function K1(e){const t=es().filter(n=>n.runtimeId!==e);return Fm(t),Ql(t),t}function BM(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),r=t.flatMap(i=>i.apps.map(s=>{var o;const a=((o=i.appLabels)==null?void 0:o[s])??s;return{id:qa(i.id,s),label:a,app:s,remote:!0,host:i.runtimeId?i.name:DM(i.base??"")}}));return[...n,...r]}const hS=Object.freeze(Object.defineProperty({__proto__:null,addConnection:jM,addRuntimeConnection:PM,buildAgentEntries:BM,connectRuntime:Px,loadConnections:es,registerConnections:Ql,remoteAppId:qa,removeConnection:MJ,removeRuntimeConnection:K1},Symbol.toStringTag,{value:"Module"}));function Xu({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),c.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),c.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),c.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),c.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),c.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),c.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}function DJ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),c.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),c.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),c.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}function PJ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"m4.7 7.2 7.3-3 7.3 3-7.3 3.1Z"}),c.jsx("path",{d:"M7.2 9.2v4.2c0 1.7 2.15 3.05 4.8 3.05s4.8-1.35 4.8-3.05V9.2"}),c.jsx("path",{d:"M19.3 7.2v5.25"}),c.jsx("circle",{cx:"19.3",cy:"14.4",r:"1.15",fill:"currentColor",stroke:"none"})]})}function FM({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M18.7 8.15A7.55 7.55 0 0 0 5.35 7.1"}),c.jsx("path",{d:"m18.7 8.15-.2-3.05-3.02.3"}),c.jsx("path",{d:"M5.3 15.85A7.55 7.55 0 0 0 18.65 16.9"}),c.jsx("path",{d:"m5.3 15.85.2 3.05 3.02-.3"}),c.jsx("path",{d:"M6.85 12h2.8l1.4-2.9 1.9 5.8 1.42-2.9h2.78"})]})}const pS=15,jJ=1e4,BJ=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}];function FJ(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function UM(e){const t=e.toLowerCase();return t.includes("invalidagentkitruntime.notfound")||t.includes("specified agentkitruntime does not exist")?"该 Runtime 已不存在或列表信息已过期,请刷新列表后重试。":t.includes("accessdenied")||t.includes("forbidden")||t.includes("permission")||t.includes("(401)")||t.includes("(403)")?"当前账号无权访问该 Runtime,请检查所属 Project 和访问权限。":t.includes("agent-info failed: 404")||t.includes("读取 agent 列表失败 (404)")?"该 Agent Server 版本暂不支持信息预览。":"该 Runtime 暂时无法访问,请确认其状态为“就绪”后重试。"}function _0(e,t=jJ){return new Promise((n,r)=>{const i=setTimeout(()=>r(new Error("加载超时,请重试")),t);e.then(s=>{clearTimeout(i),n(s)},s=>{clearTimeout(i),r(s)})})}function UJ({open:e,onClose:t,anchorTop:n=0,agentsSource:r,localApps:i,currentId:s,currentRuntime:a,runtimeScope:o,onSelect:l}){const[u,d]=v.useState([]),[f,h]=v.useState([""]),[p,m]=v.useState(0),[y,w]=v.useState(o==="mine"),[g,E]=v.useState(null),[b,_]=v.useState("cn-beijing"),[k,T]=v.useState(!1),[C,S]=v.useState(""),[R,I]=v.useState(""),[M,B]=v.useState(null),[Y,P]=v.useState(new Set),[U,A]=v.useState(),[L,O]=v.useState("agent"),j=v.useRef(!1);function N(W){A(ae=>(ae==null?void 0:ae.runtimeId)===W.runtimeId?void 0:{runtimeId:W.runtimeId,name:W.name,region:W.region})}const H=v.useCallback(async W=>{if(u[W]){m(W);return}const ae=f[W];if(ae!==void 0){T(!0),S("");try{const he=await _0(xh({nextToken:ae,pageSize:pS,region:b,scope:"all"}));d(Z=>{const ce=[...Z];return ce[W]=he.runtimes,ce}),h(Z=>{const ce=[...Z];return he.nextToken&&(ce[W+1]=he.nextToken),ce}),m(W)}catch(he){S(he instanceof Error?he.message:String(he))}finally{T(!1)}}},[f,u,b]),V=v.useCallback(async()=>{T(!0),S("");try{const W=[];let ae="";do{const he=await _0(xh({scope:"mine",nextToken:ae,pageSize:100,region:b}));W.push(...he.runtimes),ae=he.nextToken}while(ae&&W.length<2e3);E(W)}catch(W){S(W instanceof Error?W.message:String(W))}finally{T(!1)}},[b]);v.useEffect(()=>{w(o==="mine"),d([]),h([""]),m(0),E(null),j.current=!1},[o]),v.useEffect(()=>{e&&r==="cloud"&&!y&&!j.current&&(j.current=!0,H(0))},[e,r,y,H]),v.useEffect(()=>{y&&g===null&&r==="cloud"&&V()},[y,g,r,V]),v.useEffect(()=>{e&&(A(void 0),O("agent"))},[e]);function D(){P(new Set),y?(E(null),V()):(d([]),h([""]),m(0),j.current=!0,T(!0),S(""),_0(xh({nextToken:"",pageSize:pS,region:b,scope:"all"})).then(W=>{d([W.runtimes]),h(W.nextToken?["",W.nextToken]:[""])}).catch(W=>S(W instanceof Error?W.message:String(W))).finally(()=>T(!1)))}function ne(W){W!==b&&(_(W),d([]),h([""]),m(0),E(null),P(new Set),j.current=!1)}const J=!y&&(u[p+1]!==void 0||f[p+1]!==void 0);function re(W){B(W.runtimeId),Px(W.runtimeId,W.name,W.region).then(ae=>{l(ae),t()}).catch(ae=>{if(ae instanceof xd){S(ae.message);return}if(ae instanceof $u){ae.unsupported&&P(he=>new Set(he).add(W.runtimeId)),S(ae.message);return}P(he=>new Set(he).add(W.runtimeId))}).finally(()=>B(null))}if(!e)return null;const G=(y?g??[]:u[p]??[]).filter(W=>R?W.name.toLowerCase().includes(R.toLowerCase()):!0);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:t}),c.jsxs("div",{className:`agentsel ${U?"has-detail":""}`,role:"dialog","aria-label":"选择 Agent",style:{top:n,height:`min(640px, calc(100dvh - ${n}px - 10px))`},children:[c.jsxs("div",{className:"agentsel-main",children:[c.jsxs("div",{className:"agentsel-head",children:[c.jsxs("span",{className:"agentsel-title",children:[c.jsx(Xu,{})," 选择 Agent"]}),c.jsxs("div",{className:"agentsel-head-actions",children:[r==="cloud"&&c.jsx("button",{className:"agentsel-refresh",onClick:D,title:"刷新",disabled:k,children:c.jsx(YE,{className:`icon ${k?"spin":""}`})}),c.jsx("button",{className:"agentsel-refresh",onClick:t,title:"关闭",children:c.jsx(ti,{className:"icon"})})]})]}),r==="local"?c.jsx("div",{className:"agentsel-body",children:i.length===0?c.jsx("div",{className:"agentsel-empty",children:"暂无本地 Agent。"}):c.jsx("ul",{className:"agentsel-list",children:i.map(W=>c.jsx("li",{children:c.jsxs("button",{className:`agentsel-item ${W===s?"active":""}`,onClick:()=>{l(W),t()},children:[c.jsx(Xu,{}),c.jsx("span",{className:"agentsel-item-name",children:W})]})},W))})}):c.jsxs("div",{className:"agentsel-body agentsel-body--cloud",children:[c.jsxs("div",{className:"agentsel-tools",children:[c.jsxs("div",{className:"agentsel-search",children:[c.jsx(g1,{className:"icon"}),c.jsx("input",{value:R,onChange:W=>I(W.target.value),placeholder:"搜索 Runtime 名称"})]}),c.jsx("div",{className:"agentsel-regions","aria-label":"按部署地域筛选",children:BJ.map(W=>c.jsx("button",{type:"button",className:b===W.value?"active":"","aria-pressed":b===W.value,onClick:()=>ne(W.value),children:W.label},W.value))}),o==="all"&&c.jsxs("label",{className:"agentsel-mine",children:[c.jsx("input",{type:"checkbox",checked:y,onChange:W=>w(W.target.checked)}),"只看我创建的"]})]}),C&&c.jsx("div",{className:"agentsel-error",children:C}),c.jsxs("div",{className:"agentsel-listwrap",children:[G.length===0&&!k?c.jsx("div",{className:"agentsel-empty",children:"暂无 Runtime。"}):c.jsx("ul",{className:"agentsel-list",children:G.map(W=>{const ae=Y.has(W.runtimeId),he=M===W.runtimeId,Z=(a==null?void 0:a.runtimeId)===W.runtimeId,ce=(U==null?void 0:U.runtimeId)===W.runtimeId;return c.jsx("li",{children:c.jsxs("div",{className:`agentsel-item agentsel-runtime-item ${Z?"active":""} ${ce?"is-previewed":""}`,title:W.runtimeId,children:[c.jsx(FM,{}),c.jsxs("div",{className:"agentsel-item-main",children:[c.jsx("span",{className:"agentsel-item-name",title:W.name,children:W.name}),c.jsxs("div",{className:"agentsel-item-meta",children:[c.jsx("span",{className:`agentsel-status is-${ae?"bad":WJ(W.status)}`,children:ae?"不支持":$M(W.status)}),W.isMine&&c.jsx("span",{className:"agentsel-badge",children:"我创建的"})]})]}),c.jsxs("div",{className:"agentsel-item-actions",children:[c.jsx("button",{type:"button",className:"agentsel-connect",disabled:he||Z,onClick:()=>re(W),children:he?"连接中…":Z?"已连接":ae?"重试":"连接"}),c.jsx("button",{type:"button",className:`agentsel-info ${ce?"active":""}`,"aria-label":`查看 ${W.name} 信息`,"aria-pressed":ce,title:"查看信息",onClick:()=>N(W),children:c.jsx(Ed,{className:"icon"})})]})]})},W.runtimeId)})}),k&&c.jsxs("div",{className:"agentsel-loading",children:[c.jsx(_t,{className:"icon spin"})," 加载中…"]})]}),c.jsxs("div",{className:"agentsel-pager",children:[c.jsx("button",{disabled:y||p===0||k,onClick:()=>void H(p-1),"aria-label":"上一页",children:c.jsx(J9,{className:"icon"})}),c.jsx("span",{className:"agentsel-pager-label",children:y?1:p+1}),c.jsx("button",{disabled:y||!J||k,onClick:()=>void H(p+1),"aria-label":"下一页",children:c.jsx(dr,{className:"icon"})})]})]})]}),r==="cloud"&&U&&c.jsx(VJ,{runtime:U,tab:L,onTabChange:O})]})]})}const $J={knowledgebase:"知识库",memory:"记忆",prompt_manager:"提示词管理",example_store:"样例库",run_processor:"运行处理器",tracer:"链路追踪",toolset:"工具集",plugin:"插件",other:"其他"};function HJ(e){return $J[e.toLowerCase()]??e}function zJ(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function VJ({runtime:e,tab:t,onTabChange:n}){return c.jsxs("section",{className:"agentsel-detail agentsel-preview","aria-label":"Agent 与 Runtime 信息",children:[c.jsx("div",{className:"agentsel-head agentsel-preview-head",children:c.jsxs("div",{className:`agentsel-detail-tabs is-${t}`,role:"tablist","aria-label":"详情类型",children:[c.jsx("span",{className:"agentsel-detail-tabs-slider","aria-hidden":!0}),c.jsx("button",{id:"agentsel-agent-tab",type:"button",role:"tab","aria-selected":t==="agent","aria-controls":"agentsel-agent-panel",onClick:()=>n("agent"),children:"Agent 信息"}),c.jsx("button",{id:"agentsel-runtime-tab",type:"button",role:"tab","aria-selected":t==="runtime","aria-controls":"agentsel-runtime-panel",onClick:()=>n("runtime"),children:"Runtime 信息"})]})}),c.jsx("div",{id:"agentsel-agent-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-agent-tab",hidden:t!=="agent",children:c.jsx(KJ,{runtime:e})}),c.jsx("div",{id:"agentsel-runtime-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-runtime-tab",hidden:t!=="runtime",children:c.jsx(YJ,{runtime:e})})]})}function KJ({runtime:e}){const[t,n]=v.useState(null),[r,i]=v.useState(!0),[s,a]=v.useState(""),o=e.runtimeId,l=e.region;v.useEffect(()=>{let d=!0;return n(null),i(!0),a(""),SR(o,l).then(f=>d&&n(f)).catch(f=>{if(!d)return;const h=f instanceof Error?f.message:String(f);a(UM(h))}).finally(()=>d&&i(!1)),()=>{d=!1}},[o,l]);const u=(t==null?void 0:t.components)??[];return c.jsx("div",{className:"agentsel-detail-body",children:r?c.jsxs("div",{className:"agentsel-panel-state",children:[c.jsx(_t,{className:"icon spin"})," 读取 Agent 信息…"]}):s?c.jsxs("div",{className:"agentsel-panel-empty",children:[c.jsx("span",{children:"暂时无法读取 Agent 信息"}),c.jsx("small",{title:s,children:s})]}):t?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"agentsel-identity",children:[c.jsx(Xu,{className:"agentsel-identity-icon"}),c.jsxs("div",{className:"agentsel-identity-copy",children:[c.jsx("strong",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&c.jsx("span",{title:t.model,children:t.model})]})]}),t.description&&c.jsxs("section",{className:"agentsel-info-section",children:[c.jsx("h3",{children:"描述"}),c.jsx("p",{className:"agentsel-description",title:t.description,children:t.description})]}),t.subAgents.length>0&&c.jsx(mS,{icon:c.jsx(hR,{className:"icon"}),title:"子 Agent",values:t.subAgents}),t.tools.length>0&&c.jsx(mS,{icon:c.jsx(DJ,{}),title:"工具",values:t.tools}),t.skills.length>0&&c.jsxs("section",{className:"agentsel-info-section",children:[c.jsxs("h3",{children:[c.jsx(PJ,{})," 技能"]}),c.jsx("div",{className:"agentsel-info-list",children:t.skills.map(d=>c.jsxs("div",{className:"agentsel-info-list-item",children:[c.jsx("strong",{title:d.name,children:d.name}),d.description&&c.jsx("span",{title:d.description,children:d.description})]},d.name))})]}),u.length>0&&c.jsxs("section",{className:"agentsel-info-section",children:[c.jsxs("h3",{children:[c.jsx(nR,{className:"icon"})," 挂载组件"]}),c.jsx("div",{className:"agentsel-info-list",children:u.map((d,f)=>c.jsxs("div",{className:"agentsel-info-list-item agentsel-component",children:[c.jsxs("div",{className:"agentsel-component-head",children:[c.jsx("strong",{title:d.name,children:d.name}),c.jsxs("span",{children:[HJ(d.kind),d.backend?` · ${zJ(d.backend)}`:""]})]}),d.description&&c.jsx("span",{title:d.description,children:d.description})]},`${d.kind}:${d.name}:${f}`))})]}),!t.description&&t.subAgents.length===0&&t.tools.length===0&&t.skills.length===0&&u.length===0&&c.jsx("div",{className:"agentsel-panel-empty",children:"暂无更多 Agent 配置信息。"})]}):null})}function mS({icon:e,title:t,values:n}){return c.jsxs("section",{className:"agentsel-info-section",children:[c.jsxs("h3",{children:[e,t]}),c.jsx("div",{className:"agentsel-chips",children:n.map((r,i)=>c.jsx("span",{className:"agentsel-chip",title:r,children:r},`${r}:${i}`))})]})}function YJ({runtime:e}){const[t,n]=v.useState(null),[r,i]=v.useState(!0),[s,a]=v.useState(""),o=e.runtimeId,l=e.region;v.useEffect(()=>{let d=!0;return i(!0),a(""),n(null),JE(o,l).then(f=>d&&n(f)).catch(f=>d&&a(UM(f instanceof Error?f.message:String(f)))).finally(()=>d&&i(!1)),()=>{d=!1}},[o,l]);const u=[];if(t){t.model&&u.push(["模型",t.model]),t.description&&u.push(["描述",t.description]),t.status&&u.push(["状态",$M(t.status)]),t.region&&u.push(["区域",FJ(t.region)]);const d=t.resources,f=[d.cpuMilli!=null?`CPU ${d.cpuMilli}m`:"",d.memoryMb!=null?`内存 ${d.memoryMb}MB`:"",d.minInstance!=null||d.maxInstance!=null?`实例 ${d.minInstance??"?"}~${d.maxInstance??"?"}`:""].filter(Boolean).join(" · ");f&&u.push(["资源",f]),t.currentVersion!=null&&u.push(["版本",String(t.currentVersion)])}return c.jsxs("div",{className:"agentsel-detail-body",children:[c.jsxs("div",{className:"agentsel-runtime-identity",children:[c.jsx(FM,{}),c.jsxs("div",{children:[c.jsx("strong",{title:e.name,children:e.name}),c.jsx("span",{title:e.runtimeId,children:e.runtimeId})]})]}),r?c.jsxs("div",{className:"agentsel-apps-note",children:[c.jsx(_t,{className:"icon spin"})," 读取详情…"]}):s?c.jsx("div",{className:"agentsel-error",children:s}):t?c.jsxs(c.Fragment,{children:[c.jsx("dl",{className:"agentsel-kv",children:u.map(([d,f])=>c.jsxs("div",{className:"agentsel-kv-row",children:[c.jsx("dt",{children:d}),c.jsx("dd",{children:f})]},d))}),t.envs.length>0&&c.jsxs("div",{className:"agentsel-envs",children:[c.jsx("div",{className:"agentsel-envs-head",children:"环境变量"}),t.envs.map(d=>c.jsxs("div",{className:"agentsel-env",children:[c.jsx("span",{className:"agentsel-env-k",children:d.key}),c.jsx("span",{className:"agentsel-env-v",children:d.value})]},d.key))]})]}):null]})}function WJ(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}const qJ={ready:"就绪",unreleased:"未发布",running:"运行中",active:"运行中",creating:"创建中",pending:"等待中",deploying:"部署中",updating:"更新中",failed:"失败",error:"异常",stopping:"停止中",stopped:"已停止",deleting:"删除中",deleted:"已删除"};function $M(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return qJ[t]??(e||"-")}const jx="/assets/volcengine-DM14a-L-.svg",gS="(max-width: 860px)",GJ=54;function XJ(){return c.jsxs("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M12.5 3 5.5 13h5l-1 8 8-11h-5l.5-7z",fill:"currentColor",stroke:"none"}),c.jsx("path",{d:"M19 4.5v3M17.5 6h3",opacity:"0.85"})]})}function QJ(){return c.jsxs("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("circle",{cx:"8.25",cy:"7.75",r:"3.15"}),c.jsx("path",{d:"M2.9 19.2c.45-3.45 2.48-5.35 5.35-5.35 2.4 0 4.2 1.28 4.98 3.66"}),c.jsx("path",{d:"M17.4 4.5v15M14.8 9h5.2M14.8 15.3h5.2"}),c.jsx("circle",{cx:"17.4",cy:"9",r:"1.15",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"17.4",cy:"15.3",r:"1.15",fill:"currentColor",stroke:"none"})]})}function ZJ(e){let t=2166136261;for(const r of e)t^=r.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const JJ={admin:"管理员",developer:"开发者",user:"普通用户"};function yS({role:e}){const t=JJ[e];return c.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function eee({access:e,userInfo:t,onLogout:n}){const[r,i]=v.useState(!1),[s,a]=v.useState("");if(!t)return null;const o=VU(t),l=typeof t.email=="string"?t.email:"",u=(o||"U").slice(0,1).toUpperCase(),d=ZJ(o||l||u),f=KU(t),h=f===s?"":f;return c.jsxs("div",{className:"sidebar-user",children:[c.jsxs("button",{className:"sidebar-user-btn",onClick:()=>i(p=>!p),title:l?`${o} -${l}`:o,children:[c.jsxs("span",{className:`account-avatar${h?" has-image":""}`,style:d,children:[u,h?c.jsx("img",{className:"account-avatar-image",src:h,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>a(h)}):null]}),c.jsxs("span",{className:"sidebar-user-identity",children:[c.jsxs("span",{className:"sidebar-user-primary",children:[c.jsx("span",{className:"sidebar-user-name",children:o}),c.jsx(yS,{role:e.role})]}),l&&l!==o&&c.jsx("span",{className:"sidebar-user-email",children:l})]})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>i(!1)}),c.jsxs("div",{className:"account-pop sidebar-user-pop",children:[c.jsxs("div",{className:"account-head",children:[c.jsxs("span",{className:`account-avatar account-avatar--lg${h?" has-image":""}`,style:d,children:[u,h?c.jsx("img",{className:"account-avatar-image",src:h,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>a(h)}):null]}),c.jsxs("div",{className:"account-id",children:[c.jsxs("div",{className:"account-name-row",children:[c.jsx("div",{className:"account-name",children:o}),c.jsx(yS,{role:e.role})]}),l&&l!==o&&c.jsx("div",{className:"account-sub",children:l})]})]}),c.jsxs("button",{className:"account-logout",onClick:()=>{i(!1),n()},children:[c.jsx(EU,{className:"icon"})," 退出登录"]})]})]})]})}function tee({branding:e,sessions:t,currentSessionId:n,features:r,access:i,streamingSids:s,agentsSource:a="local",localApps:o=[],currentAgentId:l="",currentAgentLabel:u="",currentRuntime:d,onSelectAgent:f,onNewChat:h,onSearch:p,onQuickCreate:m,onSkillCenter:y,onAddAgent:w,onManageAgents:g,onPickSession:E,onDeleteSession:b,userInfo:_,onLogout:k}){const T=L=>(r==null?void 0:r[L])!==!1,[C,S]=v.useState(null),[R,I]=v.useState(!1),M=v.useRef(typeof window<"u"&&window.matchMedia(gS).matches),[B,Y]=v.useState(M.current),P=()=>{I(L=>!L)},U=[...t].sort((L,O)=>(O.lastUpdateTime??0)-(L.lastUpdateTime??0)),A=()=>{M.current=!1,Y(L=>!L),I(!1),S(null)};return v.useEffect(()=>{const L=window.matchMedia(gS),O=j=>{j.matches?Y(N=>N||(M.current=!0,!0)):M.current&&(M.current=!1,Y(!1))};return L.addEventListener("change",O),()=>L.removeEventListener("change",O)},[]),c.jsxs("aside",{className:`sidebar ${B?"is-collapsed":""}`,children:[c.jsxs("div",{className:"sidebar-top",children:[c.jsxs("div",{className:"sidebar-brand-row",children:[c.jsxs("div",{className:"brand",children:[c.jsx("img",{className:"brand-logo",src:e.logoUrl||jx,width:20,height:20,alt:"","aria-hidden":!0}),c.jsx("span",{className:"brand-title",children:e.title})]}),c.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:A,"aria-label":B?"展开侧边栏":"收起侧边栏",title:B?"展开侧边栏":"收起侧边栏",children:B?c.jsx(TU,{className:"icon"}):c.jsx(_U,{className:"icon"})})]}),f&&(()=>{const L=a==="cloud"&&!l,O=a==="cloud"&&!L&&!!d,j=a==="cloud"&&!L&&(d!=null&&d.region)?d.region==="cn-beijing"?"北京":d.region==="cn-shanghai"?"上海":d.region:"";return c.jsxs("button",{className:`agent-row ${L?"agent-row--empty":""} ${O?"agent-row--connected":""}`,onClick:P,"aria-label":L?"请选择 Agent":u||"选择 Agent",title:"切换 Agent",children:[c.jsx(Xu,{className:"icon agent-row-lead"}),c.jsx("span",{className:"agent-row-name",children:L?"请选择 Agent":u||"选择 Agent"}),j&&c.jsx("span",{className:"agent-row-region",children:j}),c.jsx(dr,{className:`icon agent-row-chev ${R?"open":""}`})]})})(),f&&c.jsx(UJ,{open:R,onClose:()=>I(!1),anchorTop:GJ,agentsSource:a,localApps:o,currentId:l,currentRuntime:d,runtimeScope:i.capabilities.runtimeScope,onSelect:f}),T("newChat")&&c.jsxs("button",{className:"new-chat",onClick:h,"aria-label":"新会话",title:"新会话",children:[c.jsx(Ei,{className:"icon"}),c.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),T("search")&&c.jsx(IJ,{onClick:p}),T("skillCenter")&&c.jsx(EJ,{onClick:y}),i.capabilities.createAgents&&T("addAgent")&&c.jsxs("button",{className:"new-chat",onClick:m,"aria-label":"添加 Agent",title:"添加 Agent",children:[c.jsx(XJ,{}),c.jsx("span",{className:"sidebar-nav-label",children:"添加 Agent"})]}),i.capabilities.manageAgents&&T("manageAgents")&&c.jsxs("button",{className:"new-chat",onClick:g,"aria-label":"管理 Agent",title:"管理 Agent",children:[c.jsx(QJ,{}),c.jsx("span",{className:"sidebar-nav-label",children:"管理 Agent"})]})]}),T("history")&&c.jsxs("div",{className:"sidebar-history",children:[c.jsxs("div",{className:"history-head",children:[c.jsx("span",{children:"历史会话"}),T("newChat")&&c.jsx("button",{type:"button",className:"history-new-chat",onClick:h,"aria-label":"新建会话",title:"新建会话",children:c.jsx(Ei,{className:"icon"})})]}),c.jsxs("div",{className:"history-list",children:[U.length===0&&c.jsx("div",{className:"history-empty",children:"暂无会话"}),U.map(L=>{const O=UR(L.events);return c.jsxs("div",{className:`history-item ${L.id===n?"active":""}`,children:[c.jsxs("button",{className:"history-item-btn",onClick:()=>E(L.id),title:O,children:[(s==null?void 0:s.has(L.id))&&c.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),c.jsx("span",{className:"history-title",children:O})]}),c.jsx("button",{className:"history-more",title:"更多",onClick:()=>S(j=>j===L.id?null:L.id),children:c.jsx(rU,{className:"icon"})}),C===L.id&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>S(null)}),c.jsx("div",{className:"history-menu",children:c.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{S(null),b(L.id)},children:[c.jsx(Vl,{className:"icon"})," 删除"]})})]})]},L.id)})]})]}),c.jsx(eee,{access:i,userInfo:_,onLogout:k})]})}function nee({apps:e,appName:t,onAppChange:n,agentLabel:r,title:i,crumbs:s,rightContent:a}){return c.jsxs("div",{className:"navbar",children:[c.jsxs("div",{className:"navbar-left",children:[c.jsx("div",{className:"navbar-default",children:s&&s.length>0?c.jsx("nav",{className:"navbar-crumbs","aria-label":"面包屑",children:s.map((o,l)=>c.jsxs(v.Fragment,{children:[l>0&&c.jsx(dr,{className:"crumb-sep"}),o.onClick?c.jsx("button",{className:"crumb crumb-link",onClick:o.onClick,children:o.label}):c.jsx("span",{className:"crumb crumb-current",children:o.label})]},l))}):i?c.jsx("div",{className:"navbar-title",title:i,children:i}):c.jsx(ree,{apps:e,appName:t,onAppChange:n,agentLabel:r})}),c.jsx("div",{id:"veadk-page-header-left",className:"navbar-portal-slot"})]}),c.jsxs("div",{className:"navbar-right",children:[c.jsx("div",{id:"veadk-page-header-actions",className:"navbar-portal-actions"}),a]})]})}function ree({apps:e,appName:t,onAppChange:n,agentLabel:r}){const[i,s]=v.useState(!1),[a,o]=v.useState(null),[l,u]=v.useState({}),[d,f]=v.useState(0),h=v.useRef({}),p=w=>r?r(w):w;function m(w){o(w);const g=h.current[w];if(g){const E=g.getBoundingClientRect(),b=g.closest(".agent-dd");if(b){const _=b.getBoundingClientRect();f(E.top-_.top)}}l[w]===void 0&&(u(E=>({...E,[w]:"loading"})),wd(w).then(E=>u(b=>({...b,[w]:E}))).catch(()=>u(E=>({...E,[w]:"error"}))))}function y(){s(!1),o(null)}return c.jsxs("div",{className:"agent-dd",children:[c.jsxs("button",{className:"agent-dd-trigger",onClick:()=>s(w=>!w),children:[c.jsx("span",{className:"agent-dd-current",children:t?p(t):"选择 Agent"}),c.jsx(gp,{className:`agent-dd-chev ${i?"open":""}`})]}),i&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:y}),c.jsx("div",{className:"agent-dd-menu",children:e.map(w=>c.jsx("div",{ref:g=>h.current[w]=g,className:"agent-dd-row",onMouseEnter:()=>m(w),onMouseLeave:()=>o(g=>g===w?null:g),children:c.jsxs("button",{className:`agent-dd-item ${w===t?"active":""}`,onClick:()=>{n(w),y()},children:[c.jsx("span",{className:"agent-dd-item-name",children:p(w)}),w===t&&c.jsx("span",{className:"agent-dd-item-dot","aria-label":"当前"})]})},w))}),a&&c.jsx(iee,{state:l[a],top:d})]})]})}function iee({state:e,top:t}){return c.jsx("div",{className:"agent-dd-flyout",style:{top:`${t}px`},children:e===void 0||e==="loading"?c.jsxs("div",{className:"agent-dd-fly-loading",children:[c.jsx(_t,{className:"icon spin"})," 加载中…"]}):e==="error"?c.jsx("div",{className:"agent-dd-fly-loading",children:"读取信息失败"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"agent-dd-fly-name",children:e.name}),e.description&&c.jsx("div",{className:"agent-dd-fly-desc",children:e.description}),c.jsxs("div",{className:"agent-dd-fly-field",children:[c.jsx(iR,{className:"icon"}),c.jsx("span",{className:"agent-dd-fly-model",children:e.model})]}),e.tools.length>0&&c.jsxs("div",{className:"agent-dd-fly-field agent-dd-fly-field--tools",children:[c.jsx(qE,{className:"icon"}),c.jsx("div",{className:"agent-dd-fly-chips",children:e.tools.map(n=>c.jsx("span",{className:"agent-dd-chip",children:n},n))})]}),e.subAgents.length>0&&c.jsxs("div",{className:"agent-dd-fly-field",children:[c.jsx("span",{className:"agent-dd-fly-label",children:"子 Agent"}),c.jsx("span",{className:"agent-dd-fly-model",children:e.subAgents.join("、")})]})]})})}const bS={llm:{icon:Ka,label:"LLM"},sequential:{icon:cR,label:"顺序"},parallel:{icon:mR,label:"并行"},loop:{icon:WE,label:"循环"},a2a:{icon:wm,label:"A2A"}};function HM(e){return 1+e.children.reduce((t,n)=>t+HM(n),0)}function Sl(e){return e.id||e.name}function see(e,t){const n=Sl(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const r=/^agent_sub_(\d+)$/.exec(n);return r?`子 Agent ${r[1]}`:e.name||n}function zM(e,t=!0){return{...e,id:Sl(e),name:see(e,t),children:e.children.map(n=>zM(n,!1))}}function VM(e,t){t.set(Sl(e),e.name||Sl(e)),e.children.forEach(n=>VM(n,t))}function KM({node:e,activeAgent:t,seen:n,path:r}){const i=bS[e.type]??bS.llm,s=i.icon,a=Sl(e),o=!!a,l=o&&a===t,u=o&&!l&&r.has(a),d=o&&!l&&!u&&n.has(a);return c.jsxs("div",{className:"topo-branch",children:[c.jsxs("div",{className:`topo-node topo-type-${e.type} ${l?"is-active":""} ${u?"is-onpath":""} ${d?"is-done":""}`,title:e.description||e.name,children:[c.jsx(s,{className:"topo-icon"}),c.jsx("span",{className:"topo-name",children:e.name||"(未命名)"}),c.jsx("span",{className:"topo-badge",children:i.label})]}),l&&e.type==="a2a"&&c.jsx("div",{className:"topo-remote",children:"远程执行中…"}),e.children.length>0&&c.jsx("div",{className:"topo-children",children:e.children.map((f,h)=>c.jsx(KM,{node:f,activeAgent:t,seen:n,path:r},`${Sl(f)}-${h}`))})]})}function ES({appName:e,activeAgent:t,seenAgents:n,execPath:r=[]}){const[i,s]=v.useState(null);if(v.useEffect(()=>{let l=!1;if(s(null),!!e)return wd(e).then(u=>{l||s(u.graph?zM(u.graph):null)}).catch(()=>{l||s(null)}),()=>{l=!0}},[e]),!i||i.children.length===0)return null;const a=new Set(r),o=new Map;return VM(i,o),c.jsxs("aside",{className:"topo","aria-label":"Agent 拓扑",children:[c.jsxs("div",{className:"topo-head",children:[c.jsx("span",{className:"topo-head-title",children:"Agent 拓扑"}),c.jsxs("span",{className:"topo-head-sub",children:[HM(i)," 个"]})]}),r.length>0&&c.jsx("div",{className:"topo-path","aria-label":"执行路径",children:r.map((l,u)=>c.jsxs("span",{className:"topo-path-seg",children:[u>0&&c.jsx(dr,{className:"topo-path-sep"}),c.jsx("span",{className:u===r.length-1?"topo-path-name is-current":"topo-path-name",children:o.get(l)??l})]},`${l}-${u}`))}),c.jsx("div",{className:"topo-tree",children:c.jsx(KM,{node:i,activeAgent:t,seen:n,path:a})})]})}function aee({onAdded:e,onCancel:t}){const[n,r]=v.useState(""),[i,s]=v.useState(""),[a,o]=v.useState(""),[l,u]=v.useState(!1),[d,f]=v.useState(""),h=n.trim().length>0&&i.trim().length>0&&!l;async function p(){if(h){u(!0),f("");try{const m=await jM(a,n,i,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(qa(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return c.jsx("div",{className:"addagent",children:c.jsxs("div",{className:"addagent-card",children:[c.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),c.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),c.jsxs("label",{className:"addagent-field",children:[c.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),c.jsx("input",{className:"addagent-input",value:n,onChange:m=>r(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),c.jsxs("label",{className:"addagent-field",children:[c.jsx("span",{className:"addagent-label",children:"API Key"}),c.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:m=>s(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),c.jsxs("label",{className:"addagent-field",children:[c.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),c.jsx("input",{className:"addagent-input",value:a,onChange:m=>o(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&c.jsx("div",{className:"addagent-error",children:d}),c.jsxs("div",{className:"addagent-actions",children:[c.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:l,children:"取消"}),c.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[l?c.jsx(_t,{className:"icon spin"}):null,l?"连接中…":"连接并添加"]})]})]})})}function oee({currentRuntimeId:e,onConnect:t}){const[n,r]=v.useState([]),[i,s]=v.useState(!0),[a,o]=v.useState(""),[l,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(null),[m,y]=v.useState({}),[w,g]=v.useState("cn-beijing"),[E,b]=v.useState(!1),_=v.useCallback(async()=>{s(!0),o("");try{r(await IR(w))}catch(R){o(R instanceof Error?R.message:String(R))}finally{s(!1)}},[w]);v.useEffect(()=>{_()},[_]);async function k(R){y(M=>({...M,[R.runtimeId]:{loading:!0}}));const I={loading:!1};try{I.detail=await JE(R.runtimeId,R.region)}catch(M){I.error=M instanceof Error?M.message:String(M)}I.detail&&(I.graphs=[{name:I.detail.name,description:I.detail.description,type:"llm",model:I.detail.model,tools:[],skills:[],path:[I.detail.name],mentionable:!1,children:[]}],I.graphNote="仅显示主 Agent(控制面信息)。"),y(M=>({...M,[R.runtimeId]:I}))}function T(R){const I=h===R.runtimeId;p(I?null:R.runtimeId),!I&&!m[R.runtimeId]&&k(R)}async function C(R){if(!l&&window.confirm(`确定删除 Agent "${R.name}"?该 Runtime 将被永久删除。`)){u(R.runtimeId),o("");try{await DR(R.runtimeId,R.region),r(I=>I.filter(M=>M.runtimeId!==R.runtimeId))}catch(I){o(I instanceof Error?I.message:String(I))}finally{u(null)}}}async function S(R){if(!(d||e===R.runtimeId)){f(R.runtimeId),o("");try{await t(R)}catch(I){o(I instanceof Error?I.message:String(I))}finally{f(null)}}}return c.jsxs("div",{className:"manage",children:[c.jsxs("div",{className:"manage-head",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"manage-title",children:"管理 Agent"}),c.jsx("p",{className:"manage-sub",children:"列出你有权管理的 AgentKit Runtime"})]}),c.jsxs("div",{className:"manage-head-actions",children:[c.jsxs("div",{className:"manage-region-picker",onKeyDown:R=>{R.key==="Escape"&&b(!1)},children:[c.jsxs("button",{type:"button",className:"manage-region",onClick:()=>b(R=>!R),title:"按区域筛选","aria-label":"区域筛选","aria-haspopup":"listbox","aria-expanded":E,children:[c.jsx("span",{children:w==="cn-beijing"?"北京":"上海"}),c.jsx(gp,{className:`manage-region-chevron${E?" is-open":""}`})]}),E&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>b(!1)}),c.jsx("div",{className:"manage-region-menu",role:"listbox","aria-label":"区域",children:[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}].map(R=>{const I=R.value===w;return c.jsxs("button",{type:"button",role:"option","aria-selected":I,className:`manage-region-option${I?" is-selected":""}`,onClick:()=>{g(R.value),b(!1)},children:[c.jsx("span",{children:R.label}),I&&c.jsx($i,{"aria-hidden":"true"})]},R.value)})})]})]}),c.jsxs("button",{type:"button",className:"manage-refresh",onClick:()=>void _(),disabled:i,title:"刷新",children:[c.jsx(YE,{className:`icon ${i?"spin":""}`}),"刷新"]})]})]}),a&&c.jsx("div",{className:"manage-error",children:a}),i?c.jsxs("div",{className:"manage-empty",children:[c.jsx(_t,{className:"icon spin"})," 加载中…"]}):n.length===0?c.jsx("div",{className:"manage-empty",children:"暂无你部署的 Agent。"}):c.jsx("ul",{className:"manage-list",children:n.map(R=>{const I=h===R.runtimeId,M=m[R.runtimeId];return c.jsxs("li",{className:"manage-item",children:[c.jsxs("div",{className:"manage-item-row",children:[c.jsxs("button",{type:"button",className:"manage-item-toggle",onClick:()=>T(R),"aria-expanded":I,children:[I?c.jsx(gp,{className:"icon"}):c.jsx(dr,{className:"icon"}),c.jsxs("span",{className:"manage-item-main",children:[c.jsx("span",{className:"manage-item-name",children:R.name}),c.jsx("span",{className:`manage-badge is-${fee(R.status)}`,children:R.status||"-"})]})]}),c.jsxs("div",{className:"manage-item-actions",children:[c.jsxs("button",{type:"button",className:"manage-connect",onClick:()=>void S(R),disabled:d!==null||e===R.runtimeId,children:[d===R.runtimeId?c.jsx(_t,{className:"icon spin"}):c.jsx(mU,{className:"icon"}),e===R.runtimeId?"已连接":"连接到此 Agent"]}),c.jsx("button",{type:"button",className:"manage-del",onClick:()=>void C(R),disabled:l===R.runtimeId,title:"删除该 Runtime",children:l===R.runtimeId?c.jsx(_t,{className:"icon spin"}):c.jsx(Vl,{className:"icon"})})]})]}),c.jsxs("div",{className:"manage-item-meta",children:[c.jsx("span",{className:"manage-item-id",title:R.runtimeId,children:R.runtimeId}),c.jsx("span",{className:"manage-item-dot",children:"·"}),c.jsx("span",{children:R.region}),R.createdAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"manage-item-dot",children:"·"}),c.jsx("span",{children:WM(R.createdAt)})]})]}),I&&c.jsx("div",{className:"manage-detail",children:!M||M.loading?c.jsxs("div",{className:"manage-detail-loading",children:[c.jsx(_t,{className:"icon spin"})," 读取详情…"]}):c.jsxs(c.Fragment,{children:[M.error&&c.jsx("div",{className:"manage-error",children:M.error}),M.detail&&c.jsx(uee,{detail:M.detail}),c.jsx("div",{className:"manage-tree-head",children:"Agent 结构"}),M.graphs&&M.graphs.length>0?M.graphs.map((B,Y)=>c.jsx(YM,{node:B},Y)):c.jsx("div",{className:"manage-tree-note",children:M.graphNote})]})})]},R.runtimeId)})})]})}const lee=/KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL/i;function cee({envKey:e,value:t}){const[n,r]=v.useState(!1);return!lee.test(e)||n?c.jsx("code",{className:"manage-env-v",children:t}):c.jsx("button",{type:"button",className:"manage-env-v manage-env-masked",title:"敏感值已隐藏,点击显示","aria-label":`显示 ${e} 的值`,onClick:()=>r(!0),children:"••••••••"})}function uee({detail:e}){const t=e.resources,n=[];e.model&&n.push(["模型",e.model]),e.description&&n.push(["描述",e.description]),e.statusMessage&&n.push(["状态信息",e.statusMessage]),e.project&&n.push(["Project",e.project]),e.currentVersion!=null&&n.push(["版本",String(e.currentVersion)]);const r=[t.cpuMilli!=null?`CPU ${t.cpuMilli}m`:"",t.memoryMb!=null?`内存 ${t.memoryMb}MB`:"",t.minInstance!=null||t.maxInstance!=null?`实例 ${t.minInstance??"?"}~${t.maxInstance??"?"}`:"",t.maxConcurrency!=null?`并发 ${t.maxConcurrency}`:""].filter(Boolean).join(" · ");return r&&n.push(["资源",r]),e.memoryId&&n.push(["Memory",e.memoryId]),e.toolId&&n.push(["Tool",e.toolId]),e.knowledgeId&&n.push(["Knowledge",e.knowledgeId]),e.mcpToolsetId&&n.push(["MCP Toolset",e.mcpToolsetId]),e.updatedAt&&n.push(["更新时间",WM(e.updatedAt)]),c.jsxs("div",{className:"manage-detail-card",children:[c.jsx("dl",{className:"manage-kv",children:n.map(([i,s])=>c.jsxs("div",{className:"manage-kv-row",children:[c.jsx("dt",{children:i}),c.jsx("dd",{children:s})]},i))}),e.envs.length>0&&c.jsxs("div",{className:"manage-envs",children:[c.jsx("div",{className:"manage-envs-head",children:"环境变量"}),e.envs.map(i=>c.jsxs("div",{className:"manage-env",children:[c.jsx("code",{className:"manage-env-k",children:i.key}),c.jsx(cee,{envKey:i.key,value:i.value})]},i.key))]})]})}const dee={llm:"LLM",sequential:"Sequential",parallel:"Parallel",loop:"Loop",a2a:"A2A"};function YM({node:e,depth:t=0}){return c.jsxs("div",{className:"manage-tree",style:{marginLeft:t?16:0},children:[c.jsxs("div",{className:"manage-tree-node",children:[c.jsx("span",{className:"manage-tree-name",children:e.name||"(未命名)"}),c.jsx("span",{className:"manage-tree-type",children:dee[e.type]||e.type}),e.model&&c.jsx("span",{className:"manage-tree-model",children:e.model})]}),e.tools.length>0&&c.jsx("div",{className:"manage-tree-tools",children:e.tools.map(n=>c.jsx("span",{className:"manage-tree-tool",children:n},n))}),e.children.map((n,r)=>c.jsx(YM,{node:n,depth:t+1},r))]})}function fee(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}function WM(e){const t=Number(e),n=Number.isFinite(t)&&String(t)===e?new Date(t*1e3):new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()}const hee={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function pee(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}function mee(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function gee(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function Bx(e,t){if(mee(e))return pee(t,e.path);if(gee(e)){const n=hee[e.call],r={};for(const[i,s]of Object.entries(e.args??{}))r[i]=Bx(s,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function yee(e,t){const n=Bx(e,t);return n==null?"":typeof n=="string"?n:String(n)}const qM=new Map;function uo(e,t){qM.set(e,t)}function bee(e){return qM.get(e)}function Eee(e,t,n){const r=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let s=0;sBx(r,e.dataModel),resolveString:r=>yee(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const i=e.components[r];if(!i)return null;const s=bee(i.component)??xee;return c.jsx(s,{node:i,ctx:n},r)}};return c.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function XM(e){const t=v.useRef(null),n=v.useRef(!0),r=28,i=v.useCallback(()=>{const s=t.current;s&&(n.current=s.scrollHeight-s.scrollTop-s.clientHeight{const s=t.current;s&&n.current&&(s.scrollTop=s.scrollHeight)},[e]),{ref:t,onScroll:i}}function Fx({value:e,onRemoveSkill:t,onRemoveAgent:n}){return e.skills.length===0&&!e.targetAgent?null:c.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(r=>c.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:r.description,children:[c.jsx(Ya,{"aria-hidden":!0}),c.jsxs("span",{children:["/",r.name]}),t?c.jsx("button",{type:"button",onClick:()=>t(r.name),"aria-label":`移除技能 ${r.name}`,children:c.jsx(ti,{})}):null]},r.name)),e.targetAgent?c.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[c.jsx(tR,{"aria-hidden":!0}),c.jsx("span",{children:e.targetAgent.name}),n?c.jsx("button",{type:"button",onClick:n,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:c.jsx(ti,{})}):null]}):null]})}function Ux(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function QM(e){var n,r,i,s;const t=Ux(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((r=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:r.toUpperCase())??"VIDEO":t==="image"?((s=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:s.toUpperCase())??"IMAGE":"TXT"}function ZM(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function JM(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?_R(t,e.uri):""}function vee({kind:e}){return e==="image"?c.jsx(uR,{}):e==="video"?c.jsx(oR,{}):e==="pdf"?c.jsx(oU,{}):c.jsx(aR,{})}function $x({appName:e,items:t,compact:n=!1,onRemove:r}){const[i,s]=v.useState(null);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const o=Ux(a.mimeType),l=JM(a,e),u=a.status==="uploading"||a.status==="error"||!l,d=c.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>s(a),"aria-label":`预览 ${a.name??"附件"}`,children:[o==="image"&&l?c.jsx("img",{className:"media-card-image",src:l,alt:a.name??"图片",loading:"lazy"}):o==="video"&&l?c.jsxs("div",{className:"media-card-video-container",children:[c.jsx("video",{className:"media-card-video",src:l,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),c.jsx("span",{className:"media-card-video-play",children:c.jsx(SU,{})})]}):c.jsx("span",{className:"media-card-icon",children:c.jsx(vee,{kind:o})}),c.jsxs("span",{className:"media-card-copy",children:[c.jsx("span",{className:"media-card-name",children:a.name??"附件"}),c.jsxs("span",{className:"media-card-meta",children:[c.jsx("span",{className:"media-card-type",children:QM(a)}),a.status==="uploading"?c.jsxs(c.Fragment,{children:[c.jsx(_t,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":ZM(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?c.jsx(nu,{className:"media-card-open"}):null]});return c.jsxs(Xt.div,{className:`media-card media-card--${o}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[o==="image"&&!u?c.jsx(XI,{src:l,children:d}):d,r?c.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:c.jsx(ti,{})}):null]},a.id)})}),c.jsx(Ys,{children:i?c.jsx(_ee,{appName:e,item:i,onClose:()=>s(null)}):null})]})}function _ee({appName:e,item:t,onClose:n}){const r=v.useMemo(()=>JM(t,e),[e,t]),i=Ux(t.mimeType),[s,a]=v.useState(""),[o,l]=v.useState(i==="text"||i==="markdown"),[u,d]=v.useState("");return v.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),v.useEffect(()=>{if(i!=="text"&&i!=="markdown")return;const f=new AbortController;return l(!0),d(""),fetch(r,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||l(!1)}),()=>f.abort()},[i,r]),c.jsx(Xt.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:c.jsxs(Xt.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[c.jsxs("header",{className:"media-viewer-header",children:[c.jsxs("div",{children:[c.jsx("strong",{children:t.name??"附件"}),c.jsxs("span",{children:[QM(t),t.sizeBytes?` · ${ZM(t.sizeBytes)}`:""]})]}),c.jsxs("nav",{children:[c.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:c.jsx(zE,{})}),c.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:c.jsx(ti,{})})]})]}),c.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?c.jsx("img",{src:r,alt:t.name??"图片"}):null,i==="video"?c.jsx("div",{className:"media-viewer-video-wrapper",children:c.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?c.jsx("iframe",{src:r,title:t.name??"PDF"}):null,o?c.jsxs("div",{className:"media-viewer-loading",children:[c.jsx(_t,{})," 正在读取文档…"]}):null,!o&&u?c.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!o&&i==="markdown"?c.jsx("div",{className:"media-document",children:c.jsx(Rd,{text:s})}):null,!o&&i==="text"?c.jsx("pre",{className:"media-document media-document--plain",children:s}):null]})]})})}function Zl({as:e="span",className:t="",duration:n=4,spread:r=20,children:i,style:s,...a}){const o=Math.min(Math.max(r,5),45);return c.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...s,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-o}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+o}%)`,animationDuration:`${n}s`},...a,children:i})}function Tee(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),c.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function kee(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),c.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),c.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),c.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function See(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("rect",{x:"3.25",y:"5.5",width:"16.25",height:"13",rx:"2.4"}),c.jsx("path",{d:"m10.2 9.2 4.4 2.8-4.4 2.8V9.2Z"}),c.jsx("path",{d:"m19.25 2.5.42 1.2 1.2.42-1.2.42-.42 1.2-.42-1.2-1.2-.42 1.2-.42.42-1.2Z",fill:"currentColor",stroke:"none"})]})}function Nee(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),c.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),c.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function Aee(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),c.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),c.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),c.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function e3(e){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:c.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Cee({definition:e,done:t,open:n,onToggle:r}){const i=e.icon;return c.jsxs("button",{type:"button",className:`builtin-tool-head${t?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:r,"aria-expanded":n,children:[c.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:c.jsx(i,{})}),t?c.jsx("span",{className:"builtin-tool-label",children:e.doneLabel}):c.jsx(Zl,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:e.runningLabel}),c.jsx(e3,{className:`builtin-tool-chevron${n?" is-open":""}`})]})}const Iee={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Tee},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:kee},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:See},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:Nee},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:Aee}};function Ree(e){return Iee[e]}const t3="send_a2ui_json_to_client";function Oee({className:e}){return c.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function Lee(){return c.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function n3({text:e,done:t}){const[n,r]=v.useState(!t),i=v.useRef(!1);v.useEffect(()=>{i.current||r(!t)},[t]);const s=()=>{i.current=!0,r(u=>!u)},a=e.replace(/^\s+/,""),{ref:o,onScroll:l}=XM(a);return c.jsxs("div",{className:"block-thinking",children:[c.jsxs("button",{className:"think-head",onClick:s,type:"button",children:[c.jsx("span",{className:"think-icon","aria-hidden":"true",children:c.jsx(Oee,{className:`spark ${t?"":"pulse"}`})}),t?c.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):c.jsx(Zl,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),c.jsx(dr,{className:`chev ${n?"open":""}`})]}),c.jsx("div",{className:`think-collapse ${n&&a?"open":""}`,children:c.jsx("div",{className:"think-collapse-inner",children:c.jsx("div",{className:"think-body scroll",ref:o,onScroll:l,children:a})})})]})}function r3(){return c.jsx(n3,{text:"",done:!1})}function Mee({name:e,args:t,response:n,done:r}){const[i,s]=v.useState(!1),a=e===t3?"渲染 UI":e,o=Ree(e),l=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=l&&l.length>2e3?l.slice(0,2e3)+` -…(已截断)`:l;return c.jsxs(Xt.div,{className:`block-tool${o?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o?c.jsx(Cee,{definition:o,done:r,open:i,onToggle:()=>s(d=>!d)}):c.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>s(d=>!d),type:"button","aria-expanded":i,children:[c.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:c.jsx(Lee,{})}),r?c.jsx("span",{className:"tool-name",children:a}):c.jsx(Zl,{className:"tool-name",duration:2.2,spread:15,children:a}),c.jsx(e3,{className:`tool-chevron${i?" is-open":""}`})]}),c.jsx("div",{className:`think-collapse ${i?"open":""}`,children:c.jsx("div",{className:"think-collapse-inner",children:c.jsxs("div",{className:"tool-detail",children:[t!=null&&c.jsxs("div",{className:"tool-section",children:[c.jsx("div",{className:"tool-section-label",children:"参数"}),c.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&c.jsxs("div",{className:"tool-section",children:[c.jsx("div",{className:"tool-section-label",children:"返回"}),c.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function Dee({block:e,onAuth:t}){const[n,r]=v.useState(e.done?"done":"idle"),[i,s]=v.useState(""),a=e.label||"MCP 工具集",o=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),l=async()=>{if(t){s(""),r("authorizing");try{await t(e),r("done")}catch(d){s(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?c.jsxs(Xt.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[c.jsx(fT,{className:"auth-card-icon auth-card-icon--done"}),c.jsxs("span",{children:["已授权 · ",a]})]}):c.jsxs(Xt.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[c.jsxs("div",{className:"auth-card-head",children:[c.jsx(fT,{className:"auth-card-icon"}),c.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),c.jsxs("p",{className:"auth-card-desc",children:["工具集 ",c.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",o&&c.jsxs(c.Fragment,{children:[" ","将跳转至 ",c.jsx("code",{className:"auth-card-code",children:o})," 完成登录,"]}),"授权完成后对话自动继续。"]}),c.jsx("button",{className:"auth-card-btn",onClick:l,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?c.jsxs(c.Fragment,{children:[c.jsx(_t,{className:"cw-i spin"})," 等待授权…"]}):c.jsx(c.Fragment,{children:"去授权"})}),!e.authUri&&c.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&c.jsx("div",{className:"auth-card-err",children:i})]})}function Hx({blocks:e,appName:t="",onAction:n,onAuth:r}){return c.jsx(c.Fragment,{children:e.map((i,s)=>{switch(i.kind){case"thinking":return c.jsx(n3,{text:i.text,done:i.done},s);case"text":{const a=i.text.replace(/^\s+/,"");return a?c.jsx("div",{className:"bubble",children:c.jsx(Rd,{text:a})},s):null}case"attachment":return c.jsx($x,{appName:t,items:i.files},s);case"invocation":return c.jsx(Fx,{value:i.value},s);case"tool":return i.name===t3&&i.done?null:c.jsx(Mee,{name:i.name,args:i.args,response:i.response,done:i.done},s);case"auth":return c.jsx(Dee,{block:i,onAuth:r},s);case"a2ui":return GM(i.messages).filter(a=>a.components[a.rootId]).map(a=>c.jsx(Xt.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:c.jsx(wee,{surface:a,onAction:n})},`${s}-${a.surfaceId}`));default:return null}})})}function Pee(e){return e.isComposing||e.keyCode===229}const Ni=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"临时会话",description:"在 AgentKit 沙箱中执行一次性任务"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}];function xS({mode:e}){return e==="skill-create"?c.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),c.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?c.jsx("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{d:"M4.1 4.2h11.8v8.7H9l-3.5 2.8v-2.8H4.1z",strokeDasharray:"2.25 1.9"})}):c.jsx(Xu,{className:"new-chat-mode__agent-icon"})}function jee({value:e,agentName:t,onChange:n,disabled:r=!1,temporaryEnabled:i,skillCreateEnabled:s}){const[a,o]=v.useState(!1),[l,u]=v.useState(()=>Ni.findIndex(E=>E.value===e)),d=v.useRef(null),f=v.useRef(null),h=Ni.find(E=>E.value===e)??Ni[0];function p(E){return E.value==="temporary"?i:E.value==="skill-create"?s:!0}function m(E){return p(E)!==!0}function y(E){const b=p(E);return b===void 0?"正在检查配置":b?E.description:"管理员未配置"}v.useEffect(()=>{if(!a)return;const E=b=>{var _;(_=d.current)!=null&&_.contains(b.target)||o(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[a]);function w(E){let b=l;do b=(b+E+Ni.length)%Ni.length;while(m(Ni[b]));u(b)}function g(E){var b;m(E)||(n(E.value),o(!1),(b=f.current)==null||b.focus())}return c.jsxs("div",{className:"new-chat-mode",ref:d,children:[c.jsxs("button",{ref:f,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":a,disabled:r,onClick:()=>{u(Ni.findIndex(E=>E.value===e)),o(E=>!E)},onKeyDown:E=>{E.key==="ArrowDown"||E.key==="ArrowUp"?(E.preventDefault(),a?w(E.key==="ArrowDown"?1:-1):o(!0)):a&&(E.key==="Enter"||E.key===" ")?(E.preventDefault(),g(Ni[l])):a&&E.key==="Escape"&&(E.preventDefault(),o(!1))},children:[c.jsx("span",{className:"new-chat-mode__icon",children:c.jsx(xS,{mode:h.value})}),c.jsx("span",{className:"new-chat-mode__current",title:h.value==="agent"?t:void 0,children:h.value==="agent"?t:h.label}),c.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:c.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),a?c.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:E=>{var b;E.key==="ArrowDown"||E.key==="ArrowUp"?(E.preventDefault(),w(E.key==="ArrowDown"?1:-1)):E.key==="Enter"?(E.preventDefault(),g(Ni[l])):E.key==="Escape"&&(E.preventDefault(),o(!1),(b=f.current)==null||b.focus())},children:Ni.map((E,b)=>c.jsxs("button",{type:"button",role:"option","aria-selected":e===E.value,"aria-disabled":m(E),disabled:m(E),className:`new-chat-mode__option${b===l?" is-active":""}`,onMouseEnter:()=>u(b),onClick:()=>g(E),children:[c.jsx("span",{className:"new-chat-mode__option-icon",children:c.jsx(xS,{mode:E.value})}),c.jsxs("span",{className:"new-chat-mode__copy",children:[c.jsxs("span",{className:"new-chat-mode__label",children:[E.value==="agent"?t:E.label,E.value==="skill-create"?c.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),c.jsx("span",{children:y(E)})]}),e===E.value?c.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},E.value))}):null]})}const zx=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function Bee({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:r,value:i,onChange:s,onSubmit:a,disabled:o,busy:l,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:y=!0,onInvocationChange:w,onAddFiles:g,onRemoveAttachment:E,newChatMode:b="agent",newChatLayout:_=!1,showModeSelector:k=!1,onModeChange:T,temporaryEnabled:C,skillCreateEnabled:S}){const R=v.useRef(null),I=v.useRef(null),M=v.useRef(null),B=v.useRef(null),[Y,P]=v.useState(!1),[U,A]=v.useState(null),[L,O]=v.useState(0),[j,N]=v.useState(!1);async function H(){if(e)try{await navigator.clipboard.writeText(e),N(!0),setTimeout(()=>N(!1),1500)}catch{N(!1)}}v.useLayoutEffect(()=>{const Z=R.current;Z&&(Z.style.height="auto",Z.style.height=`${Math.min(Z.scrollHeight,200)}px`)},[i]);const V=b==="skill-create";v.useEffect(()=>{V&&(P(!1),A(null))},[V]);const D=!V&&d.some(Z=>Z.status!=="ready"),ne=!o&&!l&&!D&&(i.trim().length>0||!V&&d.length>0),J=(U==null?void 0:U.query.toLocaleLowerCase())??"",re=(U==null?void 0:U.kind)==="skill"?f.filter(Z=>!p.skills.some(ce=>ce.name===Z.name)).filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(J)).map(Z=>({kind:"skill",value:Z})):(U==null?void 0:U.kind)==="agent"?h.filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(J)).map(Z=>({kind:"agent",value:Z})):[];function de(Z){var ce;P(!1),A(null),(ce=Z.current)==null||ce.click()}function G(Z,ce){const Ie=Z.slice(0,ce),xe=/(^|\s)([/@])([^\s/@]*)$/.exec(Ie);if(!xe){A(null);return}const ge=xe[2].length+xe[3].length,De={kind:xe[2]==="/"?"skill":"agent",query:xe[3],start:ce-ge,end:ce},_e=!U||U.kind!==De.kind||U.query!==De.query||U.start!==De.start||U.end!==De.end;A(De),_e&&O(0),P(!1)}function W(Z){if(!U)return;const ce=i.slice(0,U.start)+i.slice(U.end);s(ce),Z.kind==="skill"?w({...p,skills:[...p.skills,Z.value]}):w({skills:[],targetAgent:Z.value});const Ie=U.start;A(null),requestAnimationFrame(()=>{var xe,ge;(xe=R.current)==null||xe.focus(),(ge=R.current)==null||ge.setSelectionRange(Ie,Ie)})}function ae(){if(p.targetAgent){w({skills:[]});return}p.skills.length>0&&w({...p,skills:p.skills.slice(0,-1)})}function he(Z){const ce=Z.target.files?Array.from(Z.target.files):[];ce.length&&g(ce),Z.target.value=""}return c.jsxs("div",{className:`composer${_?" composer--new-chat":""}`,children:[V?null:c.jsx(Fx,{value:p,onRemoveSkill:Z=>w({...p,skills:p.skills.filter(ce=>ce.name!==Z)}),onRemoveAgent:()=>w({skills:[]})}),!V&&d.length>0&&c.jsx($x,{appName:n,compact:!0,items:d,onRemove:E}),c.jsxs("div",{className:"composer-box",children:[U?c.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":U.kind==="skill"?"可用技能":"可用子 Agent",children:[c.jsxs("div",{className:"composer-command-head",children:[U.kind==="skill"?c.jsx(Ya,{}):c.jsx(tR,{}),c.jsx("span",{children:U.kind==="skill"?"调用技能":"使用子 Agent"}),c.jsx("kbd",{children:U.kind==="skill"?"/":"@"})]}),m?c.jsxs("div",{className:"composer-command-empty",children:[c.jsx(_t,{className:"spin"})," 正在读取 Agent 能力…"]}):re.length===0?c.jsx("div",{className:"composer-command-empty",children:U.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):c.jsx("div",{className:"composer-command-list",children:re.map((Z,ce)=>c.jsxs("button",{type:"button",role:"option","aria-selected":ce===L,className:`composer-command-item${ce===L?" is-active":""}`,onMouseDown:Ie=>{Ie.preventDefault(),W(Z)},onMouseEnter:()=>O(ce),children:[c.jsx("span",{className:`composer-command-icon composer-command-icon--${Z.kind}`,children:Z.kind==="skill"?c.jsx(Ya,{}):c.jsx(Ka,{})}),c.jsxs("span",{className:"composer-command-copy",children:[c.jsxs("strong",{children:[Z.kind==="skill"?"/":"@",Z.value.name]}),c.jsx("span",{children:Z.value.description||(Z.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),c.jsx("kbd",{children:ce===L?"↵":Z.kind==="skill"?"技能":"Agent"})]},`${Z.kind}-${Z.value.name}`))})]}):null,V?null:c.jsxs("div",{className:"composer-menu-wrap",children:[c.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:o||!y,onClick:()=>{A(null),P(Z=>!Z)},children:c.jsx(Ei,{className:"icon"})}),Y&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>P(!1)}),c.jsxs("div",{className:"composer-menu",role:"menu",children:[c.jsxs("button",{type:"button",className:"menu-item",onClick:()=>de(I),children:[c.jsx(uR,{className:"icon"}),"上传图片"]}),c.jsxs("button",{type:"button",className:"menu-item",onClick:()=>de(M),children:[c.jsx(aR,{className:"icon"}),"上传文档或 PDF"]}),c.jsxs("button",{type:"button",className:"menu-item",onClick:()=>de(B),children:[c.jsx(oR,{className:"icon"}),"上传视频"]})]})]})]}),c.jsx("div",{className:"composer-input-stack",children:c.jsx("textarea",{ref:R,className:"comp-input scroll",rows:_?4:1,value:i,disabled:o,placeholder:V?`描述你想创建的 Skill,将使用 ${zx.join(" 和 ")} 并行创建…`:o?"请选择 Agent":`向 ${r} 发消息…`,"aria-expanded":!!U,onChange:Z=>{s(Z.target.value),V||G(Z.target.value,Z.target.selectionStart)},onSelect:Z=>{V||G(Z.currentTarget.value,Z.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>A(null),0),onKeyDown:Z=>{if(!Pee(Z.nativeEvent)){if(U){if(Z.key==="ArrowDown"&&re.length>0){Z.preventDefault(),O(ce=>(ce+1)%re.length);return}if(Z.key==="ArrowUp"&&re.length>0){Z.preventDefault(),O(ce=>(ce-1+re.length)%re.length);return}if((Z.key==="Enter"||Z.key==="Tab")&&re[L]){Z.preventDefault(),W(re[L]);return}if(Z.key==="Escape"){Z.preventDefault(),A(null);return}}if(Z.key==="Backspace"&&!i&&Z.currentTarget.selectionStart===0&&Z.currentTarget.selectionEnd===0){ae();return}Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),ne&&a())}}})}),k&&T?c.jsx(jee,{value:b,agentName:r,onChange:T,disabled:l,temporaryEnabled:C,skillCreateEnabled:S}):null,c.jsx(Xt.button,{type:"button",className:"comp-send",disabled:!ne,onClick:a,"aria-label":"发送",whileTap:ne?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:l?c.jsx(_t,{className:"icon spin"}):c.jsx(eR,{className:"icon"})})]}),u&&c.jsxs("div",{className:"composer-meta",children:[c.jsxs("span",{className:"composer-session-line",children:["会话 ID:",c.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&c.jsx("button",{type:"button",className:"composer-session-copy",title:j?"已复制":"复制会话 ID","aria-label":j?"已复制会话 ID":"复制会话 ID",onClick:()=>void H(),children:j?c.jsx($i,{}):c.jsx(HE,{})})]}),c.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),c.jsx("span",{children:"回答仅供参考"})]}),c.jsx("input",{ref:I,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:he}),c.jsx("input",{ref:M,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:he}),c.jsx("input",{ref:B,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:he})]})}function i3({title:e,sub:t,cards:n,footer:r}){return c.jsxs("div",{className:"stk",children:[c.jsxs("div",{className:"stk-head",children:[c.jsx("h1",{className:"stk-title",children:e}),t&&c.jsx("p",{className:"stk-sub",children:t})]}),c.jsx("div",{className:"stk-list",children:n.map((i,s)=>c.jsxs(Xt.button,{type:"button",className:`stk-card ${i.disabled?"stk-card-disabled":""}`,onClick:i.disabled?void 0:i.onClick,disabled:i.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:s*.04},children:[c.jsx("span",{className:"stk-card-icon",children:c.jsx(i.icon,{})}),c.jsxs("span",{className:"stk-card-text",children:[c.jsx("span",{className:"stk-card-title",children:i.title}),c.jsx("span",{className:"stk-card-desc",children:i.desc})]}),c.jsx(dr,{className:"stk-card-arrow"})]},i.key))}),r&&c.jsx("div",{className:"stk-footer",children:r})]})}const Vx=Symbol.for("yaml.alias"),Y1=Symbol.for("yaml.document"),Ws=Symbol.for("yaml.map"),s3=Symbol.for("yaml.pair"),Ui=Symbol.for("yaml.scalar"),Jl=Symbol.for("yaml.seq"),ni=Symbol.for("yaml.node.type"),ec=e=>!!e&&typeof e=="object"&&e[ni]===Vx,Od=e=>!!e&&typeof e=="object"&&e[ni]===Y1,Ld=e=>!!e&&typeof e=="object"&&e[ni]===Ws,yn=e=>!!e&&typeof e=="object"&&e[ni]===s3,Ft=e=>!!e&&typeof e=="object"&&e[ni]===Ui,Md=e=>!!e&&typeof e=="object"&&e[ni]===Jl;function mn(e){if(e&&typeof e=="object")switch(e[ni]){case Ws:case Jl:return!0}return!1}function gn(e){if(e&&typeof e=="object")switch(e[ni]){case Vx:case Ws:case Ui:case Jl:return!0}return!1}const a3=e=>(Ft(e)||mn(e))&&!!e.anchor,ba=Symbol("break visit"),Fee=Symbol("skip children"),hu=Symbol("remove node");function tc(e,t){const n=Uee(t);Od(e)?Wo(null,e.contents,n,Object.freeze([e]))===hu&&(e.contents=null):Wo(null,e,n,Object.freeze([]))}tc.BREAK=ba;tc.SKIP=Fee;tc.REMOVE=hu;function Wo(e,t,n,r){const i=$ee(e,t,n,r);if(gn(i)||yn(i))return Hee(e,r,i),Wo(e,i,n,r);if(typeof i!="symbol"){if(mn(t)){r=Object.freeze(r.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>zee[t]);class lr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},lr.defaultYaml,t),this.tags=Object.assign({},lr.defaultTags,n)}clone(){const t=new lr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new lr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:lr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},lr.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:lr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},lr.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+Vee(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let i;if(t&&r.length>0&&gn(t.contents)){const s={};tc(t.contents,(a,o)=>{gn(o)&&o.tag&&(s[o.tag]=!0)}),i=Object.keys(s)}else i=[];for(const[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(o=>o.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(` -`)}}lr.defaultYaml={explicit:!1,version:"1.2"};lr.defaultTags={"!!":"tag:yaml.org,2002:"};function o3(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function l3(e){const t=new Set;return tc(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function c3(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function Kee(e,t){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i??(i=l3(e));const a=c3(t,i);return i.add(a),a},setAnchors:()=>{for(const s of n){const a=r.get(s);if(typeof a=="object"&&a.anchor&&(Ft(a.node)||mn(a.node)))a.node.anchor=a.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=s,o}}},sourceObjects:r}}function qo(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iZr(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!a3(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class Kx{constructor(t){Object.defineProperty(this,ni,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!Od(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Zr(this,"",a);if(typeof i=="function")for(const{count:l,res:u}of a.anchors.values())i(u,l);return typeof s=="function"?qo(s,{"":o},"",o):o}}class Yx extends Kx{constructor(t){super(Vx),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],tc(t,{Node:(s,a)=>{(ec(a)||a3(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let i;for(const s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:i,maxAliasCount:s}=n,a=this.resolve(i,n);if(!a){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=r.get(a);if(o||(Zr(a,null,n),o=r.get(a)),(o==null?void 0:o.res)===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Sh(i,a,r)),o.count*o.aliasCount>s)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(t,n,r){const i=`*${this.source}`;if(t){if(o3(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}}function Sh(e,t,n){if(ec(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(mn(t)){let r=0;for(const i of t.items){const s=Sh(e,i,n);s>r&&(r=s)}return r}else if(yn(t)){const r=Sh(e,t.key,n),i=Sh(e,t.value,n);return Math.max(r,i)}return 1}const u3=e=>!e||typeof e!="function"&&typeof e!="object";class Qe extends Kx{constructor(t){super(Ui),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Zr(this.value,t,n)}toString(){return String(this.value)}}Qe.BLOCK_FOLDED="BLOCK_FOLDED";Qe.BLOCK_LITERAL="BLOCK_LITERAL";Qe.PLAIN="PLAIN";Qe.QUOTE_DOUBLE="QUOTE_DOUBLE";Qe.QUOTE_SINGLE="QUOTE_SINGLE";const Yee="tag:yaml.org,2002:";function Wee(e,t,n){if(t){const r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>{var i;return((i=r.identify)==null?void 0:i.call(r,e))&&!r.format})}function Qu(e,t,n){var f,h,p;if(Od(e)&&(e=e.contents),gn(e))return e;if(yn(e)){const m=(h=(f=n.schema[Ws]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:a,sourceObjects:o}=n;let l;if(r&&e&&typeof e=="object"){if(l=o.get(e),l)return l.anchor??(l.anchor=i(e)),new Yx(l.anchor);l={anchor:null,node:null},o.set(e,l)}t!=null&&t.startsWith("!!")&&(t=Yee+t.slice(2));let u=Wee(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new Qe(e);return l&&(l.node=m),m}u=e instanceof Map?a[Ws]:Symbol.iterator in Object(e)?a[Jl]:a[Ws]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new Qe(e);return t?d.tag=t:u.default||(d.tag=u.tag),l&&(l.node=d),d}function Mp(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){const s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return Qu(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Fc=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class d3 extends Kx{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>gn(r)||yn(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Fc(t))this.add(n);else{const[r,...i]=t,s=this.get(r,!0);if(mn(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,Mp(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const i=this.get(n,!0);if(mn(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&Ft(s)?s.value:s:mn(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!yn(n))return!1;const r=n.value;return r==null||t&&Ft(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const i=this.get(n,!0);return mn(i)?i.hasIn(r):!1}setIn(t,n){const[r,...i]=t;if(i.length===0)this.set(r,n);else{const s=this.get(r,!0);if(mn(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,Mp(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const qee=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function ts(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Aa=(e,t,n)=>e.endsWith(` -`)?ts(n,t):n.includes(` -`)?` -`+ts(n,t):(e.endsWith(" ")?"":" ")+n,f3="flow",W1="block",Nh="quoted";function Um(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:a,onOverflow:o}={}){if(!i||i<0)return e;ii-Math.max(2,s)?u.push(0):f=i-r);let h,p,m=!1,y=-1,w=-1,g=-1;n===W1&&(y=wS(e,y,t.length),y!==-1&&(f=y+l));for(let b;b=e[y+=1];){if(n===Nh&&b==="\\"){switch(w=y,e[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}g=y}if(b===` -`)n===W1&&(y=wS(e,y,t.length)),f=y+t.length+l,h=void 0;else{if(b===" "&&p&&p!==" "&&p!==` -`&&p!==" "){const _=e[y+1];_&&_!==" "&&_!==` -`&&_!==" "&&(h=y)}if(y>=f)if(h)u.push(h),f=h+l,h=void 0;else if(n===Nh){for(;p===" "||p===" ";)p=b,b=e[y+=1],m=!0;const _=y>g+1?y-2:w-1;if(d[_])return e;u.push(_),d[_]=!0,f=_+l,h=void 0}else m=!0}p=b}if(m&&o&&o(),u.length===0)return e;a&&a();let E=e.slice(0,u[0]);for(let b=0;b({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Hm=e=>/^(%|---|\.\.\.)/m.test(e);function Gee(e,t,n){if(!t||t<0)return!1;const r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,a=0;sr)return!0;if(a=s+1,i-a<=r)return!1}return!0}function pu(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(Hm(e)?" ":"");let a="",o=0;for(let l=0,u=n[l];u;u=n[++l])if(u===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(o,l)+"\\ ",l+=1,o=l,u="\\"),u==="\\")switch(n[l+1]){case"u":{a+=n.slice(o,l);const d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,o=l+1}break;case"n":if(r||n[l+2]==='"'||n.length -`;let f,h;for(h=n.length;h>0;--h){const k=n[h-1];if(k!==` -`&&k!==" "&&k!==" ")break}let p=n.substring(h);const m=p.indexOf(` -`);m===-1?f="-":n===p||m!==p.length-1?(f="+",s&&s()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(G1,`$&${u}`));let y=!1,w,g=-1;for(w=0;w{T=!0});const S=Um(`${E}${k}${p}`,u,W1,C);if(!T)return`>${_} -${u}${S}`}return n=n.replace(/\n+/g,`$&${u}`),`|${_} -${u}${E}${n}${p}`}function Xee(e,t,n,r){const{type:i,value:s}=e,{actualString:a,implicitKey:o,indent:l,indentStep:u,inFlow:d}=t;if(o&&s.includes(` -`)||d&&/[[\]{},]/.test(s))return Go(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return o||d||!s.includes(` -`)?Go(s,t):Ah(e,t,n,r);if(!o&&!d&&i!==Qe.PLAIN&&s.includes(` -`))return Ah(e,t,n,r);if(Hm(s)){if(l==="")return t.forceBlockIndent=!0,Ah(e,t,n,r);if(o&&l===u)return Go(s,t)}const f=s.replace(/\n+/g,`$& -${l}`);if(a){const h=y=>{var w;return y.default&&y.tag!=="tag:yaml.org,2002:str"&&((w=y.test)==null?void 0:w.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Go(s,t)}return o?f:Um(f,l,f3,$m(t,!1))}function Wx(e,t,n,r){const{implicitKey:i,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:o}=e;o!==Qe.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=Qe.QUOTE_DOUBLE);const l=d=>{switch(d){case Qe.BLOCK_FOLDED:case Qe.BLOCK_LITERAL:return i||s?Go(a.value,t):Ah(a,t,n,r);case Qe.QUOTE_DOUBLE:return pu(a.value,t);case Qe.QUOTE_SINGLE:return q1(a.value,t);case Qe.PLAIN:return Xee(a,t,n,r);default:return null}};let u=l(o);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=l(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function h3(e,t){const n=Object.assign({blockQuote:!0,commentString:qee,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Qee(e,t){var i;if(t.tag){const s=e.filter(a=>a.tag===t.tag);if(s.length>0)return s.find(a=>a.format===t.format)??s[0]}let n,r;if(Ft(t)){r=t.value;let s=e.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(s.length>1){const a=s.filter(o=>o.test);a.length>0&&(s=a)}n=s.find(a=>a.format===t.format)??s.find(a=>!a.format)}else r=t,n=e.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!n){const s=((i=r==null?void 0:r.constructor)==null?void 0:i.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${s} value`)}return n}function Zee(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(Ft(e)||mn(e))&&e.anchor;s&&o3(s)&&(n.add(s),i.push(`&${s}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(r.directives.tagString(a)),i.join(" ")}function Nl(e,t,n,r){var l;if(yn(e))return e.toString(t,n,r);if(ec(e)){if(t.doc.directives)return e.toString(t);if((l=t.resolvedAliases)!=null&&l.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const s=gn(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=Qee(t.doc.schema.tags,s));const a=Zee(s,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const o=typeof i.stringify=="function"?i.stringify(s,t,n,r):Ft(s)?Wx(s,t,n,r):s.toString(t,n,r);return a?Ft(s)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} -${t.indent}${o}`:o}function Jee({key:e,value:t},n,r,i){const{allNullValues:s,doc:a,indent:o,indentStep:l,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=gn(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(mn(e)||!gn(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||mn(e)||(Ft(e)?e.type===Qe.BLOCK_FOLDED||e.type===Qe.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!s),indent:o+l});let m=!1,y=!1,w=Nl(e,n,()=>m=!0,()=>y=!0);if(!p&&!n.inFlow&&w.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||t==null)return m&&r&&r(),w===""?"?":p?`? ${w}`:w}else if(s&&!f||t==null&&p)return w=`? ${w}`,h&&!m?w+=Aa(w,n.indent,u(h)):y&&i&&i(),w;m&&(h=null),p?(h&&(w+=Aa(w,n.indent,u(h))),w=`? ${w} -${o}:`):(w=`${w}:`,h&&(w+=Aa(w,n.indent,u(h))));let g,E,b;gn(t)?(g=!!t.spaceBefore,E=t.commentBefore,b=t.comment):(g=!1,E=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&Ft(t)&&(n.indentAtStart=w.length+1),y=!1,!d&&l.length>=2&&!n.inFlow&&!p&&Md(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const k=Nl(t,n,()=>_=!0,()=>y=!0);let T=" ";if(h||g||E){if(T=g?` -`:"",E){const C=u(E);T+=` -${ts(C,n.indent)}`}k===""&&!n.inFlow?T===` -`&&b&&(T=` - -`):T+=` -${n.indent}`}else if(!p&&mn(t)){const C=k[0],S=k.indexOf(` -`),R=S!==-1,I=n.inFlow??t.flow??t.items.length===0;if(R||!I){let M=!1;if(R&&(C==="&"||C==="!")){let B=k.indexOf(" ");C==="&"&&B!==-1&&Be===Ff||typeof e=="symbol"&&e.description===Ff,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Qe(Symbol(Ff)),{addToJSMap:m3}),stringify:()=>Ff},ete=(e,t)=>(os.identify(t)||Ft(t)&&(!t.type||t.type===Qe.PLAIN)&&os.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===os.tag&&n.default));function m3(e,t,n){const r=g3(e,n);if(Md(r))for(const i of r.items)T0(e,t,i);else if(Array.isArray(r))for(const i of r)T0(e,t,i);else T0(e,t,r)}function T0(e,t,n){const r=g3(e,n);if(!Ld(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,e,Map);for(const[s,a]of i)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function g3(e,t){return e&&ec(t)?t.resolve(e.doc,e):t}function y3(e,t,{key:n,value:r}){if(gn(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(ete(e,n))m3(e,t,r);else{const i=Zr(n,"",e);if(t instanceof Map)t.set(i,Zr(r,i,e));else if(t instanceof Set)t.add(i);else{const s=tte(n,i,e),a=Zr(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function tte(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(gn(e)&&(n!=null&&n.doc)){const r=h3(n.doc,{});r.anchors=new Set;for(const s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;const i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),p3(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function qx(e,t,n){const r=Qu(e,void 0,n),i=Qu(t,void 0,n);return new fr(r,i)}class fr{constructor(t,n=null){Object.defineProperty(this,ni,{value:s3}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return gn(n)&&(n=n.clone(t)),gn(r)&&(r=r.clone(t)),new fr(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return y3(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Jee(this,t,n,r):JSON.stringify(this)}}function b3(e,t,n){return(t.inFlow??e.flow?rte:nte)(e,t,n)}function nte({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:a,onComment:o}){const{indent:l,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null});let f=!1;const h=[];for(let m=0;mw=null,()=>f=!0);w&&(g+=Aa(g,s,u(w))),f&&w&&(f=!1),h.push(r+g)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;mw=null);u||(u=f.length>d||g.includes(` -`)),m0&&(u||(u=f.reduce((E,b)=>E+b.length+2,2)+(g.length+2)>t.options.lineWidth)),u&&(g+=",")),w&&(g+=Aa(g,r,o(w))),f.push(g),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((y,w)=>y+w.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const y of f)m+=y?` -${s}${i}${y}`:` -`;return`${m} -${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function Dp({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=ts(t(r),e);n.push(s.trimStart())}}function Ca(e,t){const n=Ft(t)?t.value:t;for(const r of e)if(yn(r)&&(r.key===t||r.key===n||Ft(r.key)&&r.key.value===n))return r}class Gr extends d3{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ws,t),this.items=[]}static from(t,n,r){const{keepUndefined:i,replacer:s}=r,a=new this(t),o=(l,u)=>{if(typeof s=="function")u=s.call(n,l,u);else if(Array.isArray(s)&&!s.includes(l))return;(u!==void 0||i)&&a.items.push(qx(l,u,r))};if(n instanceof Map)for(const[l,u]of n)o(l,u);else if(n&&typeof n=="object")for(const l of Object.keys(n))o(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;yn(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new fr(t,t==null?void 0:t.value):r=new fr(t.key,t.value);const i=Ca(this.items,r.key),s=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ft(i.value)&&u3(r.value)?i.value.value=r.value:i.value=r.value}else if(s){const o=this.items.findIndex(l=>s(r,l)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){const n=Ca(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=Ca(this.items,t),i=r==null?void 0:r.value;return(!n&&Ft(i)?i.value:i)??void 0}has(t){return!!Ca(this.items,t)}set(t,n){this.add(new fr(t,n),!0)}toJSON(t,n,r){const i=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const s of this.items)y3(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(const i of this.items)if(!yn(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),b3(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const nc={collection:"map",default:!0,nodeClass:Gr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Ld(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Gr.from(e,t,n)};class Ga extends d3{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Jl,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=Uf(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=Uf(t);if(typeof r!="number")return;const i=this.items[r];return!n&&Ft(i)?i.value:i}has(t){const n=Uf(t);return typeof n=="number"&&n=0?t:null}const rc={collection:"seq",default:!0,nodeClass:Ga,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Md(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ga.from(e,t,n)},zm={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Wx(e,t,n,r)}},Vm={identify:e=>e==null,createNode:()=>new Qe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Qe(null),stringify:({source:e},t)=>typeof e=="string"&&Vm.test.test(e)?e:t.options.nullStr},Gx={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Qe(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Gx.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function _i({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let o=t-(s.length-a-1);for(;o-- >0;)s+="0"}return s}const E3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_i},x3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():_i(e)}},w3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Qe(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:_i},Km=e=>typeof e=="bigint"||Number.isInteger(e),Xx=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function v3(e,t,n){const{value:r}=e;return Km(r)&&r>=0?n+r.toString(t):_i(e)}const _3={identify:e=>Km(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Xx(e,2,8,n),stringify:e=>v3(e,8,"0o")},T3={identify:Km,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Xx(e,0,10,n),stringify:_i},k3={identify:e=>Km(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Xx(e,2,16,n),stringify:e=>v3(e,16,"0x")},ite=[nc,rc,zm,Vm,Gx,_3,T3,k3,E3,x3,w3];function vS(e){return typeof e=="bigint"||Number.isInteger(e)}const $f=({value:e})=>JSON.stringify(e),ste=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:$f},{identify:e=>e==null,createNode:()=>new Qe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:$f},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:$f},{identify:vS,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>vS(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:$f}],ate={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},ote=[nc,rc].concat(ste,ate),Qx={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i1&&t("Each pair must have its own sequence indicator");const i=r.items[0]||new fr(new Qe(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore} -${i.key.commentBefore}`:r.commentBefore),r.comment){const s=i.value??i.key;s.comment=s.comment?`${r.comment} -${s.comment}`:r.comment}r=i}e.items[n]=yn(r)?r:new fr(r)}}else t("Expected a sequence for this tag");return e}function N3(e,t,n){const{replacer:r}=n,i=new Ga(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let o,l;if(Array.isArray(a))if(a.length===2)o=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)o=u[0],l=a[o];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else o=a;i.items.push(qx(o,l,n))}return i}const Zx={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:S3,createNode:N3};class al extends Ga{constructor(){super(),this.add=Gr.prototype.add.bind(this),this.delete=Gr.prototype.delete.bind(this),this.get=Gr.prototype.get.bind(this),this.has=Gr.prototype.has.bind(this),this.set=Gr.prototype.set.bind(this),this.tag=al.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const i of this.items){let s,a;if(yn(i)?(s=Zr(i.key,"",n),a=Zr(i.value,s,n)):s=Zr(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){const i=N3(t,n,r),s=new this;return s.items=i.items,s}}al.tag="tag:yaml.org,2002:omap";const Jx={collection:"seq",identify:e=>e instanceof Map,nodeClass:al,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=S3(e,t),r=[];for(const{key:i}of n.items)Ft(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new al,n)},createNode:(e,t,n)=>al.from(e,t,n)};function A3({value:e,source:t},n){return t&&(e?C3:I3).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const C3={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Qe(!0),stringify:A3},I3={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Qe(!1),stringify:A3},lte={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_i},cte={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():_i(e)}},ute={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Qe(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:_i},Dd=e=>typeof e=="bigint"||Number.isInteger(e);function Ym(e,t,n,{intAsBigInt:r}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return i==="-"?BigInt(-1)*a:a}const s=parseInt(e,n);return i==="-"?-1*s:s}function ew(e,t,n){const{value:r}=e;if(Dd(r)){const i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return _i(e)}const dte={identify:Dd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Ym(e,2,2,n),stringify:e=>ew(e,2,"0b")},fte={identify:Dd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Ym(e,1,8,n),stringify:e=>ew(e,8,"0")},hte={identify:Dd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Ym(e,0,10,n),stringify:_i},pte={identify:Dd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Ym(e,2,16,n),stringify:e=>ew(e,16,"0x")};class ol extends Gr{constructor(t){super(t),this.tag=ol.tag}add(t){let n;yn(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new fr(t.key,null):n=new fr(t,null),Ca(this.items,n.key)||this.items.push(n)}get(t,n){const r=Ca(this.items,t);return!n&&yn(r)?Ft(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=Ca(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new fr(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push(qx(a,null,r));return s}}ol.tag="tag:yaml.org,2002:set";const tw={collection:"map",identify:e=>e instanceof Set,nodeClass:ol,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>ol.from(e,t,n),resolve(e,t){if(Ld(e)){if(e.hasAllNullValues(!0))return Object.assign(new ol,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function nw(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,o)=>a*i(60)+i(o),i(0));return n==="-"?i(-1)*s:s}function R3(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return _i(e);let r="";t<0&&(r="-",t*=n(-1));const i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const O3={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>nw(e,n),stringify:R3},L3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>nw(e,!1),stringify:R3},Wm={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(Wm.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,s,a,o]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,i,s||0,a||0,o||0,l);const d=t[8];if(d&&d!=="Z"){let f=nw(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},_S=[nc,rc,zm,Vm,C3,I3,dte,fte,hte,pte,lte,cte,ute,Qx,os,Jx,Zx,tw,O3,L3,Wm],TS=new Map([["core",ite],["failsafe",[nc,rc,zm]],["json",ote],["yaml11",_S],["yaml-1.1",_S]]),kS={binary:Qx,bool:Gx,float:w3,floatExp:x3,floatNaN:E3,floatTime:L3,int:T3,intHex:k3,intOct:_3,intTime:O3,map:nc,merge:os,null:Vm,omap:Jx,pairs:Zx,seq:rc,set:tw,timestamp:Wm},mte={"tag:yaml.org,2002:binary":Qx,"tag:yaml.org,2002:merge":os,"tag:yaml.org,2002:omap":Jx,"tag:yaml.org,2002:pairs":Zx,"tag:yaml.org,2002:set":tw,"tag:yaml.org,2002:timestamp":Wm};function k0(e,t,n){const r=TS.get(t);if(r&&!e)return n&&!r.includes(os)?r.concat(os):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{const s=Array.from(TS.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(const s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(os)),i.reduce((s,a)=>{const o=typeof a=="string"?kS[a]:a;if(!o){const l=JSON.stringify(a),u=Object.keys(kS).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return s.includes(o)||s.push(o),s},[])}const gte=(e,t)=>e.keyt.key?1:0;class rw{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?k0(t,"compat"):t?k0(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?mte:{},this.tags=k0(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Ws,{value:nc}),Object.defineProperty(this,Ui,{value:zm}),Object.defineProperty(this,Jl,{value:rc}),this.sortMapEntries=typeof a=="function"?a:a===!0?gte:null}clone(){const t=Object.create(rw.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function yte(e,t){var l;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const i=h3(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(ts(u,""))}let a=!1,o=null;if(e.contents){if(gn(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(ts(f,""))}i.forceBlockIndent=!!e.comment,o=e.contents.comment}const u=o?void 0:()=>a=!0;let d=Nl(e.contents,i,()=>o=null,u);o&&(d+=Aa(d,"",s(o))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Nl(e.contents,i));if((l=e.directives)!=null&&l.docEnd)if(e.comment){const u=s(e.comment);u.includes(` -`)?(n.push("..."),n.push(ts(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(ts(s(u),"")))}return n.join(` -`)+` -`}class Pd{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ni,{value:Y1});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new lr({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){const t=Object.create(Pd.prototype,{[ni]:{value:Y1}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=gn(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){xo(this.contents)&&this.contents.add(t)}addIn(t,n){xo(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=l3(this);t.anchor=!n||r.has(n)?c3(n||"a",r):n}return new Yx(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const w=E=>typeof E=="number"||E instanceof String||E instanceof Number,g=n.filter(w).map(String);g.length>0&&(n=n.concat(g)),i=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:a,flow:o,keepUndefined:l,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Kee(this,a||"a"),m={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},y=Qu(t,d,m);return o&&mn(y)&&(y.flow=!0),h(),y}createPair(t,n,r={}){const i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new fr(i,s)}delete(t){return xo(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Fc(t)?this.contents==null?!1:(this.contents=null,!0):xo(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return mn(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Fc(t)?!n&&Ft(this.contents)?this.contents.value:this.contents:mn(this.contents)?this.contents.getIn(t,n):void 0}has(t){return mn(this.contents)?this.contents.has(t):!1}hasIn(t){return Fc(t)?this.contents!==void 0:mn(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Mp(this.schema,[t],n):xo(this.contents)&&this.contents.set(t,n)}setIn(t,n){Fc(t)?this.contents=n:this.contents==null?this.contents=Mp(this.schema,Array.from(t),n):xo(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new lr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new lr({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new rw(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:a}={}){const o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Zr(this.contents,n??"",o);if(typeof s=="function")for(const{count:u,res:d}of o.anchors.values())s(d,u);return typeof a=="function"?qo(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return yte(this,t)}}function xo(e){if(mn(e))return!0;throw new Error("Expected a YAML collection as document contents")}class M3 extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}}class Uc extends M3{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class bte extends M3{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const SS=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){const o=Math.min(s-39,a.length-79);a="…"+a.substring(o),s-=o-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,s))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`… -`),a=o+a}if(/[^ ]/.test(a)){let o=1;const l=n.linePos[1];(l==null?void 0:l.line)===r&&l.col>i&&(o=Math.max(1,Math.min(l.col-i,80-s)));const u=" ".repeat(s)+"^".repeat(o);n.message+=`: - -${a} -${u} -`}};function Al(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:o}){let l=!1,u=o,d=o,f="",h="",p=!1,m=!1,y=null,w=null,g=null,E=null,b=null,_=null,k=null;for(const S of e)switch(m&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&s(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),y&&(u&&S.type!=="comment"&&S.type!=="newline"&&s(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),S.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&S.source.includes(" ")&&(y=S),d=!0;break;case"comment":{d||s(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const R=S.source.substring(1)||" ";f?f+=h+R:f=R,h="",u=!1;break}case"newline":u?f?f+=S.source:(!_||n!=="seq-item-ind")&&(l=!0):h+=S.source,u=!0,p=!0,(w||g)&&(E=S),d=!0;break;case"anchor":w&&s(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&s(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),w=S,k??(k=S.offset),u=!1,d=!1,m=!0;break;case"tag":{g&&s(S,"MULTIPLE_TAGS","A node can have at most one tag"),g=S,k??(k=S.offset),u=!1,d=!1,m=!0;break}case n:(w||g)&&s(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),_&&s(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),_=S,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&s(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=S,u=!1,d=!1;break}default:s(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),u=!1,d=!1}const T=e[e.length-1],C=T?T.offset+T.source.length:i;return m&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(u&&y.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&s(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:_,spaceBefore:l,comment:f,hasNewline:p,anchor:w,tag:g,newlineAfterProp:E,end:C,start:k??C}}function Zu(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` -`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(Zu(t.key)||Zu(t.value))return!0}return!1;default:return!0}}function X1(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Zu(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function D3(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,a)=>s===a||Ft(s)&&Ft(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}const NS="All mapping items must start at the same column";function Ete({composeNode:e,composeEmptyNode:t},n,r,i,s){var d;const a=(s==null?void 0:s.nodeClass)??Gr,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,u=null;for(const f of r.items){const{start:h,key:p,sep:m,value:y}=f,w=Al(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!w.found;if(g){if(p&&(p.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&i(l,"BAD_INDENT",NS)),!w.anchor&&!w.tag&&!m){u=w.end,w.comment&&(o.comment?o.comment+=` -`+w.comment:o.comment=w.comment);continue}(w.newlineAfterProp||Zu(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=w.found)==null?void 0:d.indent)!==r.indent&&i(l,"BAD_INDENT",NS);n.atKey=!0;const E=w.end,b=p?e(n,p,w,i):t(n,E,h,null,w,i);n.schema.compat&&X1(r.indent,p,i),n.atKey=!1,D3(n,o.items,b)&&i(E,"DUPLICATE_KEY","Map keys must be unique");const _=Al(m??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:i,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(l=_.end,_.found){g&&((y==null?void 0:y.type)==="block-map"&&!_.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&w.start<_.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=y?e(n,y,_,i):t(n,l,m,null,_,i);n.schema.compat&&X1(r.indent,y,i),l=k.range[2];const T=new fr(b,k);n.options.keepSourceTokens&&(T.srcToken=f),o.items.push(T)}else{g&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(b.comment?b.comment+=` -`+_.comment:b.comment=_.comment);const k=new fr(b);n.options.keepSourceTokens&&(k.srcToken=f),o.items.push(k)}}return u&&ue&&(e.type==="block-map"||e.type==="block-seq");function wte({composeNode:e,composeEmptyNode:t},n,r,i,s){var w;const a=r.start.source==="{",o=a?"flow map":"flow sequence",l=(s==null?void 0:s.nodeClass)??(a?Gr:Ga),u=new l(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let g=0;g0){const g=jd(m,y,n.options.strict,i);g.comment&&(u.comment?u.comment+=` -`+g.comment:u.comment=g.comment),u.range=[r.offset,y,g.offset]}else u.range=[r.offset,y,y];return u}function A0(e,t,n,r,i,s){const a=n.type==="block-map"?Ete(e,t,n,r,s):n.type==="block-seq"?xte(e,t,n,r,s):wte(e,t,n,r,s),o=a.constructor;return i==="!"||i===o.tagName?(a.tag=o.tagName,a):(i&&(a.tag=i),a)}function vte(e,t,n,r,i){var h;const s=r.tag,a=s?t.directives.tagName(s.source,p=>i(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=r,y=p&&s?p.offset>s.offset?p:s:p??s;y&&(!m||m.offsetp.tag===a&&p.collection===o);if(!l){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===o)t.schema.tags.push(Object.assign({},p,{default:!1})),l=p;else return p?i(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),A0(e,t,n,i,a)}const u=A0(e,t,n,i,a,l),d=((h=l.resolve)==null?void 0:h.call(l,u,p=>i(s,"TAG_RESOLVE_FAILED",p),t.options))??u,f=gn(d)?d:new Qe(d);return f.range=u.range,f.tag=a,l!=null&&l.format&&(f.format=l.format),f}function _te(e,t,n){const r=t.offset,i=Tte(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?Qe.BLOCK_FOLDED:Qe.BLOCK_LITERAL,a=t.source?kte(t.source):[];let o=a.length;for(let y=a.length-1;y>=0;--y){const w=a[y][1];if(w===""||w==="\r")o=y;else break}if(o===0){const y=i.chomp==="+"&&a.length>0?` -`.repeat(Math.max(1,a.length-1)):"";let w=r+i.length;return t.source&&(w+=t.source.length),{value:y,type:s,comment:i.comment,range:[r,w,w]}}let l=t.indent+i.indent,u=t.offset+i.length,d=0;for(let y=0;yl&&(l=w.length);else{w.length=o;--y)a[y][0].length>l&&(o=y+1);let f="",h="",p=!1;for(let y=0;yl||g[0]===" "?(h===" "?h=` -`:!p&&h===` -`&&(h=` - -`),f+=h+w.slice(l)+g,h=` -`,p=!0):g===""?h===` -`?f+=` -`:h=` -`:(f+=h+g,h=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let y=o;yn(r+h,p,m);switch(i){case"scalar":o=Qe.PLAIN,l=Nte(s,u);break;case"single-quoted-scalar":o=Qe.QUOTE_SINGLE,l=Ate(s,u);break;case"double-quoted-scalar":o=Qe.QUOTE_DOUBLE,l=Cte(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}const d=r+s.length,f=jd(a,d,t,n);return{value:l,type:o,comment:f.comment,range:[r,d,f.offset]}}function Nte(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),P3(e)}function Ate(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),P3(e.slice(1,-1)).replace(/''/g,"'")}function P3(e){let t,n;try{t=new RegExp(`(.*?)(?s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Ite(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` -`||r==="\r")&&!(r==="\r"&&e[t+2]!==` -`);)r===` -`&&(n+=` -`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}const Rte={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ote(e,t,n,r){const i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{const o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}function j3(e,t,n,r){const{value:i,type:s,comment:a,range:o}=t.type==="block-scalar"?_te(e,t,r):Ste(t,e.options.strict,r),l=n?e.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[Ui]:l?u=Lte(e.schema,i,l,n,r):t.type==="scalar"?u=Mte(e,i,t,r):u=e.schema[Ui];let d;try{const f=u.resolve(i,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Ft(f)?f:new Qe(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new Qe(i)}return d.range=o,d.source=i,s&&(d.type=s),l&&(d.tag=l),u.format&&(d.format=u.format),a&&(d.comment=a),d}function Lte(e,t,n,r,i){var o;if(n==="!")return e[Ui];const s=[];for(const l of e.tags)if(!l.collection&&l.tag===n)if(l.default&&l.test)s.push(l);else return l;for(const l of s)if((o=l.test)!=null&&o.test(t))return l;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ui])}function Mte({atKey:e,directives:t,schema:n},r,i,s){const a=n.tags.find(o=>{var l;return(o.default===!0||e&&o.default==="key")&&((l=o.test)==null?void 0:l.test(r))})||n[Ui];if(n.compat){const o=n.compat.find(l=>{var u;return l.default&&((u=l.test)==null?void 0:u.test(r))})??n[Ui];if(a.tag!==o.tag){const l=t.tagString(a.tag),u=t.tagString(o.tag),d=`Value may be parsed as either ${l} or ${u}`;s(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function Dte(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++r];break}}return e}const Pte={composeNode:B3,composeEmptyNode:iw};function B3(e,t,n,r){const i=e.atKey,{spaceBefore:s,comment:a,anchor:o,tag:l}=n;let u,d=!0;switch(t.type){case"alias":u=jte(e,t,r),(o||l)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=j3(e,t,l,r),o&&(u.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=vte(Pte,e,t,n,r),o&&(u.anchor=o.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=iw(e,t.offset,void 0,null,n,r)),o&&u.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Ft(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function iw(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:o,end:l},u){const d={type:"scalar",offset:Dte(t,n,r),indent:-1,source:""},f=j3(e,d,o,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=l),f}function jte({options:e},{offset:t,source:n,end:r},i){const s=new Yx(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,o=jd(r,a,e.strict,i);return s.range=[t,a,o.offset],o.comment&&(s.comment=o.comment),s}function Bte(e,t,{offset:n,start:r,value:i,end:s},a){const o=Object.assign({_directives:t},e),l=new Pd(void 0,o),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=Al(r,{indicator:"doc-start",next:i??(s==null?void 0:s[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?B3(u,i,d,a):iw(u,d.end,r,null,d,a);const f=l.contents.range[2],h=jd(s,f,!1,a);return h.comment&&(l.comment=h.comment),l.range=[n,f,h.offset],l}function Tc(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function AS(e){var i;let t="",n=!1,r=!1;for(let s=0;s{const a=Tc(n);s?this.warnings.push(new bte(a,r,i)):this.errors.push(new Uc(a,r,i))},this.directives=new lr({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:i}=AS(this.prelude);if(r){const s=t.contents;if(n)t.comment=t.comment?`${t.comment} -${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(mn(s)&&!s.flow&&s.items.length>0){let a=s.items[0];yn(a)&&(a=a.key);const o=a.commentBefore;a.commentBefore=o?`${r} -${o}`:r}else{const a=s.commentBefore;s.commentBefore=a?`${r} -${a}`:r}}if(n){for(let s=0;s{const s=Tc(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Bte(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Uc(Tc(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new Uc(Tc(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=jd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Uc(Tc(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),i=new Pd(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}const F3="\uFEFF",U3="",$3="",Q1="";function Ute(e){switch(e){case F3:return"byte-order-mark";case U3:return"doc-mode";case $3:return"flow-error-end";case Q1:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` -`:case`\r -`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function ai(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const CS=new Set("0123456789ABCDEFabcdef"),$te=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Hf=new Set(",[]{}"),Hte=new Set(` ,[]{} -\r `),C0=e=>!e||Hte.has(e);class zte{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` -`?!0:n==="\r"?this.buffer[t+1]===` -`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){const i=this.buffer[r+t+1];if(i===` -`||!i&&!this.atEnd)return t+r+1}return n===` -`||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&ai(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!ai(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ai(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(C0),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ai(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case` -`:t=s,n=0;break;case"\r":{const a=this.buffer[s+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===` -`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(` -`,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===` -`;)r=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let s=t-1,a=this.buffer[s];a==="\r"&&(a=this.buffer[--s]);const o=s;for(;a===" ";)a=this.buffer[--s];if(a===` -`&&s>=this.pos&&s+1+n>o)t=s;else break}while(!0);return yield Q1,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){const s=this.buffer[r+1];if(ai(s)||t&&Hf.has(s))break;n=r}else if(ai(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===` -`?(r+=1,i=` -`,s=this.buffer[r+1]):n=r),s==="#"||t&&Hf.has(s))break;if(i===` -`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Hf.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Q1,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(C0),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(ai(r)||n&&Hf.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!ai(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if($te.has(n))n=this.buffer[++t];else if(n==="%"&&CS.has(this.buffer[t+1])&&CS.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` -`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");const i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class Vte{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[s]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function Pp(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&RS(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&IS(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,s=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(s&&n.sep&&!n.value){const o=[];for(let l=0;lt.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Is(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(H3(n.key)&&!Is(n.sep,"newline")){const o=wo(n.start),l=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Is(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=wo(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Is(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);s||n.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Is(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const i="end"in n.value?n.value.end:void 0,s=Array.isArray(i)?i[i.length-1]:void 0;(s==null?void 0:s.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const i=t.items[t.items.length-2],s=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(s)){Pp(s,n.start),s.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Is(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while((r==null?void 0:r.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const i=zf(r),s=wo(i);RS(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` -`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` -`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=zf(t),r=wo(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=zf(t),r=wo(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Yte(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Vte||null,prettyErrors:t}}function Wte(e,t={}){const{lineCounter:n,prettyErrors:r}=Yte(t),i=new Kte(n==null?void 0:n.addNewLine),s=new Fte(t);let a=null;for(const o of s.compose(i.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Uc(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(SS(e,n)),a.warnings.forEach(SS(e,n))),a}function qte(e,t,n){let r;const i=Wte(e,n);if(!i)return null;if(i.warnings.forEach(s=>p3(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Gte(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Od(e)&&!r?e.toString(n):new Pd(e,r,n).toString(n)}const Xte="https://ark.cn-beijing.volces.com/api/v3/",mu=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:Xte}],Cl=[],kc=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],ls={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},z3=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请输入智能体中心 ID,如 as-yer579143kbrkemozdn6",comment:"AgentKit 智能体中心 ID"},{key:"REGISTRY_TOP_K",required:!1,placeholder:ls.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:ls.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:ls.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],sw=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Cl},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Cl},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],jp=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],Bp=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:mu,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...mu],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...mu],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:Cl},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}]}],Fp=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:mu,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...mu],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:Cl},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Cl,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],Up=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...Cl,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Qte=e=>sw.find(t=>t.id===e),Zte=e=>jp.find(t=>t.id===e),Jte=e=>Bp.find(t=>t.id===e),ene=e=>Fp.find(t=>t.id===e),tne=e=>Up.find(t=>t.id===e),nne="doubao-seed-2-1-pro-260628",rne="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",ine=`你是一个专业、可靠的智能助手。 - -你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 - -约束: -- 信息不足时主动提问澄清,不要臆造事实。 -- 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function ea(){return{name:"",description:rne,instruction:ine,agentType:"llm",maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:nne,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:"local",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}const sne=new Set(["local","sqlite","mysql","postgresql"]),ane=new Set(["local","opensearch","redis","viking","mem0"]),one=new Set(["local","opensearch","viking","context_search"]),lne=new Set(["apmplus","cozeloop","tls"]),V3=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","vesearch"]),cne=new Set(["llm","sequential","parallel","loop","a2a"]);function ut(e,t=""){return typeof e=="string"?e:t}function Ea(e){return e===!0}function Ch(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function K3(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:ut(t.name),description:ut(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function I0(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function Y3(e){return typeof e=="string"&&cne.has(e)?e:"llm"}function W3(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function q3(e){const t=e&&typeof e=="object"?e:{};return{enabled:Ea(t.enabled),registrySpaceId:ut(t.registrySpaceId),registryTopK:ut(t.registryTopK),registryRegion:ut(t.registryRegion),registryEndpoint:ut(t.registryEndpoint)}}function G3(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},r=q3(n.a2aRegistry),i=Y3(n.agentType),s=r.enabled&&i==="llm"?"a2a":i;return{...ea(),name:ut(n.name),description:ut(n.description),instruction:ut(n.instruction),agentType:s,maxIterations:W3(n.maxIterations),a2aUrl:ut(n.a2aUrl),builtinTools:Ch(n.builtinTools).filter(a=>V3.has(a)),customTools:K3(n.customTools),a2aRegistry:s==="a2a"?{...r,enabled:!0}:r,subAgents:G3(n.subAgents)}}):[]}function une(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const r=n&&typeof n=="object"?n:{},i=ut(r.source),s=i==="local"||i==="skillspace"||i==="skillhub"?i:"skillhub",a=ut(r.name)||ut(r.slug)||ut(r.skillName)||ut(r.skillId)||"skill",o=ut(r.folder)||a,l=ut(r.description);if(s==="skillhub"){const f=ut(r.slug);if(!f)continue;t.push({source:s,folder:o,name:a,description:l,slug:f,namespace:ut(r.namespace)||"public"});continue}if(s==="local"){const h=(Array.isArray(r.localFiles)?r.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},y=ut(m.path),w=ut(m.content);return y?{path:y,content:w}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:s,folder:o,name:a,description:l,localFiles:h});continue}const u=ut(r.skillSpaceId),d=ut(r.skillId);!u||!d||t.push({source:s,folder:o,name:a,description:l,skillSpaceId:u,skillSpaceName:ut(r.skillSpaceName),skillId:d,version:ut(r.version)})}return t}function X3(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},r=t.deployment&&typeof t.deployment=="object"?t.deployment:{},i=q3(t.a2aRegistry),s=Y3(t.agentType),a=i.enabled&&s==="llm"?"a2a":s,o=Array.isArray(t.mcpTools)?t.mcpTools.map(l=>{const u=l&&typeof l=="object"?l:{},d=u.transport==="stdio"?"stdio":"http";return{name:ut(u.name),transport:d,url:ut(u.url),authToken:ut(u.authToken),command:ut(u.command),args:Ch(u.args)}}).filter(l=>l.transport==="http"?!!l.url:!!l.command):[];return{...ea(),name:ut(t.name)||"my_agent",description:ut(t.description),instruction:ut(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:W3(t.maxIterations),a2aUrl:ut(t.a2aUrl),modelName:ut(t.modelName),modelProvider:ut(t.modelProvider),modelApiBase:ut(t.modelApiBase),builtinTools:Ch(t.builtinTools).filter(l=>V3.has(l)),customTools:K3(t.customTools),mcpTools:o,a2aRegistry:a==="a2a"?{...i,enabled:!0}:i,memory:{shortTerm:Ea(n.shortTerm),longTerm:Ea(n.longTerm)},shortTermBackend:I0(t.shortTermBackend,sne,"local"),longTermBackend:I0(t.longTermBackend,ane,"local"),autoSaveSession:Ea(t.autoSaveSession),knowledgebase:Ea(t.knowledgebase),knowledgebaseBackend:I0(t.knowledgebaseBackend,one,"local"),tracing:Ea(t.tracing),tracingExporters:Ch(t.tracingExporters).filter(l=>lne.has(l)),deployment:{feishuEnabled:Ea(r.feishuEnabled)},subAgents:G3(t.subAgents),selectedSkills:une(t)}}function Q3(e){var n,r,i,s,a,o,l,u,d,f,h,p,m,y,w,g,E;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const b={enabled:!0};(r=e.a2aRegistry.registrySpaceId)!=null&&r.trim()&&(b.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),b.registryTopK=((i=e.a2aRegistry.registryTopK)==null?void 0:i.trim())||ls.topK,b.registryRegion=((s=e.a2aRegistry.registryRegion)==null?void 0:s.trim())||ls.region,b.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||ls.endpoint,t.a2aRegistry=b}return t}return t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(o=e.modelName)!=null&&o.trim()&&(t.modelName=e.modelName.trim()),(l=e.modelProvider)!=null&&l.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(b=>({name:b.name,description:b.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(b=>{var k,T,C,S;const _={name:b.name,transport:b.transport};return(k=b.url)!=null&&k.trim()&&(_.url=b.url.trim()),(T=b.authToken)!=null&&T.trim()&&(_.authToken=b.authToken.trim()),(C=b.command)!=null&&C.trim()&&(_.command=b.command.trim()),(S=b.args)!=null&&S.length&&(_.args=b.args),_})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"local"),e.tracing&&((y=e.tracingExporters)!=null&&y.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(w=e.deployment)!=null&&w.feishuEnabled&&(t.deployment={feishuEnabled:!0}),(g=e.selectedSkills)!=null&&g.length&&(t.selectedSkills=e.selectedSkills.map(b=>{const _={source:b.source,name:b.name,folder:b.folder};return b.description&&(_.description=b.description),b.source==="skillhub"?(_.slug=b.slug,_.namespace=b.namespace??"public"):b.source==="local"?_.localFiles=b.localFiles??[]:(_.skillSpaceId=b.skillSpaceId,_.skillSpaceName=b.skillSpaceName,_.skillId=b.skillId,b.version&&(_.version=b.version)),_})),(E=e.subAgents)!=null&&E.length&&(t.subAgents=e.subAgents.map(Q3)),t}function dne(e){return`# VeADK Agent 结构配置 -# 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+Gte(Q3(e))}function fne(e){const t=qte(e);return X3(t)}const hne=[{kind:"custom",icon:LU,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:xU,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:pU,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:MU,title:"工作流",desc:"敬请期待",disabled:!0}];function pne({onSelect:e,onImport:t}){const n=v.useRef(null),[r,i]=v.useState(""),s=hne.map(o=>({key:o.kind,icon:o.icon,title:o.title,desc:o.desc,disabled:o.disabled,onClick:()=>e(o.kind)})),a=async o=>{var u;const l=(u=o.target.files)==null?void 0:u[0];if(o.target.value="",!!l)try{const d=await l.text();t(fne(d))}catch(d){i(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return c.jsx(i3,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:s,footer:c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[c.jsxs("button",{className:"stk-import",onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},children:[c.jsx(RU,{}),"导入 YAML 配置"]}),r&&c.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:r}),c.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const mne="modulepreload",gne=function(e){return"/"+e},OS={},ll=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=gne(l),l in OS)return;OS[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":mne,u||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};function yne({className:e,...t}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[c.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),c.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const No={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:yne},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:cR},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:mR},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:WE},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:wm}},Vf=[No.llm,No.sequential,No.parallel,No.loop,No.a2a];function aw(e){return No[e??"llm"]}const Z3=e=>e==="sequential"||e==="parallel"||e==="loop",Bd=e=>e==="a2a";function J3(e){const t=new Map,n={};for(const r of e){for(const i of r.env){const s=t.get(i.key);(!s||i.required&&!s.required)&&t.set(i.key,i)}r.enableFlag&&(t.set(r.enableFlag,{key:r.enableFlag,required:!0}),n[r.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function bne(e,t){return J3([{env:e}]).specs.map(r=>({...r,value:t[r.key]??""}))}function Ene(e,t){const n=new Map;for(const r of e){const i=t[r.key]??"";i.trim()&&n.set(r.key,i)}return[...n].map(([r,i])=>({key:r,value:i}))}function LS(e,t){return e.find(n=>{var r;return n.required&&!((r=t[n.key])!=null&&r.trim())})}const xne=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function wne(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function nn(e,t){e.push(t&255,t>>>8&255)}function Cr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const MS=2048,R0=20,DS=0;function vne(e){const t=new TextEncoder,n=[],r=[];let i=0;for(const p of e){const m=t.encode(p.path),y=t.encode(p.content),w=wne(y),g=y.length,E=[];Cr(E,67324752),nn(E,R0),nn(E,MS),nn(E,DS),nn(E,0),nn(E,0),Cr(E,w),Cr(E,g),Cr(E,g),nn(E,m.length),nn(E,0);const b=Uint8Array.from(E);n.push(b,m,y),r.push({nameBytes:m,dataBytes:y,crc:w,size:g,offset:i}),i+=b.length+m.length+y.length}const s=i,a=[];let o=0;for(const p of r){const m=[];Cr(m,33639248),nn(m,R0),nn(m,R0),nn(m,MS),nn(m,DS),nn(m,0),nn(m,0),Cr(m,p.crc),Cr(m,p.size),Cr(m,p.size),nn(m,p.nameBytes.length),nn(m,0),nn(m,0),nn(m,0),nn(m,0),Cr(m,0),Cr(m,p.offset);const y=Uint8Array.from(m);a.push(y,p.nameBytes),o+=y.length+p.nameBytes.length}const l=[];Cr(l,101010256),nn(l,0),nn(l,0),nn(l,r.length),nn(l,r.length),Cr(l,o),Cr(l,s),nn(l,0);const u=[...n,...a,Uint8Array.from(l)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const _ne=v.lazy(()=>ll(()=>import("./CodeEditor-B47Yc-gR.js"),[]));function Tne(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let i=t;r.forEach((s,a)=>{let o=i.children.get(s);o||(o={name:s,children:new Map},i.children.set(s,o)),a===r.length-1&&(o.path=n.path),i=o})}return t}function kne(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return r!==i?r?-1:1:t.name.localeCompare(n.name)})}function Sne({project:e,open:t,onClose:n,onChange:r}){var m;const[i,s]=v.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,o]=v.useState(new Set),l=v.useRef(null),u=v.useMemo(()=>Tne(e.files),[e.files]),d=e.files.find(y=>y.path===i)??null;if(v.useEffect(()=>{var g;if(!t)return;const y=document.body.style.overflow;document.body.style.overflow="hidden",(g=l.current)==null||g.focus();const w=E=>{E.key==="Escape"&&n()};return window.addEventListener("keydown",w),()=>{document.body.style.overflow=y,window.removeEventListener("keydown",w)}},[n,t]),v.useEffect(()=>{d||e.files.length===0||s(e.files[0].path)},[e.files,d]),!t)return null;function f(y){o(w=>{const g=new Set(w);return g.has(y)?g.delete(y):g.add(y),g})}function h(y,w,g){return kne(y).map(E=>{const b=g?`${g}/${E.name}`:E.name;if(!(E.children.size>0&&E.path===void 0)&&E.path)return c.jsxs("button",{type:"button",className:`code-browser-file${i===E.path?" is-active":""}`,style:{paddingLeft:`${12+w*16}px`},onClick:()=>s(E.path??null),title:E.path,children:[c.jsx(dT,{"aria-hidden":"true"}),c.jsx("span",{children:E.name})]},b);const k=a.has(b);return c.jsxs("div",{children:[c.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+w*16}px`},onClick:()=>f(b),"aria-expanded":!k,children:[c.jsx(dr,{className:k?"":"is-open","aria-hidden":"true"}),c.jsx(lR,{"aria-hidden":"true"}),c.jsx("span",{children:E.name})]}),!k&&h(E,w+1,b)]},b)})}function p(y){d&&r({...e,files:e.files.map(w=>w.path===d.path?{...w,content:y}:w)})}return Va.createPortal(c.jsx("div",{className:"code-browser-backdrop",onMouseDown:y=>{y.target===y.currentTarget&&n()},children:c.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[c.jsxs("header",{className:"code-browser-head",children:[c.jsxs("div",{className:"code-browser-title-wrap",children:[c.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:c.jsx($E,{})}),c.jsxs("div",{children:[c.jsx("h2",{id:"code-browser-title",children:"项目代码"}),c.jsx("p",{children:e.name||"Agent 项目"})]})]}),c.jsx("button",{ref:l,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:c.jsx(ti,{"aria-hidden":"true"})})]}),c.jsxs("div",{className:"code-browser-workspace",children:[c.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[c.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",c.jsx("span",{children:e.files.length})]}),c.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):c.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),c.jsxs("main",{className:"code-browser-main",children:[c.jsxs("div",{className:"code-browser-path",children:[c.jsx(dT,{"aria-hidden":"true"}),c.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),c.jsx("div",{className:"code-browser-editor",children:d?c.jsx(v.Suspense,{fallback:c.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:c.jsx(_ne,{value:d.content,path:d.path,onChange:p})}):c.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function Nne({project:e,onChange:t,className:n=""}){const[r,i]=v.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>i(!0),"aria-label":"查看和编辑项目源码",title:"查看源码",children:[c.jsx($E,{"aria-hidden":"true"}),c.jsx("span",{children:"查看源码"})]}),c.jsx(Sne,{project:e,open:r,onClose:()=>i(!1),onChange:t})]})}function Ane({className:e,...t}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[c.jsx("path",{d:"m12 2.75 4.25 2.45v4.9L12 12.55 7.75 10.1V5.2L12 2.75Z"}),c.jsx("path",{d:"m7.75 5.2 4.25 2.45 4.25-2.45M12 7.65v4.9"}),c.jsx("path",{d:"M12 12.55v4.7m-2.25-2.2L12 17.3l2.25-2.25"}),c.jsx("path",{d:"M5.5 17.25v2.25a1.75 1.75 0 0 0 1.75 1.75h9.5a1.75 1.75 0 0 0 1.75-1.75v-2.25"})]})}function $p({message:e,className:t="",onRetry:n}){const[r,i]=v.useState(!1),[s,a]=v.useState(!1),[o,l]=v.useState(!1),u=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)}catch{a(!1)}},d=async()=>{if(!(!n||o)){l(!0);try{await n()}finally{l(!1)}}};return c.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,children:[c.jsx("p",{className:"deploy-error-message-text",children:e}),c.jsxs("div",{className:"deploy-error-message-actions",children:[n&&c.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:o,onClick:()=>void d(),children:[o?c.jsx(_t,{className:"spin"}):c.jsx(pR,{}),o?"重试中…":"重试部署"]}),c.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>i(f=>!f),children:r?c.jsx(vU,{}):c.jsx(nu,{})}),c.jsx("button",{type:"button",title:s?"已复制":"复制完整错误信息","aria-label":s?"已复制":"复制完整错误信息",onClick:()=>void u(),children:s?c.jsx($i,{}):c.jsx(HE,{})})]})]})}_r.registerLanguage("python",cL);_r.registerLanguage("typescript",wL);_r.registerLanguage("javascript",rL);_r.registerLanguage("json",iL);_r.registerLanguage("yaml",vL);_r.registerLanguage("markdown",lL);_r.registerLanguage("bash",QO);_r.registerLanguage("ini",ZO);_r.registerLanguage("dockerfile",bW);_r.registerLanguage("makefile",oL);const Cne=v.lazy(()=>ll(()=>import("./CodeEditor-B47Yc-gR.js"),[]));function Ine({open:e,onCancel:t,onConfirm:n}){const r=v.useRef(null);return v.useEffect(()=>{var a;if(!e)return;const i=document.body.style.overflow;document.body.style.overflow="hidden",(a=r.current)==null||a.focus();const s=o=>{o.key==="Escape"&&t()};return window.addEventListener("keydown",s),()=>{document.body.style.overflow=i,window.removeEventListener("keydown",s)}},[t,e]),e?Va.createPortal(c.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:i=>{i.target===i.currentTarget&&t()},children:c.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[c.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[c.jsxs("div",{className:"code-browser-title-wrap",children:[c.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:c.jsx(IU,{})}),c.jsx("h2",{id:"pp-confirm-title",children:"确认部署"})]}),c.jsx("button",{type:"button",className:"code-browser-close",onClick:t,"aria-label":"关闭部署确认",children:c.jsx(ti,{"aria-hidden":"true"})})]}),c.jsx("div",{className:"pp-confirm-body",children:c.jsx("p",{id:"pp-confirm-description",children:"部署后暂不支持修改 Agent 配置,确定部署吗?"})}),c.jsxs("footer",{className:"pp-confirm-actions",children:[c.jsx("button",{ref:r,type:"button",onClick:t,children:"取消"}),c.jsx("button",{type:"button",className:"is-primary",onClick:n,children:"确定部署"})]})]})}),document.body):null}const Rne={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},PS={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function jS(e){return e.replace(/&/g,"&").replace(//g,">")}function One(e){const n=(e.split("/").pop()??e).toLowerCase();if(PS[n])return PS[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const r=n.lastIndexOf(".");if(r===-1)return null;const i=n.slice(r+1);return Rne[i]??null}function Lne(e,t){try{const n=One(t);return n&&_r.getLanguage(n)?_r.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?_r.highlightAuto(e).value:jS(e)}catch{return jS(e)}}const Kf=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}];function Mne(e){return e.trim().replace(/[。.!!]+$/u,"")}function O0(e,t="未配置"){return[...new Set(e.map(r=>r==null?void 0:r.trim()).filter(Boolean))].join("、")||t}function eD(e,t="root"){var a,o,l;const n=e.agentType??"llm",r=[...(e.builtinTools??[]).map(u=>{var d;return((d=Qte(u))==null?void 0:d.label)??u}),...(e.customTools??[]).map(u=>u.name),...(e.mcpTools??[]).map(u=>u.name),...e.tools??[]],i=[...(e.selectedSkills??[]).map(u=>u.name),...e.skills??[]],s=e.memory.longTerm?((a=Jte(e.longTermBackend??"local"))==null?void 0:a.label)??e.longTermBackend:void 0;return{id:t,name:e.name.trim()||"未命名 Agent",type:n,description:Mne(e.description),model:n==="llm"?e.modelName||e.model||"默认模型":"不适用",tools:O0(r),skills:O0(i),knowledgebase:e.knowledgebase?((o=ene(e.knowledgebaseBackend??"local"))==null?void 0:o.label)??e.knowledgebaseBackend??"默认知识库":"未配置",shortTerm:e.memory.shortTerm?((l=Zte(e.shortTermBackend??"local"))==null?void 0:l.label)??e.shortTermBackend??"默认后端":"未配置",longTerm:s?`${s}${e.autoSaveSession?" · 自动保存会话":""}`:"未配置",tracing:e.tracing?O0((e.tracingExporters??[]).map(u=>{var d;return((d=tne(u))==null?void 0:d.label)??u}),"默认观测"):"未配置",children:e.subAgents.map((u,d)=>eD(u,`${t}.${d}`))}}function tD(e,t){if(e.id===t)return e;for(const n of e.children){const r=tD(n,t);if(r)return r}}function nD({agent:e,depth:t,inspectedId:n,onHover:r,onFocus:i}){const s=aw(e.type),a=s.icon;return c.jsxs("div",{className:"pp-topology-branch",children:[c.jsxs("button",{type:"button",className:`pp-agent-node${e.id===n?" is-inspected":""}`,style:{marginLeft:t*16,width:`calc(100% - ${t*16}px)`},onMouseEnter:()=>r(e.id),onMouseLeave:()=>r(null),onFocus:()=>i(e.id),onBlur:()=>i(null),"aria-label":`查看 ${e.name} 配置`,children:[c.jsx("span",{className:"pp-agent-node-icon",children:c.jsx(a,{"aria-hidden":"true"})}),c.jsxs("span",{className:"pp-agent-node-main",children:[c.jsx("span",{className:"pp-agent-node-name",children:e.name}),c.jsx("span",{className:"pp-agent-node-type",children:s.label})]}),e.children.length>0&&c.jsx("span",{className:"pp-agent-child-count",children:e.children.length})]}),e.children.length>0&&c.jsx("div",{className:"pp-topology-children",children:e.children.map(o=>c.jsx(nD,{agent:o,depth:t+1,inspectedId:n,onHover:r,onFocus:i},o.id))})]})}function Dne(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let i=t;r.forEach((s,a)=>{let o=i.children.get(s);o||(o={name:s,children:new Map},i.children.set(s,o)),a===r.length-1&&(o.path=n.path),i=o})}return t}function Pne(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,i=n.children.size>0&&n.path===void 0;return r!==i?r?-1:1:t.name.localeCompare(n.name)})}function jne(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function Bne({left:e,right:t}){const[n,r]=v.useState(null);return v.useLayoutEffect(()=>{const i=document.getElementById("veadk-page-header-left"),s=document.getElementById("veadk-page-header-actions");i&&s&&r({left:i,right:s})},[]),n?c.jsxs(c.Fragment,{children:[Va.createPortal(e,n.left),Va.createPortal(t,n.right)]}):c.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function ow({project:e,agentDraft:t,agentName:n,agentCount:r,onChange:i,onDeploy:s,onAgentAdded:a,onDeploymentTaskChange:o,feishuEnabled:l=!1,onFeishuEnabledChange:u,deploymentEnv:d=[],deploymentEnvValues:f={},onDeploymentEnvChange:h,network:p,onNetworkChange:m,deployRegion:y="cn-beijing",onDeployRegionChange:w,onBack:g,onExportYaml:E}){var Ze,un,dn;const b=typeof i=="function",[_,k]=v.useState(((un=(Ze=e==null?void 0:e.files)==null?void 0:Ze[0])==null?void 0:un.path)??null),[T,C]=v.useState(new Set),[S,R]=v.useState(!1),[I,M]=v.useState(""),[B,Y]=v.useState(!1),[P,U]=v.useState(!1),[A,L]=v.useState(!1),[O,j]=v.useState(null),[N,H]=v.useState(null),[V,D]=v.useState({}),[ne,J]=v.useState(null),[re,de]=v.useState(!1),[G,W]=v.useState([]),[ae,he]=v.useState(!1),[Z,ce]=v.useState(null),[Ie,xe]=v.useState(null),ge=v.useRef(!0),De=v.useMemo(()=>t?eD(t):{id:"root",name:n||(e==null?void 0:e.name)||"未命名 Agent",type:"llm",description:"",model:"默认模型",tools:"未配置",skills:"未配置",knowledgebase:"未配置",shortTerm:"未配置",longTerm:"未配置",tracing:"未配置",children:[]},[t,n,e==null?void 0:e.name]),_e=Ie??Z,He=_e?tD(De,_e):void 0,Oe=He?aw(He.type):void 0,oe=Oe==null?void 0:Oe.icon;v.useEffect(()=>(ge.current=!0,()=>{ge.current=!1}),[]);const kt=v.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:Dne(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return c.jsx("div",{className:"pp-error",children:"项目数据无效"});const ve=e.files.find(se=>se.path===_)??null,St=(p==null?void 0:p.mode)??"public",dt=bne(l?[...d,...kc]:d,f),K=dt.length+G.length;function X(se){C(Te=>{const ye=new Set(Te);return ye.has(se)?ye.delete(se):ye.add(se),ye})}function le(se,Te){i&&(i({...e,files:se}),Te!==void 0&&k(Te))}function Se(se){ve&&le(e.files.map(Te=>Te.path===ve.path?{...Te,content:se}:Te))}function Le(){const se=I.trim();if(R(!1),M(""),!!se){if(e.files.some(Te=>Te.path===se)){k(se);return}le([...e.files,{path:se,content:""}],se)}}function ft(){if(!ve)return;const se=window.prompt("重命名文件",ve.path),Te=se==null?void 0:se.trim();!Te||Te===ve.path||e.files.some(ye=>ye.path===Te)||le(e.files.map(ye=>ye.path===ve.path?{...ye,path:Te}:ye),Te)}function qe(){var Te;if(!ve)return;const se=e.files.filter(ye=>ye.path!==ve.path);le(se,((Te=se[0])==null?void 0:Te.path)??null)}function ct(se,Te){W(ye=>ye.map(je=>je.id===se?{...je,...Te}:je))}function Jt(se){W(Te=>Te.filter(ye=>ye.id!==se))}function Ot(){W(se=>[...se,jne()])}function Xe(se){m&&m(se==="public"?void 0:{...p??{mode:se},mode:se})}function xt(se){m==null||m({...p??{mode:"private"},...se})}function Vt(){const se=new Map(G.map(ye=>({key:ye.key.trim(),value:ye.value})).filter(ye=>ye.key.length>0).map(ye=>[ye.key,ye.value])),Te=l?[...d,...kc]:d;for(const ye of Ene(Te,f))se.set(ye.key,ye.value);return[...se].map(([ye,je])=>({key:ye,value:je}))}async function An(){if(!(!u||B||A)){j(null),L(!0);try{await u(!l)}catch(se){ge.current&&j(`更新飞书配置失败:${se instanceof Error?se.message:String(se)}`)}finally{ge.current&&L(!1)}}}async function $e(){var Te;if(!s||B)return;if(St!=="public"&&!((Te=p==null?void 0:p.vpcId)!=null&&Te.trim())){j("使用 VPC 网络时,请填写 VPC ID。");return}const se=LS(d,f);if(se){const ye=d.find(je=>je.key===se.key);j(`请返回配置页填写 ${(ye==null?void 0:ye.comment)||(ye==null?void 0:ye.key)}(${ye==null?void 0:ye.key})。`);return}if(l){const ye=LS(kc,f);if(ye){const je=kc.find(ze=>ze.key===ye.key);j(`启用飞书后,请填写${(je==null?void 0:je.comment)||(je==null?void 0:je.key)}。`);return}}U(!0)}async function st(){if(!s||B)return;U(!1);const se=Vt();ge.current&&(j(null),H(null),D({}),J(null),Y(!0));const Te=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let ye="生成中…";const je=Date.now();o==null||o({id:Te,runtimeName:ye,region:y,startedAt:je,status:"running",label:"准备部署"});try{const ze=await s(e,Ge=>{var Et;Ge.runtimeName&&(ye=Ge.runtimeName),ge.current&&(D(Lt=>({...Lt,[Ge.phase]:Ge})),J(Ge.phase)),o==null||o({id:Te,runtimeName:ye,region:y,startedAt:je,status:"running",label:((Et=Kf.find(Lt=>Lt.phase===Ge.phase))==null?void 0:Et.label)??Ge.phase,message:Ge.message,pct:Ge.pct})},l?{taskId:Te,im:{feishu:{enabled:!0}},envs:se}:{taskId:Te,envs:se});ge.current&&(H(ze),J(null)),o==null||o({id:Te,runtimeName:ze.agentName||ye,runtimeId:ze.runtimeId,region:ze.region||y,startedAt:je,status:"success",label:"部署完成"})}catch(ze){const Ge=ze instanceof Error?ze.message:String(ze);if(ze instanceof DOMException&&ze.name==="AbortError"){ge.current&&(j(null),J(null)),o==null||o({id:Te,runtimeName:ye,region:y,startedAt:je,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"});return}ge.current&&j(Ge),o==null||o({id:Te,runtimeName:ye,region:y,startedAt:je,status:"error",label:"部署失败",message:Ge,retry:$e})}finally{ge.current&&Y(!1)}}function rt(){U(!1)}async function bt(){if(!(!N||re)){de(!0),j(null);try{const{addConnection:se,addRuntimeConnection:Te,remoteAppId:ye,loadConnections:je}=await ll(async()=>{const{addConnection:Et,addRuntimeConnection:Lt,remoteAppId:Mt,loadConnections:bn}=await Promise.resolve().then(()=>hS);return{addConnection:Et,addRuntimeConnection:Lt,remoteAppId:Mt,loadConnections:bn}},void 0),{probeRuntimeApps:ze}=await ll(async()=>{const{probeRuntimeApps:Et}=await Promise.resolve().then(()=>GU);return{probeRuntimeApps:Et}},void 0);let Ge;if(N.runtimeId){const Et=N.region??"cn-beijing",Lt=await ze(N.runtimeId,Et)??[];Ge=Te(N.runtimeId,N.agentName,Et,Lt,Lt.length>0?{[Lt[0]]:N.agentName}:void 0)}else Ge=await se(N.agentName,N.url,N.apikey,"");if(Ge.apps.length===0)j("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const Et={[Ge.apps[0]]:N.agentName},Lt={...Ge,appLabels:{...Ge.appLabels??{},...Et}},bn=je().map(Kt=>Kt.id===Ge.id?Lt:Kt);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(bn));const{registerConnections:En}=await ll(async()=>{const{registerConnections:Kt}=await Promise.resolve().then(()=>hS);return{registerConnections:Kt}},void 0);if(En(bn),a){const Kt=ye(Ge.id,Ge.apps[0]);a(Kt,N.agentName)}else alert(`🎉 Agent "${N.agentName}" 已添加到左上角下拉列表!`)}}catch(se){j(`添加 Agent 失败:${se instanceof Error?se.message:String(se)}`)}finally{de(!1)}}}function ue(){const se=vne(e.files),Te=URL.createObjectURL(se),ye=document.createElement("a");ye.href=Te,ye.download=`${e.name||"project"}.zip`,document.body.appendChild(ye),ye.click(),document.body.removeChild(ye),URL.revokeObjectURL(Te)}function Me(se,Te,ye){return Pne(se).map(je=>{const ze=ye?`${ye}/${je.name}`:je.name,Ge=je.path!==void 0,Et={paddingLeft:8+Te*14};if(Ge){const Mt=je.path===_;return c.jsxs("button",{type:"button",className:`pp-row pp-file${Mt?" pp-active":""}`,style:Et,onClick:()=>k(je.path),title:je.path,children:[c.jsx(lU,{className:"pp-ic"}),c.jsx("span",{className:"pp-label",children:je.name})]},ze)}const Lt=T.has(ze);return c.jsxs("div",{children:[c.jsxs("button",{type:"button",className:"pp-row pp-folder",style:Et,onClick:()=>X(ze),children:[c.jsx(dr,{className:`pp-ic pp-chevron${Lt?"":" pp-open"}`}),c.jsx(lR,{className:"pp-ic"}),c.jsx("span",{className:"pp-label",children:je.name})]}),!Lt&&Me(je,Te+1,ze)]},ze)})}return c.jsxs("div",{className:`pp-root${s?" is-deploy":""}`,children:[s&&c.jsx(Bne,{left:c.jsxs("div",{className:"pp-toolbar-left",children:[g&&c.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:g,children:[c.jsx(ZI,{className:"pp-ic"}),"返回配置"]}),c.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",n||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),c.jsxs("div",{className:"pp-body",children:[s&&c.jsxs("section",{className:"pp-topology-pane","aria-label":"Agent 拓扑",children:[c.jsxs("div",{className:"pp-topology-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"pp-topology-title",children:"Agent 拓扑"}),c.jsxs("div",{className:"pp-topology-count",children:[r??1," 个智能体"]})]}),b&&i&&c.jsx(Nne,{project:e,onChange:i})]}),c.jsxs("div",{className:"pp-topology-scroll",children:[c.jsx("div",{className:"pp-topology-tree",children:c.jsx(nD,{agent:De,depth:0,inspectedId:_e,onHover:ce,onFocus:xe})}),He&&Oe&&oe&&c.jsxs("div",{className:"pp-agent-inspector","aria-live":"polite",children:[c.jsxs("div",{className:"pp-agent-inspector-head",children:[c.jsx("span",{className:"pp-agent-inspector-icon",children:c.jsx(oe,{"aria-hidden":"true"})}),c.jsxs("div",{children:[c.jsx("strong",{children:He.name}),c.jsx("span",{children:Oe.label})]})]}),He.description&&c.jsx("p",{children:He.description}),c.jsxs("dl",{className:"pp-agent-config-grid",children:[c.jsx("dt",{children:"模型"}),c.jsx("dd",{children:He.model}),c.jsx("dt",{children:"工具"}),c.jsx("dd",{children:He.tools}),c.jsx("dt",{children:"技能"}),c.jsx("dd",{children:He.skills}),c.jsx("dt",{children:"知识库"}),c.jsx("dd",{children:He.knowledgebase}),c.jsx("dt",{children:"短期记忆"}),c.jsx("dd",{children:He.shortTerm}),c.jsx("dt",{children:"长期记忆"}),c.jsx("dd",{children:He.longTerm}),c.jsx("dt",{children:"观测"}),c.jsx("dd",{children:He.tracing})]})]})]}),c.jsxs("div",{className:"pp-topology-actions",children:[E&&c.jsxs("button",{type:"button",className:"pp-secondary",onClick:E,children:[c.jsx(sU,{className:"pp-ic"}),"导出配置"]}),e.files.length>0&&c.jsxs("button",{type:"button",className:"pp-secondary",onClick:ue,children:[c.jsx(zE,{className:"pp-ic"}),"下载源码"]})]})]}),c.jsxs("div",{className:"pp-files-area",children:[c.jsxs("div",{className:"pp-sidebar",children:[c.jsxs("div",{className:"pp-sidebar-head",children:[c.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),b&&c.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{R(!0),M("")},children:c.jsx(aU,{className:"pp-ic"})})]}),c.jsxs("div",{className:"pp-tree",children:[S&&c.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:I,onChange:se=>M(se.target.value),onBlur:Le,onKeyDown:se=>{se.key==="Enter"&&Le(),se.key==="Escape"&&(R(!1),M(""))}}),e.files.length===0&&!S?c.jsx("div",{className:"pp-empty",children:"暂无文件"}):Me(kt,0,"")]})]}),c.jsxs("div",{className:"pp-main",children:[c.jsxs("div",{className:"pp-main-head",children:[c.jsx("span",{className:"pp-path",title:ve==null?void 0:ve.path,children:(ve==null?void 0:ve.path)??"未选择文件"}),c.jsx("div",{className:"pp-actions",children:b&&ve&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:ft,children:c.jsx(kU,{className:"pp-ic"})}),c.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:qe,children:c.jsx(Vl,{className:"pp-ic"})})]})})]}),c.jsx("div",{className:"pp-content",children:ve==null?c.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):b?c.jsx("div",{className:"pp-codemirror",children:c.jsx(v.Suspense,{fallback:c.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:c.jsx(Cne,{value:ve.content,path:ve.path,onChange:Se})})}):c.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:Lne(ve.content,ve.path)}})})]})]}),s&&c.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[c.jsx("div",{className:"pp-config-head",children:c.jsx("div",{className:"pp-config-title",children:"部署配置"})}),c.jsxs("div",{className:"pp-config-scroll",children:[c.jsxs("section",{className:"pp-config-section",children:[c.jsx("div",{className:"pp-config-label",children:"发布区域"}),c.jsxs("select",{className:"pp-config-select",value:y,onChange:se=>w==null?void 0:w(se.target.value),"aria-label":"部署区域",disabled:B||!w,children:[c.jsx("option",{value:"cn-beijing",children:"华北 2(北京)"}),c.jsx("option",{value:"cn-shanghai",children:"华东 2(上海)"})]})]}),c.jsxs("section",{className:"pp-config-section",children:[c.jsx("div",{className:"pp-config-label",children:"消息渠道"}),c.jsxs("button",{type:"button",role:"switch","aria-checked":l,className:`pp-channel${l?" is-on":""}`,onClick:()=>void An(),disabled:B||A||!u,children:[c.jsx("span",{className:"pp-channel-title",children:A?"飞书(正在更新代码…)":"飞书"}),c.jsx("span",{className:"pp-switch","aria-hidden":!0,children:c.jsx("span",{})})]}),l&&c.jsx("div",{className:"pp-channel-fields",children:kc.map(se=>c.jsxs("label",{children:[c.jsxs("span",{children:[se.comment||se.key,se.required&&c.jsx("small",{children:"必填"})]}),c.jsx("code",{children:se.key}),c.jsx("input",{type:se.key.includes("SECRET")?"password":"text",value:f[se.key]??"",placeholder:se.placeholder,disabled:B||!h,autoComplete:"off",onChange:Te=>h==null?void 0:h(se.key,Te.currentTarget.value)})]},se.key))})]}),c.jsxs("section",{className:"pp-config-section",children:[c.jsx("div",{className:"pp-config-label",children:"网络"}),c.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(se=>c.jsx("button",{type:"button",role:"radio","aria-checked":St===se,className:St===se?"is-on":"",onClick:()=>Xe(se),disabled:B||!m,children:se==="public"?"公网":se==="private"?"VPC":"公网 + VPC"},se))}),St!=="public"&&c.jsxs("div",{className:"pp-network-fields",children:[c.jsxs("label",{children:[c.jsx("span",{children:"VPC ID"}),c.jsx("input",{value:(p==null?void 0:p.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:B,onChange:se=>xt({vpcId:se.target.value})})]}),c.jsxs("label",{children:[c.jsxs("span",{children:["子网 ID ",c.jsx("small",{children:"可选,多个用逗号分隔"})]}),c.jsx("input",{value:(p==null?void 0:p.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:B,onChange:se=>xt({subnetIds:se.target.value})})]}),c.jsxs("label",{className:"pp-network-check",children:[c.jsx("input",{type:"checkbox",checked:!!(p!=null&&p.enableSharedInternetAccess),disabled:B,onChange:se=>xt({enableSharedInternetAccess:se.target.checked})}),"VPC 内共享公网出口"]})]})]}),c.jsxs("section",{className:"pp-config-section pp-env-section",children:[c.jsxs("div",{className:"pp-env-head",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"pp-config-label",children:["环境变量",c.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[K," 项"]})]}),c.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),c.jsx("button",{type:"button",className:"pp-icon-btn",title:ae?"隐藏值":"显示值",onClick:()=>he(se=>!se),children:ae?c.jsx(iU,{className:"pp-ic"}):c.jsx(sR,{className:"pp-ic"})})]}),c.jsxs("button",{type:"button",className:"pp-env-add",onClick:Ot,disabled:B,children:[c.jsx(Ei,{className:"pp-ic"}),"添加变量"]}),(dt.length>0||G.length>0)&&c.jsxs("div",{className:"pp-env-table",children:[dt.length>0&&c.jsxs("div",{className:"pp-env-group",children:[c.jsxs("div",{className:"pp-env-group-head",children:[c.jsx("span",{children:"组件自动生成"}),c.jsxs("small",{children:[dt.length," 项"]})]}),dt.map(se=>{const Te=se.key.startsWith("ENABLE_");return c.jsxs("div",{className:"pp-env-row pp-env-row-derived",children:[c.jsx("input",{className:"pp-env-key-fixed",value:se.key,readOnly:!0,disabled:B,"aria-label":`${se.key} 环境变量名`}),c.jsx("input",{type:Te||ae?"text":"password",value:se.value,placeholder:se.required?"必填,尚未填写":"可选,尚未填写",readOnly:Te,disabled:B||!Te&&!h,autoComplete:"off","aria-label":`${se.key} 环境变量值`,onChange:ye=>h==null?void 0:h(se.key,ye.currentTarget.value)}),c.jsx("span",{className:"pp-env-source",children:Te?"自动":"同步"})]},se.key)})]}),G.length>0&&c.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[c.jsx("span",{children:"自定义变量"}),c.jsxs("small",{children:[G.length," 项"]})]}),G.map(se=>c.jsxs("div",{className:"pp-env-row",children:[c.jsx("input",{value:se.key,placeholder:"名称",disabled:B,autoComplete:"off",onChange:Te=>ct(se.id,{key:Te.currentTarget.value})}),c.jsx("input",{type:ae?"text":"password",value:se.value,placeholder:"值",disabled:B,autoComplete:"off",onChange:Te=>ct(se.id,{value:Te.currentTarget.value})}),c.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:B,onClick:()=>Jt(se.id),children:c.jsx(ti,{className:"pp-ic"})})]},se.id))]})]}),(B||N||Object.keys(V).length>0)&&c.jsxs("section",{className:"pp-config-section pp-progress-section",children:[c.jsx("div",{className:"pp-config-label",children:"部署进度"}),c.jsx("ol",{className:"pp-steps",children:Kf.map((se,Te)=>{const ye=ne?Kf.findIndex(Et=>Et.phase===ne):-1,je=!!O&&(ye===-1?Te===0:Te===ye);let ze;N?ze="done":je?ze="failed":ye===-1?ze=B?"active":"pending":Tese.phase===ne))==null?void 0:dn.label)??ne}阶段):`:""}${O}`,onRetry:$e}),N&&c.jsxs("section",{className:"pp-deploy-result",children:[c.jsx("div",{className:"pp-deploy-result-header",children:"部署成功"}),c.jsxs("div",{className:"pp-deploy-result-body",children:[N.region&&c.jsxs("div",{className:"pp-deploy-result-field",children:[c.jsx("label",{children:"区域"}),c.jsx("code",{children:N.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),c.jsxs("div",{className:"pp-deploy-result-field",children:[c.jsx("label",{children:"Agent 名称"}),c.jsx("code",{children:N.agentName})]}),c.jsxs("div",{className:"pp-deploy-result-field",children:[c.jsx("label",{children:"API 端点"}),c.jsx("code",{className:"pp-deploy-result-url",children:N.url})]})]}),c.jsxs("div",{className:"pp-deploy-result-actions",children:[c.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:bt,disabled:re,children:[re?c.jsx(_t,{className:"pp-ic spin"}):c.jsx(fR,{className:"pp-ic"}),re?"连接中…":"立即对话"]}),N.consoleUrl&&c.jsxs("a",{href:N.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[c.jsx(VE,{className:"pp-ic"}),"控制台"]})]})]})]}),c.jsx("div",{className:"pp-config-actions",children:c.jsxs("button",{type:"button",className:"pp-deploy",onClick:$e,disabled:B||A,children:[B?c.jsx(_t,{className:"pp-ic spin"}):O?c.jsx(pR,{className:"pp-ic"}):c.jsx(Ane,{className:"pp-ic"}),B?"部署中…":O?"重试部署":"部署"]})})]})]}),c.jsx(Ine,{open:P,onCancel:rt,onConfirm:()=>void st()})]})}const BS="dogfooding",L0="dogfooding",M0="dogfooding_b";let Fne=0;const D0=()=>++Fne;function FS(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function Une(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function US(e){const t=[],n=Une(e);t.push(n);const r=n.indexOf("{"),i=n.lastIndexOf("}");r>=0&&i>r&&t.push(n.slice(r,i+1));for(const s of t)try{const a=JSON.parse(s);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await wp(X3(a))}catch{}return null}function $ne({userId:e,onBack:t,onCreate:n,onAgentAdded:r,onDeploymentTaskChange:i}){const[s,a]=v.useState([{id:D0(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[o,l]=v.useState(""),[u,d]=v.useState(!1),[f,h]=v.useState(null),[p,m]=v.useState(null),[y,w]=v.useState(!1),[g,E]=v.useState(null),[b,_]=v.useState(null),[k,T]=v.useState(!1),[C,S]=v.useState(!1),[R,I]=v.useState({}),M=v.useRef(null),B=v.useRef(null),Y=v.useRef(null),P=v.useRef(null),U=v.useRef(null);v.useEffect(()=>{const J=P.current;J&&J.scrollTo({top:J.scrollHeight,behavior:"smooth"})},[s,u]),v.useEffect(()=>{const J=U.current;J&&(J.style.height="auto",J.style.height=Math.min(J.scrollHeight,160)+"px")},[o]);const A=J=>a(re=>[...re,{id:D0(),role:"assistant",text:J}]);async function L(){if(M.current)return M.current;const J=await Ep(BS,e);return M.current=J,J}async function O(J,re){if(re.current)return re.current;const de=await Ep(J,e);return re.current=de,de}async function j(J,re){if(!R[J])try{const de=await wd(re);I(G=>({...G,[J]:de.model||re}))}catch{I(de=>({...de,[J]:re}))}}async function N(J,re,de){const G=await O(J,re);let W=Ji();for await(const he of Hu({appName:J,userId:e,sessionId:G,text:de}))W=vl(W,he);const ae=FS(W).trim();return{project:await US(ae),finalText:ae}}const H=async(J,re,de)=>ZE(J.name,J.files,{region:"cn-beijing",projectName:"default"},{...de,onStage:re}),V=async()=>{const J=o.trim();if(!(!J||u)){if(a(re=>[...re,{id:D0(),role:"user",text:J}]),l(""),h(null),d(!0),y){E(null),_(null),T(!0),S(!0),j("a",L0),j("b",M0);const re=N(L0,B,J).then(({project:G})=>(E(G),G)).catch(G=>{const W=G instanceof Error?G.message:String(G);return h(W),null}).finally(()=>T(!1)),de=N(M0,Y,J).then(({project:G})=>(_(G),G)).catch(G=>{const W=G instanceof Error?G.message:String(G);return h(W),null}).finally(()=>S(!1));try{const[G,W]=await Promise.all([re,de]),ae=[G?`方案 A:${G.name}`:null,W?`方案 B:${W.name}`:null].filter(Boolean);ae.length?A(`已生成两个方案(${ae.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const re=await L();let de=Ji();for await(const ae of Hu({appName:BS,userId:e,sessionId:re,text:J}))de=vl(de,ae);const G=FS(de).trim(),W=await US(G);W?(m(W),A(`已生成项目:${W.name}(${W.files.length} 个文件),可在右侧预览和编辑。`)):A(G||"(助手没有返回内容,请再描述一下你的需求。)")}catch(re){const de=re instanceof Error?re.message:String(re);h(de),A(`抱歉,调用智能构建助手失败:${de}`)}finally{d(!1)}}},D=J=>{const re=J==="a"?g:b;if(!re)return;m(re),w(!1),E(null),_(null),T(!1),S(!1);const de=J==="a"?"A":"B",G=J==="a"?R.a:R.b;A(`已采用方案 ${de}(${G??(J==="a"?L0:M0)}),可继续编辑。`)},ne=J=>{J.key==="Enter"&&!J.shiftKey&&!J.nativeEvent.isComposing&&(J.preventDefault(),V())};return c.jsx("div",{className:"ic-root",children:c.jsxs("div",{className:"ic-body",children:[c.jsxs("div",{className:"ic-chat",children:[c.jsxs("div",{className:"ic-transcript",ref:P,children:[c.jsx(Ys,{initial:!1,children:s.map(J=>c.jsxs(Xt.div,{className:`ic-turn ic-turn--${J.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[J.role==="assistant"&&c.jsx("div",{className:"ic-avatar",children:c.jsx(Ka,{className:"ic-avatar-icon"})}),c.jsx("div",{className:"ic-bubble",children:J.role==="assistant"?c.jsx(Rd,{text:J.text}):J.text})]},J.id))}),u&&c.jsxs(Xt.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[c.jsx("div",{className:"ic-avatar",children:c.jsx(Ka,{className:"ic-avatar-icon"})}),c.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[c.jsx("span",{className:"ic-dot"}),c.jsx("span",{className:"ic-dot"}),c.jsx("span",{className:"ic-dot"})]})]})]}),f&&c.jsxs("div",{className:"ic-error",children:[c.jsx(rR,{className:"ic-error-icon"}),f]}),c.jsxs("div",{className:"ic-composer",children:[c.jsxs("div",{className:"ic-composer-box",children:[c.jsx("textarea",{ref:U,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:o,onChange:J=>l(J.target.value),onKeyDown:ne,disabled:u}),c.jsx("button",{className:"ic-send",onClick:()=>void V(),disabled:!o.trim()||u,title:"发送 (Enter)",children:c.jsx(AU,{className:"ic-send-icon"})})]}),c.jsxs("div",{className:"ic-composer-foot",children:[c.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[c.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:y,disabled:u,onChange:J=>w(J.target.checked)}),c.jsx("span",{className:"ic-ab-track",children:c.jsx("span",{className:"ic-ab-thumb"})}),c.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),c.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),c.jsx("aside",{className:"ic-preview",children:y?c.jsxs("div",{className:"ic-compare",children:[c.jsx($S,{side:"a",project:g,loading:k,model:R.a,onAdopt:()=>D("a")}),c.jsx("div",{className:"ic-compare-divider"}),c.jsx($S,{side:"b",project:b,loading:C,model:R.b,onAdopt:()=>D("b")})]}):p?c.jsx(ow,{project:p,onChange:m,onDeploy:H,onAgentAdded:r,onDeploymentTaskChange:i}):c.jsxs("div",{className:"ic-preview-empty",children:[c.jsxs("div",{className:"ic-preview-empty-icon",children:[c.jsx(cU,{className:"ic-preview-empty-glyph"}),c.jsx(Ya,{className:"ic-preview-empty-spark"})]}),c.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),c.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function $S({side:e,project:t,loading:n,model:r,onAdopt:i}){const s=e==="a"?"方案 A":"方案 B";return c.jsxs("div",{className:"ic-pane",children:[c.jsxs("div",{className:"ic-pane-head",children:[c.jsxs("div",{className:"ic-pane-title",children:[c.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:s}),r&&c.jsx("span",{className:"ic-pane-model",children:r})]}),c.jsxs("button",{className:"ic-adopt",onClick:i,disabled:!t||n,title:`采用${s}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),c.jsx("div",{className:"ic-pane-body",children:n?c.jsxs("div",{className:"ic-pane-loading",children:[c.jsx(_t,{className:"ic-pane-spinner"}),c.jsx("span",{children:"正在生成…"})]}):t?c.jsx(ow,{project:t}):c.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}const Hne=/^[A-Za-z_][A-Za-z0-9_]*$/;function cl(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":Hne.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function rD(e){const t=new Set,n=new Set,r=i=>{cl(i.name)===null&&(t.has(i.name)?n.add(i.name):t.add(i.name)),i.subAgents.forEach(r)};return r(e),n}function ri(e){return e.trimEnd().replace(/[。.]+$/,"")}function ha(e,t){return e[t]|e[t+1]<<8}function Sc(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function zne(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function Vne(e){let n=-1;for(let o=e.length-22;o>=0&&o>e.length-65557;o--)if(Sc(e,o)===101010256){n=o;break}if(n<0)throw new Error("无效的 zip:找不到 EOCD");const r=ha(e,n+10);let i=Sc(e,n+16);const s=new TextDecoder("utf-8"),a=[];for(let o=0;o{var o;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((o=a.Metadata)==null?void 0:o.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function Wne({selected:e,onChange:t}){const[n,r]=v.useState(""),[i,s]=v.useState([]),[a,o]=v.useState(!1),[l,u]=v.useState(null),[d,f]=v.useState(!1),h=y=>e.some(w=>w.source==="skillhub"&&w.slug===y),p=y=>{y.slug&&(h(y.slug)?t(e.filter(w=>!(w.source==="skillhub"&&w.slug===y.slug))):t([...e,{source:"skillhub",slug:y.slug,name:y.name,folder:y.slug.split("/").pop()||y.name,namespace:y.namespace||"public",description:y.description}]))},m=async y=>{o(!0),u(null),f(!0);try{const w=await Yne(y);s(w)}catch(w){u(w instanceof Error?w.message:"搜索失败,请稍后重试。"),s([])}finally{o(!1)}};return v.useEffect(()=>{const y=n.trim();if(!y){s([]),f(!1),u(null);return}const w=setTimeout(()=>m(y),300);return()=>clearTimeout(w)},[n]),c.jsxs("div",{className:"cw-skillhub",children:[c.jsxs("div",{className:"cw-skill-searchrow",children:[c.jsxs("div",{className:"cw-skill-searchbox",children:[c.jsx(g1,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),c.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:y=>r(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),n.trim()&&m(n))}})]}),c.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?c.jsx(_t,{className:"cw-i cw-spin"}):c.jsx(g1,{className:"cw-i"}),"搜索"]})]}),l&&c.jsxs("div",{className:"cw-banner",children:[c.jsx(Ed,{className:"cw-i"}),c.jsx("span",{children:l})]}),a&&i.length===0?c.jsx("p",{className:"cw-empty-line",children:"正在搜索…"}):i.length>0?c.jsx("div",{className:"cw-skill-results",children:i.map(y=>{const w=h(y.slug||"");return c.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>p(y),"aria-pressed":w,children:[c.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?c.jsx($i,{className:"cw-i cw-i-sm"}):c.jsx(Ei,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-skill-result-meta",children:[c.jsx("span",{className:"cw-skill-result-name",children:y.name}),y.description&&c.jsx("span",{className:"cw-skill-result-desc",children:ri(y.description)}),y.sourceRepo&&c.jsx("span",{className:"cw-skill-result-repo",children:y.sourceRepo})]})]},y.id||y.slug)})}):d&&!l?c.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&c.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const Z1=/(^|\/)skill\.md$/i;class qs extends Error{}function qne(e,t){const n=(e??"").replace(/\r\n?/g,` -`).split(` -`);if(!n.length||n[0].trim()!=="---")throw new qs(`${t} 的 SKILL.md 必须以 YAML frontmatter (--- ... ---) 开头`);let r=-1;for(let o=1;o=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function Xne(e,t){if(!e)throw new qs(`${t} 的 SKILL.md 缺少必填的 name frontmatter`);if(e.length>64)throw new qs(`${t} 的 name 长度超过 64 个字符`);if(!/^[a-z0-9-]+$/.test(e))throw new qs(`${t} 的 name 必须匹配 [a-z0-9-]+(小写字母、数字、短横线)`)}function Qne(e,t){if(!e)throw new qs(`${t} 的 SKILL.md 缺少必填的 description frontmatter`);if(e.length>1024)throw new qs(`${t} 的 description 长度超过 1024 个字符`);if(/<[^>]+>/.test(e))throw new qs(`${t} 的 description 不能包含 XML 标签`)}function iD(e){const t=e.map(r=>({path:r.path.replace(/\\/g,"/").replace(/^\.\//,""),text:r.text})).filter(r=>r.path.length>0&&!r.path.endsWith("/")),n=new Set(t.map(r=>r.path.split("/")[0]));if(n.size===1&&t.every(r=>r.path.includes("/"))){const r=[...n][0]+"/";return t.map(i=>({path:i.path.slice(r.length),text:i.text}))}return t}function Zne(e){const t=new Map,n=new Set;for(const r of e)if(Z1.test("/"+r.path)){const i=r.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const r of e){const i=r.path.split("/");let s="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){s=d;break}}const a=Z1.test("/"+r.path);if(!s&&!a&&!n.has("")||!n.has(s)&&!a)continue;const o=s?r.path.slice(s.length+1):r.path,l=t.get(s)||[];l.push({path:o,text:r.text}),t.set(s,l)}return t}function Jne(e,t,n){const r=`${n}${e?"/"+e:""}`,i=t.find(l=>Z1.test("/"+l.path));if(!i)return{hit:null,error:`${r} 缺少 SKILL.md`};let s;try{s=qne(i.text,r)}catch(l){return{hit:null,error:l instanceof Error?l.message:String(l)}}const a=s.name,o=[];for(const l of t){if(l.path.split("/").some(f=>f===".."))return{hit:null,error:`${r} 包含非法路径(..):${l.path}`};const d=`skills/${a}/${l.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${r} 包含非法路径:${l.path}`};o.push({path:d,content:l.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:s.name,description:s.description,folder:a,localFiles:o},error:null}}async function ere(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await Vne(t)).map(i=>({path:i.name,text:i.text}));return sD(iD(r),e.name)}async function tre(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function rre(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((i,s)=>t.readEntries(i,s));if(r.length===0)return n;n.push(...r)}}async function aD(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await nre(e),path:n}];if(!e.isDirectory)return[];const r=await rre(e);return(await Promise.all(r.map(i=>aD(i,n)))).flat()}function ire({selected:e,onChange:t}){const[n,r]=v.useState([]),[i,s]=v.useState([]),[a,o]=v.useState(!1),[l,u]=v.useState(!1),d=v.useRef(0),f=b=>e.some(_=>_.source==="local"&&_.folder===b),h=b=>{b.localFiles&&(f(b.folder||b.name)?t(e.filter(_=>!(_.source==="local"&&_.folder===(b.folder||b.name)))):t([...e,{source:"local",folder:b.folder||b.name,name:b.name,description:b.description,localFiles:b.localFiles}]))},p=v.useRef([]),m=v.useRef(e);v.useEffect(()=>{p.current=i},[i]),v.useEffect(()=>{m.current=e},[e]);const y=b=>{const _=new Set([...p.current.map(S=>S.folder||S.name),...m.current.filter(S=>S.source==="local").map(S=>S.folder)]),k=[],T=[];for(const S of b.hits){const R=S.folder||S.name;if(_.has(R)){k.push(S.name);continue}_.add(R),T.push(S)}s(S=>[...S,...T]);const C=[...b.errors];if(k.length>0&&C.push(`已跳过重复技能:${k.join("、")}`),r(C),T.length===1&&b.errors.length===0&&k.length===0){const S=T[0];S.localFiles&&t([...m.current,{source:"local",folder:S.folder||S.name,name:S.name,description:S.description,localFiles:S.localFiles}])}},w=b=>{b.preventDefault(),d.current+=1,u(!0)},g=b=>{b.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},E=async b=>{if(b.preventDefault(),d.current=0,u(!1),a)return;const _=Array.from(b.dataTransfer.items).map(k=>{var T;return(T=k.webkitGetAsEntry)==null?void 0:T.call(k)}).filter(k=>k!==null);if(_.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}o(!0);try{const k=(await Promise.all(_.map(S=>aD(S)))).flat(),T=_.some(S=>S.isDirectory);if(!T&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){y(await ere(k[0].file));return}if(!T){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const C=new Map(k.map(({file:S,path:R})=>[S,R]));y(await tre(k.map(({file:S})=>S),C))}catch(k){r([`读取失败:${k instanceof Error?k.message:String(k)}`])}finally{o(!1)}};return c.jsxs("div",{className:"cw-local",children:[c.jsxs("div",{className:`cw-local-dropzone ${l?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:w,onDragOver:b=>b.preventDefault(),onDragLeave:g,onDrop:b=>void E(b),children:[c.jsx(KE,{className:"cw-local-drop-icon","aria-hidden":!0}),c.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),c.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md(含 name / description frontmatter)。支持包含多个技能的目录。"}),a&&c.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&c.jsxs("div",{className:"cw-banner",children:[c.jsx(Ed,{className:"cw-i"}),c.jsx("span",{children:n.join(";")})]}),i.length>0&&c.jsx("div",{className:"cw-skill-results",children:i.map(b=>{var k;const _=f(b.folder||b.name);return c.jsxs("button",{type:"button",className:`cw-skill-result ${_?"is-on":""}`,onClick:()=>h(b),"aria-pressed":_,children:[c.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:_?c.jsx($i,{className:"cw-i cw-i-sm"}):c.jsx(Ei,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-skill-result-meta",children:[c.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&c.jsx("span",{className:"cw-skill-result-desc",children:ri(b.description)}),c.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((k=b.localFiles)==null?void 0:k.length)??0," 个文件"]})]})]},b.id)})})]})}function sre({selected:e,onChange:t}){const[n,r]=v.useState([]),[i,s]=v.useState([]),[a,o]=v.useState(""),[l,u]=v.useState(!0),[d,f]=v.useState(!1),[h,p]=v.useState(null);v.useEffect(()=>{let g=!1;return(async()=>{u(!0),p(null);try{const E=await i7();g||(r(E),E.length>0&&o(E[0].id))}catch(E){g||p(E instanceof Error?E.message:"加载失败")}finally{g||u(!1)}})(),()=>{g=!0}},[]),v.useEffect(()=>{if(!a){s([]);return}const g=n.find(b=>b.id===a);let E=!1;return(async()=>{f(!0),p(null);try{const b=await a7(a,g==null?void 0:g.region);E||s(b)}catch(b){E||p(b instanceof Error?b.message:"加载失败")}finally{E||f(!1)}})(),()=>{E=!0}},[a,n]);const m=n.find(g=>g.id===a),y=(g,E)=>e.some(b=>b.source==="skillspace"&&b.skillId===g&&(b.version||"")===E),w=g=>{if(m)if(y(g.skillId,g.version))t(e.filter(E=>!(E.source==="skillspace"&&E.skillId===g.skillId&&(E.version||"")===g.version)));else{const E=c7(m,g);t([...e,{source:"skillspace",folder:E.folder||g.skillName,name:E.name,description:E.description,skillSpaceId:E.skillSpaceId,skillSpaceName:E.skillSpaceName,skillSpaceRegion:E.skillSpaceRegion,skillId:E.skillId,version:E.version}])}};return c.jsx("div",{className:"cw-skillspace",children:l?c.jsxs("p",{className:"cw-empty-line",children:[c.jsx(_t,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?c.jsxs("div",{className:"cw-banner",children:[c.jsx(Ed,{className:"cw-i"}),c.jsx("span",{children:h})]}):n.length===0?c.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cw-skillspace-header",children:[c.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:g=>o(g.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(g=>c.jsxs("option",{value:g.id,children:[g.name||g.id,g.region?` [${g.region}]`:"",g.description?` — ${ri(g.description)}`:""]},g.id))}),m&&c.jsx("a",{href:u7(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开",children:c.jsx(VE,{className:"cw-i cw-i-sm"})})]}),d?c.jsxs("p",{className:"cw-empty-line",children:[c.jsx(_t,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):i.length===0?c.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):c.jsx("div",{className:"cw-skill-results",children:i.map(g=>{const E=y(g.skillId,g.version);return c.jsxs("button",{type:"button",className:`cw-skill-result ${E?"is-on":""}`,onClick:()=>w(g),"aria-pressed":E,children:[c.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:E?c.jsx($i,{className:"cw-i cw-i-sm"}):c.jsx(Ei,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-skill-result-meta",children:[c.jsxs("span",{className:"cw-skill-result-name",children:[g.skillName,g.version&&c.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",g.version]})]}),g.skillDescription&&c.jsx("span",{className:"cw-skill-result-desc",children:ri(g.skillDescription)}),c.jsxs("span",{className:"cw-skill-result-repo",children:[c.jsx(nU,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${g.skillId}/${g.version}`)})})]})})}const are=v.lazy(()=>ll(()=>import("./MarkdownPromptEditor-CvbLdIOO.js"),__vite__mapDeps([0,1])));function ore(e,t,n="text/plain"){const r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement("a");i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}const HS=[{id:"type",label:"类型",hint:"选择 Agent 类型",icon:CU,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:Ed,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:iR},{id:"tools",label:"工具",hint:"可调用的能力",icon:qE},{id:"skills",label:"技能",hint:"声明式技能",icon:Ya},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:yh},{id:"advanced",label:"进阶配置",hint:"记忆与观测",icon:dR},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:nR},{id:"review",label:"完成",hint:"预览并创建",icon:NU}];function lre({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"m7.2 15.8 7.9-7.9a2 2 0 0 1 2.8 0l1.2 1.2a2 2 0 0 1 0 2.8l-7 7H8.7l-1.5-1.5a1.15 1.15 0 0 1 0-1.6Z"}),c.jsx("path",{d:"m12.7 10.3 4 4"}),c.jsx("path",{d:"M6.3 19h12.4"}),c.jsx("path",{d:"m5.5 8.2.5-1.4 1.4-.5L6 5.8l-.5-1.4L5 5.8l-1.4.5 1.4.5.5 1.4Z"})]})}function cre({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"3.25",y:"4.25",width:"17.5",height:"15.5",rx:"2.75"}),c.jsx("path",{d:"M3.75 8.75h16.5"}),c.jsx("circle",{cx:"6.35",cy:"6.5",r:"0.72",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"8.85",cy:"6.5",r:"0.72",fill:"currentColor",stroke:"none",opacity:"0.45"}),c.jsx("path",{d:"M6 14h2.2l1.35-2.8 2.1 5.5 1.7-3.1H18"})]})}function ure({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),c.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),c.jsx("path",{d:"M3 10v4",opacity:"0.45"}),c.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}const P0=4,dre={llm:"LLM 智能体",sequential:"顺序型智能体",parallel:"并行型智能体",loop:"循环型智能体",a2a:"远程智能体"},zS={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"};function oD(e,t){var r,i,s;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((r=e.registryTopK)==null?void 0:r.trim())||ls.topK,n.REGISTRY_REGION=((i=e.registryRegion)==null?void 0:i.trim())||ls.region,n.REGISTRY_ENDPOINT=((s=e.registryEndpoint)==null?void 0:s.trim())||ls.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function VS({items:e,selected:t,onToggle:n,scrollRows:r}){return c.jsx("div",{className:`cw-checklist ${r?"cw-checklist-tools":""}`,style:r?{"--cw-checklist-max-height":`${r*65+(r-1)*8}px`}:void 0,children:e.map(i=>{const s=t.includes(i.id);return c.jsxs("button",{type:"button",className:`cw-check ${s?"is-on":""}`,onClick:()=>n(i.id),"aria-pressed":s,children:[c.jsx("span",{className:"cw-check-box","aria-hidden":!0,children:s&&c.jsx($i,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-check-text",children:[c.jsx("span",{className:"cw-check-title",children:i.label}),c.jsx("span",{className:"cw-check-desc",children:ri(i.desc)})]})]},i.id)})})}function j0({options:e,value:t,onChange:n}){return c.jsx("div",{className:"cw-segmented",children:e.map(r=>{var s;const i=(t??((s=e[0])==null?void 0:s.id))===r.id;return c.jsxs("button",{type:"button",className:`cw-seg ${i?"is-on":""}`,onClick:()=>n(r.id),"aria-pressed":i,title:ri(r.desc),children:[c.jsx("span",{className:"cw-seg-title",children:r.label}),c.jsx("span",{className:"cw-seg-desc",children:ri(r.desc)})]},r.id)})})}function fre(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Nc({env:e,values:t,onChange:n}){return e.length===0?c.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):c.jsx("div",{className:"cw-env-fields",children:e.map(r=>c.jsxs("label",{className:"cw-env-field",children:[c.jsxs("span",{className:"cw-env-field-head",children:[c.jsxs("span",{className:"cw-env-field-label",children:[r.comment||r.key,r.required&&c.jsx("span",{className:"cw-req",children:"*"})]}),r.comment&&c.jsx("code",{title:r.key,children:r.key})]}),c.jsx("input",{className:"cw-input",type:fre(r.key)?"password":"text",value:t[r.key]??"",placeholder:r.placeholder||"请输入参数值",autoComplete:"off",onChange:i=>n(r.key,i.currentTarget.value)})]},r.key))})}function hre({tools:e,onChange:t}){const n=(s,a)=>t(e.map((o,l)=>l===s?{...o,...a}:o)),r=s=>t(e.filter((a,o)=>o!==s)),i=()=>t([...e,{name:"",transport:"http",url:""}]);return c.jsxs("div",{className:"cw-mcp",children:[e.length>0&&c.jsx("div",{className:"cw-mcp-list",children:c.jsx(Ys,{initial:!1,children:e.map((s,a)=>c.jsxs(Xt.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[c.jsxs("div",{className:"cw-mcp-rowhead",children:[c.jsxs("div",{className:"cw-mcp-transport",children:[c.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${s.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":s.transport==="http",children:c.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),c.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${s.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":s.transport==="stdio",children:c.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),c.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>r(a),"aria-label":"移除 MCP 工具",children:c.jsx(Vl,{className:"cw-i cw-i-sm"})})]}),c.jsx("input",{className:"cw-input",value:s.name,placeholder:"名称(用于命名,可留空)",onChange:o=>n(a,{name:o.target.value})}),s.transport==="http"?c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"cw-input",value:s.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:o=>n(a,{url:o.target.value})}),c.jsx("input",{className:"cw-input",value:s.authToken??"",placeholder:"Bearer Token(可选)",onChange:o=>n(a,{authToken:o.target.value})})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"cw-input",value:s.command??"",placeholder:"启动命令,例如 npx",onChange:o=>n(a,{command:o.target.value})}),c.jsx("input",{className:"cw-input",value:(s.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:o=>n(a,{args:o.target.value.split(/\s+/).filter(Boolean)})}),c.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),c.jsxs("button",{type:"button",className:"cw-add-sub",onClick:i,children:[c.jsx(Ei,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&c.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function lD({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),c.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),c.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),c.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function pre({s:e,onRemove:t}){let n=Ya,r="火山 Find Skill 技能广场";return e.source==="local"?(n=KE,r="本地"):e.source==="skillspace"&&(n=lD,r="AgentKit Skills 中心"),c.jsxs(Xt.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[c.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:c.jsx(n,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-selected-skill-meta",children:[c.jsx("span",{className:"cw-selected-skill-name",children:e.name}),c.jsxs("span",{className:"cw-selected-skill-detail",children:[r,e.description?` · ${ri(e.description)}`:""]})]}),c.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:c.jsx(ti,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const B0=[{id:"local",label:"本地文件",icon:KE},{id:"skillspace",label:"AgentKit Skills 中心",icon:lD},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:wm}];function mre({selected:e,onChange:t}){const[n,r]=v.useState("local"),[i,s]=v.useState(!1),a=B0.findIndex(l=>l.id===n),o=l=>t(e.filter(u=>F0(u)!==l));return v.useEffect(()=>{if(!i)return;const l=u=>{u.key==="Escape"&&s(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),c.jsxs("div",{className:"cw-skillspane",children:[c.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>s(!0),children:[c.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:c.jsx(Ei,{className:"cw-i"})}),c.jsx("span",{children:"添加 Skill"})]}),e.length>0&&c.jsxs("div",{className:"cw-skill-selected",children:[c.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),c.jsx("div",{className:"cw-selected-skill-list",children:c.jsx(Ys,{initial:!1,children:e.map(l=>c.jsx(pre,{s:l,onRemove:()=>o(F0(l))},F0(l)))})})]}),c.jsx(Ys,{children:i&&c.jsx(Xt.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:l=>{l.target===l.currentTarget&&s(!1)},children:c.jsxs(Xt.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[c.jsxs("div",{className:"cw-skill-dialog-head",children:[c.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),c.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>s(!1),children:c.jsx(ti,{className:"cw-i"})})]}),c.jsxs("div",{className:"cw-skill-dialog-body",children:[c.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${B0.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[c.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),B0.map(({id:l,label:u,icon:d})=>c.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${l}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===l,className:`cw-skill-pickertab ${n===l?"is-on":""}`,onClick:()=>r(l),children:[c.jsx(d,{className:"cw-i cw-i-sm"}),u]},l))]}),c.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&c.jsx(Wne,{selected:e,onChange:t}),n==="local"&&c.jsx(ire,{selected:e,onChange:t}),n==="skillspace"&&c.jsx(sre,{selected:e,onChange:t})]})]})]})})})]})}function F0(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Ac({checked:e,onChange:t,title:n,desc:r,icon:i}){return c.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[c.jsx("span",{className:"cw-toggle-icon",children:c.jsx(i,{className:"cw-i"})}),c.jsxs("span",{className:"cw-toggle-text",children:[c.jsx("span",{className:"cw-toggle-title",children:n}),c.jsx("span",{className:"cw-toggle-desc",children:ri(r)})]}),c.jsx("span",{className:"cw-switch","aria-hidden":!0,children:c.jsx(Xt.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}const KS=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]);function gre(e,t){var r;let n=e;for(const i of t)if(n=(r=n.subAgents)==null?void 0:r[i],!n)return!1;return!0}function Ih(e,t){let n=e;for(const r of t)n=n.subAgents[r];return n}function Fd(e,t,n){if(t.length===0)return n(e);const[r,...i]=t,s=e.subAgents.slice();return s[r]=Fd(s[r],i,n),{...e,subAgents:s}}function yre(e,t){return Fd(e,t,n=>({...n,subAgents:[...n.subAgents,ea()]}))}function bre(e,t){if(t.length===0)return e;const n=t.slice(0,-1),r=t[t.length-1];return Fd(e,n,i=>({...i,subAgents:i.subAgents.filter((s,a)=>a!==r)}))}function Ere(e,t,n,r){return Fd(e,t,i=>{const s=i.subAgents.slice(),[a]=s.splice(n,1);return s.splice(r,0,a),{...i,subAgents:s}})}const xre=e=>e==="sequential"||e==="loop",cD=e=>!Bd(e.agentType),wre=3;function uD(e,t,n=!1){var i;if(Bd(e.agentType))return n?"远程 Agent 只能作为子 Agent":(i=e.a2aRegistry)!=null&&i.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心 ID";const r=cl(e.name);return r||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":Z3(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function dD(e,t,n=[]){const r=[],i=Bd(e.agentType),s=uD(e,t,n.length===0);return s&&r.push({path:n,name:i?"远程 Agent":e.name.trim()||"未命名",problem:s}),cD(e)&&e.subAgents.forEach((a,o)=>r.push(...dD(a,t,[...n,o]))),r}function fD(e){return 1+e.subAgents.reduce((t,n)=>t+fD(n),0)}function vre(e){const t=[],n={},r=s=>{var a,o,l,u;for(const d of s.builtinTools??[]){const f=sw.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=s.a2aRegistry)!=null&&a.enabled&&(t.push({env:z3}),Object.assign(n,oD(s.a2aRegistry,{includeDefaults:!0}))),s.memory.shortTerm&&t.push({env:((o=jp.find(d=>d.id===(s.shortTermBackend??"local")))==null?void 0:o.env)??[]}),s.memory.longTerm&&t.push({env:((l=Bp.find(d=>d.id===(s.longTermBackend??"local")))==null?void 0:l.env)??[]}),s.knowledgebase&&t.push({env:((u=Fp.find(d=>d.id===(s.knowledgebaseBackend??"local")))==null?void 0:u.env)??[]}),s.tracing)for(const d of s.tracingExporters??[]){const f=Up.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}s.subAgents.forEach(r)};r(e);const i=J3(t);return{specs:i.specs,fixedValues:{...i.fixedValues,...n}}}function hD({root:e,path:t,selectedPath:n,duplicateNames:r,showErrors:i,validationPulse:s,onSelect:a,onChange:o,onClearRoot:l}){const u=Ih(e,t),d=aw(u.agentType),f=d.icon,h=t.length===0,p=KS(t,n),m=cD(u),y=m&&t.length{const C=yre(e,t),S=Ih(C,t).subAgents.length-1;o(C,[...t,S])},g=()=>o(bre(e,t),t.slice(0,-1)),E=t.slice(0,-1),b=!h&&xre(Ih(e,E).agentType),[_,k]=v.useState(!1),T=C=>{C.preventDefault(),C.stopPropagation(),k(!1);const S=C.dataTransfer.getData("application/x-agent-path");if(!S)return;let R;try{R=JSON.parse(S)}catch{return}if(!KS(R.slice(0,-1),E))return;const I=R[R.length-1],M=t[t.length-1];I!==M&&o(Ere(e,E,I,M),[...E,M])};return c.jsxs("div",{className:"cw-tree-branch",children:[c.jsxs("div",{className:`cw-tree-node cw-tree-type-${u.agentType??"llm"} ${p?"is-selected":""} ${b?"is-draggable":""} ${_?"is-dragover":""} ${i&&uD(u,r,h)?`is-invalid cw-error-shake-${s%2}`:""}`,role:"button",tabIndex:0,draggable:b,onDragStart:b?C=>{C.dataTransfer.setData("application/x-agent-path",JSON.stringify(t)),C.dataTransfer.effectAllowed="move",C.stopPropagation()}:void 0,onDragOver:b?C=>{C.preventDefault(),k(!0)}:void 0,onDragLeave:b?()=>k(!1):void 0,onDrop:b?T:void 0,onClick:()=>a(t),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a(t))},children:[c.jsx(f,{className:"cw-tree-icon"}),c.jsxs("span",{className:"cw-tree-main",children:[c.jsx("span",{className:"cw-tree-name",children:Bd(u.agentType)?"远程 Agent":u.name.trim()||"未命名"}),c.jsx("span",{className:"cw-tree-type",children:d.label})]}),c.jsxs("span",{className:"cw-tree-actions",children:[h&&c.jsx("button",{type:"button",className:"cw-icon-btn cw-tree-clear",title:"清空根 Agent","aria-label":"清空根 Agent",onClick:C=>{C.stopPropagation(),l()},children:c.jsx(lre,{className:"cw-i cw-i-sm"})}),y&&c.jsx("button",{type:"button",className:"cw-icon-btn",title:"添加子 Agent",onClick:C=>{C.stopPropagation(),w()},children:c.jsx(Ei,{className:"cw-i cw-i-sm"})}),!h&&c.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",title:"删除",onClick:C=>{C.stopPropagation(),g()},children:c.jsx(Vl,{className:"cw-i cw-i-sm"})})]})]}),m&&u.subAgents.length>0&&c.jsx("div",{className:"cw-tree-children",children:u.subAgents.map((C,S)=>c.jsx(hD,{root:e,path:[...t,S],selectedPath:n,duplicateNames:r,showErrors:i,validationPulse:s,onSelect:a,onChange:o,onClearRoot:l},S))})]})}function Rh(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function YS(e){return JSON.stringify(Rh(e))}function _re({enabled:e,disabledReason:t,phase:n,stale:r,run:i,projectName:s,logs:a,messages:o,input:l,error:u,deploying:d,deployError:f,onInput:h,onSend:p,onRestart:m,onIgnoreChanges:y,onDeploy:w}){const[g,E]=v.useState(!1),b=n==="ready"||n==="sending",_=n==="building"||n==="starting"||n==="sending",k=e&&!i&&n==="idle",T=e&&(n==="building"||n==="starting"),C=!!(i&&r&&!T);return g?c.jsx("aside",{className:"cw-debug is-collapsed","aria-label":"调试窗口(已收起)",children:c.jsx("button",{type:"button",className:"cw-debug-expand",onClick:()=>E(!1),"aria-label":"展开调试栏",title:"展开调试栏",children:c.jsx(cre,{className:"cw-i"})})}):c.jsxs("aside",{className:"cw-debug","aria-label":"调试窗口",children:[c.jsxs("div",{className:"cw-debug-head",children:[c.jsxs("div",{className:"cw-debug-title",children:[c.jsx("button",{type:"button",className:"cw-debug-collapse",onClick:()=>E(!0),"aria-label":"收起调试栏",title:"收起调试栏",children:c.jsx(dr,{className:"cw-i cw-i-sm"})}),c.jsx("span",{children:"调试"})]}),c.jsx("div",{className:"cw-debug-head-actions",children:c.jsxs("button",{type:"button",className:"cw-debug-deploy",disabled:d,onClick:w,title:"查看源码、填写环境变量并部署",children:["去部署",d?c.jsx(_t,{className:"cw-i cw-spin"}):c.jsx(JI,{className:"cw-i"})]})})]}),!i&&n==="idle"&&!e&&c.jsx("div",{className:"cw-debug-sub",children:c.jsx("span",{children:t})}),f&&c.jsx("div",{className:"cw-debug-deploy-error",role:"alert",children:f}),c.jsxs("div",{className:"cw-debug-stage",children:[c.jsx("div",{className:"cw-debug-body",children:e?n==="error"?c.jsxs("div",{className:"cw-debug-error",children:[c.jsx($p,{message:u||"调试失败",className:"cw-debug-error-detail",onRetry:async()=>{await m()}}),a.length>0&&c.jsx("div",{className:"cw-debug-progress",children:a.map((S,R)=>c.jsx("div",{className:"cw-debug-logline",children:c.jsx("span",{children:S})},`${S}-${R}`))})]}):c.jsx("div",{className:"cw-debug-chat",children:o.length===0?c.jsx("div",{className:"cw-debug-chat-empty",children:"输入消息开始验证当前 Agent。"}):o.map((S,R)=>c.jsxs("div",{className:`cw-debug-msg cw-debug-msg-${S.role}`,children:[c.jsx("div",{className:"cw-debug-role",children:S.role==="user"?"你":s||"Agent"}),c.jsx("div",{className:"cw-debug-content",children:S.role==="user"?S.content:S.error?c.jsx($p,{message:S.error,className:"cw-debug-msg-error"}):S.blocks&&S.blocks.length>0?c.jsx(Hx,{blocks:S.blocks,onAction:()=>{}}):S.content?S.content:R===o.length-1&&n==="sending"?c.jsx(r3,{}):null})]},R))}):c.jsx("div",{className:"cw-debug-empty",children:t})}),c.jsx("div",{className:"cw-debug-composer",children:c.jsxs("div",{className:"cw-debug-composerbox",children:[c.jsx("textarea",{className:"cw-debug-input",rows:1,value:l,placeholder:r?"更新 Agent 后可继续调试":b?"输入测试消息...":"调试环境启动后可输入",disabled:!b||_||r,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),p())}}),c.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!b||_||r||!l.trim(),onClick:p,children:n==="sending"?c.jsx(_t,{className:"cw-i cw-spin"}):c.jsx(eR,{className:"cw-i"})})]})}),(k||T||C)&&c.jsx("div",{className:"cw-debug-overlay",role:"status","aria-live":"polite",children:c.jsxs("div",{className:"cw-debug-overlay-content",children:[c.jsx("strong",{className:"cw-debug-overlay-title",children:T?"正在初始化调试环境":C?"Agent 配置已变更":"启动调试环境"}),T?c.jsx("div",{className:"cw-debug-overlay-progress",children:a.map((S,R)=>c.jsxs("div",{className:"cw-debug-logline",children:[R===a.length-1?c.jsx(_t,{className:"cw-i cw-spin"}):c.jsx($i,{className:"cw-i"}),c.jsx("span",{children:S})]},`${S}-${R}`))}):C?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"cw-debug-overlay-copy",children:"当前对话仍在使用上一次配置。更新后,新配置才会生效。"}),c.jsxs("div",{className:"cw-debug-overlay-actions",children:[c.jsx("button",{type:"button",className:"cw-debug-ignore",disabled:_,onClick:y,children:"忽略"}),c.jsxs("button",{type:"button",className:"cw-debug-start",disabled:_,onClick:m,children:[c.jsx(YE,{className:"cw-i"}),"更新 Agent"]})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"cw-debug-overlay-copy",children:"启动后会生成代码并创建临时运行环境。"}),c.jsxs("button",{type:"button",className:"cw-debug-start",onClick:m,children:[c.jsx(ure,{className:"cw-i cw-debug-run-icon"}),"启动调试环境"]})]})]})})]})]})}function Tre({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:r,features:i,onDeploymentTaskChange:s}){var Un,sr,Wn,Rn,at,On,Ut,en,Ln,$n,Tn;const[a,o]=v.useState(()=>r??ea()),[l,u]=v.useState(!1),[d,f]=v.useState(0),[h,p]=v.useState(null),[m,y]=v.useState(!1),[w,g]=v.useState("cn-beijing"),E=(i==null?void 0:i.generatedAgentTestRun)===!0,b=(i==null?void 0:i.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[_,k]=v.useState("idle"),[T,C]=v.useState(null),S=v.useRef(null),[R,I]=v.useState(null),[M,B]=v.useState(""),[Y,P]=v.useState([]),[U,A]=v.useState([]),[L,O]=v.useState(""),[j,N]=v.useState(null),[H,V]=v.useState(""),[D,ne]=v.useState(""),[J,re]=v.useState("basic"),[de,G]=v.useState(""),[W,ae]=v.useState(!1),[he,Z]=v.useState(!1),[ce,Ie]=v.useState(!1),[xe,ge]=v.useState([]),De=v.useRef(null),_e=v.useRef({});v.useEffect(()=>()=>{const te=S.current;te&&E1(te.runId).catch(Ne=>console.warn("清理调试运行失败",Ne))},[]);const He=v.useRef(null);He.current||(He.current=({meta:te,children:Ne})=>c.jsxs("section",{ref:Re=>{_e.current[te.id]=Re},id:`cw-sec-${te.id}`,"data-step-id":te.id,className:"cw-section",children:[c.jsx("header",{className:"cw-sec-head",children:c.jsxs("h2",{className:"cw-sec-title",children:[te.label,te.required&&c.jsx("span",{className:"cw-sec-required",children:"必填"})]})}),Ne]}));const Oe=gre(a,xe)?xe:[],oe=Ih(a,Oe),kt=Oe.length===0,ve=`cw-model-advanced-${Oe.join("-")||"root"}`,St=`cw-more-tool-types-${Oe.join("-")||"root"}`,dt=`cw-advanced-config-${Oe.join("-")||"root"}`,K=Math.max(0,Vf.findIndex(te=>te.id===(oe.agentType??"llm"))),X=te=>o(Ne=>Fd(Ne,Oe,Re=>({...Re,...te}))),le=(te,Ne)=>o(Re=>{var Be;return{...Re,deployment:{...Re.deployment??{feishuEnabled:!1},envValues:{...((Be=Re.deployment)==null?void 0:Be.envValues)??{},[te]:Ne}}}}),Se=te=>X({a2aRegistry:{...oe.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...te}}),Le=(te,Ne)=>{if(!(te in zS))return;const Re=zS[te];Se({[Re]:Ne}),le(te,Ne)},ft=te=>{if(!(kt&&te==="a2a")){if(te==="a2a"){X({agentType:te,a2aRegistry:{...oe.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}X({agentType:te,a2aRegistry:oe.a2aRegistry?{...oe.a2aRegistry,enabled:!1}:void 0})}},qe=(te,Ne)=>{o(te),Ne&&ge(Ne)},ct=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(o(ea()),ge([]),u(!1),Ie(!1))},Jt=oe.builtinTools??[],Ot=oe.mcpTools??[],Xe=oe.tracingExporters??[],xt=oe.selectedSkills??[],Vt=[oe.memory.shortTerm,oe.memory.longTerm,oe.tracing].filter(Boolean).length,An=te=>X({builtinTools:Jt.includes(te)?Jt.filter(Ne=>Ne!==te):[...Jt,te]}),$e=te=>{const Ne=Xe.includes(te)?Xe.filter(Re=>Re!==te):[...Xe,te];X({tracingExporters:Ne,tracing:Ne.length>0?!0:oe.tracing})},st=Z3(oe.agentType),rt=Bd(oe.agentType),bt=v.useMemo(()=>rD(a),[a]),ue=rt?null:cl(oe.name)??(bt.has(oe.name)?"Agent 名称在当前结构中必须唯一":null),Me=ue!==null,Ze=!rt&&oe.description.trim().length===0,un=oe.instruction.trim().length===0,dn=rt&&!((Un=oe.a2aRegistry)!=null&&Un.registrySpaceId.trim()),se=te=>l&&te?`is-error cw-error-shake-${d%2}`:"",Te=v.useMemo(()=>dD(a,bt),[a,bt]),ye=Te.length===0,je=v.useMemo(()=>YS(a),[a]),ze=v.useMemo(()=>vre(a),[a]),Ge=!!(T&&H&&H!==je&&D!==je);v.useEffect(()=>{D&&D!==je&&ne("")},[je,D]);const Et=v.useMemo(()=>{var te,Ne,Re,Be;return{type:!0,basic:rt?!dn:!Me&&(st||!un),model:!!((te=oe.modelName)!=null&&te.trim()||(Ne=oe.modelProvider)!=null&&Ne.trim()||(Re=oe.modelApiBase)!=null&&Re.trim()),tools:Jt.length>0||Ot.length>0,skills:xt.length>0,knowledge:oe.knowledgebase,advanced:oe.memory.shortTerm||oe.memory.longTerm||oe.tracing,subagents:(((Be=oe.subAgents)==null?void 0:Be.length)??0)>0,review:ye}},[oe,Me,un,st,rt,ye,Jt,Ot,xt]),Mt=st||rt?["basic"]:["basic","model","tools","skills","knowledge",...kt?["advanced"]:[]],bn=HS.filter(te=>Mt.includes(te.id)),En=Mt.join("|"),Kt=Oe.join("."),Cn=bn.findIndex(te=>te.id===J),rr=te=>{var Ne;(Ne=_e.current[te])==null||Ne.scrollIntoView({behavior:"smooth",block:"start"})};v.useEffect(()=>{if(h)return;const te=De.current;if(!te)return;const Ne=En.split("|");let Re=0;const Be=()=>{Re=0;const mt=Ne[Ne.length-1];let tn=Ne[0];if(te.scrollTop+te.clientHeight>=te.scrollHeight-2)tn=mt;else{const vt=te.getBoundingClientRect().top+24;for(const Mn of Ne){const Nt=_e.current[Mn];if(!Nt||Nt.getBoundingClientRect().top>vt)break;tn=Mn}}tn&&re(vt=>vt===tn?vt:tn)},wt=()=>{Re||(Re=window.requestAnimationFrame(Be))};return Be(),te.addEventListener("scroll",wt,{passive:!0}),window.addEventListener("resize",wt),()=>{te.removeEventListener("scroll",wt),window.removeEventListener("resize",wt),Re&&window.cancelAnimationFrame(Re)}},[h,En,Kt]);const Sr=()=>ye?!0:(u(!0),f(te=>te+1),Te[0]&&(ge(Te[0].path),window.requestAnimationFrame(()=>rr("basic"))),!1),Fn=async()=>{const te=S.current;if(S.current=null,C(null),I(null),V(""),ne(""),te)try{await E1(te.runId)}catch(Ne){console.warn("清理调试运行失败",Ne)}},Yn=async()=>{if(G(""),!!Sr()){y(!0);try{const te=await wp(Rh(a));await Fn(),k("idle"),B(""),P([]),A([]),O(""),N(null),p(te)}catch(te){G(`打开部署页失败:${te instanceof Error?te.message:String(te)}`)}finally{y(!1)}}},ir=async()=>{if(!E||m||!Sr())return;const te=YS(a);ne(""),N(null),A([]),O(""),P([]),k("building");try{await Fn();const Ne=[],Re=mt=>{Ne.push(mt),P([...Ne])};Re("提交 Agent 配置"),k("starting"),Re("初始化调试环境");const Be=await PR(Rh(a));S.current=Be,C(Be),B(Be.appName),Re("创建调试会话");const wt=await jR(Be.runId,"test_user");I(wt),V(te),Re("调试环境就绪"),k("ready")}catch(Ne){N(Ne instanceof Error?Ne.message:String(Ne)),k("error")}},Nr=async()=>{const te=S.current,Ne=R,Re=L.trim();if(!(!te||!Ne||!Re||_==="sending")){O(""),k("sending"),A(Be=>[...Be,{role:"user",content:Re},{role:"assistant",content:"",blocks:[]}]);try{let Be=Ji(),wt="";for await(const mt of BR({runId:te.runId,userId:"test_user",sessionId:Ne,text:Re})){const tn=mt.error||mt.errorMessage||mt.error_message;if(tn){A(vt=>{const Mn=[...vt],Nt=Mn[Mn.length-1];return(Nt==null?void 0:Nt.role)==="assistant"&&(Nt.error=String(tn)),Mn});break}Be=vl(Be,mt),wt=Be.blocks.filter(vt=>vt.kind==="text").map(vt=>vt.text).join(""),A(vt=>{const Mn=[...vt],Nt=Mn[Mn.length-1];return(Nt==null?void 0:Nt.role)==="assistant"&&(Nt.content=wt,Nt.blocks=Be.blocks),Mn})}k("ready")}catch(Be){A(wt=>{const mt=[...wt],tn=mt[mt.length-1];return(tn==null?void 0:tn.role)==="assistant"&&(tn.error=Be instanceof Error?Be.message:String(Be)),mt}),k("ready")}}};if(h){const te=async(Ne,Re,Be)=>{var tn;const wt=(tn=a.deployment)==null?void 0:tn.network,mt=wt&&wt.mode&&wt.mode!=="public"?{mode:wt.mode,vpc_id:wt.vpcId,subnet_ids:wt.subnetIds,enable_shared_internet_access:wt.enableSharedInternetAccess}:void 0;return ZE(Ne.name,Ne.files,{region:w,projectName:"default",network:mt},{...Be,onStage:Re})};return c.jsx("div",{className:"cw-root cw-root-preview",children:c.jsx("div",{className:"cw-preview-body",children:c.jsx(ow,{project:h,agentDraft:a,agentName:a.name||"未命名 Agent",agentCount:fD(a),onChange:p,onDeploy:te,onAgentAdded:n,onDeploymentTaskChange:s,feishuEnabled:!!((sr=a.deployment)!=null&&sr.feishuEnabled),onFeishuEnabledChange:async Ne=>{const Re={...a,deployment:{...a.deployment??{feishuEnabled:!1},feishuEnabled:Ne}},Be=await wp(Rh(Re));o(Re),p(Be)},deploymentEnv:ze.specs,deploymentEnvValues:{...(Wn=a.deployment)==null?void 0:Wn.envValues,...ze.fixedValues},onDeploymentEnvChange:le,network:(Rn=a.deployment)==null?void 0:Rn.network,onNetworkChange:Ne=>o(Re=>({...Re,deployment:{...Re.deployment??{feishuEnabled:!1},network:Ne}})),deployRegion:w,onDeployRegionChange:g,onBack:()=>p(null),onExportYaml:()=>ore(`${a.name||"agent"}.yaml`,dne(a),"text/yaml")})})})}const Yt=He.current,In=te=>HS.find(Ne=>Ne.id===te);return c.jsx("div",{className:"cw-root",children:c.jsxs("div",{className:"cw-editor",children:[c.jsxs("aside",{className:"cw-tree","aria-label":"Agent 结构",children:[c.jsx("div",{className:"cw-tree-head",children:"Agent 结构"}),c.jsx(hD,{root:a,path:[],selectedPath:Oe,duplicateNames:bt,showErrors:l,validationPulse:d,onSelect:ge,onChange:qe,onClearRoot:ct})]}),c.jsxs("div",{className:"cw-detail",children:[c.jsx("div",{className:"cw-typebar",children:c.jsx("div",{className:"cw-typebar-inner",children:c.jsxs("div",{className:"cw-typeradio cw-typeradio--row",role:"radiogroup","aria-label":"Agent 类型",style:{"--cw-agent-type-gap":`${P0}px`,"--cw-agent-type-slider-width":`calc((100% - ${8+P0*(Vf.length-1)}px) / ${Vf.length})`,"--cw-active-type-offset":`calc(${K*100}% + ${K*P0}px)`},children:[c.jsx("span",{className:"cw-typeradio-slider","aria-hidden":!0}),Vf.map(te=>{const Ne=(oe.agentType??"llm")===te.id,Re=kt&&te.id==="a2a",Be=Re?"cw-remote-agent-disabled-hint":void 0;return c.jsxs("label",{className:`cw-typeradio-item ${Ne?"is-on":""} ${Re?"is-disabled":""}`,title:Re?void 0:te.desc,tabIndex:Re?0:void 0,"aria-describedby":Be,children:[c.jsx("input",{type:"radio",name:"agentType",className:"cw-typeradio-input",checked:Ne,disabled:Re,onChange:()=>ft(te.id)}),c.jsxs("span",{className:"cw-typeradio-title",children:[dre[te.id].replace("智能体",""),c.jsx("wbr",{}),"智能体"]}),Re&&c.jsx("span",{id:Be,className:"cw-typeradio-disabled-hint",role:"tooltip",children:"远程 Agent 仅可作为子 Agent"})]},te.id)})]})})}),c.jsx("div",{className:"cw-detail-scroll",ref:De,children:c.jsx("div",{className:"cw-detail-inner",children:c.jsxs("div",{className:"cw-lower",children:[c.jsxs("div",{className:"cw-form-col",children:[c.jsx(Yt,{meta:In("basic"),children:c.jsxs("div",{className:"cw-form",children:[!rt&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cw-field",children:[c.jsxs("label",{className:"cw-label",children:["Agent 名称",c.jsx("span",{className:"cw-req",children:"*"})]}),c.jsx("input",{className:`cw-input ${se(Me)}`,value:oe.name,placeholder:"customer_service",onChange:te=>X({name:te.target.value})}),l&&ue?c.jsx("span",{className:"cw-error-text",children:ue}):c.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在 Agent 结构中保持唯一。"})]}),c.jsxs("div",{className:"cw-field",children:[c.jsxs("label",{className:"cw-label",children:["描述",c.jsx("span",{className:"cw-req",children:"*"})]}),c.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${se(Ze)}`,value:oe.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:te=>X({description:te.target.value})}),l&&Ze?c.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):c.jsx("span",{className:"cw-help",children:"描述会显示在 Agent 列表与选择器中。"})]})]}),st?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"cw-section-desc",children:"编排型 Agent 只负责调度子 Agent,不需要模型或系统提示词。请在左侧 「Agent 结构」中为它添加、排序子 Agent。"}),oe.agentType==="loop"&&c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"最大轮次"}),c.jsx("input",{className:"cw-input",type:"number",min:1,value:oe.maxIterations??3,onChange:te=>X({maxIterations:Math.max(1,Number(te.target.value)||1)})}),c.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):rt?c.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[c.jsxs("div",{className:"cw-remote-center-head",children:[c.jsx("div",{className:"cw-label",children:"AgentKit 智能体中心"}),c.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),c.jsx(Nc,{env:z3,values:oD(oe.a2aRegistry,{includeDefaults:!1}),onChange:Le}),l&&dn&&c.jsx("span",{className:"cw-error-text",children:"AgentKit 智能体中心 ID 为必填项"})]}):c.jsxs("div",{className:"cw-field",children:[c.jsxs("label",{className:"cw-label",children:["系统提示词",c.jsx("span",{className:"cw-req",children:"*"})]}),c.jsx(v.Suspense,{fallback:c.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:c.jsx(are,{value:oe.instruction,invalid:un,onChange:te=>X({instruction:te})})}),l&&un?c.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):c.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!st&&!rt&&c.jsxs(c.Fragment,{children:[c.jsx(Yt,{meta:In("model"),children:c.jsxs("div",{className:"cw-form",children:[c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"模型名称"}),c.jsx("input",{className:"cw-input",value:oe.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:te=>X({modelName:te.target.value})})]}),c.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":W,"aria-controls":ve,onClick:()=>ae(te=>!te),children:[c.jsx("span",{children:"更多选项"}),c.jsx(dr,{className:`cw-more-options-chevron ${W?"is-open":""}`,"aria-hidden":!0})]}),c.jsx(Ys,{initial:!1,children:W&&c.jsxs(Xt.div,{id:ve,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"服务商 Provider"}),c.jsx("input",{className:"cw-input",value:oe.modelProvider??"",placeholder:"openai",onChange:te=>X({modelProvider:te.target.value})})]}),c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"API Base"}),c.jsx("input",{className:"cw-input",value:oe.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:te=>X({modelApiBase:te.target.value})}),c.jsx("span",{className:"cw-help",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),c.jsx(Yt,{meta:In("tools"),children:c.jsxs("div",{className:"cw-form",children:[c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"内置工具"}),c.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),c.jsx("div",{className:"cw-tools-list-shell",children:c.jsx(VS,{items:sw,selected:Jt,onToggle:An,scrollRows:6})})]}),c.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":he,"aria-controls":St,onClick:()=>Z(te=>!te),children:[c.jsx("span",{children:"更多类型工具"}),Ot.length>0&&c.jsxs("span",{className:"cw-more-options-count",children:["已配置 ",Ot.length]}),c.jsx(dr,{className:`cw-more-options-chevron ${he?"is-open":""}`,"aria-hidden":!0})]}),c.jsx(Ys,{initial:!1,children:he&&c.jsx(Xt.div,{id:St,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"MCP 工具"}),c.jsx("span",{className:"cw-help",children:"连接外部 MCP 服务,生成时会为每个条目创建对应的 MCPToolset。"}),c.jsx(hre,{tools:Ot,onChange:te=>X({mcpTools:te})})]})})})]})}),c.jsx(Yt,{meta:In("skills"),children:c.jsx("div",{className:"cw-form",children:c.jsx(mre,{selected:xt,onChange:te=>X({selectedSkills:te})})})}),c.jsx(Yt,{meta:In("knowledge"),children:c.jsxs("div",{className:"cw-form cw-toggle-stack",children:[c.jsx(Ac,{checked:oe.knowledgebase,onChange:te=>X({knowledgebase:te}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:yh}),oe.knowledgebase&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"知识库后端"}),c.jsx(j0,{options:Fp,value:oe.knowledgebaseBackend,onChange:te=>X({knowledgebaseBackend:te})}),c.jsx(Nc,{env:((at=Fp.find(te=>te.id===(oe.knowledgebaseBackend??"local")))==null?void 0:at.env)??[],values:((On=a.deployment)==null?void 0:On.envValues)??{},onChange:le})]})]})}),kt&&c.jsxs("section",{ref:te=>{_e.current.advanced=te},id:"cw-sec-advanced","data-step-id":"advanced",className:"cw-section cw-advanced-section",children:[c.jsxs("button",{type:"button",className:"cw-advanced-disclosure","aria-expanded":ce,"aria-controls":dt,onClick:()=>Ie(te=>!te),children:[c.jsx("span",{className:"cw-advanced-disclosure-title",children:"进阶配置"}),c.jsx(dr,{className:`cw-advanced-disclosure-chevron ${ce?"is-open":""}`,"aria-hidden":!0}),Vt>0&&c.jsxs("span",{className:"cw-more-options-count",children:["已启用 ",Vt]})]}),c.jsx(Ys,{initial:!1,children:ce&&c.jsxs(Xt.div,{id:dt,className:"cw-advanced-content",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},children:[c.jsxs("div",{className:"cw-advanced-group",children:[c.jsx("div",{className:"cw-advanced-group-head",children:c.jsx("span",{children:"记忆"})}),c.jsxs("div",{className:"cw-form cw-toggle-stack",children:[c.jsx(Ac,{checked:oe.memory.shortTerm,onChange:te=>X({memory:{...oe.memory,shortTerm:te}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:dR}),oe.memory.shortTerm&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"短期记忆后端"}),c.jsx(j0,{options:jp,value:oe.shortTermBackend,onChange:te=>X({shortTermBackend:te})}),c.jsx(Nc,{env:((Ut=jp.find(te=>te.id===(oe.shortTermBackend??"local")))==null?void 0:Ut.env)??[],values:((en=a.deployment)==null?void 0:en.envValues)??{},onChange:le})]}),c.jsx(Ac,{checked:oe.memory.longTerm,onChange:te=>X({memory:{...oe.memory,longTerm:te}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:yh}),oe.memory.longTerm&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"长期记忆后端"}),c.jsx(j0,{options:Bp,value:oe.longTermBackend,onChange:te=>X({longTermBackend:te})}),c.jsx(Nc,{env:((Ln=Bp.find(te=>te.id===(oe.longTermBackend??"local")))==null?void 0:Ln.env)??[],values:(($n=a.deployment)==null?void 0:$n.envValues)??{},onChange:le}),c.jsx(Ac,{checked:!!oe.autoSaveSession,onChange:te=>X({autoSaveSession:te}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:yh})]})]})]}),c.jsxs("div",{className:"cw-advanced-group",children:[c.jsx("div",{className:"cw-advanced-group-head",children:c.jsx("span",{children:"观测"})}),c.jsxs("div",{className:"cw-form cw-toggle-stack",children:[c.jsx(Ac,{checked:oe.tracing,onChange:te=>X({tracing:te}),title:"观测 / Tracing",desc:"记录每一步的调用链路与耗时,便于调试与性能分析。",icon:sR}),oe.tracing&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"Tracing 导出器"}),c.jsx("span",{className:"cw-help",children:"选择一个或多个观测平台,生成时会写入对应的 ENABLE_* 开关与环境变量。"}),c.jsx(VS,{items:Up,selected:Xe,onToggle:$e}),c.jsx(Nc,{env:Up.filter(te=>Xe.includes(te.id)).flatMap(te=>te.env),values:((Tn=a.deployment)==null?void 0:Tn.envValues)??{},onChange:le})]})]})]})]})})]})]})]}),c.jsx("nav",{className:"cw-rail","aria-label":"步骤导航",children:c.jsxs("ol",{className:"cw-steps",children:[c.jsx("div",{className:"cw-rail-track","aria-hidden":!0,children:c.jsx(Xt.div,{className:"cw-rail-fill",animate:{height:`${Math.max(Cn,0)/Math.max(bn.length-1,1)*100}%`},transition:{type:"spring",stiffness:260,damping:32}})}),bn.map(te=>{const Ne=te.id===J,Re=Et[te.id];return c.jsx("li",{children:c.jsxs("button",{type:"button",className:`cw-step ${Ne?"is-active":""} ${Re?"is-done":""}`,onClick:()=>rr(te.id),"aria-current":Ne?"step":void 0,"aria-label":te.label,children:[c.jsx("span",{className:"cw-step-marker","aria-hidden":!0,children:Ne?c.jsx("span",{className:"cw-dot"}):Re?c.jsx($i,{className:"cw-step-check"}):c.jsx("span",{className:"cw-dot"})}),c.jsx("span",{className:"cw-step-tooltip","aria-hidden":!0,children:te.label})]})},te.id)})]})})]})})})]}),c.jsx(_re,{enabled:E,disabledReason:b,phase:_,stale:Ge,run:T,projectName:M||a.name,logs:Y,messages:U,input:L,error:j,deploying:m,deployError:de,onInput:O,onSend:Nr,onRestart:ir,onIgnoreChanges:()=>ne(je),onDeploy:Yn})]})})}function Vi(e){return{...ea(),...e}}const kre=[{id:"support",icon:fU,draft:Vi({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:Z9,draft:Vi({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:hU,draft:Vi({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:$E,draft:Vi({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:wU,draft:Vi({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:OU,draft:Vi({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[Vi({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),Vi({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),Vi({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function Sre(e){const t=[];return e.tools.length&&t.push({icon:qE,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:Q9,label:"记忆"}),e.knowledgebase&&t.push({icon:X9,label:"知识库"}),e.tracing&&t.push({icon:q9,label:"观测"}),e.subAgents.length&&t.push({icon:hR,label:`子Agent ${e.subAgents.length}`}),t}function Nre({onBack:e,onCreate:t}){const[n,r]=v.useState(null);return c.jsx("div",{className:"tpl-root",children:n?c.jsx(Cre,{template:n,onBack:()=>r(null),onCreate:t}):c.jsx(Are,{onPick:r})})}function Are({onPick:e}){return c.jsxs("div",{className:"tpl-scroll",children:[c.jsxs("div",{className:"tpl-head",children:[c.jsx("h1",{className:"tpl-title",children:"从模板新建"}),c.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),c.jsx("div",{className:"tpl-grid",children:kre.map((t,n)=>c.jsxs(Xt.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[c.jsx("span",{className:"tpl-card-icon",children:c.jsx(t.icon,{className:"icon"})}),c.jsx("span",{className:"tpl-card-name",children:t.draft.name}),c.jsx("span",{className:"tpl-card-desc",children:ri(t.draft.description)})]},t.id))})]})}function Cre({template:e,onBack:t,onCreate:n}){const[r,i]=v.useState(e.draft.name),s=e.icon,a=Sre(e.draft);function o(){const l=r.trim()||e.draft.name;n({...e.draft,name:l})}return c.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[c.jsxs("button",{className:"tpl-back",onClick:t,children:[c.jsx(ZI,{className:"icon"})," 返回模板列表"]}),c.jsxs(Xt.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[c.jsxs("div",{className:"tpl-detail-head",children:[c.jsx("span",{className:"tpl-detail-icon",children:c.jsx(s,{className:"icon"})}),c.jsxs("div",{className:"tpl-detail-headtext",children:[c.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),c.jsx("div",{className:"tpl-detail-desc",children:ri(e.draft.description)})]})]}),a.length>0&&c.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(l=>c.jsxs("span",{className:"tpl-tag",children:[c.jsx(l.icon,{className:"tpl-tag-icon"})," ",l.label]},l.label))}),c.jsxs("label",{className:"tpl-field",children:[c.jsx("span",{className:"tpl-field-label",children:"名称"}),c.jsx("input",{className:"tpl-input",value:r,onChange:l=>i(l.target.value),placeholder:e.draft.name})]}),c.jsxs("div",{className:"tpl-field",children:[c.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),c.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),c.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"模型"}),c.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"工具"}),c.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"记忆"}),c.jsx("span",{className:"tpl-meta-val",children:Ire(e.draft)})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"知识库"}),c.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),c.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&c.jsxs("div",{className:"tpl-field",children:[c.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),c.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((l,u)=>c.jsxs("div",{className:"tpl-subagent",children:[c.jsxs("div",{className:"tpl-subagent-top",children:[c.jsx("span",{className:"tpl-subagent-name",children:l.name}),l.tools.length>0&&c.jsx("span",{className:"tpl-subagent-tools",children:l.tools.join("、")})]}),c.jsx("div",{className:"tpl-subagent-desc",children:ri(l.description)})]},u))})]}),c.jsxs("button",{className:"tpl-create",onClick:o,children:["使用此模板创建 ",c.jsx(dr,{className:"icon"})]})]})]})}function Ire(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}function _n(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function qm(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Oh.prototype=qm.prototype={constructor:Oh,on:function(e,t){var n=this._,r=Ore(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),qS.hasOwnProperty(t)?{space:qS[t],local:e}:e}function Mre(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===J1&&t.documentElement.namespaceURI===J1?t.createElement(e):t.createElementNS(n,e)}}function Dre(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pD(e){var t=Gm(e);return(t.local?Dre:Mre)(t)}function Pre(){}function lw(e){return e==null?Pre:function(){return this.querySelector(e)}}function jre(e){typeof e!="function"&&(e=lw(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=b&&(b=E+1);!(k=w[b])&&++b=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function lie(e){e||(e=cie);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function uie(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function die(){return Array.from(this)}function fie(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?_ie:typeof t=="function"?kie:Tie)(e,t,n??"")):Il(this.node(),e)}function Il(e,t){return e.style.getPropertyValue(t)||ED(e).getComputedStyle(e,null).getPropertyValue(t)}function Nie(e){return function(){delete this[e]}}function Aie(e,t){return function(){this[e]=t}}function Cie(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Iie(e,t){return arguments.length>1?this.each((t==null?Nie:typeof t=="function"?Cie:Aie)(e,t)):this.node()[e]}function xD(e){return e.trim().split(/^|\s+/)}function cw(e){return e.classList||new wD(e)}function wD(e){this._node=e,this._names=xD(e.getAttribute("class")||"")}wD.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function vD(e,t){for(var n=cw(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ise(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n()=>e;function eb(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:o,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}eb.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pse(e){return!e.ctrlKey&&!e.button}function mse(){return this.parentNode}function gse(e,t){return t??{x:e.x,y:e.y}}function yse(){return navigator.maxTouchPoints||"ontouchstart"in this}function AD(){var e=pse,t=mse,n=gse,r=yse,i={},s=qm("start","drag","end"),a=0,o,l,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",w).on("touchmove.drag",g,hse).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,k){if(!(d||!e.call(this,_,k))){var T=b(this,t.call(this,_,k),_,k,"mouse");T&&(Lr(_.view).on("mousemove.drag",m,Ju).on("mouseup.drag",y,Ju),SD(_.view),U0(_),u=!1,o=_.clientX,l=_.clientY,T("start",_))}}function m(_){if(ul(_),!u){var k=_.clientX-o,T=_.clientY-l;u=k*k+T*T>f}i.mouse("drag",_)}function y(_){Lr(_.view).on("mousemove.drag mouseup.drag",null),ND(_.view,u),ul(_),i.mouse("end",_)}function w(_,k){if(e.call(this,_,k)){var T=_.changedTouches,C=t.call(this,_,k),S=T.length,R,I;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Wf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Wf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ese.exec(e))?new Er(t[1],t[2],t[3],1):(t=xse.exec(e))?new Er(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wse.exec(e))?Wf(t[1],t[2],t[3],t[4]):(t=vse.exec(e))?Wf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=_se.exec(e))?tN(t[1],t[2]/100,t[3]/100,1):(t=Tse.exec(e))?tN(t[1],t[2]/100,t[3]/100,t[4]):GS.hasOwnProperty(e)?ZS(GS[e]):e==="transparent"?new Er(NaN,NaN,NaN,0):null}function ZS(e){return new Er(e>>16&255,e>>8&255,e&255,1)}function Wf(e,t,n,r){return r<=0&&(e=t=n=NaN),new Er(e,t,n,r)}function Nse(e){return e instanceof $d||(e=Xa(e)),e?(e=e.rgb(),new Er(e.r,e.g,e.b,e.opacity)):new Er}function tb(e,t,n,r){return arguments.length===1?Nse(e):new Er(e,t,n,r??1)}function Er(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}uw(Er,tb,CD($d,{brighter(e){return e=e==null?zp:Math.pow(zp,e),new Er(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ed:Math.pow(ed,e),new Er(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Er(ja(this.r),ja(this.g),ja(this.b),Vp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:JS,formatHex:JS,formatHex8:Ase,formatRgb:eN,toString:eN}));function JS(){return`#${Ia(this.r)}${Ia(this.g)}${Ia(this.b)}`}function Ase(){return`#${Ia(this.r)}${Ia(this.g)}${Ia(this.b)}${Ia((isNaN(this.opacity)?1:this.opacity)*255)}`}function eN(){const e=Vp(this.opacity);return`${e===1?"rgb(":"rgba("}${ja(this.r)}, ${ja(this.g)}, ${ja(this.b)}${e===1?")":`, ${e})`}`}function Vp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ja(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ia(e){return e=ja(e),(e<16?"0":"")+e.toString(16)}function tN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fi(e,t,n,r)}function ID(e){if(e instanceof fi)return new fi(e.h,e.s,e.l,e.opacity);if(e instanceof $d||(e=Xa(e)),!e)return new fi;if(e instanceof fi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),a=NaN,o=s-i,l=(s+i)/2;return o?(t===s?a=(n-r)/o+(n0&&l<1?0:a,new fi(a,o,l,e.opacity)}function Cse(e,t,n,r){return arguments.length===1?ID(e):new fi(e,t,n,r??1)}function fi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}uw(fi,Cse,CD($d,{brighter(e){return e=e==null?zp:Math.pow(zp,e),new fi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ed:Math.pow(ed,e),new fi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Er($0(e>=240?e-240:e+120,i,r),$0(e,i,r),$0(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new fi(nN(this.h),qf(this.s),qf(this.l),Vp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Vp(this.opacity);return`${e===1?"hsl(":"hsla("}${nN(this.h)}, ${qf(this.s)*100}%, ${qf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function nN(e){return e=(e||0)%360,e<0?e+360:e}function qf(e){return Math.max(0,Math.min(1,e||0))}function $0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const dw=e=>()=>e;function Ise(e,t){return function(n){return e+n*t}}function Rse(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Ose(e){return(e=+e)==1?RD:function(t,n){return n-t?Rse(t,n,e):dw(isNaN(t)?n:t)}}function RD(e,t){var n=t-e;return n?Ise(e,n):dw(isNaN(e)?t:e)}const Kp=function e(t){var n=Ose(t);function r(i,s){var a=n((i=tb(i)).r,(s=tb(s)).r),o=n(i.g,s.g),l=n(i.b,s.b),u=RD(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=o(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function Lse(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:Oi(r,i)})),n=H0.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Oi(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}function o(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Oi(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function l(u,d,f,h,p,m){if(u!==f||d!==h){var y=p.push(i(p)+"scale(",null,",",null,")");m.push({i:y-4,x:Oi(u,f)},{i:y-2,x:Oi(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),l(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,y=h.length,w;++m=0&&e._call.call(void 0,t),e=e._next;--Rl}function sN(){Qa=(Wp=nd.now())+Xm,Rl=$c=0;try{qse()}finally{Rl=0,Xse(),Qa=0}}function Gse(){var e=nd.now(),t=e-Wp;t>DD&&(Xm-=t,Wp=e)}function Xse(){for(var e,t=Yp,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yp=n);Hc=e,ib(r)}function ib(e){if(!Rl){$c&&($c=clearTimeout($c));var t=e-Qa;t>24?(e<1/0&&($c=setTimeout(sN,e-nd.now()-Xm)),Cc&&(Cc=clearInterval(Cc))):(Cc||(Wp=nd.now(),Cc=setInterval(Gse,DD)),Rl=1,PD(sN))}}function aN(e,t,n){var r=new qp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Qse=qm("start","end","cancel","interrupt"),Zse=[],BD=0,oN=1,sb=2,Mh=3,lN=4,ab=5,Dh=6;function Qm(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Jse(e,n,{name:t,index:r,group:i,on:Qse,tween:Zse,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:BD})}function hw(e,t){var n=Ti(e,t);if(n.state>BD)throw new Error("too late; already scheduled");return n}function zi(e,t){var n=Ti(e,t);if(n.state>Mh)throw new Error("too late; already running");return n}function Ti(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Jse(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=jD(s,0,n.time);function s(u){n.state=oN,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==oN)return l();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Mh)return aN(a);p.state===lN?(p.state=Dh,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dsb&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Cae(e,t,n){var r,i,s=Aae(t)?hw:zi;return function(){var a=s(this,e),o=a.on;o!==r&&(i=(r=o).copy()).on(t,n),a.on=i}}function Iae(e,t){var n=this._id;return arguments.length<2?Ti(this.node(),n).on.on(e):this.each(Cae(n,e,t))}function Rae(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Oae(){return this.on("end.remove",Rae(this._id))}function Lae(e){var t=this._name,n=this._id;typeof e!="function"&&(e=lw(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a()=>e;function ioe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ns(e,t,n){this.k=e,this.x=t,this.y=n}ns.prototype={constructor:ns,scale:function(e){return e===1?this:new ns(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ns(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Zm=new ns(1,0,0);HD.prototype=ns.prototype;function HD(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Zm;return e.__zoom}function z0(e){e.stopImmediatePropagation()}function Ic(e){e.preventDefault(),e.stopImmediatePropagation()}function soe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function aoe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function cN(){return this.__zoom||Zm}function ooe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function loe(){return navigator.maxTouchPoints||"ontouchstart"in this}function coe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function zD(){var e=soe,t=aoe,n=coe,r=ooe,i=loe,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=Lh,u=qm("start","zoom","end"),d,f,h,p=500,m=150,y=0,w=10;function g(P){P.property("__zoom",cN).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",M).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(P,U,A,L){var O=P.selection?P.selection():P;O.property("__zoom",cN),P!==O?k(P,U,A,L):O.interrupt().each(function(){T(this,arguments).event(L).start().zoom(null,typeof U=="function"?U.apply(this,arguments):U).end()})},g.scaleBy=function(P,U,A,L){g.scaleTo(P,function(){var O=this.__zoom.k,j=typeof U=="function"?U.apply(this,arguments):U;return O*j},A,L)},g.scaleTo=function(P,U,A,L){g.transform(P,function(){var O=t.apply(this,arguments),j=this.__zoom,N=A==null?_(O):typeof A=="function"?A.apply(this,arguments):A,H=j.invert(N),V=typeof U=="function"?U.apply(this,arguments):U;return n(b(E(j,V),N,H),O,a)},A,L)},g.translateBy=function(P,U,A,L){g.transform(P,function(){return n(this.__zoom.translate(typeof U=="function"?U.apply(this,arguments):U,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),a)},null,L)},g.translateTo=function(P,U,A,L,O){g.transform(P,function(){var j=t.apply(this,arguments),N=this.__zoom,H=L==null?_(j):typeof L=="function"?L.apply(this,arguments):L;return n(Zm.translate(H[0],H[1]).scale(N.k).translate(typeof U=="function"?-U.apply(this,arguments):-U,typeof A=="function"?-A.apply(this,arguments):-A),j,a)},L,O)};function E(P,U){return U=Math.max(s[0],Math.min(s[1],U)),U===P.k?P:new ns(U,P.x,P.y)}function b(P,U,A){var L=U[0]-A[0]*P.k,O=U[1]-A[1]*P.k;return L===P.x&&O===P.y?P:new ns(P.k,L,O)}function _(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function k(P,U,A,L){P.on("start.zoom",function(){T(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(L).end()}).tween("zoom",function(){var O=this,j=arguments,N=T(O,j).event(L),H=t.apply(O,j),V=A==null?_(H):typeof A=="function"?A.apply(O,j):A,D=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),ne=O.__zoom,J=typeof U=="function"?U.apply(O,j):U,re=l(ne.invert(V).concat(D/ne.k),J.invert(V).concat(D/J.k));return function(de){if(de===1)de=J;else{var G=re(de),W=D/G[2];de=new ns(W,V[0]-G[0]*W,V[1]-G[1]*W)}N.zoom(null,de)}})}function T(P,U,A){return!A&&P.__zooming||new C(P,U)}function C(P,U){this.that=P,this.args=U,this.active=0,this.sourceEvent=null,this.extent=t.apply(P,U),this.taps=0}C.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,U){return this.mouse&&P!=="mouse"&&(this.mouse[1]=U.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=U.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=U.invert(this.touch1[0])),this.that.__zoom=U,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var U=Lr(this.that).datum();u.call(P,this.that,new ioe(P,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),U)}};function S(P,...U){if(!e.apply(this,arguments))return;var A=T(this,U).event(P),L=this.__zoom,O=Math.max(s[0],Math.min(s[1],L.k*Math.pow(2,r.apply(this,arguments)))),j=ui(P);if(A.wheel)(A.mouse[0][0]!==j[0]||A.mouse[0][1]!==j[1])&&(A.mouse[1]=L.invert(A.mouse[0]=j)),clearTimeout(A.wheel);else{if(L.k===O)return;A.mouse=[j,L.invert(j)],Ph(this),A.start()}Ic(P),A.wheel=setTimeout(N,m),A.zoom("mouse",n(b(E(L,O),A.mouse[0],A.mouse[1]),A.extent,a));function N(){A.wheel=null,A.end()}}function R(P,...U){if(h||!e.apply(this,arguments))return;var A=P.currentTarget,L=T(this,U,!0).event(P),O=Lr(P.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",D,!0),j=ui(P,A),N=P.clientX,H=P.clientY;SD(P.view),z0(P),L.mouse=[j,this.__zoom.invert(j)],Ph(this),L.start();function V(ne){if(Ic(ne),!L.moved){var J=ne.clientX-N,re=ne.clientY-H;L.moved=J*J+re*re>y}L.event(ne).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=ui(ne,A),L.mouse[1]),L.extent,a))}function D(ne){O.on("mousemove.zoom mouseup.zoom",null),ND(ne.view,L.moved),Ic(ne),L.event(ne).end()}}function I(P,...U){if(e.apply(this,arguments)){var A=this.__zoom,L=ui(P.changedTouches?P.changedTouches[0]:P,this),O=A.invert(L),j=A.k*(P.shiftKey?.5:2),N=n(b(E(A,j),L,O),t.apply(this,U),a);Ic(P),o>0?Lr(this).transition().duration(o).call(k,N,L,P):Lr(this).call(g.transform,N,L,P)}}function M(P,...U){if(e.apply(this,arguments)){var A=P.touches,L=A.length,O=T(this,U,P.changedTouches.length===L).event(P),j,N,H,V;for(z0(P),N=0;N`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},rd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],VD=["Enter"," ","Escape"],KD={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ol;(function(e){e.Strict="strict",e.Loose="loose"})(Ol||(Ol={}));var Ba;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ba||(Ba={}));var id;(function(e){e.Partial="partial",e.Full="full"})(id||(id={}));const YD={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ls;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ls||(Ls={}));var sd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(sd||(sd={}));var Pe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Pe||(Pe={}));const uN={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top};function WD(e){return e===null?null:e?"valid":"invalid"}const qD=e=>"id"in e&&"source"in e&&"target"in e,uoe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),mw=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Hd=(e,t=[0,0])=>{const{width:n,height:r}=ys(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},doe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):mw(i)?i:t.nodeLookup.get(i.id));const o=a?Gp(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Jm(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return eg(n)},zd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Jm(n,Gp(i)),r=!0)}),r?eg(n):{x:0,y:0,width:0,height:0}},gw=(e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const o={...ic(t,[n,r,i]),width:t.width/i,height:t.height/i},l=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,y=ad(o,Ml(u)),w=(p??0)*(m??0),g=s&&y>0;(!u.internals.handleBounds||g||y>=w||u.dragging)&&l.push(u)}return l},foe=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function hoe(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function poe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;const o=hoe(e,a),l=zd(o),u=bw(l,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function GD({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:l,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!o)s==null||s("005",xi.error005());else{const p=o.measured.width,m=o.measured.height;p&&m&&(f=[[l,u],[l+p,u+m]])}else o&&Ja(a.extent)&&(f=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);const h=Ja(f)?Za(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",xi.error015())),{position:{x:h.x-l+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function moe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=s.has(h.id),m=!p&&h.parentId&&a.find(y=>y.id===h.parentId);(p||m)&&a.push(h)}const o=new Set(t.map(h=>h.id)),l=r.filter(h=>h.deletable!==!1),d=foe(a,l);for(const h of l)o.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};const f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const Ll=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Za=(e={x:0,y:0},t,n)=>({x:Ll(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ll(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function XD(e,t,n){const{width:r,height:i}=ys(n),{x:s,y:a}=n.internals.positionAbsolute;return Za(e,[[s,a],[s+r,a+i]],t)}const dN=(e,t,n)=>en?-Ll(Math.abs(e-n),1,t)/t:0,yw=(e,t,n=15,r=40)=>{const i=dN(e.x,r,t.width-r)*n,s=dN(e.y,r,t.height-r)*n;return[i,s]},Jm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),ob=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),eg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ml=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=mw(e)?e.internals.positionAbsolute:Hd(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},Gp=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=mw(e)?e.internals.positionAbsolute:Hd(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},QD=(e,t)=>eg(Jm(ob(e),ob(t))),ad=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},fN=e=>hi(e.width)&&hi(e.height)&&hi(e.x)&&hi(e.y),hi=e=>!isNaN(e)&&isFinite(e),ZD=(e,t)=>(n,r)=>{},Vd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ic=({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{const o={x:(e-n)/i,y:(t-r)/i};return s?Vd(o,a):o},Dl=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function vo(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function goe(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=vo(e,n),i=vo(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=vo(e.top??e.y??0,n),i=vo(e.bottom??e.y??0,n),s=vo(e.left??e.x??0,t),a=vo(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function yoe(e,t,n,r,i,s){const{x:a,y:o}=Dl(e,[t,n,r]),{x:l,y:u}=Dl({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-l,f=s-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const bw=(e,t,n,r,i,s)=>{const a=goe(s,t,n),o=(t-a.x)/e.width,l=(n-a.y)/e.height,u=Math.min(o,l),d=Ll(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,y=yoe(e,p,m,d,t,n),w={left:Math.min(y.left-a.left,0),top:Math.min(y.top-a.top,0),right:Math.min(y.right-a.right,0),bottom:Math.min(y.bottom-a.bottom,0)};return{x:p-w.left+w.right,y:m-w.top+w.bottom,zoom:d}},od=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ja(e){return e!=null&&e!=="parent"}function ys(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function JD(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function eP(e,t={width:0,height:0},n,r,i){const s={...e},a=r.get(n);if(a){const o=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return s}function hN(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function boe(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function Eoe(e){return{...KD,...e||{}}}function yu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=pi(e),o=ic({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:l,y:u}=n?Vd(o,t):o;return{xSnapped:l,ySnapped:u,...o}}const Ew=e=>({width:e.offsetWidth,height:e.offsetHeight}),tP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},xoe=["INPUT","SELECT","TEXTAREA"];function nP(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:xoe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const rP=e=>"clientX"in e,pi=(e,t)=>{var s,a;const n=rP(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},pN=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Ew(a)}})};function iP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:o}){const l=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+o*.375+r*.125,d=Math.abs(l-e),f=Math.abs(u-t);return[l,u,d,f]}function Qf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function mN({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Pe.Left:return[t-Qf(t-r,s),n];case Pe.Right:return[t+Qf(r-t,s),n];case Pe.Top:return[t,n-Qf(n-i,s)];case Pe.Bottom:return[t,n+Qf(i-n,s)]}}function sP({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:i,targetPosition:s=Pe.Top,curvature:a=.25}){const[o,l]=mN({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=mN({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,p,m]=iP({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${l} ${u},${d} ${r},${i}`,f,h,p,m]}function aP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n0}const _oe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Toe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),koe=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",xi.error006()),t;const r=n.getEdgeId||_oe;let i;return qD(e)?i={...e}:i={...e,id:r(e)},Toe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function oP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,a,o]=aP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,o]}const gN={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},Soe=({source:e,sourcePosition:t=Pe.Bottom,target:n})=>t===Pe.Left||t===Pe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Noe({source:e,sourcePosition:t=Pe.Bottom,target:n,targetPosition:r=Pe.Top,center:i,offset:s,stepPosition:a}){const o=gN[t],l=gN[r],u={x:e.x+o.x*s,y:e.y+o.y*s},d={x:n.x+l.x*s,y:n.y+l.y*s},f=Soe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],y,w;const g={x:0,y:0},E={x:0,y:0},[,,b,_]=aP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*l[h]===-1){h==="x"?(y=i.x??u.x+(d.x-u.x)*a,w=i.y??(u.y+d.y)/2):(y=i.x??(u.x+d.x)/2,w=i.y??u.y+(d.y-u.y)*a);const S=[{x:y,y:u.y},{x:y,y:d.y}],R=[{x:u.x,y:w},{x:d.x,y:w}];o[h]===p?m=h==="x"?S:R:m=h==="x"?R:S}else{const S=[{x:u.x,y:d.y}],R=[{x:d.x,y:u.y}];if(h==="x"?m=o.x===p?R:S:m=o.y===p?S:R,t===r){const P=Math.abs(e[h]-n[h]);if(P<=s){const U=Math.min(s-1,s-P);o[h]===p?g[h]=(u[h]>e[h]?-1:1)*U:E[h]=(d[h]>n[h]?-1:1)*U}}if(t!==r){const P=h==="x"?"y":"x",U=o[h]===l[P],A=u[P]>d[P],L=u[P]=Y?(y=(I.x+M.x)/2,w=m[0].y):(y=m[0].x,w=(I.y+M.y)/2)}const k={x:u.x+g.x,y:u.y+g.y},T={x:d.x+E.x,y:d.y+E.y};return[[e,...k.x!==m[0].x||k.y!==m[0].y?[k]:[],...m,...T.x!==m[m.length-1].x||T.y!==m[m.length-1].y?[T]:[],n],y,w,b,_]}function Aoe(e,t,n,r){const i=Math.min(yN(e,t)/2,yN(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function cb(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Ioe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||i].forEach(l=>{if(l&&typeof l=="object"){const u=cb(l,t);s.has(u)||(a.push({id:u,color:l.color||n,...l}),s.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const lP=1e3,Roe=10,xw={nodeOrigin:[0,0],nodeExtent:rd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ooe={...xw,checkEquality:!0};function ww(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Loe(e,t,n){const r=ww(xw,n);for(const i of e.values())if(i.parentId)_w(i,e,t,r);else{const s=Hd(i,r.nodeOrigin),a=Ja(i.extent)?i.extent:r.nodeExtent,o=Za(s,a,ys(i));i.internals.positionAbsolute=o}}function Moe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function vw(e){return e==="manual"}function ub(e,t,n,r={}){var d,f;const i=ww(Ooe,r),s={i:0},a=new Map(t),o=i!=null&&i.elevateNodesOnSelect&&!vw(i.zIndexMode)?lP:0;let l=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(i.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=Hd(h,i.nodeOrigin),y=Ja(h.extent)?h.extent:i.nodeExtent,w=Za(m,y,ys(h));p={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:Moe(h,p),z:cP(h,o,i.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(l=!1),h.parentId&&_w(p,t,n,r,s),u||(u=h.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:u}}function Doe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function _w(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:o,zIndexMode:l}=ww(xw,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Doe(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Roe),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=s&&!vw(l)?lP:0,{x:h,y:p,z:m}=Poe(e,d,a,o,f,l),{positionAbsolute:y}=e.internals,w=h!==y.x||p!==y.y;(w||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:h,y:p}:y,z:m}})}function cP(e,t,n){const r=hi(e.zIndex)?e.zIndex:0;return vw(n)?r:r+(e.selected?t:0)}function Poe(e,t,n,r,i,s){const{x:a,y:o}=t.internals.positionAbsolute,l=ys(e),u=Hd(e,n),d=Ja(e.extent)?Za(u,e.extent,l):u;let f=Za({x:a+d.x,y:o+d.y},r,l);e.extent==="parent"&&(f=XD(f,l,t));const h=cP(e,i,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Tw(e,t,n,r=[0,0]){var a;const i=[],s=new Map;for(const o of e){const l=t.get(o.parentId);if(!l)continue;const u=((a=s.get(o.parentId))==null?void 0:a.expandedRect)??Ml(l),d=QD(u,o.rect);s.set(o.parentId,{expandedRect:d,parent:l})}return s.size>0&&s.forEach(({expandedRect:o,parent:l},u)=>{var b;const d=l.internals.positionAbsolute,f=ys(l),h=l.origin??r,p=o.x0||m>0||g||E)&&(i.push({id:u,type:"position",position:{x:l.position.x-p+g,y:l.position.y-m+E}}),(b=n.get(u))==null||b.forEach(_=>{e.some(k=>k.id===_.id)||i.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+m}})})),(f.width0){const p=Tw(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:l}}async function Boe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function wN(e,t,n,r,i,s){let a=i;const o=r.get(a)||new Map;r.set(a,o.set(n,t)),a=`${i}-${e}`;const l=r.get(a)||new Map;if(r.set(a,l.set(n,t)),s){a=`${i}-${e}-${s}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function uP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:o=null}=r,l={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:o},u=`${i}-${a}--${s}-${o}`,d=`${s}-${o}--${i}-${a}`;wN("source",l,d,e,i,a),wN("target",l,u,e,s,o),t.set(r.id,r)}}function dP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:dP(n,t):!1}function vN(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Foe(e,t,n,r){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!dP(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(s);o&&i.set(s,{id:s,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return i}function V0({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,o,l;const i=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&i.push({...f,position:d.position,dragging:r})}if(!e)return[i[0],i];const s=(o=n.get(e))==null?void 0:o.internals.userNode;return[s?{...s,position:((l=t.get(e))==null?void 0:l.position)||s.position,dragging:r}:i[0],i]}function Uoe({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},a=Vd(s,t);return{x:a.x-s.x,y:a.y-s.y}}function $oe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,o=new Map,l=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,y=null;function w({noDragClassName:E,handleSelector:b,domNode:_,isSelectable:k,nodeId:T,nodeClickDistance:C=0}){h=Lr(_);function S({x:B,y:Y}){const{nodeLookup:P,nodeExtent:U,snapGrid:A,snapToGrid:L,nodeOrigin:O,onNodeDrag:j,onSelectionDrag:N,onError:H,updateNodePositions:V}=t();s={x:B,y:Y};let D=!1;const ne=o.size>1,J=ne&&U?ob(zd(o)):null,re=ne&&L?Uoe({dragItems:o,snapGrid:A,x:B,y:Y}):null;for(const[de,G]of o){if(!P.has(de))continue;let W={x:B-G.distance.x,y:Y-G.distance.y};L&&(W=re?{x:Math.round(W.x+re.x),y:Math.round(W.y+re.y)}:Vd(W,A));let ae=null;if(ne&&U&&!G.extent&&J){const{positionAbsolute:ce}=G.internals,Ie=ce.x-J.x+U[0][0],xe=ce.x+G.measured.width-J.x2+U[1][0],ge=ce.y-J.y+U[0][1],De=ce.y+G.measured.height-J.y2+U[1][1];ae=[[Ie,ge],[xe,De]]}const{position:he,positionAbsolute:Z}=GD({nodeId:de,nextPosition:W,nodeLookup:P,nodeExtent:ae||U,nodeOrigin:O,onError:H});D=D||G.position.x!==he.x||G.position.y!==he.y,G.position=he,G.internals.positionAbsolute=Z}if(m=m||D,!!D&&(V(o,!0),y&&(r||j||!T&&N))){const[de,G]=V0({nodeId:T,dragItems:o,nodeLookup:P});r==null||r(y,o,de,G),j==null||j(y,de,G),T||N==null||N(y,G)}}async function R(){if(!d)return;const{transform:B,panBy:Y,autoPanSpeed:P,autoPanOnNodeDrag:U}=t();if(!U){l=!1,cancelAnimationFrame(a);return}const[A,L]=yw(u,d,P);(A!==0||L!==0)&&(s.x=(s.x??0)-A/B[2],s.y=(s.y??0)-L/B[2],await Y({x:A,y:L})&&S(s)),a=requestAnimationFrame(R)}function I(B){var ne;const{nodeLookup:Y,multiSelectionActive:P,nodesDraggable:U,transform:A,snapGrid:L,snapToGrid:O,selectNodesOnDrag:j,onNodeDragStart:N,onSelectionDragStart:H,unselectNodesAndEdges:V}=t();f=!0,(!j||!k)&&!P&&T&&((ne=Y.get(T))!=null&&ne.selected||V()),k&&j&&T&&(e==null||e(T));const D=yu(B.sourceEvent,{transform:A,snapGrid:L,snapToGrid:O,containerBounds:d});if(s=D,o=Foe(Y,U,D,T),o.size>0&&(n||N||!T&&H)){const[J,re]=V0({nodeId:T,dragItems:o,nodeLookup:Y});n==null||n(B.sourceEvent,o,J,re),N==null||N(B.sourceEvent,J,re),T||H==null||H(B.sourceEvent,re)}}const M=AD().clickDistance(C).on("start",B=>{const{domNode:Y,nodeDragThreshold:P,transform:U,snapGrid:A,snapToGrid:L}=t();d=(Y==null?void 0:Y.getBoundingClientRect())||null,p=!1,m=!1,y=B.sourceEvent,P===0&&I(B),s=yu(B.sourceEvent,{transform:U,snapGrid:A,snapToGrid:L,containerBounds:d}),u=pi(B.sourceEvent,d)}).on("drag",B=>{const{autoPanOnNodeDrag:Y,transform:P,snapGrid:U,snapToGrid:A,nodeDragThreshold:L,nodeLookup:O}=t(),j=yu(B.sourceEvent,{transform:P,snapGrid:U,snapToGrid:A,containerBounds:d});if(y=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||T&&!O.has(T))&&(p=!0),!p){if(!l&&Y&&f&&(l=!0,R()),!f){const N=pi(B.sourceEvent,d),H=N.x-u.x,V=N.y-u.y;Math.sqrt(H*H+V*V)>L&&I(B)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&o&&f&&(u=pi(B.sourceEvent,d),S(j))}}).on("end",B=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(l=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:Y,updateNodePositions:P,onNodeDragStop:U,onSelectionDragStop:A}=t();if(m&&(P(o,!1),m=!1),i||U||!T&&A){const[L,O]=V0({nodeId:T,dragItems:o,nodeLookup:Y,dragging:!1});i==null||i(B.sourceEvent,o,L,O),U==null||U(B.sourceEvent,L,O),T||A==null||A(B.sourceEvent,O)}}}).filter(B=>{const Y=B.target;return!B.button&&(!E||!vN(Y,`.${E}`,_))&&(!b||vN(Y,b,_))});h.call(M)}function g(){h==null||h.on(".drag",null)}return{update:w,destroy:g}}function Hoe(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())ad(i,Ml(s))>0&&r.push(s);return r}const zoe=250;function Voe(e,t,n,r){var o,l;let i=[],s=1/0;const a=Hoe(e,n,t+zoe);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=eo(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=r.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function fP(e,t,n,r,i,s=!1){var u,d,f;const a=r.get(e);if(!a)return null;const o=i==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],l=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return l&&s?{...l,...eo(a,l,l.position,!0)}:l}function hP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Koe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pP=()=>!0;function Yoe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:o,nodeLookup:l,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:y,onConnectEnd:w,isValidConnection:g=pP,onReconnectEnd:E,updateConnection:b,getTransform:_,getFromHandle:k,autoPanSpeed:T,dragThreshold:C=1,handleDomNode:S}){const R=tP(e.target);let I=0,M;const{x:B,y:Y}=pi(e),P=hP(s,S),U=o==null?void 0:o.getBoundingClientRect();let A=!1;if(!U||!P)return;const L=fP(i,P,r,l,t);if(!L)return;let O=pi(e,U),j=!1,N=null,H=!1,V=null;function D(){if(!d||!U)return;const[he,Z]=yw(O,U,T);h({x:he,y:Z}),I=requestAnimationFrame(D)}const ne={...L,nodeId:i,type:P,position:L.position},J=l.get(i);let de={inProgress:!0,isValid:null,from:eo(J,ne,Pe.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:J,to:O,toHandle:null,toPosition:uN[ne.position],toNode:null,pointer:O};function G(){A=!0,b(de),m==null||m(e,{nodeId:i,handleId:r,handleType:P})}C===0&&G();function W(he){if(!A){const{x:De,y:_e}=pi(he),He=De-B,Oe=_e-Y;if(!(He*He+Oe*Oe>C*C))return;G()}if(!k()||!ne){ae(he);return}const Z=_();O=pi(he,U),M=Voe(ic(O,Z,!1,[1,1]),n,l,ne),j||(D(),j=!0);const ce=mP(he,{handle:M,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:R,lib:u,flowId:f,nodeLookup:l});V=ce.handleDomNode,N=ce.connection,H=Koe(!!M,ce.isValid);const Ie=l.get(i),xe=Ie?eo(Ie,ne,Pe.Left,!0):de.from,ge={...de,from:xe,isValid:H,to:ce.toHandle&&H?Dl({x:ce.toHandle.x,y:ce.toHandle.y},Z):O,toHandle:ce.toHandle,toPosition:H&&ce.toHandle?ce.toHandle.position:uN[ne.position],toNode:ce.toHandle?l.get(ce.toHandle.nodeId):null,pointer:O};b(ge),de=ge}function ae(he){if(!("touches"in he&&he.touches.length>0)){if(A){(M||V)&&N&&H&&(y==null||y(N));const{inProgress:Z,...ce}=de,Ie={...ce,toPosition:de.toHandle?de.toPosition:null};w==null||w(he,Ie),s&&(E==null||E(he,Ie))}p(),cancelAnimationFrame(I),j=!1,H=!1,N=null,V=null,R.removeEventListener("mousemove",W),R.removeEventListener("mouseup",ae),R.removeEventListener("touchmove",W),R.removeEventListener("touchend",ae)}}R.addEventListener("mousemove",W),R.addEventListener("mouseup",ae),R.addEventListener("touchmove",W),R.addEventListener("touchend",ae)}function mP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:o,flowId:l,isValidConnection:u=pP,nodeLookup:d}){const f=s==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=pi(e),y=a.elementFromPoint(p,m),w=y!=null&&y.classList.contains(`${o}-flow__handle`)?y:h,g={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const E=hP(void 0,w),b=w.getAttribute("data-nodeid"),_=w.getAttribute("data-handleid"),k=w.classList.contains("connectable"),T=w.classList.contains("connectableend");if(!b||!E)return g;const C={source:f?b:r,sourceHandle:f?_:i,target:f?r:b,targetHandle:f?i:_};g.connection=C;const R=k&&T&&(n===Ol.Strict?f&&E==="source"||!f&&E==="target":b!==r||_!==i);g.isValid=R&&u(C),g.toHandle=fP(b,E,_,d,n,!0)}return g}const db={onPointerDown:Yoe,isValid:mP};function Woe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Lr(e);function s({translateExtent:o,width:l,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const _=n(),k=b.sourceEvent.ctrlKey&&od()?10:1,T=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*d,C=_[2]*Math.pow(2,T*k);t.scaleTo(C)};let y=[0,0];const w=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(y=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},g=b=>{const _=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const k=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],T=[k[0]-y[0],k[1]-y[1]];y=k;const C=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),S={x:_[0]-T[0]*C,y:_[1]-T[1]*C},R=[[0,0],[l,u]];t.setViewportConstrained({x:S.x,y:S.y,zoom:_[2]},R,o)},E=zD().on("start",w).on("zoom",f?g:null).on("zoom.wheel",h?m:null);i.call(E,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:ui}}const tg=e=>({x:e.x,y:e.y,zoom:e.k}),K0=({x:e,y:t,zoom:n})=>Zm.translate(e,t).scale(n),Xo=(e,t)=>e.target.closest(`.${t}`),gP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),qoe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Y0=(e,t=0,n=qoe,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},yP=e=>{const t=e.ctrlKey&&od()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Goe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:l,onPanZoomEnd:u}){return d=>{if(Xo(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const w=ui(d),g=yP(d),E=f*Math.pow(2,g);r.scaleTo(n,E,w,d);return}const h=d.deltaMode===1?20:1;let p=i===Ba.Vertical?0:d.deltaX*h,m=i===Ba.Horizontal?0:d.deltaY*h;!od()&&d.shiftKey&&i!==Ba.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*s,-(m/f)*s,{internal:!0});const y=tg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(d,y),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,y))}}function Xoe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,o=Xo(r,e);if(r.ctrlKey&&s&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),n.call(this,r,i)}}function Qoe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,a,o;if((s=r.sourceEvent)!=null&&s.internal)return;const i=tg(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function Zoe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var a,o;e.usedRightMouseButton=!!(n&&gP(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((o=s.sourceEvent)!=null&&o.internal)&&(i==null||i(s.sourceEvent,tg(s.transform)))}}function Joe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,s&&gP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const l=tg(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,l)},n?150:0)}}}function ele({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:o,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{var w;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Xo(f,`${u}-flow__node`)||Xo(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!m||Xo(f,o)&&m||Xo(f,l)&&(!m||i&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&y}}function tle({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:l}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=zD().scaleExtent([t,n]).translateExtent(r),h=Lr(e).call(f);E({x:i.x,y:i.y,zoom:Ll(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(yP);async function y(M,B){return h?new Promise(Y=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?gu:Lh).transform(Y0(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>Y(!0)),M)}):!1}function w({noWheelClassName:M,noPanClassName:B,onPaneContextMenu:Y,userSelectionActive:P,panOnScroll:U,panOnDrag:A,panOnScrollMode:L,panOnScrollSpeed:O,preventScrolling:j,zoomOnPinch:N,zoomOnScroll:H,zoomOnDoubleClick:V,zoomActivationKeyPressed:D,lib:ne,onTransformChange:J,connectionInProgress:re,paneClickDistance:de,selectionOnDrag:G}){P&&!u.isZoomingOrPanning&&g();const W=U&&!D&&!P;f.clickDistance(G?1/0:!hi(de)||de<0?0:de);const ae=W?Goe({zoomPanValues:u,noWheelClassName:M,d3Selection:h,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:O,zoomOnPinch:N,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:o}):Xoe({noWheelClassName:M,preventScrolling:j,d3ZoomHandler:p});h.on("wheel.zoom",ae,{passive:!1});const he=Qoe({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});f.on("start",he);const Z=Zoe({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!Y,onPanZoom:s,onTransformChange:J});f.on("zoom",Z);const ce=Joe({zoomPanValues:u,panOnDrag:A,panOnScroll:U,onPaneContextMenu:Y,onPanZoomEnd:o,onDraggingChange:l});f.on("end",ce);const Ie=ele({zoomActivationKeyPressed:D,panOnDrag:A,zoomOnScroll:H,panOnScroll:U,zoomOnDoubleClick:V,zoomOnPinch:N,userSelectionActive:P,noPanClassName:B,noWheelClassName:M,lib:ne,connectionInProgress:re});f.filter(Ie),V?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function E(M,B,Y){const P=K0(M),U=f==null?void 0:f.constrain()(P,B,Y);return U&&await y(U),U}async function b(M,B){const Y=K0(M);return await y(Y,B),Y}function _(M){if(h){const B=K0(M),Y=h.property("__zoom");(Y.k!==M.zoom||Y.x!==M.x||Y.y!==M.y)&&(f==null||f.transform(h,B,null,{sync:!0}))}}function k(){const M=h?HD(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function T(M,B){return h?new Promise(Y=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?gu:Lh).scaleTo(Y0(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>Y(!0)),M)}):!1}async function C(M,B){return h?new Promise(Y=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?gu:Lh).scaleBy(Y0(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>Y(!0)),M)}):!1}function S(M){f==null||f.scaleExtent(M)}function R(M){f==null||f.translateExtent(M)}function I(M){const B=!hi(M)||M<0?0:M;f==null||f.clickDistance(B)}return{update:w,destroy:g,setViewport:b,setViewportConstrained:E,getViewport:k,scaleTo:T,scaleBy:C,setScaleExtent:S,setTranslateExtent:R,syncViewport:_,setClickDistance:I}}var Pl;(function(e){e.Line="line",e.Handle="handle"})(Pl||(Pl={}));function nle({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const a=e-t,o=n-r,l=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&i&&(l[0]=l[0]*-1),o&&s&&(l[1]=l[1]*-1),l}function _N(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function vs(e,t){return Math.max(0,t-e)}function _s(e,t){return Math.max(0,e-t)}function Zf(e,t,n){return Math.max(0,t-e,e-n)}function TN(e,t){return e?!t:t}function rle(e,t,n,r,i,s,a,o){let{affectsX:l,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:y,maxWidth:w,minHeight:g,maxHeight:E}=r,{x:b,y:_,width:k,height:T,aspectRatio:C}=e;let S=Math.floor(d?p-e.pointerX:0),R=Math.floor(f?m-e.pointerY:0);const I=k+(l?-S:S),M=T+(u?-R:R),B=-s[0]*k,Y=-s[1]*T;let P=Zf(I,y,w),U=Zf(M,g,E);if(a){let O=0,j=0;l&&S<0?O=vs(b+S+B,a[0][0]):!l&&S>0&&(O=_s(b+I+B,a[1][0])),u&&R<0?j=vs(_+R+Y,a[0][1]):!u&&R>0&&(j=_s(_+M+Y,a[1][1])),P=Math.max(P,O),U=Math.max(U,j)}if(o){let O=0,j=0;l&&S>0?O=_s(b+S,o[0][0]):!l&&S<0&&(O=vs(b+I,o[1][0])),u&&R>0?j=_s(_+R,o[0][1]):!u&&R<0&&(j=vs(_+M,o[1][1])),P=Math.max(P,O),U=Math.max(U,j)}if(i){if(d){const O=Zf(I/C,g,E)*C;if(P=Math.max(P,O),a){let j=0;!l&&!u||l&&!u&&h?j=_s(_+Y+I/C,a[1][1])*C:j=vs(_+Y+(l?S:-S)/C,a[0][1])*C,P=Math.max(P,j)}if(o){let j=0;!l&&!u||l&&!u&&h?j=vs(_+I/C,o[1][1])*C:j=_s(_+(l?S:-S)/C,o[0][1])*C,P=Math.max(P,j)}}if(f){const O=Zf(M*C,y,w)/C;if(U=Math.max(U,O),a){let j=0;!l&&!u||u&&!l&&h?j=_s(b+M*C+B,a[1][0])/C:j=vs(b+(u?R:-R)*C+B,a[0][0])/C,U=Math.max(U,j)}if(o){let j=0;!l&&!u||u&&!l&&h?j=vs(b+M*C,o[1][0])/C:j=_s(b+(u?R:-R)*C,o[0][0])/C,U=Math.max(U,j)}}}R=R+(R<0?U:-U),S=S+(S<0?P:-P),i&&(h?I>M*C?R=(TN(l,u)?-S:S)/C:S=(TN(l,u)?-R:R)*C:d?(R=S/C,u=l):(S=R*C,l=u));const A=l?b+S:b,L=u?_+R:_;return{width:k+(l?-S:S),height:T+(u?-R:R),x:s[0]*S*(l?-1:1)+A,y:s[1]*R*(u?-1:1)+L}}const bP={width:0,height:0,x:0,y:0},ile={...bP,pointerX:0,pointerY:0,aspectRatio:1};function sle(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,o=n[0]*s,l=n[1]*a;return[[r-o,i-l],[r+s-o,i+a-l]]}function ale({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Lr(e);let a={controlDirection:_N("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:y,shouldResize:w}){let g={...bP},E={...ile};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:_N(u)};let b,_=null,k=[],T,C,S,R=!1;const I=AD().on("start",M=>{const{nodeLookup:B,transform:Y,snapGrid:P,snapToGrid:U,nodeOrigin:A,paneDomNode:L}=n();if(b=B.get(t),!b)return;_=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:O,ySnapped:j}=yu(M.sourceEvent,{transform:Y,snapGrid:P,snapToGrid:U,containerBounds:_});g={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},E={...g,pointerX:O,pointerY:j,aspectRatio:g.width/g.height},T=void 0,C=Ja(b.extent)?b.extent:void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(T=B.get(b.parentId)),T&&b.extent==="parent"&&(C=[[0,0],[T.measured.width,T.measured.height]]),k=[],S=void 0;for(const[N,H]of B)if(H.parentId===t&&(k.push({id:N,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const V=sle(H,b,H.origin??A);S?S=[[Math.min(V[0][0],S[0][0]),Math.min(V[0][1],S[0][1])],[Math.max(V[1][0],S[1][0]),Math.max(V[1][1],S[1][1])]]:S=V}p==null||p(M,{...g})}).on("drag",M=>{const{transform:B,snapGrid:Y,snapToGrid:P,nodeOrigin:U}=n(),A=yu(M.sourceEvent,{transform:B,snapGrid:Y,snapToGrid:P,containerBounds:_}),L=[];if(!b)return;const{x:O,y:j,width:N,height:H}=g,V={},D=b.origin??U,{width:ne,height:J,x:re,y:de}=rle(E,a.controlDirection,A,a.boundaries,a.keepAspectRatio,D,C,S),G=ne!==N,W=J!==H,ae=re!==O&&G,he=de!==j&&W;if(!ae&&!he&&!G&&!W)return;if((ae||he||D[0]===1||D[1]===1)&&(V.x=ae?re:g.x,V.y=he?de:g.y,g.x=V.x,g.y=V.y,k.length>0)){const xe=re-O,ge=de-j;for(const De of k)De.position={x:De.position.x-xe+D[0]*(ne-N),y:De.position.y-ge+D[1]*(J-H)},L.push(De)}if((G||W)&&(V.width=G&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ne:g.width,V.height=W&&(!a.resizeDirection||a.resizeDirection==="vertical")?J:g.height,g.width=V.width,g.height=V.height),T&&b.expandParent){const xe=D[0]*(V.width??0);V.x&&V.x{R&&(y==null||y(M,{...g}),i==null||i({...g}),R=!1)});s.call(I)}function l(){s.on(".drag",null)}return{update:o,destroy:l}}var EP={exports:{}},xP={},wP={exports:{}},vP={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var jl=v;function ole(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lle=typeof Object.is=="function"?Object.is:ole,cle=jl.useState,ule=jl.useEffect,dle=jl.useLayoutEffect,fle=jl.useDebugValue;function hle(e,t){var n=t(),r=cle({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return dle(function(){i.value=n,i.getSnapshot=t,W0(i)&&s({inst:i})},[e,n,t]),ule(function(){return W0(i)&&s({inst:i}),e(function(){W0(i)&&s({inst:i})})},[e]),fle(n),n}function W0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lle(e,n)}catch{return!0}}function ple(e,t){return t()}var mle=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ple:hle;vP.useSyncExternalStore=jl.useSyncExternalStore!==void 0?jl.useSyncExternalStore:mle;wP.exports=vP;var gle=wP.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ng=v,yle=gle;function ble(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ele=typeof Object.is=="function"?Object.is:ble,xle=yle.useSyncExternalStore,wle=ng.useRef,vle=ng.useEffect,_le=ng.useMemo,Tle=ng.useDebugValue;xP.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=wle(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=_le(function(){function l(p){if(!u){if(u=!0,d=p,p=r(p),i!==void 0&&a.hasValue){var m=a.value;if(i(m,p))return f=m}return f=p}if(m=f,Ele(d,p))return m;var y=r(p);return i!==void 0&&i(m,y)?(d=p,m):(d=p,f=y)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return l(t())},h===null?void 0:function(){return l(h())}]},[t,n,r,i]);var o=xle(e,s[0],s[1]);return vle(function(){a.hasValue=!0,a.value=o},[o]),Tle(o),o};EP.exports=xP;var kle=EP.exports;const Sle=cd(kle),Nle={},kN=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Nle?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,i,l);return l},Ale=e=>e?kN(e):kN,{useDebugValue:Cle}=nt,{useSyncExternalStoreWithSelector:Ile}=Sle,Rle=e=>e;function _P(e,t=Rle,n){const r=Ile(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Cle(r),r}const SN=(e,t)=>{const n=Ale(e),r=(i,s=t)=>_P(n,i,s);return Object.assign(r,n),r},Ole=(e,t)=>e?SN(e,t):SN;function Qt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const rg=v.createContext(null),Lle=rg.Provider,TP=xi.error001("react");function pt(e,t){const n=v.useContext(rg);if(n===null)throw new Error(TP);return _P(n,e,t)}function Zt(){const e=v.useContext(rg);if(e===null)throw new Error(TP);return v.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const NN={display:"none"},Mle={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},kP="react-flow__node-desc",SP="react-flow__edge-desc",Dle="react-flow__aria-live",Ple=e=>e.ariaLiveMessage,jle=e=>e.ariaLabelConfig;function Ble({rfId:e}){const t=pt(Ple);return c.jsx("div",{id:`${Dle}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Mle,children:t})}function Fle({rfId:e,disableKeyboardA11y:t}){const n=pt(jle);return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`${kP}-${e}`,style:NN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),c.jsx("div",{id:`${SP}-${e}`,style:NN,children:n["edge.a11yDescription.default"]}),!t&&c.jsx(Ble,{rfId:e})]})}const ig=v.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const a=`${e}`.split("-");return c.jsx("div",{className:_n(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});ig.displayName="Panel";function Ule({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:c.jsx(ig,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:c.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $le=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Jf=e=>e.id;function Hle(e,t){return Qt(e.selectedNodes.map(Jf),t.selectedNodes.map(Jf))&&Qt(e.selectedEdges.map(Jf),t.selectedEdges.map(Jf))}function zle({onSelectionChange:e}){const t=Zt(),{selectedNodes:n,selectedEdges:r}=pt($le,Hle);return v.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const Vle=e=>!!e.onSelectionChangeHandlers;function Kle({onSelectionChange:e}){const t=pt(Vle);return e||t?c.jsx(zle,{onSelectionChange:e}):null}const NP=[0,0],Yle={x:0,y:0,zoom:1},Wle=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],AN=[...Wle,"rfId"],qle=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),CN={translateExtent:rd,nodeOrigin:NP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Gle(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:l}=pt(qle,Qt),u=Zt();v.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=CN,o()}),[]);const d=v.useRef(CN);return v.useEffect(()=>{for(const f of AN){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Eoe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},AN.map(f=>e[f])),null}function IN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Xle(e){var r;const[t,n]=v.useState(e==="system"?null:e);return v.useEffect(()=>{if(e!=="system"){n(e);return}const i=IN(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=IN())!=null&&r.matches?"dark":"light"}const RN=typeof document<"u"?document:null;function ld(e=null,t={target:RN,actInsideInputWithModifier:!0}){const[n,r]=v.useState(!1),i=v.useRef(!1),s=v.useRef(new Set([])),[a,o]=v.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` -`).replace(` - -`,` -+`).split(` -`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return v.useEffect(()=>{const l=(t==null?void 0:t.target)??RN,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var w,g;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&nP(p))return!1;const y=LN(p.code,o);if(s.current.add(p[y]),ON(a,s.current,!1)){const E=((g=(w=p.composedPath)==null?void 0:w.call(p))==null?void 0:g[0])||p.target,b=(E==null?void 0:E.nodeName)==="BUTTON"||(E==null?void 0:E.nodeName)==="A";t.preventDefault!==!1&&(i.current||!b)&&p.preventDefault(),r(!0)}},f=p=>{const m=LN(p.code,o);ON(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(p[m]),p.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",d),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{l==null||l.removeEventListener("keydown",d),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function ON(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function LN(e,t){return t.includes(e)?"code":"key"}const Qle=()=>{const e=Zt();return v.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:s,maxZoom:a,panZoom:o}=e.getState(),l=bw(t,r,i,s,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(l,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:i,snapToGrid:s,domNode:a}=e.getState();if(!a)return t;const{x:o,y:l}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-l},d=n.snapGrid??i,f=n.snapToGrid??s;return ic(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),a=Dl(t,n);return{x:a.x+i,y:a.y+s}}}),[])};function AP(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const a=r.get(s.id);a?a.push(s):r.set(s.id,[s])}for(const s of t){const a=r.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...s};for(const l of a)Zle(l,o);n.push(o)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Zle(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function CP(e,t){return AP(e,t)}function IP(e,t){return AP(e,t)}function xa(e,t){return{id:e,type:"select",selected:t}}function Qo(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const a=t.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),r.push(xa(s.id,a)))}return r}function MN({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const o=t.get(a.id),l=((i=o==null?void 0:o.internals)==null?void 0:i.userNode)??o;l!==void 0&&l!==a&&n.push({id:a.id,item:a,type:"replace"}),l===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function DN(e){return{id:e.id,type:"remove"}}const Jle=ZD();function RP(e,t,n={}){return koe(e,t,{...n,onError:n.onError??Jle})}const PN=e=>uoe(e),ece=e=>qD(e);function OP(e){return v.forwardRef(e)}const tce=typeof window<"u"?v.useLayoutEffect:v.useEffect;function jN(e){const[t,n]=v.useState(BigInt(0)),[r]=v.useState(()=>nce(()=>n(i=>i+BigInt(1))));return tce(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function nce(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const LP=v.createContext(null);function rce({children:e}){const t=Zt(),n=v.useCallback(o=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let y=l;for(const g of o)y=typeof g=="function"?g(y):g;let w=MN({items:y,lookup:h});for(const g of m.values())w=g(w);d&&u(y),w.length>0?f==null||f(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:E,setNodes:b}=t.getState();g&&b(E)})},[]),r=jN(n),i=v.useCallback(o=>{const{edges:l=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=l;for(const m of o)p=typeof m=="function"?m(p):m;d?u(p):f&&f(MN({items:p,lookup:h}))},[]),s=jN(i),a=v.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return c.jsx(LP.Provider,{value:a,children:e})}function ice(){const e=v.useContext(LP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const sce=e=>!!e.panZoom;function kw(){const e=Qle(),t=Zt(),n=ice(),r=pt(sce),i=v.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},l=f=>{var g,E;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=PN(f)?f:h.get(f.id),y=m.parentId?eP(m.position,m.measured,m.parentId,h,p):m.position,w={...m,position:y,width:((g=m.measured)==null?void 0:g.width)??m.width,height:((E=m.measured)==null?void 0:E.height)??m.height};return Ml(w)},u=(f,h,p={replace:!1})=>{a(m=>m.map(y=>{if(y.id===f){const w=typeof h=="function"?h(y):h;return p.replace&&PN(w)?w:{...y,...w}}return y}))},d=(f,h,p={replace:!1})=>{o(m=>m.map(y=>{if(y.id===f){const w=typeof h=="function"?h(y):h;return p.replace&&ece(w)?w:{...y,...w}}return y}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,y,w]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x:m,y,zoom:w}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:y,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:E,onDelete:b,onBeforeDelete:_}=t.getState(),{nodes:k,edges:T}=await moe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:_}),C=T.length>0,S=k.length>0;if(C){const R=T.map(DN);w==null||w(T),E(R)}if(S){const R=k.map(DN);y==null||y(k),g(R)}return(S||C)&&(b==null||b({nodes:k,edges:T})),{deletedNodes:k,deletedEdges:T}},getIntersectingNodes:(f,h=!0,p)=>{const m=fN(f),y=m?f:l(f),w=p!==void 0;return y?(p||t.getState().nodes).filter(g=>{const E=t.getState().nodeLookup.get(g.id);if(E&&!m&&(g.id===f.id||!E.internals.positionAbsolute))return!1;const b=Ml(w?g:E),_=ad(b,y);return h&&_>0||_>=b.width*b.height||_>=y.width*y.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const y=fN(f)?f:l(f);if(!y)return!1;const w=ad(y,h);return p&&w>0||w>=h.width*h.height||w>=y.width*y.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const y=typeof h=="function"?h(m):h;return p.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const y=typeof h=="function"?h(m):h;return p.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return doe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??boe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return v.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const BN=e=>e.selected,ace=typeof window<"u"?window:void 0;function oce({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Zt(),{deleteElements:r}=kw(),i=ld(e,{actInsideInputWithModifier:!1}),s=ld(t,{target:ace});v.useEffect(()=>{if(i){const{edges:a,nodes:o}=n.getState();r({nodes:o.filter(BN),edges:a.filter(BN)}),n.setState({nodesSelectionActive:!1})}},[i]),v.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function lce(e){const t=Zt();v.useEffect(()=>{const n=()=>{var i,s,a,o;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=Ew(e.current);(r.height===0||r.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",xi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const sg={position:"absolute",width:"100%",height:"100%",top:0,left:0},cce=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function uce({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=Ba.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:y,noPanClassName:w,onViewportChange:g,isControlledViewport:E,paneClickDistance:b,selectionOnDrag:_}){const k=Zt(),T=v.useRef(null),{userSelectionActive:C,lib:S,connectionInProgress:R}=pt(cce,Qt),I=ld(h),M=v.useRef();lce(T);const B=v.useCallback(Y=>{g==null||g({x:Y[0],y:Y[1],zoom:Y[2]}),E||k.setState({transform:Y})},[g,E]);return v.useEffect(()=>{if(T.current){M.current=tle({domNode:T.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:A=>k.setState(L=>L.paneDragging===A?L:{paneDragging:A}),onPanZoomStart:(A,L)=>{const{onViewportChangeStart:O,onMoveStart:j}=k.getState();j==null||j(A,L),O==null||O(L)},onPanZoom:(A,L)=>{const{onViewportChange:O,onMove:j}=k.getState();j==null||j(A,L),O==null||O(L)},onPanZoomEnd:(A,L)=>{const{onViewportChangeEnd:O,onMoveEnd:j}=k.getState();j==null||j(A,L),O==null||O(L)}});const{x:Y,y:P,zoom:U}=M.current.getViewport();return k.setState({panZoom:M.current,transform:[Y,P,U],domNode:T.current.closest(".react-flow")}),()=>{var A;(A=M.current)==null||A.destroy()}}},[]),v.useEffect(()=>{var Y;(Y=M.current)==null||Y.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:I,preventScrolling:p,noPanClassName:w,userSelectionActive:C,noWheelClassName:y,lib:S,onTransformChange:B,connectionInProgress:R,selectionOnDrag:_,paneClickDistance:b})},[e,t,n,r,i,s,a,o,I,p,w,C,y,S,B,R,_,b]),c.jsx("div",{className:"react-flow__renderer",ref:T,style:sg,children:m})}const dce=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fce(){const{userSelectionActive:e,userSelectionRect:t}=pt(dce,Qt);return e&&t?c.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const q0=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},hce=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function pce({isSelecting:e,selectionKeyPressed:t,selectionMode:n=id.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const w=v.useRef(0),g=Zt(),{userSelectionActive:E,elementsSelectable:b,dragging:_,connectionInProgress:k,panBy:T,autoPanSpeed:C}=pt(hce,Qt),S=b&&(e||E),R=v.useRef(null),I=v.useRef(),M=v.useRef(new Set),B=v.useRef(new Set),Y=v.useRef(!1),P=v.useRef({x:0,y:0}),U=v.useRef(!1),A=G=>{if(Y.current||k){Y.current=!1;return}u==null||u(G),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},L=G=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){G.preventDefault();return}d==null||d(G)},O=f?G=>f(G):void 0,j=G=>{Y.current&&(G.stopPropagation(),Y.current=!1)},N=G=>{var De,_e;const{domNode:W,transform:ae}=g.getState();if(I.current=W==null?void 0:W.getBoundingClientRect(),!I.current)return;const he=G.target===R.current;if(!he&&!!G.target.closest(".nokey")||!e||!(a&&he||t)||G.button!==0||!G.isPrimary)return;(_e=(De=G.target)==null?void 0:De.setPointerCapture)==null||_e.call(De,G.pointerId),Y.current=!1;const{x:Ie,y:xe}=pi(G.nativeEvent,I.current),ge=ic({x:Ie,y:xe},ae);g.setState({userSelectionRect:{width:0,height:0,startX:ge.x,startY:ge.y,x:Ie,y:xe}}),he||(G.stopPropagation(),G.preventDefault())};function H(G,W){const{userSelectionRect:ae}=g.getState();if(!ae)return;const{transform:he,nodeLookup:Z,edgeLookup:ce,connectionLookup:Ie,triggerNodeChanges:xe,triggerEdgeChanges:ge,defaultEdgeOptions:De}=g.getState(),_e={x:ae.startX,y:ae.startY},{x:He,y:Oe}=Dl(_e,he),oe={startX:_e.x,startY:_e.y,x:Gdt.id)),B.current=new Set;const St=(De==null?void 0:De.selectable)??!0;for(const dt of M.current){const K=Ie.get(dt);if(K)for(const{edgeId:X}of K.values()){const le=ce.get(X);le&&(le.selectable??St)&&B.current.add(X)}}if(!hN(kt,M.current)){const dt=Qo(Z,M.current,!0);xe(dt)}if(!hN(ve,B.current)){const dt=Qo(ce,B.current);ge(dt)}g.setState({userSelectionRect:oe,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!i||!I.current)return;const[G,W]=yw(P.current,I.current,C);T({x:G,y:W}).then(ae=>{if(!Y.current||!ae){w.current=requestAnimationFrame(V);return}const{x:he,y:Z}=P.current;H(he,Z),w.current=requestAnimationFrame(V)})}const D=()=>{cancelAnimationFrame(w.current),w.current=0,U.current=!1};v.useEffect(()=>()=>D(),[]);const ne=G=>{const{userSelectionRect:W,transform:ae,resetSelectedElements:he}=g.getState();if(!I.current||!W)return;const{x:Z,y:ce}=pi(G.nativeEvent,I.current);P.current={x:Z,y:ce};const Ie=Dl({x:W.startX,y:W.startY},ae);if(!Y.current){const xe=t?0:s;if(Math.hypot(Z-Ie.x,ce-Ie.y)<=xe)return;he(),o==null||o(G)}Y.current=!0,U.current||(V(),U.current=!0),H(Z,ce)},J=G=>{var W,ae;G.button===0&&((ae=(W=G.target)==null?void 0:W.releasePointerCapture)==null||ae.call(W,G.pointerId),!E&&G.target===R.current&&g.getState().userSelectionRect&&(A==null||A(G)),g.setState({userSelectionActive:!1,userSelectionRect:null}),Y.current&&(l==null||l(G),g.setState({nodesSelectionActive:M.current.size>0})),D())},re=G=>{var W,ae;(ae=(W=G.target)==null?void 0:W.releasePointerCapture)==null||ae.call(W,G.pointerId),D()},de=r===!0||Array.isArray(r)&&r.includes(0);return c.jsxs("div",{className:_n(["react-flow__pane",{draggable:de,dragging:_,selection:e}]),onClick:S?void 0:q0(A,R),onContextMenu:q0(L,R),onWheel:q0(O,R),onPointerEnter:S?void 0:h,onPointerMove:S?ne:p,onPointerUp:S?J:void 0,onPointerCancel:S?re:void 0,onPointerDownCapture:S?N:void 0,onClickCapture:S?j:void 0,onPointerLeave:m,ref:R,style:sg,children:[y,c.jsx(fce,{})]})}function fb({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:o,onError:l}=t.getState(),u=o.get(e);if(!u){l==null||l("012",xi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):i([e])}function MP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const o=Zt(),[l,u]=v.useState(!1),d=v.useRef();return v.useEffect(()=>{d.current=$oe({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{fb({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),v.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,s,e,i,a]),l}const mce=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function DP(){const e=Zt();return v.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:o,updateNodePositions:l,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=mce(a),p=i?s[0]:5,m=i?s[1]:5,y=n.direction.x*p*n.factor,w=n.direction.y*m*n.factor;for(const[,g]of u){if(!h(g))continue;let E={x:g.internals.positionAbsolute.x+y,y:g.internals.positionAbsolute.y+w};i&&(E=Vd(E,s));const{position:b,positionAbsolute:_}=GD({nodeId:g.id,nextPosition:E,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:o});g.position=b,g.internals.positionAbsolute=_,f.set(g.id,g)}l(f)},[])}const Sw=v.createContext(null),gce=Sw.Provider;Sw.Consumer;const PP=()=>v.useContext(Sw),yce=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),bce=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:o,toHandle:l,isValid:u}=a,d=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===Ol.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!i,valid:d&&u}};function Ece({type:e="source",position:t=Pe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:o,children:l,className:u,onMouseDown:d,onTouchStart:f,...h},p){var U,A;const m=a||null,y=e==="target",w=Zt(),g=PP(),{connectOnClick:E,noPanClassName:b,rfId:_}=pt(yce,Qt),{connectingFrom:k,connectingTo:T,clickConnecting:C,isPossibleEndHandle:S,connectionInProcess:R,clickConnectionInProcess:I,valid:M}=pt(bce(g,m,e),Qt);g||(A=(U=w.getState()).onError)==null||A.call(U,"010",xi.error010());const B=L=>{const{defaultEdgeOptions:O,onConnect:j,hasDefaultEdges:N}=w.getState(),H={...O,...L};if(N){const{edges:V,setEdges:D,onError:ne}=w.getState();D(RP(H,V,{onError:ne}))}j==null||j(H),o==null||o(H)},Y=L=>{if(!g)return;const O=rP(L.nativeEvent);if(i&&(O&&L.button===0||!O)){const j=w.getState();db.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:j.autoPanOnConnect,connectionMode:j.connectionMode,connectionRadius:j.connectionRadius,domNode:j.domNode,nodeLookup:j.nodeLookup,lib:j.lib,isTarget:y,handleId:m,nodeId:g,flowId:j.rfId,panBy:j.panBy,cancelConnection:j.cancelConnection,onConnectStart:j.onConnectStart,onConnectEnd:(...N)=>{var H,V;return(V=(H=w.getState()).onConnectEnd)==null?void 0:V.call(H,...N)},updateConnection:j.updateConnection,onConnect:B,isValidConnection:n||((...N)=>{var H,V;return((V=(H=w.getState()).isValidConnection)==null?void 0:V.call(H,...N))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:j.autoPanSpeed,dragThreshold:j.connectionDragThreshold})}O?d==null||d(L):f==null||f(L)},P=L=>{const{onClickConnectStart:O,onClickConnectEnd:j,connectionClickStartHandle:N,connectionMode:H,isValidConnection:V,lib:D,rfId:ne,nodeLookup:J,connection:re}=w.getState();if(!g||!N&&!i)return;if(!N){O==null||O(L.nativeEvent,{nodeId:g,handleId:m,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:m}});return}const de=tP(L.target),G=n||V,{connection:W,isValid:ae}=db.isValid(L.nativeEvent,{handle:{nodeId:g,id:m,type:e},connectionMode:H,fromNodeId:N.nodeId,fromHandleId:N.id||null,fromType:N.type,isValidConnection:G,flowId:ne,doc:de,lib:D,nodeLookup:J});ae&&W&&B(W);const he=structuredClone(re);delete he.inProgress,he.toPosition=he.toHandle?he.toHandle.position:null,j==null||j(L,he),w.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":m,"data-nodeid":g,"data-handlepos":t,"data-id":`${_}-${g}-${m}-${e}`,className:_n(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!y,target:y,connectable:r,connectablestart:i,connectableend:s,clickconnecting:C,connectingfrom:k,connectingto:T,valid:M,connectionindicator:r&&(!R||S)&&(R||I?s:i)}]),onMouseDown:Y,onTouchStart:Y,onClick:E?P:void 0,ref:p,...h,children:l})}const Bl=v.memo(OP(Ece));function xce({data:e,isConnectable:t,sourcePosition:n=Pe.Bottom}){return c.jsxs(c.Fragment,{children:[e==null?void 0:e.label,c.jsx(Bl,{type:"source",position:n,isConnectable:t})]})}function wce({data:e,isConnectable:t,targetPosition:n=Pe.Top,sourcePosition:r=Pe.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(Bl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,c.jsx(Bl,{type:"source",position:r,isConnectable:t})]})}function vce(){return null}function _ce({data:e,isConnectable:t,targetPosition:n=Pe.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(Bl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Xp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},FN={input:xce,default:wce,output:_ce,group:vce};function Tce(e){var t,n,r,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const kce=e=>{const{width:t,height:n,x:r,y:i}=zd(e.nodeLookup,{filter:s=>!!s.selected});return{width:hi(t)?t:null,height:hi(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Sce({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Zt(),{width:i,height:s,transformString:a,userSelectionActive:o}=pt(kce,Qt),l=DP(),u=v.useRef(null);v.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&i!==null&&s!==null;if(MP({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=r.getState().nodes.filter(y=>y.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Xp,p.key)&&(p.preventDefault(),l({direction:Xp[p.key],factor:p.shiftKey?4:1}))};return c.jsx("div",{className:_n(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:c.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:s}})})}const UN=typeof window<"u"?window:void 0,Nce=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function jP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:E,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:T,zoomOnDoubleClick:C,panOnDrag:S,autoPanOnSelection:R,defaultViewport:I,translateExtent:M,minZoom:B,maxZoom:Y,preventScrolling:P,onSelectionContextMenu:U,noWheelClassName:A,noPanClassName:L,disableKeyboardA11y:O,onViewportChange:j,isControlledViewport:N}){const{nodesSelectionActive:H,userSelectionActive:V}=pt(Nce,Qt),D=ld(u,{target:UN}),ne=ld(y,{target:UN}),J=ne||S,re=ne||_,de=d&&J!==!0,G=D||V||de;return oce({deleteKeyCode:l,multiSelectionKeyCode:m}),c.jsx(uce,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:E,zoomOnPinch:b,panOnScroll:re,panOnScrollSpeed:k,panOnScrollMode:T,zoomOnDoubleClick:C,panOnDrag:!D&&J,defaultViewport:I,translateExtent:M,minZoom:B,maxZoom:Y,zoomActivationKeyCode:w,preventScrolling:P,noWheelClassName:A,noPanClassName:L,onViewportChange:j,isControlledViewport:N,paneClickDistance:o,selectionOnDrag:de,children:c.jsxs(pce,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:J,autoPanOnSelection:R,isSelecting:!!G,selectionMode:f,selectionKeyPressed:D,paneClickDistance:o,selectionOnDrag:de,children:[e,H&&c.jsx(Sce,{onSelectionContextMenu:U,noPanClassName:L,disableKeyboardA11y:O})]})})}jP.displayName="FlowRenderer";const Ace=v.memo(jP),Cce=e=>t=>e?gw(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Ice(e){return pt(v.useCallback(Cce(e),[e]),Qt)}const Rce=e=>e.updateNodeInternals;function Oce(){const e=pt(Rce),[t]=v.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return v.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Lce({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Zt(),s=v.useRef(null),a=v.useRef(null),o=v.useRef(e.sourcePosition),l=v.useRef(e.targetPosition),u=v.useRef(t),d=n&&!!e.internals.handleBounds;return v.useEffect(()=>{s.current&&!e.hidden&&(!d||a.current!==s.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(s.current),a.current=s.current)},[d,e.hidden]),v.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),v.useEffect(()=>{if(s.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=l.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,l.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function Mce({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:o,elementsSelectable:l,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:y,nodeTypes:w,nodeClickDistance:g,onError:E}){const{node:b,internals:_,isParent:k}=pt(G=>{const W=G.nodeLookup.get(e),ae=G.parentLookup.has(e);return{node:W,internals:W.internals,isParent:ae}},Qt);let T=b.type||"default",C=(w==null?void 0:w[T])||FN[T];C===void 0&&(E==null||E("003",xi.error003(T)),T="default",C=(w==null?void 0:w.default)||FN.default);const S=!!(b.draggable||o&&typeof b.draggable>"u"),R=!!(b.selectable||l&&typeof b.selectable>"u"),I=!!(b.connectable||u&&typeof b.connectable>"u"),M=!!(b.focusable||d&&typeof b.focusable>"u"),B=Zt(),Y=JD(b),P=Lce({node:b,nodeType:T,hasDimensions:Y,resizeObserver:f}),U=MP({nodeRef:P,disabled:b.hidden||!S,noDragClassName:h,handleSelector:b.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:g}),A=DP();if(b.hidden)return null;const L=ys(b),O=Tce(b),j=R||S||t||n||r||i,N=n?G=>n(G,{..._.userNode}):void 0,H=r?G=>r(G,{..._.userNode}):void 0,V=i?G=>i(G,{..._.userNode}):void 0,D=s?G=>s(G,{..._.userNode}):void 0,ne=a?G=>a(G,{..._.userNode}):void 0,J=G=>{const{selectNodesOnDrag:W,nodeDragThreshold:ae}=B.getState();R&&(!W||!S||ae>0)&&fb({id:e,store:B,nodeRef:P}),t&&t(G,{..._.userNode})},re=G=>{if(!(nP(G.nativeEvent)||m)){if(VD.includes(G.key)&&R){const W=G.key==="Escape";fb({id:e,store:B,unselect:W,nodeRef:P})}else if(S&&b.selected&&Object.prototype.hasOwnProperty.call(Xp,G.key)){G.preventDefault();const{ariaLabelConfig:W}=B.getState();B.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:G.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),A({direction:Xp[G.key],factor:G.shiftKey?4:1})}}},de=()=>{var Ie;if(m||!((Ie=P.current)!=null&&Ie.matches(":focus-visible")))return;const{transform:G,width:W,height:ae,autoPanOnNodeFocus:he,setCenter:Z}=B.getState();if(!he)return;gw(new Map([[e,b]]),{x:0,y:0,width:W,height:ae},G,!0).length>0||Z(b.position.x+L.width/2,b.position.y+L.height/2,{zoom:G[2]})};return c.jsx("div",{className:_n(["react-flow__node",`react-flow__node-${T}`,{[p]:S},b.className,{selected:b.selected,selectable:R,parent:k,draggable:S,dragging:U}]),ref:P,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:Y?"visible":"hidden",...b.style,...O},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:N,onMouseMove:H,onMouseLeave:V,onContextMenu:D,onClick:J,onDoubleClick:ne,onKeyDown:M?re:void 0,tabIndex:M?0:void 0,onFocus:M?de:void 0,role:b.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${kP}-${y}`,"aria-label":b.ariaLabel,...b.domAttributes,children:c.jsx(gce,{value:e,children:c.jsx(C,{id:e,data:b.data,type:T,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:b.selected??!1,selectable:R,draggable:S,deletable:b.deletable??!0,isConnectable:I,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:U,dragHandle:b.dragHandle,zIndex:_.z,parentId:b.parentId,...L})})})}var Dce=v.memo(Mce);const Pce=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function BP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=pt(Pce,Qt),a=Ice(e.onlyRenderVisibleElements),o=Oce();return c.jsx("div",{className:"react-flow__nodes",style:sg,children:a.map(l=>c.jsx(Dce,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}BP.displayName="NodeRenderer";const jce=v.memo(BP);function Bce(e){return pt(v.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);s&&a&&voe({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),Qt)}const Fce=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return c.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Uce=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return c.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},$N={[sd.Arrow]:Fce,[sd.ArrowClosed]:Uce};function $ce(e){const t=Zt();return v.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call($N,e)?$N[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",xi.error009(e)),null)},[e])}const Hce=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const l=$ce(t);return l?c.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:o,refX:"0",refY:"0",children:c.jsx(l,{color:n,strokeWidth:a})}):null},FP=({defaultColor:e,rfId:t})=>{const n=pt(s=>s.edges),r=pt(s=>s.defaultEdgeOptions),i=v.useMemo(()=>Ioe(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:i.map(s=>c.jsx(Hce,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};FP.displayName="MarkerDefinitions";var zce=v.memo(FP);function UP({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:l,className:u,...d}){const[f,h]=v.useState({x:1,y:0,width:0,height:0}),p=_n(["react-flow__edge-textwrapper",u]),m=v.useRef(null);return v.useEffect(()=>{if(m.current){const y=m.current.getBBox();h({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),n?c.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[i&&c.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:o,ry:o}),c.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),l]}):null}UP.displayName="EdgeText";const Vce=v.memo(UP);function ag({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l,interactionWidth:u=20,...d}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...d,d:e,fill:"none",className:_n(["react-flow__edge-path",d.className])}),u?c.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&hi(t)&&hi(n)?c.jsx(Vce,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l}):null]})}function HN({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Pe.Left||e===Pe.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function $P({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:i,targetPosition:s=Pe.Top}){const[a,o]=HN({pos:n,x1:e,y1:t,x2:r,y2:i}),[l,u]=HN({pos:s,x1:r,y1:i,x2:e,y2:t}),[d,f,h,p]=iP({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:o,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${o} ${l},${u} ${r},${i}`,d,f,h,p]}function HP(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:o,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:w,interactionWidth:g})=>{const[E,b,_]=$P({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:o}),k=e.isInternal?void 0:t;return c.jsx(ag,{id:k,path:E,labelX:b,labelY:_,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:w,interactionWidth:g})})}const Kce=HP({isInternal:!1}),zP=HP({isInternal:!0});Kce.displayName="SimpleBezierEdge";zP.displayName="SimpleBezierEdgeInternal";function VP(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Pe.Bottom,targetPosition:m=Pe.Top,markerEnd:y,markerStart:w,pathOptions:g,interactionWidth:E})=>{const[b,_,k]=lb({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:s,targetPosition:m,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),T=e.isInternal?void 0:t;return c.jsx(ag,{id:T,path:b,labelX:_,labelY:k,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:y,markerStart:w,interactionWidth:E})})}const KP=VP({isInternal:!1}),YP=VP({isInternal:!0});KP.displayName="SmoothStepEdge";YP.displayName="SmoothStepEdgeInternal";function WP(e){return v.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return c.jsx(KP,{...n,id:r,pathOptions:v.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const Yce=WP({isInternal:!1}),qP=WP({isInternal:!0});Yce.displayName="StepEdge";qP.displayName="StepEdgeInternal";function GP(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:y})=>{const[w,g,E]=oP({sourceX:n,sourceY:r,targetX:i,targetY:s}),b=e.isInternal?void 0:t;return c.jsx(ag,{id:b,path:w,labelX:g,labelY:E,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:y})})}const Wce=GP({isInternal:!1}),XP=GP({isInternal:!0});Wce.displayName="StraightEdge";XP.displayName="StraightEdgeInternal";function QP(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=Pe.Bottom,targetPosition:o=Pe.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:w,pathOptions:g,interactionWidth:E})=>{const[b,_,k]=sP({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:o,curvature:g==null?void 0:g.curvature}),T=e.isInternal?void 0:t;return c.jsx(ag,{id:T,path:b,labelX:_,labelY:k,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:w,interactionWidth:E})})}const qce=QP({isInternal:!1}),ZP=QP({isInternal:!0});qce.displayName="BezierEdge";ZP.displayName="BezierEdgeInternal";const zN={default:ZP,straight:XP,step:qP,smoothstep:YP,simplebezier:zP},VN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Gce=(e,t,n)=>n===Pe.Left?e-t:n===Pe.Right?e+t:e,Xce=(e,t,n)=>n===Pe.Top?e-t:n===Pe.Bottom?e+t:e,KN="react-flow__edgeupdater";function YN({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:o}){return c.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:_n([KN,`${KN}-${o}`]),cx:Gce(t,r,e),cy:Xce(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Qce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:o,targetPosition:l,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=Zt(),y=(_,k)=>{if(_.button!==0)return;const{autoPanOnConnect:T,domNode:C,connectionMode:S,connectionRadius:R,lib:I,onConnectStart:M,cancelConnection:B,nodeLookup:Y,rfId:P,panBy:U,updateConnection:A}=m.getState(),L=k.type==="target",O=(H,V)=>{h(!1),f==null||f(H,n,k.type,V)},j=H=>u==null?void 0:u(n,H),N=(H,V)=>{h(!0),d==null||d(_,n,k.type),M==null||M(H,V)};db.onPointerDown(_.nativeEvent,{autoPanOnConnect:T,connectionMode:S,connectionRadius:R,domNode:C,handleId:k.id,nodeId:k.nodeId,nodeLookup:Y,isTarget:L,edgeUpdaterType:k.type,lib:I,flowId:P,cancelConnection:B,panBy:U,isValidConnection:(...H)=>{var V,D;return((D=(V=m.getState()).isValidConnection)==null?void 0:D.call(V,...H))??!0},onConnect:j,onConnectStart:N,onConnectEnd:(...H)=>{var V,D;return(D=(V=m.getState()).onConnectEnd)==null?void 0:D.call(V,...H)},onReconnectEnd:O,updateConnection:A,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},w=_=>y(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=_=>y(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>p(!0),b=()=>p(!1);return c.jsxs(c.Fragment,{children:[(e===!0||e==="source")&&c.jsx(YN,{position:o,centerX:r,centerY:i,radius:t,onMouseDown:w,onMouseEnter:E,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&c.jsx(YN,{position:l,centerX:s,centerY:a,radius:t,onMouseDown:g,onMouseEnter:E,onMouseOut:b,type:"target"})]})}function Zce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:y,noPanClassName:w,onError:g,disableKeyboardA11y:E}){let b=pt(Z=>Z.edgeLookup.get(e));const _=pt(Z=>Z.defaultEdgeOptions);b=_?{..._,...b}:b;let k=b.type||"default",T=(y==null?void 0:y[k])||zN[k];T===void 0&&(g==null||g("011",xi.error011(k)),k="default",T=(y==null?void 0:y.default)||zN.default);const C=!!(b.focusable||t&&typeof b.focusable>"u"),S=typeof f<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),R=!!(b.selectable||r&&typeof b.selectable>"u"),I=v.useRef(null),[M,B]=v.useState(!1),[Y,P]=v.useState(!1),U=Zt(),{zIndex:A,sourceX:L,sourceY:O,targetX:j,targetY:N,sourcePosition:H,targetPosition:V}=pt(v.useCallback(Z=>{const ce=Z.nodeLookup.get(b.source),Ie=Z.nodeLookup.get(b.target);if(!ce||!Ie)return{zIndex:b.zIndex,...VN};const xe=Coe({id:e,sourceNode:ce,targetNode:Ie,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:Z.connectionMode,onError:g});return{zIndex:woe({selected:b.selected,zIndex:b.zIndex,sourceNode:ce,targetNode:Ie,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode}),...xe||VN}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),Qt),D=v.useMemo(()=>b.markerStart?`url('#${cb(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ne=v.useMemo(()=>b.markerEnd?`url('#${cb(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||L===null||O===null||j===null||N===null)return null;const J=Z=>{var ge;const{addSelectedEdges:ce,unselectNodesAndEdges:Ie,multiSelectionActive:xe}=U.getState();R&&(U.setState({nodesSelectionActive:!1}),b.selected&&xe?(Ie({nodes:[],edges:[b]}),(ge=I.current)==null||ge.blur()):ce([e])),i&&i(Z,b)},re=s?Z=>{s(Z,{...b})}:void 0,de=a?Z=>{a(Z,{...b})}:void 0,G=o?Z=>{o(Z,{...b})}:void 0,W=l?Z=>{l(Z,{...b})}:void 0,ae=u?Z=>{u(Z,{...b})}:void 0,he=Z=>{var ce;if(!E&&VD.includes(Z.key)&&R){const{unselectNodesAndEdges:Ie,addSelectedEdges:xe}=U.getState();Z.key==="Escape"?((ce=I.current)==null||ce.blur(),Ie({edges:[b]})):xe([e])}};return c.jsx("svg",{style:{zIndex:A},children:c.jsxs("g",{className:_n(["react-flow__edge",`react-flow__edge-${k}`,b.className,w,{selected:b.selected,animated:b.animated,inactive:!R&&!i,updating:M,selectable:R}]),onClick:J,onDoubleClick:re,onContextMenu:de,onMouseEnter:G,onMouseMove:W,onMouseLeave:ae,onKeyDown:C?he:void 0,tabIndex:C?0:void 0,role:b.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":C?`${SP}-${m}`:void 0,ref:I,...b.domAttributes,children:[!Y&&c.jsx(T,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:R,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:L,sourceY:O,targetX:j,targetY:N,sourcePosition:H,targetPosition:V,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:D,markerEnd:ne,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),S&&c.jsx(Qce,{edge:b,isReconnectable:S,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:L,sourceY:O,targetX:j,targetY:N,sourcePosition:H,targetPosition:V,setUpdateHover:B,setReconnecting:P})]})})}var Jce=v.memo(Zce);const eue=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function JP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:E,onError:b}=pt(eue,Qt),_=Bce(t);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx(zce,{defaultColor:e,rfId:n}),_.map(k=>c.jsx(Jce,{id:k,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:E,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:y},k))]})}JP.displayName="EdgeRenderer";const tue=v.memo(JP),nue=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function rue({children:e}){const t=pt(nue);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function iue(e){const t=kw(),n=v.useRef(!1);v.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const sue=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function aue(e){const t=pt(sue),n=Zt();return v.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function oue(e){return e.connection.inProgress?{...e.connection,to:ic(e.connection.to,e.transform)}:{...e.connection}}function lue(e){return oue}function cue(e){const t=lue();return pt(t,Qt)}const uue=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function due({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:o,inProgress:l}=pt(uue,Qt);return!(s&&i&&l)?null:c.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:_n(["react-flow__connection",WD(o)]),children:c.jsx(e4,{style:t,type:n,CustomComponent:r,isValid:o})})})}const e4=({style:e,type:t=Ls.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:o,fromPosition:l,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=cue();if(!i)return;if(n)return c.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:h,connectionStatus:WD(r),toNode:d,toHandle:f,pointer:p});let m="";const y={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Ls.Bezier:[m]=sP(y);break;case Ls.SimpleBezier:[m]=$P(y);break;case Ls.Step:[m]=lb({...y,borderRadius:0});break;case Ls.SmoothStep:[m]=lb(y);break;default:[m]=oP(y)}return c.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};e4.displayName="ConnectionLine";const fue={};function WN(e=fue){v.useRef(e),Zt(),v.useEffect(()=>{},[e])}function hue(){Zt(),v.useRef(!1),v.useEffect(()=>{},[])}function t4({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:E,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:T,zoomActivationKeyCode:C,deleteKeyCode:S,onlyRenderVisibleElements:R,elementsSelectable:I,defaultViewport:M,translateExtent:B,minZoom:Y,maxZoom:P,preventScrolling:U,defaultMarkerColor:A,zoomOnScroll:L,zoomOnPinch:O,panOnScroll:j,panOnScrollSpeed:N,panOnScrollMode:H,zoomOnDoubleClick:V,panOnDrag:D,autoPanOnSelection:ne,onPaneClick:J,onPaneMouseEnter:re,onPaneMouseMove:de,onPaneMouseLeave:G,onPaneScroll:W,onPaneContextMenu:ae,paneClickDistance:he,nodeClickDistance:Z,onEdgeContextMenu:ce,onEdgeMouseEnter:Ie,onEdgeMouseMove:xe,onEdgeMouseLeave:ge,reconnectRadius:De,onReconnect:_e,onReconnectStart:He,onReconnectEnd:Oe,noDragClassName:oe,noWheelClassName:kt,noPanClassName:ve,disableKeyboardA11y:St,nodeExtent:dt,rfId:K,viewport:X,onViewportChange:le}){return WN(e),WN(t),hue(),iue(n),aue(X),c.jsx(Ace,{onPaneClick:J,onPaneMouseEnter:re,onPaneMouseMove:de,onPaneMouseLeave:G,onPaneContextMenu:ae,onPaneScroll:W,paneClickDistance:he,deleteKeyCode:S,selectionKeyCode:E,selectionOnDrag:b,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:k,panActivationKeyCode:T,zoomActivationKeyCode:C,elementsSelectable:I,zoomOnScroll:L,zoomOnPinch:O,zoomOnDoubleClick:V,panOnScroll:j,panOnScrollSpeed:N,panOnScrollMode:H,panOnDrag:D,autoPanOnSelection:ne,defaultViewport:M,translateExtent:B,minZoom:Y,maxZoom:P,onSelectionContextMenu:f,preventScrolling:U,noDragClassName:oe,noWheelClassName:kt,noPanClassName:ve,disableKeyboardA11y:St,onViewportChange:le,isControlledViewport:!!X,children:c.jsxs(rue,{children:[c.jsx(tue,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:_e,onReconnectStart:He,onReconnectEnd:Oe,onlyRenderVisibleElements:R,onEdgeContextMenu:ce,onEdgeMouseEnter:Ie,onEdgeMouseMove:xe,onEdgeMouseLeave:ge,reconnectRadius:De,defaultMarkerColor:A,noPanClassName:ve,disableKeyboardA11y:St,rfId:K}),c.jsx(due,{style:y,type:m,component:w,containerStyle:g}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(jce,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:R,noPanClassName:ve,noDragClassName:oe,disableKeyboardA11y:St,nodeExtent:dt,rfId:K}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}t4.displayName="GraphView";const pue=v.memo(t4),mue=ZD(),qN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:o,minZoom:l=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,y=new Map,w=new Map,g=r??t??[],E=n??e??[],b=d??[0,0],_=f??rd;uP(y,w,g);const{nodesInitialized:k}=ub(E,p,m,{nodeOrigin:b,nodeExtent:_,zIndexMode:h});let T=[0,0,1];if(a&&i&&s){const C=zd(p,{filter:M=>!!((M.width||M.initialWidth)&&(M.height||M.initialHeight))}),{x:S,y:R,zoom:I}=bw(C,i,s,l,u,(o==null?void 0:o.padding)??.1);T=[S,R,I]}return{rfId:"1",width:i??0,height:s??0,transform:T,nodes:E,nodesInitialized:k,nodeLookup:p,parentLookup:m,edges:g,edgeLookup:w,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:rd,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ol.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...YD},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:mue,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:KD,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},gue=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>Ole((p,m)=>{async function y(){const{nodeLookup:w,panZoom:g,fitViewOptions:E,fitViewResolver:b,width:_,height:k,minZoom:T,maxZoom:C}=m();g&&(await poe({nodes:w,width:_,height:k,panZoom:g,minZoom:T,maxZoom:C},E),b==null||b.resolve(!0),p({fitViewResolver:null}))}return{...qN({nodes:e,edges:t,width:i,height:s,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:w=>{const{nodeLookup:g,parentLookup:E,nodeOrigin:b,elevateNodesOnSelect:_,fitViewQueued:k,zIndexMode:T,nodesSelectionActive:C}=m(),{nodesInitialized:S,hasSelectedNodes:R}=ub(w,g,E,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:T}),I=C&&R;k&&S?(y(),p({nodes:w,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):p({nodes:w,nodesInitialized:S,nodesSelectionActive:I})},setEdges:w=>{const{connectionLookup:g,edgeLookup:E}=m();uP(g,E,w),p({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:E}=m();E(w),p({hasDefaultNodes:!0})}if(g){const{setEdges:E}=m();E(g),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:E,parentLookup:b,domNode:_,nodeOrigin:k,nodeExtent:T,debug:C,fitViewQueued:S,zIndexMode:R}=m(),{changes:I,updatedInternals:M}=joe(w,E,b,_,k,T,R);M&&(Loe(E,b,{nodeOrigin:k,nodeExtent:T,zIndexMode:R}),S?(y(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(I==null?void 0:I.length)>0&&(C&&console.log("React Flow: trigger node changes",I),g==null||g(I)))},updateNodePositions:(w,g=!1)=>{const E=[];let b=[];const{nodeLookup:_,triggerNodeChanges:k,connection:T,updateConnection:C,onNodesChangeMiddlewareMap:S}=m();for(const[R,I]of w){const M=_.get(R),B=!!(M!=null&&M.expandParent&&(M!=null&&M.parentId)&&(I!=null&&I.position)),Y={id:R,type:"position",position:B?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:g};if(M&&T.inProgress&&T.fromNode.id===M.id){const P=eo(M,T.fromHandle,Pe.Left,!0);C({...T,from:P})}B&&M.parentId&&E.push({id:R,parentId:M.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),b.push(Y)}if(E.length>0){const{parentLookup:R,nodeOrigin:I}=m(),M=Tw(E,_,R,I);b.push(...M)}for(const R of S.values())b=R(b);k(b)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:E,nodes:b,hasDefaultNodes:_,debug:k}=m();if(w!=null&&w.length){if(_){const T=CP(w,b);E(T)}k&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:E,edges:b,hasDefaultEdges:_,debug:k}=m();if(w!=null&&w.length){if(_){const T=IP(w,b);E(T)}k&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:E,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const T=w.map(C=>xa(C,!0));_(T);return}_(Qo(b,new Set([...w]),!0)),k(Qo(E))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:E,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const T=w.map(C=>xa(C,!0));k(T);return}k(Qo(E,new Set([...w]))),_(Qo(b,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:E,nodes:b,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:T}=m(),C=w||b,S=g||E,R=[];for(const M of C){if(!M.selected)continue;const B=_.get(M.id);B&&(B.selected=!1),R.push(xa(M.id,!1))}const I=[];for(const M of S)M.selected&&I.push(xa(M.id,!1));k(R),T(I)},setMinZoom:w=>{const{panZoom:g,maxZoom:E}=m();g==null||g.setScaleExtent([w,E]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:E}=m();g==null||g.setScaleExtent([E,w]),p({maxZoom:w})},setTranslateExtent:w=>{var g;(g=m().panZoom)==null||g.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:E,triggerEdgeChanges:b,elementsSelectable:_}=m();if(!_)return;const k=g.reduce((C,S)=>S.selected?[...C,xa(S.id,!1)]:C,[]),T=w.reduce((C,S)=>S.selected?[...C,xa(S.id,!1)]:C,[]);E(k),b(T)},setNodeExtent:w=>{const{nodes:g,nodeLookup:E,parentLookup:b,nodeOrigin:_,elevateNodesOnSelect:k,nodeExtent:T,zIndexMode:C}=m();w[0][0]===T[0][0]&&w[0][1]===T[0][1]&&w[1][0]===T[1][0]&&w[1][1]===T[1][1]||(ub(g,E,b,{nodeOrigin:_,nodeExtent:w,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:C}),p({nodeExtent:w}))},panBy:w=>{const{transform:g,width:E,height:b,panZoom:_,translateExtent:k}=m();return Boe({delta:w,panZoom:_,transform:g,translateExtent:k,width:E,height:b})},setCenter:async(w,g,E)=>{const{width:b,height:_,maxZoom:k,panZoom:T}=m();if(!T)return!1;const C=typeof(E==null?void 0:E.zoom)<"u"?E.zoom:k;return await T.setViewport({x:b/2-w*C,y:_/2-g*C,zoom:C},{duration:E==null?void 0:E.duration,ease:E==null?void 0:E.ease,interpolate:E==null?void 0:E.interpolate}),!0},cancelConnection:()=>{p({connection:{...YD}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...qN()})}},Object.is);function n4({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:l,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=v.useState(()=>gue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:l,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return c.jsx(Lle,{value:m,children:c.jsx(rce,{children:p})})}function yue({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return v.useContext(rg)?c.jsx(c.Fragment,{children:e}):c.jsx(n4,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:o,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const bue={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Eue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:o,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:y,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:E,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:T,onNodeDragStart:C,onNodeDrag:S,onNodeDragStop:R,onNodesDelete:I,onEdgesDelete:M,onDelete:B,onSelectionChange:Y,onSelectionDragStart:P,onSelectionDrag:U,onSelectionDragStop:A,onSelectionContextMenu:L,onSelectionStart:O,onSelectionEnd:j,onBeforeDelete:N,connectionMode:H,connectionLineType:V=Ls.Bezier,connectionLineStyle:D,connectionLineComponent:ne,connectionLineContainerStyle:J,deleteKeyCode:re="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:G=!1,selectionMode:W=id.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:he=od()?"Meta":"Control",zoomActivationKeyCode:Z=od()?"Meta":"Control",snapToGrid:ce,snapGrid:Ie,onlyRenderVisibleElements:xe=!1,selectNodesOnDrag:ge,nodesDraggable:De,autoPanOnNodeFocus:_e,nodesConnectable:He,nodesFocusable:Oe,nodeOrigin:oe=NP,edgesFocusable:kt,edgesReconnectable:ve,elementsSelectable:St=!0,defaultViewport:dt=Yle,minZoom:K=.5,maxZoom:X=2,translateExtent:le=rd,preventScrolling:Se=!0,nodeExtent:Le,defaultMarkerColor:ft="#b1b1b7",zoomOnScroll:qe=!0,zoomOnPinch:ct=!0,panOnScroll:Jt=!1,panOnScrollSpeed:Ot=.5,panOnScrollMode:Xe=Ba.Free,zoomOnDoubleClick:xt=!0,panOnDrag:Vt=!0,onPaneClick:An,onPaneMouseEnter:$e,onPaneMouseMove:st,onPaneMouseLeave:rt,onPaneScroll:bt,onPaneContextMenu:ue,paneClickDistance:Me=1,nodeClickDistance:Ze=0,children:un,onReconnect:dn,onReconnectStart:se,onReconnectEnd:Te,onEdgeContextMenu:ye,onEdgeDoubleClick:je,onEdgeMouseEnter:ze,onEdgeMouseMove:Ge,onEdgeMouseLeave:Et,reconnectRadius:Lt=10,onNodesChange:Mt,onEdgesChange:bn,noDragClassName:En="nodrag",noWheelClassName:Kt="nowheel",noPanClassName:Cn="nopan",fitView:rr,fitViewOptions:Sr,connectOnClick:Fn,attributionPosition:Yn,proOptions:ir,defaultEdgeOptions:Nr,elevateNodesOnSelect:Yt=!0,elevateEdgesOnSelect:In=!1,disableKeyboardA11y:Un=!1,autoPanOnConnect:sr,autoPanOnNodeDrag:Wn,autoPanOnSelection:Rn=!0,autoPanSpeed:at,connectionRadius:On,isValidConnection:Ut,onError:en,style:Ln,id:$n,nodeDragThreshold:Tn,connectionDragThreshold:te,viewport:Ne,onViewportChange:Re,width:Be,height:wt,colorMode:mt="light",debug:tn,onScroll:vt,ariaLabelConfig:Mn,zIndexMode:Nt="basic",...og},Ar){const aa=$n||"1",sc=Xle(mt),ac=v.useCallback(Yd=>{Yd.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt==null||vt(Yd)},[vt]);return c.jsx("div",{"data-testid":"rf__wrapper",...og,onScroll:ac,style:{...Ln,...bue},ref:Ar,className:_n(["react-flow",i,sc]),id:$n,role:"application",children:c.jsxs(yue,{nodes:e,edges:t,width:Be,height:wt,fitView:rr,fitViewOptions:Sr,minZoom:K,maxZoom:X,nodeOrigin:oe,nodeExtent:Le,zIndexMode:Nt,children:[c.jsx(Gle,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:y,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:De,autoPanOnNodeFocus:_e,nodesConnectable:He,nodesFocusable:Oe,edgesFocusable:kt,edgesReconnectable:ve,elementsSelectable:St,elevateNodesOnSelect:Yt,elevateEdgesOnSelect:In,minZoom:K,maxZoom:X,nodeExtent:Le,onNodesChange:Mt,onEdgesChange:bn,snapToGrid:ce,snapGrid:Ie,connectionMode:H,translateExtent:le,connectOnClick:Fn,defaultEdgeOptions:Nr,fitView:rr,fitViewOptions:Sr,onNodesDelete:I,onEdgesDelete:M,onDelete:B,onNodeDragStart:C,onNodeDrag:S,onNodeDragStop:R,onSelectionDrag:U,onSelectionDragStart:P,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Cn,nodeOrigin:oe,rfId:aa,autoPanOnConnect:sr,autoPanOnNodeDrag:Wn,autoPanSpeed:at,onError:en,connectionRadius:On,isValidConnection:Ut,selectNodesOnDrag:ge,nodeDragThreshold:Tn,connectionDragThreshold:te,onBeforeDelete:N,debug:tn,ariaLabelConfig:Mn,zIndexMode:Nt}),c.jsx(pue,{onInit:u,onNodeClick:o,onEdgeClick:l,onNodeMouseEnter:E,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:T,nodeTypes:s,edgeTypes:a,connectionLineType:V,connectionLineStyle:D,connectionLineComponent:ne,connectionLineContainerStyle:J,selectionKeyCode:de,selectionOnDrag:G,selectionMode:W,deleteKeyCode:re,multiSelectionKeyCode:he,panActivationKeyCode:ae,zoomActivationKeyCode:Z,onlyRenderVisibleElements:xe,defaultViewport:dt,translateExtent:le,minZoom:K,maxZoom:X,preventScrolling:Se,zoomOnScroll:qe,zoomOnPinch:ct,zoomOnDoubleClick:xt,panOnScroll:Jt,panOnScrollSpeed:Ot,panOnScrollMode:Xe,panOnDrag:Vt,autoPanOnSelection:Rn,onPaneClick:An,onPaneMouseEnter:$e,onPaneMouseMove:st,onPaneMouseLeave:rt,onPaneScroll:bt,onPaneContextMenu:ue,paneClickDistance:Me,nodeClickDistance:Ze,onSelectionContextMenu:L,onSelectionStart:O,onSelectionEnd:j,onReconnect:dn,onReconnectStart:se,onReconnectEnd:Te,onEdgeContextMenu:ye,onEdgeDoubleClick:je,onEdgeMouseEnter:ze,onEdgeMouseMove:Ge,onEdgeMouseLeave:Et,reconnectRadius:Lt,defaultMarkerColor:ft,noDragClassName:En,noWheelClassName:Kt,noPanClassName:Cn,rfId:aa,disableKeyboardA11y:Un,nodeExtent:Le,viewport:Ne,onViewportChange:Re}),c.jsx(Kle,{onSelectionChange:Y}),un,c.jsx(Ule,{proOptions:ir,position:Yn}),c.jsx(Fle,{rfId:aa,disableKeyboardA11y:Un})]})})}var xue=OP(Eue);function wue(e){const[t,n]=v.useState(e),r=v.useCallback(i=>n(s=>CP(i,s)),[]);return[t,n,r]}function vue(e){const[t,n]=v.useState(e),r=v.useCallback(i=>n(s=>IP(i,s)),[]);return[t,n,r]}function _ue({dimensions:e,lineWidth:t,variant:n,className:r}){return c.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:_n(["react-flow__background-pattern",n,r])})}function Tue({radius:e,className:t}){return c.jsx("circle",{cx:e,cy:e,r:e,className:_n(["react-flow__background-pattern","dots",t])})}var Gs;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Gs||(Gs={}));const kue={[Gs.Dots]:1,[Gs.Lines]:1,[Gs.Cross]:6},Sue=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function r4({id:e,variant:t=Gs.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:o,style:l,className:u,patternClassName:d}){const f=v.useRef(null),{transform:h,patternId:p}=pt(Sue,Qt),m=r||kue[t],y=t===Gs.Dots,w=t===Gs.Cross,g=Array.isArray(n)?n:[n,n],E=[g[0]*h[2]||1,g[1]*h[2]||1],b=m*h[2],_=Array.isArray(s)?s:[s,s],k=w?[b,b]:E,T=[_[0]*h[2]||1+k[0]/2,_[1]*h[2]||1+k[1]/2],C=`${p}${e||""}`;return c.jsxs("svg",{className:_n(["react-flow__background",u]),style:{...l,...sg,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[c.jsx("pattern",{id:C,x:h[0]%E[0],y:h[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:y?c.jsx(Tue,{radius:b/2,className:d}):c.jsx(_ue,{dimensions:k,lineWidth:i,variant:t,className:d})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}r4.displayName="Background";const Nue=v.memo(r4);function Aue(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Cue(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Iue(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Rue(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Oue(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function eh({children:e,className:t,...n}){return c.jsx("button",{type:"button",className:_n(["react-flow__controls-button",t]),...n,children:e})}const Lue=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function i4({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:o,onInteractiveChange:l,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=Zt(),{isInteractive:y,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:E}=pt(Lue,Qt),{zoomIn:b,zoomOut:_,fitView:k}=kw(),T=()=>{b(),s==null||s()},C=()=>{_(),a==null||a()},S=()=>{k(i),o==null||o()},R=()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),l==null||l(!y)},I=h==="horizontal"?"horizontal":"vertical";return c.jsxs(ig,{className:_n(["react-flow__controls",I,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??E["controls.ariaLabel"],children:[t&&c.jsxs(c.Fragment,{children:[c.jsx(eh,{onClick:T,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:g,children:c.jsx(Aue,{})}),c.jsx(eh,{onClick:C,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:w,children:c.jsx(Cue,{})})]}),n&&c.jsx(eh,{className:"react-flow__controls-fitview",onClick:S,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:c.jsx(Iue,{})}),r&&c.jsx(eh,{className:"react-flow__controls-interactive",onClick:R,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:y?c.jsx(Oue,{}):c.jsx(Rue,{})}),d]})}i4.displayName="Controls";const Mue=v.memo(i4);function Due({id:e,x:t,y:n,width:r,height:i,style:s,color:a,strokeColor:o,strokeWidth:l,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:y}=s||{},w=a||m||y;return c.jsx("rect",{className:_n(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:w,stroke:o,strokeWidth:l},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const Pue=v.memo(Due),jue=e=>e.nodes.map(t=>t.id),G0=e=>e instanceof Function?e:()=>e;function Bue({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=Pue,onClick:a}){const o=pt(jue,Qt),l=G0(t),u=G0(e),d=G0(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:o.map(h=>c.jsx(Uue,{id:h,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function Fue({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:o,onClick:l}){const{node:u,x:d,y:f,width:h,height:p}=pt(m=>{const y=m.nodeLookup.get(e);if(!y)return{node:void 0,x:0,y:0,width:0,height:0};const w=y.internals.userNode,{x:g,y:E}=y.internals.positionAbsolute,{width:b,height:_}=ys(w);return{node:w,x:g,y:E,width:b,height:_}},Qt);return!u||u.hidden||!JD(u)?null:c.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:a,onClick:l,id:u.id})}const Uue=v.memo(Fue);var $ue=v.memo(Bue);const Hue=200,zue=150,Vue=e=>!e.hidden,Kue=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?QD(zd(e.nodeLookup,{filter:Vue}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Yue="react-flow__minimap-desc";function s4({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:l,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:y=!1,zoomable:w=!1,ariaLabel:g,inversePan:E,zoomStep:b=1,offsetScale:_=5}){const k=Zt(),T=v.useRef(null),{boundingRect:C,viewBB:S,rfId:R,panZoom:I,translateExtent:M,flowWidth:B,flowHeight:Y,ariaLabelConfig:P}=pt(Kue,Qt),U=(e==null?void 0:e.width)??Hue,A=(e==null?void 0:e.height)??zue,L=C.width/U,O=C.height/A,j=Math.max(L,O),N=j*U,H=j*A,V=_*j,D=C.x-(N-C.width)/2-V,ne=C.y-(H-C.height)/2-V,J=N+V*2,re=H+V*2,de=`${Yue}-${R}`,G=v.useRef(0),W=v.useRef();G.current=j,v.useEffect(()=>{if(T.current&&I)return W.current=Woe({domNode:T.current,panZoom:I,getTransform:()=>k.getState().transform,getViewScale:()=>G.current}),()=>{var ce;(ce=W.current)==null||ce.destroy()}},[I]),v.useEffect(()=>{var ce;(ce=W.current)==null||ce.update({translateExtent:M,width:B,height:Y,inversePan:E,pannable:y,zoomStep:b,zoomable:w})},[y,w,E,b,M,B,Y]);const ae=p?ce=>{var ge;const[Ie,xe]=((ge=W.current)==null?void 0:ge.pointer(ce))||[0,0];p(ce,{x:Ie,y:xe})}:void 0,he=m?v.useCallback((ce,Ie)=>{const xe=k.getState().nodeLookup.get(Ie).internals.userNode;m(ce,xe)},[]):void 0,Z=g??P["minimap.ariaLabel"];return c.jsx(ig,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*j:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:_n(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:U,height:A,viewBox:`${D} ${ne} ${J} ${re}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:T,onClick:ae,children:[Z&&c.jsx("title",{id:de,children:Z}),c.jsx($ue,{onClick:he,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:o}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${D-V},${ne-V}h${J+V*2}v${re+V*2}h${-J-V*2}z - M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}s4.displayName="MiniMap";const Wue=v.memo(s4),que=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Gue={[Pl.Line]:"right",[Pl.Handle]:"bottom-right"};function Xue({nodeId:e,position:t,variant:n=Pl.Handle,className:r,style:i=void 0,children:s,color:a,minWidth:o=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:y,onResize:w,onResizeEnd:g}){const E=PP(),b=typeof e=="string"?e:E,_=Zt(),k=v.useRef(null),T=n===Pl.Handle,C=pt(v.useCallback(que(T&&p),[T,p]),Qt),S=v.useRef(null),R=t??Gue[n];v.useEffect(()=>{if(!(!k.current||!b))return S.current||(S.current=ale({domNode:k.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:M,transform:B,snapGrid:Y,snapToGrid:P,nodeOrigin:U,domNode:A}=_.getState();return{nodeLookup:M,transform:B,snapGrid:Y,snapToGrid:P,nodeOrigin:U,paneDomNode:A}},onChange:(M,B)=>{const{triggerNodeChanges:Y,nodeLookup:P,parentLookup:U,nodeOrigin:A}=_.getState(),L=[],O={x:M.x,y:M.y},j=P.get(b);if(j&&j.expandParent&&j.parentId){const N=j.origin??A,H=M.width??j.measured.width??0,V=M.height??j.measured.height??0,D={id:j.id,parentId:j.parentId,rect:{width:H,height:V,...eP({x:M.x??j.position.x,y:M.y??j.position.y},{width:H,height:V},j.parentId,P,N)}},ne=Tw([D],P,U,A);L.push(...ne),O.x=M.x?Math.max(N[0]*H,M.x):void 0,O.y=M.y?Math.max(N[1]*V,M.y):void 0}if(O.x!==void 0&&O.y!==void 0){const N={id:b,type:"position",position:{...O}};L.push(N)}if(M.width!==void 0&&M.height!==void 0){const H={id:b,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};L.push(H)}for(const N of B){const H={...N,type:"position"};L.push(H)}Y(L)},onEnd:({width:M,height:B})=>{const Y={id:b,type:"dimensions",resizing:!1,dimensions:{width:M,height:B}};_.getState().triggerNodeChanges([Y])}})),S.current.update({controlPosition:R,boundaries:{minWidth:o,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:y,onResize:w,onResizeEnd:g,shouldResize:m}),()=>{var M;(M=S.current)==null||M.destroy()}},[R,o,l,u,d,f,y,w,g,m]);const I=R.split("-");return c.jsx("div",{className:_n(["react-flow__resize-control","nodrag",...I,n,r]),ref:k,style:{...i,scale:C,...a&&{[T?"backgroundColor":"borderColor"]:a}},children:s})}v.memo(Xue);const Que=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:gU},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:G9},{type:"loop",label:"循环",desc:"节点循环执行",Icon:WE}];let hb=0;function X0(){return hb+=1,`node_${hb}`}function Q0(e,t,n){const r=ea();return{id:e,type:"agentNode",position:t,data:{agent:{...r,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function Zue({data:e,selected:t}){const n=e.agent;return c.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[c.jsx(Bl,{type:"target",position:Pe.Left,className:"wfb-handle"}),c.jsx("div",{className:"wfb-node-icon",children:c.jsx(Ka,{className:"icon"})}),c.jsxs("div",{className:"wfb-node-body",children:[c.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),c.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),c.jsx(Bl,{type:"source",position:Pe.Right,className:"wfb-handle"})]})}const Jue={agentNode:Zue},GN={type:"smoothstep",markerEnd:{type:sd.ArrowClosed,width:16,height:16}};function ede({onBack:e,onCreate:t}){const n=v.useRef(null),[r,i]=v.useState(""),[s,a]=v.useState(""),[o,l]=v.useState("sequential"),u=v.useMemo(()=>{hb=0;const A=X0();return Q0(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=wue([u]),[p,m,y]=vue([]),[w,g]=v.useState(u.id),E=d.find(A=>A.id===w)??null,b=r.trim()||"workflow_agent",_=v.useMemo(()=>rD({name:b,subAgents:d.map(A=>A.data.agent)}),[b,d]),k=cl(b)??(_.has(b)?"名称须与 Agent 节点名称保持唯一":null),T=E?cl(E.data.agent.name)??(_.has(E.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,C=d.length>0&&k===null&&d.every(A=>cl(A.data.agent.name)===null&&!_.has(A.data.agent.name)),S=v.useCallback(A=>m(L=>RP({...A,...GN},L)),[m]),R=v.useCallback(()=>{const A=X0(),L=d.length*28,O=Q0(A,{x:80+L,y:120+L});f(j=>j.concat(O)),g(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},M=v.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),B=v.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const O=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),j=X0(),N=Q0(j,O);f(H=>H.concat(N)),g(j)},[f]),Y=v.useCallback(A=>{w&&f(L=>L.map(O=>O.id===w?{...O,data:{...O.data,agent:{...O.data.agent,...A}}}:O))},[w,f]),P=v.useCallback(()=>{w&&(f(A=>A.filter(L=>L.id!==w)),m(A=>A.filter(L=>L.source!==w&&L.target!==w)),g(null))},[w,f,m]),U=v.useCallback(()=>{if(!C)return;const A=d.map(O=>O.data.agent),L={...ea(),name:b,description:s.trim(),instruction:s.trim(),subAgents:A,workflow:{type:o,nodes:d.map(O=>({id:O.id,agent:O.data.agent})),edges:p.map(O=>({from:O.source,to:O.target}))}};t(L)},[C,d,p,b,s,o,t]);return c.jsx("div",{className:"wfb",children:c.jsxs("div",{className:"wfb-grid",children:[c.jsxs("aside",{className:"wfb-palette",children:[c.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"名称"}),c.jsx("input",{className:`wfb-input ${k?"wfb-input--error":""}`,value:r,onChange:A=>i(A.target.value),placeholder:"my_workflow"}),k&&c.jsx("span",{className:"wfb-field-error",children:k})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"描述"}),c.jsx("textarea",{className:"wfb-input wfb-textarea",value:s,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),c.jsx("div",{className:"wfb-section-label",children:"执行方式"}),c.jsx("div",{className:"wfb-types",children:Que.map(({type:A,label:L,desc:O,Icon:j})=>c.jsxs("button",{type:"button",className:`wfb-type ${o===A?"wfb-type--active":""}`,onClick:()=>l(A),children:[c.jsx(j,{className:"icon"}),c.jsxs("span",{className:"wfb-type-text",children:[c.jsx("span",{className:"wfb-type-name",children:L}),c.jsx("span",{className:"wfb-type-desc",children:O})]})]},A))}),c.jsx("div",{className:"wfb-section-label",children:"节点"}),c.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[c.jsx(dU,{className:"icon wfb-grip"}),c.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:c.jsx(Ka,{className:"icon"})}),c.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),c.jsxs("button",{className:"wfb-add",type:"button",onClick:R,children:[c.jsx(Ei,{className:"icon"}),"添加节点"]}),c.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),c.jsxs("div",{className:"wfb-canvas",children:[c.jsxs("button",{className:"wfb-create",onClick:U,disabled:!C,type:"button",children:[c.jsx(Ya,{className:"icon"}),"创建工作流"]}),c.jsxs(xue,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:y,onConnect:S,onInit:A=>n.current=A,nodeTypes:Jue,defaultEdgeOptions:GN,onDrop:B,onDragOver:M,onNodeClick:(A,L)=>g(L.id),onPaneClick:()=>g(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[c.jsx(Nue,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),c.jsx(Mue,{showInteractive:!1}),c.jsx(Wue,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),c.jsx("aside",{className:"wfb-inspector",children:E?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"wfb-inspector-head",children:[c.jsx("div",{className:"wfb-section-label",children:"节点配置"}),c.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:P,title:"删除节点",children:c.jsx(Vl,{className:"icon"})})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"名称"}),c.jsx("input",{className:`wfb-input ${T?"wfb-input--error":""}`,value:E.data.agent.name,onChange:A=>Y({name:A.target.value}),placeholder:"agent_name"}),T?c.jsx("span",{className:"wfb-field-error",children:T}):c.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"描述"}),c.jsx("input",{className:"wfb-input",value:E.data.agent.description,onChange:A=>Y({description:A.target.value}),placeholder:"这个 agent 做什么…"})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),c.jsx("textarea",{className:"wfb-input wfb-textarea",value:E.data.agent.instruction,onChange:A=>Y({instruction:A.target.value}),placeholder:"你是一个…",rows:6})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),c.jsx("input",{className:"wfb-input",value:E.data.agent.tools.join(", "),onChange:A=>Y({tools:A.target.value.split(",").map(L=>L.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),c.jsxs("div",{className:"wfb-inspector-meta",children:[c.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),c.jsx("code",{className:"wfb-meta-val",children:E.id})]})]}):c.jsxs("div",{className:"wfb-inspector-empty",children:[c.jsx(Ka,{className:"wfb-empty-icon"}),c.jsx("p",{children:"选择一个节点以编辑其配置"}),c.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function tde(e){return c.jsx(n4,{children:c.jsx(ede,{...e})})}const nde="/web/skill-creator";class Nw extends Error{constructor(n,r){super(n);Pw(this,"status");this.name="SkillCreatorApiError",this.status=r}}function fo(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function qt(e,...t){for(const n of t){const r=e[n];if(typeof r=="string"&&r)return r}}function a4(e,...t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}async function Kd(e,t){return fetch(Bi(`${nde}${e}`),{...t,headers:_m({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function Aw(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const i=fo(await e.json(),"错误响应");return qt(i,"detail","message","error")??t}return(await e.text()).trim()||t}async function Cw(e,t){if(!e.ok)throw new Nw(await Aw(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function rde(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function ide(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function sde(e){return Array.isArray(e)?e.map((t,n)=>{const r=fo(t,`文件 ${n+1}`),i=qt(r,"path");if(!i)throw new Error(`文件 ${n+1} 缺少 path`);const s=a4(r,"size");if(s===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:i,size:s}}):[]}function ade(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],r=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:r}}function ode(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const r=fo(t,`活动 ${n+1}`),i=qt(r,"id"),s=qt(r,"kind"),a=qt(r,"status");if(!i||!s||!["status","thinking","tool","message"].includes(s))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(s==="tool"){const l=qt(r,"name");if(!l)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:i,kind:s,name:l,args:r.input,response:r.output,status:a}}const o=qt(r,"text");if(!o)throw new Error(`活动 ${n+1} 缺少文本`);return{id:i,kind:s,text:o,status:a}})}function lde(e,t){const n=fo(e,`候选方案 ${t+1}`),r=qt(n,"id","candidate_id","candidateId"),i=qt(n,"model","model_id","modelId");if(!r||!i)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:r,model:i,modelLabel:qt(n,"modelLabel","model_label")??i,status:rde(n.status),stage:ide(n.stage),name:qt(n,"name","skill_name","skillName"),description:qt(n,"description"),skillMd:qt(n,"skillMd","skill_md"),files:sde(n.files),activities:ode(n.activities),validation:ade(n.validation),durationMs:a4(n,"elapsedMs","elapsed_ms"),error:qt(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:qt(n,"skill_id","skillId"),version:qt(n,"version")}}function pb(e,t=""){const n=fo(e,"Skill 创建任务"),r=qt(n,"id","job_id","jobId");if(!r)throw new Error("Skill 创建任务缺少 id");const i=Array.isArray(n.candidates)?n.candidates.map(lde):[],s=qt(n,"status")??"running";if(s!=="provisioning"&&s!=="running"&&s!=="completed")throw new Error(`未知的 Skill 任务状态:${s}`);return{id:r,prompt:qt(n,"prompt")??t,status:s,candidates:i}}async function cde(e,t){const n=await Kd("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new Nw(await Aw(n,"创建 Skill 任务失败"),n.status);const r=n.headers.get("content-type")??"";if(r.includes("application/json")){const u=pb(await n.json(),e);return t==null||t(u),u}if(!r.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const i=n.body.getReader(),s=new TextDecoder;let a="",o;const l=u=>{if(!u.trim())return;const d=fo(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(qt(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");o=pb(d.job,e),t==null||t(o)};for(;;){const{done:u,value:d}=await i.read();a+=s.decode(d,{stream:!u});const f=a.split(` -`);if(a=f.pop()??"",f.forEach(l),u)break}if(l(a),!o)throw new Error("创建 Skill 任务失败:服务端未返回任务");return o}async function ude(e){const t=await Kd(`/jobs/${encodeURIComponent(e)}`);return pb(await Cw(t,"读取 Skill 任务失败"))}async function dde(e){const t=await Kd(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await Cw(t,"清理 Skill 任务失败")}async function fde(e,t){var o;const n=await Kd(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await Aw(n,"下载 Skill 失败"));const i=((o=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:o[1])??"skill.zip",s=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=s,a.download=i,a.click(),URL.revokeObjectURL(s)}async function hde(e,t,n){const r=await Kd(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),i=fo(await Cw(r,"添加到 AgentKit 失败"),"发布结果"),s=qt(i,"skill_id","skillId","id");if(!s)throw new Error("发布结果缺少 skill_id");return{skillId:s,name:qt(i,"name"),version:qt(i,"version"),skillSpaceIds:Array.isArray(i.skillSpaceIds)?i.skillSpaceIds.map(String):Array.isArray(i.skill_space_ids)?i.skill_space_ids.map(String):[],message:qt(i,"message")}}const pde=()=>{};function mde(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function gde({activities:e}){const t=v.useMemo(()=>e.filter(n=>n.kind!=="status").map(mde),[e]);return t.length===0?null:c.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:c.jsx(Hx,{blocks:t,onAction:pde})})}const XN={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},QN=12e4;function yde({status:e}){return e==="succeeded"?c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"7"}),c.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"7"}),c.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):c.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"7"}),c.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function bde(){return c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),c.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function Ede(){return c.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function xde({candidate:e}){var l,u;const[t,n]=v.useState("SKILL.md"),r=e.files.find(d=>d.path.endsWith("SKILL.md")),i=e.skillMd&&!r?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,s=i.find(d=>d.path===t)??i[0],a=(l=e.skillMd)==null?void 0:l.slice(0,QN),o=(((u=e.skillMd)==null?void 0:u.length)??0)>QN;return i.length===0?null:c.jsxs("div",{className:"skill-files",children:[c.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:i.map(d=>c.jsx("button",{type:"button",role:"tab","aria-selected":(s==null?void 0:s.path)===d.path,className:(s==null?void 0:s.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(s!=null&&s.path.endsWith("SKILL.md"))?c.jsxs(c.Fragment,{children:[c.jsx("pre",{className:"skill-files__content",children:c.jsx("code",{children:a})}),o?c.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):c.jsx("div",{className:"skill-files__unavailable",children:s?`${s.path} · ${s.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function wde({label:e,jobId:t,candidate:n,selected:r,publishing:i,publishDisabled:s,publishError:a,onSelect:o,onPublish:l}){const[u,d]=v.useState("conversation"),[f,h]=v.useState(!1),[p,m]=v.useState(!1),[y,w]=v.useState(""),[g,E]=v.useState(""),[b,_]=v.useState(""),[k,T]=v.useState(""),C=v.useRef(null),S=v.useRef(null),R=n.status==="queued"||n.status==="running",I=n.status==="succeeded",M=n.validation;return c.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${r?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[c.jsxs("header",{className:"skill-candidate__header",children:[c.jsx("h2",{children:n.model}),r?c.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?c.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[c.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[c.jsx("span",{className:"skill-candidate__status-icon",children:c.jsx(yde,{status:n.status})}),R?c.jsx(Zl,{duration:2.2,spread:16,children:XN[n.stage]}):c.jsx("span",{children:XN[n.stage]}),n.durationMs!==void 0&&I?c.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),c.jsx(gde,{activities:n.activities}),n.error?c.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?c.jsx("div",{className:"skill-candidate__view-actions",children:c.jsxs("button",{ref:C,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var B;return(B=S.current)==null?void 0:B.focus()})},children:[c.jsx(bde,{}),"查看 Skill"]})}):null]}):c.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[c.jsx("div",{className:"skill-candidate__preview-nav",children:c.jsxs("button",{ref:S,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var B;return(B=C.current)==null?void 0:B.focus()})},children:[c.jsx(Ede,{}),"返回对话"]})}),c.jsxs("div",{className:"skill-candidate__result",children:[c.jsxs("div",{className:"skill-candidate__summary",children:[c.jsxs("div",{children:[c.jsx("span",{children:"Skill"}),c.jsx("strong",{children:n.name??"未命名 Skill"})]}),c.jsxs("div",{children:[c.jsx("span",{children:"文件"}),c.jsx("strong",{children:n.files.length})]}),c.jsxs("div",{children:[c.jsx("span",{children:"校验"}),c.jsx("strong",{className:(M==null?void 0:M.valid)===!1?"is-invalid":"is-valid",children:(M==null?void 0:M.valid)===!1?"未通过":"已通过"})]})]}),n.description?c.jsx("p",{className:"skill-candidate__description",children:n.description}):null,M&&(M.errors.length>0||M.warnings.length>0)?c.jsxs("details",{className:"skill-validation",children:[c.jsx("summary",{children:"查看校验详情"}),[...M.errors,...M.warnings].map((B,Y)=>c.jsx("div",{children:B},`${B}-${Y}`))]}):null,c.jsx(xde,{candidate:n}),c.jsxs("div",{className:"skill-candidate__actions",children:[c.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":r,onClick:o,children:r?"已采用此方案":"采用此方案"}),c.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),w(""),fde(t,n.id).catch(B=>{w(B instanceof Error?B.message:String(B))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),c.jsx("button",{type:"button",className:"skill-action",disabled:!r||i||s||n.published,title:r?void 0:"请先采用此方案",onClick:()=>h(B=>!B),children:n.published?"已添加到 AgentKit":i?"正在添加…":"添加到 AgentKit"})]}),y?c.jsx("div",{className:"skill-candidate__error",children:y}):null,f&&r&&!n.published?c.jsxs("form",{className:"skill-publish-form",onSubmit:B=>{B.preventDefault();const Y=g.split(",").map(P=>P.trim()).filter(Boolean);l({skillSpaceIds:Y,...b.trim()?{projectName:b.trim()}:{},...k.trim()?{skillId:k.trim()}:{}})},children:[c.jsxs("label",{children:[c.jsx("span",{children:"SkillSpace ID(可选)"}),c.jsx("input",{value:g,onChange:B=>E(B.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),c.jsxs("div",{className:"skill-publish-form__optional",children:[c.jsxs("label",{children:[c.jsx("span",{children:"项目名称(可选)"}),c.jsx("input",{value:b,onChange:B=>_(B.target.value)})]}),c.jsxs("label",{children:[c.jsx("span",{children:"已有 Skill ID(可选)"}),c.jsx("input",{value:k,onChange:B=>T(B.target.value)})]})]}),c.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:i,children:i?"正在添加…":"确认添加"})]}):null,a?c.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const ZN=new Set(["completed"]),th=1100,vde=3e4;function _de(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function Tde({initialJob:e}){const[t,n]=v.useState(e),[r,i]=v.useState(""),[s,a]=v.useState(!1),[o,l]=v.useState(),[u,d]=v.useState(),[f,h]=v.useState(()=>new Set),[p,m]=v.useState({});v.useEffect(()=>{n(e),i(""),a(!1)},[e]),v.useEffect(()=>{if(ZN.has(e.status)||e.id.startsWith("pending-"))return;let g=!1,E;const b=Date.now()+vde,_=async()=>{try{const k=await ude(e.id);g||(n({...k,prompt:k.prompt||e.prompt}),i(""),ZN.has(k.status)||(E=window.setTimeout(_,th)))}catch(k){if(!g){const T=k instanceof Nw?k:void 0;if((T==null?void 0:T.status)===404&&Date.now(){g=!0,E!==void 0&&window.clearTimeout(E)}},[e.id,e.status]);const y=zx.map((g,E)=>t.candidates.find(b=>b.model===g)??t.candidates[E]??_de(g,E));async function w(g,E){d(g.id),m(b=>({...b,[g.id]:""}));try{await hde(t.id,g.id,E),h(b=>new Set(b).add(g.id))}catch(b){m(_=>({..._,[g.id]:b instanceof Error?b.message:String(b)}))}finally{d(void 0)}}return c.jsxs("section",{className:"skill-workspace",children:[c.jsx("header",{className:"skill-workspace__intro",children:c.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),r?c.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",r,"。",s?"":"页面会继续重试。"]}):null,c.jsx("div",{className:"skill-workspace__grid",children:y.map((g,E)=>{const _=f.has(g.id)||g.published?{...g,published:!0}:g;return c.jsx(wde,{label:`方案 ${E===0?"A":"B"}`,jobId:t.id,candidate:_,selected:o===g.id,publishing:u===g.id,publishDisabled:u!==void 0&&u!==g.id,publishError:p[g.id],onSelect:()=>l(g.id),onPublish:k=>void w(g,k)},`${g.model}-${g.id}`)})})]})}const Z0="/web/sandbox/sessions",kde=33e4,Sde=6e5,Nde=15e3;function J0(e){const t=_m(e);return t.set("Accept","application/json"),t}async function ey(e,t){let n={};try{n=await e.json()}catch{return new Error(`${t}(HTTP ${e.status})`)}const r=n.detail,i=r&&typeof r=="object"&&"message"in r?r.message:r??n.message;return new Error(typeof i=="string"&&i?i:t)}async function Ade(e,t){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let i="",s="";const a=[],o=new Map;function l(){t==null||t(a.map(h=>({...h})))}function u(h){s+=h;const p=a[a.length-1];(p==null?void 0:p.kind)==="text"?p.text+=h:a.push({kind:"text",text:h}),l()}function d(h){if(typeof h.id!="string"||h.kind!=="thinking"&&h.kind!=="tool"||h.status!=="running"&&h.status!=="done")return;const p=h.status==="done";let m;if(h.kind==="thinking"){if(typeof h.text!="string"||!h.text)return;m={kind:"thinking",text:h.text,done:p}}else{if(typeof h.name!="string"||!h.name)return;m={kind:"tool",name:h.name,args:h.args,response:h.response,done:p}}const y=o.get(h.id);y===void 0?(o.set(h.id,a.length),a.push(m)):a[y]=m,l()}function f(h){let p="message";const m=[];for(const w of h.split(/\r?\n/))w.startsWith("event:")&&(p=w.slice(6).trim()),w.startsWith("data:")&&m.push(w.slice(5).trimStart());if(m.length===0)return;let y;try{y=JSON.parse(m.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(p==="error")throw new Error(typeof y.message=="string"&&y.message?y.message:"沙箱对话失败,请稍后重试。");p==="activity"&&d(y),p==="delta"&&typeof y.text=="string"&&u(y.text),p==="done"&&!s&&typeof y.text=="string"&&u(y.text)}for(;;){const{done:h,value:p}=await n.read();i+=r.decode(p,{stream:!h});const m=i.split(/\r?\n\r?\n/);if(i=m.pop()??"",m.forEach(f),h)break}if(i.trim()&&f(i),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:s,blocks:a}}const ty={async startSession(e={}){const t=await fetch(Bi(Z0),{method:"POST",headers:J0({"Content-Type":"application/json"}),signal:as(e.signal,kde)});if(!t.ok)throw await ey(t,"无法启动 AgentKit 沙箱,请稍后重试。");const n=await t.json();if(!n.sessionId||n.status!=="ready")throw new Error("AgentKit 沙箱返回了无效的会话信息。");return{id:n.sessionId,toolName:"codex",createdAt:new Date().toISOString()}},async sendMessage(e,t={}){if(!e.sessionId||!e.text.trim())throw new Error("临时会话缺少有效的消息内容。");const n=await fetch(Bi(`${Z0}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:J0({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text}),signal:as(t.signal,Sde)});if(!n.ok)throw await ey(n,"沙箱对话失败,请稍后重试。");return Ade(n,t.onBlocks)},async closeSession(e,t={}){if(!e)return;const n=await fetch(Bi(`${Z0}/${encodeURIComponent(e)}`),{method:"DELETE",headers:J0(),signal:as(t.signal,Nde)});if(!n.ok&&n.status!==404)throw await ey(n,"无法清理 AgentKit 沙箱会话。")}},Cde=1e4;async function o4(e){const t=await fetch(Bi(e),{headers:_m({Accept:"application/json"}),signal:as(void 0,Cde)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function Ide(){return o4("/web/sandbox/capabilities")}async function Rde(){return o4("/web/skill-creator/capabilities")}function Ode(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("path",{d:"M12 3.5c.35 3.05 1.62 5.32 4.9 6.1-3.28.78-4.55 3.05-4.9 6.1-.35-3.05-1.62-5.32-4.9-6.1 3.28-.78 4.55-3.05 4.9-6.1Z"}),c.jsx("path",{d:"M18.5 14.5c.18 1.55.84 2.7 2.5 3.1-1.66.4-2.32 1.55-2.5 3.1-.18-1.55-.84-2.7-2.5-3.1 1.66-.4 2.32-1.55 2.5-3.1Z"}),c.jsx("path",{d:"M5.3 14.2c.14 1.15.62 2 1.85 2.3-1.23.3-1.71 1.15-1.85 2.3-.14-1.15-.62-2-1.85-2.3 1.23-.3 1.71-1.15 1.85-2.3Z"})]})}function Lde({open:e,state:t,error:n,onCancel:r,onConfirm:i}){const s=v.useRef(null),a=v.useRef(null);if(v.useEffect(()=>{var f;if(!e)return;const u=document.body.style.overflow;document.body.style.overflow="hidden",(f=a.current)==null||f.focus();const d=h=>{var w;if(h.key==="Escape"){h.preventDefault(),r();return}if(h.key!=="Tab")return;const p=(w=s.current)==null?void 0:w.querySelectorAll("button:not(:disabled)");if(!(p!=null&&p.length))return;const m=p[0],y=p[p.length-1];h.shiftKey&&document.activeElement===m?(h.preventDefault(),y.focus()):!h.shiftKey&&document.activeElement===y&&(h.preventDefault(),m.focus())};return window.addEventListener("keydown",d),()=>{document.body.style.overflow=u,window.removeEventListener("keydown",d)}},[r,e]),!e)return null;const o=t==="loading",l=o?"正在初始化沙箱":t==="error"?"启动失败":"启用临时会话";return Va.createPortal(c.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&!o&&r()},children:c.jsxs("section",{ref:s,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":"sandbox-dialog-description",children:[c.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[c.jsx("span",{className:"sandbox-dialog-orbit"}),c.jsx("span",{className:"sandbox-dialog-icon",children:o?c.jsx("span",{className:"sandbox-spinner"}):c.jsx(Ode,{})})]}),c.jsxs("div",{className:"sandbox-dialog-copy",children:[c.jsx("h2",{id:"sandbox-dialog-title",children:l}),t==="error"?c.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:n||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):o?c.jsx("p",{id:"sandbox-dialog-description","aria-live":"polite",children:"正在寻找可用工具并创建临时 Session,通常需要一点时间。"}):c.jsx("p",{id:"sandbox-dialog-description",children:"将启动 AgentKit 沙箱与 Codex Agent 开启临时会话,您的会话将不会被持久化保存。"})]}),c.jsxs("footer",{className:"sandbox-dialog-actions",children:[c.jsx("button",{ref:a,type:"button",onClick:r,children:o?"取消启动":"取消"}),!o&&c.jsx("button",{type:"button",className:"is-primary",onClick:i,children:t==="error"?"重新尝试":"确认开启"})]})]})}),document.body)}function Mde({onExit:e}){return c.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[c.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),c.jsx("span",{className:"sandbox-session-warning-copy",children:"当前为临时会话,退出后对话内容消失"}),c.jsx("button",{type:"button",onClick:e,children:"退出临时会话"})]})}const JN=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function ny(e){let t=0;for(let n=0;n>>0;return JN[t%JN.length]}function Dde(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,r=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):r.push(u);const i=(u,d)=>u.start_time-d.start_time,s=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(i).map(f=>s(f,d+1))}),a=r.sort(i).map(u=>s(u,0)),o=e.length?Math.min(...e.map(u=>u.start_time)):0,l=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:o,total:l-o||1}}function Pde(e,t){const n=[],r=i=>{n.push(i),t.has(i.span.span_id)||i.children.forEach(r)};return e.forEach(r),n}function e2(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const jde=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function t2(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const r=String(n);return{key:jde(t),value:r,long:r.length>80||r.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function Bde({appName:e,sessionId:t,onClose:n}){const[r,i]=v.useState(null),[s,a]=v.useState(""),[o,l]=v.useState(new Set),[u,d]=v.useState(null);v.useEffect(()=>{i(null),a(""),TR(e,t).then(E=>{i(E),d(E.length?E.reduce((b,_)=>b.start_time<=_.start_time?b:_).span_id:null)}).catch(E=>a(String(E)))},[e,t]);const{rootNodes:f,min:h,total:p}=v.useMemo(()=>Dde(r??[]),[r]),m=v.useMemo(()=>Pde(f,o),[f,o]),y=(r==null?void 0:r.find(E=>E.span_id===u))??null,w=p/1e6,g=E=>l(b=>{const _=new Set(b);return _.has(E)?_.delete(E):_.add(E),_});return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"drawer-scrim",onClick:n}),c.jsxs("aside",{className:"drawer drawer--trace",children:[c.jsxs("header",{className:"drawer-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"drawer-title",children:"调用链路观测"}),c.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${w.toFixed(1)} ms`:"加载中"})]}),c.jsx("button",{className:"drawer-close",onClick:n,"aria-label":"关闭",children:c.jsx(ti,{className:"icon"})})]}),r==null&&!s&&c.jsxs("div",{className:"drawer-loading",children:[c.jsx(_t,{className:"icon spin"})," 加载调用链路…"]}),s&&c.jsx("div",{className:"error",children:s}),r&&r.length===0&&c.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),m.length>0&&c.jsxs("div",{className:"trace-split",children:[c.jsx("div",{className:"trace-tree scroll",children:m.map(E=>{const b=E.span,_=(b.start_time-h)/p*100,k=Math.max((b.end_time-b.start_time)/p*100,.6),T=E.children.length>0;return c.jsxs("button",{className:`trace-row ${u===b.span_id?"active":""}`,onClick:()=>d(b.span_id),children:[c.jsxs("span",{className:"trace-label",style:{paddingLeft:E.depth*14},children:[c.jsx("span",{className:`trace-caret ${T?"":"hidden"} ${o.has(b.span_id)?"":"open"}`,onClick:C=>{C.stopPropagation(),T&&g(b.span_id)},children:c.jsx(dr,{className:"chev"})}),c.jsx("span",{className:"trace-dot",style:{background:ny(b.name)}}),c.jsx("span",{className:"trace-name",title:b.name,children:b.name})]}),c.jsx("span",{className:"trace-dur",children:e2(b.end_time-b.start_time)}),c.jsx("span",{className:"trace-track",children:c.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${k}%`,background:ny(b.name)}})})]},b.span_id)})}),c.jsx("div",{className:"trace-detail scroll",children:y?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"td-title",children:y.name}),c.jsxs("div",{className:"td-dur",children:[c.jsx("span",{className:"td-dot",style:{background:ny(y.name)}}),e2(y.end_time-y.start_time)]}),c.jsx("div",{className:"td-section",children:"属性"}),c.jsx("div",{className:"td-props",children:t2(y).filter(E=>!E.long).map(E=>c.jsxs("div",{className:"td-prop",children:[c.jsx("span",{className:"td-key",children:E.key}),c.jsx("span",{className:"td-val",children:E.value})]},E.key))}),t2(y).filter(E=>E.long).map(E=>c.jsxs("div",{className:"td-block",children:[c.jsx("div",{className:"td-section",children:E.key}),c.jsx("pre",{className:"td-pre",children:E.value})]},E.key))]}):c.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}function Fde(e){return e.toLowerCase()==="github"?c.jsx(uU,{className:"icon"}):c.jsx(bU,{className:"icon"})}function Ude({branding:e,onUsername:t}){const[n,r]=v.useState(null),[i,s]=v.useState(""),[a,o]=v.useState(0),[l,u]=v.useState("");v.useEffect(()=>{let h=!0;return r(null),s(""),UU().then(p=>{h&&r(p)}).catch(p=>{h&&s(p instanceof Error?p.message:String(p))}),()=>{h=!1}},[a]);const d=BU.test(l),f=()=>{d&&t(l)};return c.jsxs("div",{className:"login",children:[c.jsx("header",{className:"login-top",children:c.jsxs("span",{className:"login-brand",children:[c.jsx("img",{className:"login-brand-logo",src:e.logoUrl||jx,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),c.jsx("main",{className:"login-main",children:c.jsxs("div",{className:"login-card",children:[c.jsx(Zl,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),i?c.jsxs("div",{className:"login-provider-error",role:"alert",children:[c.jsx("p",{children:i}),c.jsx("button",{type:"button",onClick:()=>o(h=>h+1),children:"重试"})]}):n===null?null:n.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"login-sub",children:"登录以继续使用"}),c.jsx("div",{className:"login-providers",children:n.map(h=>c.jsxs("button",{className:"login-btn",onClick:()=>$U(h.loginUrl),children:[Fde(h.id),c.jsxs("span",{children:["使用 ",h.label," 登录"]})]},h.id))})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),c.jsxs("form",{className:"login-name",onSubmit:h=>{h.preventDefault(),f()},children:[c.jsx("input",{className:"login-name-input",value:l,onChange:h=>u(h.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16,autoFocus:!0}),c.jsx("button",{type:"submit",className:"login-name-go",disabled:!d,"aria-label":"进入",children:c.jsx(JI,{className:"icon"})})]}),c.jsx("p",{className:"login-hint","aria-live":"polite",children:l&&!d?"只能包含大小写字母和数字,最多 16 位。":""})]}),c.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),c.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",c.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),c.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function $de({node:e,ctx:t}){const n=e.variant??"default";return c.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}uo("Button",$de);function Hde({node:e,ctx:t}){return c.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}uo("Card",Hde);const zde={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},Vde={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function l4(e){return zde[e]??"flex-start"}function c4(e){return Vde[e]??"stretch"}function Kde({node:e,ctx:t}){const n=e.children??[];return c.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:l4(e.justify),alignItems:c4(e.align)},children:n.map(r=>t.render(r))})}uo("Column",Kde);function Yde({node:e}){const t=e.axis==="vertical";return c.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}uo("Divider",Yde);const Wde={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function qde({node:e}){const t=e.name??"";return c.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:Wde[t]??"•"})}uo("Icon",qde);function Gde({node:e,ctx:t}){const n=e.children??[];return c.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:l4(e.justify),alignItems:c4(e.align??"center")},children:n.map(r=>t.render(r))})}uo("Row",Gde);const Xde=new Set(["h1","h2","h3","h4","h5"]);function Qde({node:e,ctx:t}){const n=e.variant??"body",r=t.resolveString(e.text),i=Xde.has(n)?n:"p";return c.jsx(i,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:r})}uo("Text",Qde);const Zde="创建 Agent",Jde={intelligent:"智能模式",custom:"自定义",template:"从模板新建",workflow:"工作流"},Ao={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},efe=new Set,tfe=[];function Yi(){return{skills:[]}}function nfe(e,t){var r;const n=UR(e==null?void 0:e.events);if(n!=="新会话")return n;for(const i of t){if(i.role!=="user")continue;const s=(r=i.blocks.find(a=>a.kind==="text"))==null?void 0:r.text.trim();if(s)return s}return"新会话"}function u4(e,t){if(e.name===t)return e;for(const n of e.children){const r=u4(n,t);if(r)return r}}function d4(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...d4(n)));return t}function n2(){const e=typeof localStorage<"u"?localStorage.getItem(Ao.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function rfe({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("ellipse",{cx:"12",cy:"12",rx:"6.6",ry:"8.2"}),c.jsx("path",{d:"M12 8.2l1.05 2.75 2.75 1.05-2.75 1.05L12 15.8l-1.05-2.75L8.2 12l2.75-1.05z",fill:"currentColor",stroke:"none"})]})}function ife(){return c.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),c.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),c.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function f4(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function sfe(e){if(!e)return"";const t=[];return e.ts&&t.push(f4(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function afe(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}const ofe="send_a2ui_json_to_client";function lfe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"?t.files.length>0:t.kind==="tool"?!(t.name===ofe&&t.done):t.kind==="a2ui"?GM(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function cfe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function ufe(e){return new Promise((t,n)=>{let r="";try{r=new URL(e,window.location.href).protocol}catch{}if(r!=="http:"&&r!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const i=window.open(e,"veadk_oauth","width=520,height=720");if(!i){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let s=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",l)},o=d=>{if(!s){s=!0,a();try{i.close()}catch{}t(d)}},l=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&o(f.url)};window.addEventListener("message",l);const u=setInterval(()=>{if(!s){if(i.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(s=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=i.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&o(d)}catch{}}},500)})}function dfe(e,t){const n=JSON.parse(JSON.stringify(e??{})),r=n.exchangedAuthCredential??n.exchanged_auth_credential??{},i=r.oauth2??{};return i.authResponseUri=t,i.auth_response_uri=t,r.oauth2=i,n.exchangedAuthCredential=r,n}function r2({text:e}){const[t,n]=v.useState(!1);return c.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?c.jsx($i,{className:"icon"}):c.jsx(HE,{className:"icon"})})}function ffe(e){return e==="cn-beijing"?"华北 2(北京)":e==="cn-shanghai"?"华东 2(上海)":e||"未指定"}function hfe({tasks:e,onCancel:t}){const[n,r]=v.useState(!1),[i,s]=v.useState(null),a=e.filter(f=>f.status==="running").length,o=e[0],l=a>0?"running":(o==null?void 0:o.status)??"idle",u=a>0?`${a} 个部署任务进行中`:(o==null?void 0:o.status)==="success"?"最近部署已完成":(o==null?void 0:o.status)==="error"?"最近部署失败":(o==null?void 0:o.status)==="cancelled"?"最近部署已取消":"部署任务",d=f=>{s(f.id),t(f).finally(()=>s(null))};return c.jsxs("div",{className:"global-deploy-center",children:[c.jsxs("button",{type:"button",className:`global-deploy-task is-${l}`,"aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(f=>!f),children:[l==="running"?c.jsx(_t,{className:"global-deploy-task-icon spin"}):l==="success"?c.jsx(eU,{className:"global-deploy-task-icon"}):l==="error"?c.jsx(rR,{className:"global-deploy-task-icon"}):l==="cancelled"?c.jsx(tU,{className:"global-deploy-task-icon"}):c.jsx(yU,{className:"global-deploy-task-icon"}),c.jsx("span",{className:"global-deploy-task-detail",children:u}),c.jsx(gp,{className:`global-deploy-task-chevron${n?" is-open":""}`})]}),n&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"global-deploy-task-scrim","aria-label":"关闭部署任务",onClick:()=>r(!1)}),c.jsxs("section",{className:"global-deploy-popover",role:"dialog","aria-label":"部署任务",children:[c.jsxs("header",{className:"global-deploy-popover-head",children:[c.jsx("span",{children:"部署任务"}),c.jsx("span",{children:e.length})]}),c.jsx("div",{className:"global-deploy-list",children:e.length===0?c.jsx("div",{className:"global-deploy-empty",children:"暂无部署任务"}):e.map(f=>{const h=`${f.label}${f.status==="running"&&typeof f.pct=="number"?` ${Math.round(f.pct)}%`:""}`;return c.jsxs("article",{className:`global-deploy-item is-${f.status}`,children:[c.jsxs("div",{className:"global-deploy-item-head",children:[c.jsx("span",{className:"global-deploy-runtime-name",children:f.runtimeName}),c.jsx("span",{className:"global-deploy-status",children:h})]}),c.jsxs("dl",{className:"global-deploy-meta",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"Runtime 名称"}),c.jsx("dd",{children:f.runtimeName})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"部署地域"}),c.jsx("dd",{children:ffe(f.region)})]}),f.runtimeId&&c.jsxs("div",{children:[c.jsx("dt",{children:"Runtime ID"}),c.jsx("dd",{children:f.runtimeId})]})]}),f.message&&f.status==="error"?c.jsx($p,{className:"global-deploy-error",message:f.message,onRetry:f.retry}):f.message?c.jsx("p",{className:"global-deploy-message",children:f.message}):null,f.status==="running"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"global-deploy-progress","aria-hidden":!0,children:c.jsx("span",{style:{width:`${Math.max(6,Math.min(100,f.pct??6))}%`}})}),c.jsx("div",{className:"global-deploy-item-actions",children:c.jsx("button",{type:"button",disabled:i===f.id,onClick:()=>d(f),children:i===f.id?"取消中…":"取消部署"})})]})]},f.id)})})]})]})]})}const i2=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],s2=()=>i2[Math.floor(Math.random()*i2.length)];function ry(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function pfe(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function mfe(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}function gfe(){const[e,t]=v.useState([]),[n,r]=v.useState(""),[i,s]=v.useState([]),[a,o]=v.useState(""),l=v.useRef(null),[u,d]=v.useState(!1),[f,h]=v.useState([]),[p,m]=v.useState(null),[y,w]=v.useState([]),[g,E]=v.useState(!1),[b,_]=v.useState(!1),[k,T]=v.useState("confirm"),[C,S]=v.useState(""),R=v.useRef(null),I=v.useRef(null),[M,B]=v.useState({}),Y=a?M[a]??[]:f,P=p?y:Y,U=p?"灵光一现":nfe(i.find(q=>q.id===a),P),A=(q,ee)=>B(we=>({...we,[q]:typeof ee=="function"?ee(we[q]??[]):ee})),[L,O]=v.useState(""),[j,N]=v.useState("agent"),[H,V]=v.useState({}),[D,ne]=v.useState(null),[J,re]=v.useState(!1),de=v.useRef(0),[G,W]=v.useState([]),[ae,he]=v.useState(Yi),[Z,ce]=v.useState(null),[Ie,xe]=v.useState(!1),ge=v.useRef(new Set),[De,_e]=v.useState(()=>new Set),He=v.useRef(new Map),Oe=(q,ee)=>_e(we=>{const Fe=new Set(we);return ee?Fe.add(q):Fe.delete(q),Fe}),oe=v.useRef(""),[kt,ve]=v.useState(""),[St,dt]=v.useState(!1),[K,X]=v.useState(s2),[le,Se]=v.useState(null),[Le,ft]=v.useState(null),[qe,ct]=v.useState(""),[Jt,Ot]=v.useState(),[Xe,xt]=v.useState(null),[Vt,An]=v.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[$e,st]=v.useState("cloud"),[rt,bt]=v.useState(zu),[ue,Me]=v.useState("chat"),[Ze,un]=v.useState(!1),[dn,se]=v.useState(!1),[Te,ye]=v.useState(!1),[je,ze]=v.useState({}),[Ge,Et]=v.useState({}),[Lt,Mt]=v.useState({}),En=De.has(a)||u,Kt=p?g:En,Cn=je[a]??"",rr=Ge[a]??efe,Sr=Lt[a]??tfe,Fn=Z==null?void 0:Z.graph,Yn=ae.targetAgent&&Fn?u4(Fn,ae.targetAgent.name):Fn,ir=(Yn==null?void 0:Yn.skills)??(ae.targetAgent?[]:(Z==null?void 0:Z.skills)??[]),Nr=Fn?d4(Fn):[];function Yt(q){ry(q);for(const ee of q)ee.status==="uploading"?ge.current.add(ee.id):ee.uri&&Eh(n,ee.uri).catch(we=>ve(String(we)))}function In(){de.current+=1;const q=D;ne(null),re(!1),q&&!q.id.startsWith("pending-")&&dde(q.id).catch(ee=>{ve(ee instanceof Error?ee.message:String(ee))})}async function Un(q){try{await b1(n,qe,q),await y1(n,qe,q),s(ee=>ee.filter(we=>we.id!==q)),B(ee=>{const{[q]:we,...Fe}=ee;return Fe})}catch(ee){ve(String(ee))}}function sr(q){const ee=G.find(Ye=>Ye.id===q);if(!ee)return;const we=G.filter(Ye=>Ye.id!==q);ry([ee]),ee.status==="uploading"&&ge.current.add(q),W(we),we.length===0&&!L.trim()&&!!a&&P.length===0?(oe.current="",o(""),Un(a)):ee.uri&&Eh(n,ee.uri).catch(Ye=>ve(String(Ye)))}const Wn=(q,ee)=>{var We,Ke,Je,Ae,yt;const we=ee.author&&ee.author!=="user"?ee.author:void 0;we&&(ze(At=>({...At,[q]:we})),Et(At=>({...At,[q]:new Set(At[q]??[]).add(we)})),Mt(At=>{var Dt;return(Dt=At[q])!=null&&Dt.length?At:{...At,[q]:[we]}}));const Fe=((We=ee.actions)==null?void 0:We.transferToAgent)??((Ke=ee.actions)==null?void 0:Ke.transfer_to_agent);Fe&&Mt(At=>{const Dt=At[q]??[];return Dt[Dt.length-1]===Fe?At:{...At,[q]:[...Dt,Fe]}}),(((Je=ee.actions)==null?void 0:Je.endOfAgent)??((Ae=ee.actions)==null?void 0:Ae.end_of_agent)??((yt=ee.actions)==null?void 0:yt.escalate))&&Mt(At=>{const Dt=At[q]??[];return Dt.length<=1?At:{...At,[q]:Dt.slice(0,-1)}})},[Rn,at]=v.useState(n2),[On,Ut]=v.useState([]),en=v.useCallback(q=>{Ut(ee=>{const we=ee.findIndex(Ye=>Ye.id===q.id);if(we===-1)return[q,...ee];const Fe=[...ee];return Fe[we]={...Fe[we],...q},Fe})},[]),Ln=v.useCallback(async q=>{try{await CR(q.id),Ut(ee=>ee.map(we=>we.id===q.id?{...we,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"}:we))}catch(ee){const we=ee instanceof Error?ee.message:String(ee);Ut(Fe=>Fe.map(Ye=>Ye.id===q.id?{...Ye,message:`取消失败:${we}`}:Ye))}},[]),[$n,Tn]=v.useState(!0),[te,Ne]=v.useState(!1),[Re,Be]=v.useState(!1),[wt,mt]=v.useState(!1),[tn,vt]=v.useState(null),[Mn,Nt]=v.useState(!1),[og,Ar]=v.useState(!1),aa=v.useRef(null),[sc,ac]=v.useState(()=>{const q=es();return Ql(q),q}),[Yd,Wd]=v.useState(!1),lg=v.useRef(!1),qd=v.useRef(!1);function Gd(q){console.log("create agent draft:",q),at(null),ho()}function Iw(q,ee){console.log("Agent added, navigating to:",q,ee),ac(es()),at(null),r(q)}const{ref:h4,onScroll:p4}=XM(P),cg=v.useCallback(()=>{ft(null),zU().then(q=>{ct(q.userId),Ot(q.info),se(!!q.local),Se(q.status)}).catch(q=>{ft(q instanceof Error?q.message:String(q))})},[]);v.useEffect(()=>{cg()},[cg]),v.useEffect(()=>{dn&&qe&&mT(qe)},[dn,qe]),v.useEffect(()=>{if(le!=="authenticated"||!qe){V({});return}let q=!1;return Promise.allSettled([Ide(),Rde()]).then(([ee,we])=>{q||V({temporaryEnabled:ee.status==="fulfilled"&&ee.value.enabled,skillCreateEnabled:we.status==="fulfilled"&&we.value.enabled})}),()=>{q=!0}},[le,qe]),v.useEffect(()=>{if(le!=="authenticated"||!qe){xt(null);return}let q=!1;return xt(null),LR().then(ee=>{q||xt(ee)}).catch(ee=>{console.warn("[app] /web/access failed; using ordinary-user access:",ee),q||xt(OR)}),()=>{q=!0}},[le,qe]),v.useEffect(()=>{RR().then(q=>{An(q.features),st(q.agentsSource),bt(q.branding),Me(q.defaultView),un(!0)})},[]),v.useEffect(()=>{!Xe||!Ze||qd.current||(qd.current=!0,ue==="addAgent"&&Xe.capabilities.createAgents&&(at(null),Ne(!1),Nt(!1),Ar(!1),Be(!1),mt(!0)))},[Xe,ue,Ze]),v.useEffect(()=>{Xe&&(Xe.capabilities.createAgents||(at(null),vt(null),Be(!1),mt(!1),Ut([])),Xe.capabilities.manageAgents||Ar(!1))},[Xe]),v.useEffect(()=>{document.title=rt.title;let q=document.querySelector('link[rel~="icon"]');q||(q=document.createElement("link"),q.rel="icon",document.head.appendChild(q)),q.removeAttribute("type"),q.href=rt.logoUrl||jx},[rt]),v.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(q=>q.ok?q.json():null).then(q=>{q&&Tn(!!q.credentials)}).catch(q=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",q)})},[]);function m4(q){mT(q),lg.current=!0,qd.current=!1,xt(null),at(null),vt(null),Ne(!1),Be(!1),mt(!1),Nt(!1),Ar(!1),ho(),ct(q),Ot({name:q}),se(!0),Se("authenticated")}function g4(){qd.current=!1,xt(null),dn?(FU(),ct(""),Ot(void 0),Se("unauthenticated")):HU()}v.useEffect(()=>{le!=="unauthenticated"&&xR().then(q=>{if(t(q),$e==="cloud"){r("");return}const ee=localStorage.getItem(Ao.app),we=sc.flatMap(We=>We.apps.map(Ke=>qa(We.id,Ke))),Fe=ee&&(q.includes(ee)||we.includes(ee)),Ye=["web_search_agent","web_demo"].find(We=>q.includes(We))??q.find(We=>!/^\d/.test(We))??q[0];r(Fe?ee:Ye||"")}).catch(q=>ve(String(q)))},[le,$e]),v.useEffect(()=>{n&&localStorage.setItem(Ao.app,n)},[n]),v.useEffect(()=>{let q=!1;if(ce(null),he(Yi()),!n){xe(!1);return}return xe(!0),wd(n).then(ee=>{q||ce(ee)}).catch(()=>{q||ce(null)}).finally(()=>{q||xe(!1)}),()=>{q=!0}},[n]),v.useEffect(()=>{Xe&&localStorage.setItem(Ao.view,Xe.capabilities.createAgents?Rn??"chat":"chat")},[Xe,Rn]),v.useEffect(()=>{localStorage.setItem(Ao.session,a),oe.current=a},[a]),v.useEffect(()=>()=>He.current.forEach(q=>q.abort()),[]),v.useEffect(()=>()=>{var q,ee;(q=R.current)==null||q.abort(),(ee=I.current)==null||ee.abort()},[]),v.useEffect(()=>{!n||!qe||(async()=>{const q=await Xd(n);if(!lg.current){lg.current=!0;const ee=localStorage.getItem(Ao.session)||"";if(n2()===null&&ee&&q.some(we=>we.id===ee)){Qd(ee);return}}ho()})()},[n,qe]),v.useEffect(()=>{const q=aa.current;q&&q.app===n&&(aa.current=null,Qd(q.sid))},[n]);function y4(q,ee){Nt(!1),q===n?Qd(ee):(aa.current={app:q,sid:ee},r(q))}async function Xd(q){try{const ee=await QE(q,qe),we=await Promise.all(ee.map(Fe=>{var Ye;return(Ye=Fe.events)!=null&&Ye.length?Promise.resolve(Fe):xp(q,qe,Fe.id)}));return s(we),we}catch(ee){return ve(String(ee)),[]}}function b4(){p||(ve(""),S(""),T("confirm"),_(!0))}function E4(){var q;(q=R.current)==null||q.abort(),R.current=null,_(!1),T("confirm"),S(""),!p&&j==="temporary"&&N("agent")}async function x4(){var ee;(ee=R.current)==null||ee.abort();const q=new AbortController;R.current=q,T("loading"),S("");try{const we=await ty.startSession({signal:q.signal});if(R.current!==q)return;oe.current="",o(""),h([]),O(""),he(Yi()),N("temporary"),In(),re(!1),Yt(G),W([]),w([]),m(we),at(null),Ne(!1),Be(!1),mt(!1),Nt(!1),Ar(!1),_(!1),T("confirm")}catch(we){if((we==null?void 0:we.name)==="AbortError"||R.current!==q)return;S(we instanceof Error?we.message:String(we)),T("error")}finally{R.current===q&&(R.current=null)}}function oa(){var ee;(ee=I.current)==null||ee.abort(),I.current=null,E(!1),w([]),O(""),ve(""),N("agent");const q=p;m(null),q&&ty.closeSession(q.id).catch(we=>ve(String(we)))}async function w4(q){var Ye;const ee=p;if(!ee||g||!q.trim())return;ve("");const we=new AbortController;(Ye=I.current)==null||Ye.abort(),I.current=we;const Fe=[{role:"user",blocks:[{kind:"text",text:q}],meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];w(We=>[...We,...Fe]),E(!0);try{const We=await ty.sendMessage({sessionId:ee.id,text:q},{signal:we.signal,onBlocks:Ke=>{I.current===we&&w(Je=>{const Ae=Je.slice(),yt=Ae[Ae.length-1];return(yt==null?void 0:yt.role)==="assistant"&&(Ae[Ae.length-1]={...yt,blocks:Ke}),Ae})}});if(I.current!==we)return;w(Ke=>{const Je=Ke.slice(),Ae=Je[Je.length-1];return(Ae==null?void 0:Ae.role)==="assistant"&&(Je[Je.length-1]={...Ae,blocks:We.blocks,meta:{ts:Date.now()/1e3}}),Je})}catch(We){if((We==null?void 0:We.name)==="AbortError"||I.current!==we)return;w(Ke=>Ke.slice(0,-2)),O(q),ve(`临时会话发送失败:${We instanceof Error?We.message:String(We)}`)}finally{I.current===we&&(I.current=null,E(!1))}}function ho(){oa(),ve(""),X(s2()),N("agent"),In(),re(!1);const q=a&&Y.length===0&&G.length>0?a:"";oe.current="",o(""),d(!1),h([]),he(Yi()),Yt(G),W([]),q&&Un(q)}async function v4(q){var ee;try{(ee=He.current.get(q))==null||ee.abort(),await b1(n,qe,q),await y1(n,qe,q),B(we=>{const{[q]:Fe,...Ye}=we;return Ye}),q===a&&ho(),await Xd(n)}catch(we){ve(String(we))}}async function Qd(q){if(p&&oa(),q!==a&&(oe.current=q,ve(""),d(!1),h([]),N("agent"),In(),he(Yi()),o(q),M[q]===void 0)){ye(!0);try{const ee=await xp(n,qe,q);A(q,r7(ee.events??[]))}catch(ee){ve(String(ee))}finally{ye(!1)}}}async function Rw(q=!0){if(a)return a;l.current||(l.current=Ep(n,qe));const ee=l.current;try{const we=await ee;q&&o(we);const Fe=Date.now()/1e3,Ye={id:we,lastUpdateTime:Fe,events:[]};return s(We=>[Ye,...We.filter(Ke=>Ke.id!==we)]),we}finally{l.current===ee&&(l.current=null)}}async function _4(q){ve("");let ee;try{ee=await Rw()}catch(Fe){ve(String(Fe));return}const we=Array.from(q).map(Fe=>({file:Fe,attachment:{id:pfe(),mimeType:mfe(Fe),name:Fe.name,sizeBytes:Fe.size,status:"uploading"}}));W(Fe=>[...Fe,...we.map(Ye=>Ye.attachment)]),await Promise.all(we.map(async({file:Fe,attachment:Ye})=>{try{const We=await wR(n,qe,ee,Fe);if(ge.current.delete(Ye.id)){We.uri&&await Eh(n,We.uri);return}W(Ke=>Ke.map(Je=>Je.id===Ye.id?We:Je))}catch(We){if(ge.current.delete(Ye.id))return;const Ke=We instanceof Error?We.message:String(We);W(Je=>Je.map(Ae=>Ae.id===Ye.id?{...Ae,status:"error",error:Ke}:Ae)),ve(Ke)}}))}async function Ow(q,ee=[],we=Yi()){if(!q.trim()&&ee.length===0||En||!n||!qe)return;ve("");const Fe=[];(we.skills.length>0||we.targetAgent)&&Fe.push({kind:"invocation",value:we}),ee.length&&Fe.push({kind:"attachment",files:ee.map(Ae=>({id:Ae.id,mimeType:Ae.mimeType,data:Ae.data,uri:Ae.uri,name:Ae.name,sizeBytes:Ae.sizeBytes}))}),q.trim()&&Fe.push({kind:"text",text:q});const Ye=[{role:"user",blocks:Fe,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],We=!a;We&&(h(Ye),d(!0));let Ke;try{Ke=await Rw(!We)}catch(Ae){We&&(h([]),d(!1),O(q),he(we)),ve(String(Ae));return}A(Ke,Ye),We&&(oe.current=Ke,o(Ke),h([]),d(!1));const Je=new AbortController;He.current.set(Ke,Je),Oe(Ke,!0),oe.current=Ke,ze(Ae=>({...Ae,[Ke]:""})),Et(Ae=>({...Ae,[Ke]:new Set})),Mt(Ae=>({...Ae,[Ke]:[]}));try{let Ae=Ji(),yt=0,At=Date.now()/1e3;for await(const Dt of Hu({appName:n,userId:qe,sessionId:Ke,text:q,attachments:ee,invocation:we,signal:Je.signal})){if(Je.signal.aborted)break;const bs=Dt.error??Dt.errorMessage??Dt.error_message;if(typeof bs=="string"&&bs){oe.current===Ke&&ve(bs);break}Wn(Ke,Dt),Ae=vl(Ae,Dt);const po=Dt.usageMetadata??Dt.usage_metadata;po!=null&&po.totalTokenCount&&(yt=po.totalTokenCount),Dt.timestamp&&(At=Dt.timestamp);const hg=Ae.blocks,ca={tokens:yt||void 0,ts:At};A(Ke,ua=>{const Es=ua.slice(),ef=Es[Es.length-1];return(ef==null?void 0:ef.role)==="assistant"&&(Es[Es.length-1]={...ef,blocks:hg,meta:ca}),Es})}Xd(n)}catch(Ae){(Ae==null?void 0:Ae.name)!=="AbortError"&&!Je.signal.aborted&&oe.current===Ke&&ve(String(Ae))}finally{He.current.get(Ke)===Je&&He.current.delete(Ke),Oe(Ke,!1),ze(Ae=>({...Ae,[Ke]:""})),Mt(Ae=>({...Ae,[Ke]:[]}))}}function T4(q,ee){var Ye,We;const we=((Ye=q==null?void 0:q.event)==null?void 0:Ye.name)??ee.id,Fe=((We=q==null?void 0:q.event)==null?void 0:We.context)??{};Ow(`[ui-action] ${we}: ${JSON.stringify(Fe)}`)}async function k4(q){if(!q.authUri)throw new Error("事件中没有授权地址。");if(!n||!qe||!a)throw new Error("会话尚未就绪。");const ee=a,we=await ufe(q.authUri),Fe=dfe(q.authConfig,we),Ye=Ae=>Ae.map(yt=>yt.kind==="auth"&&!yt.done?{...yt,done:!0}:yt);A(ee,Ae=>{const yt=Ae.slice(),At=yt[yt.length-1];return(At==null?void 0:At.role)==="assistant"&&(yt[yt.length-1]={...At,blocks:Ye(At.blocks)}),yt});const We=P[P.length-1],Ke=Ye(We&&We.role==="assistant"?We.blocks:[]),Je=new AbortController;He.current.set(ee,Je),Oe(ee,!0);try{let Ae=Ji(),yt=0,At=Date.now()/1e3;for await(const Dt of Hu({appName:n,userId:qe,sessionId:a,text:"",functionResponses:[{id:q.callId,name:"adk_request_credential",response:Fe}],signal:Je.signal})){if(Je.signal.aborted)break;Wn(ee,Dt),Ae=vl(Ae,Dt);const bs=Dt.usageMetadata??Dt.usage_metadata;bs!=null&&bs.totalTokenCount&&(yt=bs.totalTokenCount),Dt.timestamp&&(At=Dt.timestamp);const po=[...Ke,...Ae.blocks];A(ee,hg=>{var Es;const ca=hg.slice(),ua=ca[ca.length-1];return(ua==null?void 0:ua.role)==="assistant"&&(ca[ca.length-1]={...ua,blocks:po,meta:{tokens:yt||((Es=ua.meta)==null?void 0:Es.tokens),ts:At}}),ca})}Xd(n)}catch(Ae){(Ae==null?void 0:Ae.name)!=="AbortError"&&!Je.signal.aborted&&oe.current===ee&&ve(String(Ae))}finally{He.current.get(ee)===Je&&He.current.delete(ee),Oe(ee,!1),ze(Ae=>({...Ae,[ee]:""})),Mt(Ae=>({...Ae,[ee]:[]}))}}if(Le)return c.jsxs("div",{className:"boot boot-error",children:[c.jsx("p",{children:Le}),c.jsx("button",{type:"button",onClick:cg,children:"重试"})]});if(le===null)return c.jsx("div",{className:"boot"});if(le==="unauthenticated")return c.jsx(Ude,{branding:rt,onUsername:m4});if(!Xe)return c.jsx("div",{className:"boot"});const la=Xe.capabilities.createAgents,Lw=Xe.capabilities.manageAgents,ki=la?Rn:null,ug=la&&wt,dg=la&&Re,Mw=Lw&&og,Dw=BM(e,sc),Zd=q=>{var ee;return((ee=Dw.find(we=>we.id===q))==null?void 0:ee.label)??q},oc=sc.find(q=>q.runtimeId&&q.apps.some(ee=>qa(q.id,ee)===n)),Jd=oc&&oc.runtimeId?{runtimeId:oc.runtimeId,name:oc.name,region:oc.region??"cn-beijing"}:void 0,fg=q=>{ac(es()),oe.current="",o(""),r(q)},S4=async q=>{const ee=await Px(q.runtimeId,q.name,q.region);fg(ee)};return c.jsxs("div",{className:"layout",children:[c.jsx(tee,{branding:rt,access:Xe,agentsSource:$e,localApps:e,currentAgentId:n,currentAgentLabel:n?Zd(n):"",currentRuntime:Jd,onSelectAgent:fg,features:Vt,sessions:i,currentSessionId:a,streamingSids:De,onNewChat:()=>{at(null),Ne(!1),Be(!1),mt(!1),Nt(!1),Ar(!1),ho()},onSearch:()=>{p&&oa(),at(null),Ne(!1),Be(!1),mt(!1),Ar(!1),Nt(!0),ve("")},onQuickCreate:()=>{if(!la){ve("当前账号没有添加 Agent 的权限。");return}p&&oa(),oe.current="",o(""),Ne(!1),Be(!1),Nt(!1),Ar(!1),at(null),vt(null),mt(!0),ve("")},onSkillCenter:()=>{p&&oa(),at(null),Be(!1),mt(!1),Nt(!1),Ar(!1),Ne(!0),ve("")},onAddAgent:()=>{if(!la){ve("当前账号没有添加 Agent 的权限。");return}p&&oa(),oe.current="",at(null),Ne(!1),Nt(!1),Ar(!1),o(""),mt(!1),Be(!0),ve("")},onManageAgents:()=>{if(!Lw){ve("当前账号没有管理 Agent 的权限。");return}p&&oa(),oe.current="",o(""),at(null),Ne(!1),Be(!1),mt(!1),Nt(!1),Ar(!0),ve("")},onPickSession:q=>{at(null),Ne(!1),Be(!1),mt(!1),Nt(!1),Ar(!1),ve(""),Qd(q)},onDeleteSession:v4,userInfo:Jt,onLogout:g4}),(()=>{const q=c.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&c.jsx(Mde,{onExit:ho}),c.jsx(Bee,{sessionId:p?p.id:a,sessionInitializing:!p&&u,appName:n,agentName:p?"AgentKit 沙箱":n?Zd(n):"Agent",value:L,onChange:O,onSubmit:()=>{if(!p&&j==="skill-create"){const Ye=L.trim();if(!Ye||J)return;const We={id:`pending-${Date.now()}`,prompt:Ye,status:"provisioning",candidates:zx.map((Je,Ae)=>({id:`pending-${Ae}`,model:Je,modelLabel:Je,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};re(!0);const Ke=++de.current;ve(""),ne(We),O(""),cde(Ye,Je=>{de.current===Ke&&ne(Je)}).then(Je=>{de.current===Ke&&ne(Je)}).catch(Je=>{de.current===Ke&&(ne(null),O(Ye),ve(Je instanceof Error?Je.message:String(Je)))}).finally(()=>{de.current===Ke&&re(!1)});return}const ee=L;if(O(""),p){w4(ee);return}const we=G,Fe=ae;W([]),he(Yi()),Ow(ee,we,Fe),ry(we)},disabled:p?!1:!qe||j==="temporary"||j==="agent"&&!n,busy:p?g:j==="skill-create"?J:En,showMeta:P.length>0&&!p,attachments:p?[]:G,skills:p?[]:ir,agents:p?[]:Nr,invocation:p?Yi():ae,capabilitiesLoading:!p&&Ie,allowAttachments:!p,onInvocationChange:he,onAddFiles:_4,onRemoveAttachment:sr,newChatMode:p?"agent":j,newChatLayout:!p&&P.length===0&&D===null,showModeSelector:!p&&P.length===0&&D===null&&la,temporaryEnabled:H.temporaryEnabled,skillCreateEnabled:H.skillCreateEnabled,onModeChange:ee=>{if(!(ee==="temporary"&&!H.temporaryEnabled||ee==="skill-create"&&!H.skillCreateEnabled)){if(ee==="temporary"){N(ee),b4();return}if(N(ee),ve(""),ee==="skill-create"){he(Yi());const we=a&&Y.length===0&&G.length>0?a:"";Yt(G),W([]),we&&(oe.current="",o(""),Un(we))}}}})]});return c.jsxs("section",{className:"main-shell",children:[c.jsx(nee,{apps:Dw.map(ee=>ee.id),appName:n,onAppChange:fg,agentLabel:Zd,title:ug?"添加 Agent":dg?"添加 AgentKit 智能体":te?void 0:Mn?"搜索":Mw?"管理 Agent":ki?void 0:U,crumbs:te?[{label:"技能中心"},{label:"AgentKit Skill 空间"}]:Mn||dg||ug||!ki?void 0:ki==="menu"?[{label:Zde,onClick:()=>{at(null),vt(null),mt(!0)}},{label:"从 0 快速创建"}]:[{label:"从 0 快速创建",onClick:()=>Wd(!0)},{label:Jde[ki]}],rightContent:c.jsx(hfe,{tasks:la?On:[],onCancel:Ln})}),c.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[kt&&c.jsx("div",{className:"error",children:kt}),Te&&c.jsxs("div",{className:"session-loading",children:[c.jsx(_t,{className:"icon spin"})," 加载会话…"]}),Mw?c.jsx(oee,{currentRuntimeId:Jd==null?void 0:Jd.runtimeId,onConnect:S4}):ug?c.jsx(i3,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:rfe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{mt(!1),vt(null),at("menu")}}]}):Mn?c.jsx(OJ,{userId:qe,appId:n,agentInfo:Z,capabilitiesLoading:Ie,agentLabel:Zd,onOpenSession:y4}):dg?c.jsx(aee,{onAdded:ee=>{ac(es()),Be(!1),r(ee)},onCancel:()=>Be(!1)}):te?c.jsx(xJ,{}):ki!==null&&!$n?c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[c.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),c.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",c.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",c.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):ki==="menu"?c.jsx(pne,{onSelect:ee=>{vt(null),at(ee)},onImport:ee=>{vt(ee),at("custom")}}):ki==="intelligent"?c.jsx($ne,{userId:qe,onBack:()=>at("menu"),onCreate:Gd,onAgentAdded:Iw,onDeploymentTaskChange:en}):ki==="custom"?c.jsx(Tre,{initialDraft:tn??void 0,onBack:()=>at("menu"),onCreate:Gd,onAgentAdded:Iw,features:Vt,onDeploymentTaskChange:en}):ki==="template"?c.jsx(Nre,{onBack:()=>at("menu"),onCreate:Gd}):ki==="workflow"?c.jsx(tde,{onBack:()=>at("menu"),onCreate:Gd}):P.length===0&&D?c.jsx(Tde,{initialJob:D}):P.length===0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"welcome",children:[c.jsx(Zl,{as:"h1",className:"welcome-title",duration:4.8,spread:22,children:p?"让灵感在临时空间里自由生长":j==="skill-create"?"想创建一个什么 Skill?":K}),q]}),!p&&j==="agent"?c.jsx(ES,{appName:n,activeAgent:Cn,seenAgents:rr,execPath:Sr}):null]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"transcript",ref:h4,onScroll:p4,children:P.map((ee,we)=>{var We;const Fe=we===P.length-1;if(ee.role==="user"){const Ke=ee.blocks.map(yt=>yt.kind==="text"?yt.text:"").join(""),Je=ee.blocks.flatMap(yt=>yt.kind==="attachment"?yt.files:[]),Ae=ee.blocks.find(yt=>yt.kind==="invocation");return c.jsxs(Xt.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Ae==null?void 0:Ae.kind)==="invocation"&&c.jsx(Fx,{value:Ae.value}),Je.length>0&&c.jsx($x,{appName:n,items:Je}),Ke&&c.jsx("div",{className:"bubble",children:c.jsx(Rd,{text:Ke})}),c.jsxs("div",{className:"turn-actions turn-actions--right",children:[((We=ee.meta)==null?void 0:We.ts)&&c.jsx("span",{className:"meta-text",children:f4(ee.meta.ts)}),c.jsx(r2,{text:Ke})]})]},we)}const Ye=ee.blocks.length===0;return c.jsx(Xt.div,{className:"turn turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:Ye?Fe&&Kt?c.jsx(r3,{}):null:c.jsxs(c.Fragment,{children:[c.jsx(Hx,{appName:n,blocks:ee.blocks,onAction:T4,onAuth:k4}),!(Fe&&Kt)&&!lfe(ee)&&c.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(Fe&&Kt)&&!cfe(ee)&&c.jsxs("div",{className:"turn-meta",children:[c.jsxs("div",{className:"turn-actions",children:[!p&&c.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>dt(!0),children:c.jsx(ife,{})}),c.jsx(r2,{text:afe(ee)})]}),ee.meta&&c.jsx("span",{className:"meta-text",children:sfe(ee.meta)})]})]})},we)})}),!p&&c.jsx(ES,{appName:n,activeAgent:Cn,seenAgents:rr,execPath:Sr}),q]})]})]})})(),St&&a&&c.jsx(Bde,{appName:n,sessionId:a,onClose:()=>dt(!1)}),c.jsx(Lde,{open:b,state:k,error:C,onCancel:E4,onConfirm:()=>void x4()}),Yd&&c.jsx("div",{className:"confirm-scrim",onClick:()=>Wd(!1),children:c.jsxs("div",{className:"confirm-box",onClick:q=>q.stopPropagation(),children:[c.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),c.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),c.jsxs("div",{className:"confirm-actions",children:[c.jsx("button",{className:"confirm-btn",onClick:()=>Wd(!1),children:"取消"}),c.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{vt(null),at("menu"),Wd(!1)},children:"确定返回"})]})]})})]})}(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||iy.createRoot(document.getElementById("root")).render(c.jsx(nt.StrictMode,{children:c.jsx(dj,{reducedMotion:"user",children:c.jsx(V9,{maskOpacity:.9,children:c.jsx(gfe,{})})})}));export{v as A,Nm as B,jr as C,wfe as D,iu as E,Wa as F,bfe as R,tr as V,nt as a,_l as b,ak as c,vfe as d,lx as e,wz as f,Ku as g,ht as h,BK as i,KK as j,_z as k,cd as l,KY as m,SK as n,NK as o,JY as p,EY as q,xY as r,BO as s,c as t,Ue as u,Rt as v,ot as w,xfe as x,PK as y,Va as z}; diff --git a/veadk/webui/assets/index-u-pg5XfV.js b/veadk/webui/assets/index-u-pg5XfV.js new file mode 100644 index 00000000..27f539a1 --- /dev/null +++ b/veadk/webui/assets/index-u-pg5XfV.js @@ -0,0 +1,695 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor--dxbgBhm.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var MP=Object.defineProperty;var DP=(e,t,n)=>t in e?MP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var cw=(e,t,n)=>DP(e,typeof t!="symbol"?t+"":t,n);function PP(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Nh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ju(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var NS={exports:{}},Bp={},SS={exports:{}},at={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ed=Symbol.for("react.element"),jP=Symbol.for("react.portal"),BP=Symbol.for("react.fragment"),FP=Symbol.for("react.strict_mode"),UP=Symbol.for("react.profiler"),$P=Symbol.for("react.provider"),HP=Symbol.for("react.context"),zP=Symbol.for("react.forward_ref"),VP=Symbol.for("react.suspense"),KP=Symbol.for("react.memo"),YP=Symbol.for("react.lazy"),uw=Symbol.iterator;function WP(e){return e===null||typeof e!="object"?null:(e=uw&&e[uw]||e["@@iterator"],typeof e=="function"?e:null)}var AS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},CS=Object.assign,IS={};function Ol(e,t,n){this.props=e,this.context=t,this.refs=IS,this.updater=n||AS}Ol.prototype.isReactComponent={};Ol.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ol.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function RS(){}RS.prototype=Ol.prototype;function X1(e,t,n){this.props=e,this.context=t,this.refs=IS,this.updater=n||AS}var Q1=X1.prototype=new RS;Q1.constructor=X1;CS(Q1,Ol.prototype);Q1.isPureReactComponent=!0;var dw=Array.isArray,OS=Object.prototype.hasOwnProperty,Z1={current:null},LS={key:!0,ref:!0,__self:!0,__source:!0};function MS(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)OS.call(t,r)&&!LS.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1>>1,V=O[H];if(0>>1;Hs(J,S))res(de,J)?(O[H]=de,O[re]=S,H=re):(O[H]=J,O[ne]=S,H=ne);else if(res(de,S))O[H]=de,O[re]=S,H=re;else break e}}return j}function s(O,j){var S=O.sortIndex-j.sortIndex;return S!==0?S:O.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],d=1,f=null,h=3,p=!1,m=!1,b=!1,w=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(O){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=O)r(u),j.sortIndex=j.expirationTime,t(l,j);else break;j=n(u)}}function _(O){if(b=!1,y(O),!m)if(n(l)!==null)m=!0,A(k);else{var j=n(u);j!==null&&L(_,j.startTime-O)}}function k(O,j){m=!1,b&&(b=!1,g(N),N=-1),p=!0;var S=h;try{for(y(j),f=n(l);f!==null&&(!(f.expirationTime>j)||O&&!M());){var H=f.callback;if(typeof H=="function"){f.callback=null,h=f.priorityLevel;var V=H(f.expirationTime<=j);j=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(l)&&r(l),y(j)}else r(l);f=n(l)}if(f!==null)var D=!0;else{var ne=n(u);ne!==null&&L(_,ne.startTime-j),D=!1}return D}finally{f=null,h=S,p=!1}}var T=!1,C=null,N=-1,R=5,I=-1;function M(){return!(e.unstable_now()-IO||125H?(O.sortIndex=S,t(u,O),n(l)===null&&O===n(u)&&(b?(g(N),N=-1):b=!0,L(_,S-H))):(O.sortIndex=V,t(l,O),m||p||(m=!0,A(k))),O},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(O){var j=h;return function(){var S=h;h=j;try{return O.apply(this,arguments)}finally{h=S}}}})(FS);BS.exports=FS;var s4=BS.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var i4=v,Or=s4;function me(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),z0=Object.prototype.hasOwnProperty,a4=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,hw={},pw={};function o4(e){return z0.call(pw,e)?!0:z0.call(hw,e)?!1:a4.test(e)?pw[e]=!0:(hw[e]=!0,!1)}function l4(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function c4(e,t,n,r){if(t===null||typeof t>"u"||l4(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ur(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var $n={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){$n[e]=new ur(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];$n[t]=new ur(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){$n[e]=new ur(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){$n[e]=new ur(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){$n[e]=new ur(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){$n[e]=new ur(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){$n[e]=new ur(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){$n[e]=new ur(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){$n[e]=new ur(e,5,!1,e.toLowerCase(),null,!1,!1)});var eb=/[\-:]([a-z])/g;function tb(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(eb,tb);$n[t]=new ur(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(eb,tb);$n[t]=new ur(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(eb,tb);$n[t]=new ur(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){$n[e]=new ur(e,1,!1,e.toLowerCase(),null,!1,!1)});$n.xlinkHref=new ur("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){$n[e]=new ur(e,1,!1,e.toLowerCase(),null,!0,!0)});function nb(e,t,n,r){var s=$n.hasOwnProperty(t)?$n[t]:null;(s!==null?s.type!==0:r||!(2o||s[a]!==i[o]){var l=` +`+s[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=o);break}}}finally{tg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?vc(e):""}function u4(e){switch(e.tag){case 5:return vc(e.type);case 16:return vc("Lazy");case 13:return vc("Suspense");case 19:return vc("SuspenseList");case 0:case 2:case 15:return e=ng(e.type,!1),e;case 11:return e=ng(e.type.render,!1),e;case 1:return e=ng(e.type,!0),e;default:return""}}function W0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _o:return"Fragment";case vo:return"Portal";case V0:return"Profiler";case rb:return"StrictMode";case K0:return"Suspense";case Y0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case HS:return(e.displayName||"Context")+".Consumer";case $S:return(e._context.displayName||"Context")+".Provider";case sb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ib:return t=e.displayName||null,t!==null?t:W0(e.type)||"Memo";case vi:t=e._payload,e=e._init;try{return W0(e(t))}catch{}}return null}function d4(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return W0(t);case 8:return t===rb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ki(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function VS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function f4(e){var t=VS(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wd(e){e._valueTracker||(e._valueTracker=f4(e))}function KS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=VS(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Sh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function q0(e,t){var n=t.checked;return rn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function gw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ki(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function YS(e,t){t=t.checked,t!=null&&nb(e,"checked",t,!1)}function G0(e,t){YS(e,t);var n=Ki(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?X0(e,t.type,n):t.hasOwnProperty("defaultValue")&&X0(e,t.type,Ki(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yw(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function X0(e,t,n){(t!=="number"||Sh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var _c=Array.isArray;function Ko(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=qd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function cu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},h4=["Webkit","ms","Moz","O"];Object.keys(Mc).forEach(function(e){h4.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mc[t]=Mc[e]})});function XS(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mc.hasOwnProperty(e)&&Mc[e]?(""+t).trim():t+"px"}function QS(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=XS(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var p4=rn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function J0(e,t){if(t){if(p4[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(me(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(me(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(me(61))}if(t.style!=null&&typeof t.style!="object")throw Error(me(62))}}function ey(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ty=null;function ab(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ny=null,Yo=null,Wo=null;function xw(e){if(e=rd(e)){if(typeof ny!="function")throw Error(me(280));var t=e.stateNode;t&&(t=zp(t),ny(e.stateNode,e.type,t))}}function ZS(e){Yo?Wo?Wo.push(e):Wo=[e]:Yo=e}function JS(){if(Yo){var e=Yo,t=Wo;if(Wo=Yo=null,xw(e),t)for(e=0;e>>=0,e===0?32:31-(k4(e)/N4|0)|0}var Gd=64,Xd=4194304;function Tc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Rh(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=Tc(o):(i&=a,i!==0&&(r=Tc(i)))}else a=n&~s,a!==0?r=Tc(a):i!==0&&(r=Tc(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function td(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-cs(t),e[t]=n}function I4(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Pc),Cw=" ",Iw=!1;function E2(e,t){switch(e){case"keyup":return s6.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function x2(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var To=!1;function a6(e,t){switch(e){case"compositionend":return x2(t);case"keypress":return t.which!==32?null:(Iw=!0,Cw);case"textInput":return e=t.data,e===Cw&&Iw?null:e;default:return null}}function o6(e,t){if(To)return e==="compositionend"||!pb&&E2(e,t)?(e=y2(),qf=db=Ci=null,To=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Mw(n)}}function T2(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?T2(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function k2(){for(var e=window,t=Sh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Sh(e.document)}return t}function mb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function g6(e){var t=k2(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&T2(n.ownerDocument.documentElement,n)){if(r!==null&&mb(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Dw(n,i);var a=Dw(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ko=null,ly=null,Bc=null,cy=!1;function Pw(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cy||ko==null||ko!==Sh(r)||(r=ko,"selectionStart"in r&&mb(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Bc&&mu(Bc,r)||(Bc=r,r=Mh(ly,"onSelect"),0Ao||(e.current=my[Ao],my[Ao]=null,Ao--)}function Dt(e,t){Ao++,my[Ao]=e.current,e.current=t}var Yi={},Xn=Qi(Yi),gr=Qi(!1),Da=Yi;function il(e,t){var n=e.type.contextTypes;if(!n)return Yi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function yr(e){return e=e.childContextTypes,e!=null}function Ph(){Ft(gr),Ft(Xn)}function zw(e,t,n){if(Xn.current!==Yi)throw Error(me(168));Dt(Xn,t),Dt(gr,n)}function M2(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(me(108,d4(e)||"Unknown",s));return rn({},n,r)}function jh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yi,Da=Xn.current,Dt(Xn,e),Dt(gr,gr.current),!0}function Vw(e,t,n){var r=e.stateNode;if(!r)throw Error(me(169));n?(e=M2(e,t,Da),r.__reactInternalMemoizedMergedChildContext=e,Ft(gr),Ft(Xn),Dt(Xn,e)):Ft(gr),Dt(gr,n)}var Vs=null,Vp=!1,gg=!1;function D2(e){Vs===null?Vs=[e]:Vs.push(e)}function A6(e){Vp=!0,D2(e)}function Zi(){if(!gg&&Vs!==null){gg=!0;var e=0,t=vt;try{var n=Vs;for(vt=1;e>=a,s-=a,Ys=1<<32-cs(t)+s|n<N?(R=C,C=null):R=C.sibling;var I=h(g,C,y[N],_);if(I===null){C===null&&(C=R);break}e&&C&&I.alternate===null&&t(g,C),E=i(I,E,N),T===null?k=I:T.sibling=I,T=I,C=R}if(N===y.length)return n(g,C),Yt&&ua(g,N),k;if(C===null){for(;NN?(R=C,C=null):R=C.sibling;var M=h(g,C,I.value,_);if(M===null){C===null&&(C=R);break}e&&C&&M.alternate===null&&t(g,C),E=i(M,E,N),T===null?k=M:T.sibling=M,T=M,C=R}if(I.done)return n(g,C),Yt&&ua(g,N),k;if(C===null){for(;!I.done;N++,I=y.next())I=f(g,I.value,_),I!==null&&(E=i(I,E,N),T===null?k=I:T.sibling=I,T=I);return Yt&&ua(g,N),k}for(C=r(g,C);!I.done;N++,I=y.next())I=p(C,g,N,I.value,_),I!==null&&(e&&I.alternate!==null&&C.delete(I.key===null?N:I.key),E=i(I,E,N),T===null?k=I:T.sibling=I,T=I);return e&&C.forEach(function(B){return t(g,B)}),Yt&&ua(g,N),k}function w(g,E,y,_){if(typeof y=="object"&&y!==null&&y.type===_o&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Yd:e:{for(var k=y.key,T=E;T!==null;){if(T.key===k){if(k=y.type,k===_o){if(T.tag===7){n(g,T.sibling),E=s(T,y.props.children),E.return=g,g=E;break e}}else if(T.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===vi&&Ww(k)===T.type){n(g,T.sibling),E=s(T,y.props),E.ref=ic(g,T,y),E.return=g,g=E;break e}n(g,T);break}else t(g,T);T=T.sibling}y.type===_o?(E=Aa(y.props.children,g.mode,_,y.key),E.return=g,g=E):(_=nh(y.type,y.key,y.props,null,g.mode,_),_.ref=ic(g,E,y),_.return=g,g=_)}return a(g);case vo:e:{for(T=y.key;E!==null;){if(E.key===T)if(E.tag===4&&E.stateNode.containerInfo===y.containerInfo&&E.stateNode.implementation===y.implementation){n(g,E.sibling),E=s(E,y.children||[]),E.return=g,g=E;break e}else{n(g,E);break}else t(g,E);E=E.sibling}E=Tg(y,g.mode,_),E.return=g,g=E}return a(g);case vi:return T=y._init,w(g,E,T(y._payload),_)}if(_c(y))return m(g,E,y,_);if(ec(y))return b(g,E,y,_);rf(g,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,E!==null&&E.tag===6?(n(g,E.sibling),E=s(E,y),E.return=g,g=E):(n(g,E),E=_g(y,g.mode,_),E.return=g,g=E),a(g)):n(g,E)}return w}var ol=F2(!0),U2=F2(!1),Uh=Qi(null),$h=null,Ro=null,Eb=null;function xb(){Eb=Ro=$h=null}function wb(e){var t=Uh.current;Ft(Uh),e._currentValue=t}function by(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Go(e,t){$h=e,Eb=Ro=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function Wr(e){var t=e._currentValue;if(Eb!==e)if(e={context:e,memoizedValue:t,next:null},Ro===null){if($h===null)throw Error(me(308));Ro=e,$h.dependencies={lanes:0,firstContext:e}}else Ro=Ro.next=e;return t}var xa=null;function vb(e){xa===null?xa=[e]:xa.push(e)}function $2(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,vb(t)):(n.next=s.next,s.next=n),t.interleaved=n,ai(e,r)}function ai(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var _i=!1;function _b(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function H2(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Zs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ji(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,pt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ai(e,n)}return s=r.interleaved,s===null?(t.next=t,vb(r)):(t.next=s.next,s.next=t),r.interleaved=t,ai(e,n)}function Xf(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lb(e,n)}}function qw(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Hh(e,t,n,r){var s=e.updateQueue;_i=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var l=o,u=l.next;l.next=null,a===null?i=u:a.next=u,a=l;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;a=0,d=u=l=null,o=i;do{var h=o.lane,p=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,b=o;switch(h=t,p=n,b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=rn({},f,h);break e;case 2:_i=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,l=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(l=f),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Ba|=a,e.lanes=a,e.memoizedState=f}}function Gw(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=bg.transition;bg.transition={};try{e(!1),t()}finally{vt=n,bg.transition=r}}function iA(){return qr().memoizedState}function O6(e,t,n){var r=Fi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},aA(e))oA(t,n);else if(n=$2(e,t,n,r),n!==null){var s=ar();us(n,e,r,s),lA(n,t,r)}}function L6(e,t,n){var r=Fi(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(aA(e))oA(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(s.hasEagerState=!0,s.eagerState=o,fs(o,a)){var l=t.interleaved;l===null?(s.next=s,vb(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=$2(e,t,s,r),n!==null&&(s=ar(),us(n,e,r,s),lA(n,t,r))}}function aA(e){var t=e.alternate;return e===nn||t!==null&&t===nn}function oA(e,t){Fc=Vh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function lA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lb(e,n)}}var Kh={readContext:Wr,useCallback:Vn,useContext:Vn,useEffect:Vn,useImperativeHandle:Vn,useInsertionEffect:Vn,useLayoutEffect:Vn,useMemo:Vn,useReducer:Vn,useRef:Vn,useState:Vn,useDebugValue:Vn,useDeferredValue:Vn,useTransition:Vn,useMutableSource:Vn,useSyncExternalStore:Vn,useId:Vn,unstable_isNewReconciler:!1},M6={readContext:Wr,useCallback:function(e,t){return _s().memoizedState=[e,t===void 0?null:t],e},useContext:Wr,useEffect:Qw,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Zf(4194308,4,eA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zf(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zf(4,2,e,t)},useMemo:function(e,t){var n=_s();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_s();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=O6.bind(null,nn,e),[r.memoizedState,e]},useRef:function(e){var t=_s();return e={current:e},t.memoizedState=e},useState:Xw,useDebugValue:Rb,useDeferredValue:function(e){return _s().memoizedState=e},useTransition:function(){var e=Xw(!1),t=e[0];return e=R6.bind(null,e[1]),_s().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=nn,s=_s();if(Yt){if(n===void 0)throw Error(me(407));n=n()}else{if(n=t(),Mn===null)throw Error(me(349));ja&30||Y2(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Qw(q2.bind(null,r,i,e),[e]),r.flags|=2048,_u(9,W2.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=_s(),t=Mn.identifierPrefix;if(Yt){var n=Ws,r=Ys;n=(r&~(1<<32-cs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=wu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ss]=t,e[bu]=r,bA(e,t,!1,!1),t.stateNode=e;e:{switch(a=ey(n,r),n){case"dialog":Bt("cancel",e),Bt("close",e),s=r;break;case"iframe":case"object":case"embed":Bt("load",e),s=r;break;case"video":case"audio":for(s=0;sul&&(t.flags|=128,r=!0,ac(i,!1),t.lanes=4194304)}else{if(!r)if(e=zh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ac(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Yt)return Kn(t),null}else 2*un()-i.renderingStartTime>ul&&n!==1073741824&&(t.flags|=128,r=!0,ac(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=un(),t.sibling=null,n=en.current,Dt(en,r?n&1|2:n&1),t):(Kn(t),null);case 22:case 23:return jb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Nr&1073741824&&(Kn(t),t.subtreeFlags&6&&(t.flags|=8192)):Kn(t),null;case 24:return null;case 25:return null}throw Error(me(156,t.tag))}function H6(e,t){switch(yb(t),t.tag){case 1:return yr(t.type)&&Ph(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ll(),Ft(gr),Ft(Xn),Nb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return kb(t),null;case 13:if(Ft(en),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(me(340));al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ft(en),null;case 4:return ll(),null;case 10:return wb(t.type._context),null;case 22:case 23:return jb(),null;case 24:return null;default:return null}}var af=!1,Wn=!1,z6=typeof WeakSet=="function"?WeakSet:Set,Ae=null;function Oo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){an(e,t,r)}else n.current=null}function Sy(e,t,n){try{n()}catch(r){an(e,t,r)}}var lv=!1;function V6(e,t){if(uy=Oh,e=k2(),mb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,l=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(o=a+s),f!==i||r!==0&&f.nodeType!==3||(l=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(o=a),h===i&&++d===r&&(l=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(dy={focusedElem:e,selectionRange:n},Oh=!1,Ae=t;Ae!==null;)if(t=Ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ae=e;else for(;Ae!==null;){t=Ae;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var b=m.memoizedProps,w=m.memoizedState,g=t.stateNode,E=g.getSnapshotBeforeUpdate(t.elementType===t.type?b:ns(t.type,b),w);g.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(me(163))}}catch(_){an(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Ae=e;break}Ae=t.return}return m=lv,lv=!1,m}function Uc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Sy(t,n,i)}s=s.next}while(s!==r)}}function Wp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ay(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function wA(e){var t=e.alternate;t!==null&&(e.alternate=null,wA(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ss],delete t[bu],delete t[py],delete t[N6],delete t[S6])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function vA(e){return e.tag===5||e.tag===3||e.tag===4}function cv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vA(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Cy(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Dh));else if(r!==4&&(e=e.child,e!==null))for(Cy(e,t,n),e=e.sibling;e!==null;)Cy(e,t,n),e=e.sibling}function Iy(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Iy(e,t,n),e=e.sibling;e!==null;)Iy(e,t,n),e=e.sibling}var Bn=null,rs=!1;function mi(e,t,n){for(n=n.child;n!==null;)_A(e,t,n),n=n.sibling}function _A(e,t,n){if(As&&typeof As.onCommitFiberUnmount=="function")try{As.onCommitFiberUnmount(Fp,n)}catch{}switch(n.tag){case 5:Wn||Oo(n,t);case 6:var r=Bn,s=rs;Bn=null,mi(e,t,n),Bn=r,rs=s,Bn!==null&&(rs?(e=Bn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Bn.removeChild(n.stateNode));break;case 18:Bn!==null&&(rs?(e=Bn,n=n.stateNode,e.nodeType===8?mg(e.parentNode,n):e.nodeType===1&&mg(e,n),hu(e)):mg(Bn,n.stateNode));break;case 4:r=Bn,s=rs,Bn=n.stateNode.containerInfo,rs=!0,mi(e,t,n),Bn=r,rs=s;break;case 0:case 11:case 14:case 15:if(!Wn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Sy(n,t,a),s=s.next}while(s!==r)}mi(e,t,n);break;case 1:if(!Wn&&(Oo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){an(n,t,o)}mi(e,t,n);break;case 21:mi(e,t,n);break;case 22:n.mode&1?(Wn=(r=Wn)||n.memoizedState!==null,mi(e,t,n),Wn=r):mi(e,t,n);break;default:mi(e,t,n)}}function uv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new z6),t.forEach(function(r){var s=J6.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Jr(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~i}if(r=s,r=un()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Y6(r/1960))-r,10e?16:e,Ii===null)var r=!1;else{if(e=Ii,Ii=null,qh=0,pt&6)throw Error(me(331));var s=pt;for(pt|=4,Ae=e.current;Ae!==null;){var i=Ae,a=i.child;if(Ae.flags&16){var o=i.deletions;if(o!==null){for(var l=0;lun()-Db?Sa(e,0):Mb|=n),br(e,t)}function RA(e,t){t===0&&(e.mode&1?(t=Xd,Xd<<=1,!(Xd&130023424)&&(Xd=4194304)):t=1);var n=ar();e=ai(e,t),e!==null&&(td(e,t,n),br(e,n))}function Z6(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),RA(e,n)}function J6(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(me(314))}r!==null&&r.delete(t),RA(e,n)}var OA;OA=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||gr.current)pr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pr=!1,U6(e,t,n);pr=!!(e.flags&131072)}else pr=!1,Yt&&t.flags&1048576&&P2(t,Fh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Jf(e,t),e=t.pendingProps;var s=il(t,Xn.current);Go(t,n),s=Ab(null,t,r,e,s,n);var i=Cb();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,yr(r)?(i=!0,jh(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,_b(t),s.updater=Yp,t.stateNode=s,s._reactInternals=t,xy(t,r,e,n),t=_y(null,t,r,!0,i,n)):(t.tag=0,Yt&&i&&gb(t),rr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Jf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=t5(r),e=ns(r,e),s){case 0:t=vy(null,t,r,e,n);break e;case 1:t=iv(null,t,r,e,n);break e;case 11:t=rv(null,t,r,e,n);break e;case 14:t=sv(null,t,r,ns(r.type,e),n);break e}throw Error(me(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ns(r,s),vy(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ns(r,s),iv(e,t,r,s,n);case 3:e:{if(mA(t),e===null)throw Error(me(387));r=t.pendingProps,i=t.memoizedState,s=i.element,H2(e,t),Hh(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=cl(Error(me(423)),t),t=av(e,t,r,n,s);break e}else if(r!==s){s=cl(Error(me(424)),t),t=av(e,t,r,n,s);break e}else for(Ar=Pi(t.stateNode.containerInfo.firstChild),Cr=t,Yt=!0,is=null,n=U2(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(al(),r===s){t=oi(e,t,n);break e}rr(e,t,r,n)}t=t.child}return t;case 5:return z2(t),e===null&&yy(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,fy(r,s)?a=null:i!==null&&fy(r,i)&&(t.flags|=32),pA(e,t),rr(e,t,a,n),t.child;case 6:return e===null&&yy(t),null;case 13:return gA(e,t,n);case 4:return Tb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ol(t,null,r,n):rr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ns(r,s),rv(e,t,r,s,n);case 7:return rr(e,t,t.pendingProps,n),t.child;case 8:return rr(e,t,t.pendingProps.children,n),t.child;case 12:return rr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,Dt(Uh,r._currentValue),r._currentValue=a,i!==null)if(fs(i.value,a)){if(i.children===s.children&&!gr.current){t=oi(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Zs(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),by(i.return,n,t),o.lanes|=n;break}l=l.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(me(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),by(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}rr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Go(t,n),s=Wr(s),r=r(s),t.flags|=1,rr(e,t,r,n),t.child;case 14:return r=t.type,s=ns(r,t.pendingProps),s=ns(r.type,s),sv(e,t,r,s,n);case 15:return fA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:ns(r,s),Jf(e,t),t.tag=1,yr(r)?(e=!0,jh(t)):e=!1,Go(t,n),cA(t,r,s),xy(t,r,s,n),_y(null,t,r,!0,e,n);case 19:return yA(e,t,n);case 22:return hA(e,t,n)}throw Error(me(156,t.tag))};function LA(e,t){return a2(e,t)}function e5(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vr(e,t,n,r){return new e5(e,t,n,r)}function Fb(e){return e=e.prototype,!(!e||!e.isReactComponent)}function t5(e){if(typeof e=="function")return Fb(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sb)return 11;if(e===ib)return 14}return 2}function Ui(e,t){var n=e.alternate;return n===null?(n=Vr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function nh(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Fb(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case _o:return Aa(n.children,s,i,t);case rb:a=8,s|=8;break;case V0:return e=Vr(12,n,t,s|2),e.elementType=V0,e.lanes=i,e;case K0:return e=Vr(13,n,t,s),e.elementType=K0,e.lanes=i,e;case Y0:return e=Vr(19,n,t,s),e.elementType=Y0,e.lanes=i,e;case zS:return Gp(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $S:a=10;break e;case HS:a=9;break e;case sb:a=11;break e;case ib:a=14;break e;case vi:a=16,r=null;break e}throw Error(me(130,e==null?e:typeof e,""))}return t=Vr(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Aa(e,t,n,r){return e=Vr(7,e,r,t),e.lanes=n,e}function Gp(e,t,n,r){return e=Vr(22,e,r,t),e.elementType=zS,e.lanes=n,e.stateNode={isHidden:!1},e}function _g(e,t,n){return e=Vr(6,e,null,t),e.lanes=n,e}function Tg(e,t,n){return t=Vr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function n5(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sg(0),this.expirationTimes=sg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sg(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ub(e,t,n,r,s,i,a,o,l){return e=new n5(e,t,n,o,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Vr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_b(i),e}function r5(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jA)}catch(e){console.error(e)}}jA(),jS.exports=Dr;var Ua=jS.exports,bv=Ua;H0.createRoot=bv.createRoot,H0.hydrateRoot=bv.hydrateRoot;const Vb=v.createContext({});function em(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const tm=v.createContext(null),ku=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class l5 extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function c5({children:e,isPresent:t}){const n=v.useId(),r=v.useRef(null),s=v.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=v.useContext(ku);return v.useInsertionEffect(()=>{const{width:a,height:o,top:l,left:u}=s.current;if(t||!r.current||!a||!o)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${a}px !important; + height: ${o}px !important; + top: ${l}px !important; + left: ${u}px !important; + } + `),()=>{document.head.removeChild(d)}},[t]),c.jsx(l5,{isPresent:t,childRef:r,sizeRef:s,children:v.cloneElement(e,{ref:r})})}const u5=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a})=>{const o=em(d5),l=v.useId(),u=v.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;r&&r()},[o,r]),d=v.useMemo(()=>({id:l,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),i?[Math.random(),u]:[n,u]);return v.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),v.useEffect(()=>{!n&&!o.size&&r&&r()},[n]),a==="popLayout"&&(e=c.jsx(c5,{isPresent:n,children:e})),c.jsx(tm.Provider,{value:d,children:e})};function d5(){return new Map}function BA(e=!0){const t=v.useContext(tm);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=v.useId();v.useEffect(()=>{e&&s(i)},[e]);const a=v.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const cf=e=>e.key||"";function Ev(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const Kb=typeof window<"u",FA=Kb?v.useLayoutEffect:v.useEffect,$i=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1})=>{const[o,l]=BA(a),u=v.useMemo(()=>Ev(e),[e]),d=a&&!o?[]:u.map(cf),f=v.useRef(!0),h=v.useRef(u),p=em(()=>new Map),[m,b]=v.useState(u),[w,g]=v.useState(u);FA(()=>{f.current=!1,h.current=u;for(let _=0;_{const k=cf(_),T=a&&!o?!1:u===w||d.includes(k),C=()=>{if(p.has(k))p.set(k,!0);else return;let N=!0;p.forEach(R=>{R||(N=!1)}),N&&(y==null||y(),g(h.current),a&&(l==null||l()),r&&r())};return c.jsx(u5,{isPresent:T,initial:!f.current||n?void 0:!1,custom:T?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:T?void 0:C,children:_},k)})})},Ir=e=>e;let UA=Ir;const f5={useManualTiming:!1};function h5(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(l.schedule(u),e()),u(a)}const l={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(o),t.clear(),r=!1,s&&(s=!1,l.process(u))}};return l}const uf=["read","resolveKeyframes","update","preRender","render","postRender"],p5=40;function $A(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=uf.reduce((g,E)=>(g[E]=h5(i),g),{}),{read:o,resolveKeyframes:l,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const g=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(g-s.timestamp,p5),1),s.timestamp=g,s.isProcessing=!0,o.process(s),l.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:uf.reduce((g,E)=>{const y=a[E];return g[E]=(_,k=!1,T=!1)=>(n||m(),y.schedule(_,k,T)),g},{}),cancel:g=>{for(let E=0;Exv[e].some(n=>!!t[n])};function m5(e){for(const t in e)dl[t]={...dl[t],...e[t]}}const g5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Qh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||g5.has(e)}let zA=e=>!Qh(e);function VA(e){e&&(zA=t=>t.startsWith("on")?!Qh(t):e(t))}try{VA(require("@emotion/is-prop-valid").default)}catch{}function y5(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(zA(s)||n===!0&&Qh(s)||!t&&!Qh(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function b5({children:e,isValidProp:t,...n}){t&&VA(t),n={...v.useContext(ku),...n},n.isStatic=em(()=>n.isStatic);const r=v.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return c.jsx(ku.Provider,{value:r,children:e})}function E5(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const nm=v.createContext({});function Nu(e){return typeof e=="string"||Array.isArray(e)}function rm(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Yb=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Wb=["initial",...Yb];function sm(e){return rm(e.animate)||Wb.some(t=>Nu(e[t]))}function KA(e){return!!(sm(e)||e.variants)}function x5(e,t){if(sm(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Nu(n)?n:void 0,animate:Nu(r)?r:void 0}}return e.inherit!==!1?t:{}}function w5(e){const{initial:t,animate:n}=x5(e,v.useContext(nm));return v.useMemo(()=>({initial:t,animate:n}),[wv(t),wv(n)])}function wv(e){return Array.isArray(e)?e.join(" "):e}const v5=Symbol.for("motionComponentSymbol");function Mo(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function _5(e,t,n){return v.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Mo(n)&&(n.current=r))},[t])}const qb=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),T5="framerAppearId",YA="data-"+qb(T5),{schedule:Gb}=$A(queueMicrotask,!1),WA=v.createContext({});function k5(e,t,n,r,s){var i,a;const{visualElement:o}=v.useContext(nm),l=v.useContext(HA),u=v.useContext(tm),d=v.useContext(ku).reducedMotion,f=v.useRef(null);r=r||l.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=v.useContext(WA);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&N5(f.current,n,s,p);const m=v.useRef(!1);v.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const b=n[YA],w=v.useRef(!!b&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return FA(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),Gb.render(h.render),w.current&&h.animationState&&h.animationState.animateChanges())}),v.useEffect(()=>{h&&(!w.current&&h.animationState&&h.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,b)}),w.current=!1))}),h}function N5(e,t,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:qA(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&Mo(o),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function qA(e){if(e)return e.options.allowProjection!==!1?e.projection:qA(e.parent)}function S5({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,a;e&&m5(e);function o(u,d){let f;const h={...v.useContext(ku),...u,layoutId:A5(u)},{isStatic:p}=h,m=w5(u),b=r(u,p);if(!p&&Kb){C5();const w=I5(h);f=w.MeasureLayout,m.visualElement=k5(s,b,h,t,w.ProjectionNode)}return c.jsxs(nm.Provider,{value:m,children:[f&&m.visualElement?c.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,_5(b,m.visualElement,d),b,p,m.visualElement)]})}o.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const l=v.forwardRef(o);return l[v5]=s,l}function A5({layoutId:e}){const t=v.useContext(Vb).id;return t&&e!==void 0?t+"-"+e:e}function C5(e,t){v.useContext(HA).strict}function I5(e){const{drag:t,layout:n}=dl;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const R5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Xb(e){return typeof e!="string"||e.includes("-")?!1:!!(R5.indexOf(e)>-1||/[A-Z]/u.test(e))}function vv(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function Qb(e,t,n,r){if(typeof t=="function"){const[s,i]=vv(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=vv(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const Dy=e=>Array.isArray(e),O5=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),L5=e=>Dy(e)?e[e.length-1]||0:e,qn=e=>!!(e&&e.getVelocity);function rh(e){const t=qn(e)?e.get():e;return O5(t)?t.toValue():t}function M5({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const a={latestValues:D5(r,s,i,e),renderState:t()};return n&&(a.onMount=o=>n({props:r,current:o,...a}),a.onUpdate=o=>n(o)),a}const GA=e=>(t,n)=>{const r=v.useContext(nm),s=v.useContext(tm),i=()=>M5(e,t,r,s);return n?i():em(i)};function D5(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=rh(i[h]);let{initial:a,animate:o}=e;const l=sm(e),u=KA(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!rm(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),QA=XA("--"),P5=XA("var(--"),Zb=e=>P5(e)?j5.test(e.split("/*")[0].trim()):!1,j5=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ZA=(e,t)=>t&&typeof e=="number"?t.transform(e):e,li=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Su={...Pl,transform:e=>li(0,1,e)},df={...Pl,default:1},id=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ei=id("deg"),Is=id("%"),ze=id("px"),B5=id("vh"),F5=id("vw"),_v={...Is,parse:e=>Is.parse(e)/100,transform:e=>Is.transform(e*100)},U5={borderWidth:ze,borderTopWidth:ze,borderRightWidth:ze,borderBottomWidth:ze,borderLeftWidth:ze,borderRadius:ze,radius:ze,borderTopLeftRadius:ze,borderTopRightRadius:ze,borderBottomRightRadius:ze,borderBottomLeftRadius:ze,width:ze,maxWidth:ze,height:ze,maxHeight:ze,top:ze,right:ze,bottom:ze,left:ze,padding:ze,paddingTop:ze,paddingRight:ze,paddingBottom:ze,paddingLeft:ze,margin:ze,marginTop:ze,marginRight:ze,marginBottom:ze,marginLeft:ze,backgroundPositionX:ze,backgroundPositionY:ze},$5={rotate:Ei,rotateX:Ei,rotateY:Ei,rotateZ:Ei,scale:df,scaleX:df,scaleY:df,scaleZ:df,skew:Ei,skewX:Ei,skewY:Ei,distance:ze,translateX:ze,translateY:ze,translateZ:ze,x:ze,y:ze,z:ze,perspective:ze,transformPerspective:ze,opacity:Su,originX:_v,originY:_v,originZ:ze},Tv={...Pl,transform:Math.round},Jb={...U5,...$5,zIndex:Tv,size:ze,fillOpacity:Su,strokeOpacity:Su,numOctaves:Tv},H5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},z5=Dl.length;function V5(e,t,n){let r="",s=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),JA=()=>({...nE(),attrs:{}}),rE=e=>typeof e=="string"&&e.toLowerCase()==="svg";function eC(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const tC=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function nC(e,t,n,r){eC(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(tC.has(s)?s:qb(s),t.attrs[s])}const Zh={};function G5(e){Object.assign(Zh,e)}function rC(e,{layout:t,layoutId:n}){return Ja.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Zh[e]||e==="opacity")}function sE(e,t,n){var r;const{style:s}=e,i={};for(const a in s)(qn(s[a])||t.style&&qn(t.style[a])||rC(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function sC(e,t,n){const r=sE(e,t,n);for(const s in e)if(qn(e[s])||qn(t[s])){const i=Dl.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function X5(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Nv=["x","y","width","height","cx","cy","r"],Q5={useVisualState:GA({scrapeMotionValuesFromProps:sC,createRenderState:JA,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const o in s)if(Ja.has(o)){i=!0;break}}if(!i)return;let a=!t;if(t)for(let o=0;o{X5(n,r),Ut.render(()=>{tE(r,s,rE(n.tagName),e.transformTemplate),nC(n,r)})})}})},Z5={useVisualState:GA({scrapeMotionValuesFromProps:sE,createRenderState:nE})};function iC(e,t,n){for(const r in t)!qn(t[r])&&!rC(r,n)&&(e[r]=t[r])}function J5({transformTemplate:e},t){return v.useMemo(()=>{const n=nE();return eE(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ej(e,t){const n=e.style||{},r={};return iC(r,n,e),Object.assign(r,J5(e,t)),r}function tj(e,t){const n={},r=ej(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function nj(e,t,n,r){const s=v.useMemo(()=>{const i=JA();return tE(i,t,rE(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};iC(i,e.style,e),s.style={...i,...s.style}}return s}function rj(e=!1){return(n,r,s,{latestValues:i},a)=>{const l=(Xb(n)?nj:tj)(r,i,a,n),u=y5(r,typeof n=="string",e),d=n!==v.Fragment?{...u,...l,ref:s}:{},{children:f}=r,h=v.useMemo(()=>qn(f)?f.get():f,[f]);return v.createElement(n,{...d,children:h})}}function sj(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...Xb(r)?Q5:Z5,preloadedFeatures:e,useRender:rj(s),createVisualElement:t,Component:r};return S5(a)}}function aC(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(sh===void 0&&Rs.set(Fn.isProcessing||f5.useManualTiming?Fn.timestamp:performance.now()),sh),set:e=>{sh=e,queueMicrotask(ij)}};function aE(e,t){e.indexOf(t)===-1&&e.push(t)}function oE(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class lE{constructor(){this.subscriptions=[]}add(t){return aE(this.subscriptions,t),()=>oE(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class oj{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Rs.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Rs.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=aj(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new lE);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ut.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Rs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Sv)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Sv);return lC(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Au(e,t){return new oj(e,t)}function lj(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Au(n))}function cj(e,t){const n=im(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const o=L5(i[a]);lj(e,a,o)}}function uj(e){return!!(qn(e)&&e.add)}function Py(e,t){const n=e.getValue("willChange");if(uj(n))return n.add(t)}function cC(e){return e.props[YA]}function cE(e){let t;return()=>(t===void 0&&(t=e()),t)}const dj=cE(()=>window.ScrollTimeline!==void 0);class fj{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(dj()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class hj extends fj{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Js=e=>e*1e3,ei=e=>e/1e3;function uE(e){return typeof e=="function"}function Av(e,t){e.timeline=t,e.onfinish=null}const dE=e=>Array.isArray(e)&&typeof e[0]=="number",pj={linearEasing:void 0};function mj(e,t){const n=cE(e);return()=>{var r;return(r=pj[t])!==null&&r!==void 0?r:n()}}const Jh=mj(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),fl=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},uC=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,jy={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Nc([0,.65,.55,1]),circOut:Nc([.55,0,1,.45]),backIn:Nc([.31,.01,.66,-.59]),backOut:Nc([.33,1.53,.69,.99])};function fC(e,t){if(e)return typeof e=="function"&&Jh()?uC(e,t):dE(e)?Nc(e):Array.isArray(e)?e.map(n=>fC(n,t)||jy.easeOut):jy[e]}const hC=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,gj=1e-7,yj=12;function bj(e,t,n,r,s){let i,a,o=0;do a=t+(n-t)/2,i=hC(a,r,s)-e,i>0?n=a:t=a;while(Math.abs(i)>gj&&++obj(i,0,1,e,n);return i=>i===0||i===1?i:hC(s(i),t,r)}const pC=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,mC=e=>t=>1-e(1-t),gC=ad(.33,1.53,.69,.99),fE=mC(gC),yC=pC(fE),bC=e=>(e*=2)<1?.5*fE(e):.5*(2-Math.pow(2,-10*(e-1))),hE=e=>1-Math.sin(Math.acos(e)),EC=mC(hE),xC=pC(hE),wC=e=>/^0[^.\s]+$/u.test(e);function Ej(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||wC(e):!0}const zc=e=>Math.round(e*1e5)/1e5,pE=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function xj(e){return e==null}const wj=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,mE=(e,t)=>n=>!!(typeof n=="string"&&wj.test(n)&&n.startsWith(e)||t&&!xj(n)&&Object.prototype.hasOwnProperty.call(n,t)),vC=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match(pE);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},vj=e=>li(0,255,e),Ng={...Pl,transform:e=>Math.round(vj(e))},va={test:mE("rgb","red"),parse:vC("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Ng.transform(e)+", "+Ng.transform(t)+", "+Ng.transform(n)+", "+zc(Su.transform(r))+")"};function _j(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const By={test:mE("#"),parse:_j,transform:va.transform},Do={test:mE("hsl","hue"),parse:vC("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Is.transform(zc(t))+", "+Is.transform(zc(n))+", "+zc(Su.transform(r))+")"},Yn={test:e=>va.test(e)||By.test(e)||Do.test(e),parse:e=>va.test(e)?va.parse(e):Do.test(e)?Do.parse(e):By.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?va.transform(e):Do.transform(e)},Tj=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function kj(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(pE))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(Tj))===null||n===void 0?void 0:n.length)||0)>0}const _C="number",TC="color",Nj="var",Sj="var(",Cv="${}",Aj=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Cu(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=t.replace(Aj,l=>(Yn.test(l)?(r.color.push(i),s.push(TC),n.push(Yn.parse(l))):l.startsWith(Sj)?(r.var.push(i),s.push(Nj),n.push(l)):(r.number.push(i),s.push(_C),n.push(parseFloat(l))),++i,Cv)).split(Cv);return{values:n,split:o,indexes:r,types:s}}function kC(e){return Cu(e).values}function NC(e){const{split:t,types:n}=Cu(e),r=t.length;return s=>{let i="";for(let a=0;atypeof e=="number"?0:e;function Ij(e){const t=kC(e);return NC(e)(t.map(Cj))}const qi={test:kj,parse:kC,createTransformer:NC,getAnimatableNone:Ij},Rj=new Set(["brightness","contrast","saturate","opacity"]);function Oj(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(pE)||[];if(!r)return e;const s=n.replace(r,"");let i=Rj.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const Lj=/\b([a-z-]*)\(.*?\)/gu,Fy={...qi,getAnimatableNone:e=>{const t=e.match(Lj);return t?t.map(Oj).join(" "):e}},Mj={...Jb,color:Yn,backgroundColor:Yn,outlineColor:Yn,fill:Yn,stroke:Yn,borderColor:Yn,borderTopColor:Yn,borderRightColor:Yn,borderBottomColor:Yn,borderLeftColor:Yn,filter:Fy,WebkitFilter:Fy},gE=e=>Mj[e];function SC(e,t){let n=gE(e);return n!==Fy&&(n=qi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Dj=new Set(["auto","none","0"]);function Pj(e,t,n){let r=0,s;for(;re===Pl||e===ze,Rv=(e,t)=>parseFloat(e.split(", ")[t]),Ov=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return Rv(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?Rv(i[1],e):0}},jj=new Set(["x","y","z"]),Bj=Dl.filter(e=>!jj.has(e));function Fj(e){const t=[];return Bj.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const hl={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Ov(4,13),y:Ov(5,14)};hl.translateX=hl.x;hl.translateY=hl.y;const Ca=new Set;let Uy=!1,$y=!1;function AC(){if($y){const e=Array.from(Ca).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=Fj(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))===null||o===void 0||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}$y=!1,Uy=!1,Ca.forEach(e=>e.complete()),Ca.clear()}function CC(){Ca.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&($y=!0)})}function Uj(){CC(),AC()}class yE{constructor(t,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ca.add(this),Uy||(Uy=!0,Ut.read(CC),Ut.resolveKeyframes(AC))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),$j=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Hj(e){const t=$j.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function RC(e,t,n=1){const[r,s]=Hj(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return IC(a)?parseFloat(a):a}return Zb(s)?RC(s,t,n+1):s}const OC=e=>t=>t.test(e),zj={test:e=>e==="auto",parse:e=>e},LC=[Pl,ze,Is,Ei,F5,B5,zj],Lv=e=>LC.find(OC(e));class MC extends yE{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const Mv=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(qi.test(e)||e==="0")&&!e.startsWith("url("));function Vj(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function am(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(Yj),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const Wj=40;class DC{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Rs.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>Wj?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Uj(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Rs.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:o,onUpdate:l,isGenerator:u}=this.options;if(!u&&!Kj(t,r,s,i))if(a)this.options.duration=0;else{l&&l(am(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Hy=2e4;function PC(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=Hy?1/0:t}const tn=(e,t,n)=>e+(t-e)*n;function Sg(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function qj({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,a=0;if(!t)s=i=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;s=Sg(l,o,e+1/3),i=Sg(l,o,e),a=Sg(l,o,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function ep(e,t){return n=>n>0?t:e}const Ag=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},Gj=[By,va,Do],Xj=e=>Gj.find(t=>t.test(e));function Dv(e){const t=Xj(e);if(!t)return!1;let n=t.parse(e);return t===Do&&(n=qj(n)),n}const Pv=(e,t)=>{const n=Dv(e),r=Dv(t);if(!n||!r)return ep(e,t);const s={...n};return i=>(s.red=Ag(n.red,r.red,i),s.green=Ag(n.green,r.green,i),s.blue=Ag(n.blue,r.blue,i),s.alpha=tn(n.alpha,r.alpha,i),va.transform(s))},Qj=(e,t)=>n=>t(e(n)),od=(...e)=>e.reduce(Qj),zy=new Set(["none","hidden"]);function Zj(e,t){return zy.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Jj(e,t){return n=>tn(e,t,n)}function bE(e){return typeof e=="number"?Jj:typeof e=="string"?Zb(e)?ep:Yn.test(e)?Pv:nB:Array.isArray(e)?jC:typeof e=="object"?Yn.test(e)?Pv:eB:ep}function jC(e,t){const n=[...e],r=n.length,s=e.map((i,a)=>bE(i)(i,t[a]));return i=>{for(let a=0;a{for(const i in r)n[i]=r[i](s);return n}}function tB(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=qi.createTransformer(t),r=Cu(e),s=Cu(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?zy.has(e)&&!s.values.length||zy.has(t)&&!r.values.length?Zj(e,t):od(jC(tB(r,s),s.values),n):ep(e,t)};function BC(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?tn(e,t,n):bE(e)(e,t)}const rB=5;function FC(e,t,n){const r=Math.max(t-rB,0);return lC(n-e(r),t-r)}const sn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Cg=.001;function sB({duration:e=sn.duration,bounce:t=sn.bounce,velocity:n=sn.velocity,mass:r=sn.mass}){let s,i,a=1-t;a=li(sn.minDamping,sn.maxDamping,a),e=li(sn.minDuration,sn.maxDuration,ei(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=Vy(u,a),m=Math.exp(-f);return Cg-h/p*m},i=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),b=Vy(Math.pow(u,2),a);return(-s(u)+Cg>0?-1:1)*((h-p)*m)/b}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Cg+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,l=aB(s,i,o);if(e=Js(e),isNaN(l))return{stiffness:sn.stiffness,damping:sn.damping,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const iB=12;function aB(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function cB(e){let t={velocity:sn.velocity,stiffness:sn.stiffness,damping:sn.damping,mass:sn.mass,isResolvedFromDuration:!1,...e};if(!jv(e,lB)&&jv(e,oB))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*li(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:sn.mass,stiffness:s,damping:i}}else{const n=sB(e);t={...t,...n,mass:sn.mass},t.isResolvedFromDuration=!0}return t}function UC(e=sn.visualDuration,t=sn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=cB({...n,velocity:-ei(n.velocity||0)}),m=h||0,b=u/(2*Math.sqrt(l*d)),w=a-i,g=ei(Math.sqrt(l/d)),E=Math.abs(w)<5;r||(r=E?sn.restSpeed.granular:sn.restSpeed.default),s||(s=E?sn.restDelta.granular:sn.restDelta.default);let y;if(b<1){const k=Vy(g,b);y=T=>{const C=Math.exp(-b*g*T);return a-C*((m+b*g*w)/k*Math.sin(k*T)+w*Math.cos(k*T))}}else if(b===1)y=k=>a-Math.exp(-g*k)*(w+(m+g*w)*k);else{const k=g*Math.sqrt(b*b-1);y=T=>{const C=Math.exp(-b*g*T),N=Math.min(k*T,300);return a-C*((m+b*g*w)*Math.sinh(N)+k*w*Math.cosh(N))/k}}const _={calculatedDuration:p&&f||null,next:k=>{const T=y(k);if(p)o.done=k>=f;else{let C=0;b<1&&(C=k===0?Js(m):FC(y,k,T));const N=Math.abs(C)<=r,R=Math.abs(a-T)<=s;o.done=N&&R}return o.value=o.done?a:T,o},toString:()=>{const k=Math.min(PC(_),Hy),T=uC(C=>_.next(k*C).value,k,30);return k+"ms "+T}};return _}function Bv({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=N=>o!==void 0&&Nl,m=N=>o===void 0?l:l===void 0||Math.abs(o-N)-b*Math.exp(-N/r),y=N=>g+E(N),_=N=>{const R=E(N),I=y(N);h.done=Math.abs(R)<=u,h.value=h.done?g:I};let k,T;const C=N=>{p(h.value)&&(k=N,T=UC({keyframes:[h.value,m(h.value)],velocity:FC(y,N,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:N=>{let R=!1;return!T&&k===void 0&&(R=!0,_(N),C(N)),k!==void 0&&N>=k?T.next(N-k):(!R&&_(N),h)}}}const uB=ad(.42,0,1,1),dB=ad(0,0,.58,1),$C=ad(.42,0,.58,1),fB=e=>Array.isArray(e)&&typeof e[0]!="number",hB={linear:Ir,easeIn:uB,easeInOut:$C,easeOut:dB,circIn:hE,circInOut:xC,circOut:EC,backIn:fE,backInOut:yC,backOut:gC,anticipate:bC},Fv=e=>{if(dE(e)){UA(e.length===4);const[t,n,r,s]=e;return ad(t,n,r,s)}else if(typeof e=="string")return hB[e];return e};function pB(e,t,n){const r=[],s=n||BC,i=e.length-1;for(let a=0;at[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=pB(t,r,s),l=o.length,u=d=>{if(a&&d1)for(;fu(li(e[0],e[i-1],d)):u}function gB(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=fl(0,t,r);e.push(tn(n,1,s))}}function yB(e){const t=[0];return gB(t,e.length-1),t}function bB(e,t){return e.map(n=>n*t)}function EB(e,t){return e.map(()=>t||$C).splice(0,e.length-1)}function tp({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=fB(r)?r.map(Fv):Fv(r),i={done:!1,value:t[0]},a=bB(n&&n.length===t.length?n:yB(t),e),o=mB(a,t,{ease:Array.isArray(s)?s:EB(t,s)});return{calculatedDuration:e,next:l=>(i.value=o(l),i.done=l>=e,i)}}const xB=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Ut.update(t,!0),stop:()=>Wi(t),now:()=>Fn.isProcessing?Fn.timestamp:Rs.now()}},wB={decay:Bv,inertia:Bv,tween:tp,keyframes:tp,spring:UC},vB=e=>e/100;class EE extends DC{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,a=(s==null?void 0:s.KeyframeResolver)||yE,o=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new a(i,o,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,o=uE(n)?n:wB[n]||tp;let l,u;o!==tp&&typeof t[0]!="number"&&(l=od(vB,BC(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});i==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=PC(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:N}=this.options;return{done:!0,value:N[N.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:l,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:b,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),E=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let y=this.currentTime,_=i;if(p){const N=Math.min(this.currentTime,d)/f;let R=Math.floor(N),I=N%1;!I&&N>=1&&(I=1),I===1&&R--,R=Math.min(R,p+1),!!(R%2)&&(m==="reverse"?(I=1-I,b&&(I-=b/f)):m==="mirror"&&(_=a)),y=li(0,1,I)*f}const k=E?{done:!1,value:l[0]}:_.next(y);o&&(k.value=o(k.value));let{done:T}=k;!E&&u!==null&&(T=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&T);return C&&s!==void 0&&(k.value=am(l,this.options,s)),w&&w(k.value),C&&this.finish(),k}get duration(){const{resolved:t}=this;return t?ei(t.calculatedDuration):0}get time(){return ei(this.currentTime)}set time(t){t=Js(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=ei(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=xB,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const _B=new Set(["opacity","clipPath","filter","transform"]);function TB(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeInOut",times:l}={}){const u={[t]:n};l&&(u.offset=l);const d=fC(o,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const kB=cE(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),np=10,NB=2e4;function SB(e){return uE(e.type)||e.type==="spring"||!dC(e.ease)}function AB(e,t){const n=new EE({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(a,o),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:a,motionValue:o,name:l,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i=="string"&&Jh()&&CB(i)&&(i=HC[i]),SB(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...b}=this.options,w=AB(t,b);t=w.keyframes,t.length===1&&(t[1]=t[0]),r=w.duration,s=w.times,i=w.ease,a="keyframes"}const d=TB(o.owner.current,l,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(Av(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(am(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return ei(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return ei(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Js(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Ir;const{animation:r}=n;Av(r,t)}return Ir}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new EE({...p,keyframes:r,duration:s,type:i,ease:a,times:o,isGenerator:!0}),b=Js(this.time);u.setWithVelocity(m.sample(b-np).value,m.sample(b).value,np)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:u}=n.owner.getProps();return kB()&&r&&_B.has(r)&&!l&&!u&&!s&&i!=="mirror"&&a!==0&&o!=="inertia"}}const IB={type:"spring",stiffness:500,damping:25,restSpeed:10},RB=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),OB={type:"keyframes",duration:.8},LB={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MB=(e,{keyframes:t})=>t.length>2?OB:Ja.has(e)?e.startsWith("scale")?RB(t[1]):IB:LB;function DB({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:l,elapsed:u,...d}){return!!Object.keys(d).length}const xE=(e,t,n,r={},s,i)=>a=>{const o=iE(r,e)||{},l=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Js(l);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};DB(o)||(d={...d,...MB(e,d)}),d.duration&&(d.duration=Js(d.duration)),d.repeatDelay&&(d.repeatDelay=Js(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=am(d.keyframes,o);if(h!==void 0)return Ut.update(()=>{d.onUpdate(h),d.onComplete()}),new hj([])}return!i&&Uv.supports(d)?new Uv(d):new EE(d)};function PB({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function zC(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...l}=t;r&&(a=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in l){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=l[f];if(p===void 0||d&&PB(d,f))continue;const m={delay:n,...iE(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const g=cC(e);if(g){const E=window.MotionHandoffAnimation(g,f,Ut);E!==null&&(m.startTime=E,b=!0)}}Py(e,f),h.start(xE(f,h,p,e.shouldReduceMotion&&oC.has(f)?{type:!1}:m,e,b));const w=h.animation;w&&u.push(w)}return o&&Promise.all(u).then(()=>{Ut.update(()=>{o&&cj(e,o)})}),u}function Ky(e,t,n={}){var r;const s=im(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const a=s?()=>Promise.all(zC(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return jB(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,d]=l==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function jB(e,t,n=0,r=0,s=1,i){const a=[],o=(e.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(e.variantChildren).sort(BB).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(Ky(u,t,{...i,delay:n+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function BB(e,t){return e.sortNodePosition(t)}function FB(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>Ky(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=Ky(e,t,n);else{const s=typeof t=="function"?im(e,t,n.custom):t;r=Promise.all(zC(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const UB=Wb.length;function VC(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?VC(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>FB(e,n,r)))}function VB(e){let t=zB(e),n=$v(),r=!0;const s=l=>(u,d)=>{var f;const h=im(e,d,l==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...b}=h;u={...u,...b,...m}}return u};function i(l){t=l(e)}function a(l){const{props:u}=e,d=VC(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let w=0;wm&&_,R=!1;const I=Array.isArray(y)?y:[y];let M=I.reduce(s(g),{});k===!1&&(M={});const{prevResolvedValues:B={}}=E,Y={...B,...M},P=L=>{N=!0,h.has(L)&&(R=!0,h.delete(L)),E.needsAnimating[L]=!0;const O=e.getValue(L);O&&(O.liveStyle=!1)};for(const L in Y){const O=M[L],j=B[L];if(p.hasOwnProperty(L))continue;let S=!1;Dy(O)&&Dy(j)?S=!aC(O,j):S=O!==j,S?O!=null?P(L):h.add(L):O!==void 0&&h.has(L)?P(L):E.protectedKeys[L]=!0}E.prevProp=y,E.prevResolvedValues=M,E.isActive&&(p={...p,...M}),r&&e.blockInitialAnimation&&(N=!1),N&&(!(T&&C)||R)&&f.push(...I.map(L=>({animation:L,options:{type:g}})))}if(h.size){const w={};h.forEach(g=>{const E=e.getBaseTarget(g),y=e.getValue(g);y&&(y.liveStyle=!0),w[g]=E??null}),f.push({animation:w})}let b=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,b?t(f):Promise.resolve()}function o(l,u){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:i,getState:()=>n,reset:()=>{n=$v(),r=!0}}}function KB(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!aC(t,e):!1}function oa(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function $v(){return{animate:oa(!0),whileInView:oa(),whileHover:oa(),whileTap:oa(),whileDrag:oa(),whileFocus:oa(),exit:oa()}}class Ji{constructor(t){this.isMounted=!1,this.node=t}update(){}}class YB extends Ji{constructor(t){super(t),t.animationState||(t.animationState=VB(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();rm(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let WB=0;class qB extends Ji{constructor(){super(...arguments),this.id=WB++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const GB={animation:{Feature:YB},exit:{Feature:qB}},ts={x:!1,y:!1};function KC(){return ts.x||ts.y}function XB(e){return e==="x"||e==="y"?ts[e]?null:(ts[e]=!0,()=>{ts[e]=!1}):ts.x||ts.y?null:(ts.x=ts.y=!0,()=>{ts.x=ts.y=!1})}const wE=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Iu(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function ld(e){return{point:{x:e.pageX,y:e.pageY}}}const QB=e=>t=>wE(t)&&e(t,ld(t));function Vc(e,t,n,r){return Iu(e,t,QB(n),r)}const Hv=(e,t)=>Math.abs(e-t);function ZB(e,t){const n=Hv(e.x,t.x),r=Hv(e.y,t.y);return Math.sqrt(n**2+r**2)}class YC{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Rg(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=ZB(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:b}=Fn;this.history.push({...m,timestamp:b});const{onStart:w,onMove:g}=this.handlers;h||(w&&w(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Ig(h,this.transformPagePoint),Ut.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Rg(f.type==="pointercancel"?this.lastMoveEventInfo:Ig(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,w),m&&m(f,w)},!wE(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=ld(t),o=Ig(a,this.transformPagePoint),{point:l}=o,{timestamp:u}=Fn;this.history=[{...l,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Rg(o,this.history)),this.removeListeners=od(Vc(this.contextWindow,"pointermove",this.handlePointerMove),Vc(this.contextWindow,"pointerup",this.handlePointerUp),Vc(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Wi(this.updatePoint)}}function Ig(e,t){return t?{point:t(e.point)}:e}function zv(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rg({point:e},t){return{point:e,delta:zv(e,WC(t)),offset:zv(e,JB(t)),velocity:e8(t,.1)}}function JB(e){return e[0]}function WC(e){return e[e.length-1]}function e8(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=WC(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Js(t)));)n--;if(!r)return{x:0,y:0};const i=ei(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const qC=1e-4,t8=1-qC,n8=1+qC,GC=.01,r8=0-GC,s8=0+GC;function Lr(e){return e.max-e.min}function i8(e,t,n){return Math.abs(e-t)<=n}function Vv(e,t,n,r=.5){e.origin=r,e.originPoint=tn(t.min,t.max,e.origin),e.scale=Lr(n)/Lr(t),e.translate=tn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=t8&&e.scale<=n8||isNaN(e.scale))&&(e.scale=1),(e.translate>=r8&&e.translate<=s8||isNaN(e.translate))&&(e.translate=0)}function Kc(e,t,n,r){Vv(e.x,t.x,n.x,r?r.originX:void 0),Vv(e.y,t.y,n.y,r?r.originY:void 0)}function Kv(e,t,n){e.min=n.min+t.min,e.max=e.min+Lr(t)}function a8(e,t,n){Kv(e.x,t.x,n.x),Kv(e.y,t.y,n.y)}function Yv(e,t,n){e.min=t.min-n.min,e.max=e.min+Lr(t)}function Yc(e,t,n){Yv(e.x,t.x,n.x),Yv(e.y,t.y,n.y)}function o8(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?tn(n,e,r.max):Math.min(e,n)),e}function Wv(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function l8(e,{top:t,left:n,bottom:r,right:s}){return{x:Wv(e.x,n,s),y:Wv(e.y,t,r)}}function qv(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=fl(t.min,t.max-r,e.min):r>s&&(n=fl(e.min,e.max-s,t.min)),li(0,1,n)}function d8(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Yy=.35;function f8(e=Yy){return e===!1?e=0:e===!0&&(e=Yy),{x:Gv(e,"left","right"),y:Gv(e,"top","bottom")}}function Gv(e,t,n){return{min:Xv(e,t),max:Xv(e,n)}}function Xv(e,t){return typeof e=="number"?e:e[t]||0}const Qv=()=>({translate:0,scale:1,origin:0,originPoint:0}),Po=()=>({x:Qv(),y:Qv()}),Zv=()=>({min:0,max:0}),cn=()=>({x:Zv(),y:Zv()});function Br(e){return[e("x"),e("y")]}function XC({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function h8({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function p8(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Og(e){return e===void 0||e===1}function Wy({scale:e,scaleX:t,scaleY:n}){return!Og(e)||!Og(t)||!Og(n)}function fa(e){return Wy(e)||QC(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function QC(e){return Jv(e.x)||Jv(e.y)}function Jv(e){return e&&e!=="0%"}function rp(e,t,n){const r=e-n,s=t*r;return n+s}function e_(e,t,n,r,s){return s!==void 0&&(e=rp(e,s,r)),rp(e,n,r)+t}function qy(e,t=0,n=1,r,s){e.min=e_(e.min,t,n,r,s),e.max=e_(e.max,t,n,r,s)}function ZC(e,{x:t,y:n}){qy(e.x,t.translate,t.scale,t.originPoint),qy(e.y,n.translate,n.scale,n.originPoint)}const t_=.999999999999,n_=1.0000000000001;function m8(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,a;for(let o=0;ot_&&(t.x=1),t.yt_&&(t.y=1)}function jo(e,t){e.min=e.min+t,e.max=e.max+t}function r_(e,t,n,r,s=.5){const i=tn(e.min,e.max,s);qy(e,t,n,i,r)}function Bo(e,t){r_(e.x,t.x,t.scaleX,t.scale,t.originX),r_(e.y,t.y,t.scaleY,t.scale,t.originY)}function JC(e,t){return XC(p8(e.getBoundingClientRect(),t))}function g8(e,t,n){const r=JC(e,n),{scroll:s}=t;return s&&(jo(r.x,s.offset.x),jo(r.y,s.offset.y)),r}const eI=({current:e})=>e?e.ownerDocument.defaultView:null,y8=new WeakMap;class b8{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=cn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(ld(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XB(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Br(w=>{let g=this.getAxisMotionValue(w).get()||0;if(Is.test(g)){const{projection:E}=this.visualElement;if(E&&E.layout){const y=E.layout.layoutBox[w];y&&(g=Lr(y)*(parseFloat(g)/100))}}this.originPoint[w]=g}),m&&Ut.postRender(()=>m(d,f)),Py(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:w}=f;if(p&&this.currentDirection===null){this.currentDirection=E8(w),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,w),this.updateAxis("y",f.point,w),this.visualElement.render(),b&&b(d,f)},o=(d,f)=>this.stop(d,f),l=()=>Br(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new YC(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:eI(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Ut.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!ff(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=o8(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Mo(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=l8(s.layoutBox,n):this.constraints=!1,this.elastic=f8(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Br(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=d8(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Mo(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=g8(r,s.root,this.visualElement.getTransformPagePoint());let a=c8(s.layout.layoutBox,i);if(n){const o=n(h8(a));this.hasMutatedConstraints=!!o,o&&(a=XC(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),l=this.constraints||{},u=Br(d=>{if(!ff(d,n,this.currentDirection))return;let f=l&&l[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return Py(this.visualElement,t),r.start(xE(t,r,0,n,this.visualElement,!1))}stopAnimation(){Br(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Br(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Br(n=>{const{drag:r}=this.getProps();if(!ff(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[n];i.set(t[n]-tn(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Mo(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Br(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const l=o.get();s[a]=u8({min:l,max:l},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Br(a=>{if(!ff(a,t,null))return;const o=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];o.set(tn(l,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;y8.set(this.visualElement,this);const t=this.visualElement.current,n=Vc(t,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Mo(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Ut.read(r);const a=Iu(window,"resize",()=>this.scalePositionWithinConstraints()),o=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Br(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=l[d].translate,f.set(f.get()+l[d].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=Yy,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function ff(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function E8(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class x8 extends Ji{constructor(t){super(t),this.removeGroupControls=Ir,this.removeListeners=Ir,this.controls=new b8(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ir}unmount(){this.removeGroupControls(),this.removeListeners()}}const s_=e=>(t,n)=>{e&&Ut.postRender(()=>e(t,n))};class w8 extends Ji{constructor(){super(...arguments),this.removePointerDownListener=Ir}onPointerDown(t){this.session=new YC(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:eI(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:s_(t),onStart:s_(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&Ut.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=Vc(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const ih={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function i_(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const lc={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ze.test(e))e=parseFloat(e);else return e;const n=i_(e,t.target.x),r=i_(e,t.target.y);return`${n}% ${r}%`}},v8={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=qi.parse(e);if(s.length>5)return r;const i=qi.createTransformer(e),a=typeof s[0]!="number"?1:0,o=n.x.scale*t.x,l=n.y.scale*t.y;s[0+a]/=o,s[1+a]/=l;const u=tn(o,l,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}};class _8 extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;G5(T8),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ih.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||Ut.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Gb.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function tI(e){const[t,n]=BA(),r=v.useContext(Vb);return c.jsx(_8,{...e,layoutGroup:r,switchLayoutGroup:v.useContext(WA),isPresent:t,safeToRemove:n})}const T8={borderRadius:{...lc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lc,borderTopRightRadius:lc,borderBottomLeftRadius:lc,borderBottomRightRadius:lc,boxShadow:v8};function k8(e,t,n){const r=qn(e)?e:Au(e);return r.start(xE("",r,t,n)),r.animation}function N8(e){return e instanceof SVGElement&&e.tagName!=="svg"}const S8=(e,t)=>e.depth-t.depth;class A8{constructor(){this.children=[],this.isDirty=!1}add(t){aE(this.children,t),this.isDirty=!0}remove(t){oE(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(S8),this.isDirty=!1,this.children.forEach(t)}}function C8(e,t){const n=Rs.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Wi(r),e(i-t))};return Ut.read(r,!0),()=>Wi(r)}const nI=["TopLeft","TopRight","BottomLeft","BottomRight"],I8=nI.length,a_=e=>typeof e=="string"?parseFloat(e):e,o_=e=>typeof e=="number"||ze.test(e);function R8(e,t,n,r,s,i){s?(e.opacity=tn(0,n.opacity!==void 0?n.opacity:1,O8(r)),e.opacityExit=tn(t.opacity!==void 0?t.opacity:1,0,L8(r))):i&&(e.opacity=tn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(fl(e,t,r))}function c_(e,t){e.min=t.min,e.max=t.max}function jr(e,t){c_(e.x,t.x),c_(e.y,t.y)}function u_(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function d_(e,t,n,r,s){return e-=t,e=rp(e,1/n,r),s!==void 0&&(e=rp(e,1/s,r)),e}function M8(e,t=0,n=1,r=.5,s,i=e,a=e){if(Is.test(t)&&(t=parseFloat(t),t=tn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=tn(i.min,i.max,r);e===i&&(o-=t),e.min=d_(e.min,t,n,o,s),e.max=d_(e.max,t,n,o,s)}function f_(e,t,[n,r,s],i,a){M8(e,t[n],t[r],t[s],t.scale,i,a)}const D8=["x","scaleX","originX"],P8=["y","scaleY","originY"];function h_(e,t,n,r){f_(e.x,t,D8,n?n.x:void 0,r?r.x:void 0),f_(e.y,t,P8,n?n.y:void 0,r?r.y:void 0)}function p_(e){return e.translate===0&&e.scale===1}function sI(e){return p_(e.x)&&p_(e.y)}function m_(e,t){return e.min===t.min&&e.max===t.max}function j8(e,t){return m_(e.x,t.x)&&m_(e.y,t.y)}function g_(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function iI(e,t){return g_(e.x,t.x)&&g_(e.y,t.y)}function y_(e){return Lr(e.x)/Lr(e.y)}function b_(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class B8{constructor(){this.members=[]}add(t){aE(this.members,t),t.scheduleRender()}remove(t){if(oE(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function F8(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=e.x.scale*t.x,l=e.y.scale*t.y;return(o!==1||l!==1)&&(r+=`scale(${o}, ${l})`),r||"none"}const ha={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Sc=typeof window<"u"&&window.MotionDebug!==void 0,Lg=["","X","Y","Z"],U8={visibility:"hidden"},E_=1e3;let $8=0;function Mg(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function aI(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=cC(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ut,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&aI(r)}function oI({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=t==null?void 0:t()){this.id=$8++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Sc&&(ha.totalNodes=ha.resolvedTargetDeltas=ha.recalculatedProjection=0),this.nodes.forEach(V8),this.nodes.forEach(G8),this.nodes.forEach(X8),this.nodes.forEach(K8),Sc&&window.MotionDebug.record(ha)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=C8(h,250),ih.hasAnimatedSinceResize&&(ih.hasAnimatedSinceResize=!1,this.nodes.forEach(w_))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||t9,{onLayoutAnimationStart:w,onLayoutAnimationComplete:g}=d.getProps(),E=!this.targetLayout||!iI(this.targetLayout,m)||p,y=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const _={...iE(b,"layout"),onPlay:w,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||w_(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Wi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Q8),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&aI(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const k=_/1e3;v_(f.x,a.x,k),v_(f.y,a.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Yc(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),J8(this.relativeTarget,this.relativeTargetOrigin,h,k),y&&j8(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=cn()),jr(y,this.relativeTarget)),b&&(this.animationValues=d,R8(d,u,this.latestValues,k,E,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Wi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ut.update(()=>{ih.hasAnimatedSinceResize=!0,this.currentAnimation=k8(0,E_,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(E_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:l,layout:u,latestValues:d}=a;if(!(!o||!l||!u)){if(this!==a&&this.layout&&u&&lI(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||cn();const f=Lr(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+f;const h=Lr(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+h}jr(o,l),Bo(o,d),Kc(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new B8),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:l}=a;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(o=!0),!o)return;const u={};l.z&&Mg("z",a,u,this.animationValues);for(let d=0;d{var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(x_),this.root.sharedNodes.clear()}}}function H8(e){e.updateLayout()}function z8(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,a=n.source!==e.layout.source;i==="size"?Br(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Lr(h);h.min=r[f].min,h.max=h.min+p}):lI(i,n.layoutBox,r)&&Br(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=Lr(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=Po();Kc(o,r,n.layoutBox);const l=Po();a?Kc(l,e.applyTransform(s,!0),n.measuredBox):Kc(l,r,n.layoutBox);const u=!sI(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=cn();Yc(m,n.layoutBox,h.layoutBox);const b=cn();Yc(b,r,p.layoutBox),iI(m,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function V8(e){Sc&&ha.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function K8(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Y8(e){e.clearSnapshot()}function x_(e){e.clearMeasurements()}function W8(e){e.isLayoutDirty=!1}function q8(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function w_(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function G8(e){e.resolveTargetDelta()}function X8(e){e.calcProjection()}function Q8(e){e.resetSkewAndRotation()}function Z8(e){e.removeLeadSnapshot()}function v_(e,t,n){e.translate=tn(t.translate,0,n),e.scale=tn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function __(e,t,n,r){e.min=tn(t.min,n.min,r),e.max=tn(t.max,n.max,r)}function J8(e,t,n,r){__(e.x,t.x,n.x,r),__(e.y,t.y,n.y,r)}function e9(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const t9={duration:.45,ease:[.4,0,.1,1]},T_=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),k_=T_("applewebkit/")&&!T_("chrome/")?Math.round:Ir;function N_(e){e.min=k_(e.min),e.max=k_(e.max)}function n9(e){N_(e.x),N_(e.y)}function lI(e,t,n){return e==="position"||e==="preserve-aspect"&&!i8(y_(t),y_(n),.2)}function r9(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const s9=oI({attachResizeListener:(e,t)=>Iu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Dg={current:void 0},cI=oI({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Dg.current){const e=new s9({});e.mount(window),e.setOptions({layoutScroll:!0}),Dg.current=e}return Dg.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),i9={pan:{Feature:w8},drag:{Feature:x8,ProjectionNode:cI,MeasureLayout:tI}};function a9(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function uI(e,t){const n=a9(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function S_(e){return t=>{t.pointerType==="touch"||KC()||e(t)}}function o9(e,t,n={}){const[r,s,i]=uI(e,n),a=S_(o=>{const{target:l}=o,u=t(o);if(typeof u!="function"||!l)return;const d=S_(f=>{u(f),l.removeEventListener("pointerleave",d)});l.addEventListener("pointerleave",d,s)});return r.forEach(o=>{o.addEventListener("pointerenter",a,s)}),i}function A_(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Ut.postRender(()=>i(t,ld(t)))}class l9 extends Ji{mount(){const{current:t}=this.node;t&&(this.unmount=o9(t,n=>(A_(this.node,n,"Start"),r=>A_(this.node,r,"End"))))}unmount(){}}class c9 extends Ji{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=od(Iu(this.node.current,"focus",()=>this.onFocus()),Iu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const dI=(e,t)=>t?e===t?!0:dI(e,t.parentElement):!1,u9=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function d9(e){return u9.has(e.tagName)||e.tabIndex!==-1}const Ac=new WeakSet;function C_(e){return t=>{t.key==="Enter"&&e(t)}}function Pg(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const f9=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=C_(()=>{if(Ac.has(n))return;Pg(n,"down");const s=C_(()=>{Pg(n,"up")}),i=()=>Pg(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function I_(e){return wE(e)&&!KC()}function h9(e,t,n={}){const[r,s,i]=uI(e,n),a=o=>{const l=o.currentTarget;if(!I_(o)||Ac.has(l))return;Ac.add(l);const u=t(o),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!I_(p)||!Ac.has(l))&&(Ac.delete(l),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||dI(l,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(o=>{!d9(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),o.addEventListener("focus",u=>f9(u,s),s)}),i}function R_(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Ut.postRender(()=>i(t,ld(t)))}class p9 extends Ji{mount(){const{current:t}=this.node;t&&(this.unmount=h9(t,n=>(R_(this.node,n,"Start"),(r,{success:s})=>R_(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Gy=new WeakMap,jg=new WeakMap,m9=e=>{const t=Gy.get(e.target);t&&t(e)},g9=e=>{e.forEach(m9)};function y9({root:e,...t}){const n=e||document;jg.has(n)||jg.set(n,{});const r=jg.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(g9,{root:e,...t})),r[s]}function b9(e,t,n){const r=y9(t);return Gy.set(e,n),r.observe(e),()=>{Gy.delete(e),r.unobserve(e)}}const E9={some:0,all:1};class x9 extends Ji{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:E9[s]},o=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(l)};return b9(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(w9(t,n))&&this.startObserver()}unmount(){}}function w9({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const v9={inView:{Feature:x9},tap:{Feature:p9},focus:{Feature:c9},hover:{Feature:l9}},_9={layout:{ProjectionNode:cI,MeasureLayout:tI}},Xy={current:null},fI={current:!1};function T9(){if(fI.current=!0,!!Kb)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Xy.current=e.matches;e.addListener(t),t()}else Xy.current=!1}const k9=[...LC,Yn,qi],N9=e=>k9.find(OC(e)),O_=new WeakMap;function S9(e,t,n){for(const r in t){const s=t[r],i=n[r];if(qn(s))e.addValue(r,s);else if(qn(i))e.addValue(r,Au(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,Au(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const L_=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class A9{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=yE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Rs.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),fI.current||T9(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Xy.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){O_.delete(this.current),this.projection&&this.projection.unmount(),Wi(this.notifyUpdate),Wi(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Ja.has(t),s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Ut.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in dl){const n=dl[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):cn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Au(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(IC(s)||wC(s))?s=parseFloat(s):!N9(s)&&qi.test(n)&&(s=SC(t,n)),this.setBaseTarget(t,qn(s)?s.get():s)),qn(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=Qb(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!qn(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new lE),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class hI extends A9{constructor(){super(...arguments),this.KeyframeResolver=MC}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;qn(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function C9(e){return window.getComputedStyle(e)}class I9 extends hI{constructor(){super(...arguments),this.type="html",this.renderInstance=eC}readValueFromInstance(t,n){if(Ja.has(n)){const r=gE(n);return r&&r.default||0}else{const r=C9(t),s=(QA(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return JC(t,n)}build(t,n,r){eE(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return sE(t,n,r)}}class R9 extends hI{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=cn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Ja.has(n)){const r=gE(n);return r&&r.default||0}return n=tC.has(n)?n:qb(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return sC(t,n,r)}build(t,n,r){tE(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){nC(t,n,r,s)}mount(t){this.isSVGTag=rE(t.tagName),super.mount(t)}}const O9=(e,t)=>Xb(e)?new R9(t):new I9(t,{allowProjection:e!==v.Fragment}),L9=sj({...GB,...v9,...i9,..._9},O9),Wt=E5(L9);function vn(){return vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?v.useEffect:v.useLayoutEffect;function go(e,t,n){var r=v.useRef(t);r.current=t,v.useEffect(function(){function s(i){r.current(i)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var M9=["container"];function D9(e){var t=e.container,n=t===void 0?document.body:t,r=om(e,M9);return Ua.createPortal(et.createElement("div",vn({},r)),n)}function P9(e){return et.createElement("svg",vn({width:"44",height:"44",viewBox:"0 0 768 768"},e),et.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function j9(e){return et.createElement("svg",vn({width:"44",height:"44",viewBox:"0 0 768 768"},e),et.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function B9(e){return et.createElement("svg",vn({width:"44",height:"44",viewBox:"0 0 768 768"},e),et.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function F9(){return v.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function D_(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var s=e.touches[1],i=s.clientX,a=s.clientY;return[(n+i)/2,(r+a)/2,Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var Ti=function(e,t,n,r){var s,i=n*t,a=(i-r)/2,o=e;return i<=r?(s=1,o=0):e>0&&a-e<=0?(s=2,o=a):e<0&&a+e<=0&&(s=3,o=-a),[s,o]};function Bg(e,t,n,r,s,i,a,o,l,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),l===void 0&&(l=0),u===void 0&&(u=0);var d=Ti(e,i,n,innerWidth)[0],f=Ti(t,i,r,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-i/s*(a-(h+e))-h+(r/n>=3&&n*i===innerWidth?0:d?l/2:l),y:o-i/s*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function Jy(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function Fg(e,t,n){var r=Jy(n,innerWidth,innerHeight),s=r[0],i=r[1],a=0,o=s,l=i,u=e/t*i,d=t/e*s;return e=i?o=u:e>=s&&ts/i?l=d:t/e>=3&&!r[2]?a=((l=d)-i)/2:o=u,{width:o,height:l,x:0,y:a,pause:!0}}function pf(e,t){var n=t.leading,r=n!==void 0&&n,s=t.maxWait,i=t.wait,a=i===void 0?s||0:i,o=v.useRef(e);o.current=e;var l=v.useRef(0),u=v.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=v.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){l.current=p,d(),o.current.apply(null,h)}var b=l.current,w=p-b;if(b===0&&(r&&m(),l.current=p),s!==void 0){if(w>s)return void m()}else w=1&&i&&i())};d()}function d(){l=requestAnimationFrame(u)}}var $9={T:0,L:0,W:0,H:0,FIT:void 0},mI=function(){var e=v.useRef(!1);return v.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},H9=["className"];function z9(e){var t=e.className,n=t===void 0?"":t,r=om(e,H9);return et.createElement("div",vn({className:"PhotoView__Spinner "+n},r),et.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},et.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),et.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var V9=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function K9(e){var t=e.src,n=e.loaded,r=e.broken,s=e.className,i=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,l=om(e,V9),u=mI();return t&&!r?et.createElement(et.Fragment,null,et.createElement("img",vn({className:"PhotoView__Photo"+(s?" "+s:""),src:t,onLoad:function(d){var f=d.target;u.current&&i({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&i({broken:!0})},draggable:!1,alt:""},l)),!n&&(a?et.createElement("span",{className:"PhotoView__icon"},a):et.createElement(z9,{className:"PhotoView__icon"}))):o?et.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var Y9={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function W9(e){var t=e.item,n=t.src,r=t.render,s=t.width,i=s===void 0?0:s,a=t.height,o=a===void 0?0:a,l=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,b=e.loadingElement,w=e.brokenElement,g=e.onPhotoTap,E=e.onMaskTap,y=e.onReachMove,_=e.onReachUp,k=e.onPhotoResize,T=e.isActive,C=e.expose,N=sp(Y9),R=N[0],I=N[1],M=v.useRef(0),B=mI(),Y=R.naturalWidth,P=Y===void 0?i:Y,U=R.naturalHeight,A=U===void 0?o:U,L=R.width,O=L===void 0?i:L,j=R.height,S=j===void 0?o:j,H=R.loaded,V=H===void 0?!n:H,D=R.broken,ne=R.x,J=R.y,re=R.touched,de=R.stopRaf,G=R.maskTouched,W=R.rotate,ae=R.scale,he=R.CX,Z=R.CY,ce=R.lastX,Ce=R.lastY,Ee=R.lastCX,ge=R.lastCY,Me=R.lastScale,ve=R.touchTime,$e=R.touchLength,Re=R.pause,oe=R.reach,_t=Ia({onScale:function(ue){return we(hf(ue))},onRotate:function(ue){W!==ue&&(C({rotate:ue}),I(vn({rotate:ue},Fg(P,A,ue))))}});function we(ue,Le,Qe){ae!==ue&&(C({scale:ue}),I(vn({scale:ue},Bg(ne,J,O,S,ae,ue,Le,Qe),ue<=1&&{x:0,y:0})))}var Tt=pf(function(ue,Le,Qe){if(Qe===void 0&&(Qe=0),(re||G)&&T){var on=Jy(W,O,S),ln=on[0],ie=on[1];if(Qe===0&&M.current===0){var _e=Math.abs(ue-he)<=20,ye=Math.abs(Le-Z)<=20;if(_e&&ye)return void I({lastCX:ue,lastCY:Le});M.current=_e?Le>Z?3:2:1}var Pe,He=ue-Ee,qe=Le-ge;if(Qe===0){var yt=Ti(He+ce,ae,ln,innerWidth)[0],Rt=Ti(qe+Ce,ae,ie,innerHeight);Pe=function(mn,gn,Ht,kn){return gn&&mn===1||kn==="x"?"x":Ht&&mn>1||kn==="y"?"y":void 0}(M.current,yt,Rt[0],oe),Pe!==void 0&&y(Pe,ue,Le,ae)}if(Pe==="x"||G)return void I({reach:"x"});var Ot=hf(ae+(Qe-$e)/100/2*ae,P/O,.2);C({scale:Ot}),I(vn({touchLength:Qe,reach:Pe,scale:Ot},Bg(ne,J,O,S,ae,Ot,ue,Le,He,qe)))}},{maxWait:8});function ct(ue){return!de&&!re&&(B.current&&I(vn({},ue,{pause:u})),B.current)}var K,X,le,ke,Oe,ut,We,ot,Xt=(Oe=function(ue){return ct({x:ue})},ut=function(ue){return ct({y:ue})},We=function(ue){return B.current&&(C({scale:ue}),I({scale:ue})),!re&&B.current},ot=Ia({X:function(ue){return Oe(ue)},Y:function(ue){return ut(ue)},S:function(ue){return We(ue)}}),function(ue,Le,Qe,on,ln,ie,_e,ye,Pe,He,qe){var yt=Jy(He,ln,ie),Rt=yt[0],Ot=yt[1],mn=Ti(ue,ye,Rt,innerWidth),gn=mn[0],Ht=mn[1],kn=Ti(Le,ye,Ot,innerHeight),Jn=kn[0],wr=kn[1],Dn=Date.now()-qe;if(Dn>=200||ye!==_e||Math.abs(Pe-_e)>1){var Hn=Bg(ue,Le,ln,ie,_e,ye),er=Hn.x,vr=Hn.y,zt=gn?Ht:er!==ue?er:null,Nn=Jn?wr:vr!==Le?vr:null;return zt!==null&&ya(ue,zt,ot.X),Nn!==null&&ya(Le,Nn,ot.Y),void(ye!==_e&&ya(_e,ye,ot.S))}var Pn=(ue-Qe)/Dn,tr=(Le-on)/Dn,zn=Math.sqrt(Math.pow(Pn,2)+Math.pow(tr,2)),Sn=!1,st=!1;(function(An,jt){var Qt,Cn=An,jn=0,xn=0,te=function(je){Qt||(Qt=je);var Et=je-Qt,ht=Math.sign(An),Zt=-.001*ht,xt=Math.sign(-Cn)*Math.pow(Cn,2)*2e-4,In=Cn*Et+(Zt+xt)*Math.pow(Et,2)/2;jn+=In,Qt=je,ht*(Cn+=(Zt+xt)*Et)<=0?Ie():jt(jn)?Ne():Ie()};function Ne(){xn=requestAnimationFrame(te)}function Ie(){cancelAnimationFrame(xn)}Ne()})(zn,function(An){var jt=ue+An*(Pn/zn),Qt=Le+An*(tr/zn),Cn=Ti(jt,_e,Rt,innerWidth),jn=Cn[0],xn=Cn[1],te=Ti(Qt,_e,Ot,innerHeight),Ne=te[0],Ie=te[1];if(jn&&!Sn&&(Sn=!0,gn?ya(jt,xn,ot.X):P_(xn,jt+(jt-xn),ot.X)),Ne&&!st&&(st=!0,Jn?ya(Qt,Ie,ot.Y):P_(Ie,Qt+(Qt-Ie),ot.Y)),Sn&&st)return!1;var je=Sn||ot.X(xn),Et=st||ot.Y(Ie);return je&&Et})}),It=(K=g,X=function(ue,Le){oe||we(ae!==1?1:Math.max(2,P/O),ue,Le)},le=v.useRef(0),ke=pf(function(){le.current=0,K.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ue=[].slice.call(arguments);le.current+=1,ke.apply(void 0,ue),le.current>=2&&(ke.cancel(),le.current=0,X.apply(void 0,ue))});function Ge(ue,Le){if(M.current=0,(re||G)&&T){I({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Qe=hf(ae,P/O);if(Xt(ne,J,ce,Ce,O,S,ae,Qe,Me,W,ve),_(ue,Le),he===ue&&Z===Le){if(re)return void It(ue,Le);G&&E(ue,Le)}}}function bt(ue,Le,Qe){Qe===void 0&&(Qe=0),I({touched:!0,CX:ue,CY:Le,lastCX:ue,lastCY:Le,lastX:ne,lastY:J,lastScale:ae,touchLength:Qe,touchTime:Date.now()})}function $t(ue){I({maskTouched:!0,CX:ue.clientX,CY:ue.clientY,lastX:ne,lastY:J})}go(Hs?void 0:"mousemove",function(ue){ue.preventDefault(),Tt(ue.clientX,ue.clientY)}),go(Hs?void 0:"mouseup",function(ue){Ge(ue.clientX,ue.clientY)}),go(Hs?"touchmove":void 0,function(ue){ue.preventDefault();var Le=D_(ue);Tt.apply(void 0,Le)},{passive:!1}),go(Hs?"touchend":void 0,function(ue){var Le=ue.changedTouches[0];Ge(Le.clientX,Le.clientY)},{passive:!1}),go("resize",pf(function(){V&&!re&&(I(Fg(P,A,W)),k())},{maxWait:8})),Zy(function(){T&&C(vn({scale:ae,rotate:W},_t))},[T]);var Tn=function(ue,Le,Qe,on,ln,ie,_e,ye,Pe,He){var qe=function(er,vr,zt,Nn,Pn){var tr=v.useRef(!1),zn=sp({lead:!0,scale:zt}),Sn=zn[0],st=Sn.lead,An=Sn.scale,jt=zn[1],Qt=pf(function(Cn){try{return Pn(!0),jt({lead:!1,scale:Cn}),Promise.resolve()}catch(jn){return Promise.reject(jn)}},{wait:Nn});return Zy(function(){tr.current?(Pn(!1),jt({lead:!0}),Qt(zt)):tr.current=!0},[zt]),st?[er*An,vr*An,zt/An]:[er*zt,vr*zt,1]}(ie,_e,ye,Pe,He),yt=qe[0],Rt=qe[1],Ot=qe[2],mn=function(er,vr,zt,Nn,Pn){var tr=v.useState($9),zn=tr[0],Sn=tr[1],st=v.useState(0),An=st[0],jt=st[1],Qt=v.useRef(),Cn=Ia({OK:function(){return er&&jt(4)}});function jn(xn){Pn(!1),jt(xn)}return v.useEffect(function(){if(Qt.current||(Qt.current=Date.now()),zt){if(function(xn,te){var Ne=xn&&xn.current;if(Ne&&Ne.nodeType===1){var Ie=Ne.getBoundingClientRect();te({T:Ie.top,L:Ie.left,W:Ie.width,H:Ie.height,FIT:Ne.tagName==="IMG"?getComputedStyle(Ne).objectFit:void 0})}}(vr,Sn),er)return Date.now()-Qt.current<250?(jt(1),requestAnimationFrame(function(){jt(2),requestAnimationFrame(function(){return jn(3)})}),void setTimeout(Cn.OK,Nn)):void jt(4);jn(5)}},[er,zt]),[An,zn]}(ue,Le,Qe,Pe,He),gn=mn[0],Ht=mn[1],kn=Ht.W,Jn=Ht.FIT,wr=innerWidth/2,Dn=innerHeight/2,Hn=gn<3||gn>4;return[Hn?kn?Ht.L:wr:on+(wr-ie*ye/2),Hn?kn?Ht.T:Dn:ln+(Dn-_e*ye/2),yt,Hn&&Jn?yt*(Ht.H/kn):Rt,gn===0?Ot:Hn?kn/(ie*ye)||.01:Ot,Hn?Jn?1:0:1,gn,Jn]}(u,l,V,ne,J,O,S,ae,d,function(ue){return I({pause:ue})}),Ue=Tn[4],rt=Tn[6],tt="transform "+d+"ms "+f,gt={className:p,onMouseDown:Hs?void 0:function(ue){ue.stopPropagation(),ue.button===0&&bt(ue.clientX,ue.clientY,0)},onTouchStart:Hs?function(ue){ue.stopPropagation(),bt.apply(void 0,D_(ue))}:void 0,onWheel:function(ue){if(!oe){var Le=hf(ae-ue.deltaY/100/2,P/O);I({stopRaf:!0}),we(Le,ue.clientX,ue.clientY)}},style:{width:Tn[2]+"px",height:Tn[3]+"px",opacity:Tn[5],objectFit:rt===4?void 0:Tn[7],transform:W?"rotate("+W+"deg)":void 0,transition:rt>2?tt+", opacity "+d+"ms ease, height "+(rt<4?d/2:rt>4?d:0)+"ms "+f:void 0}};return et.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Hs&&T?$t:void 0,onTouchStart:Hs&&T?function(ue){return $t(ue.touches[0])}:void 0},et.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Ue+", 0, 0, "+Ue+", "+Tn[0]+", "+Tn[1]+")",transition:re||Re?void 0:tt,willChange:T?"transform":void 0}},n?et.createElement(K9,vn({src:n,loaded:V,broken:D},gt,{onPhotoLoad:function(ue){I(vn({},ue,ue.loaded&&Fg(ue.naturalWidth||0,ue.naturalHeight||0,W)))},loadingElement:b,brokenElement:w})):r&&r({attrs:gt,scale:Ue,rotate:W})))}var j_={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function q9(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,s=e.easing,i=e.photoClosable,a=e.maskClosable,o=a===void 0||a,l=e.maskOpacity,u=l===void 0?1:l,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,b=e.toolbarRender,w=e.className,g=e.maskClassName,E=e.photoClassName,y=e.photoWrapClassName,_=e.loadingElement,k=e.brokenElement,T=e.images,C=e.index,N=C===void 0?0:C,R=e.onIndexChange,I=e.visible,M=e.onClose,B=e.afterClose,Y=e.portalContainer,P=sp(j_),U=P[0],A=P[1],L=v.useState(0),O=L[0],j=L[1],S=U.x,H=U.touched,V=U.pause,D=U.lastCX,ne=U.lastCY,J=U.bg,re=J===void 0?u:J,de=U.lastBg,G=U.overlay,W=U.minimal,ae=U.scale,he=U.rotate,Z=U.onScale,ce=U.onRotate,Ce=e.hasOwnProperty("index"),Ee=Ce?N:O,ge=Ce?R:j,Me=v.useRef(Ee),ve=T.length,$e=T[Ee],Re=typeof n=="boolean"?n:ve>n,oe=function(Ue,rt){var tt=v.useReducer(function(Qe){return!Qe},!1)[1],gt=v.useRef(0),ue=function(Qe){var on=v.useRef(Qe);function ln(ie){on.current=ie}return v.useMemo(function(){(function(ie){Ue?(ie(Ue),gt.current=1):gt.current=2})(ln)},[Qe]),[on.current,ln]}(Ue),Le=ue[1];return[ue[0],gt.current,function(){tt(),gt.current===2&&(Le(!1),rt&&rt()),gt.current=0}]}(I,B),_t=oe[0],we=oe[1],Tt=oe[2];Zy(function(){if(_t)return A({pause:!0,x:Ee*-(innerWidth+co)}),void(Me.current=Ee);A(j_)},[_t]);var ct=Ia({close:function(Ue){ce&&ce(0),A({overlay:!0,lastBg:re}),M(Ue)},changeIndex:function(Ue,rt){rt===void 0&&(rt=!1);var tt=Re?Me.current+(Ue-Ee):Ue,gt=ve-1,ue=Qy(tt,0,gt),Le=Re?tt:ue,Qe=innerWidth+co;A({touched:!1,lastCX:void 0,lastCY:void 0,x:-Qe*Le,pause:rt}),Me.current=Le,ge&&ge(Re?Ue<0?gt:Ue>gt?0:Ue:ue)}}),K=ct.close,X=ct.changeIndex;function le(Ue){return Ue?K():A({overlay:!G})}function ke(){A({x:-(innerWidth+co)*Ee,lastCX:void 0,lastCY:void 0,pause:!0}),Me.current=Ee}function Oe(Ue,rt,tt,gt){Ue==="x"?function(ue){if(D!==void 0){var Le=ue-D,Qe=Le;!Re&&(Ee===0&&Le>0||Ee===ve-1&&Le<0)&&(Qe=Le/2),A({touched:!0,lastCX:D,x:-(innerWidth+co)*Me.current+Qe,pause:!1})}else A({touched:!0,lastCX:ue,x:S,pause:!1})}(rt):Ue==="y"&&function(ue,Le){if(ne!==void 0){var Qe=u===null?null:Qy(u,.01,u-Math.abs(ue-ne)/100/4);A({touched:!0,lastCY:ne,bg:Le===1?Qe:u,minimal:Le===1})}else A({touched:!0,lastCY:ue,bg:re,minimal:!0})}(tt,gt)}function ut(Ue,rt){var tt=Ue-(D??Ue),gt=rt-(ne??rt),ue=!1;if(tt<-40)X(Ee+1);else if(tt>40)X(Ee-1);else{var Le=-(innerWidth+co)*Me.current;Math.abs(gt)>100&&W&&f&&(ue=!0,K()),A({touched:!1,x:Le,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ue||G})}}go("keydown",function(Ue){if(I)switch(Ue.key){case"ArrowLeft":X(Ee-1,!0);break;case"ArrowRight":X(Ee+1,!0);break;case"Escape":K()}});var We=function(Ue,rt,tt){return v.useMemo(function(){var gt=Ue.length;return tt?Ue.concat(Ue).concat(Ue).slice(gt+rt-1,gt+rt+2):Ue.slice(Math.max(rt-1,0),Math.min(rt+2,gt+1))},[Ue,rt,tt])}(T,Ee,Re);if(!_t)return null;var ot=G&&!we,Xt=I?re:de,It=Z&&ce&&{images:T,index:Ee,visible:I,onClose:K,onIndexChange:X,overlayVisible:ot,overlay:$e&&$e.overlay,scale:ae,rotate:he,onScale:Z,onRotate:ce},Ge=r?r(we):400,bt=s?s(we):M_,$t=r?r(3):600,Tn=s?s(3):M_;return et.createElement(D9,{className:"PhotoView-Portal"+(ot?"":" PhotoView-Slider__clean")+(I?"":" PhotoView-Slider__willClose")+(w?" "+w:""),role:"dialog",onClick:function(Ue){return Ue.stopPropagation()},container:Y},I&&et.createElement(F9,null),et.createElement("div",{className:"PhotoView-Slider__Backdrop"+(g?" "+g:"")+(we===1?" PhotoView-Slider__fadeIn":we===2?" PhotoView-Slider__fadeOut":""),style:{background:Xt?"rgba(0, 0, 0, "+Xt+")":void 0,transitionTimingFunction:bt,transitionDuration:(H?0:Ge)+"ms",animationDuration:Ge+"ms"},onAnimationEnd:Tt}),p&&et.createElement("div",{className:"PhotoView-Slider__BannerWrap"},et.createElement("div",{className:"PhotoView-Slider__Counter"},Ee+1," / ",ve),et.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&It&&b(It),et.createElement(P9,{className:"PhotoView-Slider__toolbarIcon",onClick:K}))),We.map(function(Ue,rt){var tt=Re||Ee!==0?Me.current-1+rt:Ee+rt;return et.createElement(W9,{key:Re?Ue.key+"/"+Ue.src+"/"+tt:Ue.key,item:Ue,speed:Ge,easing:bt,visible:I,onReachMove:Oe,onReachUp:ut,onPhotoTap:function(){return le(i)},onMaskTap:function(){return le(o)},wrapClassName:y,className:E,style:{left:(innerWidth+co)*tt+"px",transform:"translate3d("+S+"px, 0px, 0)",transition:H||V?void 0:"transform "+$t+"ms "+Tn},loadingElement:_,brokenElement:k,onPhotoResize:ke,isActive:Me.current===tt,expose:A})}),!Hs&&p&&et.createElement(et.Fragment,null,(Re||Ee!==0)&&et.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return X(Ee-1,!0)}},et.createElement(j9,null)),(Re||Ee+1-1){var g=u.slice();return g.splice(w,1,b),void o({images:g})}o(function(E){return{images:E.images.concat(b)}})},remove:function(b){o(function(w){var g=w.images.filter(function(E){return E.key!==b});return{images:g,index:Math.min(g.length-1,f)}})},show:function(b){var w=u.findIndex(function(g){return g.key===b});o({visible:!0,index:w}),r&&r(!0,w,a)}}),p=Ia({close:function(){o({visible:!1}),r&&r(!1,f,a)},changeIndex:function(b){o({index:b}),n&&n(b,a)}}),m=v.useMemo(function(){return vn({},a,h)},[a,h]);return et.createElement(pI.Provider,{value:m},t,et.createElement(q9,vn({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var gI=function(e){var t,n,r=e.src,s=e.render,i=e.overlay,a=e.width,o=e.height,l=e.triggers,u=l===void 0?["onClick"]:l,d=e.children,f=v.useContext(pI),h=(t=function(){return f.nextId()},(n=v.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=v.useRef(null);v.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),v.useEffect(function(){return function(){f.remove(h)}},[]);var m=Ia({render:function(w){return s&&s(w)},show:function(w,g){f.show(h),function(E,y){if(d){var _=d.props[E];_&&_(y)}}(w,g)}}),b=v.useMemo(function(){var w={};return u.forEach(function(g){w[g]=m.show.bind(null,g)}),w},[]);return v.useEffect(function(){f.update({key:h,src:r,originRef:p,render:m.render,overlay:i,width:a,height:o})},[r]),d?v.Children.only(v.cloneElement(d,vn({},b,{ref:p}))):null};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z9=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yI=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var J9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eF=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...o},l)=>v.createElement("svg",{ref:l,...J9,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yI("lucide",s),...o},[...a.map(([u,d])=>v.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Te=(e,t)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement(eF,{ref:i,iconNode:t,className:yI(`lucide-${Z9(e)}`,r),...s}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tF=Te("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bI=Te("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nF=Te("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EI=Te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xI=Te("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wI=Te("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rF=Te("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $a=Te("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vI=Te("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sF=Te("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iF=Te("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ds=Te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ip=Te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aF=Te("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const or=Te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _I=Te("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oF=Te("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lF=Te("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cF=Te("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vE=Te("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _E=Te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TI=Te("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ah=Te("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TE=Te("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uF=Te("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kE=Te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dF=Te("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kI=Te("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B_=Te("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fF=Te("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hF=Te("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NI=Te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pF=Te("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SI=Te("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mF=Te("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gF=Te("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NE=Te("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AI=Te("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CI=Te("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yF=Te("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lm=Te("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bF=Te("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EF=Te("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const II=Te("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cd=Te("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xF=Te("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RI=Te("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wF=Te("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vF=Te("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _F=Te("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TF=Te("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wt=Te("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kF=Te("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NF=Te("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wc=Te("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OI=Te("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SF=Te("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AF=Te("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CF=Te("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LI=Te("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IF=Te("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RF=Te("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OF=Te("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LF=Te("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hs=Te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SE=Te("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AE=Te("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MF=Te("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MI=Te("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e1=Te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DF=Te("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PF=Te("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F_=Te("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ha=Te("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DI=Te("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jl=Te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jF=Te("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BF=Te("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FF=Te("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UF=Te("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $F=Te("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CE=Te("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Gr=Te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),U_="veadk_auth_qs";let cc=null;function HF(){if(cc!==null)return cc;const e=window.location.search.replace(/^\?/,"");return e?(sessionStorage.setItem(U_,e),window.history.replaceState(null,"",window.location.pathname+window.location.hash),cc=e):cc=sessionStorage.getItem(U_)??"",cc}function Os(e){const t=HF();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const zF=/\brun_sse\s*failed\s*:\s*404\b/i,$_="提示:该 404 可能是多实例部署使用 in-memory 或 SQLite 短期记忆导致的:请求落到不同实例后,会话无法找到。请改用基于数据库的持久化短期记忆存储。";function mf(e){const t=String(e);return!zF.test(t)||t.includes($_)?t:`${t} + +${$_}`}async function*IE(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let r="";try{for(;;){const{done:s,value:i}=await t.read();if(s)break;r+=n.decode(i,{stream:!0});let a=r.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const o=r.slice(0,a.index);r=r.slice(a.index+a[0].length);const l=o.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` +`);if(l)try{yield JSON.parse(l)}catch{l!=="[DONE]"&&l!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${l.length} chars):`,l.slice(0,200))}a=r.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const cm=3e4,VF=12e4,PI=1e4;function ti(e,t=cm){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const ap="veadk_local_user",op="veadk_local_user_tab",KF=/^[A-Za-z0-9]{1,16}$/;function jI(){try{const e=sessionStorage.getItem(op);if(e)return e;const t=localStorage.getItem(ap);return t&&sessionStorage.setItem(op,t),t}catch{try{return localStorage.getItem(ap)}catch{return null}}}function H_(e){try{sessionStorage.setItem(op,e)}catch{}try{localStorage.setItem(ap,e)}catch{}}function YF(){try{sessionStorage.removeItem(op)}catch{}try{localStorage.removeItem(ap)}catch{}}function um(e){const t=new Headers(e),n=jI();return n&&t.set("X-VeADK-Local-User",n),t}async function WF(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:ti(void 0,PI)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function qF(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function GF(){window.location.assign("/oauth2/logout")}async function XF(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:ti(void 0,PI)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=jI();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function QF(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function ZF(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const oh="",RE=new Map;function BI(e,t){RE.set(e,t)}function FI(){RE.clear()}function ms(e){const t=RE.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}function At(e,t={},n={},r=cm){const s={...t,headers:um(t.headers),signal:ti(t.signal,r)};if(n.runtimeId){const i=n.region?`${e.includes("?")?"&":"?"}region=${encodeURIComponent(n.region)}`:"";return fetch(Os(`${oh}/web/runtime-proxy/${n.runtimeId}${e}${i}`),s)}if(n.base){const i=new Headers(s.headers);return i.set("X-AgentKit-Base",n.base),n.apiKey&&i.set("X-AgentKit-Key",n.apiKey),fetch(Os(`${oh}/agentkit-proxy${e}`),{...s,headers:i})}return fetch(Os(`${oh}${e}`),s)}function JF(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const r=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return r?`${r}: ${s}`:s}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function Zr(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const r=JSON.parse(n);return JF(r.detail??r.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function UI(){const e=await At("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class ud extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Ru extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}async function eU(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function dm(e,t,n){const r=await At("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await eU(r):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new ud;if(n!=null&&n.runtimeId&&r.status===404)throw new Ru("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new Ru("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await Zr(r,"读取 Agent 列表失败"));return r.json()}async function lp(e,t){const{app:n,ep:r}=ms(e),s=await At(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!s.ok)throw new Error(`create session failed: ${s.status}`);return(await s.json()).id}async function OE(e,t){const{app:n,ep:r}=ms(e),s=await At(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function cp(e,t,n){const{app:r,ep:s}=ms(e),i=await At(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{},s);if(!i.ok)throw new Error(`get session failed: ${i.status}`);return i.json()}async function t1(e,t,n){const{app:r,ep:s}=ms(e),i=await At(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!i.ok&&i.status!==404)throw new Error(`delete session failed: ${i.status}`)}async function tU(e){const t=await At("/web/media/capabilities");if(!t.ok)throw new Error(await Zr(t,"media capabilities failed"));return t.json()}async function $I(e,t,n,r){const{app:s}=ms(e),i=new FormData;i.set("app_name",s),i.set("user_id",t),i.set("session_id",n),i.set("file",r);const a=await At("/web/media",{method:"POST",body:i},{},VF);if(!a.ok)throw new Error(await Zr(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function n1(e,t,n){const{app:r}=ms(e),s=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,i=await At(s,{method:"DELETE"});if(!i.ok&&i.status!==404)throw new Error(await Zr(i,"media cleanup failed"))}function HI(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((r,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function lh(e,t){const n=HI(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await At(n,{method:"DELETE"});if(!r.ok&&r.status!==404)throw new Error(await Zr(r,"media cleanup failed"))}function zI(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=HI(t);if(!n)return t;const r=`${n}/content`;return Os(`${oh}${r}`)}async function VI(e,t){const{app:n,ep:r}=ms(e),s=await At(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const i=s.headers.get("content-type")??"";if(!i.includes("application/json")){const o=i.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${o}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}async function KI(e,t){const n=await At(`/web/agent-info/${e}`,{},t);if(!n.ok)throw new Error(`agent-info failed: ${n.status}`);const r=await n.json();return{name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph}}async function dd(e){const{app:t,ep:n}=ms(e);return KI(t,n)}async function YI(e,t){const n={runtimeId:e,region:t},s=(await dm("","",n))[0];if(!s)throw new Error("该 Runtime 未提供可预览的 Agent。");return KI(s,n)}async function WI(e,t,n,r){const{app:s,ep:i}=ms(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:r}),o=await At(`/web/search?${a.toString()}`,{},i);if(!o.ok)throw new Error(await Zr(o,"Agent 检索失败"));return o.json()}async function qI(e,t){const{app:n}=ms(e),r=await At(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`web search failed: ${r.status}`);return r.json()}async function*Ou({appName:e,userId:t,sessionId:n,text:r,attachments:s=[],invocation:i,functionResponses:a=[],signal:o}){const{app:l,ep:u}=ms(e),d=s.flatMap(m=>m.status&&m.status!=="ready"?[]:m.uri?[{fileData:{mimeType:m.mimeType,fileUri:m.uri,displayName:m.name},partMetadata:{veadkMedia:{id:m.id,uri:m.uri,name:m.name,mimeType:m.mimeType,sizeBytes:m.sizeBytes}}}]:m.data?[{inlineData:{mimeType:m.mimeType,data:m.data,displayName:m.name}}]:[]),f=i&&(i.skills.length>0||i.targetAgent)?i:void 0,h=[...d,...a.map(m=>({functionResponse:{id:m.id,name:m.name,response:m.response}})),...r.trim()?[{text:r}]:[]];if(f&&h.length>0){const m=h[0],b=m.partMetadata;h[0]={...m,partMetadata:{...b,veadkInvocation:f}}}const p=await At("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:l,user_id:t,session_id:n,new_message:{role:"user",parts:h},streaming:!0,custom_metadata:f?{veadkInvocation:f}:void 0}),signal:o},u,0);if(!p.ok)throw new Error(mf(`run_sse failed: ${p.status}`));for await(const m of IE(p)){const b=m;typeof b.error=="string"&&(b.error=mf(b.error)),typeof b.errorMessage=="string"&&(b.errorMessage=mf(b.errorMessage)),typeof b.error_message=="string"&&(b.error_message=mf(b.error_message)),yield b}}const qc=new Map;async function LE(e,t,n,r){var u;const s=r==null?void 0:r.taskId,i=s?new AbortController:void 0;s&&i&&qc.set(s,i);const a=()=>{s&&qc.get(s)===i&&qc.delete(s)};let o;try{o=await At("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:i==null?void 0:i.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:s,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs})},{},0)}catch(d){throw a(),d}if(!o.ok){const d=await o.text().catch(()=>"");throw a(),new Error(d||`部署失败 (${o.status})`)}let l=null;try{for await(const d of IE(o)){const f=d;if(f&&f.done){l=f;break}f&&f.message&&((u=r==null?void 0:r.onStage)==null||u.call(r,f))}}catch(d){throw a(),d}if(a(),!l)throw new Error("部署失败:连接中断");if(!l.success)throw new Error(l.error||"部署失败");if(!l.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!l.runtimeId&&!l.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:l.apikey??"",url:l.url??"",agentName:l.agentName,runtimeId:l.runtimeId,consoleUrl:l.consoleUrl,region:l.region,feishuChannel:l.feishuChannel}}async function GI(e){var n;const t=await At("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||`取消部署失败 (${t.status})`)}(n=qc.get(e))==null||n.abort(),qc.delete(e)}async function XI(e="cn-beijing"){const t=await At(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Lu={title:"VeADK Studio",logoUrl:""},Ug={studio:!1,branding:Lu,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function QI(){var e,t;try{const n=await At("/web/ui-config");if(!n.ok)return Ug;const r=await n.json(),s=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Lu.logoUrl;return{studio:r.studio??!1,branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:Lu.title,logoUrl:s?Os(s):""},features:{...Ug.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local"}}catch{return Ug}}const ZI={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function JI(){var n,r,s;const e=await At("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function ch(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await At(`/web/runtimes?${t.toString()}`);if(!n.ok)throw new Error(`加载 Runtime 失败 (${n.status})`);const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function eR(e,t="cn-beijing"){try{return await dm("","",{runtimeId:e,region:t})}catch(n){if(n instanceof ud||n instanceof Ru)throw n;return null}}async function tR(e,t="cn-beijing"){const n=await At("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(r||`删除失败 (${n.status})`)}}async function ME(e,t="cn-beijing"){const n=await At(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Zr(n,"加载 Runtime 详情失败"));return n.json()}async function up(e){const t=await At("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Zr(t,"生成项目失败"));return t.json()}async function nR(e){const t=await At("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Zr(t,"创建调试运行失败"));return t.json()}async function rR(e,t){const n=await At(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await Zr(n,"创建调试会话失败"));return(await n.json()).id}async function*sR({runId:e,userId:t,sessionId:n,text:r,signal:s}){const i=r.trim()?[{text:r}]:[],a=await At(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:i},streaming:!0}),signal:s},{},0);if(!a.ok)throw new Error(await Zr(a,"调试运行失败"));for await(const o of IE(a))yield o}async function r1(e){const t=await At(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Zr(t,"清理调试运行失败"))}const nU=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Lu,DEFAULT_STUDIO_ACCESS:ZI,RuntimeAccessDeniedError:ud,RuntimeProbeError:Ru,cancelAgentkitDeployment:GI,clearRemoteApps:FI,componentSearch:WI,createGeneratedAgentTestRun:nR,createGeneratedAgentTestSession:rR,createSession:lp,deleteGeneratedAgentTestRun:r1,deleteMedia:lh,deleteRuntime:tR,deleteSession:t1,deleteSessionMedia:n1,deployAgentkitProject:LE,fetchRemoteApps:dm,generateAgentProject:up,getAgentInfo:dd,getMediaCapabilities:tU,getMyRuntimes:XI,getRuntimeAgentInfo:YI,getRuntimeDetail:ME,getRuntimes:ch,getSession:cp,getSessionTrace:VI,getStudioAccess:JI,getUiConfig:QI,listApps:UI,listSessions:OE,mediaContentUrl:zI,probeRuntimeApps:eR,registerRemoteApp:BI,runGeneratedAgentTestSSE:sR,runSSE:Ou,uploadMedia:$I,webSearch:qI},Symbol.toStringTag,{value:"Module"})),rU="send_a2ui_json_to_client",sU="validated_a2ui_json",s1="adk_request_credential";function iU(e){var r,s,i,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.rawAuthCredential)==null?void 0:i.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function qs(){return{blocks:[],liveStart:0}}const z_=e=>e.functionCall??e.function_call,i1=e=>e.functionResponse??e.function_response;function aU(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function iR(e){const t=[];for(const[n,r]of e.entries()){const s=r.partMetadata??r.part_metadata,i=s==null?void 0:s.veadkTransport;if((i==null?void 0:i.hidden)===!0)continue;const a=s==null?void 0:s.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=r.inlineData??r.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:aU(o.data),name:o.displayName??o.display_name});continue}const l=r.fileData??r.file_data,u=(l==null?void 0:l.fileUri)??(l==null?void 0:l.file_uri);l&&u&&t.push({id:u,mimeType:l.mimeType??l.mime_type,uri:u,name:l.displayName??l.display_name})}return t}function a1(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const oU=new Set(["llm","sequential","parallel","loop","a2a"]);function lU(e){var t;for(const n of e){const r=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!r||typeof r!="object")continue;const s=r,i=Array.isArray(s.skills)?s.skills.flatMap(l=>{if(!l||typeof l!="object")return[];const u=l;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=s.targetAgent;if(o&&typeof o=="object"){const l=o,u=l.type;typeof l.name=="string"&&typeof u=="string"&&oU.has(u)&&Array.isArray(l.path)&&(a={name:l.name,description:typeof l.description=="string"?l.description:"",type:u,path:l.path.filter(d=>typeof d=="string")})}if(i.length>0||a)return{skills:i,targetAgent:a}}}function cU(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function V_(e,t,n){const r=e[e.length-1];r&&r.kind===t?r.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function gf(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function pl(e,t){var a,o;const n=e.blocks.map(l=>({...l}));let r=e.liveStart;const s=((a=t.content)==null?void 0:a.parts)??[],i=s.some(l=>z_(l)||i1(l));if(t.partial&&!i){for(const l of s){const u=a1(l);typeof u=="string"&&u&&V_(n,l.thought?"thinking":"text",u)}return{blocks:n,liveStart:r}}n.length=r;for(const l of s){const u=z_(l),d=i1(l),f=iR([l]),h=a1(l);if(typeof h=="string"&&h)V_(n,l.thought?"thinking":"text",h);else if(f.length)gf(n),cU(n,f);else if(u)if(gf(n),u.name===s1){const p=u.args??{},m=p.authConfig??p.auth_config??p,w=String(p.functionCallId??p.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:u.id??"",label:w,authUri:iU(m),authConfig:m,done:!1})}else n.push({kind:"tool",name:u.name??"",args:u.args,done:!1});else if(d){if(gf(n),d.name===s1)for(let p=n.length-1;p>=0;p--){const m=n[p];if(m.kind==="auth"&&!m.done){m.done=!0;break}}for(let p=n.length-1;p>=0;p--){const m=n[p];if(m.kind==="tool"&&!m.done&&m.name===d.name){m.done=!0,m.response=d.response;break}}if(d.name===rU){const p=((o=d.response)==null?void 0:o[sU])??[];if(p.length){const m=n[n.length-1];m&&m.kind==="a2ui"?m.messages.push(...p):n.push({kind:"a2ui",messages:p})}}}}return gf(n),r=n.length,{blocks:n,liveStart:r}}function uU(e){var r;const t=[];let n=qs();for(const s of e)if(s.author==="user"){const a=((r=s.content)==null?void 0:r.parts)??[];if(a.some(f=>{var h;return((h=i1(f))==null?void 0:h.name)===s1})){for(let f=t.length-1;f>=0;f--)if(t[f].role==="assistant"){for(let h=t[f].blocks.length-1;h>=0;h--){const p=t[f].blocks[h];if(p.kind==="auth"){p.done=!0;break}}break}}const o=a.map(a1).filter(f=>!!f).join(""),l=iR(a),u=lU(a);if(!o&&!l.length&&!u){n=qs();continue}const d=[];u&&d.push({kind:"invocation",value:u}),l.length&&d.push({kind:"attachment",files:l}),o&&d.push({kind:"text",text:o}),t.push({role:"user",blocks:d,meta:{ts:s.timestamp}}),n=qs()}else{let a=t[t.length-1];(!a||a.role!=="assistant")&&(a={role:"assistant",blocks:[],meta:{}},t.push(a),n=qs()),n=pl(n,s),a.blocks=n.blocks;const o=s.usageMetadata??s.usage_metadata,l=a.meta??(a.meta={});o!=null&&o.totalTokenCount&&(l.tokens=o.totalTokenCount),s.timestamp&&(l.ts=s.timestamp)}return t}function aR(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"新会话"}async function fd(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ti(void 0,cm)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function dU(){return(await fd("/web/skill-spaces?region=all")).items||[]}async function fU(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),fd(`/web/skill-spaces?${t.toString()}`)}async function hU(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await fd(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function pU(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),fd(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function mU(e,t,n,r,s){const i=[];n&&i.push(`version=${encodeURIComponent(n)}`),r&&i.push(`region=${encodeURIComponent(r)}`),s&&i.push(`project=${encodeURIComponent(s)}`);const a=i.length>0?`?${i.join("&")}`:"";return fd(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function gU(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function yU(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}function ede(){}function K_(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function oR(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const bU=/[$_\p{ID_Start}]/u,EU=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,xU=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,wU=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vU=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lR={};function tde(e){return e?bU.test(String.fromCodePoint(e)):!1}function nde(e,t){const r=(t||lR).jsx?xU:EU;return e?r.test(String.fromCodePoint(e)):!1}function Y_(e,t){return(lR.jsx?vU:wU).test(e)}const _U=/[ \t\n\f\r]/g;function TU(e){return typeof e=="object"?e.type==="text"?W_(e.value):!1:W_(e)}function W_(e){return e.replace(_U,"")===""}let hd=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};hd.prototype.normal={};hd.prototype.property={};hd.prototype.space=void 0;function cR(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new hd(n,r,t)}function Mu(e){return e.toLowerCase()}class xr{constructor(t,n){this.attribute=n,this.property=t}}xr.prototype.attribute="";xr.prototype.booleanish=!1;xr.prototype.boolean=!1;xr.prototype.commaOrSpaceSeparated=!1;xr.prototype.commaSeparated=!1;xr.prototype.defined=!1;xr.prototype.mustUseProperty=!1;xr.prototype.number=!1;xr.prototype.overloadedBoolean=!1;xr.prototype.property="";xr.prototype.spaceSeparated=!1;xr.prototype.space=void 0;let kU=0;const Je=eo(),yn=eo(),o1=eo(),be=eo(),Mt=eo(),Qo=eo(),kr=eo();function eo(){return 2**++kU}const l1=Object.freeze(Object.defineProperty({__proto__:null,boolean:Je,booleanish:yn,commaOrSpaceSeparated:kr,commaSeparated:Qo,number:be,overloadedBoolean:o1,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),$g=Object.keys(l1);class DE extends xr{constructor(t,n,r,s){let i=-1;if(super(t,n),q_(this,"space",s),typeof r=="number")for(;++i<$g.length;){const a=$g[i];q_(this,$g[i],(r&l1[a])===l1[a])}}}DE.prototype.defined=!0;function q_(e,t,n){n&&(e[t]=n)}function Bl(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new DE(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Mu(r)]=r,n[Mu(i.attribute)]=r}return new hd(t,n,e.space)}const uR=Bl({properties:{ariaActiveDescendant:null,ariaAtomic:yn,ariaAutoComplete:null,ariaBusy:yn,ariaChecked:yn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Mt,ariaCurrent:null,ariaDescribedBy:Mt,ariaDetails:null,ariaDisabled:yn,ariaDropEffect:Mt,ariaErrorMessage:null,ariaExpanded:yn,ariaFlowTo:Mt,ariaGrabbed:yn,ariaHasPopup:null,ariaHidden:yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Mt,ariaLevel:be,ariaLive:null,ariaModal:yn,ariaMultiLine:yn,ariaMultiSelectable:yn,ariaOrientation:null,ariaOwns:Mt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:yn,ariaReadOnly:yn,ariaRelevant:null,ariaRequired:yn,ariaRoleDescription:Mt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:yn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function dR(e,t){return t in e?e[t]:t}function fR(e,t){return dR(e,t.toLowerCase())}const NU=Bl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qo,acceptCharset:Mt,accessKey:Mt,action:null,allow:null,allowFullScreen:Je,allowPaymentRequest:Je,allowUserMedia:Je,alt:null,as:null,async:Je,autoCapitalize:null,autoComplete:Mt,autoFocus:Je,autoPlay:Je,blocking:Mt,capture:null,charSet:null,checked:Je,cite:null,className:Mt,cols:be,colSpan:null,content:null,contentEditable:yn,controls:Je,controlsList:Mt,coords:be|Qo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Je,defer:Je,dir:null,dirName:null,disabled:Je,download:o1,draggable:yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Je,formTarget:null,headers:Mt,height:be,hidden:o1,high:be,href:null,hrefLang:null,htmlFor:Mt,httpEquiv:Mt,id:null,imageSizes:null,imageSrcSet:null,inert:Je,inputMode:null,integrity:null,is:null,isMap:Je,itemId:null,itemProp:Mt,itemRef:Mt,itemScope:Je,itemType:Mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Je,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Je,muted:Je,name:null,nonce:null,noModule:Je,noValidate:Je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Je,optimum:be,pattern:null,ping:Mt,placeholder:null,playsInline:Je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Je,referrerPolicy:null,rel:Mt,required:Je,reversed:Je,rows:be,rowSpan:be,sandbox:Mt,scope:null,scoped:Je,seamless:Je,selected:Je,shadowRootClonable:Je,shadowRootDelegatesFocus:Je,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:yn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Je,useMap:null,value:yn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Mt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Je,declare:Je,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Je,noHref:Je,noShade:Je,noWrap:Je,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:yn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Je,disableRemotePlayback:Je,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:fR}),SU=Bl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:kr,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Mt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Je,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Qo,g2:Qo,glyphName:Qo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:kr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kr,rev:kr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kr,requiredFeatures:kr,requiredFonts:kr,requiredFormats:kr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:kr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kr,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:dR}),hR=Bl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),pR=Bl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fR}),mR=Bl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),AU={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},CU=/[A-Z]/g,G_=/-[a-z]/g,IU=/^data[-\w.:]+$/i;function fm(e,t){const n=Mu(t);let r=t,s=xr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&IU.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(G_,OU);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!G_.test(i)){let a=i.replace(CU,RU);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=DE}return new s(r,t)}function RU(e){return"-"+e.toLowerCase()}function OU(e){return e.charAt(1).toUpperCase()}const pd=cR([uR,NU,hR,pR,mR],"html"),ea=cR([uR,SU,hR,pR,mR],"svg");function X_(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function gR(e){return e.join(" ").trim()}var PE={},Q_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,LU=/\n/g,MU=/^\s*/,DU=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,PU=/^:\s*/,jU=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,BU=/^[;\s]*/,FU=/^\s+|\s+$/g,UU=` +`,Z_="/",J_="*",ba="",$U="comment",HU="declaration";function zU(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var b=m.match(LU);b&&(n+=b.length);var w=m.lastIndexOf(UU);r=~w?m.length-w:r+m.length}function i(){var m={line:n,column:r};return function(b){return b.position=new a(m),u(),b}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var b=new Error(t.source+":"+n+":"+r+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(m){var b=m.exec(e);if(b){var w=b[0];return s(w),e=e.slice(w.length),b}}function u(){l(MU)}function d(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=i();if(!(Z_!=e.charAt(0)||J_!=e.charAt(1))){for(var b=2;ba!=e.charAt(b)&&(J_!=e.charAt(b)||Z_!=e.charAt(b+1));)++b;if(b+=2,ba===e.charAt(b-1))return o("End of comment missing");var w=e.slice(2,b-2);return r+=2,s(w),e=e.slice(b),r+=2,m({type:$U,comment:w})}}function h(){var m=i(),b=l(DU);if(b){if(f(),!l(PU))return o("property missing ':'");var w=l(jU),g=m({type:HU,property:eT(b[0].replace(Q_,ba)),value:w?eT(w[0].replace(Q_,ba)):ba});return l(BU),g}}function p(){var m=[];d(m);for(var b;b=h();)b!==!1&&(m.push(b),d(m));return m}return u(),p()}function eT(e){return e?e.replace(FU,ba):ba}var VU=zU,KU=Nh&&Nh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(PE,"__esModule",{value:!0});PE.default=WU;const YU=KU(VU);function WU(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,YU.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:o}=i;s?t(a,o,i):o&&(n=n||{},n[a]=o)}),n}var hm={};Object.defineProperty(hm,"__esModule",{value:!0});hm.camelCase=void 0;var qU=/^--[a-zA-Z0-9_-]+$/,GU=/-([a-z])/g,XU=/^[^-]+$/,QU=/^-(webkit|moz|ms|o|khtml)-/,ZU=/^-(ms)-/,JU=function(e){return!e||XU.test(e)||qU.test(e)},e7=function(e,t){return t.toUpperCase()},tT=function(e,t){return"".concat(t,"-")},t7=function(e,t){return t===void 0&&(t={}),JU(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ZU,tT):e=e.replace(QU,tT),e.replace(GU,e7))};hm.camelCase=t7;var n7=Nh&&Nh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},r7=n7(PE),s7=hm;function c1(e,t){var n={};return!e||typeof e!="string"||(0,r7.default)(e,function(r,s){r&&s&&(n[(0,s7.camelCase)(r,t)]=s)}),n}c1.default=c1;var i7=c1;const a7=Ju(i7),pm=yR("end"),Ps=yR("start");function yR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function o7(e){const t=Ps(e),n=pm(e);if(t&&n)return{start:t,end:n}}function Gc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nT(e.position):"start"in e||"end"in e?nT(e):"line"in e||"column"in e?u1(e):""}function u1(e){return rT(e&&e.line)+":"+rT(e&&e.column)}function nT(e){return u1(e&&e.start)+"-"+u1(e&&e.end)}function rT(e){return e&&typeof e=="number"?e:1}class Qn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Gc(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qn.prototype.file="";Qn.prototype.name="";Qn.prototype.reason="";Qn.prototype.message="";Qn.prototype.stack="";Qn.prototype.column=void 0;Qn.prototype.line=void 0;Qn.prototype.ancestors=void 0;Qn.prototype.cause=void 0;Qn.prototype.fatal=void 0;Qn.prototype.place=void 0;Qn.prototype.ruleId=void 0;Qn.prototype.source=void 0;const jE={}.hasOwnProperty,l7=new Map,c7=/[A-Z]/g,u7=new Set(["table","tbody","thead","tfoot","tr"]),d7=new Set(["td","th"]),bR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function f7(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=x7(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=E7(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ea:pd,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=ER(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function ER(e,t,n){if(t.type==="element")return h7(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return p7(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return g7(e,t,n);if(t.type==="mdxjsEsm")return m7(e,t);if(t.type==="root")return y7(e,t,n);if(t.type==="text")return b7(e,t)}function h7(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=ea,e.schema=s),e.ancestors.push(t);const i=wR(e,t.tagName,!1),a=w7(e,t);let o=FE(e,t);return u7.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!TU(l):!0})),xR(e,a,i,t),BE(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function p7(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Du(e,t.position)}function m7(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Du(e,t.position)}function g7(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=ea,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:wR(e,t.name,!0),a=v7(e,t),o=FE(e,t);return xR(e,a,i,t),BE(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function y7(e,t,n){const r={};return BE(r,FE(e,t)),e.create(t,e.Fragment,r,n)}function b7(e,t){return t.value}function xR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function BE(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function E7(e,t,n){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?n:t;return o?u(i,a,o):u(i,a)}}function x7(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),l=Ps(r);return t(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function w7(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&jE.call(t.properties,s)){const i=_7(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&d7.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function v7(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Du(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Du(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function FE(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:l7;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i0?(Rr(e,e.length,0,t),e):t}const aT={}.hasOwnProperty;function _R(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ds(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ir=ta(/[A-Za-z]/),Gn=ta(/[\dA-Za-z]/),O7=ta(/[#-'*+\--9=?A-Z^-~]/);function dp(e){return e!==null&&(e<32||e===127)}const d1=ta(/\d/),L7=ta(/[\dA-Fa-f]/),M7=ta(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Ct(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const mm=ta(new RegExp("\\p{P}|\\p{S}","u")),za=ta(/\s/);function ta(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Fl(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function dt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return it(l)?(e.enter(n),o(l)):t(l)}function o(l){return it(l)&&i++a))return;const C=t.events.length;let N=C,R,I;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(R){I=t.events[N][1].end;break}R=!0}for(g(r),T=C;Ty;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=y}function E(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function F7(e,t,n){return dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ml(e){if(e===null||Ct(e)||za(e))return 1;if(mm(e))return 2}function gm(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};lT(f,-l),lT(h,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=$r(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=$r(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=$r(u,gm(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=$r(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=$r(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Rr(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&it(T)?dt(e,E,"linePrefix",i+1)(T):E(T)}function E(T){return T===null||Fe(T)?e.check(cT,b,_)(T):(e.enter("codeFlowValue"),y(T))}function y(T){return T===null||Fe(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),y)}function _(T){return e.exit("codeFenced"),t(T)}function k(T,C,N){let R=0;return I;function I(U){return T.enter("lineEnding"),T.consume(U),T.exit("lineEnding"),M}function M(U){return T.enter("codeFencedFence"),it(U)?dt(T,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):B(U)}function B(U){return U===o?(T.enter("codeFencedFenceSequence"),Y(U)):N(U)}function Y(U){return U===o?(R++,T.consume(U),Y):R>=a?(T.exit("codeFencedFenceSequence"),it(U)?dt(T,P,"whitespace")(U):P(U)):N(U)}function P(U){return U===null||Fe(U)?(T.exit("codeFencedFence"),C(U)):N(U)}}}function Q7(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const zg={name:"codeIndented",tokenize:J7},Z7={partial:!0,tokenize:e$};function J7(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),dt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):Fe(u)?e.attempt(Z7,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Fe(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function e$(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):Fe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):dt(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):Fe(a)?s(a):n(a)}}const t$={name:"codeText",previous:r$,resolve:n$,tokenize:s$};function n$(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&uc(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),uc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),uc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function CR(e,t,n,r,s,i,a,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),h):g===null||g===32||g===41||dp(g)?n(g):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),b(g))}function h(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(o),h(g)):g===null||g===60||Fe(g)?n(g):(e.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function b(g){return!d&&(g===null||g===41||Ct(g))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(g)):d999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Fe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Fe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!it(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function RR(e,t,n,r,s,i){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,l):n(h)}function l(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===a?(e.exit(i),l(a)):h===null?n(h):Fe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),dt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Fe(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function Xc(e,t){let n;return r;function r(s){return Fe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):it(s)?dt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const f$={name:"definition",tokenize:p$},h$={partial:!0,tokenize:m$};function p$(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return IR.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return s=ds(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Ct(p)?Xc(e,u)(p):u(p)}function u(p){return CR(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(h$,f,f)(p)}function f(p){return it(p)?dt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Fe(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function m$(e,t,n){return r;function r(o){return Ct(o)?Xc(e,s)(o):n(o)}function s(o){return RR(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return it(o)?dt(e,a,"whitespace")(o):a(o)}function a(o){return o===null||Fe(o)?t(o):n(o)}}const g$={name:"hardBreakEscape",tokenize:y$};function y$(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Fe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const b$={name:"headingAtx",resolve:E$,tokenize:x$};function E$(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Rr(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function x$(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Ct(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Fe(d)?(e.exit("atxHeading"),t(d)):it(d)?dt(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Ct(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const w$=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dT=["pre","script","style","textarea"],v$={concrete:!0,name:"htmlFlow",resolveTo:k$,tokenize:N$},_$={partial:!0,tokenize:A$},T$={partial:!0,tokenize:S$};function k$(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function N$(e,t,n){const r=this;let s,i,a,o,l;return u;function u(D){return d(D)}function d(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),f}function f(D){return D===33?(e.consume(D),h):D===47?(e.consume(D),i=!0,b):D===63?(e.consume(D),s=3,r.interrupt?t:S):ir(D)?(e.consume(D),a=String.fromCharCode(D),w):n(D)}function h(D){return D===45?(e.consume(D),s=2,p):D===91?(e.consume(D),s=5,o=0,m):ir(D)?(e.consume(D),s=4,r.interrupt?t:S):n(D)}function p(D){return D===45?(e.consume(D),r.interrupt?t:S):n(D)}function m(D){const ne="CDATA[";return D===ne.charCodeAt(o++)?(e.consume(D),o===ne.length?r.interrupt?t:B:m):n(D)}function b(D){return ir(D)?(e.consume(D),a=String.fromCharCode(D),w):n(D)}function w(D){if(D===null||D===47||D===62||Ct(D)){const ne=D===47,J=a.toLowerCase();return!ne&&!i&&dT.includes(J)?(s=1,r.interrupt?t(D):B(D)):w$.includes(a.toLowerCase())?(s=6,ne?(e.consume(D),g):r.interrupt?t(D):B(D)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(D):i?E(D):y(D))}return D===45||Gn(D)?(e.consume(D),a+=String.fromCharCode(D),w):n(D)}function g(D){return D===62?(e.consume(D),r.interrupt?t:B):n(D)}function E(D){return it(D)?(e.consume(D),E):I(D)}function y(D){return D===47?(e.consume(D),I):D===58||D===95||ir(D)?(e.consume(D),_):it(D)?(e.consume(D),y):I(D)}function _(D){return D===45||D===46||D===58||D===95||Gn(D)?(e.consume(D),_):k(D)}function k(D){return D===61?(e.consume(D),T):it(D)?(e.consume(D),k):y(D)}function T(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),l=D,C):it(D)?(e.consume(D),T):N(D)}function C(D){return D===l?(e.consume(D),l=null,R):D===null||Fe(D)?n(D):(e.consume(D),C)}function N(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||Ct(D)?k(D):(e.consume(D),N)}function R(D){return D===47||D===62||it(D)?y(D):n(D)}function I(D){return D===62?(e.consume(D),M):n(D)}function M(D){return D===null||Fe(D)?B(D):it(D)?(e.consume(D),M):n(D)}function B(D){return D===45&&s===2?(e.consume(D),A):D===60&&s===1?(e.consume(D),L):D===62&&s===4?(e.consume(D),H):D===63&&s===3?(e.consume(D),S):D===93&&s===5?(e.consume(D),j):Fe(D)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(_$,V,Y)(D)):D===null||Fe(D)?(e.exit("htmlFlowData"),Y(D)):(e.consume(D),B)}function Y(D){return e.check(T$,P,V)(D)}function P(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),U}function U(D){return D===null||Fe(D)?Y(D):(e.enter("htmlFlowData"),B(D))}function A(D){return D===45?(e.consume(D),S):B(D)}function L(D){return D===47?(e.consume(D),a="",O):B(D)}function O(D){if(D===62){const ne=a.toLowerCase();return dT.includes(ne)?(e.consume(D),H):B(D)}return ir(D)&&a.length<8?(e.consume(D),a+=String.fromCharCode(D),O):B(D)}function j(D){return D===93?(e.consume(D),S):B(D)}function S(D){return D===62?(e.consume(D),H):D===45&&s===2?(e.consume(D),S):B(D)}function H(D){return D===null||Fe(D)?(e.exit("htmlFlowData"),V(D)):(e.consume(D),H)}function V(D){return e.exit("htmlFlow"),t(D)}}function S$(e,t,n){const r=this;return s;function s(a){return Fe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function A$(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(md,t,n)}}const C$={name:"htmlText",tokenize:I$};function I$(e,t,n){const r=this;let s,i,a;return o;function o(S){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(S),l}function l(S){return S===33?(e.consume(S),u):S===47?(e.consume(S),k):S===63?(e.consume(S),y):ir(S)?(e.consume(S),N):n(S)}function u(S){return S===45?(e.consume(S),d):S===91?(e.consume(S),i=0,m):ir(S)?(e.consume(S),E):n(S)}function d(S){return S===45?(e.consume(S),p):n(S)}function f(S){return S===null?n(S):S===45?(e.consume(S),h):Fe(S)?(a=f,L(S)):(e.consume(S),f)}function h(S){return S===45?(e.consume(S),p):f(S)}function p(S){return S===62?A(S):S===45?h(S):f(S)}function m(S){const H="CDATA[";return S===H.charCodeAt(i++)?(e.consume(S),i===H.length?b:m):n(S)}function b(S){return S===null?n(S):S===93?(e.consume(S),w):Fe(S)?(a=b,L(S)):(e.consume(S),b)}function w(S){return S===93?(e.consume(S),g):b(S)}function g(S){return S===62?A(S):S===93?(e.consume(S),g):b(S)}function E(S){return S===null||S===62?A(S):Fe(S)?(a=E,L(S)):(e.consume(S),E)}function y(S){return S===null?n(S):S===63?(e.consume(S),_):Fe(S)?(a=y,L(S)):(e.consume(S),y)}function _(S){return S===62?A(S):y(S)}function k(S){return ir(S)?(e.consume(S),T):n(S)}function T(S){return S===45||Gn(S)?(e.consume(S),T):C(S)}function C(S){return Fe(S)?(a=C,L(S)):it(S)?(e.consume(S),C):A(S)}function N(S){return S===45||Gn(S)?(e.consume(S),N):S===47||S===62||Ct(S)?R(S):n(S)}function R(S){return S===47?(e.consume(S),A):S===58||S===95||ir(S)?(e.consume(S),I):Fe(S)?(a=R,L(S)):it(S)?(e.consume(S),R):A(S)}function I(S){return S===45||S===46||S===58||S===95||Gn(S)?(e.consume(S),I):M(S)}function M(S){return S===61?(e.consume(S),B):Fe(S)?(a=M,L(S)):it(S)?(e.consume(S),M):R(S)}function B(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),s=S,Y):Fe(S)?(a=B,L(S)):it(S)?(e.consume(S),B):(e.consume(S),P)}function Y(S){return S===s?(e.consume(S),s=void 0,U):S===null?n(S):Fe(S)?(a=Y,L(S)):(e.consume(S),Y)}function P(S){return S===null||S===34||S===39||S===60||S===61||S===96?n(S):S===47||S===62||Ct(S)?R(S):(e.consume(S),P)}function U(S){return S===47||S===62||Ct(S)?R(S):n(S)}function A(S){return S===62?(e.consume(S),e.exit("htmlTextData"),e.exit("htmlText"),t):n(S)}function L(S){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),O}function O(S){return it(S)?dt(e,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):j(S)}function j(S){return e.enter("htmlTextData"),a(S)}}const HE={name:"labelEnd",resolveAll:M$,resolveTo:D$,tokenize:P$},R$={tokenize:j$},O$={tokenize:B$},L$={tokenize:F$};function M$(e){let t=-1;const n=[];for(;++t=3&&(u===null||Fe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),it(u)?dt(e,o,"whitespace")(u):o(u))}}const fr={continuation:{tokenize:G$},exit:Q$,name:"list",tokenize:q$},Y$={partial:!0,tokenize:Z$},W$={partial:!0,tokenize:X$};function q$(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:d1(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(uh,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return d1(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(md,r.interrupt?n:d,e.attempt(Y$,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return it(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function G$(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(md,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dt(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!it(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(W$,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,dt(e,e.attempt(fr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function X$(e,t,n){const r=this;return dt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function Q$(e){e.exit(this.containerState.type)}function Z$(e,t,n){const r=this;return dt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!it(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const fT={name:"setextUnderline",resolveTo:J$,tokenize:eH};function J$(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function eH(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),it(u)?dt(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Fe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const tH={tokenize:nH};function nH(e){const t=this,n=e.attempt(md,r,e.attempt(this.parser.constructs.flowInitial,s,dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(o$,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const rH={resolveAll:LR()},sH=OR("string"),iH=OR("text");function OR(e){return{resolveAll:LR(e==="text"?aH:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=s[d];let h=-1;if(f)for(;++h-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function EH(e,t){let n=-1;const r=[];let s;for(;++n0){const ut=le.tokenStack[le.tokenStack.length-1];(ut[1]||pT).call(le,void 0,ut[0])}for(X.position={start:gi(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:gi(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function LH(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MH(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DH(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Fl(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function PH(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jH(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function PR(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function BH(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return PR(e,t);const s={src:Fl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function FH(e,t){const n={src:Fl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function UH(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function $H(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return PR(e,t);const s={href:Fl(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function HH(e,t){const n={href:Fl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function zH(e,t,n){const r=e.all(t),s=n?VH(n):jR(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function KH(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Ps(t.children[1]),l=pm(t.children[t.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function XH(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(yT(t.slice(s),s>0,!1)),i.join("")}function yT(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===mT||i===gT;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===mT||i===gT;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function JH(e,t){const n={type:"text",value:ZH(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ez(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const tz={blockquote:IH,break:RH,code:OH,delete:LH,emphasis:MH,footnoteReference:DH,heading:PH,html:jH,imageReference:BH,image:FH,inlineCode:UH,linkReference:$H,link:HH,listItem:zH,list:KH,paragraph:YH,root:WH,strong:qH,table:GH,tableCell:QH,tableRow:XH,text:JH,thematicBreak:ez,toml:yf,yaml:yf,definition:yf,footnoteDefinition:yf};function yf(){}const BR=-1,ym=0,Qc=1,fp=2,zE=3,VE=4,KE=5,YE=6,FR=7,UR=8,nz=typeof self=="object"?self:globalThis,bT=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new nz[e](t)},rz=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case ym:case BR:return n(a,s);case Qc:{const o=n([],s);for(const l of a)o.push(r(l));return o}case fp:{const o=n({},s);for(const[l,u]of a)o[r(l)]=r(u);return o}case zE:return n(new Date(a),s);case VE:{const{source:o,flags:l}=a;return n(new RegExp(o,l),s)}case KE:{const o=n(new Map,s);for(const[l,u]of a)o.set(r(l),r(u));return o}case YE:{const o=n(new Set,s);for(const l of a)o.add(r(l));return o}case FR:{const{name:o,message:l}=a;return n(bT(o,l),s)}case UR:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(bT(i,a),s)};return r},ET=e=>rz(new Map,e)(0),uo="",{toString:sz}={},{keys:iz}=Object,dc=e=>{const t=typeof e;if(t!=="object"||!e)return[ym,t];const n=sz.call(e).slice(8,-1);switch(n){case"Array":return[Qc,uo];case"Object":return[fp,uo];case"Date":return[zE,uo];case"RegExp":return[VE,uo];case"Map":return[KE,uo];case"Set":return[YE,uo];case"DataView":return[Qc,n]}return n.includes("Array")?[Qc,n]:n.includes("Error")?[FR,n]:[fp,n]},bf=([e,t])=>e===ym&&(t==="function"||t==="symbol"),az=(e,t,n,r)=>{const s=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},i=a=>{if(n.has(a))return n.get(a);let[o,l]=dc(a);switch(o){case ym:{let d=a;switch(l){case"bigint":o=UR,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return s([BR],a)}return s([o,d],a)}case Qc:{if(l){let h=a;return l==="DataView"?h=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(a)),s([l,[...h]],a)}const d=[],f=s([o,d],a);for(const h of a)d.push(i(h));return f}case fp:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=s([o,d],a);for(const h of iz(a))(e||!bf(dc(a[h])))&&d.push([i(h),i(a[h])]);return f}case zE:return s([o,a.toISOString()],a);case VE:{const{source:d,flags:f}=a;return s([o,{source:d,flags:f}],a)}case KE:{const d=[],f=s([o,d],a);for(const[h,p]of a)(e||!(bf(dc(h))||bf(dc(p))))&&d.push([i(h),i(p)]);return f}case YE:{const d=[],f=s([o,d],a);for(const h of a)(e||!bf(dc(h)))&&d.push(i(h));return f}}const{message:u}=a;return s([o,{name:l,message:u}],a)};return i},xT=(e,{json:t,lossy:n}={})=>{const r=[];return az(!(t||n),!!t,new Map,r)(e),r},gl=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ET(xT(e,t)):structuredClone(e):(e,t)=>ET(xT(e,t));function oz(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function lz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function cz(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||oz,r=e.options.footnoteBackLabel||lz,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l0&&m.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,p);typeof E=="string"&&(E={type:"text",value:E}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const E=w.children[w.children.length-1];E&&E.type==="text"?E.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...m)}else d.push(...m);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...gl(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` +`}]}}const gd=function(e){if(e==null)return hz;if(typeof e=="function")return bm(e);if(typeof e=="object")return Array.isArray(e)?uz(e):dz(e);if(typeof e=="string")return fz(e);throw new Error("Expected function, string, or object as test")};function uz(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=$R,m,b,w;if((!t||i(l,u,d[d.length-1]||void 0))&&(p=yz(n(l,d)),p[0]===h1))return p;if("children"in l&&l.children){const g=l;if(g.children&&p[0]!==gz)for(b=(r?g.children.length:-1)+a,w=d.concat(g);b>-1&&b0&&n.push({type:"text",value:` +`}),n}function wT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vT(e,t){const n=Ez(e,t),r=n.one(e,void 0),s=cz(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function Tz(e,t){return e&&"run"in e?async function(n,r){const s=vT(n,{file:r,...t});await e.run(s,r)}:function(n,r){return vT(n,{file:r,...e||t})}}function _T(e){if(e)throw e}var dh=Object.prototype.hasOwnProperty,zR=Object.prototype.toString,TT=Object.defineProperty,kT=Object.getOwnPropertyDescriptor,NT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):zR.call(t)==="[object Array]"},ST=function(t){if(!t||zR.call(t)!=="[object Object]")return!1;var n=dh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&dh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||dh.call(t,s)},AT=function(t,n){TT&&n.name==="__proto__"?TT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},CT=function(t,n){if(n==="__proto__")if(dh.call(t,n)){if(kT)return kT(t,n).value}else return;return t[n]},kz=function e(){var t,n,r,s,i,a,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});la.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return s(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const Ts={basename:Az,dirname:Cz,extname:Iz,join:Rz,sep:"/"};function Az(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');bd(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function Cz(e){if(bd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Iz(e){bd(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function Rz(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Lz(e,t){let n="",r=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function bd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Mz={cwd:Dz};function Dz(){return"/"}function g1(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Pz(e){if(typeof e=="string")e=new URL(e);else if(!g1(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return jz(e)}function jz(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const b=r[h][1];m1(b)&&m1(p)&&(p=Kg(!0,b,p)),r[h]=[u,p,...m]}}}}const $z=new WE().freeze();function Gg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function RT(e){if(!m1(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function OT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ef(e){return Hz(e)?e:new VR(e)}function Hz(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zz(e){return typeof e=="string"||Vz(e)}function Vz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Kz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",LT=[],MT={allowDangerousHtml:!0},Yz=/^(https?|ircs?|mailto|xmpp)$/i,Wz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function qz(e){const t=Gz(e),n=Xz(e);return Qz(t.runSync(t.parse(n),n),e)}function Gz(e){const t=e.rehypePlugins||LT,n=e.remarkPlugins||LT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...MT}:MT;return $z().use(CH).use(n).use(Tz,r).use(t)}function Xz(e){const t=e.children||"",n=new VR;return typeof t=="string"&&(n.value=t),n}function Qz(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||Zz;for(const d of Wz)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Kz+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),yd(e,u),f7(e,{Fragment:c.Fragment,components:s,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in Hg)if(Object.hasOwn(Hg,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],b=Hg[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=l(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function Zz(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Yz.test(e.slice(0,t))?e:""}function DT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function Jz(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eV(e,t,n){const s=gd((n||{}).ignore||[]),i=tV(t);let a=-1;for(;++a0?{type:"text",value:T}:void 0),T===!1?h.lastIndex=_+1:(m!==_&&E.push({type:"text",value:u.value.slice(m,_)}),Array.isArray(T)?E.push(...T):T&&E.push(T),m=_+y[0].length,g=!0),!h.global)break;y=h.exec(u.value)}return g?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=DT(e,"(");let i=DT(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function KR(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||za(n)||mm(n))&&(!t||n!==47)}YR.peek=TV;function gV(){this.buffer()}function yV(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bV(){this.buffer()}function EV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ds(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wV(e){this.exit(e)}function vV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ds(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _V(e){this.exit(e)}function TV(){return"["}function YR(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function kV(){return{enter:{gfmFootnoteCallString:gV,gfmFootnoteCall:yV,gfmFootnoteDefinitionLabelString:bV,gfmFootnoteDefinition:EV},exit:{gfmFootnoteCallString:xV,gfmFootnoteCall:wV,gfmFootnoteDefinitionLabelString:vV,gfmFootnoteDefinition:_V}}}function NV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:YR},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return l+=o.move(i.safe(i.associationId(r),{before:l,after:"]"})),d(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?` +`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?WR:SV))),u(),l}}function SV(e,t,n){return t===0?e:WR(e,t,n)}function WR(e,t,n){return(n?"":" ")+e}const AV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];qR.peek=LV;function CV(){return{canContainEols:["delete"],enter:{strikethrough:RV},exit:{strikethrough:OV}}}function IV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:AV}],handlers:{delete:qR}}}function RV(e){this.enter({type:"delete",children:[]},e)}function OV(e){this.exit(e)}function qR(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function LV(){return"~"}function MV(e){return e.length}function DV(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||MV,i=[],a=[],o=[],l=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++gl[g])&&(l[g]=y)}b.push(E)}a[d]=b,o[d]=w}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fl[f]&&(l[f]=E),p[f]=E),h[f]=y}a.splice(1,0,h),o.splice(1,0,p),d=-1;const m=[];for(;++d "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),BV);return s(),a}function BV(e,t,n){return">"+(n?"":" ")+e}function FV(e,t){return BT(e,t.inConstruct,!0)&&!BT(e,t.notInConstruct,!1)}function BT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function $V(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function HV(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function zV(e,t,n,r){const s=HV(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if($V(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,VV);return f(),h}const o=n.createTracker(r),l=s.repeat(Math.max(UV(i,s)+1,3)),u=n.enter("codeFenced");let d=o.move(l);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:` +`,encode:["`"],...o.current()})),f()}return d+=o.move(` +`),i&&(d+=o.move(i+` +`)),d+=o.move(l),u(),d}function VV(e,t,n){return(n?"":" ")+e}function qE(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function KV(e,t,n,r){const s=qE(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...l.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),a(),u}function YV(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Pu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hp(e,t,n){const r=ml(e),s=ml(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}XR.peek=WV;function XR(e,t,n,r){const s=YV(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let l=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),d=hp(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(l=Pu(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=hp(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+Pu(f));const p=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+l+p}function WV(e,t,n){return n.options.emphasis||"*"}function qV(e,t){let n=!1;return yd(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,h1}),!!((!e.depth||e.depth<3)&&UE(e)&&(t.options.setext||n))}function GV(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(qV(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:` +`,after:` +`});return f(),d(),h+` +`+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` +`))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),l=n.enter("phrasing");i.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` +`,...i.current()});return/^[\t ]/.test(u)&&(u=Pu(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),l(),o(),u}QR.peek=XV;function QR(e){return e.value||""}function XV(){return"<"}ZR.peek=QV;function ZR(e,t,n,r){const s=qE(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),u+=l.move(")"),a(),u}function QV(){return"!"}JR.peek=ZV;function JR(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const u=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?l+=o.move(f+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function ZV(){return"!"}eO.peek=JV;function eO(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}nO.peek=eK;function nO(e,t,n,r){const s=qE(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,l;if(tO(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),l=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),l()),u+=a.move(")"),o(),u}function eK(e,t,n){return tO(e,n)?"<":"["}rO.peek=tK;function rO(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?l+=o.move(f+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function tK(){return"["}function GE(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function nK(e){const t=GE(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function rK(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function sO(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function sK(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?rK(n):GE(n);const o=e.ordered?a==="."?")":".":nK(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),sO(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return l(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?i:i+" ".repeat(a-i.length))+f}}function oK(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const lK=gd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function cK(e,t,n,r){return(e.children.some(function(a){return lK(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function uK(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}iO.peek=dK;function iO(e,t,n,r){const s=uK(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let l=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),d=hp(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(l=Pu(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=hp(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+Pu(f));const p=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+l+p}function dK(e,t,n){return n.options.strong||"*"}function fK(e,t,n,r){return n.safe(e.value,r)}function hK(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function pK(e,t,n){const r=(sO(n)+(n.options.ruleSpaces?" ":"")).repeat(hK(n));return n.options.ruleSpaces?r.slice(0,-1):r}const aO={blockquote:jV,break:FT,code:zV,definition:KV,emphasis:XR,hardBreak:FT,heading:GV,html:QR,image:ZR,imageReference:JR,inlineCode:eO,link:nO,linkReference:rO,list:sK,listItem:aK,paragraph:oK,root:cK,strong:iO,text:fK,thematicBreak:pK};function mK(){return{enter:{table:gK,tableData:UT,tableHeader:UT,tableRow:bK},exit:{codeText:EK,table:yK,tableData:t0,tableHeader:t0,tableRow:t0}}}function gK(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function yK(e){this.exit(e),this.data.inTable=void 0}function bK(e){this.enter({type:"tableRow",children:[]},e)}function t0(e){this.exit(e)}function UT(e){this.enter({type:"tableCell",children:[]},e)}function EK(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,xK));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function xK(e,t){return t==="|"?t:e}function wK(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:l,tableRow:o}};function a(p,m,b,w){return u(d(p,b,w),p.align)}function o(p,m,b,w){const g=f(p,b,w),E=u([g]);return E.slice(0,E.indexOf(` +`))}function l(p,m,b,w){const g=b.enter("tableCell"),E=b.enter("phrasing"),y=b.containerPhrasing(p,{...w,before:i,after:i});return E(),g(),y}function u(p,m){return DV(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function d(p,m,b){const w=p.children;let g=-1;const E=[],y=m.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const FK={tokenize:WK,partial:!0};function UK(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:VK,continuation:{tokenize:KK},exit:YK}},text:{91:{name:"gfmFootnoteCall",tokenize:zK},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$K,resolveTo:HK}}}}function $K(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return n(l);const u=ds(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function HK(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function zK(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!a||f===null||f===91||Ct(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(ds(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Ct(f)||(a=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function VK(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!o||m===null||m===91||Ct(m))return n(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=ds(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Ct(m)||(o=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),dt(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function KK(e,t,n){return e.check(md,t,e.attempt(FK,t,n))}function YK(e){e.exit("gfmFootnoteDefinition")}function WK(e,t,n){const r=this;return dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function qK(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let l=-1;for(;++l1?l(m):(a.consume(m),f++,p);if(f<2&&!n)return l(m);const w=a.exit("strikethroughSequenceTemporary"),g=ml(m);return w._open=!g||g===2&&!!b,w._close=!b||b===2&&!!g,o(m)}}}class GK{constructor(){this.map=[]}add(t,n,r){XK(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function XK(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const P=r.events[M][1].type;if(P==="lineEnding"||P==="linePrefix")M--;else break}const B=M>-1?r.events[M][1].type:null,Y=B==="tableHead"||B==="tableRow"?T:l;return Y===T&&r.parser.lazy[r.now().line]?n(I):Y(I)}function l(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,i+=1),d(I)}function d(I){return I===null?n(I):Fe(I)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),p):n(I):it(I)?dt(e,d,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(I)))}function f(I){return I===null||I===124||Ct(I)?(e.exit("data"),d(I)):(e.consume(I),I===92?h:f)}function h(I){return I===92||I===124?(e.consume(I),f):f(I)}function p(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),a=!1,it(I)?dt(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):m(I))}function m(I){return I===45||I===58?w(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),b):k(I)}function b(I){return it(I)?dt(e,w,"whitespace")(I):w(I)}function w(I){return I===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),g):I===45?(i+=1,g(I)):I===null||Fe(I)?_(I):k(I)}function g(I){return I===45?(e.enter("tableDelimiterFiller"),E(I)):k(I)}function E(I){return I===45?(e.consume(I),E):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(I))}function y(I){return it(I)?dt(e,_,"whitespace")(I):_(I)}function _(I){return I===124?m(I):I===null||Fe(I)?!a||s!==i?k(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):k(I)}function k(I){return n(I)}function T(I){return e.enter("tableRow"),C(I)}function C(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),C):I===null||Fe(I)?(e.exit("tableRow"),t(I)):it(I)?dt(e,C,"whitespace")(I):(e.enter("data"),N(I))}function N(I){return I===null||I===124||Ct(I)?(e.exit("data"),C(I)):(e.consume(I),I===92?R:N)}function R(I){return I===92||I===124?(e.consume(I),N):N(I)}}function eY(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,d,f;const h=new GK;for(;++nn[2]+1){const m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},yo(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function HT(e,t,n,r,s){const i=[],a=yo(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function yo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const tY={name:"tasklistCheck",tokenize:rY};function nY(){return{text:{91:tY}}}function rY(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ct(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return Fe(l)?t(l):it(l)?e.check({tokenize:sY},t,n)(l):n(l)}}function sY(e,t,n){return dt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function iY(e){return _R([IK(),UK(),qK(e),ZK(),nY()])}const aY={};function oY(e){const t=this,n=e||aY,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(iY(n)),i.push(NK()),a.push(SK(n))}const zT=function(e,t,n){const r=gd(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&l.push(` +`.repeat(u)||" "),u=-1,l.push(d))}return l.join("")}function gO(e,t,n){return e.type==="element"?mY(e,t,n):e.type==="text"?n.whitespace==="normal"?yO(e,n):gY(e):[]}function mY(e,t,n){const r=bO(e,n),s=e.children||[];let i=-1,a=[];if(hY(e))return a;let o,l;for(b1(e)||WT(e)&&zT(t,e,WT)?l=` +`:fY(e)?(o=2,l=2):mO(e)&&(o=1,l=1);++i]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],w=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:w},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:T.concat([{begin:/\(/,end:/\)/,keywords:_,contains:T.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function _Y(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=vY(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function EO(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(o);const l={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],w=["true","false"],g={match:/(\/[a-z._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],k=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:w,built_in:[...E,...y,"set","shopt",..._,...k]},contains:[p,e.SHEBANG(),m,f,i,a,g,o,l,u,d,n]}}function TY(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",w={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},g=[f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:g.concat([{begin:/\(/,end:/\)/,keywords:w,contains:g.concat(["self"]),relevance:0}]),relevance:0},y={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:w,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:w}}}function kY(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],w=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:w},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},T=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:T.concat([{begin:/\(/,end:/\)/,keywords:_,contains:T.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function NY(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],a={keyword:s.concat(i),built_in:t,literal:r},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},w=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.C_BLOCK_COMMENT_MODE],p.contains=[w,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const g={variants:[u,b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},y=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},g,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+y+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[g,l,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}const SY=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),AY=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],CY=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],IY=[...AY,...CY],RY=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),OY=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),LY=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),MY=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function DY(e){const t=e.regex,n=SY(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+OY.join("|")+")"},{begin:":(:)?("+LY.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+MY.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:RY.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+IY.join("|")+")\\b"}]}}function PY(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function jY(e){const i={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:i,illegal:"wO(e,t,n-1))}function FY(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+wO("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,qT,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},qT,u]}}const GT="[A-Za-z$_][0-9A-Za-z$_]*",UY=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],$Y=["true","false","null","undefined","NaN","Infinity"],vO=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],_O=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],TO=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],HY=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zY=[].concat(TO,vO,_O);function kO(e){const t=e.regex,n=(O,{after:j})=>{const S="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,j)=>{const S=O[0].length+O.index,H=O.input[S];if(H==="<"||H===","){j.ignoreMatch();return}H===">"&&(n(O,{after:S})||j.ignoreMatch());let V;const D=O.input.substring(S);if(V=D.match(/^\s*=/)){j.ignoreMatch();return}if((V=D.match(/^\s+extends\s+/))&&V.index===0){j.ignoreMatch();return}}},o={$pattern:GT,keyword:UY,literal:$Y,built_in:zY,"variable.language":HY},l="[0-9](_?[0-9])*",u=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,w,{match:/\$\d+/},f];h.contains=y.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(y)});const _=[].concat(E,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},N={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...vO,..._O]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(O){return t.concat("(?!",O.join("|"),")")}const Y={match:t.concat(/\b/,B([...TO,"super","import"].map(O=>`${O}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,w,E,{match:/\$\d+/},f,N,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},Y,M,C,U,{match:/\$[(.]/}]}}function NO(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Eo="[0-9](_*[0-9])*",_f=`\\.(${Eo})`,Tf="[0-9a-fA-F](_*[0-9a-fA-F])*",VY={className:"number",variants:[{begin:`(\\b(${Eo})((${_f})|\\.)?|(${_f}))[eE][+-]?(${Eo})[fFdD]?\\b`},{begin:`\\b(${Eo})((${_f})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${_f})[fFdD]?\\b`},{begin:`\\b(${Eo})[fFdD]\\b`},{begin:`\\b0[xX]((${Tf})\\.?|(${Tf})?\\.(${Tf}))[pP][+-]?(${Eo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Tf})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function KY(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(a);const o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=VY,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,o,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,o,l,a,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,l]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const YY=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),WY=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],qY=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],GY=[...WY,...qY],XY=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),SO=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),AO=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),QY=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),ZY=SO.concat(AO).sort().reverse();function JY(e){const t=YY(e),n=ZY,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",a=[],o=[],l=function(y){return{className:"string",begin:"~?"+y+".*?"+y}},u=function(y,_,k){return{className:y,begin:_,relevance:k}},d={$pattern:/[a-z-]+/,keyword:r,attribute:XY.join(" ")},f={begin:"\\(",end:"\\)",contains:o,keywords:d,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=o.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+QY.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:o,relevance:0}},w={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:h}},g={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+s+"\\}"),{begin:"\\b("+GY.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+SO.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+AO.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},E={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[g]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,w,E,m,g,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function eW(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function CO(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,l];return[u,d,f,h].forEach(g=>{g.contains=g.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function tW(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,o={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function nW(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,i,l],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,w,g="\\1")=>{const E=g==="\\1"?g:t.concat(g,w);return t.concat(t.concat("(?:",b,")"),w,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,g,r)},p=(b,w,g)=>t.concat(t.concat("(?:",b,")"),w,/(?:\\.|[^\\\/])*?/,g,r),m=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function rW(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(P,U)=>{U.data._beginMatch=P[1]||P[2]},"on:end":(P,U)=>{U.data._beginMatch!==P[1]&&U.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,m={scope:"string",variants:[d,u,f,h]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},w=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],E=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],_={keyword:g,literal:(P=>{const U=[];return P.forEach(A=>{U.push(A),A.toLowerCase()===A?U.push(A.toUpperCase()):U.push(A.toLowerCase())}),U})(w),built_in:E},k=P=>P.map(U=>U.replace(/\|\d+$/,"")),T={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",k(E).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(r,"\\b(?!\\()"),N={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[R,a,N,e.C_BLOCK_COMMENT_MODE,m,b,T]},M={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(g).join("\\b|"),"|",k(E).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(M);const B=[R,N,e.C_BLOCK_COMMENT_MODE,m,b,T],Y={begin:t.concat(/#\[\s*\\?/,t.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:w,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:w,keyword:["new","array"]},contains:["self",...B]},...B,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:_,contains:[Y,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},a,M,N,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},T,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:_,contains:["self",Y,a,N,e.C_BLOCK_COMMENT_MODE,m,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,b]}}function sW(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function iW(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function RO(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},w={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,w,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,g,f]}]}}function aW(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function oW(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function lW(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(r,/(::\w+)*/),a={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},o={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},T=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,u),relevance:0}].concat(l,u);d.contains=T,b.contains=T;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:T}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:T}}];return u.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(I).concat(u).concat(T)}}function cW(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",o=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:o,literal:l,built_in:u},illegal:""},i]}}const uW=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),dW=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],fW=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],hW=[...dW,...fW],pW=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),mW=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),gW=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),yW=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function bW(e){const t=uW(e),n=gW,r=mW,s="@[a-z-]+",i="and or not only",o={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+hW.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+yW.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,o,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:pW.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function EW(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function xW(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...u,...l].filter(k=>!d.includes(k)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},w={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},g={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function E(k){return t.concat(/\b/,t.either(...k.map(T=>T.replace(/\s+/,"\\s+"))),/\b/)}const y={scope:"keyword",match:E(h),relevance:0};function _(k,{exceptions:T,when:C}={}){const N=C;return T=T||[],k.map(R=>R.match(/\|\d+$/)||T.includes(R)?R:N(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(m,{when:k=>k.length<3}),literal:i,type:o,built_in:f},contains:[{scope:"type",match:E(a)},y,g,b,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,w]}}function OO(e){return e?typeof e=="string"?e:e.source:null}function fc(e){return St("(?=",e,")")}function St(...e){return e.map(n=>OO(n)).join("")}function wW(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function nr(...e){return"("+(wW(e).capture?"":"?:")+e.map(r=>OO(r)).join("|")+")"}const ZE=e=>St(/\b/,e,/\w$/.test(e)?/\b/:/\B/),vW=["Protocol","Type"].map(ZE),XT=["init","self"].map(ZE),_W=["Any","Self"],n0=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],QT=["false","nil","true"],TW=["assignment","associativity","higherThan","left","lowerThan","none","right"],kW=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],ZT=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],LO=nr(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),MO=nr(LO,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),r0=St(LO,MO,"*"),DO=nr(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),pp=nr(DO,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),vs=St(DO,pp,"*"),kf=St(/[A-Z]/,pp,"*"),NW=["attached","autoclosure",St(/convention\(/,nr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",St(/objc\(/,vs,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],SW=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function AW(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,nr(...vW,...XT)],className:{2:"keyword"}},i={match:St(/\./,nr(...n0)),relevance:0},a=n0.filter(ge=>typeof ge=="string").concat(["_|0"]),o=n0.filter(ge=>typeof ge!="string").concat(_W).map(ZE),l={variants:[{className:"keyword",match:nr(...o,...XT)}]},u={$pattern:nr(/\b\w+/,/#\w+/),keyword:a.concat(kW),literal:QT},d=[s,i,l],f={match:St(/\./,nr(...ZT)),relevance:0},h={className:"built_in",match:St(/\b/,nr(...ZT),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:r0},{match:`\\.(\\.|${MO})+`}]},w=[m,b],g="([0-9]_*)+",E="([0-9a-fA-F]_*)+",y={className:"number",relevance:0,variants:[{match:`\\b(${g})(\\.(${g}))?([eE][+-]?(${g}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${g}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(ge="")=>({className:"subst",variants:[{match:St(/\\/,ge,/[0\\tnr"']/)},{match:St(/\\/,ge,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(ge="")=>({className:"subst",match:St(/\\/,ge,/[\t ]*(?:[\r\n]|\r\n)/)}),T=(ge="")=>({className:"subst",label:"interpol",begin:St(/\\/,ge,/\(/),end:/\)/}),C=(ge="")=>({begin:St(ge,/"""/),end:St(/"""/,ge),contains:[_(ge),k(ge),T(ge)]}),N=(ge="")=>({begin:St(ge,/"/),end:St(/"/,ge),contains:[_(ge),T(ge)]}),R={className:"string",variants:[C(),C("#"),C("##"),C("###"),N(),N("#"),N("##"),N("###")]},I=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],M={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},B=ge=>{const Me=St(ge,/\//),ve=St(/\//,ge);return{begin:Me,end:ve,contains:[...I,{scope:"comment",begin:`#(?!.*${ve})`,end:/$/}]}},Y={scope:"regexp",variants:[B("###"),B("##"),B("#"),M]},P={match:St(/`/,vs,/`/)},U={className:"variable",match:/\$\d+/},A={className:"variable",match:`\\$${pp}+`},L=[P,U,A],O={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:SW,contains:[...w,y,R]}]}},j={scope:"keyword",match:St(/@/,nr(...NW),fc(nr(/\(/,/\s+/)))},S={scope:"meta",match:St(/@/,vs)},H=[O,j,S],V={match:fc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:St(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,pp,"+")},{className:"type",match:kf,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:St(/\s+&\s+/,fc(kf)),relevance:0}]},D={begin://,keywords:u,contains:[...r,...d,...H,m,V]};V.contains.push(D);const ne={match:St(vs,/\s*:/),keywords:"_|0",relevance:0},J={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ne,...r,Y,...d,...p,...w,y,R,...L,...H,V]},re={begin://,keywords:"repeat each",contains:[...r,V]},de={begin:nr(fc(St(vs,/\s*:/)),fc(St(vs,/\s+/,vs,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:vs}]},G={begin:/\(/,end:/\)/,keywords:u,contains:[de,...r,...d,...w,y,R,...H,V,J],endsParent:!0,illegal:/["']/},W={match:[/(func|macro)/,/\s+/,nr(P.match,vs,r0)],className:{1:"keyword",3:"title.function"},contains:[re,G,t],illegal:[/\[/,/%/]},ae={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[re,G,t],illegal:/\[|%/},he={match:[/operator/,/\s+/,r0],className:{1:"keyword",3:"title"}},Z={begin:[/precedencegroup/,/\s+/,kf],className:{1:"keyword",3:"title"},contains:[V],keywords:[...TW,...QT],end:/}/},ce={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ce={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,vs,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[re,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:kf},...d],relevance:0}]};for(const ge of R.variants){const Me=ge.contains.find($e=>$e.label==="interpol");Me.keywords=u;const ve=[...d,...p,...w,y,R,...L];Me.contains=[...ve,{begin:/\(/,end:/\)/,contains:["self",...ve]}]}return{name:"Swift",keywords:u,contains:[...r,W,ae,ce,Ce,Ee,he,Z,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},Y,...d,...p,...w,y,R,...L,...H,V,J]}}const mp="[A-Za-z$_][0-9A-Za-z$_]*",PO=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],jO=["true","false","null","undefined","NaN","Infinity"],BO=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],FO=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],UO=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],$O=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],HO=[].concat(UO,BO,FO);function CW(e){const t=e.regex,n=(O,{after:j})=>{const S="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(O,j)=>{const S=O[0].length+O.index,H=O.input[S];if(H==="<"||H===","){j.ignoreMatch();return}H===">"&&(n(O,{after:S})||j.ignoreMatch());let V;const D=O.input.substring(S);if(V=D.match(/^\s*=/)){j.ignoreMatch();return}if((V=D.match(/^\s+extends\s+/))&&V.index===0){j.ignoreMatch();return}}},o={$pattern:mp,keyword:PO,literal:jO,built_in:HO,"variable.language":$O},l="[0-9](_?[0-9])*",u=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},w={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},E={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,w,{match:/\$\d+/},f];h.contains=y.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(y)});const _=[].concat(E,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),T={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},N={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...BO,...FO]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[T],illegal:/%/},M={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(O){return t.concat("(?!",O.join("|"),")")}const Y={match:t.concat(/\b/,B([...UO,"super","import"].map(O=>`${O}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},T]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[T]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,b,w,E,{match:/\$\d+/},f,N,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[T,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[T]},Y,M,C,U,{match:/\$[(.]/}]}}function zO(e){const t=e.regex,n=CW(e),r=mp,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:mp,keyword:PO.concat(l),literal:jO,built_in:HO.concat(s),"variable.language":$O},d={className:"meta",begin:"@"+r},f=(b,w,g)=>{const E=b.contains.findIndex(y=>y.label===w);if(E===-1)throw new Error("can not find mode to replace");b.contains.splice(E,1,g)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,i,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const m=n.contains.find(b=>b.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function IW(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,s),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(i,s),/ +/,t.either(a,o),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function RW(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,a,s,e.QUOTE_STRING_MODE,l,u,o]}}function OW(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,l,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[i,a,l,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function VO(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},w=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,b,i,a],g=[...w];return g.pop(),g.push(o),p.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:w}}const LW={arduino:_Y,bash:EO,c:TY,cpp:kY,csharp:NY,css:DY,diff:PY,go:jY,graphql:BY,ini:xO,java:FY,javascript:kO,json:NO,kotlin:KY,less:JY,lua:eW,makefile:CO,markdown:IO,objectivec:tW,perl:nW,php:rW,"php-template":sW,plaintext:iW,python:RO,"python-repl":aW,r:oW,ruby:lW,rust:cW,scss:bW,shell:EW,sql:xW,swift:AW,typescript:zO,vbnet:IW,wasm:RW,xml:OW,yaml:VO};function KO(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&KO(n)}),e}let JT=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function YO(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ri(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const MW="",ek=e=>!!e.scope,DW=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class PW{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=YO(t)}openNode(t){if(!ek(t))return;const n=DW(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){ek(t)&&(this.buffer+=MW)}value(){return this.buffer}span(t){this.buffer+=``}}const tk=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class JE{constructor(){this.rootNode=tk(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=tk({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{JE._collapse(n)}))}}class jW extends JE{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new PW(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function ju(e){return e?typeof e=="string"?e:e.source:null}function WO(e){return no("(?=",e,")")}function BW(e){return no("(?:",e,")*")}function FW(e){return no("(?:",e,")?")}function no(...e){return e.map(n=>ju(n)).join("")}function UW(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function ex(...e){return"("+(UW(e).capture?"":"?:")+e.map(r=>ju(r)).join("|")+")"}function qO(e){return new RegExp(e.toString()+"|").exec("").length-1}function $W(e,t){const n=e&&e.exec(t);return n&&n.index===0}const HW=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function tx(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=ju(r),a="";for(;i.length>0;){const o=HW.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+s):(a+=o[0],o[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const zW=/\b\B/,GO="[a-zA-Z]\\w*",nx="[a-zA-Z_]\\w*",XO="\\b\\d+(\\.\\d+)?",QO="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",ZO="\\b(0b[01]+)",VW="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",KW=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=no(t,/.*\b/,e.binary,/\b.*/)),Ri({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Bu={begin:"\\\\[\\s\\S]",relevance:0},YW={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Bu]},WW={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Bu]},qW={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Em=function(e,t,n={}){const r=Ri({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=ex("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:no(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},GW=Em("//","$"),XW=Em("/\\*","\\*/"),QW=Em("#","$"),ZW={scope:"number",begin:XO,relevance:0},JW={scope:"number",begin:QO,relevance:0},eq={scope:"number",begin:ZO,relevance:0},tq={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Bu,{begin:/\[/,end:/\]/,relevance:0,contains:[Bu]}]},nq={scope:"title",begin:GO,relevance:0},rq={scope:"title",begin:nx,relevance:0},sq={begin:"\\.\\s*"+nx,relevance:0},iq=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var Nf=Object.freeze({__proto__:null,APOS_STRING_MODE:YW,BACKSLASH_ESCAPE:Bu,BINARY_NUMBER_MODE:eq,BINARY_NUMBER_RE:ZO,COMMENT:Em,C_BLOCK_COMMENT_MODE:XW,C_LINE_COMMENT_MODE:GW,C_NUMBER_MODE:JW,C_NUMBER_RE:QO,END_SAME_AS_BEGIN:iq,HASH_COMMENT_MODE:QW,IDENT_RE:GO,MATCH_NOTHING_RE:zW,METHOD_GUARD:sq,NUMBER_MODE:ZW,NUMBER_RE:XO,PHRASAL_WORDS_MODE:qW,QUOTE_STRING_MODE:WW,REGEXP_MODE:tq,RE_STARTERS_RE:VW,SHEBANG:KW,TITLE_MODE:nq,UNDERSCORE_IDENT_RE:nx,UNDERSCORE_TITLE_MODE:rq});function aq(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function oq(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function lq(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=aq,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function cq(e,t){Array.isArray(e.illegal)&&(e.illegal=ex(...e.illegal))}function uq(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function dq(e,t){e.relevance===void 0&&(e.relevance=1)}const fq=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=no(n.beforeMatch,WO(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},hq=["of","and","for","in","not","or","if","then","parent","list","value"],pq="keyword";function JO(e,t,n=pq){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,JO(e[i],t,i))}),r;function s(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const l=o.split("|");r[l[0]]=[i,mq(l[0],l[1])]})}}function mq(e,t){return t?Number(t):gq(e)?0:1}function gq(e){return hq.includes(e.toLowerCase())}const nk={},Ra=e=>{console.error(e)},rk=(e,...t)=>{console.log(`WARN: ${e}`,...t)},fo=(e,t)=>{nk[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),nk[`${e}/${t}`]=!0)},gp=new Error;function eL(e,t,{key:n}){let r=0;const s=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+r]=s[o],i[o+r]=!0,r+=qO(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function yq(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ra("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),gp;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ra("beginScope must be object"),gp;eL(e,e.begin,{key:"beginScope"}),e.begin=tx(e.begin,{joinWith:""})}}function bq(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ra("skip, excludeEnd, returnEnd not compatible with endScope: {}"),gp;if(typeof e.endScope!="object"||e.endScope===null)throw Ra("endScope must be object"),gp;eL(e,e.end,{key:"endScope"}),e.end=tx(e.end,{joinWith:""})}}function Eq(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function xq(e){Eq(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),yq(e),bq(e)}function wq(e){function t(a,o){return new RegExp(ju(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=qO(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(l=>l[1]);this.matcherRe=t(tx(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(o);if(!l)return null;const u=l.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return l.splice(0,u),Object.assign(l,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const l=new n;return this.rules.slice(o).forEach(([u,d])=>l.addRule(u,d)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let u=l.exec(o);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(o)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function s(a){const o=new r;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const l=a;if(a.isCompiled)return l;[oq,uq,xq,fq].forEach(d=>d(a,o)),e.compilerExtensions.forEach(d=>d(a,o)),a.__beforeBegin=null,[lq,cq,dq].forEach(d=>d(a,o)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=JO(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(u,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=ju(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return vq(d==="self"?a:d)})),a.contains.forEach(function(d){i(d,l)}),a.starts&&i(a.starts,o),l.matcher=s(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Ri(e.classNameAliases||{}),i(e)}function tL(e){return e?e.endsWithParent||tL(e.starts):!1}function vq(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Ri(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:tL(e)?Ri(e,{starts:e.starts?Ri(e.starts):null}):Object.isFrozen(e)?Ri(e):e}var _q="11.11.1";class Tq extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const s0=YO,sk=Ri,ik=Symbol("nomatch"),kq=7,nL=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:jW};function l(A){return o.noHighlightRe.test(A)}function u(A){let L=A.className+" ";L+=A.parentNode?A.parentNode.className:"";const O=o.languageDetectRe.exec(L);if(O){const j=N(O[1]);return j||(rk(i.replace("{}",O[1])),rk("Falling back to no-highlight mode for this block.",A)),j?O[1]:"no-highlight"}return L.split(/\s+/).find(j=>l(j)||N(j))}function d(A,L,O){let j="",S="";typeof L=="object"?(j=A,O=L.ignoreIllegals,S=L.language):(fo("10.7.0","highlight(lang, code, ...args) has been deprecated."),fo("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),S=A,j=L),O===void 0&&(O=!0);const H={code:j,language:S};P("before:highlight",H);const V=H.result?H.result:f(H.language,H.code,O);return V.code=H.code,P("after:highlight",V),V}function f(A,L,O,j){const S=Object.create(null);function H(K,X){return K.keywords[X]}function V(){if(!ve.keywords){Re.addText(oe);return}let K=0;ve.keywordPatternRe.lastIndex=0;let X=ve.keywordPatternRe.exec(oe),le="";for(;X;){le+=oe.substring(K,X.index);const ke=Ee.case_insensitive?X[0].toLowerCase():X[0],Oe=H(ve,ke);if(Oe){const[ut,We]=Oe;if(Re.addText(le),le="",S[ke]=(S[ke]||0)+1,S[ke]<=kq&&(_t+=We),ut.startsWith("_"))le+=X[0];else{const ot=Ee.classNameAliases[ut]||ut;J(X[0],ot)}}else le+=X[0];K=ve.keywordPatternRe.lastIndex,X=ve.keywordPatternRe.exec(oe)}le+=oe.substring(K),Re.addText(le)}function D(){if(oe==="")return;let K=null;if(typeof ve.subLanguage=="string"){if(!t[ve.subLanguage]){Re.addText(oe);return}K=f(ve.subLanguage,oe,!0,$e[ve.subLanguage]),$e[ve.subLanguage]=K._top}else K=p(oe,ve.subLanguage.length?ve.subLanguage:null);ve.relevance>0&&(_t+=K.relevance),Re.__addSublanguage(K._emitter,K.language)}function ne(){ve.subLanguage!=null?D():V(),oe=""}function J(K,X){K!==""&&(Re.startScope(X),Re.addText(K),Re.endScope())}function re(K,X){let le=1;const ke=X.length-1;for(;le<=ke;){if(!K._emit[le]){le++;continue}const Oe=Ee.classNameAliases[K[le]]||K[le],ut=X[le];Oe?J(ut,Oe):(oe=ut,V(),oe=""),le++}}function de(K,X){return K.scope&&typeof K.scope=="string"&&Re.openNode(Ee.classNameAliases[K.scope]||K.scope),K.beginScope&&(K.beginScope._wrap?(J(oe,Ee.classNameAliases[K.beginScope._wrap]||K.beginScope._wrap),oe=""):K.beginScope._multi&&(re(K.beginScope,X),oe="")),ve=Object.create(K,{parent:{value:ve}}),ve}function G(K,X,le){let ke=$W(K.endRe,le);if(ke){if(K["on:end"]){const Oe=new JT(K);K["on:end"](X,Oe),Oe.isMatchIgnored&&(ke=!1)}if(ke){for(;K.endsParent&&K.parent;)K=K.parent;return K}}if(K.endsWithParent)return G(K.parent,X,le)}function W(K){return ve.matcher.regexIndex===0?(oe+=K[0],1):(ct=!0,0)}function ae(K){const X=K[0],le=K.rule,ke=new JT(le),Oe=[le.__beforeBegin,le["on:begin"]];for(const ut of Oe)if(ut&&(ut(K,ke),ke.isMatchIgnored))return W(X);return le.skip?oe+=X:(le.excludeBegin&&(oe+=X),ne(),!le.returnBegin&&!le.excludeBegin&&(oe=X)),de(le,K),le.returnBegin?0:X.length}function he(K){const X=K[0],le=L.substring(K.index),ke=G(ve,K,le);if(!ke)return ik;const Oe=ve;ve.endScope&&ve.endScope._wrap?(ne(),J(X,ve.endScope._wrap)):ve.endScope&&ve.endScope._multi?(ne(),re(ve.endScope,K)):Oe.skip?oe+=X:(Oe.returnEnd||Oe.excludeEnd||(oe+=X),ne(),Oe.excludeEnd&&(oe=X));do ve.scope&&Re.closeNode(),!ve.skip&&!ve.subLanguage&&(_t+=ve.relevance),ve=ve.parent;while(ve!==ke.parent);return ke.starts&&de(ke.starts,K),Oe.returnEnd?0:X.length}function Z(){const K=[];for(let X=ve;X!==Ee;X=X.parent)X.scope&&K.unshift(X.scope);K.forEach(X=>Re.openNode(X))}let ce={};function Ce(K,X){const le=X&&X[0];if(oe+=K,le==null)return ne(),0;if(ce.type==="begin"&&X.type==="end"&&ce.index===X.index&&le===""){if(oe+=L.slice(X.index,X.index+1),!s){const ke=new Error(`0 width match regex (${A})`);throw ke.languageName=A,ke.badRule=ce.rule,ke}return 1}if(ce=X,X.type==="begin")return ae(X);if(X.type==="illegal"&&!O){const ke=new Error('Illegal lexeme "'+le+'" for mode "'+(ve.scope||"")+'"');throw ke.mode=ve,ke}else if(X.type==="end"){const ke=he(X);if(ke!==ik)return ke}if(X.type==="illegal"&&le==="")return oe+=` +`,1;if(Tt>1e5&&Tt>X.index*3)throw new Error("potential infinite loop, way more iterations than matches");return oe+=le,le.length}const Ee=N(A);if(!Ee)throw Ra(i.replace("{}",A)),new Error('Unknown language: "'+A+'"');const ge=wq(Ee);let Me="",ve=j||ge;const $e={},Re=new o.__emitter(o);Z();let oe="",_t=0,we=0,Tt=0,ct=!1;try{if(Ee.__emitTokens)Ee.__emitTokens(L,Re);else{for(ve.matcher.considerAll();;){Tt++,ct?ct=!1:ve.matcher.considerAll(),ve.matcher.lastIndex=we;const K=ve.matcher.exec(L);if(!K)break;const X=L.substring(we,K.index),le=Ce(X,K);we=K.index+le}Ce(L.substring(we))}return Re.finalize(),Me=Re.toHTML(),{language:A,value:Me,relevance:_t,illegal:!1,_emitter:Re,_top:ve}}catch(K){if(K.message&&K.message.includes("Illegal"))return{language:A,value:s0(L),illegal:!0,relevance:0,_illegalBy:{message:K.message,index:we,context:L.slice(we-100,we+100),mode:K.mode,resultSoFar:Me},_emitter:Re};if(s)return{language:A,value:s0(L),illegal:!1,relevance:0,errorRaised:K,_emitter:Re,_top:ve};throw K}}function h(A){const L={value:s0(A),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return L._emitter.addText(A),L}function p(A,L){L=L||o.languages||Object.keys(t);const O=h(A),j=L.filter(N).filter(I).map(ne=>f(ne,A,!1));j.unshift(O);const S=j.sort((ne,J)=>{if(ne.relevance!==J.relevance)return J.relevance-ne.relevance;if(ne.language&&J.language){if(N(ne.language).supersetOf===J.language)return 1;if(N(J.language).supersetOf===ne.language)return-1}return 0}),[H,V]=S,D=H;return D.secondBest=V,D}function m(A,L,O){const j=L&&n[L]||O;A.classList.add("hljs"),A.classList.add(`language-${j}`)}function b(A){let L=null;const O=u(A);if(l(O))return;if(P("before:highlightElement",{el:A,language:O}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(o.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),o.throwUnescapedHTML))throw new Tq("One of your code blocks includes unescaped HTML.",A.innerHTML);L=A;const j=L.textContent,S=O?d(j,{language:O,ignoreIllegals:!0}):p(j);A.innerHTML=S.value,A.dataset.highlighted="yes",m(A,O,S.language),A.result={language:S.language,re:S.relevance,relevance:S.relevance},S.secondBest&&(A.secondBest={language:S.secondBest.language,relevance:S.secondBest.relevance}),P("after:highlightElement",{el:A,result:S,text:j})}function w(A){o=sk(o,A)}const g=()=>{_(),fo("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){_(),fo("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let y=!1;function _(){function A(){_()}if(document.readyState==="loading"){y||window.addEventListener("DOMContentLoaded",A,!1),y=!0;return}document.querySelectorAll(o.cssSelector).forEach(b)}function k(A,L){let O=null;try{O=L(e)}catch(j){if(Ra("Language definition for '{}' could not be registered.".replace("{}",A)),s)Ra(j);else throw j;O=a}O.name||(O.name=A),t[A]=O,O.rawDefinition=L.bind(null,e),O.aliases&&R(O.aliases,{languageName:A})}function T(A){delete t[A];for(const L of Object.keys(n))n[L]===A&&delete n[L]}function C(){return Object.keys(t)}function N(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function R(A,{languageName:L}){typeof A=="string"&&(A=[A]),A.forEach(O=>{n[O.toLowerCase()]=L})}function I(A){const L=N(A);return L&&!L.disableAutodetect}function M(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=L=>{A["before:highlightBlock"](Object.assign({block:L.el},L))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=L=>{A["after:highlightBlock"](Object.assign({block:L.el},L))})}function B(A){M(A),r.push(A)}function Y(A){const L=r.indexOf(A);L!==-1&&r.splice(L,1)}function P(A,L){const O=A;r.forEach(function(j){j[O]&&j[O](L)})}function U(A){return fo("10.7.0","highlightBlock will be removed entirely in v12.0"),fo("10.7.0","Please use highlightElement now."),b(A)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:_,highlightElement:b,highlightBlock:U,configure:w,initHighlighting:g,initHighlightingOnLoad:E,registerLanguage:k,unregisterLanguage:T,listLanguages:C,getLanguage:N,registerAliases:R,autoDetection:I,inherit:sk,addPlugin:B,removePlugin:Y}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=_q,e.regex={concat:no,lookahead:WO,either:ex,optional:FW,anyNumberOfTimes:BW};for(const A in Nf)typeof Nf[A]=="object"&&KO(Nf[A]);return Object.assign(e,Nf),e},yl=nL({});yl.newInstance=()=>nL({});var Nq=yl;yl.HighlightJS=yl;yl.default=yl;const Er=Ju(Nq),ak={},Sq="hljs-";function Aq(e){const t=Er.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:a,registered:o};function n(l,u,d){const f=d||ak,h=typeof f.prefix=="string"?f.prefix:Sq;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:Cq,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,b=m.data;return b.language=p.language,b.relevance=p.relevance,m}function r(l,u){const f=(u||ak).subset||s();let h=-1,p=0,m;for(;++hp&&(p=w.data.relevance,m=w)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return t.listLanguages()}function i(l,u){if(typeof l=="string")t.registerLanguage(l,u);else{let d;for(d in l)Object.hasOwn(l,d)&&t.registerLanguage(d,l[d])}}function a(l,u){if(typeof l=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const f=l[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function o(l){return!!t.getLanguage(l)}}class Cq{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],s=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(t){const n=this,r=t.split(".").map(function(a,o){return o?a+"_".repeat(o):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Iq={};function ok(e){const t=e||Iq,n=t.aliases,r=t.detect||!1,s=t.languages||LW,i=t.plainText,a=t.prefix,o=t.subset;let l="hljs";const u=Aq(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");l=d===-1?a:a.slice(0,d)}return function(d,f){yd(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const b=Rq(h);if(b===!1||!b&&!r||b&&i&&i.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(l)||h.properties.className.unshift(l);const w=pY(h,{whitespace:"pre"});let g;try{g=b?u.highlight(b,w,{prefix:a}):u.highlightAuto(w,{prefix:a,subset:o})}catch(E){const y=E;if(b&&/Unknown language/.test(y.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[m,h],cause:y,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw y}!b&&g.data&&g.data.language&&h.properties.className.push("language-"+g.data.language),g.children.length>0&&(h.children=g.children)})}}function Rq(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&i<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const l=uk(t,n[a-1]);o=l===-1?t.length+1:l+1,n[a]=o}if(o>i)return{line:a+1,column:i-(a>0?n[a-1]:0)+1,offset:i};a++}}}function s(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length1?n[i.line-2]:0)+i.column-1;if(a=55296&&e<=57343}function rG(e){return e>=56320&&e<=57343}function sG(e,t){return(e-55296)*1024+9216+t}function lL(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function cL(e){return e>=64976&&e<=65007||nG.has(e)}var se;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(se||(se={}));const iG=65536;class aG{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=iG,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(rG(n))return this.pos++,this._addGap(),sG(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,F.EOF;return this._err(se.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,F.EOF;const r=this.html.charCodeAt(n);return r===F.CARRIAGE_RETURN?F.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,F.EOF;let t=this.html.charCodeAt(this.pos);return t===F.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,F.LINE_FEED):t===F.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,oL(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===F.LINE_FEED||t===F.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){lL(t)?this._err(se.controlCharacterInInputStream):cL(t)&&this._err(se.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const oG=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),lG=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function cG(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=lG.get(e))!==null&&t!==void 0?t:e}var Ln;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Ln||(Ln={}));const uG=32;var Oi;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Oi||(Oi={}));function x1(e){return e>=Ln.ZERO&&e<=Ln.NINE}function dG(e){return e>=Ln.UPPER_A&&e<=Ln.UPPER_F||e>=Ln.LOWER_A&&e<=Ln.LOWER_F}function fG(e){return e>=Ln.UPPER_A&&e<=Ln.UPPER_Z||e>=Ln.LOWER_A&&e<=Ln.LOWER_Z||x1(e)}function hG(e){return e===Ln.EQUALS||fG(e)}var Rn;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Rn||(Rn={}));var Ks;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ks||(Ks={}));class pG{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Rn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ks.Strict}startEntity(t){this.decodeMode=t,this.state=Rn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Rn.EntityStart:return t.charCodeAt(n)===Ln.NUM?(this.state=Rn.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Rn.NamedEntity,this.stateNamedEntity(t,n));case Rn.NumericStart:return this.stateNumericStart(t,n);case Rn.NumericDecimal:return this.stateNumericDecimal(t,n);case Rn.NumericHex:return this.stateNumericHex(t,n);case Rn.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|uG)===Ln.LOWER_X?(this.state=Rn.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Rn.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,s){if(n!==r){const i=r-n;this.result=this.result*Math.pow(s,i)+Number.parseInt(t.substr(n,i),s),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,i!==0){if(a===Ln.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Ks.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,s=(r[n]&Oi.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Oi.VALUE_LENGTH:s[t+1],r),n===3&&this.emitCodePoint(s[t+2],r),r}end(){var t;switch(this.state){case Rn.NamedEntity:return this.result!==0&&(this.decodeMode!==Ks.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Rn.NumericDecimal:return this.emitNumericEntity(0,2);case Rn.NumericHex:return this.emitNumericEntity(0,3);case Rn.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Rn.EntityStart:return 0}}}function mG(e,t,n,r){const s=(t&Oi.BRANCH_LENGTH)>>7,i=t&Oi.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){const l=r-i;return l<0||l>=s?-1:e[n+l]-1}let a=n,o=a+s-1;for(;a<=o;){const l=a+o>>>1,u=e[l];if(ur)o=l-1;else return e[l+s]}return-1}var fe;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(fe||(fe={}));var Oa;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Oa||(Oa={}));var Hr;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Hr||(Hr={}));var Q;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(Q||(Q={}));var x;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(x||(x={}));const gG=new Map([[Q.A,x.A],[Q.ADDRESS,x.ADDRESS],[Q.ANNOTATION_XML,x.ANNOTATION_XML],[Q.APPLET,x.APPLET],[Q.AREA,x.AREA],[Q.ARTICLE,x.ARTICLE],[Q.ASIDE,x.ASIDE],[Q.B,x.B],[Q.BASE,x.BASE],[Q.BASEFONT,x.BASEFONT],[Q.BGSOUND,x.BGSOUND],[Q.BIG,x.BIG],[Q.BLOCKQUOTE,x.BLOCKQUOTE],[Q.BODY,x.BODY],[Q.BR,x.BR],[Q.BUTTON,x.BUTTON],[Q.CAPTION,x.CAPTION],[Q.CENTER,x.CENTER],[Q.CODE,x.CODE],[Q.COL,x.COL],[Q.COLGROUP,x.COLGROUP],[Q.DD,x.DD],[Q.DESC,x.DESC],[Q.DETAILS,x.DETAILS],[Q.DIALOG,x.DIALOG],[Q.DIR,x.DIR],[Q.DIV,x.DIV],[Q.DL,x.DL],[Q.DT,x.DT],[Q.EM,x.EM],[Q.EMBED,x.EMBED],[Q.FIELDSET,x.FIELDSET],[Q.FIGCAPTION,x.FIGCAPTION],[Q.FIGURE,x.FIGURE],[Q.FONT,x.FONT],[Q.FOOTER,x.FOOTER],[Q.FOREIGN_OBJECT,x.FOREIGN_OBJECT],[Q.FORM,x.FORM],[Q.FRAME,x.FRAME],[Q.FRAMESET,x.FRAMESET],[Q.H1,x.H1],[Q.H2,x.H2],[Q.H3,x.H3],[Q.H4,x.H4],[Q.H5,x.H5],[Q.H6,x.H6],[Q.HEAD,x.HEAD],[Q.HEADER,x.HEADER],[Q.HGROUP,x.HGROUP],[Q.HR,x.HR],[Q.HTML,x.HTML],[Q.I,x.I],[Q.IMG,x.IMG],[Q.IMAGE,x.IMAGE],[Q.INPUT,x.INPUT],[Q.IFRAME,x.IFRAME],[Q.KEYGEN,x.KEYGEN],[Q.LABEL,x.LABEL],[Q.LI,x.LI],[Q.LINK,x.LINK],[Q.LISTING,x.LISTING],[Q.MAIN,x.MAIN],[Q.MALIGNMARK,x.MALIGNMARK],[Q.MARQUEE,x.MARQUEE],[Q.MATH,x.MATH],[Q.MENU,x.MENU],[Q.META,x.META],[Q.MGLYPH,x.MGLYPH],[Q.MI,x.MI],[Q.MO,x.MO],[Q.MN,x.MN],[Q.MS,x.MS],[Q.MTEXT,x.MTEXT],[Q.NAV,x.NAV],[Q.NOBR,x.NOBR],[Q.NOFRAMES,x.NOFRAMES],[Q.NOEMBED,x.NOEMBED],[Q.NOSCRIPT,x.NOSCRIPT],[Q.OBJECT,x.OBJECT],[Q.OL,x.OL],[Q.OPTGROUP,x.OPTGROUP],[Q.OPTION,x.OPTION],[Q.P,x.P],[Q.PARAM,x.PARAM],[Q.PLAINTEXT,x.PLAINTEXT],[Q.PRE,x.PRE],[Q.RB,x.RB],[Q.RP,x.RP],[Q.RT,x.RT],[Q.RTC,x.RTC],[Q.RUBY,x.RUBY],[Q.S,x.S],[Q.SCRIPT,x.SCRIPT],[Q.SEARCH,x.SEARCH],[Q.SECTION,x.SECTION],[Q.SELECT,x.SELECT],[Q.SOURCE,x.SOURCE],[Q.SMALL,x.SMALL],[Q.SPAN,x.SPAN],[Q.STRIKE,x.STRIKE],[Q.STRONG,x.STRONG],[Q.STYLE,x.STYLE],[Q.SUB,x.SUB],[Q.SUMMARY,x.SUMMARY],[Q.SUP,x.SUP],[Q.TABLE,x.TABLE],[Q.TBODY,x.TBODY],[Q.TEMPLATE,x.TEMPLATE],[Q.TEXTAREA,x.TEXTAREA],[Q.TFOOT,x.TFOOT],[Q.TD,x.TD],[Q.TH,x.TH],[Q.THEAD,x.THEAD],[Q.TITLE,x.TITLE],[Q.TR,x.TR],[Q.TRACK,x.TRACK],[Q.TT,x.TT],[Q.U,x.U],[Q.UL,x.UL],[Q.SVG,x.SVG],[Q.VAR,x.VAR],[Q.WBR,x.WBR],[Q.XMP,x.XMP]]);function $l(e){var t;return(t=gG.get(e))!==null&&t!==void 0?t:x.UNKNOWN}const pe=x,yG={[fe.HTML]:new Set([pe.ADDRESS,pe.APPLET,pe.AREA,pe.ARTICLE,pe.ASIDE,pe.BASE,pe.BASEFONT,pe.BGSOUND,pe.BLOCKQUOTE,pe.BODY,pe.BR,pe.BUTTON,pe.CAPTION,pe.CENTER,pe.COL,pe.COLGROUP,pe.DD,pe.DETAILS,pe.DIR,pe.DIV,pe.DL,pe.DT,pe.EMBED,pe.FIELDSET,pe.FIGCAPTION,pe.FIGURE,pe.FOOTER,pe.FORM,pe.FRAME,pe.FRAMESET,pe.H1,pe.H2,pe.H3,pe.H4,pe.H5,pe.H6,pe.HEAD,pe.HEADER,pe.HGROUP,pe.HR,pe.HTML,pe.IFRAME,pe.IMG,pe.INPUT,pe.LI,pe.LINK,pe.LISTING,pe.MAIN,pe.MARQUEE,pe.MENU,pe.META,pe.NAV,pe.NOEMBED,pe.NOFRAMES,pe.NOSCRIPT,pe.OBJECT,pe.OL,pe.P,pe.PARAM,pe.PLAINTEXT,pe.PRE,pe.SCRIPT,pe.SECTION,pe.SELECT,pe.SOURCE,pe.STYLE,pe.SUMMARY,pe.TABLE,pe.TBODY,pe.TD,pe.TEMPLATE,pe.TEXTAREA,pe.TFOOT,pe.TH,pe.THEAD,pe.TITLE,pe.TR,pe.TRACK,pe.UL,pe.WBR,pe.XMP]),[fe.MATHML]:new Set([pe.MI,pe.MO,pe.MN,pe.MS,pe.MTEXT,pe.ANNOTATION_XML]),[fe.SVG]:new Set([pe.TITLE,pe.FOREIGN_OBJECT,pe.DESC]),[fe.XLINK]:new Set,[fe.XML]:new Set,[fe.XMLNS]:new Set},w1=new Set([pe.H1,pe.H2,pe.H3,pe.H4,pe.H5,pe.H6]);Q.STYLE,Q.SCRIPT,Q.XMP,Q.IFRAME,Q.NOEMBED,Q.NOFRAMES,Q.PLAINTEXT;var $;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})($||($={}));const dn={DATA:$.DATA,RCDATA:$.RCDATA,RAWTEXT:$.RAWTEXT,SCRIPT_DATA:$.SCRIPT_DATA,PLAINTEXT:$.PLAINTEXT,CDATA_SECTION:$.CDATA_SECTION};function bG(e){return e>=F.DIGIT_0&&e<=F.DIGIT_9}function Cc(e){return e>=F.LATIN_CAPITAL_A&&e<=F.LATIN_CAPITAL_Z}function EG(e){return e>=F.LATIN_SMALL_A&&e<=F.LATIN_SMALL_Z}function xi(e){return EG(e)||Cc(e)}function fk(e){return xi(e)||bG(e)}function Sf(e){return e+32}function dL(e){return e===F.SPACE||e===F.LINE_FEED||e===F.TABULATION||e===F.FORM_FEED}function hk(e){return dL(e)||e===F.SOLIDUS||e===F.GREATER_THAN_SIGN}function xG(e){return e===F.NULL?se.nullCharacterReference:e>1114111?se.characterReferenceOutsideUnicodeRange:oL(e)?se.surrogateCharacterReference:cL(e)?se.noncharacterCharacterReference:lL(e)||e===F.CARRIAGE_RETURN?se.controlCharacterReference:null}class wG{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=$.DATA,this.returnState=$.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new aG(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new pG(oG,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(se.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(se.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const s=xG(r);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(se.endTagWithAttributes),t.selfClosing&&this._err(se.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case nt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case nt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case nt.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:nt.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=dL(t)?nt.WHITESPACE_CHARACTER:t===F.NULL?nt.NULL_CHARACTER:nt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(nt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=$.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ks.Attribute:Ks.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===$.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===$.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===$.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case $.DATA:{this._stateData(t);break}case $.RCDATA:{this._stateRcdata(t);break}case $.RAWTEXT:{this._stateRawtext(t);break}case $.SCRIPT_DATA:{this._stateScriptData(t);break}case $.PLAINTEXT:{this._statePlaintext(t);break}case $.TAG_OPEN:{this._stateTagOpen(t);break}case $.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case $.TAG_NAME:{this._stateTagName(t);break}case $.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case $.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case $.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case $.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case $.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case $.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case $.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case $.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case $.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case $.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case $.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case $.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case $.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case $.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case $.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case $.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case $.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case $.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case $.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case $.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case $.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case $.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case $.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case $.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case $.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case $.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case $.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case $.BOGUS_COMMENT:{this._stateBogusComment(t);break}case $.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case $.COMMENT_START:{this._stateCommentStart(t);break}case $.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case $.COMMENT:{this._stateComment(t);break}case $.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case $.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case $.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case $.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case $.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case $.COMMENT_END:{this._stateCommentEnd(t);break}case $.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case $.DOCTYPE:{this._stateDoctype(t);break}case $.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case $.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case $.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case $.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case $.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case $.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case $.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case $.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case $.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case $.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case $.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case $.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case $.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case $.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case $.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case $.CDATA_SECTION:{this._stateCdataSection(t);break}case $.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case $.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case $.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case $.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case F.LESS_THAN_SIGN:{this.state=$.TAG_OPEN;break}case F.AMPERSAND:{this._startCharacterReference();break}case F.NULL:{this._err(se.unexpectedNullCharacter),this._emitCodePoint(t);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case F.AMPERSAND:{this._startCharacterReference();break}case F.LESS_THAN_SIGN:{this.state=$.RCDATA_LESS_THAN_SIGN;break}case F.NULL:{this._err(se.unexpectedNullCharacter),this._emitChars(Vt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case F.LESS_THAN_SIGN:{this.state=$.RAWTEXT_LESS_THAN_SIGN;break}case F.NULL:{this._err(se.unexpectedNullCharacter),this._emitChars(Vt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case F.LESS_THAN_SIGN:{this.state=$.SCRIPT_DATA_LESS_THAN_SIGN;break}case F.NULL:{this._err(se.unexpectedNullCharacter),this._emitChars(Vt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case F.NULL:{this._err(se.unexpectedNullCharacter),this._emitChars(Vt);break}case F.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(xi(t))this._createStartTagToken(),this.state=$.TAG_NAME,this._stateTagName(t);else switch(t){case F.EXCLAMATION_MARK:{this.state=$.MARKUP_DECLARATION_OPEN;break}case F.SOLIDUS:{this.state=$.END_TAG_OPEN;break}case F.QUESTION_MARK:{this._err(se.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=$.BOGUS_COMMENT,this._stateBogusComment(t);break}case F.EOF:{this._err(se.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(se.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=$.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(xi(t))this._createEndTagToken(),this.state=$.TAG_NAME,this._stateTagName(t);else switch(t){case F.GREATER_THAN_SIGN:{this._err(se.missingEndTagName),this.state=$.DATA;break}case F.EOF:{this._err(se.eofBeforeTagName),this._emitChars("");break}case F.NULL:{this._err(se.unexpectedNullCharacter),this.state=$.SCRIPT_DATA_ESCAPED,this._emitChars(Vt);break}case F.EOF:{this._err(se.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=$.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===F.SOLIDUS?this.state=$.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:xi(t)?(this._emitChars("<"),this.state=$.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=$.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){xi(t)?(this.state=$.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case F.NULL:{this._err(se.unexpectedNullCharacter),this.state=$.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Vt);break}case F.EOF:{this._err(se.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=$.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===F.SOLIDUS?(this.state=$.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=$.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(dr.SCRIPT,!1)&&hk(this.preprocessor.peek(dr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==fe.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(NG,fe.HTML)}clearBackToTableBodyContext(){this.clearBackTo(kG,fe.HTML)}clearBackToTableRowContext(){this.clearBackTo(TG,fe.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===x.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===x.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case fe.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case fe.SVG:{if(gk.has(s))return!1;break}case fe.MATHML:{if(mk.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,yp)}hasInListItemScope(t){return this.hasInDynamicScope(t,vG)}hasInButtonScope(t){return this.hasInDynamicScope(t,_G)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case fe.HTML:{if(w1.has(n))return!0;if(yp.has(n))return!1;break}case fe.SVG:{if(gk.has(n))return!1;break}case fe.MATHML:{if(mk.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===fe.HTML)switch(this.tagIDs[n]){case t:return!0;case x.TABLE:case x.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===fe.HTML)switch(this.tagIDs[t]){case x.TBODY:case x.THEAD:case x.TFOOT:return!0;case x.TABLE:case x.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===fe.HTML)switch(this.tagIDs[n]){case t:return!0;case x.OPTION:case x.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&fL.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&pk.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&pk.has(this.currentTagId);)this.pop()}}const i0=3;var ks;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(ks||(ks={}));const yk={type:ks.Marker};class CG{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],s=n.length,i=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o[a.name,a.value]));let i=0;for(let a=0;as.get(l.name)===l.value)&&(i+=1,i>=i0&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(yk)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:ks.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:ks.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(yk);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===ks.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===ks.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===ks.Element&&n.element===t)}}const wi={createDocument(){return{nodeName:"#document",mode:Hr.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const s=e.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};wi.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(wi.isTextNode(n)){n.value+=t;return}}wi.appendChild(e,wi.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&wi.isTextNode(r)?r.value+=t:wi.insertBefore(e,wi.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function DG(e){return e.name===hL&&e.publicId===null&&(e.systemId===null||e.systemId===IG)}function PG(e){if(e.name!==hL)return Hr.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===RG)return Hr.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),LG.has(n))return Hr.QUIRKS;let r=t===null?OG:pL;if(bk(n,r))return Hr.QUIRKS;if(r=t===null?mL:MG,bk(n,r))return Hr.LIMITED_QUIRKS}return Hr.NO_QUIRKS}const Ek={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},jG="definitionurl",BG="definitionURL",FG=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),UG=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:fe.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:fe.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:fe.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:fe.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:fe.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:fe.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:fe.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:fe.XML}],["xml:space",{prefix:"xml",name:"space",namespace:fe.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:fe.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:fe.XMLNS}]]),$G=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),HG=new Set([x.B,x.BIG,x.BLOCKQUOTE,x.BODY,x.BR,x.CENTER,x.CODE,x.DD,x.DIV,x.DL,x.DT,x.EM,x.EMBED,x.H1,x.H2,x.H3,x.H4,x.H5,x.H6,x.HEAD,x.HR,x.I,x.IMG,x.LI,x.LISTING,x.MENU,x.META,x.NOBR,x.OL,x.P,x.PRE,x.RUBY,x.S,x.SMALL,x.SPAN,x.STRONG,x.STRIKE,x.SUB,x.SUP,x.TABLE,x.TT,x.U,x.UL,x.VAR]);function zG(e){const t=e.tagID;return t===x.FONT&&e.attrs.some(({name:r})=>r===Oa.COLOR||r===Oa.SIZE||r===Oa.FACE)||HG.has(t)}function gL(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,t,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===fe.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,fe.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=z.TEXT}switchToPlaintextParsing(){this.insertionMode=z.TEXT,this.originalInsertionMode=z.IN_BODY,this.tokenizer.state=dn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Q.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==fe.HTML))switch(this.fragmentContextID){case x.TITLE:case x.TEXTAREA:{this.tokenizer.state=dn.RCDATA;break}case x.STYLE:case x.XMP:case x.IFRAME:case x.NOEMBED:case x.NOFRAMES:case x.NOSCRIPT:{this.tokenizer.state=dn.RAWTEXT;break}case x.SCRIPT:{this.tokenizer.state=dn.SCRIPT_DATA;break}case x.PLAINTEXT:{this.tokenizer.state=dn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,fe.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,fe.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Q.HTML,fe.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,x.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:l,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:l,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,s=this.treeAdapter.getTagName(t),i=n.type===nt.END_TAG&&s===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===x.SVG&&this.treeAdapter.getTagName(n)===Q.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===fe.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===x.MGLYPH||t.tagID===x.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,fe.HTML)}_processToken(t){switch(t.type){case nt.CHARACTER:{this.onCharacter(t);break}case nt.NULL_CHARACTER:{this.onNullCharacter(t);break}case nt.COMMENT:{this.onComment(t);break}case nt.DOCTYPE:{this.onDoctype(t);break}case nt.START_TAG:{this._processStartTag(t);break}case nt.END_TAG:{this.onEndTag(t);break}case nt.EOF:{this.onEof(t);break}case nt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return WG(t,s,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===ks.Marker||this.openElements.contains(s.element)),r=n===-1?t-1:n-1;for(let s=r;s>=0;s--){const i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=z.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(x.P),this.openElements.popUntilTagNamePopped(x.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case x.TR:{this.insertionMode=z.IN_ROW;return}case x.TBODY:case x.THEAD:case x.TFOOT:{this.insertionMode=z.IN_TABLE_BODY;return}case x.CAPTION:{this.insertionMode=z.IN_CAPTION;return}case x.COLGROUP:{this.insertionMode=z.IN_COLUMN_GROUP;return}case x.TABLE:{this.insertionMode=z.IN_TABLE;return}case x.BODY:{this.insertionMode=z.IN_BODY;return}case x.FRAMESET:{this.insertionMode=z.IN_FRAMESET;return}case x.SELECT:{this._resetInsertionModeForSelect(t);return}case x.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case x.HTML:{this.insertionMode=this.headElement?z.AFTER_HEAD:z.BEFORE_HEAD;return}case x.TD:case x.TH:{if(t>0){this.insertionMode=z.IN_CELL;return}break}case x.HEAD:{if(t>0){this.insertionMode=z.IN_HEAD;return}break}}this.insertionMode=z.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===x.TEMPLATE)break;if(r===x.TABLE){this.insertionMode=z.IN_SELECT_IN_TABLE;return}}this.insertionMode=z.IN_SELECT}_isElementCausesFosterParenting(t){return bL.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case x.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===fe.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case x.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return yG[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){SQ(this,t);return}switch(this.insertionMode){case z.INITIAL:{hc(this,t);break}case z.BEFORE_HTML:{Zc(this,t);break}case z.BEFORE_HEAD:{Jc(this,t);break}case z.IN_HEAD:{eu(this,t);break}case z.IN_HEAD_NO_SCRIPT:{tu(this,t);break}case z.AFTER_HEAD:{nu(this,t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:{xL(this,t);break}case z.TEXT:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{a0(this,t);break}case z.IN_TABLE_TEXT:{NL(this,t);break}case z.IN_COLUMN_GROUP:{bp(this,t);break}case z.AFTER_BODY:{Ep(this,t);break}case z.AFTER_AFTER_BODY:{hh(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){NQ(this,t);return}switch(this.insertionMode){case z.INITIAL:{hc(this,t);break}case z.BEFORE_HTML:{Zc(this,t);break}case z.BEFORE_HEAD:{Jc(this,t);break}case z.IN_HEAD:{eu(this,t);break}case z.IN_HEAD_NO_SCRIPT:{tu(this,t);break}case z.AFTER_HEAD:{nu(this,t);break}case z.TEXT:{this._insertCharacters(t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{a0(this,t);break}case z.IN_COLUMN_GROUP:{bp(this,t);break}case z.AFTER_BODY:{Ep(this,t);break}case z.AFTER_AFTER_BODY:{hh(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){v1(this,t);return}switch(this.insertionMode){case z.INITIAL:case z.BEFORE_HTML:case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:case z.IN_BODY:case z.IN_TABLE:case z.IN_CAPTION:case z.IN_COLUMN_GROUP:case z.IN_TABLE_BODY:case z.IN_ROW:case z.IN_CELL:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:case z.IN_TEMPLATE:case z.IN_FRAMESET:case z.AFTER_FRAMESET:{v1(this,t);break}case z.IN_TABLE_TEXT:{pc(this,t);break}case z.AFTER_BODY:{sX(this,t);break}case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{iX(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case z.INITIAL:{aX(this,t);break}case z.BEFORE_HEAD:case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:{this._err(t,se.misplacedDoctype);break}case z.IN_TABLE_TEXT:{pc(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,se.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?AQ(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{hc(this,t);break}case z.BEFORE_HTML:{oX(this,t);break}case z.BEFORE_HEAD:{cX(this,t);break}case z.IN_HEAD:{gs(this,t);break}case z.IN_HEAD_NO_SCRIPT:{fX(this,t);break}case z.AFTER_HEAD:{pX(this,t);break}case z.IN_BODY:{Zn(this,t);break}case z.IN_TABLE:{bl(this,t);break}case z.IN_TABLE_TEXT:{pc(this,t);break}case z.IN_CAPTION:{uQ(this,t);break}case z.IN_COLUMN_GROUP:{lx(this,t);break}case z.IN_TABLE_BODY:{vm(this,t);break}case z.IN_ROW:{_m(this,t);break}case z.IN_CELL:{hQ(this,t);break}case z.IN_SELECT:{CL(this,t);break}case z.IN_SELECT_IN_TABLE:{mQ(this,t);break}case z.IN_TEMPLATE:{yQ(this,t);break}case z.AFTER_BODY:{EQ(this,t);break}case z.IN_FRAMESET:{xQ(this,t);break}case z.AFTER_FRAMESET:{vQ(this,t);break}case z.AFTER_AFTER_BODY:{TQ(this,t);break}case z.AFTER_AFTER_FRAMESET:{kQ(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?CQ(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case z.INITIAL:{hc(this,t);break}case z.BEFORE_HTML:{lX(this,t);break}case z.BEFORE_HEAD:{uX(this,t);break}case z.IN_HEAD:{dX(this,t);break}case z.IN_HEAD_NO_SCRIPT:{hX(this,t);break}case z.AFTER_HEAD:{mX(this,t);break}case z.IN_BODY:{wm(this,t);break}case z.TEXT:{eQ(this,t);break}case z.IN_TABLE:{Fu(this,t);break}case z.IN_TABLE_TEXT:{pc(this,t);break}case z.IN_CAPTION:{dQ(this,t);break}case z.IN_COLUMN_GROUP:{fQ(this,t);break}case z.IN_TABLE_BODY:{_1(this,t);break}case z.IN_ROW:{AL(this,t);break}case z.IN_CELL:{pQ(this,t);break}case z.IN_SELECT:{IL(this,t);break}case z.IN_SELECT_IN_TABLE:{gQ(this,t);break}case z.IN_TEMPLATE:{bQ(this,t);break}case z.AFTER_BODY:{OL(this,t);break}case z.IN_FRAMESET:{wQ(this,t);break}case z.AFTER_FRAMESET:{_Q(this,t);break}case z.AFTER_AFTER_BODY:{hh(this,t);break}}}onEof(t){switch(this.insertionMode){case z.INITIAL:{hc(this,t);break}case z.BEFORE_HTML:{Zc(this,t);break}case z.BEFORE_HEAD:{Jc(this,t);break}case z.IN_HEAD:{eu(this,t);break}case z.IN_HEAD_NO_SCRIPT:{tu(this,t);break}case z.AFTER_HEAD:{nu(this,t);break}case z.IN_BODY:case z.IN_TABLE:case z.IN_CAPTION:case z.IN_COLUMN_GROUP:case z.IN_TABLE_BODY:case z.IN_ROW:case z.IN_CELL:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:{TL(this,t);break}case z.TEXT:{tQ(this,t);break}case z.IN_TABLE_TEXT:{pc(this,t);break}case z.IN_TEMPLATE:{RL(this,t);break}case z.AFTER_BODY:case z.IN_FRAMESET:case z.AFTER_FRAMESET:case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{ox(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===F.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case z.IN_HEAD:case z.IN_HEAD_NO_SCRIPT:case z.AFTER_HEAD:case z.TEXT:case z.IN_COLUMN_GROUP:case z.IN_SELECT:case z.IN_SELECT_IN_TABLE:case z.IN_FRAMESET:case z.AFTER_FRAMESET:{this._insertCharacters(t);break}case z.IN_BODY:case z.IN_CAPTION:case z.IN_CELL:case z.IN_TEMPLATE:case z.AFTER_BODY:case z.AFTER_AFTER_BODY:case z.AFTER_AFTER_FRAMESET:{EL(this,t);break}case z.IN_TABLE:case z.IN_TABLE_BODY:case z.IN_ROW:{a0(this,t);break}case z.IN_TABLE_TEXT:{kL(this,t);break}}}};function ZG(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):_L(e,t),n}function JG(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function eX(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let i=0,a=s;a!==n;i++,a=s){s=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),l=o&&i>=XG;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=tX(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function tX(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function nX(e,t,n){const r=e.treeAdapter.getTagName(t),s=$l(r);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);s===x.TEMPLATE&&i===fe.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function rX(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,s.tagID)}function ax(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&e._setEndLocation(i,t)}}}}function aX(e,t){e._setDocumentType(t);const n=t.forceQuirks?Hr.QUIRKS:PG(t);DG(t)||e._err(t,se.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=z.BEFORE_HTML}function hc(e,t){e._err(t,se.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Hr.QUIRKS),e.insertionMode=z.BEFORE_HTML,e._processToken(t)}function oX(e,t){t.tagID===x.HTML?(e._insertElement(t,fe.HTML),e.insertionMode=z.BEFORE_HEAD):Zc(e,t)}function lX(e,t){const n=t.tagID;(n===x.HTML||n===x.HEAD||n===x.BODY||n===x.BR)&&Zc(e,t)}function Zc(e,t){e._insertFakeRootElement(),e.insertionMode=z.BEFORE_HEAD,e._processToken(t)}function cX(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.HEAD:{e._insertElement(t,fe.HTML),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD;break}default:Jc(e,t)}}function uX(e,t){const n=t.tagID;n===x.HEAD||n===x.BODY||n===x.HTML||n===x.BR?Jc(e,t):e._err(t,se.endTagWithoutMatchingOpenElement)}function Jc(e,t){e._insertFakeElement(Q.HEAD,x.HEAD),e.headElement=e.openElements.current,e.insertionMode=z.IN_HEAD,e._processToken(t)}function gs(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:{e._appendElement(t,fe.HTML),t.ackSelfClosing=!0;break}case x.TITLE:{e._switchToTextParsing(t,dn.RCDATA);break}case x.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,dn.RAWTEXT):(e._insertElement(t,fe.HTML),e.insertionMode=z.IN_HEAD_NO_SCRIPT);break}case x.NOFRAMES:case x.STYLE:{e._switchToTextParsing(t,dn.RAWTEXT);break}case x.SCRIPT:{e._switchToTextParsing(t,dn.SCRIPT_DATA);break}case x.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=z.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(z.IN_TEMPLATE);break}case x.HEAD:{e._err(t,se.misplacedStartTagForHeadElement);break}default:eu(e,t)}}function dX(e,t){switch(t.tagID){case x.HEAD:{e.openElements.pop(),e.insertionMode=z.AFTER_HEAD;break}case x.BODY:case x.BR:case x.HTML:{eu(e,t);break}case x.TEMPLATE:{ro(e,t);break}default:e._err(t,se.endTagWithoutMatchingOpenElement)}}function ro(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==x.TEMPLATE&&e._err(t,se.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(x.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,se.endTagWithoutMatchingOpenElement)}function eu(e,t){e.openElements.pop(),e.insertionMode=z.AFTER_HEAD,e._processToken(t)}function fX(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.BASEFONT:case x.BGSOUND:case x.HEAD:case x.LINK:case x.META:case x.NOFRAMES:case x.STYLE:{gs(e,t);break}case x.NOSCRIPT:{e._err(t,se.nestedNoscriptInHead);break}default:tu(e,t)}}function hX(e,t){switch(t.tagID){case x.NOSCRIPT:{e.openElements.pop(),e.insertionMode=z.IN_HEAD;break}case x.BR:{tu(e,t);break}default:e._err(t,se.endTagWithoutMatchingOpenElement)}}function tu(e,t){const n=t.type===nt.EOF?se.openElementsLeftAfterEof:se.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=z.IN_HEAD,e._processToken(t)}function pX(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.BODY:{e._insertElement(t,fe.HTML),e.framesetOk=!1,e.insertionMode=z.IN_BODY;break}case x.FRAMESET:{e._insertElement(t,fe.HTML),e.insertionMode=z.IN_FRAMESET;break}case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:case x.NOFRAMES:case x.SCRIPT:case x.STYLE:case x.TEMPLATE:case x.TITLE:{e._err(t,se.abandonedHeadElementChild),e.openElements.push(e.headElement,x.HEAD),gs(e,t),e.openElements.remove(e.headElement);break}case x.HEAD:{e._err(t,se.misplacedStartTagForHeadElement);break}default:nu(e,t)}}function mX(e,t){switch(t.tagID){case x.BODY:case x.HTML:case x.BR:{nu(e,t);break}case x.TEMPLATE:{ro(e,t);break}default:e._err(t,se.endTagWithoutMatchingOpenElement)}}function nu(e,t){e._insertFakeElement(Q.BODY,x.BODY),e.insertionMode=z.IN_BODY,xm(e,t)}function xm(e,t){switch(t.type){case nt.CHARACTER:{xL(e,t);break}case nt.WHITESPACE_CHARACTER:{EL(e,t);break}case nt.COMMENT:{v1(e,t);break}case nt.START_TAG:{Zn(e,t);break}case nt.END_TAG:{wm(e,t);break}case nt.EOF:{TL(e,t);break}}}function EL(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function xL(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function gX(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function yX(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function bX(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_FRAMESET)}function EX(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML)}function xX(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&w1.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,fe.HTML)}function wX(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function vX(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),n||(e.formElement=e.openElements.current))}function _X(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const s=e.openElements.tagIDs[r];if(n===x.LI&&s===x.LI||(n===x.DD||n===x.DT)&&(s===x.DD||s===x.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==x.ADDRESS&&s!==x.DIV&&s!==x.P&&e._isSpecialElement(e.openElements.items[r],s))break}e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML)}function TX(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),e.tokenizer.state=dn.PLAINTEXT}function kX(e,t){e.openElements.hasInScope(x.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(x.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.framesetOk=!1}function NX(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Q.A);n&&(ax(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function SX(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function AX(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(x.NOBR)&&(ax(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,fe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function CX(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function IX(e,t){e.treeAdapter.getDocumentMode(e.document)!==Hr.QUIRKS&&e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._insertElement(t,fe.HTML),e.framesetOk=!1,e.insertionMode=z.IN_TABLE}function wL(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,fe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function vL(e){const t=uL(e,Oa.TYPE);return t!=null&&t.toLowerCase()===qG}function RX(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,fe.HTML),vL(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function OX(e,t){e._appendElement(t,fe.HTML),t.ackSelfClosing=!0}function LX(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._appendElement(t,fe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function MX(e,t){t.tagName=Q.IMG,t.tagID=x.IMG,wL(e,t)}function DX(e,t){e._insertElement(t,fe.HTML),e.skipNextNewLine=!0,e.tokenizer.state=dn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=z.TEXT}function PX(e,t){e.openElements.hasInButtonScope(x.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,dn.RAWTEXT)}function jX(e,t){e.framesetOk=!1,e._switchToTextParsing(t,dn.RAWTEXT)}function vk(e,t){e._switchToTextParsing(t,dn.RAWTEXT)}function BX(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===z.IN_TABLE||e.insertionMode===z.IN_CAPTION||e.insertionMode===z.IN_TABLE_BODY||e.insertionMode===z.IN_ROW||e.insertionMode===z.IN_CELL?z.IN_SELECT_IN_TABLE:z.IN_SELECT}function FX(e,t){e.openElements.currentTagId===x.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML)}function UX(e,t){e.openElements.hasInScope(x.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,fe.HTML)}function $X(e,t){e.openElements.hasInScope(x.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(x.RTC),e._insertElement(t,fe.HTML)}function HX(e,t){e._reconstructActiveFormattingElements(),gL(t),ix(t),t.selfClosing?e._appendElement(t,fe.MATHML):e._insertElement(t,fe.MATHML),t.ackSelfClosing=!0}function zX(e,t){e._reconstructActiveFormattingElements(),yL(t),ix(t),t.selfClosing?e._appendElement(t,fe.SVG):e._insertElement(t,fe.SVG),t.ackSelfClosing=!0}function _k(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,fe.HTML)}function Zn(e,t){switch(t.tagID){case x.I:case x.S:case x.B:case x.U:case x.EM:case x.TT:case x.BIG:case x.CODE:case x.FONT:case x.SMALL:case x.STRIKE:case x.STRONG:{SX(e,t);break}case x.A:{NX(e,t);break}case x.H1:case x.H2:case x.H3:case x.H4:case x.H5:case x.H6:{xX(e,t);break}case x.P:case x.DL:case x.OL:case x.UL:case x.DIV:case x.DIR:case x.NAV:case x.MAIN:case x.MENU:case x.ASIDE:case x.CENTER:case x.FIGURE:case x.FOOTER:case x.HEADER:case x.HGROUP:case x.DIALOG:case x.DETAILS:case x.ADDRESS:case x.ARTICLE:case x.SEARCH:case x.SECTION:case x.SUMMARY:case x.FIELDSET:case x.BLOCKQUOTE:case x.FIGCAPTION:{EX(e,t);break}case x.LI:case x.DD:case x.DT:{_X(e,t);break}case x.BR:case x.IMG:case x.WBR:case x.AREA:case x.EMBED:case x.KEYGEN:{wL(e,t);break}case x.HR:{LX(e,t);break}case x.RB:case x.RTC:{UX(e,t);break}case x.RT:case x.RP:{$X(e,t);break}case x.PRE:case x.LISTING:{wX(e,t);break}case x.XMP:{PX(e,t);break}case x.SVG:{zX(e,t);break}case x.HTML:{gX(e,t);break}case x.BASE:case x.LINK:case x.META:case x.STYLE:case x.TITLE:case x.SCRIPT:case x.BGSOUND:case x.BASEFONT:case x.TEMPLATE:{gs(e,t);break}case x.BODY:{yX(e,t);break}case x.FORM:{vX(e,t);break}case x.NOBR:{AX(e,t);break}case x.MATH:{HX(e,t);break}case x.TABLE:{IX(e,t);break}case x.INPUT:{RX(e,t);break}case x.PARAM:case x.TRACK:case x.SOURCE:{OX(e,t);break}case x.IMAGE:{MX(e,t);break}case x.BUTTON:{kX(e,t);break}case x.APPLET:case x.OBJECT:case x.MARQUEE:{CX(e,t);break}case x.IFRAME:{jX(e,t);break}case x.SELECT:{BX(e,t);break}case x.OPTION:case x.OPTGROUP:{FX(e,t);break}case x.NOEMBED:case x.NOFRAMES:{vk(e,t);break}case x.FRAMESET:{bX(e,t);break}case x.TEXTAREA:{DX(e,t);break}case x.NOSCRIPT:{e.options.scriptingEnabled?vk(e,t):_k(e,t);break}case x.PLAINTEXT:{TX(e,t);break}case x.COL:case x.TH:case x.TD:case x.TR:case x.HEAD:case x.FRAME:case x.TBODY:case x.TFOOT:case x.THEAD:case x.CAPTION:case x.COLGROUP:break;default:_k(e,t)}}function VX(e,t){if(e.openElements.hasInScope(x.BODY)&&(e.insertionMode=z.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function KX(e,t){e.openElements.hasInScope(x.BODY)&&(e.insertionMode=z.AFTER_BODY,OL(e,t))}function YX(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function WX(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(x.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(x.FORM):n&&e.openElements.remove(n))}function qX(e){e.openElements.hasInButtonScope(x.P)||e._insertFakeElement(Q.P,x.P),e._closePElement()}function GX(e){e.openElements.hasInListItemScope(x.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(x.LI),e.openElements.popUntilTagNamePopped(x.LI))}function XX(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function QX(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ZX(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function JX(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Q.BR,x.BR),e.openElements.pop(),e.framesetOk=!1}function _L(e,t){const n=t.tagName,r=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const i=e.openElements.items[s],a=e.openElements.tagIDs[s];if(r===a&&(r!==x.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(i,a))break}}function wm(e,t){switch(t.tagID){case x.A:case x.B:case x.I:case x.S:case x.U:case x.EM:case x.TT:case x.BIG:case x.CODE:case x.FONT:case x.NOBR:case x.SMALL:case x.STRIKE:case x.STRONG:{ax(e,t);break}case x.P:{qX(e);break}case x.DL:case x.UL:case x.OL:case x.DIR:case x.DIV:case x.NAV:case x.PRE:case x.MAIN:case x.MENU:case x.ASIDE:case x.BUTTON:case x.CENTER:case x.FIGURE:case x.FOOTER:case x.HEADER:case x.HGROUP:case x.DIALOG:case x.ADDRESS:case x.ARTICLE:case x.DETAILS:case x.SEARCH:case x.SECTION:case x.SUMMARY:case x.LISTING:case x.FIELDSET:case x.BLOCKQUOTE:case x.FIGCAPTION:{YX(e,t);break}case x.LI:{GX(e);break}case x.DD:case x.DT:{XX(e,t);break}case x.H1:case x.H2:case x.H3:case x.H4:case x.H5:case x.H6:{QX(e);break}case x.BR:{JX(e);break}case x.BODY:{VX(e,t);break}case x.HTML:{KX(e,t);break}case x.FORM:{WX(e);break}case x.APPLET:case x.OBJECT:case x.MARQUEE:{ZX(e,t);break}case x.TEMPLATE:{ro(e,t);break}default:_L(e,t)}}function TL(e,t){e.tmplInsertionModeStack.length>0?RL(e,t):ox(e,t)}function eQ(e,t){var n;t.tagID===x.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function tQ(e,t){e._err(t,se.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function a0(e,t){if(e.openElements.currentTagId!==void 0&&bL.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=z.IN_TABLE_TEXT,t.type){case nt.CHARACTER:{NL(e,t);break}case nt.WHITESPACE_CHARACTER:{kL(e,t);break}}else Ed(e,t)}function nQ(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_CAPTION}function rQ(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_COLUMN_GROUP}function sQ(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Q.COLGROUP,x.COLGROUP),e.insertionMode=z.IN_COLUMN_GROUP,lx(e,t)}function iQ(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,fe.HTML),e.insertionMode=z.IN_TABLE_BODY}function aQ(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Q.TBODY,x.TBODY),e.insertionMode=z.IN_TABLE_BODY,vm(e,t)}function oQ(e,t){e.openElements.hasInTableScope(x.TABLE)&&(e.openElements.popUntilTagNamePopped(x.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function lQ(e,t){vL(t)?e._appendElement(t,fe.HTML):Ed(e,t),t.ackSelfClosing=!0}function cQ(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,fe.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function bl(e,t){switch(t.tagID){case x.TD:case x.TH:case x.TR:{aQ(e,t);break}case x.STYLE:case x.SCRIPT:case x.TEMPLATE:{gs(e,t);break}case x.COL:{sQ(e,t);break}case x.FORM:{cQ(e,t);break}case x.TABLE:{oQ(e,t);break}case x.TBODY:case x.TFOOT:case x.THEAD:{iQ(e,t);break}case x.INPUT:{lQ(e,t);break}case x.CAPTION:{nQ(e,t);break}case x.COLGROUP:{rQ(e,t);break}default:Ed(e,t)}}function Fu(e,t){switch(t.tagID){case x.TABLE:{e.openElements.hasInTableScope(x.TABLE)&&(e.openElements.popUntilTagNamePopped(x.TABLE),e._resetInsertionMode());break}case x.TEMPLATE:{ro(e,t);break}case x.BODY:case x.CAPTION:case x.COL:case x.COLGROUP:case x.HTML:case x.TBODY:case x.TD:case x.TFOOT:case x.TH:case x.THEAD:case x.TR:break;default:Ed(e,t)}}function Ed(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,xm(e,t),e.fosterParentingEnabled=n}function kL(e,t){e.pendingCharacterTokens.push(t)}function NL(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function pc(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===x.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===x.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===x.OPTGROUP&&e.openElements.pop();break}case x.OPTION:{e.openElements.currentTagId===x.OPTION&&e.openElements.pop();break}case x.SELECT:{e.openElements.hasInSelectScope(x.SELECT)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode());break}case x.TEMPLATE:{ro(e,t);break}}}function mQ(e,t){const n=t.tagID;n===x.CAPTION||n===x.TABLE||n===x.TBODY||n===x.TFOOT||n===x.THEAD||n===x.TR||n===x.TD||n===x.TH?(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),e._processStartTag(t)):CL(e,t)}function gQ(e,t){const n=t.tagID;n===x.CAPTION||n===x.TABLE||n===x.TBODY||n===x.TFOOT||n===x.THEAD||n===x.TR||n===x.TD||n===x.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(x.SELECT),e._resetInsertionMode(),e.onEndTag(t)):IL(e,t)}function yQ(e,t){switch(t.tagID){case x.BASE:case x.BASEFONT:case x.BGSOUND:case x.LINK:case x.META:case x.NOFRAMES:case x.SCRIPT:case x.STYLE:case x.TEMPLATE:case x.TITLE:{gs(e,t);break}case x.CAPTION:case x.COLGROUP:case x.TBODY:case x.TFOOT:case x.THEAD:{e.tmplInsertionModeStack[0]=z.IN_TABLE,e.insertionMode=z.IN_TABLE,bl(e,t);break}case x.COL:{e.tmplInsertionModeStack[0]=z.IN_COLUMN_GROUP,e.insertionMode=z.IN_COLUMN_GROUP,lx(e,t);break}case x.TR:{e.tmplInsertionModeStack[0]=z.IN_TABLE_BODY,e.insertionMode=z.IN_TABLE_BODY,vm(e,t);break}case x.TD:case x.TH:{e.tmplInsertionModeStack[0]=z.IN_ROW,e.insertionMode=z.IN_ROW,_m(e,t);break}default:e.tmplInsertionModeStack[0]=z.IN_BODY,e.insertionMode=z.IN_BODY,Zn(e,t)}}function bQ(e,t){t.tagID===x.TEMPLATE&&ro(e,t)}function RL(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(x.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):ox(e,t)}function EQ(e,t){t.tagID===x.HTML?Zn(e,t):Ep(e,t)}function OL(e,t){var n;if(t.tagID===x.HTML){if(e.fragmentContext||(e.insertionMode=z.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===x.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Ep(e,t)}function Ep(e,t){e.insertionMode=z.IN_BODY,xm(e,t)}function xQ(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.FRAMESET:{e._insertElement(t,fe.HTML);break}case x.FRAME:{e._appendElement(t,fe.HTML),t.ackSelfClosing=!0;break}case x.NOFRAMES:{gs(e,t);break}}}function wQ(e,t){t.tagID===x.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==x.FRAMESET&&(e.insertionMode=z.AFTER_FRAMESET))}function vQ(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.NOFRAMES:{gs(e,t);break}}}function _Q(e,t){t.tagID===x.HTML&&(e.insertionMode=z.AFTER_AFTER_FRAMESET)}function TQ(e,t){t.tagID===x.HTML?Zn(e,t):hh(e,t)}function hh(e,t){e.insertionMode=z.IN_BODY,xm(e,t)}function kQ(e,t){switch(t.tagID){case x.HTML:{Zn(e,t);break}case x.NOFRAMES:{gs(e,t);break}}}function NQ(e,t){t.chars=Vt,e._insertCharacters(t)}function SQ(e,t){e._insertCharacters(t),e.framesetOk=!1}function LL(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==fe.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function AQ(e,t){if(zG(t))LL(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===fe.MATHML?gL(t):r===fe.SVG&&(VG(t),yL(t)),ix(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function CQ(e,t){if(t.tagID===x.P||t.tagID===x.BR){LL(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===fe.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}Q.AREA,Q.BASE,Q.BASEFONT,Q.BGSOUND,Q.BR,Q.COL,Q.EMBED,Q.FRAME,Q.HR,Q.IMG,Q.INPUT,Q.KEYGEN,Q.LINK,Q.META,Q.PARAM,Q.SOURCE,Q.TRACK,Q.WBR;const IQ=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,RQ=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Tk={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function ML(e,t){const n=$Q(e),r=GR("type",{handlers:{root:OQ,element:LQ,text:MQ,comment:PL,doctype:DQ,raw:jQ},unknown:BQ}),s={parser:n?new wk(Tk):wk.getFragmentParser(void 0,Tk),handle(o){r(o,s)},stitches:!1,options:t||{}};r(e,s),Hl(s,Ps());const i=n?s.parser.document:s.parser.getFragment(),a=Hq(i,{file:s.options.file});return s.stitches&&yd(a,"comment",function(o,l,u){const d=o;if(d.value.stitch&&u&&l!==void 0){const f=u.children;return f[l]=d.value.stitch,l}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function DL(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:nt.CHARACTER,chars:e.value,location:xd(e)};Hl(t,Ps(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function DQ(e,t){const n={type:nt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:xd(e)};Hl(t,Ps(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function PQ(e,t){t.stitches=!0;const n=HQ(e);if("children"in e&&"children"in n){const r=ML({type:"root",children:e.children},t.options);n.children=r.children}PL({type:"comment",value:{stitch:n}},t)}function PL(e,t){const n=e.value,r={type:nt.COMMENT,data:n,location:xd(e)};Hl(t,Ps(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function jQ(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,jL(t,Ps(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(IQ,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function BQ(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))PQ(n,t);else{let r="";throw RQ.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function Hl(e,t){jL(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=dn.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function jL(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function FQ(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===dn.PLAINTEXT)return;Hl(t,Ps(e));const r=t.parser.openElements.current;let s="namespaceURI"in r?r.namespaceURI:_a.html;s===_a.html&&n==="svg"&&(s=_a.svg);const i=Wq({...e,children:[]},{space:s===_a.svg?"svg":"html"}),a={type:nt.START_TAG,tagName:n,tagID:$l(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:xd(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function UQ(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&tG.includes(n)||t.parser.tokenizer.state===dn.PLAINTEXT)return;Hl(t,pm(e));const r={type:nt.END_TAG,tagName:n,tagID:$l(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:xd(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===dn.RCDATA||t.parser.tokenizer.state===dn.RAWTEXT||t.parser.tokenizer.state===dn.SCRIPT_DATA)&&(t.parser.tokenizer.state=dn.DATA)}function $Q(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function xd(e){const t=Ps(e)||{line:void 0,column:void 0,offset:void 0},n=pm(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function HQ(e){return"children"in e?gl({...e,children:[]}):gl(e)}function zQ(e){return function(t,n){return ML(t,{...e,file:n})}}const BL=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function FL(e){if(!e)return!1;try{const t=e.toLowerCase();return BL.some(n=>t.includes(n))}catch{return!1}}function VQ(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(FL(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(i=>(i==null?void 0:i.value)||"").join("").toLowerCase();return BL.some(i=>s.includes(i))}return!1}function KQ({text:e,className:t,allowRawHtml:n=!0}){const[r,s]=v.useState(null),i=(l,u)=>{if(l.src)return l.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const b=d(m);if(b)return b}return null},f=d({children:u});if(f)return f}return""},a=l=>{try{const d=new URL(l).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},o=l=>l?Array.isArray(l)?l.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(l==null?void 0:l.value)||"video":"video";return c.jsxs("div",{className:t?`md ${t}`:"md",children:[c.jsx(qz,{remarkPlugins:[oY],rehypePlugins:n?[zQ,ok]:[ok],components:{a:({node:l,...u})=>{const d=u.href;if(d&&(FL(d)||VQ(l))){const f=d,h=o(l==null?void 0:l.children);return c.jsxs("div",{className:"video-container",children:[c.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>s({src:f,title:h}),children:[c.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),c.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:c.jsx(Wc,{})})]}),c.jsx("div",{className:"video-caption",children:c.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return c.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:l,src:u,alt:d,...f})=>{const h=c.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?c.jsx(gI,{src:u,children:c.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,c.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:c.jsx(Wc,{})})]})}):h},video:({node:l,src:u,children:d,...f})=>{const h=i({src:u},d);return h?c.jsx("div",{className:"video-container",children:c.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:h}),children:[c.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),c.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:c.jsx(Wc,{})})]})}):c.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),r&&c.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:c.jsxs("div",{className:"video-viewer",onClick:l=>l.stopPropagation(),children:[c.jsxs("div",{className:"video-viewer-header",children:[c.jsx("div",{className:"video-viewer-title",children:r.title||a(r.src)}),c.jsxs("nav",{className:"video-viewer-nav",children:[c.jsx("a",{href:r.src,download:r.title||a(r.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:c.jsx(TE,{})}),c.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:c.jsx(Gr,{})})]})]}),c.jsx("div",{className:"video-viewer-body",children:c.jsx("video",{src:r.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const wd=v.memo(KQ),kk=6,Nk=7,YQ={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function T1(e){return YQ[(e||"").trim().toLowerCase()]||"未知"}function Sk(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function WQ(e){if(!e)return"";const t=e.trim(),n=Number(t),r=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function qQ(e){const t=e.replace(/\r\n/g,` +`);if(!t.startsWith(`--- +`))return e;const n=t.indexOf(` +--- +`,4);return n>=0?t.slice(n+5).trimStart():e}function GQ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M5.25 7.5h5.25v5.25H5.25zM13.5 7.5h5.25v5.25H13.5zM9.38 15.75h5.24v3H9.38z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),c.jsx("path",{d:"M7.88 12.75v1.5c0 .83.67 1.5 1.5 1.5h5.24c.83 0 1.5-.67 1.5-1.5v-1.5M12 4.75V7.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),c.jsx("circle",{cx:"12",cy:"4.75",r:"1",fill:"currentColor"})]})}function XQ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),c.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function QQ(){return c.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:c.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Ak({direction:e}){return c.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:c.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function k1(){return c.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function Ck({page:e,total:t,pageSize:n,onPage:r}){const s=Math.max(1,Math.ceil(t/n));return c.jsxs("footer",{className:"skillcenter-pager",children:[c.jsxs("span",{children:["共 ",t," 项"]}),c.jsxs("div",{className:"skillcenter-pager-actions",children:[c.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:c.jsx(Ak,{direction:"left"})}),c.jsxs("span",{children:[e," / ",s]}),c.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=s,"aria-label":"下一页",children:c.jsx(Ak,{direction:"right"})})]})]})}function ph({children:e}){return c.jsx("div",{className:"skillcenter-empty",children:e})}function ZQ({skill:e,space:t,region:n,detail:r,loading:s,error:i,onClose:a}){return v.useEffect(()=>{const o=l=>{l.key==="Escape"&&a()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a]),c.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:c.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:o=>o.stopPropagation(),children:[c.jsxs("header",{className:"skill-detail-head",children:[c.jsxs("div",{className:"skill-detail-heading",children:[c.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:c.jsx(XQ,{})}),c.jsxs("div",{children:[c.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),c.jsx("p",{children:(r==null?void 0:r.description)||e.skillDescription||"暂无描述"})]})]}),c.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:c.jsx(QQ,{})})]}),c.jsxs("dl",{className:"skill-detail-meta",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"技能 ID"}),c.jsx("dd",{title:e.skillId,children:e.skillId})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"版本"}),c.jsx("dd",{children:(r==null?void 0:r.version)||e.version||"—"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"状态"}),c.jsx("dd",{children:T1(e.skillStatus)})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"技能空间"}),c.jsx("dd",{title:t.name,children:t.name})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"Project"}),c.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"地域"}),c.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),c.jsxs("div",{className:"skill-detail-content",children:[c.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?c.jsxs("div",{className:"skillcenter-loading",children:[c.jsx(k1,{}),"正在读取技能内容…"]}):i?c.jsx("div",{className:"skillcenter-error",children:i}):r!=null&&r.skillMd?c.jsx(wd,{text:qQ(r.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):c.jsx(ph,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function JQ({onClick:e}){return c.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"技能中心",title:"技能中心",children:[c.jsx(GQ,{}),c.jsx("span",{className:"sidebar-nav-label",children:"技能中心"})]})}function eZ(){const[e,t]=v.useState("cn-beijing"),[n,r]=v.useState([]),[s,i]=v.useState(1),[a,o]=v.useState(0),[l,u]=v.useState(!1),[d,f]=v.useState(""),[h,p]=v.useState(null),[m,b]=v.useState([]),[w,g]=v.useState(1),[E,y]=v.useState(0),[_,k]=v.useState(!1),[T,C]=v.useState(""),[N,R]=v.useState(null),[I,M]=v.useState(null),[B,Y]=v.useState(!1),[P,U]=v.useState(""),A=v.useRef(0);v.useEffect(()=>{let H=!0;return u(!0),f(""),fU({region:e,page:s,pageSize:kk}).then(V=>{if(!H)return;const D=V.items||[];r(D),o(V.totalCount||0),p(ne=>D.find(J=>J.id===(ne==null?void 0:ne.id))||null)}).catch(V=>{H&&(r([]),o(0),p(null),f(V instanceof Error?V.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{H&&u(!1)}),()=>{H=!1}},[e,s]),v.useEffect(()=>{if(!h){b([]),y(0);return}let H=!0;return k(!0),C(""),pU(h.id,{region:e,page:w,pageSize:Nk,project:h.projectName}).then(V=>{H&&(b(V.items||[]),y(V.totalCount||0))}).catch(V=>{H&&(b([]),y(0),C(V instanceof Error?V.message:"读取技能失败,请稍后重试"))}).finally(()=>{H&&k(!1)}),()=>{H=!1}},[e,h,w]);const L=H=>{H!==e&&(j(),t(H),i(1),g(1),p(null),b([]))},O=H=>{j(),p(H),g(1)},j=()=>{A.current+=1,R(null),M(null),U(""),Y(!1)},S=async H=>{if(!h)return;const V=A.current+1;A.current=V,R(H),M(null),U(""),Y(!0);try{const D=await mU(h.id,H.skillId,H.version,e,h.projectName);A.current===V&&M(D)}catch(D){A.current===V&&U(D instanceof Error?D.message:"读取技能详情失败,请稍后重试")}finally{A.current===V&&Y(!1)}};return c.jsxs("section",{className:"skillcenter",children:[c.jsxs("div",{className:"skillcenter-browser",children:[c.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[c.jsxs("header",{className:"skillcenter-panel-head",children:[c.jsxs("div",{children:[c.jsx("h2",{children:"技能空间"}),c.jsx("span",{className:"skillcenter-count-badge",children:a})]}),c.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[c.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>L("cn-beijing"),children:"北京"}),c.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>L("cn-shanghai"),children:"上海"})]})]}),c.jsxs("div",{className:"skillcenter-listwrap",children:[l&&c.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[c.jsx(k1,{}),"正在读取技能空间…"]}),d?c.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!l?c.jsx(ph,{children:"当前地域暂无可访问的技能空间"}):c.jsx("div",{className:"skillcenter-list",children:n.map(H=>c.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===H.id?"active":""}`,onClick:()=>O(H),children:c.jsxs("span",{className:"skillcenter-item-body",children:[c.jsx("span",{className:"skillcenter-item-title",title:H.name,children:H.name}),c.jsx("span",{className:"skillcenter-item-description",children:H.description||"暂无描述"}),c.jsxs("span",{className:"skillcenter-item-meta",children:[c.jsx("span",{className:`skillcenter-status ${Sk(H.status)}`,children:T1(H.status)}),c.jsxs("span",{className:"skillcenter-meta-text",title:H.projectName||"default",children:["Project · ",H.projectName||"default"]}),c.jsxs("span",{className:"skillcenter-meta-text",children:[H.skillCount??0," 个技能"]}),H.updatedAt&&c.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",WQ(H.updatedAt)]})]})]})},`${H.projectName||"default"}:${H.id}`))})]}),c.jsx(Ck,{page:s,total:a,pageSize:kk,onPage:i})]}),c.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?c.jsxs(c.Fragment,{children:[c.jsxs("header",{className:"skillcenter-panel-head",children:[c.jsx("div",{children:c.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),c.jsx("span",{children:E})]}),c.jsxs("div",{className:"skillcenter-listwrap",children:[_&&c.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[c.jsx(k1,{}),"正在读取技能…"]}),T?c.jsx("div",{className:"skillcenter-error",children:T}):m.length===0&&!_?c.jsx(ph,{children:"这个空间中暂无技能"}):c.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(H=>c.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void S(H),children:c.jsxs("span",{className:"skillcenter-item-body",children:[c.jsx("span",{className:"skillcenter-item-title",title:H.skillName,children:H.skillName}),c.jsx("span",{className:"skillcenter-item-description",children:H.skillDescription||"暂无描述"}),c.jsxs("span",{className:"skillcenter-item-meta",children:[c.jsx("span",{className:`skillcenter-status ${Sk(H.skillStatus)}`,children:T1(H.skillStatus)}),c.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",H.version||"—"]})]})]})},`${H.skillId}:${H.version}`))})]}),c.jsx(Ck,{page:w,total:E,pageSize:Nk,onPage:g})]}):c.jsx(ph,{children:"点击 Skill 空间以查看详情"})})]}),N&&h&&c.jsx(ZQ,{skill:N,space:h,region:e,detail:I,loading:B,error:P,onClose:j})]})}const tZ=50,Ik=48;function nZ(e){return(e.events??[]).flatMap(t=>{var s,i;const r=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((i=t.content)==null?void 0:i.role)??"",ts:t.timestamp}]:[]})}function rZ(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"未命名会话"}function sZ(e,t,n){const r=Math.max(0,t-Ik),s=Math.min(e.length,t+n+Ik);return(r>0?"…":"")+e.slice(r,s).trim()+(s{var l;if((l=o.events)!=null&&l.length)return o;try{return await cp(t,e,o.id)}catch{return o}})),a=[];for(const o of i)for(const{text:l,role:u,ts:d}of nZ(o)){const f=l.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:rZ(o),snippet:sZ(l,f,r.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,l)=>(l.ts??0)-(o.ts??0)),a.slice(0,tZ)}async function aZ(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await qI(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:r,results:s,error:i}=n;return r?i?{results:[],note:i}:{results:s.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function oZ(e,t,n,r){if(!t||!r.trim())return{results:[]};const s=await WI(t,e,r.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const i=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:i,sourceType:s.sourceType}:{type:"memory",index:o,content:a.content,sourceName:i,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function lZ(e,t,n){return e==="session"?{results:await iZ(n.userId,n.appId,t)}:e==="web"?aZ(n.appId,t):oZ(e,n.appId,n.userId,t)}function UL({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),c.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function cZ({open:e}){return c.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:c.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function uZ({onClick:e}){return c.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"智能搜索",title:"智能搜索",children:[c.jsx(UL,{}),c.jsx("span",{className:"sidebar-nav-label",children:"智能搜索"})]})}function dZ(e,t,n){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),i=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:i(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&s.has("knowledge"),unavailableLabel:i("知识库")},{id:"memory",label:"长期记忆",ready:r&&s.has("memory"),unavailableLabel:i("长期记忆")}]}function xp(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function Rk(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function fZ({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:s,onOpenSession:i}){var U,A;const[a,o]=v.useState("session"),[l,u]=v.useState(""),[d,f]=v.useState([]),[h,p]=v.useState(),[m,b]=v.useState(!1),[w,g]=v.useState(!1),[E,y]=v.useState(!1),_=v.useRef(0),k=v.useRef(null),T=dZ(t,n,r),C=T.find(L=>L.id===a),N=a==="knowledge"?(U=n==null?void 0:n.components)==null?void 0:U.find(L=>L.source==="knowledgebase"||L.kind==="knowledgebase"):a==="memory"?(A=n==null?void 0:n.components)==null?void 0:A.find(L=>L.source==="long_term_memory"||L.kind==="memory"):void 0;v.useEffect(()=>{_.current+=1,o("session"),f([]),p(void 0),g(!1),b(!1),y(!1)},[t]),v.useEffect(()=>{if(!E)return;function L(O){var j;(j=k.current)!=null&&j.contains(O.target)||y(!1)}return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[E]);async function R(L,O){var V;const j=L.trim();if(!j||!((V=T.find(D=>D.id===O))!=null&&V.ready))return;const S=++_.current;b(!0),g(!0);let H;try{H=await lZ(O,j,{userId:e,appId:t})}catch(D){const ne=D instanceof Error?D.message:String(D);H={results:[],note:`搜索失败:${ne}`}}S===_.current&&(f(H.results),p(H.note),b(!1))}function I(L){_.current+=1,u(L),f([]),p(void 0),g(!1),b(!1)}function M(L){_.current+=1,o(L),y(!1),f([]),p(void 0),g(!1),b(!1)}const B=!!(C!=null&&C.ready),Y=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(N==null?void 0:N.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(N==null?void 0:N.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",P=N!=null&&N.backend?xp(N.backend):"";return c.jsxs("div",{className:"search",children:[c.jsxs("div",{className:"search-box",children:[c.jsxs("div",{className:"search-source-picker-wrap",ref:k,children:[c.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(C==null?void 0:C.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":E,onClick:()=>y(L=>!L),children:[c.jsx("span",{children:(C==null?void 0:C.label)??"搜索类型"}),P&&c.jsx("small",{children:P}),c.jsx(cZ,{open:E})]}),E&&c.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:T.map(L=>{var S,H;const O=L.id==="knowledge"?(S=n==null?void 0:n.components)==null?void 0:S.find(V=>V.source==="knowledgebase"||V.kind==="knowledgebase"):L.id==="memory"?(H=n==null?void 0:n.components)==null?void 0:H.find(V=>V.source==="long_term_memory"||V.kind==="memory"):void 0,j=O?[O.name,O.backend?xp(O.backend):""].filter(Boolean).join(" · "):L.ready?L.description:L.unavailableLabel;return c.jsxs("button",{type:"button",role:"option","aria-selected":a===L.id,disabled:!L.ready,onClick:()=>M(L.id),children:[c.jsx("span",{children:L.label}),j&&c.jsx("small",{children:j})]},L.id)})})]}),c.jsx("span",{className:"search-box-divider","aria-hidden":!0}),c.jsx("input",{className:"search-input",value:l,onChange:L=>I(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),R(l,a))},placeholder:Y,disabled:!B,autoFocus:!0}),c.jsx("button",{className:"search-go",onClick:()=>void R(l,a),disabled:!l.trim()||m,"aria-label":"搜索",children:m?c.jsx(wt,{className:"icon spin"}):c.jsx(UL,{className:"icon"})})]}),c.jsx("div",{className:"search-results",children:B?w?m?null:h?c.jsx("div",{className:"search-empty",children:h}):d.length===0&&w?c.jsxs("div",{className:"search-empty",children:["未找到匹配「",l.trim(),"」的结果。"]}):d.map((L,O)=>c.jsx(hZ,{result:L,agentLabel:s,onOpen:i},O)):c.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):c.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(C==null?void 0:C.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function hZ({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return c.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[c.jsx(OI,{className:"search-result-icon"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsx("span",{className:"search-result-title",children:e.title}),c.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${Rk(e.ts)}`:""]})]}),c.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return c.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[c.jsx(lm,{className:"search-result-icon"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsx("span",{className:"search-result-title",children:e.title||e.url}),c.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&c.jsx(kE,{className:"search-result-ext"})]})]}),e.summary&&c.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return c.jsxs("div",{className:"search-result search-result-static",children:[c.jsx(Ok,{source:"knowledge"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),c.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${xp(e.sourceType)}`:""]})]}),c.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return c.jsxs("div",{className:"search-result search-result-static",children:[c.jsx(Ok,{source:"memory"}),c.jsxs("div",{className:"search-result-body",children:[c.jsxs("div",{className:"search-result-head",children:[c.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),c.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${xp(e.sourceType)}`:"",e.ts?` · ${Rk(e.ts)}`:""]})]}),c.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function Ok({source:e,className:t="search-result-icon"}){return e==="knowledge"?c.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),c.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):c.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[c.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),c.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}const $L="veadk_agentkit_connections";function Gs(){try{const e=localStorage.getItem($L);return e?JSON.parse(e):[]}catch{return[]}}function Tm(e){try{localStorage.setItem($L,JSON.stringify(e))}catch{}}function Va(e,t){return`agentkit:${e}:${t}`}function HL(e){try{return new URL(e).host}catch{return e}}function zl(e){FI();for(const t of e)for(const n of t.apps)BI(Va(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function zL(e,t,n,r,s){const i={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:s},a=[...Gs().filter(o=>o.runtimeId!==e),i];return Tm(a),zl(a),i}async function cx(e,t,n){let r;try{r=await eR(e,n)}catch(a){throw a instanceof ud&&N1(e),a}if(!r||r.length===0)throw N1(e),new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const s=Object.fromEntries(r.map(a=>[a,t])),i=zL(e,t,n,r,s);return Va(i.id,r[0])}async function VL(e,t,n,r){const s=t.trim().replace(/\/+$/,""),i=await dm(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||HL(s),base:s,apiKey:n.trim(),apps:i,appLabels:r&&i.length>0?{[i[0]]:r}:void 0},o=[...Gs().filter(l=>l.base!==s),a];return Tm(o),zl(o),a}function pZ(e){const t=Gs().filter(n=>n.id!==e);return Tm(t),zl(t),t}function N1(e){const t=Gs().filter(n=>n.runtimeId!==e);return Tm(t),zl(t),t}function KL(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),r=t.flatMap(s=>s.apps.map(i=>{var o;const a=((o=s.appLabels)==null?void 0:o[i])??i;return{id:Va(s.id,i),label:a,app:i,remote:!0,host:s.runtimeId?s.name:HL(s.base??"")}}));return[...n,...r]}const Lk=Object.freeze(Object.defineProperty({__proto__:null,addConnection:VL,addRuntimeConnection:zL,buildAgentEntries:KL,connectRuntime:cx,loadConnections:Gs,registerConnections:zl,remoteAppId:Va,removeConnection:pZ,removeRuntimeConnection:N1},Symbol.toStringTag,{value:"Module"}));function Uu({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),c.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),c.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),c.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),c.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),c.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),c.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}function mZ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),c.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),c.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),c.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}function gZ({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"m4.7 7.2 7.3-3 7.3 3-7.3 3.1Z"}),c.jsx("path",{d:"M7.2 9.2v4.2c0 1.7 2.15 3.05 4.8 3.05s4.8-1.35 4.8-3.05V9.2"}),c.jsx("path",{d:"M19.3 7.2v5.25"}),c.jsx("circle",{cx:"19.3",cy:"14.4",r:"1.15",fill:"currentColor",stroke:"none"})]})}function YL({className:e="icon"}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M18.7 8.15A7.55 7.55 0 0 0 5.35 7.1"}),c.jsx("path",{d:"m18.7 8.15-.2-3.05-3.02.3"}),c.jsx("path",{d:"M5.3 15.85A7.55 7.55 0 0 0 18.65 16.9"}),c.jsx("path",{d:"m5.3 15.85.2 3.05 3.02-.3"}),c.jsx("path",{d:"M6.85 12h2.8l1.4-2.9 1.9 5.8 1.42-2.9h2.78"})]})}const Mk=15,yZ=1e4,bZ=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}];function EZ(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function WL(e){const t=e.toLowerCase();return t.includes("invalidagentkitruntime.notfound")||t.includes("specified agentkitruntime does not exist")?"该 Runtime 已不存在或列表信息已过期,请刷新列表后重试。":t.includes("accessdenied")||t.includes("forbidden")||t.includes("permission")||t.includes("(401)")||t.includes("(403)")?"当前账号无权访问该 Runtime,请检查所属 Project 和访问权限。":t.includes("agent-info failed: 404")||t.includes("读取 agent 列表失败 (404)")?"该 Agent Server 版本暂不支持信息预览。":"该 Runtime 暂时无法访问,请确认其状态为“就绪”后重试。"}function o0(e,t=yZ){return new Promise((n,r)=>{const s=setTimeout(()=>r(new Error("加载超时,请重试")),t);e.then(i=>{clearTimeout(s),n(i)},i=>{clearTimeout(s),r(i)})})}function xZ({open:e,onClose:t,anchorTop:n=0,agentsSource:r,localApps:s,currentId:i,currentRuntime:a,runtimeScope:o,onSelect:l}){const[u,d]=v.useState([]),[f,h]=v.useState([""]),[p,m]=v.useState(0),[b,w]=v.useState(o==="mine"),[g,E]=v.useState(null),[y,_]=v.useState("cn-beijing"),[k,T]=v.useState(!1),[C,N]=v.useState(""),[R,I]=v.useState(""),[M,B]=v.useState(null),[Y,P]=v.useState(new Set),[U,A]=v.useState(),[L,O]=v.useState("agent"),j=v.useRef(!1);function S(W){A(ae=>(ae==null?void 0:ae.runtimeId)===W.runtimeId?void 0:{runtimeId:W.runtimeId,name:W.name,region:W.region})}const H=v.useCallback(async W=>{if(u[W]){m(W);return}const ae=f[W];if(ae!==void 0){T(!0),N("");try{const he=await o0(ch({nextToken:ae,pageSize:Mk,region:y,scope:"all"}));d(Z=>{const ce=[...Z];return ce[W]=he.runtimes,ce}),h(Z=>{const ce=[...Z];return he.nextToken&&(ce[W+1]=he.nextToken),ce}),m(W)}catch(he){N(he instanceof Error?he.message:String(he))}finally{T(!1)}}},[f,u,y]),V=v.useCallback(async()=>{T(!0),N("");try{const W=[];let ae="";do{const he=await o0(ch({scope:"mine",nextToken:ae,pageSize:100,region:y}));W.push(...he.runtimes),ae=he.nextToken}while(ae&&W.length<2e3);E(W)}catch(W){N(W instanceof Error?W.message:String(W))}finally{T(!1)}},[y]);v.useEffect(()=>{w(o==="mine"),d([]),h([""]),m(0),E(null),j.current=!1},[o]),v.useEffect(()=>{e&&r==="cloud"&&!b&&!j.current&&(j.current=!0,H(0))},[e,r,b,H]),v.useEffect(()=>{b&&g===null&&r==="cloud"&&V()},[b,g,r,V]),v.useEffect(()=>{e&&(A(void 0),O("agent"))},[e]);function D(){P(new Set),b?(E(null),V()):(d([]),h([""]),m(0),j.current=!0,T(!0),N(""),o0(ch({nextToken:"",pageSize:Mk,region:y,scope:"all"})).then(W=>{d([W.runtimes]),h(W.nextToken?["",W.nextToken]:[""])}).catch(W=>N(W instanceof Error?W.message:String(W))).finally(()=>T(!1)))}function ne(W){W!==y&&(_(W),d([]),h([""]),m(0),E(null),P(new Set),j.current=!1)}const J=!b&&(u[p+1]!==void 0||f[p+1]!==void 0);function re(W){B(W.runtimeId),cx(W.runtimeId,W.name,W.region).then(ae=>{l(ae),t()}).catch(ae=>{if(ae instanceof ud){N(ae.message);return}if(ae instanceof Ru){ae.unsupported&&P(he=>new Set(he).add(W.runtimeId)),N(ae.message);return}P(he=>new Set(he).add(W.runtimeId))}).finally(()=>B(null))}if(!e)return null;const G=(b?g??[]:u[p]??[]).filter(W=>R?W.name.toLowerCase().includes(R.toLowerCase()):!0);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:t}),c.jsxs("div",{className:`agentsel ${U?"has-detail":""}`,role:"dialog","aria-label":"选择 Agent",style:{top:n,height:`min(640px, calc(100dvh - ${n}px - 10px))`},children:[c.jsxs("div",{className:"agentsel-main",children:[c.jsxs("div",{className:"agentsel-head",children:[c.jsxs("span",{className:"agentsel-title",children:[c.jsx(Uu,{})," 选择 Agent"]}),c.jsxs("div",{className:"agentsel-head-actions",children:[r==="cloud"&&c.jsx("button",{className:"agentsel-refresh",onClick:D,title:"刷新",disabled:k,children:c.jsx(SE,{className:`icon ${k?"spin":""}`})}),c.jsx("button",{className:"agentsel-refresh",onClick:t,title:"关闭",children:c.jsx(Gr,{className:"icon"})})]})]}),r==="local"?c.jsx("div",{className:"agentsel-body",children:s.length===0?c.jsx("div",{className:"agentsel-empty",children:"暂无本地 Agent。"}):c.jsx("ul",{className:"agentsel-list",children:s.map(W=>c.jsx("li",{children:c.jsxs("button",{className:`agentsel-item ${W===i?"active":""}`,onClick:()=>{l(W),t()},children:[c.jsx(Uu,{}),c.jsx("span",{className:"agentsel-item-name",children:W})]})},W))})}):c.jsxs("div",{className:"agentsel-body agentsel-body--cloud",children:[c.jsxs("div",{className:"agentsel-tools",children:[c.jsxs("div",{className:"agentsel-search",children:[c.jsx(e1,{className:"icon"}),c.jsx("input",{value:R,onChange:W=>I(W.target.value),placeholder:"搜索 Runtime 名称"})]}),c.jsx("div",{className:"agentsel-regions","aria-label":"按部署地域筛选",children:bZ.map(W=>c.jsx("button",{type:"button",className:y===W.value?"active":"","aria-pressed":y===W.value,onClick:()=>ne(W.value),children:W.label},W.value))}),o==="all"&&c.jsxs("label",{className:"agentsel-mine",children:[c.jsx("input",{type:"checkbox",checked:b,onChange:W=>w(W.target.checked)}),"只看我创建的"]})]}),C&&c.jsx("div",{className:"agentsel-error",children:C}),c.jsxs("div",{className:"agentsel-listwrap",children:[G.length===0&&!k?c.jsx("div",{className:"agentsel-empty",children:"暂无 Runtime。"}):c.jsx("ul",{className:"agentsel-list",children:G.map(W=>{const ae=Y.has(W.runtimeId),he=M===W.runtimeId,Z=(a==null?void 0:a.runtimeId)===W.runtimeId,ce=(U==null?void 0:U.runtimeId)===W.runtimeId;return c.jsx("li",{children:c.jsxs("div",{className:`agentsel-item agentsel-runtime-item ${Z?"active":""} ${ce?"is-previewed":""}`,title:W.runtimeId,children:[c.jsx(YL,{}),c.jsxs("div",{className:"agentsel-item-main",children:[c.jsx("span",{className:"agentsel-item-name",title:W.name,children:W.name}),c.jsxs("div",{className:"agentsel-item-meta",children:[c.jsx("span",{className:`agentsel-status is-${ae?"bad":SZ(W.status)}`,children:ae?"不支持":qL(W.status)}),W.isMine&&c.jsx("span",{className:"agentsel-badge",children:"我创建的"})]})]}),c.jsxs("div",{className:"agentsel-item-actions",children:[c.jsx("button",{type:"button",className:"agentsel-connect",disabled:he||Z,onClick:()=>re(W),children:he?"连接中…":Z?"已连接":ae?"重试":"连接"}),c.jsx("button",{type:"button",className:`agentsel-info ${ce?"active":""}`,"aria-label":`查看 ${W.name} 信息`,"aria-pressed":ce,title:"查看信息",onClick:()=>S(W),children:c.jsx(cd,{className:"icon"})})]})]})},W.runtimeId)})}),k&&c.jsxs("div",{className:"agentsel-loading",children:[c.jsx(wt,{className:"icon spin"})," 加载中…"]})]}),c.jsxs("div",{className:"agentsel-pager",children:[c.jsx("button",{disabled:b||p===0||k,onClick:()=>void H(p-1),"aria-label":"上一页",children:c.jsx(aF,{className:"icon"})}),c.jsx("span",{className:"agentsel-pager-label",children:b?1:p+1}),c.jsx("button",{disabled:b||!J||k,onClick:()=>void H(p+1),"aria-label":"下一页",children:c.jsx(or,{className:"icon"})})]})]})]}),r==="cloud"&&U&&c.jsx(TZ,{runtime:U,tab:L,onTabChange:O})]})]})}const wZ={knowledgebase:"知识库",memory:"记忆",prompt_manager:"提示词管理",example_store:"样例库",run_processor:"运行处理器",tracer:"链路追踪",toolset:"工具集",plugin:"插件",other:"其他"};function vZ(e){return wZ[e.toLowerCase()]??e}function _Z(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function TZ({runtime:e,tab:t,onTabChange:n}){return c.jsxs("section",{className:"agentsel-detail agentsel-preview","aria-label":"Agent 与 Runtime 信息",children:[c.jsx("div",{className:"agentsel-head agentsel-preview-head",children:c.jsxs("div",{className:`agentsel-detail-tabs is-${t}`,role:"tablist","aria-label":"详情类型",children:[c.jsx("span",{className:"agentsel-detail-tabs-slider","aria-hidden":!0}),c.jsx("button",{id:"agentsel-agent-tab",type:"button",role:"tab","aria-selected":t==="agent","aria-controls":"agentsel-agent-panel",onClick:()=>n("agent"),children:"Agent 信息"}),c.jsx("button",{id:"agentsel-runtime-tab",type:"button",role:"tab","aria-selected":t==="runtime","aria-controls":"agentsel-runtime-panel",onClick:()=>n("runtime"),children:"Runtime 信息"})]})}),c.jsx("div",{id:"agentsel-agent-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-agent-tab",hidden:t!=="agent",children:c.jsx(kZ,{runtime:e})}),c.jsx("div",{id:"agentsel-runtime-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-runtime-tab",hidden:t!=="runtime",children:c.jsx(NZ,{runtime:e})})]})}function kZ({runtime:e}){const[t,n]=v.useState(null),[r,s]=v.useState(!0),[i,a]=v.useState(""),o=e.runtimeId,l=e.region;v.useEffect(()=>{let d=!0;return n(null),s(!0),a(""),YI(o,l).then(f=>d&&n(f)).catch(f=>{if(!d)return;const h=f instanceof Error?f.message:String(f);a(WL(h))}).finally(()=>d&&s(!1)),()=>{d=!1}},[o,l]);const u=(t==null?void 0:t.components)??[];return c.jsx("div",{className:"agentsel-detail-body",children:r?c.jsxs("div",{className:"agentsel-panel-state",children:[c.jsx(wt,{className:"icon spin"})," 读取 Agent 信息…"]}):i?c.jsxs("div",{className:"agentsel-panel-empty",children:[c.jsx("span",{children:"暂时无法读取 Agent 信息"}),c.jsx("small",{title:i,children:i})]}):t?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"agentsel-identity",children:[c.jsx(Uu,{className:"agentsel-identity-icon"}),c.jsxs("div",{className:"agentsel-identity-copy",children:[c.jsx("strong",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&c.jsx("span",{title:t.model,children:t.model})]})]}),t.description&&c.jsxs("section",{className:"agentsel-info-section",children:[c.jsx("h3",{children:"描述"}),c.jsx("p",{className:"agentsel-description",title:t.description,children:t.description})]}),t.subAgents.length>0&&c.jsx(Dk,{icon:c.jsx(LI,{className:"icon"}),title:"子 Agent",values:t.subAgents}),t.tools.length>0&&c.jsx(Dk,{icon:c.jsx(mZ,{}),title:"工具",values:t.tools}),t.skills.length>0&&c.jsxs("section",{className:"agentsel-info-section",children:[c.jsxs("h3",{children:[c.jsx(gZ,{})," 技能"]}),c.jsx("div",{className:"agentsel-info-list",children:t.skills.map(d=>c.jsxs("div",{className:"agentsel-info-list-item",children:[c.jsx("strong",{title:d.name,children:d.name}),d.description&&c.jsx("span",{title:d.description,children:d.description})]},d.name))})]}),u.length>0&&c.jsxs("section",{className:"agentsel-info-section",children:[c.jsxs("h3",{children:[c.jsx(vI,{className:"icon"})," 挂载组件"]}),c.jsx("div",{className:"agentsel-info-list",children:u.map((d,f)=>c.jsxs("div",{className:"agentsel-info-list-item agentsel-component",children:[c.jsxs("div",{className:"agentsel-component-head",children:[c.jsx("strong",{title:d.name,children:d.name}),c.jsxs("span",{children:[vZ(d.kind),d.backend?` · ${_Z(d.backend)}`:""]})]}),d.description&&c.jsx("span",{title:d.description,children:d.description})]},`${d.kind}:${d.name}:${f}`))})]}),!t.description&&t.subAgents.length===0&&t.tools.length===0&&t.skills.length===0&&u.length===0&&c.jsx("div",{className:"agentsel-panel-empty",children:"暂无更多 Agent 配置信息。"})]}):null})}function Dk({icon:e,title:t,values:n}){return c.jsxs("section",{className:"agentsel-info-section",children:[c.jsxs("h3",{children:[e,t]}),c.jsx("div",{className:"agentsel-chips",children:n.map((r,s)=>c.jsx("span",{className:"agentsel-chip",title:r,children:r},`${r}:${s}`))})]})}function NZ({runtime:e}){const[t,n]=v.useState(null),[r,s]=v.useState(!0),[i,a]=v.useState(""),o=e.runtimeId,l=e.region;v.useEffect(()=>{let d=!0;return s(!0),a(""),n(null),ME(o,l).then(f=>d&&n(f)).catch(f=>d&&a(WL(f instanceof Error?f.message:String(f)))).finally(()=>d&&s(!1)),()=>{d=!1}},[o,l]);const u=[];if(t){t.model&&u.push(["模型",t.model]),t.description&&u.push(["描述",t.description]),t.status&&u.push(["状态",qL(t.status)]),t.region&&u.push(["区域",EZ(t.region)]);const d=t.resources,f=[d.cpuMilli!=null?`CPU ${d.cpuMilli}m`:"",d.memoryMb!=null?`内存 ${d.memoryMb}MB`:"",d.minInstance!=null||d.maxInstance!=null?`实例 ${d.minInstance??"?"}~${d.maxInstance??"?"}`:""].filter(Boolean).join(" · ");f&&u.push(["资源",f]),t.currentVersion!=null&&u.push(["版本",String(t.currentVersion)])}return c.jsxs("div",{className:"agentsel-detail-body",children:[c.jsxs("div",{className:"agentsel-runtime-identity",children:[c.jsx(YL,{}),c.jsxs("div",{children:[c.jsx("strong",{title:e.name,children:e.name}),c.jsx("span",{title:e.runtimeId,children:e.runtimeId})]})]}),r?c.jsxs("div",{className:"agentsel-apps-note",children:[c.jsx(wt,{className:"icon spin"})," 读取详情…"]}):i?c.jsx("div",{className:"agentsel-error",children:i}):t?c.jsxs(c.Fragment,{children:[c.jsx("dl",{className:"agentsel-kv",children:u.map(([d,f])=>c.jsxs("div",{className:"agentsel-kv-row",children:[c.jsx("dt",{children:d}),c.jsx("dd",{children:f})]},d))}),t.envs.length>0&&c.jsxs("div",{className:"agentsel-envs",children:[c.jsx("div",{className:"agentsel-envs-head",children:"环境变量"}),t.envs.map(d=>c.jsxs("div",{className:"agentsel-env",children:[c.jsx("span",{className:"agentsel-env-k",children:d.key}),c.jsx("span",{className:"agentsel-env-v",children:d.value})]},d.key))]})]}):null]})}function SZ(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}const AZ={ready:"就绪",unreleased:"未发布",running:"运行中",active:"运行中",creating:"创建中",pending:"等待中",deploying:"部署中",updating:"更新中",failed:"失败",error:"异常",stopping:"停止中",stopped:"已停止",deleting:"删除中",deleted:"已删除"};function qL(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return AZ[t]??(e||"-")}const ux="/assets/volcengine-DM14a-L-.svg",Pk="(max-width: 860px)",CZ=54;function IZ(){return c.jsxs("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M12.5 3 5.5 13h5l-1 8 8-11h-5l.5-7z",fill:"currentColor",stroke:"none"}),c.jsx("path",{d:"M19 4.5v3M17.5 6h3",opacity:"0.85"})]})}function RZ(){return c.jsxs("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("circle",{cx:"8.25",cy:"7.75",r:"3.15"}),c.jsx("path",{d:"M2.9 19.2c.45-3.45 2.48-5.35 5.35-5.35 2.4 0 4.2 1.28 4.98 3.66"}),c.jsx("path",{d:"M17.4 4.5v15M14.8 9h5.2M14.8 15.3h5.2"}),c.jsx("circle",{cx:"17.4",cy:"9",r:"1.15",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"17.4",cy:"15.3",r:"1.15",fill:"currentColor",stroke:"none"})]})}function OZ(e){let t=2166136261;for(const r of e)t^=r.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const LZ={admin:"管理员",developer:"开发者",user:"普通用户"};function jk({role:e}){const t=LZ[e];return c.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function MZ({access:e,userInfo:t,onLogout:n}){const[r,s]=v.useState(!1),[i,a]=v.useState("");if(!t)return null;const o=QF(t),l=typeof t.email=="string"?t.email:"",u=(o||"U").slice(0,1).toUpperCase(),d=OZ(o||l||u),f=ZF(t),h=f===i?"":f;return c.jsxs("div",{className:"sidebar-user",children:[c.jsxs("button",{className:"sidebar-user-btn",onClick:()=>s(p=>!p),title:l?`${o} +${l}`:o,children:[c.jsxs("span",{className:`account-avatar${h?" has-image":""}`,style:d,children:[u,h?c.jsx("img",{className:"account-avatar-image",src:h,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>a(h)}):null]}),c.jsxs("span",{className:"sidebar-user-identity",children:[c.jsxs("span",{className:"sidebar-user-primary",children:[c.jsx("span",{className:"sidebar-user-name",children:o}),c.jsx(jk,{role:e.role})]}),l&&l!==o&&c.jsx("span",{className:"sidebar-user-email",children:l})]})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>s(!1)}),c.jsxs("div",{className:"account-pop sidebar-user-pop",children:[c.jsxs("div",{className:"account-head",children:[c.jsxs("span",{className:`account-avatar account-avatar--lg${h?" has-image":""}`,style:d,children:[u,h?c.jsx("img",{className:"account-avatar-image",src:h,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>a(h)}):null]}),c.jsxs("div",{className:"account-id",children:[c.jsxs("div",{className:"account-name-row",children:[c.jsx("div",{className:"account-name",children:o}),c.jsx(jk,{role:e.role})]}),l&&l!==o&&c.jsx("div",{className:"account-sub",children:l})]})]}),c.jsxs("button",{className:"account-logout",onClick:()=>{s(!1),n()},children:[c.jsx(NF,{className:"icon"})," 退出登录"]})]})]})]})}function DZ({branding:e,sessions:t,currentSessionId:n,features:r,access:s,streamingSids:i,agentsSource:a="local",localApps:o=[],currentAgentId:l="",currentAgentLabel:u="",currentRuntime:d,onSelectAgent:f,onNewChat:h,onSearch:p,onQuickCreate:m,onSkillCenter:b,onAddAgent:w,onManageAgents:g,onPickSession:E,onDeleteSession:y,userInfo:_,onLogout:k}){const T=L=>(r==null?void 0:r[L])!==!1,[C,N]=v.useState(null),[R,I]=v.useState(!1),M=v.useRef(typeof window<"u"&&window.matchMedia(Pk).matches),[B,Y]=v.useState(M.current),P=()=>{I(L=>!L)},U=[...t].sort((L,O)=>(O.lastUpdateTime??0)-(L.lastUpdateTime??0)),A=()=>{M.current=!1,Y(L=>!L),I(!1),N(null)};return v.useEffect(()=>{const L=window.matchMedia(Pk),O=j=>{j.matches?Y(S=>S||(M.current=!0,!0)):M.current&&(M.current=!1,Y(!1))};return L.addEventListener("change",O),()=>L.removeEventListener("change",O)},[]),c.jsxs("aside",{className:`sidebar ${B?"is-collapsed":""}`,children:[c.jsxs("div",{className:"sidebar-top",children:[c.jsxs("div",{className:"sidebar-brand-row",children:[c.jsxs("div",{className:"brand",children:[c.jsx("img",{className:"brand-logo",src:e.logoUrl||ux,width:20,height:20,alt:"","aria-hidden":!0}),c.jsx("span",{className:"brand-title",children:e.title})]}),c.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:A,"aria-label":B?"展开侧边栏":"收起侧边栏",title:B?"展开侧边栏":"收起侧边栏",children:B?c.jsx(RF,{className:"icon"}):c.jsx(IF,{className:"icon"})})]}),f&&(()=>{const L=a==="cloud"&&!l,O=a==="cloud"&&!L&&!!d,j=a==="cloud"&&!L&&(d!=null&&d.region)?d.region==="cn-beijing"?"北京":d.region==="cn-shanghai"?"上海":d.region:"";return c.jsxs("button",{className:`agent-row ${L?"agent-row--empty":""} ${O?"agent-row--connected":""}`,onClick:P,"aria-label":L?"请选择 Agent":u||"选择 Agent",title:"切换 Agent",children:[c.jsx(Uu,{className:"icon agent-row-lead"}),c.jsx("span",{className:"agent-row-name",children:L?"请选择 Agent":u||"选择 Agent"}),j&&c.jsx("span",{className:"agent-row-region",children:j}),c.jsx(or,{className:`icon agent-row-chev ${R?"open":""}`})]})})(),f&&c.jsx(xZ,{open:R,onClose:()=>I(!1),anchorTop:CZ,agentsSource:a,localApps:o,currentId:l,currentRuntime:d,runtimeScope:s.capabilities.runtimeScope,onSelect:f}),T("newChat")&&c.jsxs("button",{className:"new-chat",onClick:h,"aria-label":"新会话",title:"新会话",children:[c.jsx(hs,{className:"icon"}),c.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),T("search")&&c.jsx(uZ,{onClick:p}),T("skillCenter")&&c.jsx(JQ,{onClick:b}),s.capabilities.createAgents&&T("addAgent")&&c.jsxs("button",{className:"new-chat",onClick:m,"aria-label":"添加 Agent",title:"添加 Agent",children:[c.jsx(IZ,{}),c.jsx("span",{className:"sidebar-nav-label",children:"添加 Agent"})]}),s.capabilities.manageAgents&&T("manageAgents")&&c.jsxs("button",{className:"new-chat",onClick:g,"aria-label":"管理 Agent",title:"管理 Agent",children:[c.jsx(RZ,{}),c.jsx("span",{className:"sidebar-nav-label",children:"管理 Agent"})]})]}),T("history")&&c.jsxs("div",{className:"sidebar-history",children:[c.jsxs("div",{className:"history-head",children:[c.jsx("span",{children:"历史会话"}),T("newChat")&&c.jsx("button",{type:"button",className:"history-new-chat",onClick:h,"aria-label":"新建会话",title:"新建会话",children:c.jsx(hs,{className:"icon"})})]}),c.jsxs("div",{className:"history-list",children:[U.length===0&&c.jsx("div",{className:"history-empty",children:"暂无会话"}),U.map(L=>{const O=aR(L.events);return c.jsxs("div",{className:`history-item ${L.id===n?"active":""}`,children:[c.jsxs("button",{className:"history-item-btn",onClick:()=>E(L.id),title:O,children:[(i==null?void 0:i.has(L.id))&&c.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),c.jsx("span",{className:"history-title",children:O})]}),c.jsx("button",{className:"history-more",title:"更多",onClick:()=>N(j=>j===L.id?null:L.id),children:c.jsx(uF,{className:"icon"})}),C===L.id&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>N(null)}),c.jsx("div",{className:"history-menu",children:c.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{N(null),y(L.id)},children:[c.jsx(jl,{className:"icon"})," 删除"]})})]})]},L.id)})]})]}),c.jsx(MZ,{access:s,userInfo:_,onLogout:k})]})}function PZ({apps:e,appName:t,onAppChange:n,agentLabel:r,title:s,crumbs:i,rightContent:a}){return c.jsxs("div",{className:"navbar",children:[c.jsxs("div",{className:"navbar-left",children:[c.jsx("div",{className:"navbar-default",children:i&&i.length>0?c.jsx("nav",{className:"navbar-crumbs","aria-label":"面包屑",children:i.map((o,l)=>c.jsxs(v.Fragment,{children:[l>0&&c.jsx(or,{className:"crumb-sep"}),o.onClick?c.jsx("button",{className:"crumb crumb-link",onClick:o.onClick,children:o.label}):c.jsx("span",{className:"crumb crumb-current",children:o.label})]},l))}):s?c.jsx("div",{className:"navbar-title",title:s,children:s}):c.jsx(jZ,{apps:e,appName:t,onAppChange:n,agentLabel:r})}),c.jsx("div",{id:"veadk-page-header-left",className:"navbar-portal-slot"})]}),c.jsxs("div",{className:"navbar-right",children:[c.jsx("div",{id:"veadk-page-header-actions",className:"navbar-portal-actions"}),a]})]})}function jZ({apps:e,appName:t,onAppChange:n,agentLabel:r}){const[s,i]=v.useState(!1),[a,o]=v.useState(null),[l,u]=v.useState({}),[d,f]=v.useState(0),h=v.useRef({}),p=w=>r?r(w):w;function m(w){o(w);const g=h.current[w];if(g){const E=g.getBoundingClientRect(),y=g.closest(".agent-dd");if(y){const _=y.getBoundingClientRect();f(E.top-_.top)}}l[w]===void 0&&(u(E=>({...E,[w]:"loading"})),dd(w).then(E=>u(y=>({...y,[w]:E}))).catch(()=>u(E=>({...E,[w]:"error"}))))}function b(){i(!1),o(null)}return c.jsxs("div",{className:"agent-dd",children:[c.jsxs("button",{className:"agent-dd-trigger",onClick:()=>i(w=>!w),children:[c.jsx("span",{className:"agent-dd-current",children:t?p(t):"选择 Agent"}),c.jsx(ip,{className:`agent-dd-chev ${s?"open":""}`})]}),s&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:b}),c.jsx("div",{className:"agent-dd-menu",children:e.map(w=>c.jsx("div",{ref:g=>h.current[w]=g,className:"agent-dd-row",onMouseEnter:()=>m(w),onMouseLeave:()=>o(g=>g===w?null:g),children:c.jsxs("button",{className:`agent-dd-item ${w===t?"active":""}`,onClick:()=>{n(w),b()},children:[c.jsx("span",{className:"agent-dd-item-name",children:p(w)}),w===t&&c.jsx("span",{className:"agent-dd-item-dot","aria-label":"当前"})]})},w))}),a&&c.jsx(BZ,{state:l[a],top:d})]})]})}function BZ({state:e,top:t}){return c.jsx("div",{className:"agent-dd-flyout",style:{top:`${t}px`},children:e===void 0||e==="loading"?c.jsxs("div",{className:"agent-dd-fly-loading",children:[c.jsx(wt,{className:"icon spin"})," 加载中…"]}):e==="error"?c.jsx("div",{className:"agent-dd-fly-loading",children:"读取信息失败"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"agent-dd-fly-name",children:e.name}),e.description&&c.jsx("div",{className:"agent-dd-fly-desc",children:e.description}),c.jsxs("div",{className:"agent-dd-fly-field",children:[c.jsx(TI,{className:"icon"}),c.jsx("span",{className:"agent-dd-fly-model",children:e.model})]}),e.tools.length>0&&c.jsxs("div",{className:"agent-dd-fly-field agent-dd-fly-field--tools",children:[c.jsx(CE,{className:"icon"}),c.jsx("div",{className:"agent-dd-fly-chips",children:e.tools.map(n=>c.jsx("span",{className:"agent-dd-chip",children:n},n))})]}),e.subAgents.length>0&&c.jsxs("div",{className:"agent-dd-fly-field",children:[c.jsx("span",{className:"agent-dd-fly-label",children:"子 Agent"}),c.jsx("span",{className:"agent-dd-fly-model",children:e.subAgents.join("、")})]})]})})}const Bk={llm:{icon:$a,label:"LLM"},sequential:{icon:CI,label:"顺序"},parallel:{icon:DI,label:"并行"},loop:{icon:AE,label:"循环"},a2a:{icon:lm,label:"A2A"}};function GL(e){return 1+e.children.reduce((t,n)=>t+GL(n),0)}function El(e){return e.id||e.name}function FZ(e,t){const n=El(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const r=/^agent_sub_(\d+)$/.exec(n);return r?`子 Agent ${r[1]}`:e.name||n}function XL(e,t=!0){return{...e,id:El(e),name:FZ(e,t),children:e.children.map(n=>XL(n,!1))}}function QL(e,t){t.set(El(e),e.name||El(e)),e.children.forEach(n=>QL(n,t))}function ZL({node:e,activeAgent:t,seen:n,path:r}){const s=Bk[e.type]??Bk.llm,i=s.icon,a=El(e),o=!!a,l=o&&a===t,u=o&&!l&&r.has(a),d=o&&!l&&!u&&n.has(a);return c.jsxs("div",{className:"topo-branch",children:[c.jsxs("div",{className:`topo-node topo-type-${e.type} ${l?"is-active":""} ${u?"is-onpath":""} ${d?"is-done":""}`,title:e.description||e.name,children:[c.jsx(i,{className:"topo-icon"}),c.jsx("span",{className:"topo-name",children:e.name||"(未命名)"}),c.jsx("span",{className:"topo-badge",children:s.label})]}),l&&e.type==="a2a"&&c.jsx("div",{className:"topo-remote",children:"远程执行中…"}),e.children.length>0&&c.jsx("div",{className:"topo-children",children:e.children.map((f,h)=>c.jsx(ZL,{node:f,activeAgent:t,seen:n,path:r},`${El(f)}-${h}`))})]})}function Fk({appName:e,activeAgent:t,seenAgents:n,execPath:r=[]}){const[s,i]=v.useState(null);if(v.useEffect(()=>{let l=!1;if(i(null),!!e)return dd(e).then(u=>{l||i(u.graph?XL(u.graph):null)}).catch(()=>{l||i(null)}),()=>{l=!0}},[e]),!s||s.children.length===0)return null;const a=new Set(r),o=new Map;return QL(s,o),c.jsxs("aside",{className:"topo","aria-label":"Agent 拓扑",children:[c.jsxs("div",{className:"topo-head",children:[c.jsx("span",{className:"topo-head-title",children:"Agent 拓扑"}),c.jsxs("span",{className:"topo-head-sub",children:[GL(s)," 个"]})]}),r.length>0&&c.jsx("div",{className:"topo-path","aria-label":"执行路径",children:r.map((l,u)=>c.jsxs("span",{className:"topo-path-seg",children:[u>0&&c.jsx(or,{className:"topo-path-sep"}),c.jsx("span",{className:u===r.length-1?"topo-path-name is-current":"topo-path-name",children:o.get(l)??l})]},`${l}-${u}`))}),c.jsx("div",{className:"topo-tree",children:c.jsx(ZL,{node:s,activeAgent:t,seen:n,path:a})})]})}function UZ({onAdded:e,onCancel:t}){const[n,r]=v.useState(""),[s,i]=v.useState(""),[a,o]=v.useState(""),[l,u]=v.useState(!1),[d,f]=v.useState(""),h=n.trim().length>0&&s.trim().length>0&&!l;async function p(){if(h){u(!0),f("");try{const m=await VL(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Va(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return c.jsx("div",{className:"addagent",children:c.jsxs("div",{className:"addagent-card",children:[c.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),c.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),c.jsxs("label",{className:"addagent-field",children:[c.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),c.jsx("input",{className:"addagent-input",value:n,onChange:m=>r(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),c.jsxs("label",{className:"addagent-field",children:[c.jsx("span",{className:"addagent-label",children:"API Key"}),c.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:m=>i(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),c.jsxs("label",{className:"addagent-field",children:[c.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),c.jsx("input",{className:"addagent-input",value:a,onChange:m=>o(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&c.jsx("div",{className:"addagent-error",children:d}),c.jsxs("div",{className:"addagent-actions",children:[c.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:l,children:"取消"}),c.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[l?c.jsx(wt,{className:"icon spin"}):null,l?"连接中…":"连接并添加"]})]})]})})}function $Z({currentRuntimeId:e,onConnect:t}){const[n,r]=v.useState([]),[s,i]=v.useState(!0),[a,o]=v.useState(""),[l,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(null),[m,b]=v.useState({}),[w,g]=v.useState("cn-beijing"),[E,y]=v.useState(!1),_=v.useCallback(async()=>{i(!0),o("");try{r(await XI(w))}catch(R){o(R instanceof Error?R.message:String(R))}finally{i(!1)}},[w]);v.useEffect(()=>{_()},[_]);async function k(R){b(M=>({...M,[R.runtimeId]:{loading:!0}}));const I={loading:!1};try{I.detail=await ME(R.runtimeId,R.region)}catch(M){I.error=M instanceof Error?M.message:String(M)}I.detail&&(I.graphs=[{name:I.detail.name,description:I.detail.description,type:"llm",model:I.detail.model,tools:[],skills:[],path:[I.detail.name],mentionable:!1,children:[]}],I.graphNote="仅显示主 Agent(控制面信息)。"),b(M=>({...M,[R.runtimeId]:I}))}function T(R){const I=h===R.runtimeId;p(I?null:R.runtimeId),!I&&!m[R.runtimeId]&&k(R)}async function C(R){if(!l&&window.confirm(`确定删除 Agent "${R.name}"?该 Runtime 将被永久删除。`)){u(R.runtimeId),o("");try{await tR(R.runtimeId,R.region),r(I=>I.filter(M=>M.runtimeId!==R.runtimeId))}catch(I){o(I instanceof Error?I.message:String(I))}finally{u(null)}}}async function N(R){if(!(d||e===R.runtimeId)){f(R.runtimeId),o("");try{await t(R)}catch(I){o(I instanceof Error?I.message:String(I))}finally{f(null)}}}return c.jsxs("div",{className:"manage",children:[c.jsxs("div",{className:"manage-head",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"manage-title",children:"管理 Agent"}),c.jsx("p",{className:"manage-sub",children:"列出你有权管理的 AgentKit Runtime"})]}),c.jsxs("div",{className:"manage-head-actions",children:[c.jsxs("div",{className:"manage-region-picker",onKeyDown:R=>{R.key==="Escape"&&y(!1)},children:[c.jsxs("button",{type:"button",className:"manage-region",onClick:()=>y(R=>!R),title:"按区域筛选","aria-label":"区域筛选","aria-haspopup":"listbox","aria-expanded":E,children:[c.jsx("span",{children:w==="cn-beijing"?"北京":"上海"}),c.jsx(ip,{className:`manage-region-chevron${E?" is-open":""}`})]}),E&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>y(!1)}),c.jsx("div",{className:"manage-region-menu",role:"listbox","aria-label":"区域",children:[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}].map(R=>{const I=R.value===w;return c.jsxs("button",{type:"button",role:"option","aria-selected":I,className:`manage-region-option${I?" is-selected":""}`,onClick:()=>{g(R.value),y(!1)},children:[c.jsx("span",{children:R.label}),I&&c.jsx(Ds,{"aria-hidden":"true"})]},R.value)})})]})]}),c.jsxs("button",{type:"button",className:"manage-refresh",onClick:()=>void _(),disabled:s,title:"刷新",children:[c.jsx(SE,{className:`icon ${s?"spin":""}`}),"刷新"]})]})]}),a&&c.jsx("div",{className:"manage-error",children:a}),s?c.jsxs("div",{className:"manage-empty",children:[c.jsx(wt,{className:"icon spin"})," 加载中…"]}):n.length===0?c.jsx("div",{className:"manage-empty",children:"暂无你部署的 Agent。"}):c.jsx("ul",{className:"manage-list",children:n.map(R=>{const I=h===R.runtimeId,M=m[R.runtimeId];return c.jsxs("li",{className:"manage-item",children:[c.jsxs("div",{className:"manage-item-row",children:[c.jsxs("button",{type:"button",className:"manage-item-toggle",onClick:()=>T(R),"aria-expanded":I,children:[I?c.jsx(ip,{className:"icon"}):c.jsx(or,{className:"icon"}),c.jsxs("span",{className:"manage-item-main",children:[c.jsx("span",{className:"manage-item-name",children:R.name}),c.jsx("span",{className:`manage-badge is-${YZ(R.status)}`,children:R.status||"-"})]})]}),c.jsxs("div",{className:"manage-item-actions",children:[c.jsxs("button",{type:"button",className:"manage-connect",onClick:()=>void N(R),disabled:d!==null||e===R.runtimeId,children:[d===R.runtimeId?c.jsx(wt,{className:"icon spin"}):c.jsx(vF,{className:"icon"}),e===R.runtimeId?"已连接":"连接到此 Agent"]}),c.jsx("button",{type:"button",className:"manage-del",onClick:()=>void C(R),disabled:l===R.runtimeId,title:"删除该 Runtime",children:l===R.runtimeId?c.jsx(wt,{className:"icon spin"}):c.jsx(jl,{className:"icon"})})]})]}),c.jsxs("div",{className:"manage-item-meta",children:[c.jsx("span",{className:"manage-item-id",title:R.runtimeId,children:R.runtimeId}),c.jsx("span",{className:"manage-item-dot",children:"·"}),c.jsx("span",{children:R.region}),R.createdAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"manage-item-dot",children:"·"}),c.jsx("span",{children:eM(R.createdAt)})]})]}),I&&c.jsx("div",{className:"manage-detail",children:!M||M.loading?c.jsxs("div",{className:"manage-detail-loading",children:[c.jsx(wt,{className:"icon spin"})," 读取详情…"]}):c.jsxs(c.Fragment,{children:[M.error&&c.jsx("div",{className:"manage-error",children:M.error}),M.detail&&c.jsx(VZ,{detail:M.detail}),c.jsx("div",{className:"manage-tree-head",children:"Agent 结构"}),M.graphs&&M.graphs.length>0?M.graphs.map((B,Y)=>c.jsx(JL,{node:B},Y)):c.jsx("div",{className:"manage-tree-note",children:M.graphNote})]})})]},R.runtimeId)})})]})}const HZ=/KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL/i;function zZ({envKey:e,value:t}){const[n,r]=v.useState(!1);return!HZ.test(e)||n?c.jsx("code",{className:"manage-env-v",children:t}):c.jsx("button",{type:"button",className:"manage-env-v manage-env-masked",title:"敏感值已隐藏,点击显示","aria-label":`显示 ${e} 的值`,onClick:()=>r(!0),children:"••••••••"})}function VZ({detail:e}){const t=e.resources,n=[];e.model&&n.push(["模型",e.model]),e.description&&n.push(["描述",e.description]),e.statusMessage&&n.push(["状态信息",e.statusMessage]),e.project&&n.push(["Project",e.project]),e.currentVersion!=null&&n.push(["版本",String(e.currentVersion)]);const r=[t.cpuMilli!=null?`CPU ${t.cpuMilli}m`:"",t.memoryMb!=null?`内存 ${t.memoryMb}MB`:"",t.minInstance!=null||t.maxInstance!=null?`实例 ${t.minInstance??"?"}~${t.maxInstance??"?"}`:"",t.maxConcurrency!=null?`并发 ${t.maxConcurrency}`:""].filter(Boolean).join(" · ");return r&&n.push(["资源",r]),e.memoryId&&n.push(["Memory",e.memoryId]),e.toolId&&n.push(["Tool",e.toolId]),e.knowledgeId&&n.push(["Knowledge",e.knowledgeId]),e.mcpToolsetId&&n.push(["MCP Toolset",e.mcpToolsetId]),e.updatedAt&&n.push(["更新时间",eM(e.updatedAt)]),c.jsxs("div",{className:"manage-detail-card",children:[c.jsx("dl",{className:"manage-kv",children:n.map(([s,i])=>c.jsxs("div",{className:"manage-kv-row",children:[c.jsx("dt",{children:s}),c.jsx("dd",{children:i})]},s))}),e.envs.length>0&&c.jsxs("div",{className:"manage-envs",children:[c.jsx("div",{className:"manage-envs-head",children:"环境变量"}),e.envs.map(s=>c.jsxs("div",{className:"manage-env",children:[c.jsx("code",{className:"manage-env-k",children:s.key}),c.jsx(zZ,{envKey:s.key,value:s.value})]},s.key))]})]})}const KZ={llm:"LLM",sequential:"Sequential",parallel:"Parallel",loop:"Loop",a2a:"A2A"};function JL({node:e,depth:t=0}){return c.jsxs("div",{className:"manage-tree",style:{marginLeft:t?16:0},children:[c.jsxs("div",{className:"manage-tree-node",children:[c.jsx("span",{className:"manage-tree-name",children:e.name||"(未命名)"}),c.jsx("span",{className:"manage-tree-type",children:KZ[e.type]||e.type}),e.model&&c.jsx("span",{className:"manage-tree-model",children:e.model})]}),e.tools.length>0&&c.jsx("div",{className:"manage-tree-tools",children:e.tools.map(n=>c.jsx("span",{className:"manage-tree-tool",children:n},n))}),e.children.map((n,r)=>c.jsx(JL,{node:n,depth:t+1},r))]})}function YZ(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}function eM(e){const t=Number(e),n=Number.isFinite(t)&&String(t)===e?new Date(t*1e3):new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()}const WZ={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function qZ(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function GZ(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function XZ(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function dx(e,t){if(GZ(e))return qZ(t,e.path);if(XZ(e)){const n=WZ[e.call],r={};for(const[s,i]of Object.entries(e.args??{}))r[s]=dx(i,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function QZ(e,t){const n=dx(e,t);return n==null?"":typeof n=="string"?n:String(n)}const tM=new Map;function so(e,t){tM.set(e,t)}function ZZ(e){return tM.get(e)}function JZ(e,t,n){const r=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let i=0;idx(r,e.dataModel),resolveString:r=>QZ(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const s=e.components[r];if(!s)return null;const i=ZZ(s.component)??eJ;return c.jsx(i,{node:s,ctx:n},r)}};return c.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function rM(e){const t=v.useRef(null),n=v.useRef(!0),r=28,s=v.useCallback(()=>{const i=t.current;i&&(n.current=i.scrollHeight-i.scrollTop-i.clientHeight{const i=t.current;i&&n.current&&(i.scrollTop=i.scrollHeight)},[e]),{ref:t,onScroll:s}}function fx({value:e,onRemoveSkill:t,onRemoveAgent:n}){return e.skills.length===0&&!e.targetAgent?null:c.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(r=>c.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:r.description,children:[c.jsx(Ha,{"aria-hidden":!0}),c.jsxs("span",{children:["/",r.name]}),t?c.jsx("button",{type:"button",onClick:()=>t(r.name),"aria-label":`移除技能 ${r.name}`,children:c.jsx(Gr,{})}):null]},r.name)),e.targetAgent?c.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[c.jsx(wI,{"aria-hidden":!0}),c.jsx("span",{children:e.targetAgent.name}),n?c.jsx("button",{type:"button",onClick:n,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:c.jsx(Gr,{})}):null]}):null]})}function hx(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function sM(e){var n,r,s,i;const t=hx(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((r=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:r.toUpperCase())??"VIDEO":t==="image"?((i=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:i.toUpperCase())??"IMAGE":"TXT"}function iM(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function aM(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?zI(t,e.uri):""}function nJ({kind:e}){return e==="image"?c.jsx(II,{}):e==="video"?c.jsx(SI,{}):e==="pdf"?c.jsx(pF,{}):c.jsx(NI,{})}function px({appName:e,items:t,compact:n=!1,onRemove:r}){const[s,i]=v.useState(null);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const o=hx(a.mimeType),l=aM(a,e),u=a.status==="uploading"||a.status==="error"||!l,d=c.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>i(a),"aria-label":`预览 ${a.name??"附件"}`,children:[o==="image"&&l?c.jsx("img",{className:"media-card-image",src:l,alt:a.name??"图片",loading:"lazy"}):o==="video"&&l?c.jsxs("div",{className:"media-card-video-container",children:[c.jsx("video",{className:"media-card-video",src:l,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),c.jsx("span",{className:"media-card-video-play",children:c.jsx(LF,{})})]}):c.jsx("span",{className:"media-card-icon",children:c.jsx(nJ,{kind:o})}),c.jsxs("span",{className:"media-card-copy",children:[c.jsx("span",{className:"media-card-name",children:a.name??"附件"}),c.jsxs("span",{className:"media-card-meta",children:[c.jsx("span",{className:"media-card-type",children:sM(a)}),a.status==="uploading"?c.jsxs(c.Fragment,{children:[c.jsx(wt,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":iM(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?c.jsx(Wc,{className:"media-card-open"}):null]});return c.jsxs(Wt.div,{className:`media-card media-card--${o}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[o==="image"&&!u?c.jsx(gI,{src:l,children:d}):d,r?c.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:c.jsx(Gr,{})}):null]},a.id)})}),c.jsx($i,{children:s?c.jsx(rJ,{appName:e,item:s,onClose:()=>i(null)}):null})]})}function rJ({appName:e,item:t,onClose:n}){const r=v.useMemo(()=>aM(t,e),[e,t]),s=hx(t.mimeType),[i,a]=v.useState(""),[o,l]=v.useState(s==="text"||s==="markdown"),[u,d]=v.useState("");return v.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),v.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return l(!0),d(""),fetch(r,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||l(!1)}),()=>f.abort()},[s,r]),c.jsx(Wt.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:c.jsxs(Wt.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[c.jsxs("header",{className:"media-viewer-header",children:[c.jsxs("div",{children:[c.jsx("strong",{children:t.name??"附件"}),c.jsxs("span",{children:[sM(t),t.sizeBytes?` · ${iM(t.sizeBytes)}`:""]})]}),c.jsxs("nav",{children:[c.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:c.jsx(TE,{})}),c.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:c.jsx(Gr,{})})]})]}),c.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?c.jsx("img",{src:r,alt:t.name??"图片"}):null,s==="video"?c.jsx("div",{className:"media-viewer-video-wrapper",children:c.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?c.jsx("iframe",{src:r,title:t.name??"PDF"}):null,o?c.jsxs("div",{className:"media-viewer-loading",children:[c.jsx(wt,{})," 正在读取文档…"]}):null,!o&&u?c.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!o&&s==="markdown"?c.jsx("div",{className:"media-document",children:c.jsx(wd,{text:i})}):null,!o&&s==="text"?c.jsx("pre",{className:"media-document media-document--plain",children:i}):null]})]})})}function Vl({as:e="span",className:t="",duration:n=4,spread:r=20,children:s,style:i,...a}){const o=Math.min(Math.max(r,5),45);return c.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...i,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-o}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+o}%)`,animationDuration:`${n}s`},...a,children:s})}function sJ(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),c.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function iJ(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),c.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),c.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),c.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function aJ(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("rect",{x:"3.25",y:"5.5",width:"16.25",height:"13",rx:"2.4"}),c.jsx("path",{d:"m10.2 9.2 4.4 2.8-4.4 2.8V9.2Z"}),c.jsx("path",{d:"m19.25 2.5.42 1.2 1.2.42-1.2.42-.42 1.2-.42-1.2-1.2-.42 1.2-.42.42-1.2Z",fill:"currentColor",stroke:"none"})]})}function oJ(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),c.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),c.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function lJ(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),c.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),c.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),c.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function oM(e){return c.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:c.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function cJ({definition:e,done:t,open:n,onToggle:r}){const s=e.icon;return c.jsxs("button",{type:"button",className:`builtin-tool-head${t?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:r,"aria-expanded":n,children:[c.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:c.jsx(s,{})}),t?c.jsx("span",{className:"builtin-tool-label",children:e.doneLabel}):c.jsx(Vl,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:e.runningLabel}),c.jsx(oM,{className:`builtin-tool-chevron${n?" is-open":""}`})]})}const uJ={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:sJ},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:iJ},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:aJ},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:oJ},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:lJ}};function dJ(e){return uJ[e]}const lM="send_a2ui_json_to_client";function fJ({className:e}){return c.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:c.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function hJ(){return c.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function cM({text:e,done:t}){const[n,r]=v.useState(!t),s=v.useRef(!1);v.useEffect(()=>{s.current||r(!t)},[t]);const i=()=>{s.current=!0,r(u=>!u)},a=e.replace(/^\s+/,""),{ref:o,onScroll:l}=rM(a);return c.jsxs("div",{className:"block-thinking",children:[c.jsxs("button",{className:"think-head",onClick:i,type:"button",children:[c.jsx("span",{className:"think-icon","aria-hidden":"true",children:c.jsx(fJ,{className:`spark ${t?"":"pulse"}`})}),t?c.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):c.jsx(Vl,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),c.jsx(or,{className:`chev ${n?"open":""}`})]}),c.jsx("div",{className:`think-collapse ${n&&a?"open":""}`,children:c.jsx("div",{className:"think-collapse-inner",children:c.jsx("div",{className:"think-body scroll",ref:o,onScroll:l,children:a})})})]})}function uM(){return c.jsx(cM,{text:"",done:!1})}function pJ({name:e,args:t,response:n,done:r}){const[s,i]=v.useState(!1),a=e===lM?"渲染 UI":e,o=dJ(e),l=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=l&&l.length>2e3?l.slice(0,2e3)+` +…(已截断)`:l;return c.jsxs(Wt.div,{className:`block-tool${o?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o?c.jsx(cJ,{definition:o,done:r,open:s,onToggle:()=>i(d=>!d)}):c.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>i(d=>!d),type:"button","aria-expanded":s,children:[c.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:c.jsx(hJ,{})}),r?c.jsx("span",{className:"tool-name",children:a}):c.jsx(Vl,{className:"tool-name",duration:2.2,spread:15,children:a}),c.jsx(oM,{className:`tool-chevron${s?" is-open":""}`})]}),c.jsx("div",{className:`think-collapse ${s?"open":""}`,children:c.jsx("div",{className:"think-collapse-inner",children:c.jsxs("div",{className:"tool-detail",children:[t!=null&&c.jsxs("div",{className:"tool-section",children:[c.jsx("div",{className:"tool-section-label",children:"参数"}),c.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&c.jsxs("div",{className:"tool-section",children:[c.jsx("div",{className:"tool-section-label",children:"返回"}),c.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function mJ({block:e,onAuth:t}){const[n,r]=v.useState(e.done?"done":"idle"),[s,i]=v.useState(""),a=e.label||"MCP 工具集",o=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),l=async()=>{if(t){i(""),r("authorizing");try{await t(e),r("done")}catch(d){i(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?c.jsxs(Wt.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[c.jsx(F_,{className:"auth-card-icon auth-card-icon--done"}),c.jsxs("span",{children:["已授权 · ",a]})]}):c.jsxs(Wt.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[c.jsxs("div",{className:"auth-card-head",children:[c.jsx(F_,{className:"auth-card-icon"}),c.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),c.jsxs("p",{className:"auth-card-desc",children:["工具集 ",c.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",o&&c.jsxs(c.Fragment,{children:[" ","将跳转至 ",c.jsx("code",{className:"auth-card-code",children:o})," 完成登录,"]}),"授权完成后对话自动继续。"]}),c.jsx("button",{className:"auth-card-btn",onClick:l,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?c.jsxs(c.Fragment,{children:[c.jsx(wt,{className:"cw-i spin"})," 等待授权…"]}):c.jsx(c.Fragment,{children:"去授权"})}),!e.authUri&&c.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&c.jsx("div",{className:"auth-card-err",children:s})]})}function mx({blocks:e,appName:t="",onAction:n,onAuth:r}){return c.jsx(c.Fragment,{children:e.map((s,i)=>{switch(s.kind){case"thinking":return c.jsx(cM,{text:s.text,done:s.done},i);case"text":{const a=s.text.replace(/^\s+/,"");return a?c.jsx("div",{className:"bubble",children:c.jsx(wd,{text:a})},i):null}case"attachment":return c.jsx(px,{appName:t,items:s.files},i);case"invocation":return c.jsx(fx,{value:s.value},i);case"tool":return s.name===lM&&s.done?null:c.jsx(pJ,{name:s.name,args:s.args,response:s.response,done:s.done},i);case"auth":return c.jsx(mJ,{block:s,onAuth:r},i);case"a2ui":return nM(s.messages).filter(a=>a.components[a.rootId]).map(a=>c.jsx(Wt.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:c.jsx(tJ,{surface:a,onAction:n})},`${i}-${a.surfaceId}`));default:return null}})})}function gJ(e){return e.isComposing||e.keyCode===229}const ws=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"临时会话",description:"在 AgentKit 沙箱中执行一次性任务"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}];function Uk({mode:e}){return e==="skill-create"?c.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),c.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?c.jsx("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{d:"M4.1 4.2h11.8v8.7H9l-3.5 2.8v-2.8H4.1z",strokeDasharray:"2.25 1.9"})}):c.jsx(Uu,{className:"new-chat-mode__agent-icon"})}function yJ({value:e,agentName:t,onChange:n,disabled:r=!1,temporaryEnabled:s,skillCreateEnabled:i}){const[a,o]=v.useState(!1),[l,u]=v.useState(()=>ws.findIndex(E=>E.value===e)),d=v.useRef(null),f=v.useRef(null),h=ws.find(E=>E.value===e)??ws[0];function p(E){return E.value==="temporary"?s:E.value==="skill-create"?i:!0}function m(E){return p(E)!==!0}function b(E){const y=p(E);return y===void 0?"正在检查配置":y?E.description:"管理员未配置"}v.useEffect(()=>{if(!a)return;const E=y=>{var _;(_=d.current)!=null&&_.contains(y.target)||o(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[a]);function w(E){let y=l;do y=(y+E+ws.length)%ws.length;while(m(ws[y]));u(y)}function g(E){var y;m(E)||(n(E.value),o(!1),(y=f.current)==null||y.focus())}return c.jsxs("div",{className:"new-chat-mode",ref:d,children:[c.jsxs("button",{ref:f,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":a,disabled:r,onClick:()=>{u(ws.findIndex(E=>E.value===e)),o(E=>!E)},onKeyDown:E=>{E.key==="ArrowDown"||E.key==="ArrowUp"?(E.preventDefault(),a?w(E.key==="ArrowDown"?1:-1):o(!0)):a&&(E.key==="Enter"||E.key===" ")?(E.preventDefault(),g(ws[l])):a&&E.key==="Escape"&&(E.preventDefault(),o(!1))},children:[c.jsx("span",{className:"new-chat-mode__icon",children:c.jsx(Uk,{mode:h.value})}),c.jsx("span",{className:"new-chat-mode__current",title:h.value==="agent"?t:void 0,children:h.value==="agent"?t:h.label}),c.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:c.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),a?c.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:E=>{var y;E.key==="ArrowDown"||E.key==="ArrowUp"?(E.preventDefault(),w(E.key==="ArrowDown"?1:-1)):E.key==="Enter"?(E.preventDefault(),g(ws[l])):E.key==="Escape"&&(E.preventDefault(),o(!1),(y=f.current)==null||y.focus())},children:ws.map((E,y)=>c.jsxs("button",{type:"button",role:"option","aria-selected":e===E.value,"aria-disabled":m(E),disabled:m(E),className:`new-chat-mode__option${y===l?" is-active":""}`,onMouseEnter:()=>u(y),onClick:()=>g(E),children:[c.jsx("span",{className:"new-chat-mode__option-icon",children:c.jsx(Uk,{mode:E.value})}),c.jsxs("span",{className:"new-chat-mode__copy",children:[c.jsxs("span",{className:"new-chat-mode__label",children:[E.value==="agent"?t:E.label,E.value==="skill-create"?c.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),c.jsx("span",{children:b(E)})]}),e===E.value?c.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},E.value))}):null]})}const gx=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function bJ({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:r,value:s,onChange:i,onSubmit:a,disabled:o,busy:l,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:b=!0,onInvocationChange:w,onAddFiles:g,onRemoveAttachment:E,newChatMode:y="agent",newChatLayout:_=!1,showModeSelector:k=!1,onModeChange:T,temporaryEnabled:C,skillCreateEnabled:N}){const R=v.useRef(null),I=v.useRef(null),M=v.useRef(null),B=v.useRef(null),[Y,P]=v.useState(!1),[U,A]=v.useState(null),[L,O]=v.useState(0),[j,S]=v.useState(!1);async function H(){if(e)try{await navigator.clipboard.writeText(e),S(!0),setTimeout(()=>S(!1),1500)}catch{S(!1)}}v.useLayoutEffect(()=>{const Z=R.current;Z&&(Z.style.height="auto",Z.style.height=`${Math.min(Z.scrollHeight,200)}px`)},[s]);const V=y==="skill-create";v.useEffect(()=>{V&&(P(!1),A(null))},[V]);const D=!V&&d.some(Z=>Z.status!=="ready"),ne=!o&&!l&&!D&&(s.trim().length>0||!V&&d.length>0),J=(U==null?void 0:U.query.toLocaleLowerCase())??"",re=(U==null?void 0:U.kind)==="skill"?f.filter(Z=>!p.skills.some(ce=>ce.name===Z.name)).filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(J)).map(Z=>({kind:"skill",value:Z})):(U==null?void 0:U.kind)==="agent"?h.filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(J)).map(Z=>({kind:"agent",value:Z})):[];function de(Z){var ce;P(!1),A(null),(ce=Z.current)==null||ce.click()}function G(Z,ce){const Ce=Z.slice(0,ce),Ee=/(^|\s)([/@])([^\s/@]*)$/.exec(Ce);if(!Ee){A(null);return}const ge=Ee[2].length+Ee[3].length,Me={kind:Ee[2]==="/"?"skill":"agent",query:Ee[3],start:ce-ge,end:ce},ve=!U||U.kind!==Me.kind||U.query!==Me.query||U.start!==Me.start||U.end!==Me.end;A(Me),ve&&O(0),P(!1)}function W(Z){if(!U)return;const ce=s.slice(0,U.start)+s.slice(U.end);i(ce),Z.kind==="skill"?w({...p,skills:[...p.skills,Z.value]}):w({skills:[],targetAgent:Z.value});const Ce=U.start;A(null),requestAnimationFrame(()=>{var Ee,ge;(Ee=R.current)==null||Ee.focus(),(ge=R.current)==null||ge.setSelectionRange(Ce,Ce)})}function ae(){if(p.targetAgent){w({skills:[]});return}p.skills.length>0&&w({...p,skills:p.skills.slice(0,-1)})}function he(Z){const ce=Z.target.files?Array.from(Z.target.files):[];ce.length&&g(ce),Z.target.value=""}return c.jsxs("div",{className:`composer${_?" composer--new-chat":""}`,children:[V?null:c.jsx(fx,{value:p,onRemoveSkill:Z=>w({...p,skills:p.skills.filter(ce=>ce.name!==Z)}),onRemoveAgent:()=>w({skills:[]})}),!V&&d.length>0&&c.jsx(px,{appName:n,compact:!0,items:d,onRemove:E}),c.jsxs("div",{className:"composer-box",children:[U?c.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":U.kind==="skill"?"可用技能":"可用子 Agent",children:[c.jsxs("div",{className:"composer-command-head",children:[U.kind==="skill"?c.jsx(Ha,{}):c.jsx(wI,{}),c.jsx("span",{children:U.kind==="skill"?"调用技能":"使用子 Agent"}),c.jsx("kbd",{children:U.kind==="skill"?"/":"@"})]}),m?c.jsxs("div",{className:"composer-command-empty",children:[c.jsx(wt,{className:"spin"})," 正在读取 Agent 能力…"]}):re.length===0?c.jsx("div",{className:"composer-command-empty",children:U.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):c.jsx("div",{className:"composer-command-list",children:re.map((Z,ce)=>c.jsxs("button",{type:"button",role:"option","aria-selected":ce===L,className:`composer-command-item${ce===L?" is-active":""}`,onMouseDown:Ce=>{Ce.preventDefault(),W(Z)},onMouseEnter:()=>O(ce),children:[c.jsx("span",{className:`composer-command-icon composer-command-icon--${Z.kind}`,children:Z.kind==="skill"?c.jsx(Ha,{}):c.jsx($a,{})}),c.jsxs("span",{className:"composer-command-copy",children:[c.jsxs("strong",{children:[Z.kind==="skill"?"/":"@",Z.value.name]}),c.jsx("span",{children:Z.value.description||(Z.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),c.jsx("kbd",{children:ce===L?"↵":Z.kind==="skill"?"技能":"Agent"})]},`${Z.kind}-${Z.value.name}`))})]}):null,V?null:c.jsxs("div",{className:"composer-menu-wrap",children:[c.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:o||!b,onClick:()=>{A(null),P(Z=>!Z)},children:c.jsx(hs,{className:"icon"})}),Y&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"menu-scrim",onClick:()=>P(!1)}),c.jsxs("div",{className:"composer-menu",role:"menu",children:[c.jsxs("button",{type:"button",className:"menu-item",onClick:()=>de(I),children:[c.jsx(II,{className:"icon"}),"上传图片"]}),c.jsxs("button",{type:"button",className:"menu-item",onClick:()=>de(M),children:[c.jsx(NI,{className:"icon"}),"上传文档或 PDF"]}),c.jsxs("button",{type:"button",className:"menu-item",onClick:()=>de(B),children:[c.jsx(SI,{className:"icon"}),"上传视频"]})]})]})]}),c.jsx("div",{className:"composer-input-stack",children:c.jsx("textarea",{ref:R,className:"comp-input scroll",rows:_?4:1,value:s,disabled:o,placeholder:V?`描述你想创建的 Skill,将使用 ${gx.join(" 和 ")} 并行创建…`:o?"请选择 Agent":`向 ${r} 发消息…`,"aria-expanded":!!U,onChange:Z=>{i(Z.target.value),V||G(Z.target.value,Z.target.selectionStart)},onSelect:Z=>{V||G(Z.currentTarget.value,Z.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>A(null),0),onKeyDown:Z=>{if(!gJ(Z.nativeEvent)){if(U){if(Z.key==="ArrowDown"&&re.length>0){Z.preventDefault(),O(ce=>(ce+1)%re.length);return}if(Z.key==="ArrowUp"&&re.length>0){Z.preventDefault(),O(ce=>(ce-1+re.length)%re.length);return}if((Z.key==="Enter"||Z.key==="Tab")&&re[L]){Z.preventDefault(),W(re[L]);return}if(Z.key==="Escape"){Z.preventDefault(),A(null);return}}if(Z.key==="Backspace"&&!s&&Z.currentTarget.selectionStart===0&&Z.currentTarget.selectionEnd===0){ae();return}Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),ne&&a())}}})}),k&&T?c.jsx(yJ,{value:y,agentName:r,onChange:T,disabled:l,temporaryEnabled:C,skillCreateEnabled:N}):null,c.jsx(Wt.button,{type:"button",className:"comp-send",disabled:!ne,onClick:a,"aria-label":"发送",whileTap:ne?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:l?c.jsx(wt,{className:"icon spin"}):c.jsx(xI,{className:"icon"})})]}),u&&c.jsxs("div",{className:"composer-meta",children:[c.jsxs("span",{className:"composer-session-line",children:["会话 ID:",c.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&c.jsx("button",{type:"button",className:"composer-session-copy",title:j?"已复制":"复制会话 ID","aria-label":j?"已复制会话 ID":"复制会话 ID",onClick:()=>void H(),children:j?c.jsx(Ds,{}):c.jsx(_E,{})})]}),c.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),c.jsx("span",{children:"回答仅供参考"})]}),c.jsx("input",{ref:I,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:he}),c.jsx("input",{ref:M,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:he}),c.jsx("input",{ref:B,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:he})]})}function dM({title:e,sub:t,cards:n,footer:r}){return c.jsxs("div",{className:"stk",children:[c.jsxs("div",{className:"stk-head",children:[c.jsx("h1",{className:"stk-title",children:e}),t&&c.jsx("p",{className:"stk-sub",children:t})]}),c.jsx("div",{className:"stk-list",children:n.map((s,i)=>c.jsxs(Wt.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:i*.04},children:[c.jsx("span",{className:"stk-card-icon",children:c.jsx(s.icon,{})}),c.jsxs("span",{className:"stk-card-text",children:[c.jsx("span",{className:"stk-card-title",children:s.title}),c.jsx("span",{className:"stk-card-desc",children:s.desc})]}),c.jsx(or,{className:"stk-card-arrow"})]},s.key))}),r&&c.jsx("div",{className:"stk-footer",children:r})]})}const yx=Symbol.for("yaml.alias"),S1=Symbol.for("yaml.document"),Hi=Symbol.for("yaml.map"),fM=Symbol.for("yaml.pair"),Ms=Symbol.for("yaml.scalar"),Kl=Symbol.for("yaml.seq"),Xr=Symbol.for("yaml.node.type"),Yl=e=>!!e&&typeof e=="object"&&e[Xr]===yx,vd=e=>!!e&&typeof e=="object"&&e[Xr]===S1,_d=e=>!!e&&typeof e=="object"&&e[Xr]===Hi,pn=e=>!!e&&typeof e=="object"&&e[Xr]===fM,Pt=e=>!!e&&typeof e=="object"&&e[Xr]===Ms,Td=e=>!!e&&typeof e=="object"&&e[Xr]===Kl;function fn(e){if(e&&typeof e=="object")switch(e[Xr]){case Hi:case Kl:return!0}return!1}function hn(e){if(e&&typeof e=="object")switch(e[Xr]){case yx:case Hi:case Ms:case Kl:return!0}return!1}const hM=e=>(Pt(e)||fn(e))&&!!e.anchor,pa=Symbol("break visit"),EJ=Symbol("skip children"),ru=Symbol("remove node");function Wl(e,t){const n=xJ(t);vd(e)?Uo(null,e.contents,n,Object.freeze([e]))===ru&&(e.contents=null):Uo(null,e,n,Object.freeze([]))}Wl.BREAK=pa;Wl.SKIP=EJ;Wl.REMOVE=ru;function Uo(e,t,n,r){const s=wJ(e,t,n,r);if(hn(s)||pn(s))return vJ(e,r,s),Uo(e,s,n,r);if(typeof s!="symbol"){if(fn(t)){r=Object.freeze(r.concat(t));for(let i=0;ie.replace(/[!,[\]{}]/g,t=>_J[t]);class sr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},sr.defaultYaml,t),this.tags=Object.assign({},sr.defaultTags,n)}clone(){const t=new sr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new sr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:sr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},sr.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:sr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},sr.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[i,a]=r;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const a=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,a),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,r,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+TJ(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let s;if(t&&r.length>0&&hn(t.contents)){const i={};Wl(t.contents,(a,o)=>{hn(o)&&o.tag&&(i[o.tag]=!0)}),s=Object.keys(i)}else s=[];for(const[i,a]of r)i==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(o=>o.startsWith(a)))&&n.push(`%TAG ${i} ${a}`);return n.join(` +`)}}sr.defaultYaml={explicit:!1,version:"1.2"};sr.defaultTags={"!!":"tag:yaml.org,2002:"};function pM(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function mM(e){const t=new Set;return Wl(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function gM(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function kJ(e,t){const n=[],r=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=mM(e));const a=gM(t,s);return s.add(a),a},setAnchors:()=>{for(const i of n){const a=r.get(i);if(typeof a=="object"&&a.anchor&&(Pt(a.node)||fn(a.node)))a.node.anchor=a.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:r}}function $o(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;sYr(r,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!hM(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=i=>{r.res=i,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class bx{constructor(t){Object.defineProperty(this,Xr,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!vd(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Yr(this,"",a);if(typeof s=="function")for(const{count:l,res:u}of a.anchors.values())s(u,l);return typeof i=="function"?$o(i,{"":o},"",o):o}}class Ex extends bx{constructor(t){super(yx),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],Wl(t,{Node:(i,a)=>{(Yl(a)||hM(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let s;for(const i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:s,maxAliasCount:i}=n,a=this.resolve(s,n);if(!a){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=r.get(a);if(o||(Yr(a,null,n),o=r.get(a)),(o==null?void 0:o.res)===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=mh(s,a,r)),o.count*o.aliasCount>i)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(t,n,r){const s=`*${this.source}`;if(t){if(pM(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${s} `}return s}}function mh(e,t,n){if(Yl(t)){const r=t.resolve(e),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(fn(t)){let r=0;for(const s of t.items){const i=mh(e,s,n);i>r&&(r=i)}return r}else if(pn(t)){const r=mh(e,t.key,n),s=mh(e,t.value,n);return Math.max(r,s)}return 1}const yM=e=>!e||typeof e!="function"&&typeof e!="object";class Xe extends bx{constructor(t){super(Ms),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Yr(this.value,t,n)}toString(){return String(this.value)}}Xe.BLOCK_FOLDED="BLOCK_FOLDED";Xe.BLOCK_LITERAL="BLOCK_LITERAL";Xe.PLAIN="PLAIN";Xe.QUOTE_DOUBLE="QUOTE_DOUBLE";Xe.QUOTE_SINGLE="QUOTE_SINGLE";const NJ="tag:yaml.org,2002:";function SJ(e,t,n){if(t){const r=n.filter(i=>i.tag===t),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(r=>{var s;return((s=r.identify)==null?void 0:s.call(r,e))&&!r.format})}function $u(e,t,n){var f,h,p;if(vd(e)&&(e=e.contents),hn(e))return e;if(pn(e)){const m=(h=(f=n.schema[Hi]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:a,sourceObjects:o}=n;let l;if(r&&e&&typeof e=="object"){if(l=o.get(e),l)return l.anchor??(l.anchor=s(e)),new Ex(l.anchor);l={anchor:null,node:null},o.set(e,l)}t!=null&&t.startsWith("!!")&&(t=NJ+t.slice(2));let u=SJ(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new Xe(e);return l&&(l.node=m),m}u=e instanceof Map?a[Hi]:Symbol.iterator in Object(e)?a[Kl]:a[Hi]}i&&(i(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new Xe(e);return t?d.tag=t:u.default||(d.tag=u.tag),l&&(l.node=d),d}function wp(e,t,n){let r=n;for(let s=t.length-1;s>=0;--s){const i=t[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const a=[];a[i]=r,r=a}else r=new Map([[i,r]])}return $u(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Ic=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class bM extends bx{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>hn(r)||pn(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Ic(t))this.add(n);else{const[r,...s]=t,i=this.get(r,!0);if(fn(i))i.addIn(s,n);else if(i===void 0&&this.schema)this.set(r,wp(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const s=this.get(n,!0);if(fn(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...s]=t,i=this.get(r,!0);return s.length===0?!n&&Pt(i)?i.value:i:fn(i)?i.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!pn(n))return!1;const r=n.value;return r==null||t&&Pt(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const s=this.get(n,!0);return fn(s)?s.hasIn(r):!1}setIn(t,n){const[r,...s]=t;if(s.length===0)this.set(r,n);else{const i=this.get(r,!0);if(fn(i))i.setIn(s,n);else if(i===void 0&&this.schema)this.set(r,wp(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}}const AJ=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Xs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Ta=(e,t,n)=>e.endsWith(` +`)?Xs(n,t):n.includes(` +`)?` +`+Xs(n,t):(e.endsWith(" ")?"":" ")+n,EM="flow",A1="block",gh="quoted";function km(e,t,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:a,onOverflow:o}={}){if(!s||s<0)return e;ss-Math.max(2,i)?u.push(0):f=s-r);let h,p,m=!1,b=-1,w=-1,g=-1;n===A1&&(b=$k(e,b,t.length),b!==-1&&(f=b+l));for(let y;y=e[b+=1];){if(n===gh&&y==="\\"){switch(w=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}g=b}if(y===` +`)n===A1&&(b=$k(e,b,t.length)),f=b+t.length+l,h=void 0;else{if(y===" "&&p&&p!==" "&&p!==` +`&&p!==" "){const _=e[b+1];_&&_!==" "&&_!==` +`&&_!==" "&&(h=b)}if(b>=f)if(h)u.push(h),f=h+l,h=void 0;else if(n===gh){for(;p===" "||p===" ";)p=y,y=e[b+=1],m=!0;const _=b>g+1?b-2:w-1;if(d[_])return e;u.push(_),d[_]=!0,f=_+l,h=void 0}else m=!0}p=y}if(m&&o&&o(),u.length===0)return e;a&&a();let E=e.slice(0,u[0]);for(let y=0;y({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Sm=e=>/^(%|---|\.\.\.)/m.test(e);function CJ(e,t,n){if(!t||t<0)return!1;const r=t-n,s=e.length;if(s<=r)return!1;for(let i=0,a=0;ir)return!0;if(a=i+1,s-a<=r)return!1}return!0}function su(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,s=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(Sm(e)?" ":"");let a="",o=0;for(let l=0,u=n[l];u;u=n[++l])if(u===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(a+=n.slice(o,l)+"\\ ",l+=1,o=l,u="\\"),u==="\\")switch(n[l+1]){case"u":{a+=n.slice(o,l);const d=n.substr(l+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(l,6)}l+=5,o=l+1}break;case"n":if(r||n[l+2]==='"'||n.length +`;let f,h;for(h=n.length;h>0;--h){const k=n[h-1];if(k!==` +`&&k!==" "&&k!==" ")break}let p=n.substring(h);const m=p.indexOf(` +`);m===-1?f="-":n===p||m!==p.length-1?(f="+",i&&i()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===` +`&&(p=p.slice(0,-1)),p=p.replace(I1,`$&${u}`));let b=!1,w,g=-1;for(w=0;w{T=!0});const N=km(`${E}${k}${p}`,u,A1,C);if(!T)return`>${_} +${u}${N}`}return n=n.replace(/\n+/g,`$&${u}`),`|${_} +${u}${E}${n}${p}`}function IJ(e,t,n,r){const{type:s,value:i}=e,{actualString:a,implicitKey:o,indent:l,indentStep:u,inFlow:d}=t;if(o&&i.includes(` +`)||d&&/[[\]{},]/.test(i))return Ho(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||d||!i.includes(` +`)?Ho(i,t):yh(e,t,n,r);if(!o&&!d&&s!==Xe.PLAIN&&i.includes(` +`))return yh(e,t,n,r);if(Sm(i)){if(l==="")return t.forceBlockIndent=!0,yh(e,t,n,r);if(o&&l===u)return Ho(i,t)}const f=i.replace(/\n+/g,`$& +${l}`);if(a){const h=b=>{var w;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((w=b.test)==null?void 0:w.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Ho(i,t)}return o?f:km(f,l,EM,Nm(t,!1))}function xx(e,t,n,r){const{implicitKey:s,inFlow:i}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:o}=e;o!==Xe.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=Xe.QUOTE_DOUBLE);const l=d=>{switch(d){case Xe.BLOCK_FOLDED:case Xe.BLOCK_LITERAL:return s||i?Ho(a.value,t):yh(a,t,n,r);case Xe.QUOTE_DOUBLE:return su(a.value,t);case Xe.QUOTE_SINGLE:return C1(a.value,t);case Xe.PLAIN:return IJ(a,t,n,r);default:return null}};let u=l(o);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=l(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function xM(e,t){const n=Object.assign({blockQuote:!0,commentString:AJ,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function RJ(e,t){var s;if(t.tag){const i=e.filter(a=>a.tag===t.tag);if(i.length>0)return i.find(a=>a.format===t.format)??i[0]}let n,r;if(Pt(t)){r=t.value;let i=e.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(i.length>1){const a=i.filter(o=>o.test);a.length>0&&(i=a)}n=i.find(a=>a.format===t.format)??i.find(a=>!a.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){const i=((s=r==null?void 0:r.constructor)==null?void 0:s.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function OJ(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const s=[],i=(Pt(e)||fn(e))&&e.anchor;i&&pM(i)&&(n.add(i),s.push(`&${i}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(r.directives.tagString(a)),s.join(" ")}function xl(e,t,n,r){var l;if(pn(e))return e.toString(t,n,r);if(Yl(e)){if(t.doc.directives)return e.toString(t);if((l=t.resolvedAliases)!=null&&l.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const i=hn(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=RJ(t.doc.schema.tags,i));const a=OJ(i,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const o=typeof s.stringify=="function"?s.stringify(i,t,n,r):Pt(i)?xx(i,t,n,r):i.toString(t,n,r);return a?Pt(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} +${t.indent}${o}`:o}function LJ({key:e,value:t},n,r,s){const{allNullValues:i,doc:a,indent:o,indentStep:l,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=hn(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(fn(e)||!hn(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||fn(e)||(Pt(e)?e.type===Xe.BLOCK_FOLDED||e.type===Xe.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!i),indent:o+l});let m=!1,b=!1,w=xl(e,n,()=>m=!0,()=>b=!0);if(!p&&!n.inFlow&&w.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return m&&r&&r(),w===""?"?":p?`? ${w}`:w}else if(i&&!f||t==null&&p)return w=`? ${w}`,h&&!m?w+=Ta(w,n.indent,u(h)):b&&s&&s(),w;m&&(h=null),p?(h&&(w+=Ta(w,n.indent,u(h))),w=`? ${w} +${o}:`):(w=`${w}:`,h&&(w+=Ta(w,n.indent,u(h))));let g,E,y;hn(t)?(g=!!t.spaceBefore,E=t.commentBefore,y=t.comment):(g=!1,E=null,y=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&Pt(t)&&(n.indentAtStart=w.length+1),b=!1,!d&&l.length>=2&&!n.inFlow&&!p&&Td(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const k=xl(t,n,()=>_=!0,()=>b=!0);let T=" ";if(h||g||E){if(T=g?` +`:"",E){const C=u(E);T+=` +${Xs(C,n.indent)}`}k===""&&!n.inFlow?T===` +`&&y&&(T=` + +`):T+=` +${n.indent}`}else if(!p&&fn(t)){const C=k[0],N=k.indexOf(` +`),R=N!==-1,I=n.inFlow??t.flow??t.items.length===0;if(R||!I){let M=!1;if(R&&(C==="&"||C==="!")){let B=k.indexOf(" ");C==="&"&&B!==-1&&Be===Af||typeof e=="symbol"&&e.description===Af,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Xe(Symbol(Af)),{addToJSMap:vM}),stringify:()=>Af},MJ=(e,t)=>(ni.identify(t)||Pt(t)&&(!t.type||t.type===Xe.PLAIN)&&ni.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===ni.tag&&n.default));function vM(e,t,n){const r=_M(e,n);if(Td(r))for(const s of r.items)l0(e,t,s);else if(Array.isArray(r))for(const s of r)l0(e,t,s);else l0(e,t,r)}function l0(e,t,n){const r=_M(e,n);if(!_d(r))throw new Error("Merge sources must be maps or map aliases");const s=r.toJSON(null,e,Map);for(const[i,a]of s)t instanceof Map?t.has(i)||t.set(i,a):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function _M(e,t){return e&&Yl(t)?t.resolve(e.doc,e):t}function TM(e,t,{key:n,value:r}){if(hn(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(MJ(e,n))vM(e,t,r);else{const s=Yr(n,"",e);if(t instanceof Map)t.set(s,Yr(r,s,e));else if(t instanceof Set)t.add(s);else{const i=DJ(n,s,e),a=Yr(r,i,e);i in t?Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[i]=a}}return t}function DJ(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(hn(e)&&(n!=null&&n.doc)){const r=xM(n.doc,{});r.anchors=new Set;for(const i of n.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;const s=e.toString(r);if(!n.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),wM(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(t)}function wx(e,t,n){const r=$u(e,void 0,n),s=$u(t,void 0,n);return new lr(r,s)}class lr{constructor(t,n=null){Object.defineProperty(this,Xr,{value:fM}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return hn(n)&&(n=n.clone(t)),hn(r)&&(r=r.clone(t)),new lr(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return TM(n,r,this)}toString(t,n,r){return t!=null&&t.doc?LJ(this,t,n,r):JSON.stringify(this)}}function kM(e,t,n){return(t.inFlow??e.flow?jJ:PJ)(e,t,n)}function PJ({comment:e,items:t},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:a,onComment:o}){const{indent:l,options:{commentString:u}}=n,d=Object.assign({},n,{indent:i,type:null});let f=!1;const h=[];for(let m=0;mw=null,()=>f=!0);w&&(g+=Ta(g,i,u(w))),f&&w&&(f=!1),h.push(r+g)}let p;if(h.length===0)p=s.start+s.end;else{p=h[0];for(let m=1;mw=null);u||(u=f.length>d||g.includes(` +`)),m0&&(u||(u=f.reduce((E,y)=>E+y.length+2,2)+(g.length+2)>t.options.lineWidth)),u&&(g+=",")),w&&(g+=Ta(g,r,o(w))),f.push(g),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((b,w)=>b+w.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const b of f)m+=b?` +${i}${s}${b}`:` +`;return`${m} +${s}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function vp({indent:e,options:{commentString:t}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){const i=Xs(t(r),e);n.push(i.trimStart())}}function ka(e,t){const n=Pt(t)?t.value:t;for(const r of e)if(pn(r)&&(r.key===t||r.key===n||Pt(r.key)&&r.key.value===n))return r}class zr extends bM{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Hi,t),this.items=[]}static from(t,n,r){const{keepUndefined:s,replacer:i}=r,a=new this(t),o=(l,u)=>{if(typeof i=="function")u=i.call(n,l,u);else if(Array.isArray(i)&&!i.includes(l))return;(u!==void 0||s)&&a.items.push(wx(l,u,r))};if(n instanceof Map)for(const[l,u]of n)o(l,u);else if(n&&typeof n=="object")for(const l of Object.keys(n))o(l,n[l]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;pn(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new lr(t,t==null?void 0:t.value):r=new lr(t.key,t.value);const s=ka(this.items,r.key),i=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);Pt(s.value)&&yM(r.value)?s.value.value=r.value:s.value=r.value}else if(i){const o=this.items.findIndex(l=>i(r,l)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){const n=ka(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=ka(this.items,t),s=r==null?void 0:r.value;return(!n&&Pt(s)?s.value:s)??void 0}has(t){return!!ka(this.items,t)}set(t,n){this.add(new lr(t,n),!0)}toJSON(t,n,r){const s=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items)TM(n,s,i);return s}toString(t,n,r){if(!t)return JSON.stringify(this);for(const s of this.items)if(!pn(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),kM(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const ql={collection:"map",default:!0,nodeClass:zr,tag:"tag:yaml.org,2002:map",resolve(e,t){return _d(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>zr.from(e,t,n)};class Ka extends bM{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Kl,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=Cf(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=Cf(t);if(typeof r!="number")return;const s=this.items[r];return!n&&Pt(s)?s.value:s}has(t){const n=Cf(t);return typeof n=="number"&&n=0?t:null}const Gl={collection:"seq",default:!0,nodeClass:Ka,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Td(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ka.from(e,t,n)},Am={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),xx(e,t,n,r)}},Cm={identify:e=>e==null,createNode:()=>new Xe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Xe(null),stringify:({source:e},t)=>typeof e=="string"&&Cm.test.test(e)?e:t.options.nullStr},vx={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Xe(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&vx.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function ys({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=t-(i.length-a-1);for(;o-- >0;)i+="0"}return i}const NM={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ys},SM={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ys(e)}},AM={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Xe(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:ys},Im=e=>typeof e=="bigint"||Number.isInteger(e),_x=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function CM(e,t,n){const{value:r}=e;return Im(r)&&r>=0?n+r.toString(t):ys(e)}const IM={identify:e=>Im(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>_x(e,2,8,n),stringify:e=>CM(e,8,"0o")},RM={identify:Im,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>_x(e,0,10,n),stringify:ys},OM={identify:e=>Im(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>_x(e,2,16,n),stringify:e=>CM(e,16,"0x")},BJ=[ql,Gl,Am,Cm,vx,IM,RM,OM,NM,SM,AM];function Hk(e){return typeof e=="bigint"||Number.isInteger(e)}const If=({value:e})=>JSON.stringify(e),FJ=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:If},{identify:e=>e==null,createNode:()=>new Xe(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:If},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:If},{identify:Hk,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Hk(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:If}],UJ={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},$J=[ql,Gl].concat(FJ,UJ),Tx={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s1&&t("Each pair must have its own sequence indicator");const s=r.items[0]||new lr(new Xe(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore} +${s.key.commentBefore}`:r.commentBefore),r.comment){const i=s.value??s.key;i.comment=i.comment?`${r.comment} +${i.comment}`:r.comment}r=s}e.items[n]=pn(r)?r:new lr(r)}}else t("Expected a sequence for this tag");return e}function MM(e,t,n){const{replacer:r}=n,s=new Ka(e);s.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(i++),a));let o,l;if(Array.isArray(a))if(a.length===2)o=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)o=u[0],l=a[o];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else o=a;s.items.push(wx(o,l,n))}return s}const kx={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:LM,createNode:MM};class Zo extends Ka{constructor(){super(),this.add=zr.prototype.add.bind(this),this.delete=zr.prototype.delete.bind(this),this.get=zr.prototype.get.bind(this),this.has=zr.prototype.has.bind(this),this.set=zr.prototype.set.bind(this),this.tag=Zo.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items){let i,a;if(pn(s)?(i=Yr(s.key,"",n),a=Yr(s.value,i,n)):i=Yr(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,a)}return r}static from(t,n,r){const s=MM(t,n,r),i=new this;return i.items=s.items,i}}Zo.tag="tag:yaml.org,2002:omap";const Nx={collection:"seq",identify:e=>e instanceof Map,nodeClass:Zo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=LM(e,t),r=[];for(const{key:s}of n.items)Pt(s)&&(r.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new Zo,n)},createNode:(e,t,n)=>Zo.from(e,t,n)};function DM({value:e,source:t},n){return t&&(e?PM:jM).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const PM={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Xe(!0),stringify:DM},jM={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Xe(!1),stringify:DM},HJ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ys},zJ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ys(e)}},VJ={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Xe(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:ys},kd=e=>typeof e=="bigint"||Number.isInteger(e);function Rm(e,t,n,{intAsBigInt:r}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return s==="-"?BigInt(-1)*a:a}const i=parseInt(e,n);return s==="-"?-1*i:i}function Sx(e,t,n){const{value:r}=e;if(kd(r)){const s=r.toString(t);return r<0?"-"+n+s.substr(1):n+s}return ys(e)}const KJ={identify:kd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Rm(e,2,2,n),stringify:e=>Sx(e,2,"0b")},YJ={identify:kd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Rm(e,1,8,n),stringify:e=>Sx(e,8,"0")},WJ={identify:kd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Rm(e,0,10,n),stringify:ys},qJ={identify:kd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Rm(e,2,16,n),stringify:e=>Sx(e,16,"0x")};class Jo extends zr{constructor(t){super(t),this.tag=Jo.tag}add(t){let n;pn(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new lr(t.key,null):n=new lr(t,null),ka(this.items,n.key)||this.items.push(n)}get(t,n){const r=ka(this.items,t);return!n&&pn(r)?Pt(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=ka(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new lr(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:s}=r,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),i.items.push(wx(a,null,r));return i}}Jo.tag="tag:yaml.org,2002:set";const Ax={collection:"map",identify:e=>e instanceof Set,nodeClass:Jo,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Jo.from(e,t,n),resolve(e,t){if(_d(e)){if(e.hasAllNullValues(!0))return Object.assign(new Jo,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function Cx(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),i=r.replace(/_/g,"").split(":").reduce((a,o)=>a*s(60)+s(o),s(0));return n==="-"?s(-1)*i:i}function BM(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return ys(e);let r="";t<0&&(r="-",t*=n(-1));const s=n(60),i=[t%s];return t<60?i.unshift(0):(t=(t-i[0])/s,i.unshift(t%s),t>=60&&(t=(t-i[0])/s,i.unshift(t))),r+i.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const FM={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Cx(e,n),stringify:BM},UM={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Cx(e,!1),stringify:BM},Om={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(Om.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,s,i,a,o]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,s,i||0,a||0,o||0,l);const d=t[8];if(d&&d!=="Z"){let f=Cx(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},zk=[ql,Gl,Am,Cm,PM,jM,KJ,YJ,WJ,qJ,HJ,zJ,VJ,Tx,ni,Nx,kx,Ax,FM,UM,Om],Vk=new Map([["core",BJ],["failsafe",[ql,Gl,Am]],["json",$J],["yaml11",zk],["yaml-1.1",zk]]),Kk={binary:Tx,bool:vx,float:AM,floatExp:SM,floatNaN:NM,floatTime:UM,int:RM,intHex:OM,intOct:IM,intTime:FM,map:ql,merge:ni,null:Cm,omap:Nx,pairs:kx,seq:Gl,set:Ax,timestamp:Om},GJ={"tag:yaml.org,2002:binary":Tx,"tag:yaml.org,2002:merge":ni,"tag:yaml.org,2002:omap":Nx,"tag:yaml.org,2002:pairs":kx,"tag:yaml.org,2002:set":Ax,"tag:yaml.org,2002:timestamp":Om};function c0(e,t,n){const r=Vk.get(t);if(r&&!e)return n&&!r.includes(ni)?r.concat(ni):r.slice();let s=r;if(!s)if(Array.isArray(e))s=[];else{const i=Array.from(Vk.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(const i of e)s=s.concat(i);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(ni)),s.reduce((i,a)=>{const o=typeof a=="string"?Kk[a]:a;if(!o){const l=JSON.stringify(a),u=Object.keys(Kk).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return i.includes(o)||i.push(o),i},[])}const XJ=(e,t)=>e.keyt.key?1:0;class Ix{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?c0(t,"compat"):t?c0(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?GJ:{},this.tags=c0(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Hi,{value:ql}),Object.defineProperty(this,Ms,{value:Am}),Object.defineProperty(this,Kl,{value:Gl}),this.sortMapEntries=typeof a=="function"?a:a===!0?XJ:null}clone(){const t=Object.create(Ix.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function QJ(e,t){var l;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const s=xM(e,t),{commentString:i}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=i(e.commentBefore);n.unshift(Xs(u,""))}let a=!1,o=null;if(e.contents){if(hn(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=i(e.contents.commentBefore);n.push(Xs(f,""))}s.forceBlockIndent=!!e.comment,o=e.contents.comment}const u=o?void 0:()=>a=!0;let d=xl(e.contents,s,()=>o=null,u);o&&(d+=Ta(d,"",i(o))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(xl(e.contents,s));if((l=e.directives)!=null&&l.docEnd)if(e.comment){const u=i(e.comment);u.includes(` +`)?(n.push("..."),n.push(Xs(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(Xs(i(u),"")))}return n.join(` +`)+` +`}class Nd{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Xr,{value:S1});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:a}=i;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new sr({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,s,r)}clone(){const t=Object.create(Nd.prototype,{[Xr]:{value:S1}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=hn(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ho(this.contents)&&this.contents.add(t)}addIn(t,n){ho(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=mM(this);t.anchor=!n||r.has(n)?gM(n||"a",r):n}return new Ex(t.anchor)}createNode(t,n,r){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=n;else if(Array.isArray(n)){const w=E=>typeof E=="number"||E instanceof String||E instanceof Number,g=n.filter(w).map(String);g.length>0&&(n=n.concat(g)),s=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:l,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=kJ(this,a||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},b=$u(t,d,m);return o&&fn(b)&&(b.flow=!0),h(),b}createPair(t,n,r={}){const s=this.createNode(t,null,r),i=this.createNode(n,null,r);return new lr(s,i)}delete(t){return ho(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Ic(t)?this.contents==null?!1:(this.contents=null,!0):ho(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return fn(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Ic(t)?!n&&Pt(this.contents)?this.contents.value:this.contents:fn(this.contents)?this.contents.getIn(t,n):void 0}has(t){return fn(this.contents)?this.contents.has(t):!1}hasIn(t){return Ic(t)?this.contents!==void 0:fn(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=wp(this.schema,[t],n):ho(this.contents)&&this.contents.set(t,n)}setIn(t,n){Ic(t)?this.contents=n:this.contents==null?this.contents=wp(this.schema,Array.from(t),n):ho(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new sr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new sr({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Ix(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:a}={}){const o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=Yr(this.contents,n??"",o);if(typeof i=="function")for(const{count:u,res:d}of o.anchors.values())i(d,u);return typeof a=="function"?$o(a,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return QJ(this,t)}}function ho(e){if(fn(e))return!0;throw new Error("Expected a YAML collection as document contents")}class $M extends Error{constructor(t,n,r,s){super(),this.name=t,this.code=r,this.message=s,this.pos=n}}class Rc extends $M{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class ZJ extends $M{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const Yk=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));const{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){const o=Math.min(i-39,a.length-79);a="…"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,i))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`… +`),a=o+a}if(/[^ ]/.test(a)){let o=1;const l=n.linePos[1];(l==null?void 0:l.line)===r&&l.col>s&&(o=Math.max(1,Math.min(l.col-s,80-i)));const u=" ".repeat(i)+"^".repeat(o);n.message+=`: + +${a} +${u} +`}};function wl(e,{flow:t,indicator:n,next:r,offset:s,onError:i,parentIndent:a,startOnNewline:o}){let l=!1,u=o,d=o,f="",h="",p=!1,m=!1,b=null,w=null,g=null,E=null,y=null,_=null,k=null;for(const N of e)switch(m&&(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma"&&i(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),b&&(u&&N.type!=="comment"&&N.type!=="newline"&&i(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),N.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&N.source.includes(" ")&&(b=N),d=!0;break;case"comment":{d||i(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const R=N.source.substring(1)||" ";f?f+=h+R:f=R,h="",u=!1;break}case"newline":u?f?f+=N.source:(!_||n!=="seq-item-ind")&&(l=!0):h+=N.source,u=!0,p=!0,(w||g)&&(E=N),d=!0;break;case"anchor":w&&i(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&i(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),w=N,k??(k=N.offset),u=!1,d=!1,m=!0;break;case"tag":{g&&i(N,"MULTIPLE_TAGS","A node can have at most one tag"),g=N,k??(k=N.offset),u=!1,d=!1,m=!0;break}case n:(w||g)&&i(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),_&&i(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),_=N,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){y&&i(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),y=N,u=!1,d=!1;break}default:i(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),u=!1,d=!1}const T=e[e.length-1],C=T?T.offset+T.source.length:s;return m&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&i(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:y,found:_,spaceBefore:l,comment:f,hasNewline:p,anchor:w,tag:g,newlineAfterProp:E,end:C,start:k??C}}function Hu(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` +`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(Hu(t.key)||Hu(t.value))return!0}return!1;default:return!0}}function R1(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Hu(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function HM(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const s=typeof r=="function"?r:(i,a)=>i===a||Pt(i)&&Pt(a)&&i.value===a.value;return t.some(i=>s(i.key,n))}const Wk="All mapping items must start at the same column";function JJ({composeNode:e,composeEmptyNode:t},n,r,s,i){var d;const a=(i==null?void 0:i.nodeClass)??zr,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,u=null;for(const f of r.items){const{start:h,key:p,sep:m,value:b}=f,w=wl(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:l,onError:s,parentIndent:r.indent,startOnNewline:!0}),g=!w.found;if(g){if(p&&(p.type==="block-seq"?s(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&s(l,"BAD_INDENT",Wk)),!w.anchor&&!w.tag&&!m){u=w.end,w.comment&&(o.comment?o.comment+=` +`+w.comment:o.comment=w.comment);continue}(w.newlineAfterProp||Hu(p))&&s(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=w.found)==null?void 0:d.indent)!==r.indent&&s(l,"BAD_INDENT",Wk);n.atKey=!0;const E=w.end,y=p?e(n,p,w,s):t(n,E,h,null,w,s);n.schema.compat&&R1(r.indent,p,s),n.atKey=!1,HM(n,o.items,y)&&s(E,"DUPLICATE_KEY","Map keys must be unique");const _=wl(m??[],{indicator:"map-value-ind",next:b,offset:y.range[2],onError:s,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(l=_.end,_.found){g&&((b==null?void 0:b.type)==="block-map"&&!_.hasNewline&&s(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&w.start<_.found.offset-1024&&s(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=b?e(n,b,_,s):t(n,l,m,null,_,s);n.schema.compat&&R1(r.indent,b,s),l=k.range[2];const T=new lr(y,k);n.options.keepSourceTokens&&(T.srcToken=f),o.items.push(T)}else{g&&s(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(y.comment?y.comment+=` +`+_.comment:y.comment=_.comment);const k=new lr(y);n.options.keepSourceTokens&&(k.srcToken=f),o.items.push(k)}}return u&&ue&&(e.type==="block-map"||e.type==="block-seq");function tee({composeNode:e,composeEmptyNode:t},n,r,s,i){var w;const a=r.start.source==="{",o=a?"flow map":"flow sequence",l=(i==null?void 0:i.nodeClass)??(a?zr:Ka),u=new l(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let g=0;g0){const g=Sd(m,b,n.options.strict,s);g.comment&&(u.comment?u.comment+=` +`+g.comment:u.comment=g.comment),u.range=[r.offset,b,g.offset]}else u.range=[r.offset,b,b];return u}function f0(e,t,n,r,s,i){const a=n.type==="block-map"?JJ(e,t,n,r,i):n.type==="block-seq"?eee(e,t,n,r,i):tee(e,t,n,r,i),o=a.constructor;return s==="!"||s===o.tagName?(a.tag=o.tagName,a):(s&&(a.tag=s),a)}function nee(e,t,n,r,s){var h;const i=r.tag,a=i?t.directives.tagName(i.source,p=>s(i,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=r,b=p&&i?p.offset>i.offset?p:i:p??i;b&&(!m||m.offsetp.tag===a&&p.collection===o);if(!l){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===o)t.schema.tags.push(Object.assign({},p,{default:!1})),l=p;else return p?s(i,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),f0(e,t,n,s,a)}const u=f0(e,t,n,s,a,l),d=((h=l.resolve)==null?void 0:h.call(l,u,p=>s(i,"TAG_RESOLVE_FAILED",p),t.options))??u,f=hn(d)?d:new Xe(d);return f.range=u.range,f.tag=a,l!=null&&l.format&&(f.format=l.format),f}function ree(e,t,n){const r=t.offset,s=see(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};const i=s.mode===">"?Xe.BLOCK_FOLDED:Xe.BLOCK_LITERAL,a=t.source?iee(t.source):[];let o=a.length;for(let b=a.length-1;b>=0;--b){const w=a[b][1];if(w===""||w==="\r")o=b;else break}if(o===0){const b=s.chomp==="+"&&a.length>0?` +`.repeat(Math.max(1,a.length-1)):"";let w=r+s.length;return t.source&&(w+=t.source.length),{value:b,type:i,comment:s.comment,range:[r,w,w]}}let l=t.indent+s.indent,u=t.offset+s.length,d=0;for(let b=0;bl&&(l=w.length);else{w.length=o;--b)a[b][0].length>l&&(o=b+1);let f="",h="",p=!1;for(let b=0;bl||g[0]===" "?(h===" "?h=` +`:!p&&h===` +`&&(h=` + +`),f+=h+w.slice(l)+g,h=` +`,p=!0):g===""?h===` +`?f+=` +`:h=` +`:(f+=h+g,h=" ",p=!1)}switch(s.chomp){case"-":break;case"+":for(let b=o;bn(r+h,p,m);switch(s){case"scalar":o=Xe.PLAIN,l=oee(i,u);break;case"single-quoted-scalar":o=Xe.QUOTE_SINGLE,l=lee(i,u);break;case"double-quoted-scalar":o=Xe.QUOTE_DOUBLE,l=cee(i,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}const d=r+i.length,f=Sd(a,d,t,n);return{value:l,type:o,comment:f.comment,range:[r,d,f.offset]}}function oee(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),zM(e)}function lee(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),zM(e.slice(1,-1)).replace(/''/g,"'")}function zM(e){let t,n;try{t=new RegExp(`(.*?)(?i?e.slice(i,r+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function uee(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` +`||r==="\r")&&!(r==="\r"&&e[t+2]!==` +`);)r===` +`&&(n+=` +`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}const dee={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` +`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function fee(e,t,n,r){const s=e.substr(t,n),a=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(a)}catch{const o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}function VM(e,t,n,r){const{value:s,type:i,comment:a,range:o}=t.type==="block-scalar"?ree(e,t,r):aee(t,e.options.strict,r),l=n?e.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[Ms]:l?u=hee(e.schema,s,l,n,r):t.type==="scalar"?u=pee(e,s,t,r):u=e.schema[Ms];let d;try{const f=u.resolve(s,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Pt(f)?f:new Xe(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new Xe(s)}return d.range=o,d.source=s,i&&(d.type=i),l&&(d.tag=l),u.format&&(d.format=u.format),a&&(d.comment=a),d}function hee(e,t,n,r,s){var o;if(n==="!")return e[Ms];const i=[];for(const l of e.tags)if(!l.collection&&l.tag===n)if(l.default&&l.test)i.push(l);else return l;for(const l of i)if((o=l.test)!=null&&o.test(t))return l;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ms])}function pee({atKey:e,directives:t,schema:n},r,s,i){const a=n.tags.find(o=>{var l;return(o.default===!0||e&&o.default==="key")&&((l=o.test)==null?void 0:l.test(r))})||n[Ms];if(n.compat){const o=n.compat.find(l=>{var u;return l.default&&((u=l.test)==null?void 0:u.test(r))})??n[Ms];if(a.tag!==o.tag){const l=t.tagString(a.tag),u=t.tagString(o.tag),d=`Value may be parsed as either ${l} or ${u}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function mee(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let s=t[r];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++r];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++r];break}}return e}const gee={composeNode:KM,composeEmptyNode:Rx};function KM(e,t,n,r){const s=e.atKey,{spaceBefore:i,comment:a,anchor:o,tag:l}=n;let u,d=!0;switch(t.type){case"alias":u=yee(e,t,r),(o||l)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=VM(e,t,l,r),o&&(u.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=nee(gee,e,t,n,r),o&&(u.anchor=o.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=Rx(e,t.offset,void 0,null,n,r)),o&&u.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!Pt(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function Rx(e,t,n,r,{spaceBefore:s,comment:i,anchor:a,tag:o,end:l},u){const d={type:"scalar",offset:mee(t,n,r),indent:-1,source:""},f=VM(e,d,o,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=l),f}function yee({options:e},{offset:t,source:n,end:r},s){const i=new Ex(n.substring(1));i.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,o=Sd(r,a,e.strict,s);return i.range=[t,a,o.offset],o.comment&&(i.comment=o.comment),i}function bee(e,t,{offset:n,start:r,value:s,end:i},a){const o=Object.assign({_directives:t},e),l=new Nd(void 0,o),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=wl(r,{indicator:"doc-start",next:s??(i==null?void 0:i[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=s?KM(u,s,d,a):Rx(u,d.end,r,null,d,a);const f=l.contents.range[2],h=Sd(i,f,!1,a);return h.comment&&(l.comment=h.comment),l.range=[n,f,h.offset],l}function mc(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function qk(e){var s;let t="",n=!1,r=!1;for(let i=0;i{const a=mc(n);i?this.warnings.push(new ZJ(a,r,s)):this.errors.push(new Rc(a,r,s))},this.directives=new sr({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:s}=qk(this.prelude);if(r){const i=t.contents;if(n)t.comment=t.comment?`${t.comment} +${r}`:r;else if(s||t.directives.docStart||!i)t.commentBefore=r;else if(fn(i)&&!i.flow&&i.items.length>0){let a=i.items[0];pn(a)&&(a=a.key);const o=a.commentBefore;a.commentBefore=o?`${r} +${o}`:r}else{const a=i.commentBefore;i.commentBefore=a?`${r} +${a}`:r}}if(n){for(let i=0;i{const i=mc(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=bee(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Rc(mc(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new Rc(mc(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Sd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Rc(mc(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),s=new Nd(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const YM="\uFEFF",WM="",qM="",O1="";function xee(e){switch(e){case YM:return"byte-order-mark";case WM:return"doc-mode";case qM:return"flow-error-end";case O1:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`:case`\r +`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function es(e){switch(e){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}const Gk=new Set("0123456789ABCDEFabcdef"),wee=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Rf=new Set(",[]{}"),vee=new Set(` ,[]{} +\r `),h0=e=>!e||vee.has(e);class _ee{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`?!0:n==="\r"?this.buffer[t+1]===` +`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){const s=this.buffer[r+t+1];if(s===` +`||!s&&!this.atEnd)return t+r+1}return n===` +`||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&es(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!es(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&es(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(h0),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>es(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":n+=1;break;case` +`:t=i,n=0;break;case"\r":{const a=this.buffer[i+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===` +`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const i=this.continueScalar(t+1);if(i===-1)break;t=this.buffer.indexOf(` +`,i)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let s=t+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===` +`;)r=this.buffer[++s];t=s-1}else if(!this.blockScalarKeep)do{let i=t-1,a=this.buffer[i];a==="\r"&&(a=this.buffer[--i]);const o=i;for(;a===" ";)a=this.buffer[--i];if(a===` +`&&i>=this.pos&&i+1+n>o)t=i;else break}while(!0);return yield O1,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){const i=this.buffer[r+1];if(es(i)||t&&Rf.has(i))break;n=r}else if(es(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===` +`?(r+=1,s=` +`,i=this.buffer[r+1]):n=r),i==="#"||t&&Rf.has(i))break;if(s===` +`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Rf.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield O1,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(h0),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(es(r)||n&&Rf.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!es(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(wee.has(n))n=this.buffer[++t];else if(n==="%"&&Gk.has(this.buffer[t+1])&&Gk.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` +`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` +`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");const s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class Tee{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[i]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function _p(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Qk(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&Xk(s.start)===-1&&(n.indent===0||s.start.every(i=>i.type!=="comment"||i.indent=t.indent){const s=!this.onKeyLine&&this.indent===t.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(i&&n.sep&&!n.value){const o=[];for(let l=0;lt.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ki(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(GM(n.key)&&!ki(n.sep,"newline")){const o=po(n.start),l=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(ki(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=po(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:a,key:null,sep:[this.sourceToken]}):ki(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!ki(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const s=t.items[t.items.length-2],i=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(i)){_p(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||ki(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while((r==null?void 0:r.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=Of(r),i=po(s);Qk(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` +`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` +`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=Of(t),r=po(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Of(t),r=po(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Nee(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Tee||null,prettyErrors:t}}function See(e,t={}){const{lineCounter:n,prettyErrors:r}=Nee(t),s=new kee(n==null?void 0:n.addNewLine),i=new Eee(t);let a=null;for(const o of i.compose(s.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Rc(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(Yk(e,n)),a.warnings.forEach(Yk(e,n))),a}function Aee(e,t,n){let r;const s=See(e,n);if(!s)return null;if(s.warnings.forEach(i=>wM(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}function Cee(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return vd(e)&&!r?e.toString(n):new Nd(e,r,n).toString(n)}const Iee="https://ark.cn-beijing.volces.com/api/v3/",iu=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:Iee}],vl=[],gc=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],ri={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},XM=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请输入智能体中心 ID,如 as-yer579143kbrkemozdn6",comment:"AgentKit 智能体中心 ID"},{key:"REGISTRY_TOP_K",required:!1,placeholder:ri.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:ri.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:ri.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],Ox=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:vl},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:vl},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],Tp=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],kp=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:iu,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...iu],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...iu],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:vl},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}]}],Np=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:iu,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...iu],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:vl},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...vl,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],Sp=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...vl,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Ree=e=>Ox.find(t=>t.id===e),Oee=e=>Tp.find(t=>t.id===e),Lee=e=>kp.find(t=>t.id===e),Mee=e=>Np.find(t=>t.id===e),Dee=e=>Sp.find(t=>t.id===e),Pee="doubao-seed-2-1-pro-260628",jee="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",Bee=`你是一个专业、可靠的智能助手。 + +你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 + +约束: +- 信息不足时主动提问澄清,不要臆造事实。 +- 需要时合理调用可用的工具,并说明关键结论。 +- 保持礼貌、专业的语气。`;function Gi(){return{name:"",description:jee,instruction:Bee,agentType:"llm",maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:Pee,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:"local",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}const Fee=new Set(["local","sqlite","mysql","postgresql"]),Uee=new Set(["local","opensearch","redis","viking","mem0"]),$ee=new Set(["local","opensearch","viking","context_search"]),Hee=new Set(["apmplus","cozeloop","tls"]),QM=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","vesearch"]),zee=new Set(["llm","sequential","parallel","loop","a2a"]);function lt(e,t=""){return typeof e=="string"?e:t}function ma(e){return e===!0}function bh(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function ZM(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:lt(t.name),description:lt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function p0(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function JM(e){return typeof e=="string"&&zee.has(e)?e:"llm"}function e3(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function t3(e){const t=e&&typeof e=="object"?e:{};return{enabled:ma(t.enabled),registrySpaceId:lt(t.registrySpaceId),registryTopK:lt(t.registryTopK),registryRegion:lt(t.registryRegion),registryEndpoint:lt(t.registryEndpoint)}}function n3(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},r=t3(n.a2aRegistry),s=JM(n.agentType),i=r.enabled&&s==="llm"?"a2a":s;return{...Gi(),name:lt(n.name),description:lt(n.description),instruction:lt(n.instruction),agentType:i,maxIterations:e3(n.maxIterations),a2aUrl:lt(n.a2aUrl),builtinTools:bh(n.builtinTools).filter(a=>QM.has(a)),customTools:ZM(n.customTools),a2aRegistry:i==="a2a"?{...r,enabled:!0}:r,subAgents:n3(n.subAgents)}}):[]}function Vee(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const r=n&&typeof n=="object"?n:{},s=lt(r.source),i=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=lt(r.name)||lt(r.slug)||lt(r.skillName)||lt(r.skillId)||"skill",o=lt(r.folder)||a,l=lt(r.description);if(i==="skillhub"){const f=lt(r.slug);if(!f)continue;t.push({source:i,folder:o,name:a,description:l,slug:f,namespace:lt(r.namespace)||"public"});continue}if(i==="local"){const h=(Array.isArray(r.localFiles)?r.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},b=lt(m.path),w=lt(m.content);return b?{path:b,content:w}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:i,folder:o,name:a,description:l,localFiles:h});continue}const u=lt(r.skillSpaceId),d=lt(r.skillId);!u||!d||t.push({source:i,folder:o,name:a,description:l,skillSpaceId:u,skillSpaceName:lt(r.skillSpaceName),skillId:d,version:lt(r.version)})}return t}function r3(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},r=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=t3(t.a2aRegistry),i=JM(t.agentType),a=s.enabled&&i==="llm"?"a2a":i,o=Array.isArray(t.mcpTools)?t.mcpTools.map(l=>{const u=l&&typeof l=="object"?l:{},d=u.transport==="stdio"?"stdio":"http";return{name:lt(u.name),transport:d,url:lt(u.url),authToken:lt(u.authToken),command:lt(u.command),args:bh(u.args)}}).filter(l=>l.transport==="http"?!!l.url:!!l.command):[];return{...Gi(),name:lt(t.name)||"my_agent",description:lt(t.description),instruction:lt(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:e3(t.maxIterations),a2aUrl:lt(t.a2aUrl),modelName:lt(t.modelName),modelProvider:lt(t.modelProvider),modelApiBase:lt(t.modelApiBase),builtinTools:bh(t.builtinTools).filter(l=>QM.has(l)),customTools:ZM(t.customTools),mcpTools:o,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:ma(n.shortTerm),longTerm:ma(n.longTerm)},shortTermBackend:p0(t.shortTermBackend,Fee,"local"),longTermBackend:p0(t.longTermBackend,Uee,"local"),autoSaveSession:ma(t.autoSaveSession),knowledgebase:ma(t.knowledgebase),knowledgebaseBackend:p0(t.knowledgebaseBackend,$ee,"local"),tracing:ma(t.tracing),tracingExporters:bh(t.tracingExporters).filter(l=>Hee.has(l)),deployment:{feishuEnabled:ma(r.feishuEnabled)},subAgents:n3(t.subAgents),selectedSkills:Vee(t)}}function s3(e){var n,r,s,i,a,o,l,u,d,f,h,p,m,b,w,g,E;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const y={enabled:!0};(r=e.a2aRegistry.registrySpaceId)!=null&&r.trim()&&(y.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),y.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||ri.topK,y.registryRegion=((i=e.a2aRegistry.registryRegion)==null?void 0:i.trim())||ri.region,y.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||ri.endpoint,t.a2aRegistry=y}return t}return t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(o=e.modelName)!=null&&o.trim()&&(t.modelName=e.modelName.trim()),(l=e.modelProvider)!=null&&l.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(y=>({name:y.name,description:y.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(y=>{var k,T,C,N;const _={name:y.name,transport:y.transport};return(k=y.url)!=null&&k.trim()&&(_.url=y.url.trim()),(T=y.authToken)!=null&&T.trim()&&(_.authToken=y.authToken.trim()),(C=y.command)!=null&&C.trim()&&(_.command=y.command.trim()),(N=y.args)!=null&&N.length&&(_.args=y.args),_})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"local"),e.tracing&&((b=e.tracingExporters)!=null&&b.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(w=e.deployment)!=null&&w.feishuEnabled&&(t.deployment={feishuEnabled:!0}),(g=e.selectedSkills)!=null&&g.length&&(t.selectedSkills=e.selectedSkills.map(y=>{const _={source:y.source,name:y.name,folder:y.folder};return y.description&&(_.description=y.description),y.source==="skillhub"?(_.slug=y.slug,_.namespace=y.namespace??"public"):y.source==="local"?_.localFiles=y.localFiles??[]:(_.skillSpaceId=y.skillSpaceId,_.skillSpaceName=y.skillSpaceName,_.skillId=y.skillId,y.version&&(_.version=y.version)),_})),(E=e.subAgents)!=null&&E.length&&(t.subAgents=e.subAgents.map(s3)),t}function Kee(e){return`# VeADK Agent 结构配置 +# 可在「创建 Agent」页通过「导入 YAML」重新载入。 +`+Cee(s3(e))}function Yee(e){const t=Aee(e);return r3(t)}const Wee=[{kind:"custom",icon:UF,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:SF,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:wF,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:$F,title:"工作流",desc:"敬请期待",disabled:!0}];function qee({onSelect:e,onImport:t}){const n=v.useRef(null),[r,s]=v.useState(""),i=Wee.map(o=>({key:o.kind,icon:o.icon,title:o.title,desc:o.desc,disabled:o.disabled,onClick:()=>e(o.kind)})),a=async o=>{var u;const l=(u=o.target.files)==null?void 0:u[0];if(o.target.value="",!!l)try{const d=await l.text();t(Yee(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return c.jsx(dM,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:i,footer:c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[c.jsxs("button",{className:"stk-import",onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},children:[c.jsx(BF,{}),"导入 YAML 配置"]}),r&&c.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:r}),c.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const Gee="modulepreload",Xee=function(e){return"/"+e},Zk={},el=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=Xee(l),l in Zk)return;Zk[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Gee,u||(f.as="script"),f.crossOrigin="",f.href=l,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function Qee({className:e,...t}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[c.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),c.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const xo={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:Qee},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:CI},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:DI},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:AE},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:lm}},Lf=[xo.llm,xo.sequential,xo.parallel,xo.loop,xo.a2a];function Lx(e){return xo[e??"llm"]}const i3=e=>e==="sequential"||e==="parallel"||e==="loop",Ad=e=>e==="a2a";function a3(e){const t=new Map,n={};for(const r of e){for(const s of r.env){const i=t.get(s.key);(!i||s.required&&!i.required)&&t.set(s.key,s)}r.enableFlag&&(t.set(r.enableFlag,{key:r.enableFlag,required:!0}),n[r.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Zee(e,t){return a3([{env:e}]).specs.map(r=>({...r,value:t[r.key]??""}))}function Jee(e,t){const n=new Map;for(const r of e){const s=t[r.key]??"";s.trim()&&n.set(r.key,s)}return[...n].map(([r,s])=>({key:r,value:s}))}function Jk(e,t){return e.find(n=>{var r;return n.required&&!((r=t[n.key])!=null&&r.trim())})}const ete=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function tte(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function Jt(e,t){e.push(t&255,t>>>8&255)}function Tr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const eN=2048,m0=20,tN=0;function nte(e){const t=new TextEncoder,n=[],r=[];let s=0;for(const p of e){const m=t.encode(p.path),b=t.encode(p.content),w=tte(b),g=b.length,E=[];Tr(E,67324752),Jt(E,m0),Jt(E,eN),Jt(E,tN),Jt(E,0),Jt(E,0),Tr(E,w),Tr(E,g),Tr(E,g),Jt(E,m.length),Jt(E,0);const y=Uint8Array.from(E);n.push(y,m,b),r.push({nameBytes:m,dataBytes:b,crc:w,size:g,offset:s}),s+=y.length+m.length+b.length}const i=s,a=[];let o=0;for(const p of r){const m=[];Tr(m,33639248),Jt(m,m0),Jt(m,m0),Jt(m,eN),Jt(m,tN),Jt(m,0),Jt(m,0),Tr(m,p.crc),Tr(m,p.size),Tr(m,p.size),Jt(m,p.nameBytes.length),Jt(m,0),Jt(m,0),Jt(m,0),Jt(m,0),Tr(m,0),Tr(m,p.offset);const b=Uint8Array.from(m);a.push(b,p.nameBytes),o+=b.length+p.nameBytes.length}const l=[];Tr(l,101010256),Jt(l,0),Jt(l,0),Jt(l,r.length),Jt(l,r.length),Tr(l,o),Tr(l,i),Jt(l,0);const u=[...n,...a,Uint8Array.from(l)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const rte=v.lazy(()=>el(()=>import("./CodeEditor-C7VckftE.js"),[]));function ste(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function ite(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function ate({project:e,open:t,onClose:n,onChange:r}){var m;const[s,i]=v.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,o]=v.useState(new Set),l=v.useRef(null),u=v.useMemo(()=>ste(e.files),[e.files]),d=e.files.find(b=>b.path===s)??null;if(v.useEffect(()=>{var g;if(!t)return;const b=document.body.style.overflow;document.body.style.overflow="hidden",(g=l.current)==null||g.focus();const w=E=>{E.key==="Escape"&&n()};return window.addEventListener("keydown",w),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",w)}},[n,t]),v.useEffect(()=>{d||e.files.length===0||i(e.files[0].path)},[e.files,d]),!t)return null;function f(b){o(w=>{const g=new Set(w);return g.has(b)?g.delete(b):g.add(b),g})}function h(b,w,g){return ite(b).map(E=>{const y=g?`${g}/${E.name}`:E.name;if(!(E.children.size>0&&E.path===void 0)&&E.path)return c.jsxs("button",{type:"button",className:`code-browser-file${s===E.path?" is-active":""}`,style:{paddingLeft:`${12+w*16}px`},onClick:()=>i(E.path??null),title:E.path,children:[c.jsx(B_,{"aria-hidden":"true"}),c.jsx("span",{children:E.name})]},y);const k=a.has(y);return c.jsxs("div",{children:[c.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+w*16}px`},onClick:()=>f(y),"aria-expanded":!k,children:[c.jsx(or,{className:k?"":"is-open","aria-hidden":"true"}),c.jsx(AI,{"aria-hidden":"true"}),c.jsx("span",{children:E.name})]}),!k&&h(E,w+1,y)]},y)})}function p(b){d&&r({...e,files:e.files.map(w=>w.path===d.path?{...w,content:b}:w)})}return Ua.createPortal(c.jsx("div",{className:"code-browser-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&n()},children:c.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[c.jsxs("header",{className:"code-browser-head",children:[c.jsxs("div",{className:"code-browser-title-wrap",children:[c.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:c.jsx(vE,{})}),c.jsxs("div",{children:[c.jsx("h2",{id:"code-browser-title",children:"项目代码"}),c.jsx("p",{children:e.name||"Agent 项目"})]})]}),c.jsx("button",{ref:l,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:c.jsx(Gr,{"aria-hidden":"true"})})]}),c.jsxs("div",{className:"code-browser-workspace",children:[c.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[c.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",c.jsx("span",{children:e.files.length})]}),c.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):c.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),c.jsxs("main",{className:"code-browser-main",children:[c.jsxs("div",{className:"code-browser-path",children:[c.jsx(B_,{"aria-hidden":"true"}),c.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),c.jsx("div",{className:"code-browser-editor",children:d?c.jsx(v.Suspense,{fallback:c.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:c.jsx(rte,{value:d.content,path:d.path,onChange:p})}):c.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function ote({project:e,onChange:t,className:n=""}){const[r,s]=v.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:"查看源码",children:[c.jsx(vE,{"aria-hidden":"true"}),c.jsx("span",{children:"查看源码"})]}),c.jsx(ate,{project:e,open:r,onClose:()=>s(!1),onChange:t})]})}function lte({className:e,...t}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[c.jsx("path",{d:"m12 2.75 4.25 2.45v4.9L12 12.55 7.75 10.1V5.2L12 2.75Z"}),c.jsx("path",{d:"m7.75 5.2 4.25 2.45 4.25-2.45M12 7.65v4.9"}),c.jsx("path",{d:"M12 12.55v4.7m-2.25-2.2L12 17.3l2.25-2.25"}),c.jsx("path",{d:"M5.5 17.25v2.25a1.75 1.75 0 0 0 1.75 1.75h9.5a1.75 1.75 0 0 0 1.75-1.75v-2.25"})]})}function Ap({message:e,className:t="",onRetry:n}){const[r,s]=v.useState(!1),[i,a]=v.useState(!1),[o,l]=v.useState(!1),u=async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)}catch{a(!1)}},d=async()=>{if(!(!n||o)){l(!0);try{await n()}finally{l(!1)}}};return c.jsxs("div",{className:`deploy-error-message${r?" is-expanded":""}${t?` ${t}`:""}`,children:[c.jsx("p",{className:"deploy-error-message-text",children:e}),c.jsxs("div",{className:"deploy-error-message-actions",children:[n&&c.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:o,onClick:()=>void d(),children:[o?c.jsx(wt,{className:"spin"}):c.jsx(MI,{}),o?"重试中…":"重试部署"]}),c.jsx("button",{type:"button",title:r?"收起错误信息":"展开完整错误信息","aria-label":r?"收起错误信息":"展开完整错误信息",onClick:()=>s(f=>!f),children:r?c.jsx(CF,{}):c.jsx(Wc,{})}),c.jsx("button",{type:"button",title:i?"已复制":"复制完整错误信息","aria-label":i?"已复制":"复制完整错误信息",onClick:()=>void u(),children:i?c.jsx(Ds,{}):c.jsx(_E,{})})]})]})}Er.registerLanguage("python",RO);Er.registerLanguage("typescript",zO);Er.registerLanguage("javascript",kO);Er.registerLanguage("json",NO);Er.registerLanguage("yaml",VO);Er.registerLanguage("markdown",IO);Er.registerLanguage("bash",EO);Er.registerLanguage("ini",xO);Er.registerLanguage("dockerfile",wY);Er.registerLanguage("makefile",CO);const cte=v.lazy(()=>el(()=>import("./CodeEditor-C7VckftE.js"),[]));function ute({open:e,onCancel:t,onConfirm:n}){const r=v.useRef(null);return v.useEffect(()=>{var a;if(!e)return;const s=document.body.style.overflow;document.body.style.overflow="hidden",(a=r.current)==null||a.focus();const i=o=>{o.key==="Escape"&&t()};return window.addEventListener("keydown",i),()=>{document.body.style.overflow=s,window.removeEventListener("keydown",i)}},[t,e]),e?Ua.createPortal(c.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:s=>{s.target===s.currentTarget&&t()},children:c.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[c.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[c.jsxs("div",{className:"code-browser-title-wrap",children:[c.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:c.jsx(jF,{})}),c.jsx("h2",{id:"pp-confirm-title",children:"确认部署"})]}),c.jsx("button",{type:"button",className:"code-browser-close",onClick:t,"aria-label":"关闭部署确认",children:c.jsx(Gr,{"aria-hidden":"true"})})]}),c.jsx("div",{className:"pp-confirm-body",children:c.jsx("p",{id:"pp-confirm-description",children:"部署后暂不支持修改 Agent 配置,确定部署吗?"})}),c.jsxs("footer",{className:"pp-confirm-actions",children:[c.jsx("button",{ref:r,type:"button",onClick:t,children:"取消"}),c.jsx("button",{type:"button",className:"is-primary",onClick:n,children:"确定部署"})]})]})}),document.body):null}const dte={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},nN={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function rN(e){return e.replace(/&/g,"&").replace(//g,">")}function fte(e){const n=(e.split("/").pop()??e).toLowerCase();if(nN[n])return nN[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const r=n.lastIndexOf(".");if(r===-1)return null;const s=n.slice(r+1);return dte[s]??null}function hte(e,t){try{const n=fte(t);return n&&Er.getLanguage(n)?Er.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?Er.highlightAuto(e).value:rN(e)}catch{return rN(e)}}const Mf=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}];function pte(e){return e.trim().replace(/[。.!!]+$/u,"")}function g0(e,t="未配置"){return[...new Set(e.map(r=>r==null?void 0:r.trim()).filter(Boolean))].join("、")||t}function o3(e,t="root"){var a,o,l;const n=e.agentType??"llm",r=[...(e.builtinTools??[]).map(u=>{var d;return((d=Ree(u))==null?void 0:d.label)??u}),...(e.customTools??[]).map(u=>u.name),...(e.mcpTools??[]).map(u=>u.name),...e.tools??[]],s=[...(e.selectedSkills??[]).map(u=>u.name),...e.skills??[]],i=e.memory.longTerm?((a=Lee(e.longTermBackend??"local"))==null?void 0:a.label)??e.longTermBackend:void 0;return{id:t,name:e.name.trim()||"未命名 Agent",type:n,description:pte(e.description),model:n==="llm"?e.modelName||e.model||"默认模型":"不适用",tools:g0(r),skills:g0(s),knowledgebase:e.knowledgebase?((o=Mee(e.knowledgebaseBackend??"local"))==null?void 0:o.label)??e.knowledgebaseBackend??"默认知识库":"未配置",shortTerm:e.memory.shortTerm?((l=Oee(e.shortTermBackend??"local"))==null?void 0:l.label)??e.shortTermBackend??"默认后端":"未配置",longTerm:i?`${i}${e.autoSaveSession?" · 自动保存会话":""}`:"未配置",tracing:e.tracing?g0((e.tracingExporters??[]).map(u=>{var d;return((d=Dee(u))==null?void 0:d.label)??u}),"默认观测"):"未配置",children:e.subAgents.map((u,d)=>o3(u,`${t}.${d}`))}}function l3(e,t){if(e.id===t)return e;for(const n of e.children){const r=l3(n,t);if(r)return r}}function c3({agent:e,depth:t,inspectedId:n,onHover:r,onFocus:s}){const i=Lx(e.type),a=i.icon;return c.jsxs("div",{className:"pp-topology-branch",children:[c.jsxs("button",{type:"button",className:`pp-agent-node${e.id===n?" is-inspected":""}`,style:{marginLeft:t*16,width:`calc(100% - ${t*16}px)`},onMouseEnter:()=>r(e.id),onMouseLeave:()=>r(null),onFocus:()=>s(e.id),onBlur:()=>s(null),"aria-label":`查看 ${e.name} 配置`,children:[c.jsx("span",{className:"pp-agent-node-icon",children:c.jsx(a,{"aria-hidden":"true"})}),c.jsxs("span",{className:"pp-agent-node-main",children:[c.jsx("span",{className:"pp-agent-node-name",children:e.name}),c.jsx("span",{className:"pp-agent-node-type",children:i.label})]}),e.children.length>0&&c.jsx("span",{className:"pp-agent-child-count",children:e.children.length})]}),e.children.length>0&&c.jsx("div",{className:"pp-topology-children",children:e.children.map(o=>c.jsx(c3,{agent:o,depth:t+1,inspectedId:n,onHover:r,onFocus:s},o.id))})]})}function mte(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function gte(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function yte(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function bte({left:e,right:t}){const[n,r]=v.useState(null);return v.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),i=document.getElementById("veadk-page-header-actions");s&&i&&r({left:s,right:i})},[]),n?c.jsxs(c.Fragment,{children:[Ua.createPortal(e,n.left),Ua.createPortal(t,n.right)]}):c.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function Mx({project:e,agentDraft:t,agentName:n,agentCount:r,onChange:s,onDeploy:i,onAgentAdded:a,onDeploymentTaskChange:o,feishuEnabled:l=!1,onFeishuEnabledChange:u,deploymentEnv:d=[],deploymentEnvValues:f={},onDeploymentEnvChange:h,network:p,onNetworkChange:m,deployRegion:b="cn-beijing",onDeployRegionChange:w,onBack:g,onExportYaml:E}){var Qe,on,ln;const y=typeof s=="function",[_,k]=v.useState(((on=(Qe=e==null?void 0:e.files)==null?void 0:Qe[0])==null?void 0:on.path)??null),[T,C]=v.useState(new Set),[N,R]=v.useState(!1),[I,M]=v.useState(""),[B,Y]=v.useState(!1),[P,U]=v.useState(!1),[A,L]=v.useState(!1),[O,j]=v.useState(null),[S,H]=v.useState(null),[V,D]=v.useState({}),[ne,J]=v.useState(null),[re,de]=v.useState(!1),[G,W]=v.useState([]),[ae,he]=v.useState(!1),[Z,ce]=v.useState(null),[Ce,Ee]=v.useState(null),ge=v.useRef(!0),Me=v.useMemo(()=>t?o3(t):{id:"root",name:n||(e==null?void 0:e.name)||"未命名 Agent",type:"llm",description:"",model:"默认模型",tools:"未配置",skills:"未配置",knowledgebase:"未配置",shortTerm:"未配置",longTerm:"未配置",tracing:"未配置",children:[]},[t,n,e==null?void 0:e.name]),ve=Ce??Z,$e=ve?l3(Me,ve):void 0,Re=$e?Lx($e.type):void 0,oe=Re==null?void 0:Re.icon;v.useEffect(()=>(ge.current=!0,()=>{ge.current=!1}),[]);const _t=v.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:mte(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return c.jsx("div",{className:"pp-error",children:"项目数据无效"});const we=e.files.find(ie=>ie.path===_)??null,Tt=(p==null?void 0:p.mode)??"public",ct=Zee(l?[...d,...gc]:d,f),K=ct.length+G.length;function X(ie){C(_e=>{const ye=new Set(_e);return ye.has(ie)?ye.delete(ie):ye.add(ie),ye})}function le(ie,_e){s&&(s({...e,files:ie}),_e!==void 0&&k(_e))}function ke(ie){we&&le(e.files.map(_e=>_e.path===we.path?{..._e,content:ie}:_e))}function Oe(){const ie=I.trim();if(R(!1),M(""),!!ie){if(e.files.some(_e=>_e.path===ie)){k(ie);return}le([...e.files,{path:ie,content:""}],ie)}}function ut(){if(!we)return;const ie=window.prompt("重命名文件",we.path),_e=ie==null?void 0:ie.trim();!_e||_e===we.path||e.files.some(ye=>ye.path===_e)||le(e.files.map(ye=>ye.path===we.path?{...ye,path:_e}:ye),_e)}function We(){var _e;if(!we)return;const ie=e.files.filter(ye=>ye.path!==we.path);le(ie,((_e=ie[0])==null?void 0:_e.path)??null)}function ot(ie,_e){W(ye=>ye.map(Pe=>Pe.id===ie?{...Pe,..._e}:Pe))}function Xt(ie){W(_e=>_e.filter(ye=>ye.id!==ie))}function It(){W(ie=>[...ie,yte()])}function Ge(ie){m&&m(ie==="public"?void 0:{...p??{mode:ie},mode:ie})}function bt(ie){m==null||m({...p??{mode:"private"},...ie})}function $t(){const ie=new Map(G.map(ye=>({key:ye.key.trim(),value:ye.value})).filter(ye=>ye.key.length>0).map(ye=>[ye.key,ye.value])),_e=l?[...d,...gc]:d;for(const ye of Jee(_e,f))ie.set(ye.key,ye.value);return[...ie].map(([ye,Pe])=>({key:ye,value:Pe}))}async function Tn(){if(!(!u||B||A)){j(null),L(!0);try{await u(!l)}catch(ie){ge.current&&j(`更新飞书配置失败:${ie instanceof Error?ie.message:String(ie)}`)}finally{ge.current&&L(!1)}}}async function Ue(){var _e;if(!i||B)return;if(Tt!=="public"&&!((_e=p==null?void 0:p.vpcId)!=null&&_e.trim())){j("使用 VPC 网络时,请填写 VPC ID。");return}const ie=Jk(d,f);if(ie){const ye=d.find(Pe=>Pe.key===ie.key);j(`请返回配置页填写 ${(ye==null?void 0:ye.comment)||(ye==null?void 0:ye.key)}(${ye==null?void 0:ye.key})。`);return}if(l){const ye=Jk(gc,f);if(ye){const Pe=gc.find(He=>He.key===ye.key);j(`启用飞书后,请填写${(Pe==null?void 0:Pe.comment)||(Pe==null?void 0:Pe.key)}。`);return}}U(!0)}async function rt(){if(!i||B)return;U(!1);const ie=$t();ge.current&&(j(null),H(null),D({}),J(null),Y(!0));const _e=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let ye="生成中…";const Pe=Date.now();o==null||o({id:_e,runtimeName:ye,region:b,startedAt:Pe,status:"running",label:"准备部署"});try{const He=await i(e,qe=>{var yt;qe.runtimeName&&(ye=qe.runtimeName),ge.current&&(D(Rt=>({...Rt,[qe.phase]:qe})),J(qe.phase)),o==null||o({id:_e,runtimeName:ye,region:b,startedAt:Pe,status:"running",label:((yt=Mf.find(Rt=>Rt.phase===qe.phase))==null?void 0:yt.label)??qe.phase,message:qe.message,pct:qe.pct})},l?{taskId:_e,im:{feishu:{enabled:!0}},envs:ie}:{taskId:_e,envs:ie});ge.current&&(H(He),J(null)),o==null||o({id:_e,runtimeName:He.agentName||ye,runtimeId:He.runtimeId,region:He.region||b,startedAt:Pe,status:"success",label:"部署完成"})}catch(He){const qe=He instanceof Error?He.message:String(He);if(He instanceof DOMException&&He.name==="AbortError"){ge.current&&(j(null),J(null)),o==null||o({id:_e,runtimeName:ye,region:b,startedAt:Pe,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"});return}ge.current&&j(qe),o==null||o({id:_e,runtimeName:ye,region:b,startedAt:Pe,status:"error",label:"部署失败",message:qe,retry:Ue})}finally{ge.current&&Y(!1)}}function tt(){U(!1)}async function gt(){if(!(!S||re)){de(!0),j(null);try{const{addConnection:ie,addRuntimeConnection:_e,remoteAppId:ye,loadConnections:Pe}=await el(async()=>{const{addConnection:yt,addRuntimeConnection:Rt,remoteAppId:Ot,loadConnections:mn}=await Promise.resolve().then(()=>Lk);return{addConnection:yt,addRuntimeConnection:Rt,remoteAppId:Ot,loadConnections:mn}},void 0),{probeRuntimeApps:He}=await el(async()=>{const{probeRuntimeApps:yt}=await Promise.resolve().then(()=>nU);return{probeRuntimeApps:yt}},void 0);let qe;if(S.runtimeId){const yt=S.region??"cn-beijing",Rt=await He(S.runtimeId,yt)??[];qe=_e(S.runtimeId,S.agentName,yt,Rt,Rt.length>0?{[Rt[0]]:S.agentName}:void 0)}else qe=await ie(S.agentName,S.url,S.apikey,"");if(qe.apps.length===0)j("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const yt={[qe.apps[0]]:S.agentName},Rt={...qe,appLabels:{...qe.appLabels??{},...yt}},mn=Pe().map(Ht=>Ht.id===qe.id?Rt:Ht);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(mn));const{registerConnections:gn}=await el(async()=>{const{registerConnections:Ht}=await Promise.resolve().then(()=>Lk);return{registerConnections:Ht}},void 0);if(gn(mn),a){const Ht=ye(qe.id,qe.apps[0]);a(Ht,S.agentName)}else alert(`🎉 Agent "${S.agentName}" 已添加到左上角下拉列表!`)}}catch(ie){j(`添加 Agent 失败:${ie instanceof Error?ie.message:String(ie)}`)}finally{de(!1)}}}function ue(){const ie=nte(e.files),_e=URL.createObjectURL(ie),ye=document.createElement("a");ye.href=_e,ye.download=`${e.name||"project"}.zip`,document.body.appendChild(ye),ye.click(),document.body.removeChild(ye),URL.revokeObjectURL(_e)}function Le(ie,_e,ye){return gte(ie).map(Pe=>{const He=ye?`${ye}/${Pe.name}`:Pe.name,qe=Pe.path!==void 0,yt={paddingLeft:8+_e*14};if(qe){const Ot=Pe.path===_;return c.jsxs("button",{type:"button",className:`pp-row pp-file${Ot?" pp-active":""}`,style:yt,onClick:()=>k(Pe.path),title:Pe.path,children:[c.jsx(mF,{className:"pp-ic"}),c.jsx("span",{className:"pp-label",children:Pe.name})]},He)}const Rt=T.has(He);return c.jsxs("div",{children:[c.jsxs("button",{type:"button",className:"pp-row pp-folder",style:yt,onClick:()=>X(He),children:[c.jsx(or,{className:`pp-ic pp-chevron${Rt?"":" pp-open"}`}),c.jsx(AI,{className:"pp-ic"}),c.jsx("span",{className:"pp-label",children:Pe.name})]}),!Rt&&Le(Pe,_e+1,He)]},He)})}return c.jsxs("div",{className:`pp-root${i?" is-deploy":""}`,children:[i&&c.jsx(bte,{left:c.jsxs("div",{className:"pp-toolbar-left",children:[g&&c.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:g,children:[c.jsx(bI,{className:"pp-ic"}),"返回配置"]}),c.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",n||e.name||"未命名 Agent",r&&r>1?` 等 ${r} 个智能体`:""]})]}),right:null}),c.jsxs("div",{className:"pp-body",children:[i&&c.jsxs("section",{className:"pp-topology-pane","aria-label":"Agent 拓扑",children:[c.jsxs("div",{className:"pp-topology-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"pp-topology-title",children:"Agent 拓扑"}),c.jsxs("div",{className:"pp-topology-count",children:[r??1," 个智能体"]})]}),y&&s&&c.jsx(ote,{project:e,onChange:s})]}),c.jsxs("div",{className:"pp-topology-scroll",children:[c.jsx("div",{className:"pp-topology-tree",children:c.jsx(c3,{agent:Me,depth:0,inspectedId:ve,onHover:ce,onFocus:Ee})}),$e&&Re&&oe&&c.jsxs("div",{className:"pp-agent-inspector","aria-live":"polite",children:[c.jsxs("div",{className:"pp-agent-inspector-head",children:[c.jsx("span",{className:"pp-agent-inspector-icon",children:c.jsx(oe,{"aria-hidden":"true"})}),c.jsxs("div",{children:[c.jsx("strong",{children:$e.name}),c.jsx("span",{children:Re.label})]})]}),$e.description&&c.jsx("p",{children:$e.description}),c.jsxs("dl",{className:"pp-agent-config-grid",children:[c.jsx("dt",{children:"模型"}),c.jsx("dd",{children:$e.model}),c.jsx("dt",{children:"工具"}),c.jsx("dd",{children:$e.tools}),c.jsx("dt",{children:"技能"}),c.jsx("dd",{children:$e.skills}),c.jsx("dt",{children:"知识库"}),c.jsx("dd",{children:$e.knowledgebase}),c.jsx("dt",{children:"短期记忆"}),c.jsx("dd",{children:$e.shortTerm}),c.jsx("dt",{children:"长期记忆"}),c.jsx("dd",{children:$e.longTerm}),c.jsx("dt",{children:"观测"}),c.jsx("dd",{children:$e.tracing})]})]})]}),c.jsxs("div",{className:"pp-topology-actions",children:[E&&c.jsxs("button",{type:"button",className:"pp-secondary",onClick:E,children:[c.jsx(fF,{className:"pp-ic"}),"导出配置"]}),e.files.length>0&&c.jsxs("button",{type:"button",className:"pp-secondary",onClick:ue,children:[c.jsx(TE,{className:"pp-ic"}),"下载源码"]})]})]}),c.jsxs("div",{className:"pp-files-area",children:[c.jsxs("div",{className:"pp-sidebar",children:[c.jsxs("div",{className:"pp-sidebar-head",children:[c.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),y&&c.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{R(!0),M("")},children:c.jsx(hF,{className:"pp-ic"})})]}),c.jsxs("div",{className:"pp-tree",children:[N&&c.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:I,onChange:ie=>M(ie.target.value),onBlur:Oe,onKeyDown:ie=>{ie.key==="Enter"&&Oe(),ie.key==="Escape"&&(R(!1),M(""))}}),e.files.length===0&&!N?c.jsx("div",{className:"pp-empty",children:"暂无文件"}):Le(_t,0,"")]})]}),c.jsxs("div",{className:"pp-main",children:[c.jsxs("div",{className:"pp-main-head",children:[c.jsx("span",{className:"pp-path",title:we==null?void 0:we.path,children:(we==null?void 0:we.path)??"未选择文件"}),c.jsx("div",{className:"pp-actions",children:y&&we&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:ut,children:c.jsx(OF,{className:"pp-ic"})}),c.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:We,children:c.jsx(jl,{className:"pp-ic"})})]})})]}),c.jsx("div",{className:"pp-content",children:we==null?c.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):y?c.jsx("div",{className:"pp-codemirror",children:c.jsx(v.Suspense,{fallback:c.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:c.jsx(cte,{value:we.content,path:we.path,onChange:ke})})}):c.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:hte(we.content,we.path)}})})]})]}),i&&c.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[c.jsx("div",{className:"pp-config-head",children:c.jsx("div",{className:"pp-config-title",children:"部署配置"})}),c.jsxs("div",{className:"pp-config-scroll",children:[c.jsxs("section",{className:"pp-config-section",children:[c.jsx("div",{className:"pp-config-label",children:"发布区域"}),c.jsxs("select",{className:"pp-config-select",value:b,onChange:ie=>w==null?void 0:w(ie.target.value),"aria-label":"部署区域",disabled:B||!w,children:[c.jsx("option",{value:"cn-beijing",children:"华北 2(北京)"}),c.jsx("option",{value:"cn-shanghai",children:"华东 2(上海)"})]})]}),c.jsxs("section",{className:"pp-config-section",children:[c.jsx("div",{className:"pp-config-label",children:"消息渠道"}),c.jsxs("button",{type:"button",role:"switch","aria-checked":l,className:`pp-channel${l?" is-on":""}`,onClick:()=>void Tn(),disabled:B||A||!u,children:[c.jsx("span",{className:"pp-channel-title",children:A?"飞书(正在更新代码…)":"飞书"}),c.jsx("span",{className:"pp-switch","aria-hidden":!0,children:c.jsx("span",{})})]}),l&&c.jsx("div",{className:"pp-channel-fields",children:gc.map(ie=>c.jsxs("label",{children:[c.jsxs("span",{children:[ie.comment||ie.key,ie.required&&c.jsx("small",{children:"必填"})]}),c.jsx("code",{children:ie.key}),c.jsx("input",{type:ie.key.includes("SECRET")?"password":"text",value:f[ie.key]??"",placeholder:ie.placeholder,disabled:B||!h,autoComplete:"off",onChange:_e=>h==null?void 0:h(ie.key,_e.currentTarget.value)})]},ie.key))})]}),c.jsxs("section",{className:"pp-config-section",children:[c.jsx("div",{className:"pp-config-label",children:"网络"}),c.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(ie=>c.jsx("button",{type:"button",role:"radio","aria-checked":Tt===ie,className:Tt===ie?"is-on":"",onClick:()=>Ge(ie),disabled:B||!m,children:ie==="public"?"公网":ie==="private"?"VPC":"公网 + VPC"},ie))}),Tt!=="public"&&c.jsxs("div",{className:"pp-network-fields",children:[c.jsxs("label",{children:[c.jsx("span",{children:"VPC ID"}),c.jsx("input",{value:(p==null?void 0:p.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:B,onChange:ie=>bt({vpcId:ie.target.value})})]}),c.jsxs("label",{children:[c.jsxs("span",{children:["子网 ID ",c.jsx("small",{children:"可选,多个用逗号分隔"})]}),c.jsx("input",{value:(p==null?void 0:p.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:B,onChange:ie=>bt({subnetIds:ie.target.value})})]}),c.jsxs("label",{className:"pp-network-check",children:[c.jsx("input",{type:"checkbox",checked:!!(p!=null&&p.enableSharedInternetAccess),disabled:B,onChange:ie=>bt({enableSharedInternetAccess:ie.target.checked})}),"VPC 内共享公网出口"]})]})]}),c.jsxs("section",{className:"pp-config-section pp-env-section",children:[c.jsxs("div",{className:"pp-env-head",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"pp-config-label",children:["环境变量",c.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[K," 项"]})]}),c.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),c.jsx("button",{type:"button",className:"pp-icon-btn",title:ae?"隐藏值":"显示值",onClick:()=>he(ie=>!ie),children:ae?c.jsx(dF,{className:"pp-ic"}):c.jsx(kI,{className:"pp-ic"})})]}),c.jsxs("button",{type:"button",className:"pp-env-add",onClick:It,disabled:B,children:[c.jsx(hs,{className:"pp-ic"}),"添加变量"]}),(ct.length>0||G.length>0)&&c.jsxs("div",{className:"pp-env-table",children:[ct.length>0&&c.jsxs("div",{className:"pp-env-group",children:[c.jsxs("div",{className:"pp-env-group-head",children:[c.jsx("span",{children:"组件自动生成"}),c.jsxs("small",{children:[ct.length," 项"]})]}),ct.map(ie=>{const _e=ie.key.startsWith("ENABLE_");return c.jsxs("div",{className:"pp-env-row pp-env-row-derived",children:[c.jsx("input",{className:"pp-env-key-fixed",value:ie.key,readOnly:!0,disabled:B,"aria-label":`${ie.key} 环境变量名`}),c.jsx("input",{type:_e||ae?"text":"password",value:ie.value,placeholder:ie.required?"必填,尚未填写":"可选,尚未填写",readOnly:_e,disabled:B||!_e&&!h,autoComplete:"off","aria-label":`${ie.key} 环境变量值`,onChange:ye=>h==null?void 0:h(ie.key,ye.currentTarget.value)}),c.jsx("span",{className:"pp-env-source",children:_e?"自动":"同步"})]},ie.key)})]}),G.length>0&&c.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[c.jsx("span",{children:"自定义变量"}),c.jsxs("small",{children:[G.length," 项"]})]}),G.map(ie=>c.jsxs("div",{className:"pp-env-row",children:[c.jsx("input",{value:ie.key,placeholder:"名称",disabled:B,autoComplete:"off",onChange:_e=>ot(ie.id,{key:_e.currentTarget.value})}),c.jsx("input",{type:ae?"text":"password",value:ie.value,placeholder:"值",disabled:B,autoComplete:"off",onChange:_e=>ot(ie.id,{value:_e.currentTarget.value})}),c.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:B,onClick:()=>Xt(ie.id),children:c.jsx(Gr,{className:"pp-ic"})})]},ie.id))]})]}),(B||S||Object.keys(V).length>0)&&c.jsxs("section",{className:"pp-config-section pp-progress-section",children:[c.jsx("div",{className:"pp-config-label",children:"部署进度"}),c.jsx("ol",{className:"pp-steps",children:Mf.map((ie,_e)=>{const ye=ne?Mf.findIndex(yt=>yt.phase===ne):-1,Pe=!!O&&(ye===-1?_e===0:_e===ye);let He;S?He="done":Pe?He="failed":ye===-1?He=B?"active":"pending":_eie.phase===ne))==null?void 0:ln.label)??ne}阶段):`:""}${O}`,onRetry:Ue}),S&&c.jsxs("section",{className:"pp-deploy-result",children:[c.jsx("div",{className:"pp-deploy-result-header",children:"部署成功"}),c.jsxs("div",{className:"pp-deploy-result-body",children:[S.region&&c.jsxs("div",{className:"pp-deploy-result-field",children:[c.jsx("label",{children:"区域"}),c.jsx("code",{children:S.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),c.jsxs("div",{className:"pp-deploy-result-field",children:[c.jsx("label",{children:"Agent 名称"}),c.jsx("code",{children:S.agentName})]}),c.jsxs("div",{className:"pp-deploy-result-field",children:[c.jsx("label",{children:"API 端点"}),c.jsx("code",{className:"pp-deploy-result-url",children:S.url})]})]}),c.jsxs("div",{className:"pp-deploy-result-actions",children:[c.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:gt,disabled:re,children:[re?c.jsx(wt,{className:"pp-ic spin"}):c.jsx(OI,{className:"pp-ic"}),re?"连接中…":"立即对话"]}),S.consoleUrl&&c.jsxs("a",{href:S.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[c.jsx(kE,{className:"pp-ic"}),"控制台"]})]})]})]}),c.jsx("div",{className:"pp-config-actions",children:c.jsxs("button",{type:"button",className:"pp-deploy",onClick:Ue,disabled:B||A,children:[B?c.jsx(wt,{className:"pp-ic spin"}):O?c.jsx(MI,{className:"pp-ic"}):c.jsx(lte,{className:"pp-ic"}),B?"部署中…":O?"重试部署":"部署"]})})]})]}),c.jsx(ute,{open:P,onCancel:tt,onConfirm:()=>void rt()})]})}const sN="dogfooding",y0="dogfooding",b0="dogfooding_b";let Ete=0;const E0=()=>++Ete;function iN(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function xte(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function aN(e){const t=[],n=xte(e);t.push(n);const r=n.indexOf("{"),s=n.lastIndexOf("}");r>=0&&s>r&&t.push(n.slice(r,s+1));for(const i of t)try{const a=JSON.parse(i);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await up(r3(a))}catch{}return null}function wte({userId:e,onBack:t,onCreate:n,onAgentAdded:r,onDeploymentTaskChange:s}){const[i,a]=v.useState([{id:E0(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[o,l]=v.useState(""),[u,d]=v.useState(!1),[f,h]=v.useState(null),[p,m]=v.useState(null),[b,w]=v.useState(!1),[g,E]=v.useState(null),[y,_]=v.useState(null),[k,T]=v.useState(!1),[C,N]=v.useState(!1),[R,I]=v.useState({}),M=v.useRef(null),B=v.useRef(null),Y=v.useRef(null),P=v.useRef(null),U=v.useRef(null);v.useEffect(()=>{const J=P.current;J&&J.scrollTo({top:J.scrollHeight,behavior:"smooth"})},[i,u]),v.useEffect(()=>{const J=U.current;J&&(J.style.height="auto",J.style.height=Math.min(J.scrollHeight,160)+"px")},[o]);const A=J=>a(re=>[...re,{id:E0(),role:"assistant",text:J}]);async function L(){if(M.current)return M.current;const J=await lp(sN,e);return M.current=J,J}async function O(J,re){if(re.current)return re.current;const de=await lp(J,e);return re.current=de,de}async function j(J,re){if(!R[J])try{const de=await dd(re);I(G=>({...G,[J]:de.model||re}))}catch{I(de=>({...de,[J]:re}))}}async function S(J,re,de){const G=await O(J,re);let W=qs();for await(const he of Ou({appName:J,userId:e,sessionId:G,text:de}))W=pl(W,he);const ae=iN(W).trim();return{project:await aN(ae),finalText:ae}}const H=async(J,re,de)=>LE(J.name,J.files,{region:"cn-beijing",projectName:"default"},{...de,onStage:re}),V=async()=>{const J=o.trim();if(!(!J||u)){if(a(re=>[...re,{id:E0(),role:"user",text:J}]),l(""),h(null),d(!0),b){E(null),_(null),T(!0),N(!0),j("a",y0),j("b",b0);const re=S(y0,B,J).then(({project:G})=>(E(G),G)).catch(G=>{const W=G instanceof Error?G.message:String(G);return h(W),null}).finally(()=>T(!1)),de=S(b0,Y,J).then(({project:G})=>(_(G),G)).catch(G=>{const W=G instanceof Error?G.message:String(G);return h(W),null}).finally(()=>N(!1));try{const[G,W]=await Promise.all([re,de]),ae=[G?`方案 A:${G.name}`:null,W?`方案 B:${W.name}`:null].filter(Boolean);ae.length?A(`已生成两个方案(${ae.join(",")}),请在右侧对比后采用其一。`):A("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const re=await L();let de=qs();for await(const ae of Ou({appName:sN,userId:e,sessionId:re,text:J}))de=pl(de,ae);const G=iN(de).trim(),W=await aN(G);W?(m(W),A(`已生成项目:${W.name}(${W.files.length} 个文件),可在右侧预览和编辑。`)):A(G||"(助手没有返回内容,请再描述一下你的需求。)")}catch(re){const de=re instanceof Error?re.message:String(re);h(de),A(`抱歉,调用智能构建助手失败:${de}`)}finally{d(!1)}}},D=J=>{const re=J==="a"?g:y;if(!re)return;m(re),w(!1),E(null),_(null),T(!1),N(!1);const de=J==="a"?"A":"B",G=J==="a"?R.a:R.b;A(`已采用方案 ${de}(${G??(J==="a"?y0:b0)}),可继续编辑。`)},ne=J=>{J.key==="Enter"&&!J.shiftKey&&!J.nativeEvent.isComposing&&(J.preventDefault(),V())};return c.jsx("div",{className:"ic-root",children:c.jsxs("div",{className:"ic-body",children:[c.jsxs("div",{className:"ic-chat",children:[c.jsxs("div",{className:"ic-transcript",ref:P,children:[c.jsx($i,{initial:!1,children:i.map(J=>c.jsxs(Wt.div,{className:`ic-turn ic-turn--${J.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[J.role==="assistant"&&c.jsx("div",{className:"ic-avatar",children:c.jsx($a,{className:"ic-avatar-icon"})}),c.jsx("div",{className:"ic-bubble",children:J.role==="assistant"?c.jsx(wd,{text:J.text}):J.text})]},J.id))}),u&&c.jsxs(Wt.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[c.jsx("div",{className:"ic-avatar",children:c.jsx($a,{className:"ic-avatar-icon"})}),c.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[c.jsx("span",{className:"ic-dot"}),c.jsx("span",{className:"ic-dot"}),c.jsx("span",{className:"ic-dot"})]})]})]}),f&&c.jsxs("div",{className:"ic-error",children:[c.jsx(_I,{className:"ic-error-icon"}),f]}),c.jsxs("div",{className:"ic-composer",children:[c.jsxs("div",{className:"ic-composer-box",children:[c.jsx("textarea",{ref:U,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:o,onChange:J=>l(J.target.value),onKeyDown:ne,disabled:u}),c.jsx("button",{className:"ic-send",onClick:()=>void V(),disabled:!o.trim()||u,title:"发送 (Enter)",children:c.jsx(DF,{className:"ic-send-icon"})})]}),c.jsxs("div",{className:"ic-composer-foot",children:[c.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[c.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:b,disabled:u,onChange:J=>w(J.target.checked)}),c.jsx("span",{className:"ic-ab-track",children:c.jsx("span",{className:"ic-ab-thumb"})}),c.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),c.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),c.jsx("aside",{className:"ic-preview",children:b?c.jsxs("div",{className:"ic-compare",children:[c.jsx(oN,{side:"a",project:g,loading:k,model:R.a,onAdopt:()=>D("a")}),c.jsx("div",{className:"ic-compare-divider"}),c.jsx(oN,{side:"b",project:y,loading:C,model:R.b,onAdopt:()=>D("b")})]}):p?c.jsx(Mx,{project:p,onChange:m,onDeploy:H,onAgentAdded:r,onDeploymentTaskChange:s}):c.jsxs("div",{className:"ic-preview-empty",children:[c.jsxs("div",{className:"ic-preview-empty-icon",children:[c.jsx(gF,{className:"ic-preview-empty-glyph"}),c.jsx(Ha,{className:"ic-preview-empty-spark"})]}),c.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),c.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function oN({side:e,project:t,loading:n,model:r,onAdopt:s}){const i=e==="a"?"方案 A":"方案 B";return c.jsxs("div",{className:"ic-pane",children:[c.jsxs("div",{className:"ic-pane-head",children:[c.jsxs("div",{className:"ic-pane-title",children:[c.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:i}),r&&c.jsx("span",{className:"ic-pane-model",children:r})]}),c.jsxs("button",{className:"ic-adopt",onClick:s,disabled:!t||n,title:`采用${i}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),c.jsx("div",{className:"ic-pane-body",children:n?c.jsxs("div",{className:"ic-pane-loading",children:[c.jsx(wt,{className:"ic-pane-spinner"}),c.jsx("span",{children:"正在生成…"})]}):t?c.jsx(Mx,{project:t}):c.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}const vte=/^[A-Za-z_][A-Za-z0-9_]*$/;function tl(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":vte.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function u3(e){const t=new Set,n=new Set,r=s=>{tl(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(r)};return r(e),n}function Qr(e){return e.trimEnd().replace(/[。.]+$/,"")}function ca(e,t){return e[t]|e[t+1]<<8}function yc(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function _te(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function Tte(e){let n=-1;for(let o=e.length-22;o>=0&&o>e.length-65557;o--)if(yc(e,o)===101010256){n=o;break}if(n<0)throw new Error("无效的 zip:找不到 EOCD");const r=ca(e,n+10);let s=yc(e,n+16);const i=new TextDecoder("utf-8"),a=[];for(let o=0;o{var o;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((o=a.Metadata)==null?void 0:o.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function Ste({selected:e,onChange:t}){const[n,r]=v.useState(""),[s,i]=v.useState([]),[a,o]=v.useState(!1),[l,u]=v.useState(null),[d,f]=v.useState(!1),h=b=>e.some(w=>w.source==="skillhub"&&w.slug===b),p=b=>{b.slug&&(h(b.slug)?t(e.filter(w=>!(w.source==="skillhub"&&w.slug===b.slug))):t([...e,{source:"skillhub",slug:b.slug,name:b.name,folder:b.slug.split("/").pop()||b.name,namespace:b.namespace||"public",description:b.description}]))},m=async b=>{o(!0),u(null),f(!0);try{const w=await Nte(b);i(w)}catch(w){u(w instanceof Error?w.message:"搜索失败,请稍后重试。"),i([])}finally{o(!1)}};return v.useEffect(()=>{const b=n.trim();if(!b){i([]),f(!1),u(null);return}const w=setTimeout(()=>m(b),300);return()=>clearTimeout(w)},[n]),c.jsxs("div",{className:"cw-skillhub",children:[c.jsxs("div",{className:"cw-skill-searchrow",children:[c.jsxs("div",{className:"cw-skill-searchbox",children:[c.jsx(e1,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),c.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>r(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&m(n))}})]}),c.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?c.jsx(wt,{className:"cw-i cw-spin"}):c.jsx(e1,{className:"cw-i"}),"搜索"]})]}),l&&c.jsxs("div",{className:"cw-banner",children:[c.jsx(cd,{className:"cw-i"}),c.jsx("span",{children:l})]}),a&&s.length===0?c.jsx("p",{className:"cw-empty-line",children:"正在搜索…"}):s.length>0?c.jsx("div",{className:"cw-skill-results",children:s.map(b=>{const w=h(b.slug||"");return c.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>p(b),"aria-pressed":w,children:[c.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?c.jsx(Ds,{className:"cw-i cw-i-sm"}):c.jsx(hs,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-skill-result-meta",children:[c.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&c.jsx("span",{className:"cw-skill-result-desc",children:Qr(b.description)}),b.sourceRepo&&c.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!l?c.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&c.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const L1=/(^|\/)skill\.md$/i;class zi extends Error{}function Ate(e,t){const n=(e??"").replace(/\r\n?/g,` +`).split(` +`);if(!n.length||n[0].trim()!=="---")throw new zi(`${t} 的 SKILL.md 必须以 YAML frontmatter (--- ... ---) 开头`);let r=-1;for(let o=1;o=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function Ite(e,t){if(!e)throw new zi(`${t} 的 SKILL.md 缺少必填的 name frontmatter`);if(e.length>64)throw new zi(`${t} 的 name 长度超过 64 个字符`);if(!/^[a-z0-9-]+$/.test(e))throw new zi(`${t} 的 name 必须匹配 [a-z0-9-]+(小写字母、数字、短横线)`)}function Rte(e,t){if(!e)throw new zi(`${t} 的 SKILL.md 缺少必填的 description frontmatter`);if(e.length>1024)throw new zi(`${t} 的 description 长度超过 1024 个字符`);if(/<[^>]+>/.test(e))throw new zi(`${t} 的 description 不能包含 XML 标签`)}function d3(e){const t=e.map(r=>({path:r.path.replace(/\\/g,"/").replace(/^\.\//,""),text:r.text})).filter(r=>r.path.length>0&&!r.path.endsWith("/")),n=new Set(t.map(r=>r.path.split("/")[0]));if(n.size===1&&t.every(r=>r.path.includes("/"))){const r=[...n][0]+"/";return t.map(s=>({path:s.path.slice(r.length),text:s.text}))}return t}function Ote(e){const t=new Map,n=new Set;for(const r of e)if(L1.test("/"+r.path)){const s=r.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const r of e){const s=r.path.split("/");let i="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){i=d;break}}const a=L1.test("/"+r.path);if(!i&&!a&&!n.has("")||!n.has(i)&&!a)continue;const o=i?r.path.slice(i.length+1):r.path,l=t.get(i)||[];l.push({path:o,text:r.text}),t.set(i,l)}return t}function Lte(e,t,n){const r=`${n}${e?"/"+e:""}`,s=t.find(l=>L1.test("/"+l.path));if(!s)return{hit:null,error:`${r} 缺少 SKILL.md`};let i;try{i=Ate(s.text,r)}catch(l){return{hit:null,error:l instanceof Error?l.message:String(l)}}const a=i.name,o=[];for(const l of t){if(l.path.split("/").some(f=>f===".."))return{hit:null,error:`${r} 包含非法路径(..):${l.path}`};const d=`skills/${a}/${l.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${r} 包含非法路径:${l.path}`};o.push({path:d,content:l.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:i.name,description:i.description,folder:a,localFiles:o},error:null}}async function Mte(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await Tte(t)).map(s=>({path:s.name,text:s.text}));return f3(d3(r),e.name)}async function Dte(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function jte(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((s,i)=>t.readEntries(s,i));if(r.length===0)return n;n.push(...r)}}async function h3(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await Pte(e),path:n}];if(!e.isDirectory)return[];const r=await jte(e);return(await Promise.all(r.map(s=>h3(s,n)))).flat()}function Bte({selected:e,onChange:t}){const[n,r]=v.useState([]),[s,i]=v.useState([]),[a,o]=v.useState(!1),[l,u]=v.useState(!1),d=v.useRef(0),f=y=>e.some(_=>_.source==="local"&&_.folder===y),h=y=>{y.localFiles&&(f(y.folder||y.name)?t(e.filter(_=>!(_.source==="local"&&_.folder===(y.folder||y.name)))):t([...e,{source:"local",folder:y.folder||y.name,name:y.name,description:y.description,localFiles:y.localFiles}]))},p=v.useRef([]),m=v.useRef(e);v.useEffect(()=>{p.current=s},[s]),v.useEffect(()=>{m.current=e},[e]);const b=y=>{const _=new Set([...p.current.map(N=>N.folder||N.name),...m.current.filter(N=>N.source==="local").map(N=>N.folder)]),k=[],T=[];for(const N of y.hits){const R=N.folder||N.name;if(_.has(R)){k.push(N.name);continue}_.add(R),T.push(N)}i(N=>[...N,...T]);const C=[...y.errors];if(k.length>0&&C.push(`已跳过重复技能:${k.join("、")}`),r(C),T.length===1&&y.errors.length===0&&k.length===0){const N=T[0];N.localFiles&&t([...m.current,{source:"local",folder:N.folder||N.name,name:N.name,description:N.description,localFiles:N.localFiles}])}},w=y=>{y.preventDefault(),d.current+=1,u(!0)},g=y=>{y.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},E=async y=>{if(y.preventDefault(),d.current=0,u(!1),a)return;const _=Array.from(y.dataTransfer.items).map(k=>{var T;return(T=k.webkitGetAsEntry)==null?void 0:T.call(k)}).filter(k=>k!==null);if(_.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}o(!0);try{const k=(await Promise.all(_.map(N=>h3(N)))).flat(),T=_.some(N=>N.isDirectory);if(!T&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){b(await Mte(k[0].file));return}if(!T){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const C=new Map(k.map(({file:N,path:R})=>[N,R]));b(await Dte(k.map(({file:N})=>N),C))}catch(k){r([`读取失败:${k instanceof Error?k.message:String(k)}`])}finally{o(!1)}};return c.jsxs("div",{className:"cw-local",children:[c.jsxs("div",{className:`cw-local-dropzone ${l?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:w,onDragOver:y=>y.preventDefault(),onDragLeave:g,onDrop:y=>void E(y),children:[c.jsx(NE,{className:"cw-local-drop-icon","aria-hidden":!0}),c.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),c.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md(含 name / description frontmatter)。支持包含多个技能的目录。"}),a&&c.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&c.jsxs("div",{className:"cw-banner",children:[c.jsx(cd,{className:"cw-i"}),c.jsx("span",{children:n.join(";")})]}),s.length>0&&c.jsx("div",{className:"cw-skill-results",children:s.map(y=>{var k;const _=f(y.folder||y.name);return c.jsxs("button",{type:"button",className:`cw-skill-result ${_?"is-on":""}`,onClick:()=>h(y),"aria-pressed":_,children:[c.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:_?c.jsx(Ds,{className:"cw-i cw-i-sm"}):c.jsx(hs,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-skill-result-meta",children:[c.jsx("span",{className:"cw-skill-result-name",children:y.name}),y.description&&c.jsx("span",{className:"cw-skill-result-desc",children:Qr(y.description)}),c.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((k=y.localFiles)==null?void 0:k.length)??0," 个文件"]})]})]},y.id)})})]})}function Fte({selected:e,onChange:t}){const[n,r]=v.useState([]),[s,i]=v.useState([]),[a,o]=v.useState(""),[l,u]=v.useState(!0),[d,f]=v.useState(!1),[h,p]=v.useState(null);v.useEffect(()=>{let g=!1;return(async()=>{u(!0),p(null);try{const E=await dU();g||(r(E),E.length>0&&o(E[0].id))}catch(E){g||p(E instanceof Error?E.message:"加载失败")}finally{g||u(!1)}})(),()=>{g=!0}},[]),v.useEffect(()=>{if(!a){i([]);return}const g=n.find(y=>y.id===a);let E=!1;return(async()=>{f(!0),p(null);try{const y=await hU(a,g==null?void 0:g.region);E||i(y)}catch(y){E||p(y instanceof Error?y.message:"加载失败")}finally{E||f(!1)}})(),()=>{E=!0}},[a,n]);const m=n.find(g=>g.id===a),b=(g,E)=>e.some(y=>y.source==="skillspace"&&y.skillId===g&&(y.version||"")===E),w=g=>{if(m)if(b(g.skillId,g.version))t(e.filter(E=>!(E.source==="skillspace"&&E.skillId===g.skillId&&(E.version||"")===g.version)));else{const E=gU(m,g);t([...e,{source:"skillspace",folder:E.folder||g.skillName,name:E.name,description:E.description,skillSpaceId:E.skillSpaceId,skillSpaceName:E.skillSpaceName,skillSpaceRegion:E.skillSpaceRegion,skillId:E.skillId,version:E.version}])}};return c.jsx("div",{className:"cw-skillspace",children:l?c.jsxs("p",{className:"cw-empty-line",children:[c.jsx(wt,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?c.jsxs("div",{className:"cw-banner",children:[c.jsx(cd,{className:"cw-i"}),c.jsx("span",{children:h})]}):n.length===0?c.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cw-skillspace-header",children:[c.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:g=>o(g.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(g=>c.jsxs("option",{value:g.id,children:[g.name||g.id,g.region?` [${g.region}]`:"",g.description?` — ${Qr(g.description)}`:""]},g.id))}),m&&c.jsx("a",{href:yU(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开",children:c.jsx(kE,{className:"cw-i cw-i-sm"})})]}),d?c.jsxs("p",{className:"cw-empty-line",children:[c.jsx(wt,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?c.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):c.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const E=b(g.skillId,g.version);return c.jsxs("button",{type:"button",className:`cw-skill-result ${E?"is-on":""}`,onClick:()=>w(g),"aria-pressed":E,children:[c.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:E?c.jsx(Ds,{className:"cw-i cw-i-sm"}):c.jsx(hs,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-skill-result-meta",children:[c.jsxs("span",{className:"cw-skill-result-name",children:[g.skillName,g.version&&c.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",g.version]})]}),g.skillDescription&&c.jsx("span",{className:"cw-skill-result-desc",children:Qr(g.skillDescription)}),c.jsxs("span",{className:"cw-skill-result-repo",children:[c.jsx(cF,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${g.skillId}/${g.version}`)})})]})})}const Ute=v.lazy(()=>el(()=>import("./MarkdownPromptEditor--dxbgBhm.js"),__vite__mapDeps([0,1])));function $te(e,t,n="text/plain"){const r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(r)}const lN=[{id:"type",label:"类型",hint:"选择 Agent 类型",icon:PF,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:cd,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:TI},{id:"tools",label:"工具",hint:"可调用的能力",icon:CE},{id:"skills",label:"技能",hint:"声明式技能",icon:Ha},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:ah},{id:"advanced",label:"进阶配置",hint:"记忆与观测",icon:RI},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:vI},{id:"review",label:"完成",hint:"预览并创建",icon:MF}];function Hte({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"m7.2 15.8 7.9-7.9a2 2 0 0 1 2.8 0l1.2 1.2a2 2 0 0 1 0 2.8l-7 7H8.7l-1.5-1.5a1.15 1.15 0 0 1 0-1.6Z"}),c.jsx("path",{d:"m12.7 10.3 4 4"}),c.jsx("path",{d:"M6.3 19h12.4"}),c.jsx("path",{d:"m5.5 8.2.5-1.4 1.4-.5L6 5.8l-.5-1.4L5 5.8l-1.4.5 1.4.5.5 1.4Z"})]})}function zte({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.65",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("rect",{x:"3.25",y:"4.25",width:"17.5",height:"15.5",rx:"2.75"}),c.jsx("path",{d:"M3.75 8.75h16.5"}),c.jsx("circle",{cx:"6.35",cy:"6.5",r:"0.72",fill:"currentColor",stroke:"none"}),c.jsx("circle",{cx:"8.85",cy:"6.5",r:"0.72",fill:"currentColor",stroke:"none",opacity:"0.45"}),c.jsx("path",{d:"M6 14h2.2l1.35-2.8 2.1 5.5 1.7-3.1H18"})]})}function Vte({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),c.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),c.jsx("path",{d:"M3 10v4",opacity:"0.45"}),c.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}const x0=4,Kte={llm:"LLM 智能体",sequential:"顺序型智能体",parallel:"并行型智能体",loop:"循环型智能体",a2a:"远程智能体"},cN={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"};function p3(e,t){var r,s,i;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((r=e.registryTopK)==null?void 0:r.trim())||ri.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||ri.region,n.REGISTRY_ENDPOINT=((i=e.registryEndpoint)==null?void 0:i.trim())||ri.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function uN({items:e,selected:t,onToggle:n,scrollRows:r}){return c.jsx("div",{className:`cw-checklist ${r?"cw-checklist-tools":""}`,style:r?{"--cw-checklist-max-height":`${r*65+(r-1)*8}px`}:void 0,children:e.map(s=>{const i=t.includes(s.id);return c.jsxs("button",{type:"button",className:`cw-check ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:[c.jsx("span",{className:"cw-check-box","aria-hidden":!0,children:i&&c.jsx(Ds,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-check-text",children:[c.jsx("span",{className:"cw-check-title",children:s.label}),c.jsx("span",{className:"cw-check-desc",children:Qr(s.desc)})]})]},s.id)})})}function w0({options:e,value:t,onChange:n}){return c.jsx("div",{className:"cw-segmented",children:e.map(r=>{var i;const s=(t??((i=e[0])==null?void 0:i.id))===r.id;return c.jsxs("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(r.id),"aria-pressed":s,title:Qr(r.desc),children:[c.jsx("span",{className:"cw-seg-title",children:r.label}),c.jsx("span",{className:"cw-seg-desc",children:Qr(r.desc)})]},r.id)})})}function Yte(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function bc({env:e,values:t,onChange:n}){return e.length===0?c.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):c.jsx("div",{className:"cw-env-fields",children:e.map(r=>c.jsxs("label",{className:"cw-env-field",children:[c.jsxs("span",{className:"cw-env-field-head",children:[c.jsxs("span",{className:"cw-env-field-label",children:[r.comment||r.key,r.required&&c.jsx("span",{className:"cw-req",children:"*"})]}),r.comment&&c.jsx("code",{title:r.key,children:r.key})]}),c.jsx("input",{className:"cw-input",type:Yte(r.key)?"password":"text",value:t[r.key]??"",placeholder:r.placeholder||"请输入参数值",autoComplete:"off",onChange:s=>n(r.key,s.currentTarget.value)})]},r.key))})}function Wte({tools:e,onChange:t}){const n=(i,a)=>t(e.map((o,l)=>l===i?{...o,...a}:o)),r=i=>t(e.filter((a,o)=>o!==i)),s=()=>t([...e,{name:"",transport:"http",url:""}]);return c.jsxs("div",{className:"cw-mcp",children:[e.length>0&&c.jsx("div",{className:"cw-mcp-list",children:c.jsx($i,{initial:!1,children:e.map((i,a)=>c.jsxs(Wt.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[c.jsxs("div",{className:"cw-mcp-rowhead",children:[c.jsxs("div",{className:"cw-mcp-transport",children:[c.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":i.transport==="http",children:c.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),c.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":i.transport==="stdio",children:c.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),c.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>r(a),"aria-label":"移除 MCP 工具",children:c.jsx(jl,{className:"cw-i cw-i-sm"})})]}),c.jsx("input",{className:"cw-input",value:i.name,placeholder:"名称(用于命名,可留空)",onChange:o=>n(a,{name:o.target.value})}),i.transport==="http"?c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"cw-input",value:i.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:o=>n(a,{url:o.target.value})}),c.jsx("input",{className:"cw-input",value:i.authToken??"",placeholder:"Bearer Token(可选)",onChange:o=>n(a,{authToken:o.target.value})})]}):c.jsxs(c.Fragment,{children:[c.jsx("input",{className:"cw-input",value:i.command??"",placeholder:"启动命令,例如 npx",onChange:o=>n(a,{command:o.target.value})}),c.jsx("input",{className:"cw-input",value:(i.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:o=>n(a,{args:o.target.value.split(/\s+/).filter(Boolean)})}),c.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),c.jsxs("button",{type:"button",className:"cw-add-sub",onClick:s,children:[c.jsx(hs,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&c.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function m3({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),c.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),c.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),c.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function qte({s:e,onRemove:t}){let n=Ha,r="火山 Find Skill 技能广场";return e.source==="local"?(n=NE,r="本地"):e.source==="skillspace"&&(n=m3,r="AgentKit Skills 中心"),c.jsxs(Wt.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[c.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:c.jsx(n,{className:"cw-i cw-i-sm"})}),c.jsxs("span",{className:"cw-selected-skill-meta",children:[c.jsx("span",{className:"cw-selected-skill-name",children:e.name}),c.jsxs("span",{className:"cw-selected-skill-detail",children:[r,e.description?` · ${Qr(e.description)}`:""]})]}),c.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:c.jsx(Gr,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const v0=[{id:"local",label:"本地文件",icon:NE},{id:"skillspace",label:"AgentKit Skills 中心",icon:m3},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:lm}];function Gte({selected:e,onChange:t}){const[n,r]=v.useState("local"),[s,i]=v.useState(!1),a=v0.findIndex(l=>l.id===n),o=l=>t(e.filter(u=>_0(u)!==l));return v.useEffect(()=>{if(!s)return;const l=u=>{u.key==="Escape"&&i(!1)};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[s]),c.jsxs("div",{className:"cw-skillspane",children:[c.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>i(!0),children:[c.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:c.jsx(hs,{className:"cw-i"})}),c.jsx("span",{children:"添加 Skill"})]}),e.length>0&&c.jsxs("div",{className:"cw-skill-selected",children:[c.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),c.jsx("div",{className:"cw-selected-skill-list",children:c.jsx($i,{initial:!1,children:e.map(l=>c.jsx(qte,{s:l,onRemove:()=>o(_0(l))},_0(l)))})})]}),c.jsx($i,{children:s&&c.jsx(Wt.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:l=>{l.target===l.currentTarget&&i(!1)},children:c.jsxs(Wt.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[c.jsxs("div",{className:"cw-skill-dialog-head",children:[c.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),c.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>i(!1),children:c.jsx(Gr,{className:"cw-i"})})]}),c.jsxs("div",{className:"cw-skill-dialog-body",children:[c.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${v0.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[c.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),v0.map(({id:l,label:u,icon:d})=>c.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${l}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===l,className:`cw-skill-pickertab ${n===l?"is-on":""}`,onClick:()=>r(l),children:[c.jsx(d,{className:"cw-i cw-i-sm"}),u]},l))]}),c.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&c.jsx(Ste,{selected:e,onChange:t}),n==="local"&&c.jsx(Bte,{selected:e,onChange:t}),n==="skillspace"&&c.jsx(Fte,{selected:e,onChange:t})]})]})]})})})]})}function _0(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Ec({checked:e,onChange:t,title:n,desc:r,icon:s}){return c.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[c.jsx("span",{className:"cw-toggle-icon",children:c.jsx(s,{className:"cw-i"})}),c.jsxs("span",{className:"cw-toggle-text",children:[c.jsx("span",{className:"cw-toggle-title",children:n}),c.jsx("span",{className:"cw-toggle-desc",children:Qr(r)})]}),c.jsx("span",{className:"cw-switch","aria-hidden":!0,children:c.jsx(Wt.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}const dN=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]);function Xte(e,t){var r;let n=e;for(const s of t)if(n=(r=n.subAgents)==null?void 0:r[s],!n)return!1;return!0}function Eh(e,t){let n=e;for(const r of t)n=n.subAgents[r];return n}function Cd(e,t,n){if(t.length===0)return n(e);const[r,...s]=t,i=e.subAgents.slice();return i[r]=Cd(i[r],s,n),{...e,subAgents:i}}function Qte(e,t){return Cd(e,t,n=>({...n,subAgents:[...n.subAgents,Gi()]}))}function Zte(e,t){if(t.length===0)return e;const n=t.slice(0,-1),r=t[t.length-1];return Cd(e,n,s=>({...s,subAgents:s.subAgents.filter((i,a)=>a!==r)}))}function Jte(e,t,n,r){return Cd(e,t,s=>{const i=s.subAgents.slice(),[a]=i.splice(n,1);return i.splice(r,0,a),{...s,subAgents:i}})}const ene=e=>e==="sequential"||e==="loop",g3=e=>!Ad(e.agentType),tne=3;function y3(e,t,n=!1){var s;if(Ad(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心 ID";const r=tl(e.name);return r||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":i3(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function b3(e,t,n=[]){const r=[],s=Ad(e.agentType),i=y3(e,t,n.length===0);return i&&r.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",problem:i}),g3(e)&&e.subAgents.forEach((a,o)=>r.push(...b3(a,t,[...n,o]))),r}function E3(e){return 1+e.subAgents.reduce((t,n)=>t+E3(n),0)}function nne(e){const t=[],n={},r=i=>{var a,o,l,u;for(const d of i.builtinTools??[]){const f=Ox.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=i.a2aRegistry)!=null&&a.enabled&&(t.push({env:XM}),Object.assign(n,p3(i.a2aRegistry,{includeDefaults:!0}))),i.memory.shortTerm&&t.push({env:((o=Tp.find(d=>d.id===(i.shortTermBackend??"local")))==null?void 0:o.env)??[]}),i.memory.longTerm&&t.push({env:((l=kp.find(d=>d.id===(i.longTermBackend??"local")))==null?void 0:l.env)??[]}),i.knowledgebase&&t.push({env:((u=Np.find(d=>d.id===(i.knowledgebaseBackend??"local")))==null?void 0:u.env)??[]}),i.tracing)for(const d of i.tracingExporters??[]){const f=Sp.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}i.subAgents.forEach(r)};r(e);const s=a3(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function x3({root:e,path:t,selectedPath:n,duplicateNames:r,showErrors:s,validationPulse:i,onSelect:a,onChange:o,onClearRoot:l}){const u=Eh(e,t),d=Lx(u.agentType),f=d.icon,h=t.length===0,p=dN(t,n),m=g3(u),b=m&&t.length{const C=Qte(e,t),N=Eh(C,t).subAgents.length-1;o(C,[...t,N])},g=()=>o(Zte(e,t),t.slice(0,-1)),E=t.slice(0,-1),y=!h&&ene(Eh(e,E).agentType),[_,k]=v.useState(!1),T=C=>{C.preventDefault(),C.stopPropagation(),k(!1);const N=C.dataTransfer.getData("application/x-agent-path");if(!N)return;let R;try{R=JSON.parse(N)}catch{return}if(!dN(R.slice(0,-1),E))return;const I=R[R.length-1],M=t[t.length-1];I!==M&&o(Jte(e,E,I,M),[...E,M])};return c.jsxs("div",{className:"cw-tree-branch",children:[c.jsxs("div",{className:`cw-tree-node cw-tree-type-${u.agentType??"llm"} ${p?"is-selected":""} ${y?"is-draggable":""} ${_?"is-dragover":""} ${s&&y3(u,r,h)?`is-invalid cw-error-shake-${i%2}`:""}`,role:"button",tabIndex:0,draggable:y,onDragStart:y?C=>{C.dataTransfer.setData("application/x-agent-path",JSON.stringify(t)),C.dataTransfer.effectAllowed="move",C.stopPropagation()}:void 0,onDragOver:y?C=>{C.preventDefault(),k(!0)}:void 0,onDragLeave:y?()=>k(!1):void 0,onDrop:y?T:void 0,onClick:()=>a(t),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a(t))},children:[c.jsx(f,{className:"cw-tree-icon"}),c.jsxs("span",{className:"cw-tree-main",children:[c.jsx("span",{className:"cw-tree-name",children:Ad(u.agentType)?"远程 Agent":u.name.trim()||"未命名"}),c.jsx("span",{className:"cw-tree-type",children:d.label})]}),c.jsxs("span",{className:"cw-tree-actions",children:[h&&c.jsx("button",{type:"button",className:"cw-icon-btn cw-tree-clear",title:"清空根 Agent","aria-label":"清空根 Agent",onClick:C=>{C.stopPropagation(),l()},children:c.jsx(Hte,{className:"cw-i cw-i-sm"})}),b&&c.jsx("button",{type:"button",className:"cw-icon-btn",title:"添加子 Agent",onClick:C=>{C.stopPropagation(),w()},children:c.jsx(hs,{className:"cw-i cw-i-sm"})}),!h&&c.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",title:"删除",onClick:C=>{C.stopPropagation(),g()},children:c.jsx(jl,{className:"cw-i cw-i-sm"})})]})]}),m&&u.subAgents.length>0&&c.jsx("div",{className:"cw-tree-children",children:u.subAgents.map((C,N)=>c.jsx(x3,{root:e,path:[...t,N],selectedPath:n,duplicateNames:r,showErrors:s,validationPulse:i,onSelect:a,onChange:o,onClearRoot:l},N))})]})}function xh(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function fN(e){return JSON.stringify(xh(e))}function rne({enabled:e,disabledReason:t,phase:n,stale:r,run:s,projectName:i,logs:a,messages:o,input:l,error:u,deploying:d,deployError:f,onInput:h,onSend:p,onRestart:m,onIgnoreChanges:b,onDeploy:w}){const[g,E]=v.useState(!1),y=n==="ready"||n==="sending",_=n==="building"||n==="starting"||n==="sending",k=e&&!s&&n==="idle",T=e&&(n==="building"||n==="starting"),C=!!(s&&r&&!T);return g?c.jsx("aside",{className:"cw-debug is-collapsed","aria-label":"调试窗口(已收起)",children:c.jsx("button",{type:"button",className:"cw-debug-expand",onClick:()=>E(!1),"aria-label":"展开调试栏",title:"展开调试栏",children:c.jsx(zte,{className:"cw-i"})})}):c.jsxs("aside",{className:"cw-debug","aria-label":"调试窗口",children:[c.jsxs("div",{className:"cw-debug-head",children:[c.jsxs("div",{className:"cw-debug-title",children:[c.jsx("button",{type:"button",className:"cw-debug-collapse",onClick:()=>E(!0),"aria-label":"收起调试栏",title:"收起调试栏",children:c.jsx(or,{className:"cw-i cw-i-sm"})}),c.jsx("span",{children:"调试"})]}),c.jsx("div",{className:"cw-debug-head-actions",children:c.jsxs("button",{type:"button",className:"cw-debug-deploy",disabled:d,onClick:w,title:"查看源码、填写环境变量并部署",children:["去部署",d?c.jsx(wt,{className:"cw-i cw-spin"}):c.jsx(EI,{className:"cw-i"})]})})]}),!s&&n==="idle"&&!e&&c.jsx("div",{className:"cw-debug-sub",children:c.jsx("span",{children:t})}),f&&c.jsx("div",{className:"cw-debug-deploy-error",role:"alert",children:f}),c.jsxs("div",{className:"cw-debug-stage",children:[c.jsx("div",{className:"cw-debug-body",children:e?n==="error"?c.jsxs("div",{className:"cw-debug-error",children:[c.jsx(Ap,{message:u||"调试失败",className:"cw-debug-error-detail",onRetry:async()=>{await m()}}),a.length>0&&c.jsx("div",{className:"cw-debug-progress",children:a.map((N,R)=>c.jsx("div",{className:"cw-debug-logline",children:c.jsx("span",{children:N})},`${N}-${R}`))})]}):c.jsx("div",{className:"cw-debug-chat",children:o.length===0?c.jsx("div",{className:"cw-debug-chat-empty",children:"输入消息开始验证当前 Agent。"}):o.map((N,R)=>c.jsxs("div",{className:`cw-debug-msg cw-debug-msg-${N.role}`,children:[c.jsx("div",{className:"cw-debug-role",children:N.role==="user"?"你":i||"Agent"}),c.jsx("div",{className:"cw-debug-content",children:N.role==="user"?N.content:N.error?c.jsx(Ap,{message:N.error,className:"cw-debug-msg-error"}):N.blocks&&N.blocks.length>0?c.jsx(mx,{blocks:N.blocks,onAction:()=>{}}):N.content?N.content:R===o.length-1&&n==="sending"?c.jsx(uM,{}):null})]},R))}):c.jsx("div",{className:"cw-debug-empty",children:t})}),c.jsx("div",{className:"cw-debug-composer",children:c.jsxs("div",{className:"cw-debug-composerbox",children:[c.jsx("textarea",{className:"cw-debug-input",rows:1,value:l,placeholder:r?"更新 Agent 后可继续调试":y?"输入测试消息...":"调试环境启动后可输入",disabled:!y||_||r,onChange:N=>h(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),p())}}),c.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!y||_||r||!l.trim(),onClick:p,children:n==="sending"?c.jsx(wt,{className:"cw-i cw-spin"}):c.jsx(xI,{className:"cw-i"})})]})}),(k||T||C)&&c.jsx("div",{className:"cw-debug-overlay",role:"status","aria-live":"polite",children:c.jsxs("div",{className:"cw-debug-overlay-content",children:[c.jsx("strong",{className:"cw-debug-overlay-title",children:T?"正在初始化调试环境":C?"Agent 配置已变更":"启动调试环境"}),T?c.jsx("div",{className:"cw-debug-overlay-progress",children:a.map((N,R)=>c.jsxs("div",{className:"cw-debug-logline",children:[R===a.length-1?c.jsx(wt,{className:"cw-i cw-spin"}):c.jsx(Ds,{className:"cw-i"}),c.jsx("span",{children:N})]},`${N}-${R}`))}):C?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"cw-debug-overlay-copy",children:"当前对话仍在使用上一次配置。更新后,新配置才会生效。"}),c.jsxs("div",{className:"cw-debug-overlay-actions",children:[c.jsx("button",{type:"button",className:"cw-debug-ignore",disabled:_,onClick:b,children:"忽略"}),c.jsxs("button",{type:"button",className:"cw-debug-start",disabled:_,onClick:m,children:[c.jsx(SE,{className:"cw-i"}),"更新 Agent"]})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"cw-debug-overlay-copy",children:"启动后会生成代码并创建临时运行环境。"}),c.jsxs("button",{type:"button",className:"cw-debug-start",onClick:m,children:[c.jsx(Vte,{className:"cw-i cw-debug-run-icon"}),"启动调试环境"]})]})]})})]})]})}function sne({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:r,features:s,onDeploymentTaskChange:i}){var Pn,tr,zn,Sn,st,An,jt,Qt,Cn,jn,xn;const[a,o]=v.useState(()=>r??Gi()),[l,u]=v.useState(!1),[d,f]=v.useState(0),[h,p]=v.useState(null),[m,b]=v.useState(!1),[w,g]=v.useState("cn-beijing"),E=(s==null?void 0:s.generatedAgentTestRun)===!0,y=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[_,k]=v.useState("idle"),[T,C]=v.useState(null),N=v.useRef(null),[R,I]=v.useState(null),[M,B]=v.useState(""),[Y,P]=v.useState([]),[U,A]=v.useState([]),[L,O]=v.useState(""),[j,S]=v.useState(null),[H,V]=v.useState(""),[D,ne]=v.useState(""),[J,re]=v.useState("basic"),[de,G]=v.useState(""),[W,ae]=v.useState(!1),[he,Z]=v.useState(!1),[ce,Ce]=v.useState(!1),[Ee,ge]=v.useState([]),Me=v.useRef(null),ve=v.useRef({});v.useEffect(()=>()=>{const te=N.current;te&&r1(te.runId).catch(Ne=>console.warn("清理调试运行失败",Ne))},[]);const $e=v.useRef(null);$e.current||($e.current=({meta:te,children:Ne})=>c.jsxs("section",{ref:Ie=>{ve.current[te.id]=Ie},id:`cw-sec-${te.id}`,"data-step-id":te.id,className:"cw-section",children:[c.jsx("header",{className:"cw-sec-head",children:c.jsxs("h2",{className:"cw-sec-title",children:[te.label,te.required&&c.jsx("span",{className:"cw-sec-required",children:"必填"})]})}),Ne]}));const Re=Xte(a,Ee)?Ee:[],oe=Eh(a,Re),_t=Re.length===0,we=`cw-model-advanced-${Re.join("-")||"root"}`,Tt=`cw-more-tool-types-${Re.join("-")||"root"}`,ct=`cw-advanced-config-${Re.join("-")||"root"}`,K=Math.max(0,Lf.findIndex(te=>te.id===(oe.agentType??"llm"))),X=te=>o(Ne=>Cd(Ne,Re,Ie=>({...Ie,...te}))),le=(te,Ne)=>o(Ie=>{var je;return{...Ie,deployment:{...Ie.deployment??{feishuEnabled:!1},envValues:{...((je=Ie.deployment)==null?void 0:je.envValues)??{},[te]:Ne}}}}),ke=te=>X({a2aRegistry:{...oe.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...te}}),Oe=(te,Ne)=>{if(!(te in cN))return;const Ie=cN[te];ke({[Ie]:Ne}),le(te,Ne)},ut=te=>{if(!(_t&&te==="a2a")){if(te==="a2a"){X({agentType:te,a2aRegistry:{...oe.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}X({agentType:te,a2aRegistry:oe.a2aRegistry?{...oe.a2aRegistry,enabled:!1}:void 0})}},We=(te,Ne)=>{o(te),Ne&&ge(Ne)},ot=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(o(Gi()),ge([]),u(!1),Ce(!1))},Xt=oe.builtinTools??[],It=oe.mcpTools??[],Ge=oe.tracingExporters??[],bt=oe.selectedSkills??[],$t=[oe.memory.shortTerm,oe.memory.longTerm,oe.tracing].filter(Boolean).length,Tn=te=>X({builtinTools:Xt.includes(te)?Xt.filter(Ne=>Ne!==te):[...Xt,te]}),Ue=te=>{const Ne=Ge.includes(te)?Ge.filter(Ie=>Ie!==te):[...Ge,te];X({tracingExporters:Ne,tracing:Ne.length>0?!0:oe.tracing})},rt=i3(oe.agentType),tt=Ad(oe.agentType),gt=v.useMemo(()=>u3(a),[a]),ue=tt?null:tl(oe.name)??(gt.has(oe.name)?"Agent 名称在当前结构中必须唯一":null),Le=ue!==null,Qe=!tt&&oe.description.trim().length===0,on=oe.instruction.trim().length===0,ln=tt&&!((Pn=oe.a2aRegistry)!=null&&Pn.registrySpaceId.trim()),ie=te=>l&&te?`is-error cw-error-shake-${d%2}`:"",_e=v.useMemo(()=>b3(a,gt),[a,gt]),ye=_e.length===0,Pe=v.useMemo(()=>fN(a),[a]),He=v.useMemo(()=>nne(a),[a]),qe=!!(T&&H&&H!==Pe&&D!==Pe);v.useEffect(()=>{D&&D!==Pe&&ne("")},[Pe,D]);const yt=v.useMemo(()=>{var te,Ne,Ie,je;return{type:!0,basic:tt?!ln:!Le&&(rt||!on),model:!!((te=oe.modelName)!=null&&te.trim()||(Ne=oe.modelProvider)!=null&&Ne.trim()||(Ie=oe.modelApiBase)!=null&&Ie.trim()),tools:Xt.length>0||It.length>0,skills:bt.length>0,knowledge:oe.knowledgebase,advanced:oe.memory.shortTerm||oe.memory.longTerm||oe.tracing,subagents:(((je=oe.subAgents)==null?void 0:je.length)??0)>0,review:ye}},[oe,Le,on,rt,tt,ye,Xt,It,bt]),Ot=rt||tt?["basic"]:["basic","model","tools","skills","knowledge",..._t?["advanced"]:[]],mn=lN.filter(te=>Ot.includes(te.id)),gn=Ot.join("|"),Ht=Re.join("."),kn=mn.findIndex(te=>te.id===J),Jn=te=>{var Ne;(Ne=ve.current[te])==null||Ne.scrollIntoView({behavior:"smooth",block:"start"})};v.useEffect(()=>{if(h)return;const te=Me.current;if(!te)return;const Ne=gn.split("|");let Ie=0;const je=()=>{Ie=0;const ht=Ne[Ne.length-1];let Zt=Ne[0];if(te.scrollTop+te.clientHeight>=te.scrollHeight-2)Zt=ht;else{const xt=te.getBoundingClientRect().top+24;for(const In of Ne){const kt=ve.current[In];if(!kt||kt.getBoundingClientRect().top>xt)break;Zt=In}}Zt&&re(xt=>xt===Zt?xt:Zt)},Et=()=>{Ie||(Ie=window.requestAnimationFrame(je))};return je(),te.addEventListener("scroll",Et,{passive:!0}),window.addEventListener("resize",Et),()=>{te.removeEventListener("scroll",Et),window.removeEventListener("resize",Et),Ie&&window.cancelAnimationFrame(Ie)}},[h,gn,Ht]);const wr=()=>ye?!0:(u(!0),f(te=>te+1),_e[0]&&(ge(_e[0].path),window.requestAnimationFrame(()=>Jn("basic"))),!1),Dn=async()=>{const te=N.current;if(N.current=null,C(null),I(null),V(""),ne(""),te)try{await r1(te.runId)}catch(Ne){console.warn("清理调试运行失败",Ne)}},Hn=async()=>{if(G(""),!!wr()){b(!0);try{const te=await up(xh(a));await Dn(),k("idle"),B(""),P([]),A([]),O(""),S(null),p(te)}catch(te){G(`打开部署页失败:${te instanceof Error?te.message:String(te)}`)}finally{b(!1)}}},er=async()=>{if(!E||m||!wr())return;const te=fN(a);ne(""),S(null),A([]),O(""),P([]),k("building");try{await Dn();const Ne=[],Ie=ht=>{Ne.push(ht),P([...Ne])};Ie("提交 Agent 配置"),k("starting"),Ie("初始化调试环境");const je=await nR(xh(a));N.current=je,C(je),B(je.appName),Ie("创建调试会话");const Et=await rR(je.runId,"test_user");I(Et),V(te),Ie("调试环境就绪"),k("ready")}catch(Ne){S(Ne instanceof Error?Ne.message:String(Ne)),k("error")}},vr=async()=>{const te=N.current,Ne=R,Ie=L.trim();if(!(!te||!Ne||!Ie||_==="sending")){O(""),k("sending"),A(je=>[...je,{role:"user",content:Ie},{role:"assistant",content:"",blocks:[]}]);try{let je=qs(),Et="";for await(const ht of sR({runId:te.runId,userId:"test_user",sessionId:Ne,text:Ie})){const Zt=ht.error||ht.errorMessage||ht.error_message;if(Zt){A(xt=>{const In=[...xt],kt=In[In.length-1];return(kt==null?void 0:kt.role)==="assistant"&&(kt.error=String(Zt)),In});break}je=pl(je,ht),Et=je.blocks.filter(xt=>xt.kind==="text").map(xt=>xt.text).join(""),A(xt=>{const In=[...xt],kt=In[In.length-1];return(kt==null?void 0:kt.role)==="assistant"&&(kt.content=Et,kt.blocks=je.blocks),In})}k("ready")}catch(je){A(Et=>{const ht=[...Et],Zt=ht[ht.length-1];return(Zt==null?void 0:Zt.role)==="assistant"&&(Zt.error=je instanceof Error?je.message:String(je)),ht}),k("ready")}}};if(h){const te=async(Ne,Ie,je)=>{var Zt;const Et=(Zt=a.deployment)==null?void 0:Zt.network,ht=Et&&Et.mode&&Et.mode!=="public"?{mode:Et.mode,vpc_id:Et.vpcId,subnet_ids:Et.subnetIds,enable_shared_internet_access:Et.enableSharedInternetAccess}:void 0;return LE(Ne.name,Ne.files,{region:w,projectName:"default",network:ht},{...je,onStage:Ie})};return c.jsx("div",{className:"cw-root cw-root-preview",children:c.jsx("div",{className:"cw-preview-body",children:c.jsx(Mx,{project:h,agentDraft:a,agentName:a.name||"未命名 Agent",agentCount:E3(a),onChange:p,onDeploy:te,onAgentAdded:n,onDeploymentTaskChange:i,feishuEnabled:!!((tr=a.deployment)!=null&&tr.feishuEnabled),onFeishuEnabledChange:async Ne=>{const Ie={...a,deployment:{...a.deployment??{feishuEnabled:!1},feishuEnabled:Ne}},je=await up(xh(Ie));o(Ie),p(je)},deploymentEnv:He.specs,deploymentEnvValues:{...(zn=a.deployment)==null?void 0:zn.envValues,...He.fixedValues},onDeploymentEnvChange:le,network:(Sn=a.deployment)==null?void 0:Sn.network,onNetworkChange:Ne=>o(Ie=>({...Ie,deployment:{...Ie.deployment??{feishuEnabled:!1},network:Ne}})),deployRegion:w,onDeployRegionChange:g,onBack:()=>p(null),onExportYaml:()=>$te(`${a.name||"agent"}.yaml`,Kee(a),"text/yaml")})})})}const zt=$e.current,Nn=te=>lN.find(Ne=>Ne.id===te);return c.jsx("div",{className:"cw-root",children:c.jsxs("div",{className:"cw-editor",children:[c.jsxs("aside",{className:"cw-tree","aria-label":"Agent 结构",children:[c.jsx("div",{className:"cw-tree-head",children:"Agent 结构"}),c.jsx(x3,{root:a,path:[],selectedPath:Re,duplicateNames:gt,showErrors:l,validationPulse:d,onSelect:ge,onChange:We,onClearRoot:ot})]}),c.jsxs("div",{className:"cw-detail",children:[c.jsx("div",{className:"cw-typebar",children:c.jsx("div",{className:"cw-typebar-inner",children:c.jsxs("div",{className:"cw-typeradio cw-typeradio--row",role:"radiogroup","aria-label":"Agent 类型",style:{"--cw-agent-type-gap":`${x0}px`,"--cw-agent-type-slider-width":`calc((100% - ${8+x0*(Lf.length-1)}px) / ${Lf.length})`,"--cw-active-type-offset":`calc(${K*100}% + ${K*x0}px)`},children:[c.jsx("span",{className:"cw-typeradio-slider","aria-hidden":!0}),Lf.map(te=>{const Ne=(oe.agentType??"llm")===te.id,Ie=_t&&te.id==="a2a",je=Ie?"cw-remote-agent-disabled-hint":void 0;return c.jsxs("label",{className:`cw-typeradio-item ${Ne?"is-on":""} ${Ie?"is-disabled":""}`,title:Ie?void 0:te.desc,tabIndex:Ie?0:void 0,"aria-describedby":je,children:[c.jsx("input",{type:"radio",name:"agentType",className:"cw-typeradio-input",checked:Ne,disabled:Ie,onChange:()=>ut(te.id)}),c.jsxs("span",{className:"cw-typeradio-title",children:[Kte[te.id].replace("智能体",""),c.jsx("wbr",{}),"智能体"]}),Ie&&c.jsx("span",{id:je,className:"cw-typeradio-disabled-hint",role:"tooltip",children:"远程 Agent 仅可作为子 Agent"})]},te.id)})]})})}),c.jsx("div",{className:"cw-detail-scroll",ref:Me,children:c.jsx("div",{className:"cw-detail-inner",children:c.jsxs("div",{className:"cw-lower",children:[c.jsxs("div",{className:"cw-form-col",children:[c.jsx(zt,{meta:Nn("basic"),children:c.jsxs("div",{className:"cw-form",children:[!tt&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cw-field",children:[c.jsxs("label",{className:"cw-label",children:["Agent 名称",c.jsx("span",{className:"cw-req",children:"*"})]}),c.jsx("input",{className:`cw-input ${ie(Le)}`,value:oe.name,placeholder:"customer_service",onChange:te=>X({name:te.target.value})}),l&&ue?c.jsx("span",{className:"cw-error-text",children:ue}):c.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在 Agent 结构中保持唯一。"})]}),c.jsxs("div",{className:"cw-field",children:[c.jsxs("label",{className:"cw-label",children:["描述",c.jsx("span",{className:"cw-req",children:"*"})]}),c.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${ie(Qe)}`,value:oe.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:te=>X({description:te.target.value})}),l&&Qe?c.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):c.jsx("span",{className:"cw-help",children:"描述会显示在 Agent 列表与选择器中。"})]})]}),rt?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"cw-section-desc",children:"编排型 Agent 只负责调度子 Agent,不需要模型或系统提示词。请在左侧 「Agent 结构」中为它添加、排序子 Agent。"}),oe.agentType==="loop"&&c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"最大轮次"}),c.jsx("input",{className:"cw-input",type:"number",min:1,value:oe.maxIterations??3,onChange:te=>X({maxIterations:Math.max(1,Number(te.target.value)||1)})}),c.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):tt?c.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[c.jsxs("div",{className:"cw-remote-center-head",children:[c.jsx("div",{className:"cw-label",children:"AgentKit 智能体中心"}),c.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),c.jsx(bc,{env:XM,values:p3(oe.a2aRegistry,{includeDefaults:!1}),onChange:Oe}),l&&ln&&c.jsx("span",{className:"cw-error-text",children:"AgentKit 智能体中心 ID 为必填项"})]}):c.jsxs("div",{className:"cw-field",children:[c.jsxs("label",{className:"cw-label",children:["系统提示词",c.jsx("span",{className:"cw-req",children:"*"})]}),c.jsx(v.Suspense,{fallback:c.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:c.jsx(Ute,{value:oe.instruction,invalid:on,onChange:te=>X({instruction:te})})}),l&&on?c.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):c.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!rt&&!tt&&c.jsxs(c.Fragment,{children:[c.jsx(zt,{meta:Nn("model"),children:c.jsxs("div",{className:"cw-form",children:[c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"模型名称"}),c.jsx("input",{className:"cw-input",value:oe.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:te=>X({modelName:te.target.value})})]}),c.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":W,"aria-controls":we,onClick:()=>ae(te=>!te),children:[c.jsx("span",{children:"更多选项"}),c.jsx(or,{className:`cw-more-options-chevron ${W?"is-open":""}`,"aria-hidden":!0})]}),c.jsx($i,{initial:!1,children:W&&c.jsxs(Wt.div,{id:we,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"服务商 Provider"}),c.jsx("input",{className:"cw-input",value:oe.modelProvider??"",placeholder:"openai",onChange:te=>X({modelProvider:te.target.value})})]}),c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"API Base"}),c.jsx("input",{className:"cw-input",value:oe.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:te=>X({modelApiBase:te.target.value})}),c.jsx("span",{className:"cw-help",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),c.jsx(zt,{meta:Nn("tools"),children:c.jsxs("div",{className:"cw-form",children:[c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"内置工具"}),c.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),c.jsx("div",{className:"cw-tools-list-shell",children:c.jsx(uN,{items:Ox,selected:Xt,onToggle:Tn,scrollRows:6})})]}),c.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":he,"aria-controls":Tt,onClick:()=>Z(te=>!te),children:[c.jsx("span",{children:"更多类型工具"}),It.length>0&&c.jsxs("span",{className:"cw-more-options-count",children:["已配置 ",It.length]}),c.jsx(or,{className:`cw-more-options-chevron ${he?"is-open":""}`,"aria-hidden":!0})]}),c.jsx($i,{initial:!1,children:he&&c.jsx(Wt.div,{id:Tt,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:c.jsxs("div",{className:"cw-field",children:[c.jsx("label",{className:"cw-label",children:"MCP 工具"}),c.jsx("span",{className:"cw-help",children:"连接外部 MCP 服务,生成时会为每个条目创建对应的 MCPToolset。"}),c.jsx(Wte,{tools:It,onChange:te=>X({mcpTools:te})})]})})})]})}),c.jsx(zt,{meta:Nn("skills"),children:c.jsx("div",{className:"cw-form",children:c.jsx(Gte,{selected:bt,onChange:te=>X({selectedSkills:te})})})}),c.jsx(zt,{meta:Nn("knowledge"),children:c.jsxs("div",{className:"cw-form cw-toggle-stack",children:[c.jsx(Ec,{checked:oe.knowledgebase,onChange:te=>X({knowledgebase:te}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:ah}),oe.knowledgebase&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"知识库后端"}),c.jsx(w0,{options:Np,value:oe.knowledgebaseBackend,onChange:te=>X({knowledgebaseBackend:te})}),c.jsx(bc,{env:((st=Np.find(te=>te.id===(oe.knowledgebaseBackend??"local")))==null?void 0:st.env)??[],values:((An=a.deployment)==null?void 0:An.envValues)??{},onChange:le})]})]})}),_t&&c.jsxs("section",{ref:te=>{ve.current.advanced=te},id:"cw-sec-advanced","data-step-id":"advanced",className:"cw-section cw-advanced-section",children:[c.jsxs("button",{type:"button",className:"cw-advanced-disclosure","aria-expanded":ce,"aria-controls":ct,onClick:()=>Ce(te=>!te),children:[c.jsx("span",{className:"cw-advanced-disclosure-title",children:"进阶配置"}),c.jsx(or,{className:`cw-advanced-disclosure-chevron ${ce?"is-open":""}`,"aria-hidden":!0}),$t>0&&c.jsxs("span",{className:"cw-more-options-count",children:["已启用 ",$t]})]}),c.jsx($i,{initial:!1,children:ce&&c.jsxs(Wt.div,{id:ct,className:"cw-advanced-content",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},children:[c.jsxs("div",{className:"cw-advanced-group",children:[c.jsx("div",{className:"cw-advanced-group-head",children:c.jsx("span",{children:"记忆"})}),c.jsxs("div",{className:"cw-form cw-toggle-stack",children:[c.jsx(Ec,{checked:oe.memory.shortTerm,onChange:te=>X({memory:{...oe.memory,shortTerm:te}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:RI}),oe.memory.shortTerm&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"短期记忆后端"}),c.jsx(w0,{options:Tp,value:oe.shortTermBackend,onChange:te=>X({shortTermBackend:te})}),c.jsx(bc,{env:((jt=Tp.find(te=>te.id===(oe.shortTermBackend??"local")))==null?void 0:jt.env)??[],values:((Qt=a.deployment)==null?void 0:Qt.envValues)??{},onChange:le})]}),c.jsx(Ec,{checked:oe.memory.longTerm,onChange:te=>X({memory:{...oe.memory,longTerm:te}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:ah}),oe.memory.longTerm&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"长期记忆后端"}),c.jsx(w0,{options:kp,value:oe.longTermBackend,onChange:te=>X({longTermBackend:te})}),c.jsx(bc,{env:((Cn=kp.find(te=>te.id===(oe.longTermBackend??"local")))==null?void 0:Cn.env)??[],values:((jn=a.deployment)==null?void 0:jn.envValues)??{},onChange:le}),c.jsx(Ec,{checked:!!oe.autoSaveSession,onChange:te=>X({autoSaveSession:te}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:ah})]})]})]}),c.jsxs("div",{className:"cw-advanced-group",children:[c.jsx("div",{className:"cw-advanced-group-head",children:c.jsx("span",{children:"观测"})}),c.jsxs("div",{className:"cw-form cw-toggle-stack",children:[c.jsx(Ec,{checked:oe.tracing,onChange:te=>X({tracing:te}),title:"观测 / Tracing",desc:"记录每一步的调用链路与耗时,便于调试与性能分析。",icon:kI}),oe.tracing&&c.jsxs("div",{className:"cw-field cw-subfield",children:[c.jsx("label",{className:"cw-label",children:"Tracing 导出器"}),c.jsx("span",{className:"cw-help",children:"选择一个或多个观测平台,生成时会写入对应的 ENABLE_* 开关与环境变量。"}),c.jsx(uN,{items:Sp,selected:Ge,onToggle:Ue}),c.jsx(bc,{env:Sp.filter(te=>Ge.includes(te.id)).flatMap(te=>te.env),values:((xn=a.deployment)==null?void 0:xn.envValues)??{},onChange:le})]})]})]})]})})]})]})]}),c.jsx("nav",{className:"cw-rail","aria-label":"步骤导航",children:c.jsxs("ol",{className:"cw-steps",children:[c.jsx("div",{className:"cw-rail-track","aria-hidden":!0,children:c.jsx(Wt.div,{className:"cw-rail-fill",animate:{height:`${Math.max(kn,0)/Math.max(mn.length-1,1)*100}%`},transition:{type:"spring",stiffness:260,damping:32}})}),mn.map(te=>{const Ne=te.id===J,Ie=yt[te.id];return c.jsx("li",{children:c.jsxs("button",{type:"button",className:`cw-step ${Ne?"is-active":""} ${Ie?"is-done":""}`,onClick:()=>Jn(te.id),"aria-current":Ne?"step":void 0,"aria-label":te.label,children:[c.jsx("span",{className:"cw-step-marker","aria-hidden":!0,children:Ne?c.jsx("span",{className:"cw-dot"}):Ie?c.jsx(Ds,{className:"cw-step-check"}):c.jsx("span",{className:"cw-dot"})}),c.jsx("span",{className:"cw-step-tooltip","aria-hidden":!0,children:te.label})]})},te.id)})]})})]})})})]}),c.jsx(rne,{enabled:E,disabledReason:y,phase:_,stale:qe,run:T,projectName:M||a.name,logs:Y,messages:U,input:L,error:j,deploying:m,deployError:de,onInput:O,onSend:vr,onRestart:er,onIgnoreChanges:()=>ne(Pe),onDeploy:Hn})]})})}function Fs(e){return{...Gi(),...e}}const ine=[{id:"support",icon:EF,draft:Fs({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:iF,draft:Fs({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:xF,draft:Fs({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:vE,draft:Fs({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:AF,draft:Fs({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:FF,draft:Fs({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[Fs({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),Fs({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),Fs({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function ane(e){const t=[];return e.tools.length&&t.push({icon:CE,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:sF,label:"记忆"}),e.knowledgebase&&t.push({icon:rF,label:"知识库"}),e.tracing&&t.push({icon:tF,label:"观测"}),e.subAgents.length&&t.push({icon:LI,label:`子Agent ${e.subAgents.length}`}),t}function one({onBack:e,onCreate:t}){const[n,r]=v.useState(null);return c.jsx("div",{className:"tpl-root",children:n?c.jsx(cne,{template:n,onBack:()=>r(null),onCreate:t}):c.jsx(lne,{onPick:r})})}function lne({onPick:e}){return c.jsxs("div",{className:"tpl-scroll",children:[c.jsxs("div",{className:"tpl-head",children:[c.jsx("h1",{className:"tpl-title",children:"从模板新建"}),c.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),c.jsx("div",{className:"tpl-grid",children:ine.map((t,n)=>c.jsxs(Wt.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[c.jsx("span",{className:"tpl-card-icon",children:c.jsx(t.icon,{className:"icon"})}),c.jsx("span",{className:"tpl-card-name",children:t.draft.name}),c.jsx("span",{className:"tpl-card-desc",children:Qr(t.draft.description)})]},t.id))})]})}function cne({template:e,onBack:t,onCreate:n}){const[r,s]=v.useState(e.draft.name),i=e.icon,a=ane(e.draft);function o(){const l=r.trim()||e.draft.name;n({...e.draft,name:l})}return c.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[c.jsxs("button",{className:"tpl-back",onClick:t,children:[c.jsx(bI,{className:"icon"})," 返回模板列表"]}),c.jsxs(Wt.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[c.jsxs("div",{className:"tpl-detail-head",children:[c.jsx("span",{className:"tpl-detail-icon",children:c.jsx(i,{className:"icon"})}),c.jsxs("div",{className:"tpl-detail-headtext",children:[c.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),c.jsx("div",{className:"tpl-detail-desc",children:Qr(e.draft.description)})]})]}),a.length>0&&c.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(l=>c.jsxs("span",{className:"tpl-tag",children:[c.jsx(l.icon,{className:"tpl-tag-icon"})," ",l.label]},l.label))}),c.jsxs("label",{className:"tpl-field",children:[c.jsx("span",{className:"tpl-field-label",children:"名称"}),c.jsx("input",{className:"tpl-input",value:r,onChange:l=>s(l.target.value),placeholder:e.draft.name})]}),c.jsxs("div",{className:"tpl-field",children:[c.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),c.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),c.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"模型"}),c.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"工具"}),c.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"记忆"}),c.jsx("span",{className:"tpl-meta-val",children:une(e.draft)})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"知识库"}),c.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),c.jsxs("div",{className:"tpl-meta",children:[c.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),c.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&c.jsxs("div",{className:"tpl-field",children:[c.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),c.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((l,u)=>c.jsxs("div",{className:"tpl-subagent",children:[c.jsxs("div",{className:"tpl-subagent-top",children:[c.jsx("span",{className:"tpl-subagent-name",children:l.name}),l.tools.length>0&&c.jsx("span",{className:"tpl-subagent-tools",children:l.tools.join("、")})]}),c.jsx("div",{className:"tpl-subagent-desc",children:Qr(l.description)})]},u))})]}),c.jsxs("button",{className:"tpl-create",onClick:o,children:["使用此模板创建 ",c.jsx(or,{className:"icon"})]})]})]})}function une(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}function En(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function Lm(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}wh.prototype=Lm.prototype={constructor:wh,on:function(e,t){var n=this._,r=fne(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),pN.hasOwnProperty(t)?{space:pN[t],local:e}:e}function pne(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===M1&&t.documentElement.namespaceURI===M1?t.createElement(e):t.createElementNS(n,e)}}function mne(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function w3(e){var t=Mm(e);return(t.local?mne:pne)(t)}function gne(){}function Dx(e){return e==null?gne:function(){return this.querySelector(e)}}function yne(e){typeof e!="function"&&(e=Dx(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=y&&(y=E+1);!(k=w[y])&&++y=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Hne(e){e||(e=zne);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;it?1:e>=t?0:NaN}function Vne(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Kne(){return Array.from(this)}function Yne(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?rre:typeof t=="function"?ire:sre)(e,t,n??"")):_l(this.node(),e)}function _l(e,t){return e.style.getPropertyValue(t)||N3(e).getComputedStyle(e,null).getPropertyValue(t)}function ore(e){return function(){delete this[e]}}function lre(e,t){return function(){this[e]=t}}function cre(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ure(e,t){return arguments.length>1?this.each((t==null?ore:typeof t=="function"?cre:lre)(e,t)):this.node()[e]}function S3(e){return e.trim().split(/^|\s+/)}function Px(e){return e.classList||new A3(e)}function A3(e){this._node=e,this._names=S3(e.getAttribute("class")||"")}A3.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function C3(e,t){for(var n=Px(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Bre(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n()=>e;function D1(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}D1.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function qre(e){return!e.ctrlKey&&!e.button}function Gre(){return this.parentNode}function Xre(e,t){return t??{x:e.x,y:e.y}}function Qre(){return navigator.maxTouchPoints||"ontouchstart"in this}function D3(){var e=qre,t=Gre,n=Xre,r=Qre,s={},i=Lm("start","drag","end"),a=0,o,l,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",w).on("touchmove.drag",g,Wre).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,k){if(!(d||!e.call(this,_,k))){var T=y(this,t.call(this,_,k),_,k,"mouse");T&&(Sr(_.view).on("mousemove.drag",m,zu).on("mouseup.drag",b,zu),L3(_.view),T0(_),u=!1,o=_.clientX,l=_.clientY,T("start",_))}}function m(_){if(nl(_),!u){var k=_.clientX-o,T=_.clientY-l;u=k*k+T*T>f}s.mouse("drag",_)}function b(_){Sr(_.view).on("mousemove.drag mouseup.drag",null),M3(_.view,u),nl(_),s.mouse("end",_)}function w(_,k){if(e.call(this,_,k)){var T=_.changedTouches,C=t.call(this,_,k),N=T.length,R,I;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Jre.exec(e))?new mr(t[1],t[2],t[3],1):(t=ese.exec(e))?new mr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tse.exec(e))?Pf(t[1],t[2],t[3],t[4]):(t=nse.exec(e))?Pf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=rse.exec(e))?wN(t[1],t[2]/100,t[3]/100,1):(t=sse.exec(e))?wN(t[1],t[2]/100,t[3]/100,t[4]):mN.hasOwnProperty(e)?bN(mN[e]):e==="transparent"?new mr(NaN,NaN,NaN,0):null}function bN(e){return new mr(e>>16&255,e>>8&255,e&255,1)}function Pf(e,t,n,r){return r<=0&&(e=t=n=NaN),new mr(e,t,n,r)}function ose(e){return e instanceof Rd||(e=Ya(e)),e?(e=e.rgb(),new mr(e.r,e.g,e.b,e.opacity)):new mr}function P1(e,t,n,r){return arguments.length===1?ose(e):new mr(e,t,n,r??1)}function mr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}jx(mr,P1,P3(Rd,{brighter(e){return e=e==null?Ip:Math.pow(Ip,e),new mr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Vu:Math.pow(Vu,e),new mr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mr(La(this.r),La(this.g),La(this.b),Rp(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:EN,formatHex:EN,formatHex8:lse,formatRgb:xN,toString:xN}));function EN(){return`#${Na(this.r)}${Na(this.g)}${Na(this.b)}`}function lse(){return`#${Na(this.r)}${Na(this.g)}${Na(this.b)}${Na((isNaN(this.opacity)?1:this.opacity)*255)}`}function xN(){const e=Rp(this.opacity);return`${e===1?"rgb(":"rgba("}${La(this.r)}, ${La(this.g)}, ${La(this.b)}${e===1?")":`, ${e})`}`}function Rp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function La(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Na(e){return e=La(e),(e<16?"0":"")+e.toString(16)}function wN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new as(e,t,n,r)}function j3(e){if(e instanceof as)return new as(e.h,e.s,e.l,e.opacity);if(e instanceof Rd||(e=Ya(e)),!e)return new as;if(e instanceof as)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,o=i-s,l=(i+s)/2;return o?(t===i?a=(n-r)/o+(n0&&l<1?0:a,new as(a,o,l,e.opacity)}function cse(e,t,n,r){return arguments.length===1?j3(e):new as(e,t,n,r??1)}function as(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}jx(as,cse,P3(Rd,{brighter(e){return e=e==null?Ip:Math.pow(Ip,e),new as(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Vu:Math.pow(Vu,e),new as(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new mr(k0(e>=240?e-240:e+120,s,r),k0(e,s,r),k0(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new as(vN(this.h),jf(this.s),jf(this.l),Rp(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Rp(this.opacity);return`${e===1?"hsl(":"hsla("}${vN(this.h)}, ${jf(this.s)*100}%, ${jf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vN(e){return e=(e||0)%360,e<0?e+360:e}function jf(e){return Math.max(0,Math.min(1,e||0))}function k0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Bx=e=>()=>e;function use(e,t){return function(n){return e+n*t}}function dse(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function fse(e){return(e=+e)==1?B3:function(t,n){return n-t?dse(t,n,e):Bx(isNaN(t)?n:t)}}function B3(e,t){var n=t-e;return n?use(e,n):Bx(isNaN(e)?t:e)}const Op=function e(t){var n=fse(t);function r(s,i){var a=n((s=P1(s)).r,(i=P1(i)).r),o=n(s.g,i.g),l=n(s.b,i.b),u=B3(s.opacity,i.opacity);return function(d){return s.r=a(d),s.g=o(d),s.b=l(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function hse(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:Ns(r,s)})),n=N0.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Ns(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function o(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Ns(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function l(u,d,f,h,p,m){if(u!==f||d!==h){var b=p.push(s(p)+"scale(",null,",",null,")");m.push({i:b-4,x:Ns(u,f)},{i:b-2,x:Ns(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),l(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,b=h.length,w;++m=0&&e._call.call(void 0,t),e=e._next;--Tl}function kN(){Wa=(Mp=Yu.now())+Dm,Tl=Oc=0;try{Ase()}finally{Tl=0,Ise(),Wa=0}}function Cse(){var e=Yu.now(),t=e-Mp;t>H3&&(Dm-=t,Mp=e)}function Ise(){for(var e,t=Lp,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Lp=n);Lc=e,F1(r)}function F1(e){if(!Tl){Oc&&(Oc=clearTimeout(Oc));var t=e-Wa;t>24?(e<1/0&&(Oc=setTimeout(kN,e-Yu.now()-Dm)),xc&&(xc=clearInterval(xc))):(xc||(Mp=Yu.now(),xc=setInterval(Cse,H3)),Tl=1,z3(kN))}}function NN(e,t,n){var r=new Dp;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Rse=Lm("start","end","cancel","interrupt"),Ose=[],K3=0,SN=1,U1=2,_h=3,AN=4,$1=5,Th=6;function Pm(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Lse(e,n,{name:t,index:r,group:s,on:Rse,tween:Ose,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:K3})}function Ux(e,t){var n=bs(e,t);if(n.state>K3)throw new Error("too late; already scheduled");return n}function Bs(e,t){var n=bs(e,t);if(n.state>_h)throw new Error("too late; already running");return n}function bs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Lse(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=V3(i,0,n.time);function i(u){n.state=SN,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==SN)return l();for(d in r)if(p=r[d],p.name===n.name){if(p.state===_h)return NN(a);p.state===AN?(p.state=Th,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dU1&&r.state<$1,r.state=Th,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function Mse(e){return this.each(function(){kh(this,e)})}function Dse(e,t){var n,r;return function(){var s=Bs(this,e),i=s.tween;if(i!==n){r=n=i;for(var a=0,o=r.length;a=0&&(t=t.slice(0,n)),!t||t==="start"})}function cie(e,t,n){var r,s,i=lie(t)?Ux:Bs;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(t,n),a.on=s}}function uie(e,t){var n=this._id;return arguments.length<2?bs(this.node(),n).on.on(e):this.each(cie(n,e,t))}function die(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function fie(){return this.on("end.remove",die(this._id))}function hie(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Dx(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function Bie(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Qs(e,t,n){this.k=e,this.x=t,this.y=n}Qs.prototype={constructor:Qs,scale:function(e){return e===1?this:new Qs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Qs(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var jm=new Qs(1,0,0);G3.prototype=Qs.prototype;function G3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return jm;return e.__zoom}function S0(e){e.stopImmediatePropagation()}function wc(e){e.preventDefault(),e.stopImmediatePropagation()}function Fie(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Uie(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function CN(){return this.__zoom||jm}function $ie(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Hie(){return navigator.maxTouchPoints||"ontouchstart"in this}function zie(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function X3(){var e=Fie,t=Uie,n=zie,r=$ie,s=Hie,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=vh,u=Lm("start","zoom","end"),d,f,h,p=500,m=150,b=0,w=10;function g(P){P.property("__zoom",CN).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(P,U,A,L){var O=P.selection?P.selection():P;O.property("__zoom",CN),P!==O?k(P,U,A,L):O.interrupt().each(function(){T(this,arguments).event(L).start().zoom(null,typeof U=="function"?U.apply(this,arguments):U).end()})},g.scaleBy=function(P,U,A,L){g.scaleTo(P,function(){var O=this.__zoom.k,j=typeof U=="function"?U.apply(this,arguments):U;return O*j},A,L)},g.scaleTo=function(P,U,A,L){g.transform(P,function(){var O=t.apply(this,arguments),j=this.__zoom,S=A==null?_(O):typeof A=="function"?A.apply(this,arguments):A,H=j.invert(S),V=typeof U=="function"?U.apply(this,arguments):U;return n(y(E(j,V),S,H),O,a)},A,L)},g.translateBy=function(P,U,A,L){g.transform(P,function(){return n(this.__zoom.translate(typeof U=="function"?U.apply(this,arguments):U,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),a)},null,L)},g.translateTo=function(P,U,A,L,O){g.transform(P,function(){var j=t.apply(this,arguments),S=this.__zoom,H=L==null?_(j):typeof L=="function"?L.apply(this,arguments):L;return n(jm.translate(H[0],H[1]).scale(S.k).translate(typeof U=="function"?-U.apply(this,arguments):-U,typeof A=="function"?-A.apply(this,arguments):-A),j,a)},L,O)};function E(P,U){return U=Math.max(i[0],Math.min(i[1],U)),U===P.k?P:new Qs(U,P.x,P.y)}function y(P,U,A){var L=U[0]-A[0]*P.k,O=U[1]-A[1]*P.k;return L===P.x&&O===P.y?P:new Qs(P.k,L,O)}function _(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function k(P,U,A,L){P.on("start.zoom",function(){T(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(L).end()}).tween("zoom",function(){var O=this,j=arguments,S=T(O,j).event(L),H=t.apply(O,j),V=A==null?_(H):typeof A=="function"?A.apply(O,j):A,D=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),ne=O.__zoom,J=typeof U=="function"?U.apply(O,j):U,re=l(ne.invert(V).concat(D/ne.k),J.invert(V).concat(D/J.k));return function(de){if(de===1)de=J;else{var G=re(de),W=D/G[2];de=new Qs(W,V[0]-G[0]*W,V[1]-G[1]*W)}S.zoom(null,de)}})}function T(P,U,A){return!A&&P.__zooming||new C(P,U)}function C(P,U){this.that=P,this.args=U,this.active=0,this.sourceEvent=null,this.extent=t.apply(P,U),this.taps=0}C.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,U){return this.mouse&&P!=="mouse"&&(this.mouse[1]=U.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=U.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=U.invert(this.touch1[0])),this.that.__zoom=U,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var U=Sr(this.that).datum();u.call(P,this.that,new Bie(P,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),U)}};function N(P,...U){if(!e.apply(this,arguments))return;var A=T(this,U).event(P),L=this.__zoom,O=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),j=ss(P);if(A.wheel)(A.mouse[0][0]!==j[0]||A.mouse[0][1]!==j[1])&&(A.mouse[1]=L.invert(A.mouse[0]=j)),clearTimeout(A.wheel);else{if(L.k===O)return;A.mouse=[j,L.invert(j)],kh(this),A.start()}wc(P),A.wheel=setTimeout(S,m),A.zoom("mouse",n(y(E(L,O),A.mouse[0],A.mouse[1]),A.extent,a));function S(){A.wheel=null,A.end()}}function R(P,...U){if(h||!e.apply(this,arguments))return;var A=P.currentTarget,L=T(this,U,!0).event(P),O=Sr(P.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",D,!0),j=ss(P,A),S=P.clientX,H=P.clientY;L3(P.view),S0(P),L.mouse=[j,this.__zoom.invert(j)],kh(this),L.start();function V(ne){if(wc(ne),!L.moved){var J=ne.clientX-S,re=ne.clientY-H;L.moved=J*J+re*re>b}L.event(ne).zoom("mouse",n(y(L.that.__zoom,L.mouse[0]=ss(ne,A),L.mouse[1]),L.extent,a))}function D(ne){O.on("mousemove.zoom mouseup.zoom",null),M3(ne.view,L.moved),wc(ne),L.event(ne).end()}}function I(P,...U){if(e.apply(this,arguments)){var A=this.__zoom,L=ss(P.changedTouches?P.changedTouches[0]:P,this),O=A.invert(L),j=A.k*(P.shiftKey?.5:2),S=n(y(E(A,j),L,O),t.apply(this,U),a);wc(P),o>0?Sr(this).transition().duration(o).call(k,S,L,P):Sr(this).call(g.transform,S,L,P)}}function M(P,...U){if(e.apply(this,arguments)){var A=P.touches,L=A.length,O=T(this,U,P.changedTouches.length===L).event(P),j,S,H,V;for(S0(P),S=0;S`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Wu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Q3=["Enter"," ","Escape"],Z3={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var kl;(function(e){e.Strict="strict",e.Loose="loose"})(kl||(kl={}));var Ma;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ma||(Ma={}));var qu;(function(e){e.Partial="partial",e.Full="full"})(qu||(qu={}));const J3={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ai;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ai||(Ai={}));var Gu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Gu||(Gu={}));var De;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(De||(De={}));const IN={[De.Left]:De.Right,[De.Right]:De.Left,[De.Top]:De.Bottom,[De.Bottom]:De.Top};function eD(e){return e===null?null:e?"valid":"invalid"}const tD=e=>"id"in e&&"source"in e&&"target"in e,Vie=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Hx=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Od=(e,t=[0,0])=>{const{width:n,height:r}=fi(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Kie=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Hx(s)?s:t.nodeLookup.get(s.id));const o=a?Pp(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Bm(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Fm(n)},Ld=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Bm(n,Pp(s)),r=!0)}),r?Fm(n):{x:0,y:0,width:0,height:0}},zx=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const o={...Xl(t,[n,r,s]),width:t.width/s,height:t.height/s},l=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,b=Xu(o,Sl(u)),w=(p??0)*(m??0),g=i&&b>0;(!u.internals.handleBounds||g||b>=w||u.dragging)&&l.push(u)}return l},Yie=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Wie(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function qie({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=Wie(e,a),l=Ld(o),u=Kx(l,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function nD({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:l,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",ps.error005());else{const p=o.measured.width,m=o.measured.height;p&&m&&(f=[[l,u],[l+p,u+m]])}else o&&Ga(a.extent)&&(f=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);const h=Ga(f)?qa(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",ps.error015())),{position:{x:h.x-l+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function Gie({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),m=!p&&h.parentId&&a.find(b=>b.id===h.parentId);(p||m)&&a.push(h)}const o=new Set(t.map(h=>h.id)),l=r.filter(h=>h.deletable!==!1),d=Yie(a,l);for(const h of l)o.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const Nl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),qa=(e={x:0,y:0},t,n)=>({x:Nl(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Nl(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function rD(e,t,n){const{width:r,height:s}=fi(n),{x:i,y:a}=n.internals.positionAbsolute;return qa(e,[[i,a],[i+r,a+s]],t)}const RN=(e,t,n)=>en?-Nl(Math.abs(e-n),1,t)/t:0,Vx=(e,t,n=15,r=40)=>{const s=RN(e.x,r,t.width-r)*n,i=RN(e.y,r,t.height-r)*n;return[s,i]},Bm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),H1=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Fm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Sl=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Hx(e)?e.internals.positionAbsolute:Od(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Pp=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Hx(e)?e.internals.positionAbsolute:Od(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},sD=(e,t)=>Fm(Bm(H1(e),H1(t))),Xu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ON=e=>os(e.width)&&os(e.height)&&os(e.x)&&os(e.y),os=e=>!isNaN(e)&&isFinite(e),iD=(e,t)=>(n,r)=>{},Md=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Xl=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const o={x:(e-n)/s,y:(t-r)/s};return i?Md(o,a):o},Al=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function mo(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Xie(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=mo(e,n),s=mo(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=mo(e.top??e.y??0,n),s=mo(e.bottom??e.y??0,n),i=mo(e.left??e.x??0,t),a=mo(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Qie(e,t,n,r,s,i){const{x:a,y:o}=Al(e,[t,n,r]),{x:l,y:u}=Al({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-l,f=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const Kx=(e,t,n,r,s,i)=>{const a=Xie(i,t,n),o=(t-a.x)/e.width,l=(n-a.y)/e.height,u=Math.min(o,l),d=Nl(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,b=Qie(e,p,m,d,t,n),w={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:p-w.left+w.right,y:m-w.top+w.bottom,zoom:d}},Qu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ga(e){return e!=null&&e!=="parent"}function fi(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function aD(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function oD(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return i}function LN(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Zie(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function Jie(e){return{...Z3,...e||{}}}function ou(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=ls(e),o=Xl({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:l,y:u}=n?Md(o,t):o;return{xSnapped:l,ySnapped:u,...o}}const Yx=e=>({width:e.offsetWidth,height:e.offsetHeight}),lD=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},eae=["INPUT","SELECT","TEXTAREA"];function cD(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:eae.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const uD=e=>"clientX"in e,ls=(e,t)=>{var i,a;const n=uD(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},MN=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Yx(a)}})};function dD({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const l=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+o*.375+r*.125,d=Math.abs(l-e),f=Math.abs(u-t);return[l,u,d,f]}function Uf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function DN({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case De.Left:return[t-Uf(t-r,i),n];case De.Right:return[t+Uf(r-t,i),n];case De.Top:return[t,n-Uf(n-s,i)];case De.Bottom:return[t,n+Uf(s-n,i)]}}function fD({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:r,targetY:s,targetPosition:i=De.Top,curvature:a=.25}){const[o,l]=DN({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=DN({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=dD({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${l} ${u},${d} ${r},${s}`,f,h,p,m]}function hD({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n0}const rae=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,sae=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),iae=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",ps.error006()),t;const r=n.getEdgeId||rae;let s;return tD(e)?s={...e}:s={...e,id:r(e)},sae(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function pD({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,o]=hD({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,o]}const PN={[De.Left]:{x:-1,y:0},[De.Right]:{x:1,y:0},[De.Top]:{x:0,y:-1},[De.Bottom]:{x:0,y:1}},aae=({source:e,sourcePosition:t=De.Bottom,target:n})=>t===De.Left||t===De.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function oae({source:e,sourcePosition:t=De.Bottom,target:n,targetPosition:r=De.Top,center:s,offset:i,stepPosition:a}){const o=PN[t],l=PN[r],u={x:e.x+o.x*i,y:e.y+o.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},f=aae({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],b,w;const g={x:0,y:0},E={x:0,y:0},[,,y,_]=hD({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*l[h]===-1){h==="x"?(b=s.x??u.x+(d.x-u.x)*a,w=s.y??(u.y+d.y)/2):(b=s.x??(u.x+d.x)/2,w=s.y??u.y+(d.y-u.y)*a);const N=[{x:b,y:u.y},{x:b,y:d.y}],R=[{x:u.x,y:w},{x:d.x,y:w}];o[h]===p?m=h==="x"?N:R:m=h==="x"?R:N}else{const N=[{x:u.x,y:d.y}],R=[{x:d.x,y:u.y}];if(h==="x"?m=o.x===p?R:N:m=o.y===p?N:R,t===r){const P=Math.abs(e[h]-n[h]);if(P<=i){const U=Math.min(i-1,i-P);o[h]===p?g[h]=(u[h]>e[h]?-1:1)*U:E[h]=(d[h]>n[h]?-1:1)*U}}if(t!==r){const P=h==="x"?"y":"x",U=o[h]===l[P],A=u[P]>d[P],L=u[P]=Y?(b=(I.x+M.x)/2,w=m[0].y):(b=m[0].x,w=(I.y+M.y)/2)}const k={x:u.x+g.x,y:u.y+g.y},T={x:d.x+E.x,y:d.y+E.y};return[[e,...k.x!==m[0].x||k.y!==m[0].y?[k]:[],...m,...T.x!==m[m.length-1].x||T.y!==m[m.length-1].y?[T]:[],n],b,w,y,_]}function lae(e,t,n,r){const s=Math.min(jN(e,t)/2,jN(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function V1(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function uae(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const u=V1(l,t);i.has(u)||(a.push({id:u,color:l.color||n,...l}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const mD=1e3,dae=10,Wx={nodeOrigin:[0,0],nodeExtent:Wu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},fae={...Wx,checkEquality:!0};function qx(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function hae(e,t,n){const r=qx(Wx,n);for(const s of e.values())if(s.parentId)Xx(s,e,t,r);else{const i=Od(s,r.nodeOrigin),a=Ga(s.extent)?s.extent:r.nodeExtent,o=qa(i,a,fi(s));s.internals.positionAbsolute=o}}function pae(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Gx(e){return e==="manual"}function K1(e,t,n,r={}){var d,f;const s=qx(fae,r),i={i:0},a=new Map(t),o=s!=null&&s.elevateNodesOnSelect&&!Gx(s.zIndexMode)?mD:0;let l=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=Od(h,s.nodeOrigin),b=Ga(h.extent)?h.extent:s.nodeExtent,w=qa(m,b,fi(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:pae(h,p),z:gD(h,o,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(l=!1),h.parentId&&Xx(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:u}}function mae(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Xx(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:l}=qx(Wx,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}mae(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*dae),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!Gx(l)?mD:0,{x:h,y:p,z:m}=gae(e,d,a,o,f,l),{positionAbsolute:b}=e.internals,w=h!==b.x||p!==b.y;(w||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:h,y:p}:b,z:m}})}function gD(e,t,n){const r=os(e.zIndex)?e.zIndex:0;return Gx(n)?r:r+(e.selected?t:0)}function gae(e,t,n,r,s,i){const{x:a,y:o}=t.internals.positionAbsolute,l=fi(e),u=Od(e,n),d=Ga(e.extent)?qa(u,e.extent,l):u;let f=qa({x:a+d.x,y:o+d.y},r,l);e.extent==="parent"&&(f=rD(f,l,t));const h=gD(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Qx(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const l=t.get(o.parentId);if(!l)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??Sl(l),d=sD(u,o.rect);i.set(o.parentId,{expandedRect:d,parent:l})}return i.size>0&&i.forEach(({expandedRect:o,parent:l},u)=>{var y;const d=l.internals.positionAbsolute,f=fi(l),h=l.origin??r,p=o.x0||m>0||g||E)&&(s.push({id:u,type:"position",position:{x:l.position.x-p+g,y:l.position.y-m+E}}),(y=n.get(u))==null||y.forEach(_=>{e.some(k=>k.id===_.id)||s.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+m}})})),(f.width0){const p=Qx(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:l}}async function bae({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function $N(e,t,n,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(n,t)),a=`${s}-${e}`;const l=r.get(a)||new Map;if(r.set(a,l.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function yD(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,l={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,d=`${i}-${o}--${s}-${a}`;$N("source",l,d,e,s,a),$N("target",l,u,e,i,o),t.set(r.id,r)}}function bD(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:bD(n,t):!1}function HN(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Eae(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!bD(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function A0({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,o,l;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(o=n.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((l=t.get(e))==null?void 0:l.position)||i.position,dragging:r}:s[0],s]}function xae({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=Md(i,t);return{x:a.x-i.x,y:a.y-i.y}}function wae({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,l=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,b=null;function w({noDragClassName:E,handleSelector:y,domNode:_,isSelectable:k,nodeId:T,nodeClickDistance:C=0}){h=Sr(_);function N({x:B,y:Y}){const{nodeLookup:P,nodeExtent:U,snapGrid:A,snapToGrid:L,nodeOrigin:O,onNodeDrag:j,onSelectionDrag:S,onError:H,updateNodePositions:V}=t();i={x:B,y:Y};let D=!1;const ne=o.size>1,J=ne&&U?H1(Ld(o)):null,re=ne&&L?xae({dragItems:o,snapGrid:A,x:B,y:Y}):null;for(const[de,G]of o){if(!P.has(de))continue;let W={x:B-G.distance.x,y:Y-G.distance.y};L&&(W=re?{x:Math.round(W.x+re.x),y:Math.round(W.y+re.y)}:Md(W,A));let ae=null;if(ne&&U&&!G.extent&&J){const{positionAbsolute:ce}=G.internals,Ce=ce.x-J.x+U[0][0],Ee=ce.x+G.measured.width-J.x2+U[1][0],ge=ce.y-J.y+U[0][1],Me=ce.y+G.measured.height-J.y2+U[1][1];ae=[[Ce,ge],[Ee,Me]]}const{position:he,positionAbsolute:Z}=nD({nodeId:de,nextPosition:W,nodeLookup:P,nodeExtent:ae||U,nodeOrigin:O,onError:H});D=D||G.position.x!==he.x||G.position.y!==he.y,G.position=he,G.internals.positionAbsolute=Z}if(m=m||D,!!D&&(V(o,!0),b&&(r||j||!T&&S))){const[de,G]=A0({nodeId:T,dragItems:o,nodeLookup:P});r==null||r(b,o,de,G),j==null||j(b,de,G),T||S==null||S(b,G)}}async function R(){if(!d)return;const{transform:B,panBy:Y,autoPanSpeed:P,autoPanOnNodeDrag:U}=t();if(!U){l=!1,cancelAnimationFrame(a);return}const[A,L]=Vx(u,d,P);(A!==0||L!==0)&&(i.x=(i.x??0)-A/B[2],i.y=(i.y??0)-L/B[2],await Y({x:A,y:L})&&N(i)),a=requestAnimationFrame(R)}function I(B){var ne;const{nodeLookup:Y,multiSelectionActive:P,nodesDraggable:U,transform:A,snapGrid:L,snapToGrid:O,selectNodesOnDrag:j,onNodeDragStart:S,onSelectionDragStart:H,unselectNodesAndEdges:V}=t();f=!0,(!j||!k)&&!P&&T&&((ne=Y.get(T))!=null&&ne.selected||V()),k&&j&&T&&(e==null||e(T));const D=ou(B.sourceEvent,{transform:A,snapGrid:L,snapToGrid:O,containerBounds:d});if(i=D,o=Eae(Y,U,D,T),o.size>0&&(n||S||!T&&H)){const[J,re]=A0({nodeId:T,dragItems:o,nodeLookup:Y});n==null||n(B.sourceEvent,o,J,re),S==null||S(B.sourceEvent,J,re),T||H==null||H(B.sourceEvent,re)}}const M=D3().clickDistance(C).on("start",B=>{const{domNode:Y,nodeDragThreshold:P,transform:U,snapGrid:A,snapToGrid:L}=t();d=(Y==null?void 0:Y.getBoundingClientRect())||null,p=!1,m=!1,b=B.sourceEvent,P===0&&I(B),i=ou(B.sourceEvent,{transform:U,snapGrid:A,snapToGrid:L,containerBounds:d}),u=ls(B.sourceEvent,d)}).on("drag",B=>{const{autoPanOnNodeDrag:Y,transform:P,snapGrid:U,snapToGrid:A,nodeDragThreshold:L,nodeLookup:O}=t(),j=ou(B.sourceEvent,{transform:P,snapGrid:U,snapToGrid:A,containerBounds:d});if(b=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||T&&!O.has(T))&&(p=!0),!p){if(!l&&Y&&f&&(l=!0,R()),!f){const S=ls(B.sourceEvent,d),H=S.x-u.x,V=S.y-u.y;Math.sqrt(H*H+V*V)>L&&I(B)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&o&&f&&(u=ls(B.sourceEvent,d),N(j))}}).on("end",B=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(l=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:Y,updateNodePositions:P,onNodeDragStop:U,onSelectionDragStop:A}=t();if(m&&(P(o,!1),m=!1),s||U||!T&&A){const[L,O]=A0({nodeId:T,dragItems:o,nodeLookup:Y,dragging:!1});s==null||s(B.sourceEvent,o,L,O),U==null||U(B.sourceEvent,L,O),T||A==null||A(B.sourceEvent,O)}}}).filter(B=>{const Y=B.target;return!B.button&&(!E||!HN(Y,`.${E}`,_))&&(!y||HN(Y,y,_))});h.call(M)}function g(){h==null||h.on(".drag",null)}return{update:w,destroy:g}}function vae(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Xu(s,Sl(i))>0&&r.push(i);return r}const _ae=250;function Tae(e,t,n,r){var o,l;let s=[],i=1/0;const a=vae(e,n,t+_ae);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Xa(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function ED(e,t,n,r,s,i=!1){var u,d,f;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],l=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return l&&i?{...l,...Xa(a,l,l.position,!0)}:l}function xD(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function kae(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const wD=()=>!0;function Nae(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:l,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:b,onConnectEnd:w,isValidConnection:g=wD,onReconnectEnd:E,updateConnection:y,getTransform:_,getFromHandle:k,autoPanSpeed:T,dragThreshold:C=1,handleDomNode:N}){const R=lD(e.target);let I=0,M;const{x:B,y:Y}=ls(e),P=xD(i,N),U=o==null?void 0:o.getBoundingClientRect();let A=!1;if(!U||!P)return;const L=ED(s,P,r,l,t);if(!L)return;let O=ls(e,U),j=!1,S=null,H=!1,V=null;function D(){if(!d||!U)return;const[he,Z]=Vx(O,U,T);h({x:he,y:Z}),I=requestAnimationFrame(D)}const ne={...L,nodeId:s,type:P,position:L.position},J=l.get(s);let de={inProgress:!0,isValid:null,from:Xa(J,ne,De.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:J,to:O,toHandle:null,toPosition:IN[ne.position],toNode:null,pointer:O};function G(){A=!0,y(de),m==null||m(e,{nodeId:s,handleId:r,handleType:P})}C===0&&G();function W(he){if(!A){const{x:Me,y:ve}=ls(he),$e=Me-B,Re=ve-Y;if(!($e*$e+Re*Re>C*C))return;G()}if(!k()||!ne){ae(he);return}const Z=_();O=ls(he,U),M=Tae(Xl(O,Z,!1,[1,1]),n,l,ne),j||(D(),j=!0);const ce=vD(he,{handle:M,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:R,lib:u,flowId:f,nodeLookup:l});V=ce.handleDomNode,S=ce.connection,H=kae(!!M,ce.isValid);const Ce=l.get(s),Ee=Ce?Xa(Ce,ne,De.Left,!0):de.from,ge={...de,from:Ee,isValid:H,to:ce.toHandle&&H?Al({x:ce.toHandle.x,y:ce.toHandle.y},Z):O,toHandle:ce.toHandle,toPosition:H&&ce.toHandle?ce.toHandle.position:IN[ne.position],toNode:ce.toHandle?l.get(ce.toHandle.nodeId):null,pointer:O};y(ge),de=ge}function ae(he){if(!("touches"in he&&he.touches.length>0)){if(A){(M||V)&&S&&H&&(b==null||b(S));const{inProgress:Z,...ce}=de,Ce={...ce,toPosition:de.toHandle?de.toPosition:null};w==null||w(he,Ce),i&&(E==null||E(he,Ce))}p(),cancelAnimationFrame(I),j=!1,H=!1,S=null,V=null,R.removeEventListener("mousemove",W),R.removeEventListener("mouseup",ae),R.removeEventListener("touchmove",W),R.removeEventListener("touchend",ae)}}R.addEventListener("mousemove",W),R.addEventListener("mouseup",ae),R.addEventListener("touchmove",W),R.addEventListener("touchend",ae)}function vD(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:l,isValidConnection:u=wD,nodeLookup:d}){const f=i==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=ls(e),b=a.elementFromPoint(p,m),w=b!=null&&b.classList.contains(`${o}-flow__handle`)?b:h,g={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const E=xD(void 0,w),y=w.getAttribute("data-nodeid"),_=w.getAttribute("data-handleid"),k=w.classList.contains("connectable"),T=w.classList.contains("connectableend");if(!y||!E)return g;const C={source:f?y:r,sourceHandle:f?_:s,target:f?r:y,targetHandle:f?s:_};g.connection=C;const R=k&&T&&(n===kl.Strict?f&&E==="source"||!f&&E==="target":y!==r||_!==s);g.isValid=R&&u(C),g.toHandle=ED(y,E,_,d,n,!0)}return g}const Y1={onPointerDown:Nae,isValid:vD};function Sae({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Sr(e);function i({translateExtent:o,width:l,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const _=n(),k=y.sourceEvent.ctrlKey&&Qu()?10:1,T=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*d,C=_[2]*Math.pow(2,T*k);t.scaleTo(C)};let b=[0,0];const w=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(b=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},g=y=>{const _=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const k=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],T=[k[0]-b[0],k[1]-b[1]];b=k;const C=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),N={x:_[0]-T[0]*C,y:_[1]-T[1]*C},R=[[0,0],[l,u]];t.setViewportConstrained({x:N.x,y:N.y,zoom:_[2]},R,o)},E=X3().on("start",w).on("zoom",f?g:null).on("zoom.wheel",h?m:null);s.call(E,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:ss}}const Um=e=>({x:e.x,y:e.y,zoom:e.k}),C0=({x:e,y:t,zoom:n})=>jm.translate(e,t).scale(n),zo=(e,t)=>e.target.closest(`.${t}`),_D=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Aae=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,I0=(e,t=0,n=Aae,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},TD=e=>{const t=e.ctrlKey&&Qu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Cae({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:l,onPanZoomEnd:u}){return d=>{if(zo(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const w=ss(d),g=TD(d),E=f*Math.pow(2,g);r.scaleTo(n,E,w,d);return}const h=d.deltaMode===1?20:1;let p=s===Ma.Vertical?0:d.deltaX*h,m=s===Ma.Horizontal?0:d.deltaY*h;!Qu()&&d.shiftKey&&s!==Ma.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*i,-(m/f)*i,{internal:!0});const b=Um(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,b))}}function Iae({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,o=zo(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),n.call(this,r,s)}}function Rae({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Um(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Oae({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(n&&_D(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,Um(i.transform)))}}function Lae({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&_D(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const l=Um(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,l)},n?150:0)}}}function Mae({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{var w;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(zo(f,`${u}-flow__node`)||zo(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||a||d&&!m||zo(f,o)&&m||zo(f,l)&&(!m||s&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&b}}function Dae({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:l}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=X3().scaleExtent([t,n]).translateExtent(r),h=Sr(e).call(f);E({x:s.x,y:s.y,zoom:Nl(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(TD);async function b(M,B){return h?new Promise(Y=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?au:vh).transform(I0(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>Y(!0)),M)}):!1}function w({noWheelClassName:M,noPanClassName:B,onPaneContextMenu:Y,userSelectionActive:P,panOnScroll:U,panOnDrag:A,panOnScrollMode:L,panOnScrollSpeed:O,preventScrolling:j,zoomOnPinch:S,zoomOnScroll:H,zoomOnDoubleClick:V,zoomActivationKeyPressed:D,lib:ne,onTransformChange:J,connectionInProgress:re,paneClickDistance:de,selectionOnDrag:G}){P&&!u.isZoomingOrPanning&&g();const W=U&&!D&&!P;f.clickDistance(G?1/0:!os(de)||de<0?0:de);const ae=W?Cae({zoomPanValues:u,noWheelClassName:M,d3Selection:h,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:O,zoomOnPinch:S,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):Iae({noWheelClassName:M,preventScrolling:j,d3ZoomHandler:p});h.on("wheel.zoom",ae,{passive:!1});const he=Rae({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});f.on("start",he);const Z=Oae({zoomPanValues:u,panOnDrag:A,onPaneContextMenu:!!Y,onPanZoom:i,onTransformChange:J});f.on("zoom",Z);const ce=Lae({zoomPanValues:u,panOnDrag:A,panOnScroll:U,onPaneContextMenu:Y,onPanZoomEnd:o,onDraggingChange:l});f.on("end",ce);const Ce=Mae({zoomActivationKeyPressed:D,panOnDrag:A,zoomOnScroll:H,panOnScroll:U,zoomOnDoubleClick:V,zoomOnPinch:S,userSelectionActive:P,noPanClassName:B,noWheelClassName:M,lib:ne,connectionInProgress:re});f.filter(Ce),V?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function E(M,B,Y){const P=C0(M),U=f==null?void 0:f.constrain()(P,B,Y);return U&&await b(U),U}async function y(M,B){const Y=C0(M);return await b(Y,B),Y}function _(M){if(h){const B=C0(M),Y=h.property("__zoom");(Y.k!==M.zoom||Y.x!==M.x||Y.y!==M.y)&&(f==null||f.transform(h,B,null,{sync:!0}))}}function k(){const M=h?G3(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function T(M,B){return h?new Promise(Y=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?au:vh).scaleTo(I0(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>Y(!0)),M)}):!1}async function C(M,B){return h?new Promise(Y=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?au:vh).scaleBy(I0(h,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>Y(!0)),M)}):!1}function N(M){f==null||f.scaleExtent(M)}function R(M){f==null||f.translateExtent(M)}function I(M){const B=!os(M)||M<0?0:M;f==null||f.clickDistance(B)}return{update:w,destroy:g,setViewport:y,setViewportConstrained:E,getViewport:k,scaleTo:T,scaleBy:C,setScaleExtent:N,setTranslateExtent:R,syncViewport:_,setClickDistance:I}}var Cl;(function(e){e.Line="line",e.Handle="handle"})(Cl||(Cl={}));function Pae({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,o=n-r,l=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(l[0]=l[0]*-1),o&&i&&(l[1]=l[1]*-1),l}function zN(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function yi(e,t){return Math.max(0,t-e)}function bi(e,t){return Math.max(0,e-t)}function $f(e,t,n){return Math.max(0,t-e,e-n)}function VN(e,t){return e?!t:t}function jae(e,t,n,r,s,i,a,o){let{affectsX:l,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:b,maxWidth:w,minHeight:g,maxHeight:E}=r,{x:y,y:_,width:k,height:T,aspectRatio:C}=e;let N=Math.floor(d?p-e.pointerX:0),R=Math.floor(f?m-e.pointerY:0);const I=k+(l?-N:N),M=T+(u?-R:R),B=-i[0]*k,Y=-i[1]*T;let P=$f(I,b,w),U=$f(M,g,E);if(a){let O=0,j=0;l&&N<0?O=yi(y+N+B,a[0][0]):!l&&N>0&&(O=bi(y+I+B,a[1][0])),u&&R<0?j=yi(_+R+Y,a[0][1]):!u&&R>0&&(j=bi(_+M+Y,a[1][1])),P=Math.max(P,O),U=Math.max(U,j)}if(o){let O=0,j=0;l&&N>0?O=bi(y+N,o[0][0]):!l&&N<0&&(O=yi(y+I,o[1][0])),u&&R>0?j=bi(_+R,o[0][1]):!u&&R<0&&(j=yi(_+M,o[1][1])),P=Math.max(P,O),U=Math.max(U,j)}if(s){if(d){const O=$f(I/C,g,E)*C;if(P=Math.max(P,O),a){let j=0;!l&&!u||l&&!u&&h?j=bi(_+Y+I/C,a[1][1])*C:j=yi(_+Y+(l?N:-N)/C,a[0][1])*C,P=Math.max(P,j)}if(o){let j=0;!l&&!u||l&&!u&&h?j=yi(_+I/C,o[1][1])*C:j=bi(_+(l?N:-N)/C,o[0][1])*C,P=Math.max(P,j)}}if(f){const O=$f(M*C,b,w)/C;if(U=Math.max(U,O),a){let j=0;!l&&!u||u&&!l&&h?j=bi(y+M*C+B,a[1][0])/C:j=yi(y+(u?R:-R)*C+B,a[0][0])/C,U=Math.max(U,j)}if(o){let j=0;!l&&!u||u&&!l&&h?j=yi(y+M*C,o[1][0])/C:j=bi(y+(u?R:-R)*C,o[0][0])/C,U=Math.max(U,j)}}}R=R+(R<0?U:-U),N=N+(N<0?P:-P),s&&(h?I>M*C?R=(VN(l,u)?-N:N)/C:N=(VN(l,u)?-R:R)*C:d?(R=N/C,u=l):(N=R*C,l=u));const A=l?y+N:y,L=u?_+R:_;return{width:k+(l?-N:N),height:T+(u?-R:R),x:i[0]*N*(l?-1:1)+A,y:i[1]*R*(u?-1:1)+L}}const kD={width:0,height:0,x:0,y:0},Bae={...kD,pointerX:0,pointerY:0,aspectRatio:1};function Fae(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=n[0]*i,l=n[1]*a;return[[r-o,s-l],[r+i-o,s+a-l]]}function Uae({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Sr(e);let a={controlDirection:zN("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:b,shouldResize:w}){let g={...kD},E={...Bae};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:zN(u)};let y,_=null,k=[],T,C,N,R=!1;const I=D3().on("start",M=>{const{nodeLookup:B,transform:Y,snapGrid:P,snapToGrid:U,nodeOrigin:A,paneDomNode:L}=n();if(y=B.get(t),!y)return;_=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:O,ySnapped:j}=ou(M.sourceEvent,{transform:Y,snapGrid:P,snapToGrid:U,containerBounds:_});g={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},E={...g,pointerX:O,pointerY:j,aspectRatio:g.width/g.height},T=void 0,C=Ga(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(T=B.get(y.parentId)),T&&y.extent==="parent"&&(C=[[0,0],[T.measured.width,T.measured.height]]),k=[],N=void 0;for(const[S,H]of B)if(H.parentId===t&&(k.push({id:S,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const V=Fae(H,y,H.origin??A);N?N=[[Math.min(V[0][0],N[0][0]),Math.min(V[0][1],N[0][1])],[Math.max(V[1][0],N[1][0]),Math.max(V[1][1],N[1][1])]]:N=V}p==null||p(M,{...g})}).on("drag",M=>{const{transform:B,snapGrid:Y,snapToGrid:P,nodeOrigin:U}=n(),A=ou(M.sourceEvent,{transform:B,snapGrid:Y,snapToGrid:P,containerBounds:_}),L=[];if(!y)return;const{x:O,y:j,width:S,height:H}=g,V={},D=y.origin??U,{width:ne,height:J,x:re,y:de}=jae(E,a.controlDirection,A,a.boundaries,a.keepAspectRatio,D,C,N),G=ne!==S,W=J!==H,ae=re!==O&&G,he=de!==j&&W;if(!ae&&!he&&!G&&!W)return;if((ae||he||D[0]===1||D[1]===1)&&(V.x=ae?re:g.x,V.y=he?de:g.y,g.x=V.x,g.y=V.y,k.length>0)){const Ee=re-O,ge=de-j;for(const Me of k)Me.position={x:Me.position.x-Ee+D[0]*(ne-S),y:Me.position.y-ge+D[1]*(J-H)},L.push(Me)}if((G||W)&&(V.width=G&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ne:g.width,V.height=W&&(!a.resizeDirection||a.resizeDirection==="vertical")?J:g.height,g.width=V.width,g.height=V.height),T&&y.expandParent){const Ee=D[0]*(V.width??0);V.x&&V.x{R&&(b==null||b(M,{...g}),s==null||s({...g}),R=!1)});i.call(I)}function l(){i.on(".drag",null)}return{update:o,destroy:l}}var ND={exports:{}},SD={},AD={exports:{}},CD={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Il=v;function $ae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hae=typeof Object.is=="function"?Object.is:$ae,zae=Il.useState,Vae=Il.useEffect,Kae=Il.useLayoutEffect,Yae=Il.useDebugValue;function Wae(e,t){var n=t(),r=zae({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Kae(function(){s.value=n,s.getSnapshot=t,R0(s)&&i({inst:s})},[e,n,t]),Vae(function(){return R0(s)&&i({inst:s}),e(function(){R0(s)&&i({inst:s})})},[e]),Yae(n),n}function R0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Hae(e,n)}catch{return!0}}function qae(e,t){return t()}var Gae=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qae:Wae;CD.useSyncExternalStore=Il.useSyncExternalStore!==void 0?Il.useSyncExternalStore:Gae;AD.exports=CD;var Xae=AD.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var $m=v,Qae=Xae;function Zae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jae=typeof Object.is=="function"?Object.is:Zae,eoe=Qae.useSyncExternalStore,toe=$m.useRef,noe=$m.useEffect,roe=$m.useMemo,soe=$m.useDebugValue;SD.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=toe(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=roe(function(){function l(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,Jae(d,p))return m;var b=r(p);return s!==void 0&&s(m,b)?(d=p,m):(d=p,f=b)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return l(t())},h===null?void 0:function(){return l(h())}]},[t,n,r,s]);var o=eoe(e,i[0],i[1]);return noe(function(){a.hasValue=!0,a.value=o},[o]),soe(o),o};ND.exports=SD;var ioe=ND.exports;const aoe=Ju(ioe),ooe={},KN=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(ooe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,l);return l},loe=e=>e?KN(e):KN,{useDebugValue:coe}=et,{useSyncExternalStoreWithSelector:uoe}=aoe,doe=e=>e;function ID(e,t=doe,n){const r=uoe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return coe(r),r}const YN=(e,t)=>{const n=loe(e),r=(s,i=t)=>ID(n,s,i);return Object.assign(r,n),r},foe=(e,t)=>e?YN(e,t):YN;function qt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Hm=v.createContext(null),hoe=Hm.Provider,RD=ps.error001("react");function ft(e,t){const n=v.useContext(Hm);if(n===null)throw new Error(RD);return ID(n,e,t)}function Gt(){const e=v.useContext(Hm);if(e===null)throw new Error(RD);return v.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const WN={display:"none"},poe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},OD="react-flow__node-desc",LD="react-flow__edge-desc",moe="react-flow__aria-live",goe=e=>e.ariaLiveMessage,yoe=e=>e.ariaLabelConfig;function boe({rfId:e}){const t=ft(goe);return c.jsx("div",{id:`${moe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:poe,children:t})}function Eoe({rfId:e,disableKeyboardA11y:t}){const n=ft(yoe);return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`${OD}-${e}`,style:WN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),c.jsx("div",{id:`${LD}-${e}`,style:WN,children:n["edge.a11yDescription.default"]}),!t&&c.jsx(boe,{rfId:e})]})}const zm=v.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return c.jsx("div",{className:En(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});zm.displayName="Panel";function xoe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:c.jsx(zm,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:c.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const woe=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Hf=e=>e.id;function voe(e,t){return qt(e.selectedNodes.map(Hf),t.selectedNodes.map(Hf))&&qt(e.selectedEdges.map(Hf),t.selectedEdges.map(Hf))}function _oe({onSelectionChange:e}){const t=Gt(),{selectedNodes:n,selectedEdges:r}=ft(woe,voe);return v.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const Toe=e=>!!e.onSelectionChangeHandlers;function koe({onSelectionChange:e}){const t=ft(Toe);return e||t?c.jsx(_oe,{onSelectionChange:e}):null}const MD=[0,0],Noe={x:0,y:0,zoom:1},Soe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],qN=[...Soe,"rfId"],Aoe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),GN={translateExtent:Wu,nodeOrigin:MD,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Coe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:l}=ft(Aoe,qt),u=Gt();v.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=GN,o()}),[]);const d=v.useRef(GN);return v.useEffect(()=>{for(const f of qN){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Jie(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},qN.map(f=>e[f])),null}function XN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ioe(e){var r;const[t,n]=v.useState(e==="system"?null:e);return v.useEffect(()=>{if(e!=="system"){n(e);return}const s=XN(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=XN())!=null&&r.matches?"dark":"light"}const QN=typeof document<"u"?document:null;function Zu(e=null,t={target:QN,actInsideInputWithModifier:!0}){const[n,r]=v.useState(!1),s=v.useRef(!1),i=v.useRef(new Set([])),[a,o]=v.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` +`).replace(` + +`,` ++`).split(` +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return v.useEffect(()=>{const l=(t==null?void 0:t.target)??QN,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var w,g;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&cD(p))return!1;const b=JN(p.code,o);if(i.current.add(p[b]),ZN(a,i.current,!1)){const E=((g=(w=p.composedPath)==null?void 0:w.call(p))==null?void 0:g[0])||p.target,y=(E==null?void 0:E.nodeName)==="BUTTON"||(E==null?void 0:E.nodeName)==="A";t.preventDefault!==!1&&(s.current||!y)&&p.preventDefault(),r(!0)}},f=p=>{const m=JN(p.code,o);ZN(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[m]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",d),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{l==null||l.removeEventListener("keydown",d),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function ZN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function JN(e,t){return t.includes(e)?"code":"key"}const Roe=()=>{const e=Gt();return v.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),l=Kx(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(l,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:o,y:l}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-l},d=n.snapGrid??s,f=n.snapToGrid??i;return Xl(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Al(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function DD(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...i};for(const l of a)Ooe(l,o);n.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Ooe(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function PD(e,t){return DD(e,t)}function jD(e,t){return DD(e,t)}function ga(e,t){return{id:e,type:"select",selected:t}}function Vo(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(ga(i.id,a)))}return r}function eS({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=t.get(a.id),l=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;l!==void 0&&l!==a&&n.push({id:a.id,item:a,type:"replace"}),l===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function tS(e){return{id:e.id,type:"remove"}}const Loe=iD();function BD(e,t,n={}){return iae(e,t,{...n,onError:n.onError??Loe})}const nS=e=>Vie(e),Moe=e=>tD(e);function FD(e){return v.forwardRef(e)}const Doe=typeof window<"u"?v.useLayoutEffect:v.useEffect;function rS(e){const[t,n]=v.useState(BigInt(0)),[r]=v.useState(()=>Poe(()=>n(s=>s+BigInt(1))));return Doe(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Poe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const UD=v.createContext(null);function joe({children:e}){const t=Gt(),n=v.useCallback(o=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let b=l;for(const g of o)b=typeof g=="function"?g(b):g;let w=eS({items:b,lookup:h});for(const g of m.values())w=g(w);d&&u(b),w.length>0?f==null||f(w):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:E,setNodes:y}=t.getState();g&&y(E)})},[]),r=rS(n),s=v.useCallback(o=>{const{edges:l=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=l;for(const m of o)p=typeof m=="function"?m(p):m;d?u(p):f&&f(eS({items:p,lookup:h}))},[]),i=rS(s),a=v.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return c.jsx(UD.Provider,{value:a,children:e})}function Boe(){const e=v.useContext(UD);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Foe=e=>!!e.panZoom;function Zx(){const e=Roe(),t=Gt(),n=Boe(),r=ft(Foe),s=v.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},l=f=>{var g,E;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=nS(f)?f:h.get(f.id),b=m.parentId?oD(m.position,m.measured,m.parentId,h,p):m.position,w={...m,position:b,width:((g=m.measured)==null?void 0:g.width)??m.width,height:((E=m.measured)==null?void 0:E.height)??m.height};return Sl(w)},u=(f,h,p={replace:!1})=>{a(m=>m.map(b=>{if(b.id===f){const w=typeof h=="function"?h(b):h;return p.replace&&nS(w)?w:{...b,...w}}return b}))},d=(f,h,p={replace:!1})=>{o(m=>m.map(b=>{if(b.id===f){const w=typeof h=="function"?h(b):h;return p.replace&&Moe(w)?w:{...b,...w}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,b,w]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x:m,y:b,zoom:w}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:b,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:E,onDelete:y,onBeforeDelete:_}=t.getState(),{nodes:k,edges:T}=await Gie({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:_}),C=T.length>0,N=k.length>0;if(C){const R=T.map(tS);w==null||w(T),E(R)}if(N){const R=k.map(tS);b==null||b(k),g(R)}return(N||C)&&(y==null||y({nodes:k,edges:T})),{deletedNodes:k,deletedEdges:T}},getIntersectingNodes:(f,h=!0,p)=>{const m=ON(f),b=m?f:l(f),w=p!==void 0;return b?(p||t.getState().nodes).filter(g=>{const E=t.getState().nodeLookup.get(g.id);if(E&&!m&&(g.id===f.id||!E.internals.positionAbsolute))return!1;const y=Sl(w?g:E),_=Xu(y,b);return h&&_>0||_>=y.width*y.height||_>=b.width*b.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const b=ON(f)?f:l(f);if(!b)return!1;const w=Xu(b,h);return p&&w>0||w>=h.width*h.height||w>=b.width*b.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const b=typeof h=="function"?h(m):h;return p.replace?{...m,data:b}:{...m,data:{...m.data,...b}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const b=typeof h=="function"?h(m):h;return p.replace?{...m,data:b}:{...m,data:{...m.data,...b}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Kie(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??Zie();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return v.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const sS=e=>e.selected,Uoe=typeof window<"u"?window:void 0;function $oe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Gt(),{deleteElements:r}=Zx(),s=Zu(e,{actInsideInputWithModifier:!1}),i=Zu(t,{target:Uoe});v.useEffect(()=>{if(s){const{edges:a,nodes:o}=n.getState();r({nodes:o.filter(sS),edges:a.filter(sS)}),n.setState({nodesSelectionActive:!1})}},[s]),v.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Hoe(e){const t=Gt();v.useEffect(()=>{const n=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Yx(e.current);(r.height===0||r.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",ps.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Vm={position:"absolute",width:"100%",height:"100%",top:0,left:0},zoe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Voe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Ma.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:b,noPanClassName:w,onViewportChange:g,isControlledViewport:E,paneClickDistance:y,selectionOnDrag:_}){const k=Gt(),T=v.useRef(null),{userSelectionActive:C,lib:N,connectionInProgress:R}=ft(zoe,qt),I=Zu(h),M=v.useRef();Hoe(T);const B=v.useCallback(Y=>{g==null||g({x:Y[0],y:Y[1],zoom:Y[2]}),E||k.setState({transform:Y})},[g,E]);return v.useEffect(()=>{if(T.current){M.current=Dae({domNode:T.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:A=>k.setState(L=>L.paneDragging===A?L:{paneDragging:A}),onPanZoomStart:(A,L)=>{const{onViewportChangeStart:O,onMoveStart:j}=k.getState();j==null||j(A,L),O==null||O(L)},onPanZoom:(A,L)=>{const{onViewportChange:O,onMove:j}=k.getState();j==null||j(A,L),O==null||O(L)},onPanZoomEnd:(A,L)=>{const{onViewportChangeEnd:O,onMoveEnd:j}=k.getState();j==null||j(A,L),O==null||O(L)}});const{x:Y,y:P,zoom:U}=M.current.getViewport();return k.setState({panZoom:M.current,transform:[Y,P,U],domNode:T.current.closest(".react-flow")}),()=>{var A;(A=M.current)==null||A.destroy()}}},[]),v.useEffect(()=>{var Y;(Y=M.current)==null||Y.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:I,preventScrolling:p,noPanClassName:w,userSelectionActive:C,noWheelClassName:b,lib:N,onTransformChange:B,connectionInProgress:R,selectionOnDrag:_,paneClickDistance:y})},[e,t,n,r,s,i,a,o,I,p,w,C,b,N,B,R,_,y]),c.jsx("div",{className:"react-flow__renderer",ref:T,style:Vm,children:m})}const Koe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Yoe(){const{userSelectionActive:e,userSelectionRect:t}=ft(Koe,qt);return e&&t?c.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const O0=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Woe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function qoe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=qu.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:b}){const w=v.useRef(0),g=Gt(),{userSelectionActive:E,elementsSelectable:y,dragging:_,connectionInProgress:k,panBy:T,autoPanSpeed:C}=ft(Woe,qt),N=y&&(e||E),R=v.useRef(null),I=v.useRef(),M=v.useRef(new Set),B=v.useRef(new Set),Y=v.useRef(!1),P=v.useRef({x:0,y:0}),U=v.useRef(!1),A=G=>{if(Y.current||k){Y.current=!1;return}u==null||u(G),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},L=G=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){G.preventDefault();return}d==null||d(G)},O=f?G=>f(G):void 0,j=G=>{Y.current&&(G.stopPropagation(),Y.current=!1)},S=G=>{var Me,ve;const{domNode:W,transform:ae}=g.getState();if(I.current=W==null?void 0:W.getBoundingClientRect(),!I.current)return;const he=G.target===R.current;if(!he&&!!G.target.closest(".nokey")||!e||!(a&&he||t)||G.button!==0||!G.isPrimary)return;(ve=(Me=G.target)==null?void 0:Me.setPointerCapture)==null||ve.call(Me,G.pointerId),Y.current=!1;const{x:Ce,y:Ee}=ls(G.nativeEvent,I.current),ge=Xl({x:Ce,y:Ee},ae);g.setState({userSelectionRect:{width:0,height:0,startX:ge.x,startY:ge.y,x:Ce,y:Ee}}),he||(G.stopPropagation(),G.preventDefault())};function H(G,W){const{userSelectionRect:ae}=g.getState();if(!ae)return;const{transform:he,nodeLookup:Z,edgeLookup:ce,connectionLookup:Ce,triggerNodeChanges:Ee,triggerEdgeChanges:ge,defaultEdgeOptions:Me}=g.getState(),ve={x:ae.startX,y:ae.startY},{x:$e,y:Re}=Al(ve,he),oe={startX:ve.x,startY:ve.y,x:G<$e?G:$e,y:Wct.id)),B.current=new Set;const Tt=(Me==null?void 0:Me.selectable)??!0;for(const ct of M.current){const K=Ce.get(ct);if(K)for(const{edgeId:X}of K.values()){const le=ce.get(X);le&&(le.selectable??Tt)&&B.current.add(X)}}if(!LN(_t,M.current)){const ct=Vo(Z,M.current,!0);Ee(ct)}if(!LN(we,B.current)){const ct=Vo(ce,B.current);ge(ct)}g.setState({userSelectionRect:oe,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!s||!I.current)return;const[G,W]=Vx(P.current,I.current,C);T({x:G,y:W}).then(ae=>{if(!Y.current||!ae){w.current=requestAnimationFrame(V);return}const{x:he,y:Z}=P.current;H(he,Z),w.current=requestAnimationFrame(V)})}const D=()=>{cancelAnimationFrame(w.current),w.current=0,U.current=!1};v.useEffect(()=>()=>D(),[]);const ne=G=>{const{userSelectionRect:W,transform:ae,resetSelectedElements:he}=g.getState();if(!I.current||!W)return;const{x:Z,y:ce}=ls(G.nativeEvent,I.current);P.current={x:Z,y:ce};const Ce=Al({x:W.startX,y:W.startY},ae);if(!Y.current){const Ee=t?0:i;if(Math.hypot(Z-Ce.x,ce-Ce.y)<=Ee)return;he(),o==null||o(G)}Y.current=!0,U.current||(V(),U.current=!0),H(Z,ce)},J=G=>{var W,ae;G.button===0&&((ae=(W=G.target)==null?void 0:W.releasePointerCapture)==null||ae.call(W,G.pointerId),!E&&G.target===R.current&&g.getState().userSelectionRect&&(A==null||A(G)),g.setState({userSelectionActive:!1,userSelectionRect:null}),Y.current&&(l==null||l(G),g.setState({nodesSelectionActive:M.current.size>0})),D())},re=G=>{var W,ae;(ae=(W=G.target)==null?void 0:W.releasePointerCapture)==null||ae.call(W,G.pointerId),D()},de=r===!0||Array.isArray(r)&&r.includes(0);return c.jsxs("div",{className:En(["react-flow__pane",{draggable:de,dragging:_,selection:e}]),onClick:N?void 0:O0(A,R),onContextMenu:O0(L,R),onWheel:O0(O,R),onPointerEnter:N?void 0:h,onPointerMove:N?ne:p,onPointerUp:N?J:void 0,onPointerCancel:N?re:void 0,onPointerDownCapture:N?S:void 0,onClickCapture:N?j:void 0,onPointerLeave:m,ref:R,style:Vm,children:[b,c.jsx(Yoe,{})]})}function W1({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:l}=t.getState(),u=o.get(e);if(!u){l==null||l("012",ps.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function $D({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=Gt(),[l,u]=v.useState(!1),d=v.useRef();return v.useEffect(()=>{d.current=wae({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{W1({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),v.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),l}const Goe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function HD(){const e=Gt();return v.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:l,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Goe(a),p=s?i[0]:5,m=s?i[1]:5,b=n.direction.x*p*n.factor,w=n.direction.y*m*n.factor;for(const[,g]of u){if(!h(g))continue;let E={x:g.internals.positionAbsolute.x+b,y:g.internals.positionAbsolute.y+w};s&&(E=Md(E,i));const{position:y,positionAbsolute:_}=nD({nodeId:g.id,nextPosition:E,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:o});g.position=y,g.internals.positionAbsolute=_,f.set(g.id,g)}l(f)},[])}const Jx=v.createContext(null),Xoe=Jx.Provider;Jx.Consumer;const zD=()=>v.useContext(Jx),Qoe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Zoe=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:l,isValid:u}=a,d=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===kl.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:d&&u}};function Joe({type:e="source",position:t=De.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:l,className:u,onMouseDown:d,onTouchStart:f,...h},p){var U,A;const m=a||null,b=e==="target",w=Gt(),g=zD(),{connectOnClick:E,noPanClassName:y,rfId:_}=ft(Qoe,qt),{connectingFrom:k,connectingTo:T,clickConnecting:C,isPossibleEndHandle:N,connectionInProcess:R,clickConnectionInProcess:I,valid:M}=ft(Zoe(g,m,e),qt);g||(A=(U=w.getState()).onError)==null||A.call(U,"010",ps.error010());const B=L=>{const{defaultEdgeOptions:O,onConnect:j,hasDefaultEdges:S}=w.getState(),H={...O,...L};if(S){const{edges:V,setEdges:D,onError:ne}=w.getState();D(BD(H,V,{onError:ne}))}j==null||j(H),o==null||o(H)},Y=L=>{if(!g)return;const O=uD(L.nativeEvent);if(s&&(O&&L.button===0||!O)){const j=w.getState();Y1.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:j.autoPanOnConnect,connectionMode:j.connectionMode,connectionRadius:j.connectionRadius,domNode:j.domNode,nodeLookup:j.nodeLookup,lib:j.lib,isTarget:b,handleId:m,nodeId:g,flowId:j.rfId,panBy:j.panBy,cancelConnection:j.cancelConnection,onConnectStart:j.onConnectStart,onConnectEnd:(...S)=>{var H,V;return(V=(H=w.getState()).onConnectEnd)==null?void 0:V.call(H,...S)},updateConnection:j.updateConnection,onConnect:B,isValidConnection:n||((...S)=>{var H,V;return((V=(H=w.getState()).isValidConnection)==null?void 0:V.call(H,...S))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:j.autoPanSpeed,dragThreshold:j.connectionDragThreshold})}O?d==null||d(L):f==null||f(L)},P=L=>{const{onClickConnectStart:O,onClickConnectEnd:j,connectionClickStartHandle:S,connectionMode:H,isValidConnection:V,lib:D,rfId:ne,nodeLookup:J,connection:re}=w.getState();if(!g||!S&&!s)return;if(!S){O==null||O(L.nativeEvent,{nodeId:g,handleId:m,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:m}});return}const de=lD(L.target),G=n||V,{connection:W,isValid:ae}=Y1.isValid(L.nativeEvent,{handle:{nodeId:g,id:m,type:e},connectionMode:H,fromNodeId:S.nodeId,fromHandleId:S.id||null,fromType:S.type,isValidConnection:G,flowId:ne,doc:de,lib:D,nodeLookup:J});ae&&W&&B(W);const he=structuredClone(re);delete he.inProgress,he.toPosition=he.toHandle?he.toHandle.position:null,j==null||j(L,he),w.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":m,"data-nodeid":g,"data-handlepos":t,"data-id":`${_}-${g}-${m}-${e}`,className:En(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,u,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:C,connectingfrom:k,connectingto:T,valid:M,connectionindicator:r&&(!R||N)&&(R||I?i:s)}]),onMouseDown:Y,onTouchStart:Y,onClick:E?P:void 0,ref:p,...h,children:l})}const Rl=v.memo(FD(Joe));function ele({data:e,isConnectable:t,sourcePosition:n=De.Bottom}){return c.jsxs(c.Fragment,{children:[e==null?void 0:e.label,c.jsx(Rl,{type:"source",position:n,isConnectable:t})]})}function tle({data:e,isConnectable:t,targetPosition:n=De.Top,sourcePosition:r=De.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(Rl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,c.jsx(Rl,{type:"source",position:r,isConnectable:t})]})}function nle(){return null}function rle({data:e,isConnectable:t,targetPosition:n=De.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(Rl,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const jp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},iS={input:ele,default:tle,output:rle,group:nle};function sle(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const ile=e=>{const{width:t,height:n,x:r,y:s}=Ld(e.nodeLookup,{filter:i=>!!i.selected});return{width:os(t)?t:null,height:os(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function ale({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Gt(),{width:s,height:i,transformString:a,userSelectionActive:o}=ft(ile,qt),l=HD(),u=v.useRef(null);v.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&s!==null&&i!==null;if($D({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=r.getState().nodes.filter(b=>b.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(jp,p.key)&&(p.preventDefault(),l({direction:jp[p.key],factor:p.shiftKey?4:1}))};return c.jsx("div",{className:En(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:c.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const aS=typeof window<"u"?window:void 0,ole=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function VD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:b,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:E,zoomOnPinch:y,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:T,zoomOnDoubleClick:C,panOnDrag:N,autoPanOnSelection:R,defaultViewport:I,translateExtent:M,minZoom:B,maxZoom:Y,preventScrolling:P,onSelectionContextMenu:U,noWheelClassName:A,noPanClassName:L,disableKeyboardA11y:O,onViewportChange:j,isControlledViewport:S}){const{nodesSelectionActive:H,userSelectionActive:V}=ft(ole,qt),D=Zu(u,{target:aS}),ne=Zu(b,{target:aS}),J=ne||N,re=ne||_,de=d&&J!==!0,G=D||V||de;return $oe({deleteKeyCode:l,multiSelectionKeyCode:m}),c.jsx(Voe,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:E,zoomOnPinch:y,panOnScroll:re,panOnScrollSpeed:k,panOnScrollMode:T,zoomOnDoubleClick:C,panOnDrag:!D&&J,defaultViewport:I,translateExtent:M,minZoom:B,maxZoom:Y,zoomActivationKeyCode:w,preventScrolling:P,noWheelClassName:A,noPanClassName:L,onViewportChange:j,isControlledViewport:S,paneClickDistance:o,selectionOnDrag:de,children:c.jsxs(qoe,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:J,autoPanOnSelection:R,isSelecting:!!G,selectionMode:f,selectionKeyPressed:D,paneClickDistance:o,selectionOnDrag:de,children:[e,H&&c.jsx(ale,{onSelectionContextMenu:U,noPanClassName:L,disableKeyboardA11y:O})]})})}VD.displayName="FlowRenderer";const lle=v.memo(VD),cle=e=>t=>e?zx(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function ule(e){return ft(v.useCallback(cle(e),[e]),qt)}const dle=e=>e.updateNodeInternals;function fle(){const e=ft(dle),[t]=v.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return v.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function hle({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=Gt(),i=v.useRef(null),a=v.useRef(null),o=v.useRef(e.sourcePosition),l=v.useRef(e.targetPosition),u=v.useRef(t),d=n&&!!e.internals.handleBounds;return v.useEffect(()=>{i.current&&!e.hidden&&(!d||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[d,e.hidden]),v.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),v.useEffect(()=>{if(i.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=l.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,l.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function ple({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:l,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:b,nodeTypes:w,nodeClickDistance:g,onError:E}){const{node:y,internals:_,isParent:k}=ft(G=>{const W=G.nodeLookup.get(e),ae=G.parentLookup.has(e);return{node:W,internals:W.internals,isParent:ae}},qt);let T=y.type||"default",C=(w==null?void 0:w[T])||iS[T];C===void 0&&(E==null||E("003",ps.error003(T)),T="default",C=(w==null?void 0:w.default)||iS.default);const N=!!(y.draggable||o&&typeof y.draggable>"u"),R=!!(y.selectable||l&&typeof y.selectable>"u"),I=!!(y.connectable||u&&typeof y.connectable>"u"),M=!!(y.focusable||d&&typeof y.focusable>"u"),B=Gt(),Y=aD(y),P=hle({node:y,nodeType:T,hasDimensions:Y,resizeObserver:f}),U=$D({nodeRef:P,disabled:y.hidden||!N,noDragClassName:h,handleSelector:y.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:g}),A=HD();if(y.hidden)return null;const L=fi(y),O=sle(y),j=R||N||t||n||r||s,S=n?G=>n(G,{..._.userNode}):void 0,H=r?G=>r(G,{..._.userNode}):void 0,V=s?G=>s(G,{..._.userNode}):void 0,D=i?G=>i(G,{..._.userNode}):void 0,ne=a?G=>a(G,{..._.userNode}):void 0,J=G=>{const{selectNodesOnDrag:W,nodeDragThreshold:ae}=B.getState();R&&(!W||!N||ae>0)&&W1({id:e,store:B,nodeRef:P}),t&&t(G,{..._.userNode})},re=G=>{if(!(cD(G.nativeEvent)||m)){if(Q3.includes(G.key)&&R){const W=G.key==="Escape";W1({id:e,store:B,unselect:W,nodeRef:P})}else if(N&&y.selected&&Object.prototype.hasOwnProperty.call(jp,G.key)){G.preventDefault();const{ariaLabelConfig:W}=B.getState();B.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:G.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),A({direction:jp[G.key],factor:G.shiftKey?4:1})}}},de=()=>{var Ce;if(m||!((Ce=P.current)!=null&&Ce.matches(":focus-visible")))return;const{transform:G,width:W,height:ae,autoPanOnNodeFocus:he,setCenter:Z}=B.getState();if(!he)return;zx(new Map([[e,y]]),{x:0,y:0,width:W,height:ae},G,!0).length>0||Z(y.position.x+L.width/2,y.position.y+L.height/2,{zoom:G[2]})};return c.jsx("div",{className:En(["react-flow__node",`react-flow__node-${T}`,{[p]:N},y.className,{selected:y.selected,selectable:R,parent:k,draggable:N,dragging:U}]),ref:P,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:Y?"visible":"hidden",...y.style,...O},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:S,onMouseMove:H,onMouseLeave:V,onContextMenu:D,onClick:J,onDoubleClick:ne,onKeyDown:M?re:void 0,tabIndex:M?0:void 0,onFocus:M?de:void 0,role:y.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${OD}-${b}`,"aria-label":y.ariaLabel,...y.domAttributes,children:c.jsx(Xoe,{value:e,children:c.jsx(C,{id:e,data:y.data,type:T,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:y.selected??!1,selectable:R,draggable:N,deletable:y.deletable??!0,isConnectable:I,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:U,dragHandle:y.dragHandle,zIndex:_.z,parentId:y.parentId,...L})})})}var mle=v.memo(ple);const gle=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function KD(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=ft(gle,qt),a=ule(e.onlyRenderVisibleElements),o=fle();return c.jsx("div",{className:"react-flow__nodes",style:Vm,children:a.map(l=>c.jsx(mle,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}KD.displayName="NodeRenderer";const yle=v.memo(KD);function ble(e){return ft(v.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&nae({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),qt)}const Ele=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return c.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},xle=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return c.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},oS={[Gu.Arrow]:Ele,[Gu.ArrowClosed]:xle};function wle(e){const t=Gt();return v.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(oS,e)?oS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",ps.error009(e)),null)},[e])}const vle=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const l=wle(t);return l?c.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:c.jsx(l,{color:n,strokeWidth:a})}):null},YD=({defaultColor:e,rfId:t})=>{const n=ft(i=>i.edges),r=ft(i=>i.defaultEdgeOptions),s=v.useMemo(()=>uae(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:s.map(i=>c.jsx(vle,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};YD.displayName="MarkerDefinitions";var _le=v.memo(YD);function WD({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:l,className:u,...d}){const[f,h]=v.useState({x:1,y:0,width:0,height:0}),p=En(["react-flow__edge-textwrapper",u]),m=v.useRef(null);return v.useEffect(()=>{if(m.current){const b=m.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?c.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&c.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),c.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),l]}):null}WD.displayName="EdgeText";const Tle=v.memo(WD);function Km({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l,interactionWidth:u=20,...d}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...d,d:e,fill:"none",className:En(["react-flow__edge-path",d.className])}),u?c.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&os(t)&&os(n)?c.jsx(Tle,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l}):null]})}function lS({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===De.Left||e===De.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function qD({sourceX:e,sourceY:t,sourcePosition:n=De.Bottom,targetX:r,targetY:s,targetPosition:i=De.Top}){const[a,o]=lS({pos:n,x1:e,y1:t,x2:r,y2:s}),[l,u]=lS({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=dD({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${o} ${l},${u} ${r},${s}`,d,f,h,p]}function GD(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:w,interactionWidth:g})=>{const[E,y,_]=qD({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),k=e.isInternal?void 0:t;return c.jsx(Km,{id:k,path:E,labelX:y,labelY:_,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:w,interactionWidth:g})})}const kle=GD({isInternal:!1}),XD=GD({isInternal:!0});kle.displayName="SimpleBezierEdge";XD.displayName="SimpleBezierEdgeInternal";function QD(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=De.Bottom,targetPosition:m=De.Top,markerEnd:b,markerStart:w,pathOptions:g,interactionWidth:E})=>{const[y,_,k]=z1({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:m,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),T=e.isInternal?void 0:t;return c.jsx(Km,{id:T,path:y,labelX:_,labelY:k,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:w,interactionWidth:E})})}const ZD=QD({isInternal:!1}),JD=QD({isInternal:!0});ZD.displayName="SmoothStepEdge";JD.displayName="SmoothStepEdgeInternal";function eP(e){return v.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return c.jsx(ZD,{...n,id:r,pathOptions:v.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Nle=eP({isInternal:!1}),tP=eP({isInternal:!0});Nle.displayName="StepEdge";tP.displayName="StepEdgeInternal";function nP(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})=>{const[w,g,E]=pD({sourceX:n,sourceY:r,targetX:s,targetY:i}),y=e.isInternal?void 0:t;return c.jsx(Km,{id:y,path:w,labelX:g,labelY:E,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:b})})}const Sle=nP({isInternal:!1}),rP=nP({isInternal:!0});Sle.displayName="StraightEdge";rP.displayName="StraightEdgeInternal";function sP(e){return v.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=De.Bottom,targetPosition:o=De.Top,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:w,pathOptions:g,interactionWidth:E})=>{const[y,_,k]=fD({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:g==null?void 0:g.curvature}),T=e.isInternal?void 0:t;return c.jsx(Km,{id:T,path:y,labelX:_,labelY:k,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:b,markerStart:w,interactionWidth:E})})}const Ale=sP({isInternal:!1}),iP=sP({isInternal:!0});Ale.displayName="BezierEdge";iP.displayName="BezierEdgeInternal";const cS={default:iP,straight:rP,step:tP,smoothstep:JD,simplebezier:XD},uS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Cle=(e,t,n)=>n===De.Left?e-t:n===De.Right?e+t:e,Ile=(e,t,n)=>n===De.Top?e-t:n===De.Bottom?e+t:e,dS="react-flow__edgeupdater";function fS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return c.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:En([dS,`${dS}-${o}`]),cx:Cle(t,r,e),cy:Ile(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Rle({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:l,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=Gt(),b=(_,k)=>{if(_.button!==0)return;const{autoPanOnConnect:T,domNode:C,connectionMode:N,connectionRadius:R,lib:I,onConnectStart:M,cancelConnection:B,nodeLookup:Y,rfId:P,panBy:U,updateConnection:A}=m.getState(),L=k.type==="target",O=(H,V)=>{h(!1),f==null||f(H,n,k.type,V)},j=H=>u==null?void 0:u(n,H),S=(H,V)=>{h(!0),d==null||d(_,n,k.type),M==null||M(H,V)};Y1.onPointerDown(_.nativeEvent,{autoPanOnConnect:T,connectionMode:N,connectionRadius:R,domNode:C,handleId:k.id,nodeId:k.nodeId,nodeLookup:Y,isTarget:L,edgeUpdaterType:k.type,lib:I,flowId:P,cancelConnection:B,panBy:U,isValidConnection:(...H)=>{var V,D;return((D=(V=m.getState()).isValidConnection)==null?void 0:D.call(V,...H))??!0},onConnect:j,onConnectStart:S,onConnectEnd:(...H)=>{var V,D;return(D=(V=m.getState()).onConnectEnd)==null?void 0:D.call(V,...H)},onReconnectEnd:O,updateConnection:A,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},w=_=>b(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=_=>b(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>p(!0),y=()=>p(!1);return c.jsxs(c.Fragment,{children:[(e===!0||e==="source")&&c.jsx(fS,{position:o,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:E,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&c.jsx(fS,{position:l,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:E,onMouseOut:y,type:"target"})]})}function Ole({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:b,noPanClassName:w,onError:g,disableKeyboardA11y:E}){let y=ft(Z=>Z.edgeLookup.get(e));const _=ft(Z=>Z.defaultEdgeOptions);y=_?{..._,...y}:y;let k=y.type||"default",T=(b==null?void 0:b[k])||cS[k];T===void 0&&(g==null||g("011",ps.error011(k)),k="default",T=(b==null?void 0:b.default)||cS.default);const C=!!(y.focusable||t&&typeof y.focusable>"u"),N=typeof f<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),R=!!(y.selectable||r&&typeof y.selectable>"u"),I=v.useRef(null),[M,B]=v.useState(!1),[Y,P]=v.useState(!1),U=Gt(),{zIndex:A,sourceX:L,sourceY:O,targetX:j,targetY:S,sourcePosition:H,targetPosition:V}=ft(v.useCallback(Z=>{const ce=Z.nodeLookup.get(y.source),Ce=Z.nodeLookup.get(y.target);if(!ce||!Ce)return{zIndex:y.zIndex,...uS};const Ee=cae({id:e,sourceNode:ce,targetNode:Ce,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:Z.connectionMode,onError:g});return{zIndex:tae({selected:y.selected,zIndex:y.zIndex,sourceNode:ce,targetNode:Ce,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode}),...Ee||uS}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),qt),D=v.useMemo(()=>y.markerStart?`url('#${V1(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=v.useMemo(()=>y.markerEnd?`url('#${V1(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||L===null||O===null||j===null||S===null)return null;const J=Z=>{var ge;const{addSelectedEdges:ce,unselectNodesAndEdges:Ce,multiSelectionActive:Ee}=U.getState();R&&(U.setState({nodesSelectionActive:!1}),y.selected&&Ee?(Ce({nodes:[],edges:[y]}),(ge=I.current)==null||ge.blur()):ce([e])),s&&s(Z,y)},re=i?Z=>{i(Z,{...y})}:void 0,de=a?Z=>{a(Z,{...y})}:void 0,G=o?Z=>{o(Z,{...y})}:void 0,W=l?Z=>{l(Z,{...y})}:void 0,ae=u?Z=>{u(Z,{...y})}:void 0,he=Z=>{var ce;if(!E&&Q3.includes(Z.key)&&R){const{unselectNodesAndEdges:Ce,addSelectedEdges:Ee}=U.getState();Z.key==="Escape"?((ce=I.current)==null||ce.blur(),Ce({edges:[y]})):Ee([e])}};return c.jsx("svg",{style:{zIndex:A},children:c.jsxs("g",{className:En(["react-flow__edge",`react-flow__edge-${k}`,y.className,w,{selected:y.selected,animated:y.animated,inactive:!R&&!s,updating:M,selectable:R}]),onClick:J,onDoubleClick:re,onContextMenu:de,onMouseEnter:G,onMouseMove:W,onMouseLeave:ae,onKeyDown:C?he:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${LD}-${m}`:void 0,ref:I,...y.domAttributes,children:[!Y&&c.jsx(T,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:R,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:L,sourceY:O,targetX:j,targetY:S,sourcePosition:H,targetPosition:V,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:D,markerEnd:ne,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),N&&c.jsx(Rle,{edge:y,isReconnectable:N,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:L,sourceY:O,targetX:j,targetY:S,sourcePosition:H,targetPosition:V,setUpdateHover:B,setReconnecting:P})]})})}var Lle=v.memo(Ole);const Mle=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function aP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:b}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:E,onError:y}=ft(Mle,qt),_=ble(t);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx(_le,{defaultColor:e,rfId:n}),_.map(k=>c.jsx(Lle,{id:k,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:E,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:b},k))]})}aP.displayName="EdgeRenderer";const Dle=v.memo(aP),Ple=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function jle({children:e}){const t=ft(Ple);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Ble(e){const t=Zx(),n=v.useRef(!1);v.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Fle=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Ule(e){const t=ft(Fle),n=Gt();return v.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function $le(e){return e.connection.inProgress?{...e.connection,to:Xl(e.connection.to,e.transform)}:{...e.connection}}function Hle(e){return $le}function zle(e){const t=Hle();return ft(t,qt)}const Vle=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Kle({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:l}=ft(Vle,qt);return!(i&&s&&l)?null:c.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:En(["react-flow__connection",eD(o)]),children:c.jsx(oP,{style:t,type:n,CustomComponent:r,isValid:o})})})}const oP=({style:e,type:t=Ai.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:l,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=zle();if(!s)return;if(n)return c.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:h,connectionStatus:eD(r),toNode:d,toHandle:f,pointer:p});let m="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Ai.Bezier:[m]=fD(b);break;case Ai.SimpleBezier:[m]=qD(b);break;case Ai.Step:[m]=z1({...b,borderRadius:0});break;case Ai.SmoothStep:[m]=z1(b);break;default:[m]=pD(b)}return c.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};oP.displayName="ConnectionLine";const Yle={};function hS(e=Yle){v.useRef(e),Gt(),v.useEffect(()=>{},[e])}function Wle(){Gt(),v.useRef(!1),v.useEffect(()=>{},[])}function lP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:E,selectionOnDrag:y,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:T,zoomActivationKeyCode:C,deleteKeyCode:N,onlyRenderVisibleElements:R,elementsSelectable:I,defaultViewport:M,translateExtent:B,minZoom:Y,maxZoom:P,preventScrolling:U,defaultMarkerColor:A,zoomOnScroll:L,zoomOnPinch:O,panOnScroll:j,panOnScrollSpeed:S,panOnScrollMode:H,zoomOnDoubleClick:V,panOnDrag:D,autoPanOnSelection:ne,onPaneClick:J,onPaneMouseEnter:re,onPaneMouseMove:de,onPaneMouseLeave:G,onPaneScroll:W,onPaneContextMenu:ae,paneClickDistance:he,nodeClickDistance:Z,onEdgeContextMenu:ce,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ee,onEdgeMouseLeave:ge,reconnectRadius:Me,onReconnect:ve,onReconnectStart:$e,onReconnectEnd:Re,noDragClassName:oe,noWheelClassName:_t,noPanClassName:we,disableKeyboardA11y:Tt,nodeExtent:ct,rfId:K,viewport:X,onViewportChange:le}){return hS(e),hS(t),Wle(),Ble(n),Ule(X),c.jsx(lle,{onPaneClick:J,onPaneMouseEnter:re,onPaneMouseMove:de,onPaneMouseLeave:G,onPaneContextMenu:ae,onPaneScroll:W,paneClickDistance:he,deleteKeyCode:N,selectionKeyCode:E,selectionOnDrag:y,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:k,panActivationKeyCode:T,zoomActivationKeyCode:C,elementsSelectable:I,zoomOnScroll:L,zoomOnPinch:O,zoomOnDoubleClick:V,panOnScroll:j,panOnScrollSpeed:S,panOnScrollMode:H,panOnDrag:D,autoPanOnSelection:ne,defaultViewport:M,translateExtent:B,minZoom:Y,maxZoom:P,onSelectionContextMenu:f,preventScrolling:U,noDragClassName:oe,noWheelClassName:_t,noPanClassName:we,disableKeyboardA11y:Tt,onViewportChange:le,isControlledViewport:!!X,children:c.jsxs(jle,{children:[c.jsx(Dle,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:ve,onReconnectStart:$e,onReconnectEnd:Re,onlyRenderVisibleElements:R,onEdgeContextMenu:ce,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ee,onEdgeMouseLeave:ge,reconnectRadius:Me,defaultMarkerColor:A,noPanClassName:we,disableKeyboardA11y:Tt,rfId:K}),c.jsx(Kle,{style:b,type:m,component:w,containerStyle:g}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(yle,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:R,noPanClassName:we,noDragClassName:oe,disableKeyboardA11y:Tt,nodeExtent:ct,rfId:K}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}lP.displayName="GraphView";const qle=v.memo(lP),Gle=iD(),pS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,b=new Map,w=new Map,g=r??t??[],E=n??e??[],y=d??[0,0],_=f??Wu;yD(b,w,g);const{nodesInitialized:k}=K1(E,p,m,{nodeOrigin:y,nodeExtent:_,zIndexMode:h});let T=[0,0,1];if(a&&s&&i){const C=Ld(p,{filter:M=>!!((M.width||M.initialWidth)&&(M.height||M.initialHeight))}),{x:N,y:R,zoom:I}=Kx(C,s,i,l,u,(o==null?void 0:o.padding)??.1);T=[N,R,I]}return{rfId:"1",width:s??0,height:i??0,transform:T,nodes:E,nodesInitialized:k,nodeLookup:p,parentLookup:m,edges:g,edgeLookup:w,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:Wu,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:kl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...J3},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Gle,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Z3,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Xle=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>foe((p,m)=>{async function b(){const{nodeLookup:w,panZoom:g,fitViewOptions:E,fitViewResolver:y,width:_,height:k,minZoom:T,maxZoom:C}=m();g&&(await qie({nodes:w,width:_,height:k,panZoom:g,minZoom:T,maxZoom:C},E),y==null||y.resolve(!0),p({fitViewResolver:null}))}return{...pS({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:w=>{const{nodeLookup:g,parentLookup:E,nodeOrigin:y,elevateNodesOnSelect:_,fitViewQueued:k,zIndexMode:T,nodesSelectionActive:C}=m(),{nodesInitialized:N,hasSelectedNodes:R}=K1(w,g,E,{nodeOrigin:y,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:T}),I=C&&R;k&&N?(b(),p({nodes:w,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):p({nodes:w,nodesInitialized:N,nodesSelectionActive:I})},setEdges:w=>{const{connectionLookup:g,edgeLookup:E}=m();yD(g,E,w),p({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:E}=m();E(w),p({hasDefaultNodes:!0})}if(g){const{setEdges:E}=m();E(g),p({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:E,parentLookup:y,domNode:_,nodeOrigin:k,nodeExtent:T,debug:C,fitViewQueued:N,zIndexMode:R}=m(),{changes:I,updatedInternals:M}=yae(w,E,y,_,k,T,R);M&&(hae(E,y,{nodeOrigin:k,nodeExtent:T,zIndexMode:R}),N?(b(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(I==null?void 0:I.length)>0&&(C&&console.log("React Flow: trigger node changes",I),g==null||g(I)))},updateNodePositions:(w,g=!1)=>{const E=[];let y=[];const{nodeLookup:_,triggerNodeChanges:k,connection:T,updateConnection:C,onNodesChangeMiddlewareMap:N}=m();for(const[R,I]of w){const M=_.get(R),B=!!(M!=null&&M.expandParent&&(M!=null&&M.parentId)&&(I!=null&&I.position)),Y={id:R,type:"position",position:B?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:g};if(M&&T.inProgress&&T.fromNode.id===M.id){const P=Xa(M,T.fromHandle,De.Left,!0);C({...T,from:P})}B&&M.parentId&&E.push({id:R,parentId:M.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),y.push(Y)}if(E.length>0){const{parentLookup:R,nodeOrigin:I}=m(),M=Qx(E,_,R,I);y.push(...M)}for(const R of N.values())y=R(y);k(y)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:E,nodes:y,hasDefaultNodes:_,debug:k}=m();if(w!=null&&w.length){if(_){const T=PD(w,y);E(T)}k&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:E,edges:y,hasDefaultEdges:_,debug:k}=m();if(w!=null&&w.length){if(_){const T=jD(w,y);E(T)}k&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:E,nodeLookup:y,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const T=w.map(C=>ga(C,!0));_(T);return}_(Vo(y,new Set([...w]),!0)),k(Vo(E))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:E,nodeLookup:y,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const T=w.map(C=>ga(C,!0));k(T);return}k(Vo(E,new Set([...w]))),_(Vo(y,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:E,nodes:y,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:T}=m(),C=w||y,N=g||E,R=[];for(const M of C){if(!M.selected)continue;const B=_.get(M.id);B&&(B.selected=!1),R.push(ga(M.id,!1))}const I=[];for(const M of N)M.selected&&I.push(ga(M.id,!1));k(R),T(I)},setMinZoom:w=>{const{panZoom:g,maxZoom:E}=m();g==null||g.setScaleExtent([w,E]),p({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:E}=m();g==null||g.setScaleExtent([E,w]),p({maxZoom:w})},setTranslateExtent:w=>{var g;(g=m().panZoom)==null||g.setTranslateExtent(w),p({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:E,triggerEdgeChanges:y,elementsSelectable:_}=m();if(!_)return;const k=g.reduce((C,N)=>N.selected?[...C,ga(N.id,!1)]:C,[]),T=w.reduce((C,N)=>N.selected?[...C,ga(N.id,!1)]:C,[]);E(k),y(T)},setNodeExtent:w=>{const{nodes:g,nodeLookup:E,parentLookup:y,nodeOrigin:_,elevateNodesOnSelect:k,nodeExtent:T,zIndexMode:C}=m();w[0][0]===T[0][0]&&w[0][1]===T[0][1]&&w[1][0]===T[1][0]&&w[1][1]===T[1][1]||(K1(g,E,y,{nodeOrigin:_,nodeExtent:w,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:C}),p({nodeExtent:w}))},panBy:w=>{const{transform:g,width:E,height:y,panZoom:_,translateExtent:k}=m();return bae({delta:w,panZoom:_,transform:g,translateExtent:k,width:E,height:y})},setCenter:async(w,g,E)=>{const{width:y,height:_,maxZoom:k,panZoom:T}=m();if(!T)return!1;const C=typeof(E==null?void 0:E.zoom)<"u"?E.zoom:k;return await T.setViewport({x:y/2-w*C,y:_/2-g*C,zoom:C},{duration:E==null?void 0:E.duration,ease:E==null?void 0:E.ease,interpolate:E==null?void 0:E.interpolate}),!0},cancelConnection:()=>{p({connection:{...J3}})},updateConnection:w=>{p({connection:w})},reset:()=>p({...pS()})}},Object.is);function cP({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:l,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=v.useState(()=>Xle({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:l,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return c.jsx(hoe,{value:m,children:c.jsx(joe,{children:p})})}function Qle({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return v.useContext(Hm)?c.jsx(c.Fragment,{children:e}):c.jsx(cP,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Zle={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Jle({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:E,onNodeMouseMove:y,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:T,onNodeDragStart:C,onNodeDrag:N,onNodeDragStop:R,onNodesDelete:I,onEdgesDelete:M,onDelete:B,onSelectionChange:Y,onSelectionDragStart:P,onSelectionDrag:U,onSelectionDragStop:A,onSelectionContextMenu:L,onSelectionStart:O,onSelectionEnd:j,onBeforeDelete:S,connectionMode:H,connectionLineType:V=Ai.Bezier,connectionLineStyle:D,connectionLineComponent:ne,connectionLineContainerStyle:J,deleteKeyCode:re="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:G=!1,selectionMode:W=qu.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:he=Qu()?"Meta":"Control",zoomActivationKeyCode:Z=Qu()?"Meta":"Control",snapToGrid:ce,snapGrid:Ce,onlyRenderVisibleElements:Ee=!1,selectNodesOnDrag:ge,nodesDraggable:Me,autoPanOnNodeFocus:ve,nodesConnectable:$e,nodesFocusable:Re,nodeOrigin:oe=MD,edgesFocusable:_t,edgesReconnectable:we,elementsSelectable:Tt=!0,defaultViewport:ct=Noe,minZoom:K=.5,maxZoom:X=2,translateExtent:le=Wu,preventScrolling:ke=!0,nodeExtent:Oe,defaultMarkerColor:ut="#b1b1b7",zoomOnScroll:We=!0,zoomOnPinch:ot=!0,panOnScroll:Xt=!1,panOnScrollSpeed:It=.5,panOnScrollMode:Ge=Ma.Free,zoomOnDoubleClick:bt=!0,panOnDrag:$t=!0,onPaneClick:Tn,onPaneMouseEnter:Ue,onPaneMouseMove:rt,onPaneMouseLeave:tt,onPaneScroll:gt,onPaneContextMenu:ue,paneClickDistance:Le=1,nodeClickDistance:Qe=0,children:on,onReconnect:ln,onReconnectStart:ie,onReconnectEnd:_e,onEdgeContextMenu:ye,onEdgeDoubleClick:Pe,onEdgeMouseEnter:He,onEdgeMouseMove:qe,onEdgeMouseLeave:yt,reconnectRadius:Rt=10,onNodesChange:Ot,onEdgesChange:mn,noDragClassName:gn="nodrag",noWheelClassName:Ht="nowheel",noPanClassName:kn="nopan",fitView:Jn,fitViewOptions:wr,connectOnClick:Dn,attributionPosition:Hn,proOptions:er,defaultEdgeOptions:vr,elevateNodesOnSelect:zt=!0,elevateEdgesOnSelect:Nn=!1,disableKeyboardA11y:Pn=!1,autoPanOnConnect:tr,autoPanOnNodeDrag:zn,autoPanOnSelection:Sn=!0,autoPanSpeed:st,connectionRadius:An,isValidConnection:jt,onError:Qt,style:Cn,id:jn,nodeDragThreshold:xn,connectionDragThreshold:te,viewport:Ne,onViewportChange:Ie,width:je,height:Et,colorMode:ht="light",debug:Zt,onScroll:xt,ariaLabelConfig:In,zIndexMode:kt="basic",...Ym},_r){const na=jn||"1",Ql=Ioe(ht),Zl=v.useCallback(Pd=>{Pd.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),xt==null||xt(Pd)},[xt]);return c.jsx("div",{"data-testid":"rf__wrapper",...Ym,onScroll:Zl,style:{...Cn,...Zle},ref:_r,className:En(["react-flow",s,Ql]),id:jn,role:"application",children:c.jsxs(Qle,{nodes:e,edges:t,width:je,height:Et,fitView:Jn,fitViewOptions:wr,minZoom:K,maxZoom:X,nodeOrigin:oe,nodeExtent:Oe,zIndexMode:kt,children:[c.jsx(Coe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:b,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:Me,autoPanOnNodeFocus:ve,nodesConnectable:$e,nodesFocusable:Re,edgesFocusable:_t,edgesReconnectable:we,elementsSelectable:Tt,elevateNodesOnSelect:zt,elevateEdgesOnSelect:Nn,minZoom:K,maxZoom:X,nodeExtent:Oe,onNodesChange:Ot,onEdgesChange:mn,snapToGrid:ce,snapGrid:Ce,connectionMode:H,translateExtent:le,connectOnClick:Dn,defaultEdgeOptions:vr,fitView:Jn,fitViewOptions:wr,onNodesDelete:I,onEdgesDelete:M,onDelete:B,onNodeDragStart:C,onNodeDrag:N,onNodeDragStop:R,onSelectionDrag:U,onSelectionDragStart:P,onSelectionDragStop:A,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:kn,nodeOrigin:oe,rfId:na,autoPanOnConnect:tr,autoPanOnNodeDrag:zn,autoPanSpeed:st,onError:Qt,connectionRadius:An,isValidConnection:jt,selectNodesOnDrag:ge,nodeDragThreshold:xn,connectionDragThreshold:te,onBeforeDelete:S,debug:Zt,ariaLabelConfig:In,zIndexMode:kt}),c.jsx(qle,{onInit:u,onNodeClick:o,onEdgeClick:l,onNodeMouseEnter:E,onNodeMouseMove:y,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:T,nodeTypes:i,edgeTypes:a,connectionLineType:V,connectionLineStyle:D,connectionLineComponent:ne,connectionLineContainerStyle:J,selectionKeyCode:de,selectionOnDrag:G,selectionMode:W,deleteKeyCode:re,multiSelectionKeyCode:he,panActivationKeyCode:ae,zoomActivationKeyCode:Z,onlyRenderVisibleElements:Ee,defaultViewport:ct,translateExtent:le,minZoom:K,maxZoom:X,preventScrolling:ke,zoomOnScroll:We,zoomOnPinch:ot,zoomOnDoubleClick:bt,panOnScroll:Xt,panOnScrollSpeed:It,panOnScrollMode:Ge,panOnDrag:$t,autoPanOnSelection:Sn,onPaneClick:Tn,onPaneMouseEnter:Ue,onPaneMouseMove:rt,onPaneMouseLeave:tt,onPaneScroll:gt,onPaneContextMenu:ue,paneClickDistance:Le,nodeClickDistance:Qe,onSelectionContextMenu:L,onSelectionStart:O,onSelectionEnd:j,onReconnect:ln,onReconnectStart:ie,onReconnectEnd:_e,onEdgeContextMenu:ye,onEdgeDoubleClick:Pe,onEdgeMouseEnter:He,onEdgeMouseMove:qe,onEdgeMouseLeave:yt,reconnectRadius:Rt,defaultMarkerColor:ut,noDragClassName:gn,noWheelClassName:Ht,noPanClassName:kn,rfId:na,disableKeyboardA11y:Pn,nodeExtent:Oe,viewport:Ne,onViewportChange:Ie}),c.jsx(koe,{onSelectionChange:Y}),on,c.jsx(xoe,{proOptions:er,position:Hn}),c.jsx(Eoe,{rfId:na,disableKeyboardA11y:Pn})]})})}var ece=FD(Jle);function tce(e){const[t,n]=v.useState(e),r=v.useCallback(s=>n(i=>PD(s,i)),[]);return[t,n,r]}function nce(e){const[t,n]=v.useState(e),r=v.useCallback(s=>n(i=>jD(s,i)),[]);return[t,n,r]}function rce({dimensions:e,lineWidth:t,variant:n,className:r}){return c.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:En(["react-flow__background-pattern",n,r])})}function sce({radius:e,className:t}){return c.jsx("circle",{cx:e,cy:e,r:e,className:En(["react-flow__background-pattern","dots",t])})}var Vi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Vi||(Vi={}));const ice={[Vi.Dots]:1,[Vi.Lines]:1,[Vi.Cross]:6},ace=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function uP({id:e,variant:t=Vi.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:l,className:u,patternClassName:d}){const f=v.useRef(null),{transform:h,patternId:p}=ft(ace,qt),m=r||ice[t],b=t===Vi.Dots,w=t===Vi.Cross,g=Array.isArray(n)?n:[n,n],E=[g[0]*h[2]||1,g[1]*h[2]||1],y=m*h[2],_=Array.isArray(i)?i:[i,i],k=w?[y,y]:E,T=[_[0]*h[2]||1+k[0]/2,_[1]*h[2]||1+k[1]/2],C=`${p}${e||""}`;return c.jsxs("svg",{className:En(["react-flow__background",u]),style:{...l,...Vm,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[c.jsx("pattern",{id:C,x:h[0]%E[0],y:h[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:b?c.jsx(sce,{radius:y/2,className:d}):c.jsx(rce,{dimensions:k,lineWidth:s,variant:t,className:d})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}uP.displayName="Background";const oce=v.memo(uP);function lce(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function cce(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function uce(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function dce(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function fce(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function zf({children:e,className:t,...n}){return c.jsx("button",{type:"button",className:En(["react-flow__controls-button",t]),...n,children:e})}const hce=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function dP({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:l,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=Gt(),{isInteractive:b,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:E}=ft(hce,qt),{zoomIn:y,zoomOut:_,fitView:k}=Zx(),T=()=>{y(),i==null||i()},C=()=>{_(),a==null||a()},N=()=>{k(s),o==null||o()},R=()=>{m.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),l==null||l(!b)},I=h==="horizontal"?"horizontal":"vertical";return c.jsxs(zm,{className:En(["react-flow__controls",I,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??E["controls.ariaLabel"],children:[t&&c.jsxs(c.Fragment,{children:[c.jsx(zf,{onClick:T,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:g,children:c.jsx(lce,{})}),c.jsx(zf,{onClick:C,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:w,children:c.jsx(cce,{})})]}),n&&c.jsx(zf,{className:"react-flow__controls-fitview",onClick:N,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:c.jsx(uce,{})}),r&&c.jsx(zf,{className:"react-flow__controls-interactive",onClick:R,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:b?c.jsx(fce,{}):c.jsx(dce,{})}),d]})}dP.displayName="Controls";const pce=v.memo(dP);function mce({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:l,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:b}=i||{},w=a||m||b;return c.jsx("rect",{className:En(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:w,stroke:o,strokeWidth:l},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const gce=v.memo(mce),yce=e=>e.nodes.map(t=>t.id),L0=e=>e instanceof Function?e:()=>e;function bce({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=gce,onClick:a}){const o=ft(yce,qt),l=L0(t),u=L0(e),d=L0(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:o.map(h=>c.jsx(xce,{id:h,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},h))})}function Ece({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:l}){const{node:u,x:d,y:f,width:h,height:p}=ft(m=>{const b=m.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const w=b.internals.userNode,{x:g,y:E}=b.internals.positionAbsolute,{width:y,height:_}=fi(w);return{node:w,x:g,y:E,width:y,height:_}},qt);return!u||u.hidden||!aD(u)?null:c.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:l,id:u.id})}const xce=v.memo(Ece);var wce=v.memo(bce);const vce=200,_ce=150,Tce=e=>!e.hidden,kce=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?sD(Ld(e.nodeLookup,{filter:Tce}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Nce="react-flow__minimap-desc";function fP({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:l,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:b=!1,zoomable:w=!1,ariaLabel:g,inversePan:E,zoomStep:y=1,offsetScale:_=5}){const k=Gt(),T=v.useRef(null),{boundingRect:C,viewBB:N,rfId:R,panZoom:I,translateExtent:M,flowWidth:B,flowHeight:Y,ariaLabelConfig:P}=ft(kce,qt),U=(e==null?void 0:e.width)??vce,A=(e==null?void 0:e.height)??_ce,L=C.width/U,O=C.height/A,j=Math.max(L,O),S=j*U,H=j*A,V=_*j,D=C.x-(S-C.width)/2-V,ne=C.y-(H-C.height)/2-V,J=S+V*2,re=H+V*2,de=`${Nce}-${R}`,G=v.useRef(0),W=v.useRef();G.current=j,v.useEffect(()=>{if(T.current&&I)return W.current=Sae({domNode:T.current,panZoom:I,getTransform:()=>k.getState().transform,getViewScale:()=>G.current}),()=>{var ce;(ce=W.current)==null||ce.destroy()}},[I]),v.useEffect(()=>{var ce;(ce=W.current)==null||ce.update({translateExtent:M,width:B,height:Y,inversePan:E,pannable:b,zoomStep:y,zoomable:w})},[b,w,E,y,M,B,Y]);const ae=p?ce=>{var ge;const[Ce,Ee]=((ge=W.current)==null?void 0:ge.pointer(ce))||[0,0];p(ce,{x:Ce,y:Ee})}:void 0,he=m?v.useCallback((ce,Ce)=>{const Ee=k.getState().nodeLookup.get(Ce).internals.userNode;m(ce,Ee)},[]):void 0,Z=g??P["minimap.ariaLabel"];return c.jsx(zm,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*j:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:En(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:U,height:A,viewBox:`${D} ${ne} ${J} ${re}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:T,onClick:ae,children:[Z&&c.jsx("title",{id:de,children:Z}),c.jsx(wce,{onClick:he,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${D-V},${ne-V}h${J+V*2}v${re+V*2}h${-J-V*2}z + M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}fP.displayName="MiniMap";const Sce=v.memo(fP),Ace=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Cce={[Cl.Line]:"right",[Cl.Handle]:"bottom-right"};function Ice({nodeId:e,position:t,variant:n=Cl.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:b,onResize:w,onResizeEnd:g}){const E=zD(),y=typeof e=="string"?e:E,_=Gt(),k=v.useRef(null),T=n===Cl.Handle,C=ft(v.useCallback(Ace(T&&p),[T,p]),qt),N=v.useRef(null),R=t??Cce[n];v.useEffect(()=>{if(!(!k.current||!y))return N.current||(N.current=Uae({domNode:k.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:M,transform:B,snapGrid:Y,snapToGrid:P,nodeOrigin:U,domNode:A}=_.getState();return{nodeLookup:M,transform:B,snapGrid:Y,snapToGrid:P,nodeOrigin:U,paneDomNode:A}},onChange:(M,B)=>{const{triggerNodeChanges:Y,nodeLookup:P,parentLookup:U,nodeOrigin:A}=_.getState(),L=[],O={x:M.x,y:M.y},j=P.get(y);if(j&&j.expandParent&&j.parentId){const S=j.origin??A,H=M.width??j.measured.width??0,V=M.height??j.measured.height??0,D={id:j.id,parentId:j.parentId,rect:{width:H,height:V,...oD({x:M.x??j.position.x,y:M.y??j.position.y},{width:H,height:V},j.parentId,P,S)}},ne=Qx([D],P,U,A);L.push(...ne),O.x=M.x?Math.max(S[0]*H,M.x):void 0,O.y=M.y?Math.max(S[1]*V,M.y):void 0}if(O.x!==void 0&&O.y!==void 0){const S={id:y,type:"position",position:{...O}};L.push(S)}if(M.width!==void 0&&M.height!==void 0){const H={id:y,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};L.push(H)}for(const S of B){const H={...S,type:"position"};L.push(H)}Y(L)},onEnd:({width:M,height:B})=>{const Y={id:y,type:"dimensions",resizing:!1,dimensions:{width:M,height:B}};_.getState().triggerNodeChanges([Y])}})),N.current.update({controlPosition:R,boundaries:{minWidth:o,minHeight:l,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:w,onResizeEnd:g,shouldResize:m}),()=>{var M;(M=N.current)==null||M.destroy()}},[R,o,l,u,d,f,b,w,g,m]);const I=R.split("-");return c.jsx("div",{className:En(["react-flow__resize-control","nodrag",...I,n,r]),ref:k,style:{...s,scale:C,...a&&{[T?"backgroundColor":"borderColor"]:a}},children:i})}v.memo(Ice);const Rce=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:_F},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:nF},{type:"loop",label:"循环",desc:"节点循环执行",Icon:AE}];let q1=0;function M0(){return q1+=1,`node_${q1}`}function D0(e,t,n){const r=Gi();return{id:e,type:"agentNode",position:t,data:{agent:{...r,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function Oce({data:e,selected:t}){const n=e.agent;return c.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[c.jsx(Rl,{type:"target",position:De.Left,className:"wfb-handle"}),c.jsx("div",{className:"wfb-node-icon",children:c.jsx($a,{className:"icon"})}),c.jsxs("div",{className:"wfb-node-body",children:[c.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),c.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),c.jsx(Rl,{type:"source",position:De.Right,className:"wfb-handle"})]})}const Lce={agentNode:Oce},mS={type:"smoothstep",markerEnd:{type:Gu.ArrowClosed,width:16,height:16}};function Mce({onBack:e,onCreate:t}){const n=v.useRef(null),[r,s]=v.useState(""),[i,a]=v.useState(""),[o,l]=v.useState("sequential"),u=v.useMemo(()=>{q1=0;const A=M0();return D0(A,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=tce([u]),[p,m,b]=nce([]),[w,g]=v.useState(u.id),E=d.find(A=>A.id===w)??null,y=r.trim()||"workflow_agent",_=v.useMemo(()=>u3({name:y,subAgents:d.map(A=>A.data.agent)}),[y,d]),k=tl(y)??(_.has(y)?"名称须与 Agent 节点名称保持唯一":null),T=E?tl(E.data.agent.name)??(_.has(E.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,C=d.length>0&&k===null&&d.every(A=>tl(A.data.agent.name)===null&&!_.has(A.data.agent.name)),N=v.useCallback(A=>m(L=>BD({...A,...mS},L)),[m]),R=v.useCallback(()=>{const A=M0(),L=d.length*28,O=D0(A,{x:80+L,y:120+L});f(j=>j.concat(O)),g(A)},[d.length,f]),I=A=>{A.dataTransfer.setData("application/wfb-node","agentNode"),A.dataTransfer.effectAllowed="move"},M=v.useCallback(A=>{A.preventDefault(),A.dataTransfer.dropEffect="move"},[]),B=v.useCallback(A=>{if(A.preventDefault(),A.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const O=n.current.screenToFlowPosition({x:A.clientX,y:A.clientY}),j=M0(),S=D0(j,O);f(H=>H.concat(S)),g(j)},[f]),Y=v.useCallback(A=>{w&&f(L=>L.map(O=>O.id===w?{...O,data:{...O.data,agent:{...O.data.agent,...A}}}:O))},[w,f]),P=v.useCallback(()=>{w&&(f(A=>A.filter(L=>L.id!==w)),m(A=>A.filter(L=>L.source!==w&&L.target!==w)),g(null))},[w,f,m]),U=v.useCallback(()=>{if(!C)return;const A=d.map(O=>O.data.agent),L={...Gi(),name:y,description:i.trim(),instruction:i.trim(),subAgents:A,workflow:{type:o,nodes:d.map(O=>({id:O.id,agent:O.data.agent})),edges:p.map(O=>({from:O.source,to:O.target}))}};t(L)},[C,d,p,y,i,o,t]);return c.jsx("div",{className:"wfb",children:c.jsxs("div",{className:"wfb-grid",children:[c.jsxs("aside",{className:"wfb-palette",children:[c.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"名称"}),c.jsx("input",{className:`wfb-input ${k?"wfb-input--error":""}`,value:r,onChange:A=>s(A.target.value),placeholder:"my_workflow"}),k&&c.jsx("span",{className:"wfb-field-error",children:k})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"描述"}),c.jsx("textarea",{className:"wfb-input wfb-textarea",value:i,onChange:A=>a(A.target.value),placeholder:"这个工作流做什么…",rows:2})]}),c.jsx("div",{className:"wfb-section-label",children:"执行方式"}),c.jsx("div",{className:"wfb-types",children:Rce.map(({type:A,label:L,desc:O,Icon:j})=>c.jsxs("button",{type:"button",className:`wfb-type ${o===A?"wfb-type--active":""}`,onClick:()=>l(A),children:[c.jsx(j,{className:"icon"}),c.jsxs("span",{className:"wfb-type-text",children:[c.jsx("span",{className:"wfb-type-name",children:L}),c.jsx("span",{className:"wfb-type-desc",children:O})]})]},A))}),c.jsx("div",{className:"wfb-section-label",children:"节点"}),c.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:I,title:"拖拽到画布,或点击下方按钮添加",children:[c.jsx(bF,{className:"icon wfb-grip"}),c.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:c.jsx($a,{className:"icon"})}),c.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),c.jsxs("button",{className:"wfb-add",type:"button",onClick:R,children:[c.jsx(hs,{className:"icon"}),"添加节点"]}),c.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),c.jsxs("div",{className:"wfb-canvas",children:[c.jsxs("button",{className:"wfb-create",onClick:U,disabled:!C,type:"button",children:[c.jsx(Ha,{className:"icon"}),"创建工作流"]}),c.jsxs(ece,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:b,onConnect:N,onInit:A=>n.current=A,nodeTypes:Lce,defaultEdgeOptions:mS,onDrop:B,onDragOver:M,onNodeClick:(A,L)=>g(L.id),onPaneClick:()=>g(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[c.jsx(oce,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),c.jsx(pce,{showInteractive:!1}),c.jsx(Sce,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),c.jsx("aside",{className:"wfb-inspector",children:E?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"wfb-inspector-head",children:[c.jsx("div",{className:"wfb-section-label",children:"节点配置"}),c.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:P,title:"删除节点",children:c.jsx(jl,{className:"icon"})})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"名称"}),c.jsx("input",{className:`wfb-input ${T?"wfb-input--error":""}`,value:E.data.agent.name,onChange:A=>Y({name:A.target.value}),placeholder:"agent_name"}),T?c.jsx("span",{className:"wfb-field-error",children:T}):c.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"描述"}),c.jsx("input",{className:"wfb-input",value:E.data.agent.description,onChange:A=>Y({description:A.target.value}),placeholder:"这个 agent 做什么…"})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),c.jsx("textarea",{className:"wfb-input wfb-textarea",value:E.data.agent.instruction,onChange:A=>Y({instruction:A.target.value}),placeholder:"你是一个…",rows:6})]}),c.jsxs("label",{className:"wfb-field",children:[c.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),c.jsx("input",{className:"wfb-input",value:E.data.agent.tools.join(", "),onChange:A=>Y({tools:A.target.value.split(",").map(L=>L.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),c.jsxs("div",{className:"wfb-inspector-meta",children:[c.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),c.jsx("code",{className:"wfb-meta-val",children:E.id})]})]}):c.jsxs("div",{className:"wfb-inspector-empty",children:[c.jsx($a,{className:"wfb-empty-icon"}),c.jsx("p",{children:"选择一个节点以编辑其配置"}),c.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function Dce(e){return c.jsx(cP,{children:c.jsx(Mce,{...e})})}const Pce="/web/skill-creator";class ew extends Error{constructor(n,r){super(n);cw(this,"status");this.name="SkillCreatorApiError",this.status=r}}function io(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function Kt(e,...t){for(const n of t){const r=e[n];if(typeof r=="string"&&r)return r}}function hP(e,...t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}async function Dd(e,t){return fetch(Os(`${Pce}${e}`),{...t,headers:um({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function tw(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=io(await e.json(),"错误响应");return Kt(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function nw(e,t){if(!e.ok)throw new ew(await tw(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function jce(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function Bce(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function Fce(e){return Array.isArray(e)?e.map((t,n)=>{const r=io(t,`文件 ${n+1}`),s=Kt(r,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const i=hP(r,"size");if(i===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:i}}):[]}function Uce(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],r=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:r}}function $ce(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const r=io(t,`活动 ${n+1}`),s=Kt(r,"id"),i=Kt(r,"kind"),a=Kt(r,"status");if(!s||!i||!["status","thinking","tool","message"].includes(i))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(i==="tool"){const l=Kt(r,"name");if(!l)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:i,name:l,args:r.input,response:r.output,status:a}}const o=Kt(r,"text");if(!o)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:i,text:o,status:a}})}function Hce(e,t){const n=io(e,`候选方案 ${t+1}`),r=Kt(n,"id","candidate_id","candidateId"),s=Kt(n,"model","model_id","modelId");if(!r||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:r,model:s,modelLabel:Kt(n,"modelLabel","model_label")??s,status:jce(n.status),stage:Bce(n.stage),name:Kt(n,"name","skill_name","skillName"),description:Kt(n,"description"),skillMd:Kt(n,"skillMd","skill_md"),files:Fce(n.files),activities:$ce(n.activities),validation:Uce(n.validation),durationMs:hP(n,"elapsedMs","elapsed_ms"),error:Kt(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:Kt(n,"skill_id","skillId"),version:Kt(n,"version")}}function G1(e,t=""){const n=io(e,"Skill 创建任务"),r=Kt(n,"id","job_id","jobId");if(!r)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(Hce):[],i=Kt(n,"status")??"running";if(i!=="provisioning"&&i!=="running"&&i!=="completed")throw new Error(`未知的 Skill 任务状态:${i}`);return{id:r,prompt:Kt(n,"prompt")??t,status:i,candidates:s}}async function zce(e,t){const n=await Dd("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new ew(await tw(n,"创建 Skill 任务失败"),n.status);const r=n.headers.get("content-type")??"";if(r.includes("application/json")){const u=G1(await n.json(),e);return t==null||t(u),u}if(!r.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),i=new TextDecoder;let a="",o;const l=u=>{if(!u.trim())return;const d=io(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(Kt(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");o=G1(d.job,e),t==null||t(o)};for(;;){const{done:u,value:d}=await s.read();a+=i.decode(d,{stream:!u});const f=a.split(` +`);if(a=f.pop()??"",f.forEach(l),u)break}if(l(a),!o)throw new Error("创建 Skill 任务失败:服务端未返回任务");return o}async function Vce(e){const t=await Dd(`/jobs/${encodeURIComponent(e)}`);return G1(await nw(t,"读取 Skill 任务失败"))}async function Kce(e){const t=await Dd(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await nw(t,"清理 Skill 任务失败")}async function Yce(e,t){var o;const n=await Dd(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await tw(n,"下载 Skill 失败"));const s=((o=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:o[1])??"skill.zip",i=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}async function Wce(e,t,n){const r=await Dd(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=io(await nw(r,"添加到 AgentKit 失败"),"发布结果"),i=Kt(s,"skill_id","skillId","id");if(!i)throw new Error("发布结果缺少 skill_id");return{skillId:i,name:Kt(s,"name"),version:Kt(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:Kt(s,"message")}}const qce=()=>{};function Gce(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function Xce({activities:e}){const t=v.useMemo(()=>e.filter(n=>n.kind!=="status").map(Gce),[e]);return t.length===0?null:c.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:c.jsx(mx,{blocks:t,onAction:qce})})}const gS={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},yS=12e4;function Qce({status:e}){return e==="succeeded"?c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"7"}),c.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"7"}),c.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):c.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"7"}),c.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function Zce(){return c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),c.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function Jce(){return c.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function eue({candidate:e}){var l,u;const[t,n]=v.useState("SKILL.md"),r=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!r?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,i=s.find(d=>d.path===t)??s[0],a=(l=e.skillMd)==null?void 0:l.slice(0,yS),o=(((u=e.skillMd)==null?void 0:u.length)??0)>yS;return s.length===0?null:c.jsxs("div",{className:"skill-files",children:[c.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:s.map(d=>c.jsx("button",{type:"button",role:"tab","aria-selected":(i==null?void 0:i.path)===d.path,className:(i==null?void 0:i.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(i!=null&&i.path.endsWith("SKILL.md"))?c.jsxs(c.Fragment,{children:[c.jsx("pre",{className:"skill-files__content",children:c.jsx("code",{children:a})}),o?c.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):c.jsx("div",{className:"skill-files__unavailable",children:i?`${i.path} · ${i.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function tue({label:e,jobId:t,candidate:n,selected:r,publishing:s,publishDisabled:i,publishError:a,onSelect:o,onPublish:l}){const[u,d]=v.useState("conversation"),[f,h]=v.useState(!1),[p,m]=v.useState(!1),[b,w]=v.useState(""),[g,E]=v.useState(""),[y,_]=v.useState(""),[k,T]=v.useState(""),C=v.useRef(null),N=v.useRef(null),R=n.status==="queued"||n.status==="running",I=n.status==="succeeded",M=n.validation;return c.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${r?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[c.jsxs("header",{className:"skill-candidate__header",children:[c.jsx("h2",{children:n.model}),r?c.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?c.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[c.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[c.jsx("span",{className:"skill-candidate__status-icon",children:c.jsx(Qce,{status:n.status})}),R?c.jsx(Vl,{duration:2.2,spread:16,children:gS[n.stage]}):c.jsx("span",{children:gS[n.stage]}),n.durationMs!==void 0&&I?c.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),c.jsx(Xce,{activities:n.activities}),n.error?c.jsx("div",{className:"skill-candidate__error",children:n.error}):null,I?c.jsx("div",{className:"skill-candidate__view-actions",children:c.jsxs("button",{ref:C,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var B;return(B=N.current)==null?void 0:B.focus()})},children:[c.jsx(Zce,{}),"查看 Skill"]})}):null]}):c.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[c.jsx("div",{className:"skill-candidate__preview-nav",children:c.jsxs("button",{ref:N,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var B;return(B=C.current)==null?void 0:B.focus()})},children:[c.jsx(Jce,{}),"返回对话"]})}),c.jsxs("div",{className:"skill-candidate__result",children:[c.jsxs("div",{className:"skill-candidate__summary",children:[c.jsxs("div",{children:[c.jsx("span",{children:"Skill"}),c.jsx("strong",{children:n.name??"未命名 Skill"})]}),c.jsxs("div",{children:[c.jsx("span",{children:"文件"}),c.jsx("strong",{children:n.files.length})]}),c.jsxs("div",{children:[c.jsx("span",{children:"校验"}),c.jsx("strong",{className:(M==null?void 0:M.valid)===!1?"is-invalid":"is-valid",children:(M==null?void 0:M.valid)===!1?"未通过":"已通过"})]})]}),n.description?c.jsx("p",{className:"skill-candidate__description",children:n.description}):null,M&&(M.errors.length>0||M.warnings.length>0)?c.jsxs("details",{className:"skill-validation",children:[c.jsx("summary",{children:"查看校验详情"}),[...M.errors,...M.warnings].map((B,Y)=>c.jsx("div",{children:B},`${B}-${Y}`))]}):null,c.jsx(eue,{candidate:n}),c.jsxs("div",{className:"skill-candidate__actions",children:[c.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":r,onClick:o,children:r?"已采用此方案":"采用此方案"}),c.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),w(""),Yce(t,n.id).catch(B=>{w(B instanceof Error?B.message:String(B))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),c.jsx("button",{type:"button",className:"skill-action",disabled:!r||s||i||n.published,title:r?void 0:"请先采用此方案",onClick:()=>h(B=>!B),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),b?c.jsx("div",{className:"skill-candidate__error",children:b}):null,f&&r&&!n.published?c.jsxs("form",{className:"skill-publish-form",onSubmit:B=>{B.preventDefault();const Y=g.split(",").map(P=>P.trim()).filter(Boolean);l({skillSpaceIds:Y,...y.trim()?{projectName:y.trim()}:{},...k.trim()?{skillId:k.trim()}:{}})},children:[c.jsxs("label",{children:[c.jsx("span",{children:"SkillSpace ID(可选)"}),c.jsx("input",{value:g,onChange:B=>E(B.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),c.jsxs("div",{className:"skill-publish-form__optional",children:[c.jsxs("label",{children:[c.jsx("span",{children:"项目名称(可选)"}),c.jsx("input",{value:y,onChange:B=>_(B.target.value)})]}),c.jsxs("label",{children:[c.jsx("span",{children:"已有 Skill ID(可选)"}),c.jsx("input",{value:k,onChange:B=>T(B.target.value)})]})]}),c.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?c.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const bS=new Set(["completed"]),Vf=1100,nue=3e4;function rue(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function sue({initialJob:e}){const[t,n]=v.useState(e),[r,s]=v.useState(""),[i,a]=v.useState(!1),[o,l]=v.useState(),[u,d]=v.useState(),[f,h]=v.useState(()=>new Set),[p,m]=v.useState({});v.useEffect(()=>{n(e),s(""),a(!1)},[e]),v.useEffect(()=>{if(bS.has(e.status)||e.id.startsWith("pending-"))return;let g=!1,E;const y=Date.now()+nue,_=async()=>{try{const k=await Vce(e.id);g||(n({...k,prompt:k.prompt||e.prompt}),s(""),bS.has(k.status)||(E=window.setTimeout(_,Vf)))}catch(k){if(!g){const T=k instanceof ew?k:void 0;if((T==null?void 0:T.status)===404&&Date.now(){g=!0,E!==void 0&&window.clearTimeout(E)}},[e.id,e.status]);const b=gx.map((g,E)=>t.candidates.find(y=>y.model===g)??t.candidates[E]??rue(g,E));async function w(g,E){d(g.id),m(y=>({...y,[g.id]:""}));try{await Wce(t.id,g.id,E),h(y=>new Set(y).add(g.id))}catch(y){m(_=>({..._,[g.id]:y instanceof Error?y.message:String(y)}))}finally{d(void 0)}}return c.jsxs("section",{className:"skill-workspace",children:[c.jsx("header",{className:"skill-workspace__intro",children:c.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),r?c.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",r,"。",i?"":"页面会继续重试。"]}):null,c.jsx("div",{className:"skill-workspace__grid",children:b.map((g,E)=>{const _=f.has(g.id)||g.published?{...g,published:!0}:g;return c.jsx(tue,{label:`方案 ${E===0?"A":"B"}`,jobId:t.id,candidate:_,selected:o===g.id,publishing:u===g.id,publishDisabled:u!==void 0&&u!==g.id,publishError:p[g.id],onSelect:()=>l(g.id),onPublish:k=>void w(g,k)},`${g.model}-${g.id}`)})})]})}const P0="/web/sandbox/sessions",iue=33e4,aue=6e5,oue=15e3;function j0(e){const t=um(e);return t.set("Accept","application/json"),t}async function B0(e,t){let n={};try{n=await e.json()}catch{return new Error(`${t}(HTTP ${e.status})`)}const r=n.detail,s=r&&typeof r=="object"&&"message"in r?r.message:r??n.message;return new Error(typeof s=="string"&&s?s:t)}async function lue(e,t){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let s="",i="";const a=[],o=new Map;function l(){t==null||t(a.map(h=>({...h})))}function u(h){i+=h;const p=a[a.length-1];(p==null?void 0:p.kind)==="text"?p.text+=h:a.push({kind:"text",text:h}),l()}function d(h){if(typeof h.id!="string"||h.kind!=="thinking"&&h.kind!=="tool"||h.status!=="running"&&h.status!=="done")return;const p=h.status==="done";let m;if(h.kind==="thinking"){if(typeof h.text!="string"||!h.text)return;m={kind:"thinking",text:h.text,done:p}}else{if(typeof h.name!="string"||!h.name)return;m={kind:"tool",name:h.name,args:h.args,response:h.response,done:p}}const b=o.get(h.id);b===void 0?(o.set(h.id,a.length),a.push(m)):a[b]=m,l()}function f(h){let p="message";const m=[];for(const w of h.split(/\r?\n/))w.startsWith("event:")&&(p=w.slice(6).trim()),w.startsWith("data:")&&m.push(w.slice(5).trimStart());if(m.length===0)return;let b;try{b=JSON.parse(m.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(p==="error")throw new Error(typeof b.message=="string"&&b.message?b.message:"沙箱对话失败,请稍后重试。");p==="activity"&&d(b),p==="delta"&&typeof b.text=="string"&&u(b.text),p==="done"&&!i&&typeof b.text=="string"&&u(b.text)}for(;;){const{done:h,value:p}=await n.read();s+=r.decode(p,{stream:!h});const m=s.split(/\r?\n\r?\n/);if(s=m.pop()??"",m.forEach(f),h)break}if(s.trim()&&f(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:i,blocks:a}}const F0={async startSession(e={}){const t=await fetch(Os(P0),{method:"POST",headers:j0({"Content-Type":"application/json"}),signal:ti(e.signal,iue)});if(!t.ok)throw await B0(t,"无法启动 AgentKit 沙箱,请稍后重试。");const n=await t.json();if(!n.sessionId||n.status!=="ready")throw new Error("AgentKit 沙箱返回了无效的会话信息。");return{id:n.sessionId,toolName:"codex",createdAt:new Date().toISOString()}},async sendMessage(e,t={}){if(!e.sessionId||!e.text.trim())throw new Error("临时会话缺少有效的消息内容。");const n=await fetch(Os(`${P0}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:j0({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text}),signal:ti(t.signal,aue)});if(!n.ok)throw await B0(n,"沙箱对话失败,请稍后重试。");return lue(n,t.onBlocks)},async closeSession(e,t={}){if(!e)return;const n=await fetch(Os(`${P0}/${encodeURIComponent(e)}`),{method:"DELETE",headers:j0(),signal:ti(t.signal,oue)});if(!n.ok&&n.status!==404)throw await B0(n,"无法清理 AgentKit 沙箱会话。")}},cue=1e4;async function pP(e){const t=await fetch(Os(e),{headers:um({Accept:"application/json"}),signal:ti(void 0,cue)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function uue(){return pP("/web/sandbox/capabilities")}async function due(){return pP("/web/skill-creator/capabilities")}function fue(e){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[c.jsx("path",{d:"M12 3.5c.35 3.05 1.62 5.32 4.9 6.1-3.28.78-4.55 3.05-4.9 6.1-.35-3.05-1.62-5.32-4.9-6.1 3.28-.78 4.55-3.05 4.9-6.1Z"}),c.jsx("path",{d:"M18.5 14.5c.18 1.55.84 2.7 2.5 3.1-1.66.4-2.32 1.55-2.5 3.1-.18-1.55-.84-2.7-2.5-3.1 1.66-.4 2.32-1.55 2.5-3.1Z"}),c.jsx("path",{d:"M5.3 14.2c.14 1.15.62 2 1.85 2.3-1.23.3-1.71 1.15-1.85 2.3-.14-1.15-.62-2-1.85-2.3 1.23-.3 1.71-1.15 1.85-2.3Z"})]})}function hue({open:e,state:t,error:n,onCancel:r,onConfirm:s}){const i=v.useRef(null),a=v.useRef(null);if(v.useEffect(()=>{var f;if(!e)return;const u=document.body.style.overflow;document.body.style.overflow="hidden",(f=a.current)==null||f.focus();const d=h=>{var w;if(h.key==="Escape"){h.preventDefault(),r();return}if(h.key!=="Tab")return;const p=(w=i.current)==null?void 0:w.querySelectorAll("button:not(:disabled)");if(!(p!=null&&p.length))return;const m=p[0],b=p[p.length-1];h.shiftKey&&document.activeElement===m?(h.preventDefault(),b.focus()):!h.shiftKey&&document.activeElement===b&&(h.preventDefault(),m.focus())};return window.addEventListener("keydown",d),()=>{document.body.style.overflow=u,window.removeEventListener("keydown",d)}},[r,e]),!e)return null;const o=t==="loading",l=o?"正在初始化沙箱":t==="error"?"启动失败":"启用临时会话";return Ua.createPortal(c.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&!o&&r()},children:c.jsxs("section",{ref:i,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":"sandbox-dialog-description",children:[c.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[c.jsx("span",{className:"sandbox-dialog-orbit"}),c.jsx("span",{className:"sandbox-dialog-icon",children:o?c.jsx("span",{className:"sandbox-spinner"}):c.jsx(fue,{})})]}),c.jsxs("div",{className:"sandbox-dialog-copy",children:[c.jsx("h2",{id:"sandbox-dialog-title",children:l}),t==="error"?c.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:n||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):o?c.jsx("p",{id:"sandbox-dialog-description","aria-live":"polite",children:"正在寻找可用工具并创建临时 Session,通常需要一点时间。"}):c.jsx("p",{id:"sandbox-dialog-description",children:"将启动 AgentKit 沙箱与 Codex Agent 开启临时会话,您的会话将不会被持久化保存。"})]}),c.jsxs("footer",{className:"sandbox-dialog-actions",children:[c.jsx("button",{ref:a,type:"button",onClick:r,children:o?"取消启动":"取消"}),!o&&c.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t==="error"?"重新尝试":"确认开启"})]})]})}),document.body)}function pue({onExit:e}){return c.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[c.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),c.jsx("span",{className:"sandbox-session-warning-copy",children:"当前为临时会话,退出后对话内容消失"}),c.jsx("button",{type:"button",onClick:e,children:"退出临时会话"})]})}const ES=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function U0(e){let t=0;for(let n=0;n>>0;return ES[t%ES.length]}function mue(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,r=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):r.push(u);const s=(u,d)=>u.start_time-d.start_time,i=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>i(f,d+1))}),a=r.sort(s).map(u=>i(u,0)),o=e.length?Math.min(...e.map(u=>u.start_time)):0,l=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:o,total:l-o||1}}function gue(e,t){const n=[],r=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(r)};return e.forEach(r),n}function xS(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const yue=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function wS(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const r=String(n);return{key:yue(t),value:r,long:r.length>80||r.includes(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function bue({appName:e,sessionId:t,onClose:n}){const[r,s]=v.useState(null),[i,a]=v.useState(""),[o,l]=v.useState(new Set),[u,d]=v.useState(null);v.useEffect(()=>{s(null),a(""),VI(e,t).then(E=>{s(E),d(E.length?E.reduce((y,_)=>y.start_time<=_.start_time?y:_).span_id:null)}).catch(E=>a(String(E)))},[e,t]);const{rootNodes:f,min:h,total:p}=v.useMemo(()=>mue(r??[]),[r]),m=v.useMemo(()=>gue(f,o),[f,o]),b=(r==null?void 0:r.find(E=>E.span_id===u))??null,w=p/1e6,g=E=>l(y=>{const _=new Set(y);return _.has(E)?_.delete(E):_.add(E),_});return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"drawer-scrim",onClick:n}),c.jsxs("aside",{className:"drawer drawer--trace",children:[c.jsxs("header",{className:"drawer-head",children:[c.jsxs("div",{children:[c.jsx("div",{className:"drawer-title",children:"调用链路观测"}),c.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${w.toFixed(1)} ms`:"加载中"})]}),c.jsx("button",{className:"drawer-close",onClick:n,"aria-label":"关闭",children:c.jsx(Gr,{className:"icon"})})]}),r==null&&!i&&c.jsxs("div",{className:"drawer-loading",children:[c.jsx(wt,{className:"icon spin"})," 加载调用链路…"]}),i&&c.jsx("div",{className:"error",children:i}),r&&r.length===0&&c.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),m.length>0&&c.jsxs("div",{className:"trace-split",children:[c.jsx("div",{className:"trace-tree scroll",children:m.map(E=>{const y=E.span,_=(y.start_time-h)/p*100,k=Math.max((y.end_time-y.start_time)/p*100,.6),T=E.children.length>0;return c.jsxs("button",{className:`trace-row ${u===y.span_id?"active":""}`,onClick:()=>d(y.span_id),children:[c.jsxs("span",{className:"trace-label",style:{paddingLeft:E.depth*14},children:[c.jsx("span",{className:`trace-caret ${T?"":"hidden"} ${o.has(y.span_id)?"":"open"}`,onClick:C=>{C.stopPropagation(),T&&g(y.span_id)},children:c.jsx(or,{className:"chev"})}),c.jsx("span",{className:"trace-dot",style:{background:U0(y.name)}}),c.jsx("span",{className:"trace-name",title:y.name,children:y.name})]}),c.jsx("span",{className:"trace-dur",children:xS(y.end_time-y.start_time)}),c.jsx("span",{className:"trace-track",children:c.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${k}%`,background:U0(y.name)}})})]},y.span_id)})}),c.jsx("div",{className:"trace-detail scroll",children:b?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"td-title",children:b.name}),c.jsxs("div",{className:"td-dur",children:[c.jsx("span",{className:"td-dot",style:{background:U0(b.name)}}),xS(b.end_time-b.start_time)]}),c.jsx("div",{className:"td-section",children:"属性"}),c.jsx("div",{className:"td-props",children:wS(b).filter(E=>!E.long).map(E=>c.jsxs("div",{className:"td-prop",children:[c.jsx("span",{className:"td-key",children:E.key}),c.jsx("span",{className:"td-val",children:E.value})]},E.key))}),wS(b).filter(E=>E.long).map(E=>c.jsxs("div",{className:"td-block",children:[c.jsx("div",{className:"td-section",children:E.key}),c.jsx("pre",{className:"td-pre",children:E.value})]},E.key))]}):c.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}function Eue(e){return e.toLowerCase()==="github"?c.jsx(yF,{className:"icon"}):c.jsx(kF,{className:"icon"})}function xue({branding:e,onUsername:t}){const[n,r]=v.useState(null),[s,i]=v.useState(""),[a,o]=v.useState(0),[l,u]=v.useState("");v.useEffect(()=>{let h=!0;return r(null),i(""),WF().then(p=>{h&&r(p)}).catch(p=>{h&&i(p instanceof Error?p.message:String(p))}),()=>{h=!1}},[a]);const d=KF.test(l),f=()=>{d&&t(l)};return c.jsxs("div",{className:"login",children:[c.jsx("header",{className:"login-top",children:c.jsxs("span",{className:"login-brand",children:[c.jsx("img",{className:"login-brand-logo",src:e.logoUrl||ux,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),c.jsx("main",{className:"login-main",children:c.jsxs("div",{className:"login-card",children:[c.jsx(Vl,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?c.jsxs("div",{className:"login-provider-error",role:"alert",children:[c.jsx("p",{children:s}),c.jsx("button",{type:"button",onClick:()=>o(h=>h+1),children:"重试"})]}):n===null?null:n.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"login-sub",children:"登录以继续使用"}),c.jsx("div",{className:"login-providers",children:n.map(h=>c.jsxs("button",{className:"login-btn",onClick:()=>qF(h.loginUrl),children:[Eue(h.id),c.jsxs("span",{children:["使用 ",h.label," 登录"]})]},h.id))})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),c.jsxs("form",{className:"login-name",onSubmit:h=>{h.preventDefault(),f()},children:[c.jsx("input",{className:"login-name-input",value:l,onChange:h=>u(h.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16,autoFocus:!0}),c.jsx("button",{type:"submit",className:"login-name-go",disabled:!d,"aria-label":"进入",children:c.jsx(EI,{className:"icon"})})]}),c.jsx("p",{className:"login-hint","aria-live":"polite",children:l&&!d?"只能包含大小写字母和数字,最多 16 位。":""})]}),c.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),c.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",c.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),c.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function wue({node:e,ctx:t}){const n=e.variant??"default";return c.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}so("Button",wue);function vue({node:e,ctx:t}){return c.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}so("Card",vue);const _ue={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},Tue={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function mP(e){return _ue[e]??"flex-start"}function gP(e){return Tue[e]??"stretch"}function kue({node:e,ctx:t}){const n=e.children??[];return c.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:mP(e.justify),alignItems:gP(e.align)},children:n.map(r=>t.render(r))})}so("Column",kue);function Nue({node:e}){const t=e.axis==="vertical";return c.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}so("Divider",Nue);const Sue={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function Aue({node:e}){const t=e.name??"";return c.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:Sue[t]??"•"})}so("Icon",Aue);function Cue({node:e,ctx:t}){const n=e.children??[];return c.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:mP(e.justify),alignItems:gP(e.align??"center")},children:n.map(r=>t.render(r))})}so("Row",Cue);const Iue=new Set(["h1","h2","h3","h4","h5"]);function Rue({node:e,ctx:t}){const n=e.variant??"body",r=t.resolveString(e.text),s=Iue.has(n)?n:"p";return c.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:r})}so("Text",Rue);const Oue="创建 Agent",Lue={intelligent:"智能模式",custom:"自定义",template:"从模板新建",workflow:"工作流"},wo={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},Mue=new Set,Due=[];function $s(){return{skills:[]}}function Pue(e,t){var r;const n=aR(e==null?void 0:e.events);if(n!=="新会话")return n;for(const s of t){if(s.role!=="user")continue;const i=(r=s.blocks.find(a=>a.kind==="text"))==null?void 0:r.text.trim();if(i)return i}return"新会话"}function yP(e,t){if(e.name===t)return e;for(const n of e.children){const r=yP(n,t);if(r)return r}}function bP(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...bP(n)));return t}function vS(){const e=typeof localStorage<"u"?localStorage.getItem(wo.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function jue({className:e}){return c.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[c.jsx("ellipse",{cx:"12",cy:"12",rx:"6.6",ry:"8.2"}),c.jsx("path",{d:"M12 8.2l1.05 2.75 2.75 1.05-2.75 1.05L12 15.8l-1.05-2.75L8.2 12l2.75-1.05z",fill:"currentColor",stroke:"none"})]})}function Bue(){return c.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[c.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),c.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),c.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function EP(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function Fue(e){if(!e)return"";const t=[];return e.ts&&t.push(EP(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function Uue(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}const $ue="send_a2ui_json_to_client";function Hue(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"?t.files.length>0:t.kind==="tool"?!(t.name===$ue&&t.done):t.kind==="a2ui"?nM(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function zue(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function Vue(e){return new Promise((t,n)=>{let r="";try{r=new URL(e,window.location.href).protocol}catch{}if(r!=="http:"&&r!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let i=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",l)},o=d=>{if(!i){i=!0,a();try{s.close()}catch{}t(d)}},l=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&o(f.url)};window.addEventListener("message",l);const u=setInterval(()=>{if(!i){if(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(i=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&o(d)}catch{}}},500)})}function Kue(e,t){const n=JSON.parse(JSON.stringify(e??{})),r=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=r.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,r.oauth2=s,n.exchangedAuthCredential=r,n}function _S({text:e}){const[t,n]=v.useState(!1);return c.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?c.jsx(Ds,{className:"icon"}):c.jsx(_E,{className:"icon"})})}function Yue(e){return e==="cn-beijing"?"华北 2(北京)":e==="cn-shanghai"?"华东 2(上海)":e||"未指定"}function Wue({tasks:e,onCancel:t}){const[n,r]=v.useState(!1),[s,i]=v.useState(null),a=e.filter(f=>f.status==="running").length,o=e[0],l=a>0?"running":(o==null?void 0:o.status)??"idle",u=a>0?`${a} 个部署任务进行中`:(o==null?void 0:o.status)==="success"?"最近部署已完成":(o==null?void 0:o.status)==="error"?"最近部署失败":(o==null?void 0:o.status)==="cancelled"?"最近部署已取消":"部署任务",d=f=>{i(f.id),t(f).finally(()=>i(null))};return c.jsxs("div",{className:"global-deploy-center",children:[c.jsxs("button",{type:"button",className:`global-deploy-task is-${l}`,"aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(f=>!f),children:[l==="running"?c.jsx(wt,{className:"global-deploy-task-icon spin"}):l==="success"?c.jsx(oF,{className:"global-deploy-task-icon"}):l==="error"?c.jsx(_I,{className:"global-deploy-task-icon"}):l==="cancelled"?c.jsx(lF,{className:"global-deploy-task-icon"}):c.jsx(TF,{className:"global-deploy-task-icon"}),c.jsx("span",{className:"global-deploy-task-detail",children:u}),c.jsx(ip,{className:`global-deploy-task-chevron${n?" is-open":""}`})]}),n&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"global-deploy-task-scrim","aria-label":"关闭部署任务",onClick:()=>r(!1)}),c.jsxs("section",{className:"global-deploy-popover",role:"dialog","aria-label":"部署任务",children:[c.jsxs("header",{className:"global-deploy-popover-head",children:[c.jsx("span",{children:"部署任务"}),c.jsx("span",{children:e.length})]}),c.jsx("div",{className:"global-deploy-list",children:e.length===0?c.jsx("div",{className:"global-deploy-empty",children:"暂无部署任务"}):e.map(f=>{const h=`${f.label}${f.status==="running"&&typeof f.pct=="number"?` ${Math.round(f.pct)}%`:""}`;return c.jsxs("article",{className:`global-deploy-item is-${f.status}`,children:[c.jsxs("div",{className:"global-deploy-item-head",children:[c.jsx("span",{className:"global-deploy-runtime-name",children:f.runtimeName}),c.jsx("span",{className:"global-deploy-status",children:h})]}),c.jsxs("dl",{className:"global-deploy-meta",children:[c.jsxs("div",{children:[c.jsx("dt",{children:"Runtime 名称"}),c.jsx("dd",{children:f.runtimeName})]}),c.jsxs("div",{children:[c.jsx("dt",{children:"部署地域"}),c.jsx("dd",{children:Yue(f.region)})]}),f.runtimeId&&c.jsxs("div",{children:[c.jsx("dt",{children:"Runtime ID"}),c.jsx("dd",{children:f.runtimeId})]})]}),f.message&&f.status==="error"?c.jsx(Ap,{className:"global-deploy-error",message:f.message,onRetry:f.retry}):f.message?c.jsx("p",{className:"global-deploy-message",children:f.message}):null,f.status==="running"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"global-deploy-progress","aria-hidden":!0,children:c.jsx("span",{style:{width:`${Math.max(6,Math.min(100,f.pct??6))}%`}})}),c.jsx("div",{className:"global-deploy-item-actions",children:c.jsx("button",{type:"button",disabled:s===f.id,onClick:()=>d(f),children:s===f.id?"取消中…":"取消部署"})})]})]},f.id)})})]})]})]})}const TS=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],kS=()=>TS[Math.floor(Math.random()*TS.length)];function $0(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function que(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Gue(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}function Xue(){const[e,t]=v.useState([]),[n,r]=v.useState(""),[s,i]=v.useState([]),[a,o]=v.useState(""),l=v.useRef(null),[u,d]=v.useState(!1),[f,h]=v.useState([]),[p,m]=v.useState(null),[b,w]=v.useState([]),[g,E]=v.useState(!1),[y,_]=v.useState(!1),[k,T]=v.useState("confirm"),[C,N]=v.useState(""),R=v.useRef(null),I=v.useRef(null),[M,B]=v.useState({}),Y=a?M[a]??[]:f,P=p?b:Y,U=p?"灵光一现":Pue(s.find(q=>q.id===a),P),A=(q,ee)=>B(xe=>({...xe,[q]:typeof ee=="function"?ee(xe[q]??[]):ee})),[L,O]=v.useState(""),[j,S]=v.useState("agent"),[H,V]=v.useState({}),[D,ne]=v.useState(null),[J,re]=v.useState(!1),de=v.useRef(0),[G,W]=v.useState([]),[ae,he]=v.useState($s),[Z,ce]=v.useState(null),[Ce,Ee]=v.useState(!1),ge=v.useRef(new Set),[Me,ve]=v.useState(()=>new Set),$e=v.useRef(new Map),Re=(q,ee)=>ve(xe=>{const Be=new Set(xe);return ee?Be.add(q):Be.delete(q),Be}),oe=v.useRef(""),[_t,we]=v.useState(""),[Tt,ct]=v.useState(!1),[K,X]=v.useState(kS),[le,ke]=v.useState(null),[Oe,ut]=v.useState(null),[We,ot]=v.useState(""),[Xt,It]=v.useState(),[Ge,bt]=v.useState(null),[$t,Tn]=v.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[Ue,rt]=v.useState("cloud"),[tt,gt]=v.useState(Lu),[ue,Le]=v.useState("chat"),[Qe,on]=v.useState(!1),[ln,ie]=v.useState(!1),[_e,ye]=v.useState(!1),[Pe,He]=v.useState({}),[qe,yt]=v.useState({}),[Rt,Ot]=v.useState({}),gn=Me.has(a)||u,Ht=p?g:gn,kn=Pe[a]??"",Jn=qe[a]??Mue,wr=Rt[a]??Due,Dn=Z==null?void 0:Z.graph,Hn=ae.targetAgent&&Dn?yP(Dn,ae.targetAgent.name):Dn,er=(Hn==null?void 0:Hn.skills)??(ae.targetAgent?[]:(Z==null?void 0:Z.skills)??[]),vr=Dn?bP(Dn):[];function zt(q){$0(q);for(const ee of q)ee.status==="uploading"?ge.current.add(ee.id):ee.uri&&lh(n,ee.uri).catch(xe=>we(String(xe)))}function Nn(){de.current+=1;const q=D;ne(null),re(!1),q&&!q.id.startsWith("pending-")&&Kce(q.id).catch(ee=>{we(ee instanceof Error?ee.message:String(ee))})}async function Pn(q){try{await n1(n,We,q),await t1(n,We,q),i(ee=>ee.filter(xe=>xe.id!==q)),B(ee=>{const{[q]:xe,...Be}=ee;return Be})}catch(ee){we(String(ee))}}function tr(q){const ee=G.find(Ke=>Ke.id===q);if(!ee)return;const xe=G.filter(Ke=>Ke.id!==q);$0([ee]),ee.status==="uploading"&&ge.current.add(q),W(xe),xe.length===0&&!L.trim()&&!!a&&P.length===0?(oe.current="",o(""),Pn(a)):ee.uri&&lh(n,ee.uri).catch(Ke=>we(String(Ke)))}const zn=(q,ee)=>{var Ye,Ve,Ze,Se,mt;const xe=ee.author&&ee.author!=="user"?ee.author:void 0;xe&&(He(Nt=>({...Nt,[q]:xe})),yt(Nt=>({...Nt,[q]:new Set(Nt[q]??[]).add(xe)})),Ot(Nt=>{var Lt;return(Lt=Nt[q])!=null&&Lt.length?Nt:{...Nt,[q]:[xe]}}));const Be=((Ye=ee.actions)==null?void 0:Ye.transferToAgent)??((Ve=ee.actions)==null?void 0:Ve.transfer_to_agent);Be&&Ot(Nt=>{const Lt=Nt[q]??[];return Lt[Lt.length-1]===Be?Nt:{...Nt,[q]:[...Lt,Be]}}),(((Ze=ee.actions)==null?void 0:Ze.endOfAgent)??((Se=ee.actions)==null?void 0:Se.end_of_agent)??((mt=ee.actions)==null?void 0:mt.escalate))&&Ot(Nt=>{const Lt=Nt[q]??[];return Lt.length<=1?Nt:{...Nt,[q]:Lt.slice(0,-1)}})},[Sn,st]=v.useState(vS),[An,jt]=v.useState([]),Qt=v.useCallback(q=>{jt(ee=>{const xe=ee.findIndex(Ke=>Ke.id===q.id);if(xe===-1)return[q,...ee];const Be=[...ee];return Be[xe]={...Be[xe],...q},Be})},[]),Cn=v.useCallback(async q=>{try{await GI(q.id),jt(ee=>ee.map(xe=>xe.id===q.id?{...xe,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"}:xe))}catch(ee){const xe=ee instanceof Error?ee.message:String(ee);jt(Be=>Be.map(Ke=>Ke.id===q.id?{...Ke,message:`取消失败:${xe}`}:Ke))}},[]),[jn,xn]=v.useState(!0),[te,Ne]=v.useState(!1),[Ie,je]=v.useState(!1),[Et,ht]=v.useState(!1),[Zt,xt]=v.useState(null),[In,kt]=v.useState(!1),[Ym,_r]=v.useState(!1),na=v.useRef(null),[Ql,Zl]=v.useState(()=>{const q=Gs();return zl(q),q}),[Pd,jd]=v.useState(!1),Wm=v.useRef(!1),Bd=v.useRef(!1);function Fd(q){console.log("create agent draft:",q),st(null),ao()}function rw(q,ee){console.log("Agent added, navigating to:",q,ee),Zl(Gs()),st(null),r(q)}const{ref:xP,onScroll:wP}=rM(P),qm=v.useCallback(()=>{ut(null),XF().then(q=>{ot(q.userId),It(q.info),ie(!!q.local),ke(q.status)}).catch(q=>{ut(q instanceof Error?q.message:String(q))})},[]);v.useEffect(()=>{qm()},[qm]),v.useEffect(()=>{ln&&We&&H_(We)},[ln,We]),v.useEffect(()=>{if(le!=="authenticated"||!We){V({});return}let q=!1;return Promise.allSettled([uue(),due()]).then(([ee,xe])=>{q||V({temporaryEnabled:ee.status==="fulfilled"&&ee.value.enabled,skillCreateEnabled:xe.status==="fulfilled"&&xe.value.enabled})}),()=>{q=!0}},[le,We]),v.useEffect(()=>{if(le!=="authenticated"||!We){bt(null);return}let q=!1;return bt(null),JI().then(ee=>{q||bt(ee)}).catch(ee=>{console.warn("[app] /web/access failed; using ordinary-user access:",ee),q||bt(ZI)}),()=>{q=!0}},[le,We]),v.useEffect(()=>{QI().then(q=>{Tn(q.features),rt(q.agentsSource),gt(q.branding),Le(q.defaultView),on(!0)})},[]),v.useEffect(()=>{!Ge||!Qe||Bd.current||(Bd.current=!0,ue==="addAgent"&&Ge.capabilities.createAgents&&(st(null),Ne(!1),kt(!1),_r(!1),je(!1),ht(!0)))},[Ge,ue,Qe]),v.useEffect(()=>{Ge&&(Ge.capabilities.createAgents||(st(null),xt(null),je(!1),ht(!1),jt([])),Ge.capabilities.manageAgents||_r(!1))},[Ge]),v.useEffect(()=>{document.title=tt.title;let q=document.querySelector('link[rel~="icon"]');q||(q=document.createElement("link"),q.rel="icon",document.head.appendChild(q)),q.removeAttribute("type"),q.href=tt.logoUrl||ux},[tt]),v.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(q=>q.ok?q.json():null).then(q=>{q&&xn(!!q.credentials)}).catch(q=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",q)})},[]);function vP(q){H_(q),Wm.current=!0,Bd.current=!1,bt(null),st(null),xt(null),Ne(!1),je(!1),ht(!1),kt(!1),_r(!1),ao(),ot(q),It({name:q}),ie(!0),ke("authenticated")}function _P(){Bd.current=!1,bt(null),ln?(YF(),ot(""),It(void 0),ke("unauthenticated")):GF()}v.useEffect(()=>{le!=="unauthenticated"&&UI().then(q=>{if(t(q),Ue==="cloud"){r("");return}const ee=localStorage.getItem(wo.app),xe=Ql.flatMap(Ye=>Ye.apps.map(Ve=>Va(Ye.id,Ve))),Be=ee&&(q.includes(ee)||xe.includes(ee)),Ke=["web_search_agent","web_demo"].find(Ye=>q.includes(Ye))??q.find(Ye=>!/^\d/.test(Ye))??q[0];r(Be?ee:Ke||"")}).catch(q=>we(String(q)))},[le,Ue]),v.useEffect(()=>{n&&localStorage.setItem(wo.app,n)},[n]),v.useEffect(()=>{let q=!1;if(ce(null),he($s()),!n){Ee(!1);return}return Ee(!0),dd(n).then(ee=>{q||ce(ee)}).catch(()=>{q||ce(null)}).finally(()=>{q||Ee(!1)}),()=>{q=!0}},[n]),v.useEffect(()=>{Ge&&localStorage.setItem(wo.view,Ge.capabilities.createAgents?Sn??"chat":"chat")},[Ge,Sn]),v.useEffect(()=>{localStorage.setItem(wo.session,a),oe.current=a},[a]),v.useEffect(()=>()=>$e.current.forEach(q=>q.abort()),[]),v.useEffect(()=>()=>{var q,ee;(q=R.current)==null||q.abort(),(ee=I.current)==null||ee.abort()},[]),v.useEffect(()=>{!n||!We||(async()=>{const q=await Ud(n);if(!Wm.current){Wm.current=!0;const ee=localStorage.getItem(wo.session)||"";if(vS()===null&&ee&&q.some(xe=>xe.id===ee)){$d(ee);return}}ao()})()},[n,We]),v.useEffect(()=>{const q=na.current;q&&q.app===n&&(na.current=null,$d(q.sid))},[n]);function TP(q,ee){kt(!1),q===n?$d(ee):(na.current={app:q,sid:ee},r(q))}async function Ud(q){try{const ee=await OE(q,We),xe=await Promise.all(ee.map(Be=>{var Ke;return(Ke=Be.events)!=null&&Ke.length?Promise.resolve(Be):cp(q,We,Be.id)}));return i(xe),xe}catch(ee){return we(String(ee)),[]}}function kP(){p||(we(""),N(""),T("confirm"),_(!0))}function NP(){var q;(q=R.current)==null||q.abort(),R.current=null,_(!1),T("confirm"),N(""),!p&&j==="temporary"&&S("agent")}async function SP(){var ee;(ee=R.current)==null||ee.abort();const q=new AbortController;R.current=q,T("loading"),N("");try{const xe=await F0.startSession({signal:q.signal});if(R.current!==q)return;oe.current="",o(""),h([]),O(""),he($s()),S("temporary"),Nn(),re(!1),zt(G),W([]),w([]),m(xe),st(null),Ne(!1),je(!1),ht(!1),kt(!1),_r(!1),_(!1),T("confirm")}catch(xe){if((xe==null?void 0:xe.name)==="AbortError"||R.current!==q)return;N(xe instanceof Error?xe.message:String(xe)),T("error")}finally{R.current===q&&(R.current=null)}}function ra(){var ee;(ee=I.current)==null||ee.abort(),I.current=null,E(!1),w([]),O(""),we(""),S("agent");const q=p;m(null),q&&F0.closeSession(q.id).catch(xe=>we(String(xe)))}async function AP(q){var Ke;const ee=p;if(!ee||g||!q.trim())return;we("");const xe=new AbortController;(Ke=I.current)==null||Ke.abort(),I.current=xe;const Be=[{role:"user",blocks:[{kind:"text",text:q}],meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];w(Ye=>[...Ye,...Be]),E(!0);try{const Ye=await F0.sendMessage({sessionId:ee.id,text:q},{signal:xe.signal,onBlocks:Ve=>{I.current===xe&&w(Ze=>{const Se=Ze.slice(),mt=Se[Se.length-1];return(mt==null?void 0:mt.role)==="assistant"&&(Se[Se.length-1]={...mt,blocks:Ve}),Se})}});if(I.current!==xe)return;w(Ve=>{const Ze=Ve.slice(),Se=Ze[Ze.length-1];return(Se==null?void 0:Se.role)==="assistant"&&(Ze[Ze.length-1]={...Se,blocks:Ye.blocks,meta:{ts:Date.now()/1e3}}),Ze})}catch(Ye){if((Ye==null?void 0:Ye.name)==="AbortError"||I.current!==xe)return;w(Ve=>Ve.slice(0,-2)),O(q),we(`临时会话发送失败:${Ye instanceof Error?Ye.message:String(Ye)}`)}finally{I.current===xe&&(I.current=null,E(!1))}}function ao(){ra(),we(""),X(kS()),S("agent"),Nn(),re(!1);const q=a&&Y.length===0&&G.length>0?a:"";oe.current="",o(""),d(!1),h([]),he($s()),zt(G),W([]),q&&Pn(q)}async function CP(q){var ee;try{(ee=$e.current.get(q))==null||ee.abort(),await n1(n,We,q),await t1(n,We,q),B(xe=>{const{[q]:Be,...Ke}=xe;return Ke}),q===a&&ao(),await Ud(n)}catch(xe){we(String(xe))}}async function $d(q){if(p&&ra(),q!==a&&(oe.current=q,we(""),d(!1),h([]),S("agent"),Nn(),he($s()),o(q),M[q]===void 0)){ye(!0);try{const ee=await cp(n,We,q);A(q,uU(ee.events??[]))}catch(ee){we(String(ee))}finally{ye(!1)}}}async function sw(q=!0){if(a)return a;l.current||(l.current=lp(n,We));const ee=l.current;try{const xe=await ee;q&&o(xe);const Be=Date.now()/1e3,Ke={id:xe,lastUpdateTime:Be,events:[]};return i(Ye=>[Ke,...Ye.filter(Ve=>Ve.id!==xe)]),xe}finally{l.current===ee&&(l.current=null)}}async function IP(q){we("");let ee;try{ee=await sw()}catch(Be){we(String(Be));return}const xe=Array.from(q).map(Be=>({file:Be,attachment:{id:que(),mimeType:Gue(Be),name:Be.name,sizeBytes:Be.size,status:"uploading"}}));W(Be=>[...Be,...xe.map(Ke=>Ke.attachment)]),await Promise.all(xe.map(async({file:Be,attachment:Ke})=>{try{const Ye=await $I(n,We,ee,Be);if(ge.current.delete(Ke.id)){Ye.uri&&await lh(n,Ye.uri);return}W(Ve=>Ve.map(Ze=>Ze.id===Ke.id?Ye:Ze))}catch(Ye){if(ge.current.delete(Ke.id))return;const Ve=Ye instanceof Error?Ye.message:String(Ye);W(Ze=>Ze.map(Se=>Se.id===Ke.id?{...Se,status:"error",error:Ve}:Se)),we(Ve)}}))}async function iw(q,ee=[],xe=$s()){if(!q.trim()&&ee.length===0||gn||!n||!We)return;we("");const Be=[];(xe.skills.length>0||xe.targetAgent)&&Be.push({kind:"invocation",value:xe}),ee.length&&Be.push({kind:"attachment",files:ee.map(Se=>({id:Se.id,mimeType:Se.mimeType,data:Se.data,uri:Se.uri,name:Se.name,sizeBytes:Se.sizeBytes}))}),q.trim()&&Be.push({kind:"text",text:q});const Ke=[{role:"user",blocks:Be,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],Ye=!a;Ye&&(h(Ke),d(!0));let Ve;try{Ve=await sw(!Ye)}catch(Se){Ye&&(h([]),d(!1),O(q),he(xe)),we(String(Se));return}A(Ve,Se=>Ye?Ke:[...Se,...Ke]),Ye&&(oe.current=Ve,o(Ve),h([]),d(!1));const Ze=new AbortController;$e.current.set(Ve,Ze),Re(Ve,!0),oe.current=Ve,He(Se=>({...Se,[Ve]:""})),yt(Se=>({...Se,[Ve]:new Set})),Ot(Se=>({...Se,[Ve]:[]}));try{let Se=qs(),mt=0,Nt=Date.now()/1e3;for await(const Lt of Ou({appName:n,userId:We,sessionId:Ve,text:q,attachments:ee,invocation:xe,signal:Ze.signal})){if(Ze.signal.aborted)break;const hi=Lt.error??Lt.errorMessage??Lt.error_message;if(typeof hi=="string"&&hi){oe.current===Ve&&we(hi);break}zn(Ve,Lt),Se=pl(Se,Lt);const oo=Lt.usageMetadata??Lt.usage_metadata;oo!=null&&oo.totalTokenCount&&(mt=oo.totalTokenCount),Lt.timestamp&&(Nt=Lt.timestamp);const Zm=Se.blocks,ia={tokens:mt||void 0,ts:Nt};A(Ve,aa=>{const pi=aa.slice(),Vd=pi[pi.length-1];return(Vd==null?void 0:Vd.role)==="assistant"&&(pi[pi.length-1]={...Vd,blocks:Zm,meta:ia}),pi})}Ud(n)}catch(Se){(Se==null?void 0:Se.name)!=="AbortError"&&!Ze.signal.aborted&&oe.current===Ve&&we(String(Se))}finally{$e.current.get(Ve)===Ze&&$e.current.delete(Ve),Re(Ve,!1),He(Se=>({...Se,[Ve]:""})),Ot(Se=>({...Se,[Ve]:[]}))}}function RP(q,ee){var Ke,Ye;const xe=((Ke=q==null?void 0:q.event)==null?void 0:Ke.name)??ee.id,Be=((Ye=q==null?void 0:q.event)==null?void 0:Ye.context)??{};iw(`[ui-action] ${xe}: ${JSON.stringify(Be)}`)}async function OP(q){if(!q.authUri)throw new Error("事件中没有授权地址。");if(!n||!We||!a)throw new Error("会话尚未就绪。");const ee=a,xe=await Vue(q.authUri),Be=Kue(q.authConfig,xe),Ke=Se=>Se.map(mt=>mt.kind==="auth"&&!mt.done?{...mt,done:!0}:mt);A(ee,Se=>{const mt=Se.slice(),Nt=mt[mt.length-1];return(Nt==null?void 0:Nt.role)==="assistant"&&(mt[mt.length-1]={...Nt,blocks:Ke(Nt.blocks)}),mt});const Ye=P[P.length-1],Ve=Ke(Ye&&Ye.role==="assistant"?Ye.blocks:[]),Ze=new AbortController;$e.current.set(ee,Ze),Re(ee,!0);try{let Se=qs(),mt=0,Nt=Date.now()/1e3;for await(const Lt of Ou({appName:n,userId:We,sessionId:a,text:"",functionResponses:[{id:q.callId,name:"adk_request_credential",response:Be}],signal:Ze.signal})){if(Ze.signal.aborted)break;zn(ee,Lt),Se=pl(Se,Lt);const hi=Lt.usageMetadata??Lt.usage_metadata;hi!=null&&hi.totalTokenCount&&(mt=hi.totalTokenCount),Lt.timestamp&&(Nt=Lt.timestamp);const oo=[...Ve,...Se.blocks];A(ee,Zm=>{var pi;const ia=Zm.slice(),aa=ia[ia.length-1];return(aa==null?void 0:aa.role)==="assistant"&&(ia[ia.length-1]={...aa,blocks:oo,meta:{tokens:mt||((pi=aa.meta)==null?void 0:pi.tokens),ts:Nt}}),ia})}Ud(n)}catch(Se){(Se==null?void 0:Se.name)!=="AbortError"&&!Ze.signal.aborted&&oe.current===ee&&we(String(Se))}finally{$e.current.get(ee)===Ze&&$e.current.delete(ee),Re(ee,!1),He(Se=>({...Se,[ee]:""})),Ot(Se=>({...Se,[ee]:[]}))}}if(Oe)return c.jsxs("div",{className:"boot boot-error",children:[c.jsx("p",{children:Oe}),c.jsx("button",{type:"button",onClick:qm,children:"重试"})]});if(le===null)return c.jsx("div",{className:"boot"});if(le==="unauthenticated")return c.jsx(xue,{branding:tt,onUsername:vP});if(!Ge)return c.jsx("div",{className:"boot"});const sa=Ge.capabilities.createAgents,aw=Ge.capabilities.manageAgents,Es=sa?Sn:null,Gm=sa&&Et,Xm=sa&&Ie,ow=aw&&Ym,lw=KL(e,Ql),Hd=q=>{var ee;return((ee=lw.find(xe=>xe.id===q))==null?void 0:ee.label)??q},Jl=Ql.find(q=>q.runtimeId&&q.apps.some(ee=>Va(q.id,ee)===n)),zd=Jl&&Jl.runtimeId?{runtimeId:Jl.runtimeId,name:Jl.name,region:Jl.region??"cn-beijing"}:void 0,Qm=q=>{Zl(Gs()),oe.current="",o(""),r(q)},LP=async q=>{const ee=await cx(q.runtimeId,q.name,q.region);Qm(ee)};return c.jsxs("div",{className:"layout",children:[c.jsx(DZ,{branding:tt,access:Ge,agentsSource:Ue,localApps:e,currentAgentId:n,currentAgentLabel:n?Hd(n):"",currentRuntime:zd,onSelectAgent:Qm,features:$t,sessions:s,currentSessionId:a,streamingSids:Me,onNewChat:()=>{st(null),Ne(!1),je(!1),ht(!1),kt(!1),_r(!1),ao()},onSearch:()=>{p&&ra(),st(null),Ne(!1),je(!1),ht(!1),_r(!1),kt(!0),we("")},onQuickCreate:()=>{if(!sa){we("当前账号没有添加 Agent 的权限。");return}p&&ra(),oe.current="",o(""),Ne(!1),je(!1),kt(!1),_r(!1),st(null),xt(null),ht(!0),we("")},onSkillCenter:()=>{p&&ra(),st(null),je(!1),ht(!1),kt(!1),_r(!1),Ne(!0),we("")},onAddAgent:()=>{if(!sa){we("当前账号没有添加 Agent 的权限。");return}p&&ra(),oe.current="",st(null),Ne(!1),kt(!1),_r(!1),o(""),ht(!1),je(!0),we("")},onManageAgents:()=>{if(!aw){we("当前账号没有管理 Agent 的权限。");return}p&&ra(),oe.current="",o(""),st(null),Ne(!1),je(!1),ht(!1),kt(!1),_r(!0),we("")},onPickSession:q=>{st(null),Ne(!1),je(!1),ht(!1),kt(!1),_r(!1),we(""),$d(q)},onDeleteSession:CP,userInfo:Xt,onLogout:_P}),(()=>{const q=c.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&c.jsx(pue,{onExit:ao}),c.jsx(bJ,{sessionId:p?p.id:a,sessionInitializing:!p&&u,appName:n,agentName:p?"AgentKit 沙箱":n?Hd(n):"Agent",value:L,onChange:O,onSubmit:()=>{if(!p&&j==="skill-create"){const Ke=L.trim();if(!Ke||J)return;const Ye={id:`pending-${Date.now()}`,prompt:Ke,status:"provisioning",candidates:gx.map((Ze,Se)=>({id:`pending-${Se}`,model:Ze,modelLabel:Ze,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};re(!0);const Ve=++de.current;we(""),ne(Ye),O(""),zce(Ke,Ze=>{de.current===Ve&&ne(Ze)}).then(Ze=>{de.current===Ve&&ne(Ze)}).catch(Ze=>{de.current===Ve&&(ne(null),O(Ke),we(Ze instanceof Error?Ze.message:String(Ze)))}).finally(()=>{de.current===Ve&&re(!1)});return}const ee=L;if(O(""),p){AP(ee);return}const xe=G,Be=ae;W([]),he($s()),iw(ee,xe,Be),$0(xe)},disabled:p?!1:!We||j==="temporary"||j==="agent"&&!n,busy:p?g:j==="skill-create"?J:gn,showMeta:P.length>0&&!p,attachments:p?[]:G,skills:p?[]:er,agents:p?[]:vr,invocation:p?$s():ae,capabilitiesLoading:!p&&Ce,allowAttachments:!p,onInvocationChange:he,onAddFiles:IP,onRemoveAttachment:tr,newChatMode:p?"agent":j,newChatLayout:!p&&P.length===0&&D===null,showModeSelector:!p&&P.length===0&&D===null&&sa,temporaryEnabled:H.temporaryEnabled,skillCreateEnabled:H.skillCreateEnabled,onModeChange:ee=>{if(!(ee==="temporary"&&!H.temporaryEnabled||ee==="skill-create"&&!H.skillCreateEnabled)){if(ee==="temporary"){S(ee),kP();return}if(S(ee),we(""),ee==="skill-create"){he($s());const xe=a&&Y.length===0&&G.length>0?a:"";zt(G),W([]),xe&&(oe.current="",o(""),Pn(xe))}}}})]});return c.jsxs("section",{className:"main-shell",children:[c.jsx(PZ,{apps:lw.map(ee=>ee.id),appName:n,onAppChange:Qm,agentLabel:Hd,title:Gm?"添加 Agent":Xm?"添加 AgentKit 智能体":te?void 0:In?"搜索":ow?"管理 Agent":Es?void 0:U,crumbs:te?[{label:"技能中心"},{label:"AgentKit Skill 空间"}]:In||Xm||Gm||!Es?void 0:Es==="menu"?[{label:Oue,onClick:()=>{st(null),xt(null),ht(!0)}},{label:"从 0 快速创建"}]:[{label:"从 0 快速创建",onClick:()=>jd(!0)},{label:Lue[Es]}],rightContent:c.jsx(Wue,{tasks:sa?An:[],onCancel:Cn})}),c.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[_t&&c.jsx("div",{className:"error",children:_t}),_e&&c.jsxs("div",{className:"session-loading",children:[c.jsx(wt,{className:"icon spin"})," 加载会话…"]}),ow?c.jsx($Z,{currentRuntimeId:zd==null?void 0:zd.runtimeId,onConnect:LP}):Gm?c.jsx(dM,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:jue,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{ht(!1),xt(null),st("menu")}}]}):In?c.jsx(fZ,{userId:We,appId:n,agentInfo:Z,capabilitiesLoading:Ce,agentLabel:Hd,onOpenSession:TP}):Xm?c.jsx(UZ,{onAdded:ee=>{Zl(Gs()),je(!1),r(ee)},onCancel:()=>je(!1)}):te?c.jsx(eZ,{}):Es!==null&&!jn?c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[c.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),c.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",c.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",c.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):Es==="menu"?c.jsx(qee,{onSelect:ee=>{xt(null),st(ee)},onImport:ee=>{xt(ee),st("custom")}}):Es==="intelligent"?c.jsx(wte,{userId:We,onBack:()=>st("menu"),onCreate:Fd,onAgentAdded:rw,onDeploymentTaskChange:Qt}):Es==="custom"?c.jsx(sne,{initialDraft:Zt??void 0,onBack:()=>st("menu"),onCreate:Fd,onAgentAdded:rw,features:$t,onDeploymentTaskChange:Qt}):Es==="template"?c.jsx(one,{onBack:()=>st("menu"),onCreate:Fd}):Es==="workflow"?c.jsx(Dce,{onBack:()=>st("menu"),onCreate:Fd}):P.length===0&&D?c.jsx(sue,{initialJob:D}):P.length===0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"welcome",children:[c.jsx(Vl,{as:"h1",className:"welcome-title",duration:4.8,spread:22,children:p?"让灵感在临时空间里自由生长":j==="skill-create"?"想创建一个什么 Skill?":K}),q]}),!p&&j==="agent"?c.jsx(Fk,{appName:n,activeAgent:kn,seenAgents:Jn,execPath:wr}):null]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"transcript",ref:xP,onScroll:wP,children:P.map((ee,xe)=>{var Ye;const Be=xe===P.length-1;if(ee.role==="user"){const Ve=ee.blocks.map(mt=>mt.kind==="text"?mt.text:"").join(""),Ze=ee.blocks.flatMap(mt=>mt.kind==="attachment"?mt.files:[]),Se=ee.blocks.find(mt=>mt.kind==="invocation");return c.jsxs(Wt.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Se==null?void 0:Se.kind)==="invocation"&&c.jsx(fx,{value:Se.value}),Ze.length>0&&c.jsx(px,{appName:n,items:Ze}),Ve&&c.jsx("div",{className:"bubble",children:c.jsx(wd,{text:Ve})}),c.jsxs("div",{className:"turn-actions turn-actions--right",children:[((Ye=ee.meta)==null?void 0:Ye.ts)&&c.jsx("span",{className:"meta-text",children:EP(ee.meta.ts)}),c.jsx(_S,{text:Ve})]})]},xe)}const Ke=ee.blocks.length===0;return c.jsx(Wt.div,{className:"turn turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:Ke?Be&&Ht?c.jsx(uM,{}):null:c.jsxs(c.Fragment,{children:[c.jsx(mx,{appName:n,blocks:ee.blocks,onAction:RP,onAuth:OP}),!(Be&&Ht)&&!Hue(ee)&&c.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(Be&&Ht)&&!zue(ee)&&c.jsxs("div",{className:"turn-meta",children:[c.jsxs("div",{className:"turn-actions",children:[!p&&c.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>ct(!0),children:c.jsx(Bue,{})}),c.jsx(_S,{text:Uue(ee)})]}),ee.meta&&c.jsx("span",{className:"meta-text",children:Fue(ee.meta)})]})]})},xe)})}),!p&&c.jsx(Fk,{appName:n,activeAgent:kn,seenAgents:Jn,execPath:wr}),q]})]})]})})(),Tt&&a&&c.jsx(bue,{appName:n,sessionId:a,onClose:()=>ct(!1)}),c.jsx(hue,{open:y,state:k,error:C,onCancel:NP,onConfirm:()=>void SP()}),Pd&&c.jsx("div",{className:"confirm-scrim",onClick:()=>jd(!1),children:c.jsxs("div",{className:"confirm-box",onClick:q=>q.stopPropagation(),children:[c.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),c.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),c.jsxs("div",{className:"confirm-actions",children:[c.jsx("button",{className:"confirm-btn",onClick:()=>jd(!1),children:"取消"}),c.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{xt(null),st("menu"),jd(!1)},children:"确定返回"})]})]})})]})}(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||H0.createRoot(document.getElementById("root")).render(c.jsx(et.StrictMode,{children:c.jsx(b5,{reducedMotion:"user",children:c.jsx(Q9,{maskOpacity:.9,children:c.jsx(Xue,{})})})}));export{v as A,gm as B,Rr as C,tde as D,Gc as E,za as F,GR as G,Zue as R,Qn as V,et as a,ml as b,DT as c,nde as d,$E as e,TH as f,Pu as g,dt as h,$V as i,qV as j,NH as k,Ju as l,qK as m,CV as n,IV as o,nY as p,vK as q,_K as r,aO as s,c as t,Fe as u,Ct as v,it as w,ede as x,FV as y,Ua as z}; diff --git a/veadk/webui/index.html b/veadk/webui/index.html index d157d220..bd5a634b 100644 --- a/veadk/webui/index.html +++ b/veadk/webui/index.html @@ -5,7 +5,7 @@ VeADK Studio - +